ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.147 by root, Fri Apr 6 07:45:35 2007 UTC vs.
Revision 1.148 by root, Mon Apr 9 04:39:11 2007 UTC

1574 1574
1575sub show_tip_of_the_day { 1575sub show_tip_of_the_day {
1576 # find all tips 1576 # find all tips
1577 my @tod = CFPlus::Pod::find tip_of_the_day => "*"; 1577 my @tod = CFPlus::Pod::find tip_of_the_day => "*";
1578 1578
1579 my $todindex = $CFPlus::DB_STATE->get ("tip_of_the_day"); 1579 CFPlus::DB::get state => "tip_of_the_day", sub {
1580 my ($todindex) = @_;
1580 $todindex = 0 if $todindex >= @tod; 1581 $todindex = 0 if $todindex >= @tod;
1581 $CFPlus::DB_STATE->put (tip_of_the_day => $todindex + 1); 1582 CFPlus::DB::put state => tip_of_the_day => $todindex + 1, sub { };
1582 1583
1583 # create dialog 1584 # create dialog
1584 my $dialog; 1585 my $dialog;
1585 1586
1586 my $close = sub { 1587 my $close = sub {
1587 $dialog->destroy; 1588 $dialog->destroy;
1589 };
1590
1591 $dialog = new CFPlus::UI::Toplevel
1592 x => "center",
1593 y => "center",
1594 z => 3,
1595 name => 'tip_of_the_day',
1596 force_w => int $WIDTH * 4/9,
1597 force_h => int $WIDTH * 2/9,
1598 title => "Tip of the day #" . (1 + $todindex),
1599 child => my $vbox = new CFPlus::UI::VBox,
1600 has_close_button => 1,
1601 on_delete => $close,
1602 ;
1603
1604 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1605 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1606 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $tod[$todindex]);
1607
1608 $vbox->add (my $table = new CFPlus::UI::Table col_expand => [0, 1]);
1609
1610 $table->add (0, 0, new CFPlus::UI::Button
1611 text => "Close",
1612 tooltip => "Close the tip of the day window. To never see it again, disable the tip of the day in the <b>Server Setup</b>.",
1613 on_activate => $close,
1614 );
1615
1616 $table->add (2, 0, new CFPlus::UI::Button
1617 text => "Next",
1618 tooltip => "Show the next <b>Tip of the day</b>.",
1619 on_activate => sub {
1620 $close->();
1621 &show_tip_of_the_day;
1622 },
1623 );
1624
1625 $dialog->show;
1588 }; 1626 };
1589
1590 $dialog = new CFPlus::UI::Toplevel
1591 x => "center",
1592 y => "center",
1593 z => 3,
1594 name => 'tip_of_the_day',
1595 force_w => int $WIDTH * 4/9,
1596 force_h => int $WIDTH * 2/9,
1597 title => "Tip of the day #" . (1 + $todindex),
1598 child => my $vbox = new CFPlus::UI::VBox,
1599 has_close_button => 1,
1600 on_delete => $close,
1601 ;
1602
1603 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1604 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1605 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $tod[$todindex]);
1606
1607 $vbox->add (my $table = new CFPlus::UI::Table col_expand => [0, 1]);
1608
1609 $table->add (0, 0, new CFPlus::UI::Button
1610 text => "Close",
1611 tooltip => "Close the tip of the day window. To never see it again, disable the tip of the day in the <b>Server Setup</b>.",
1612 on_activate => $close,
1613 );
1614
1615 $table->add (2, 0, new CFPlus::UI::Button
1616 text => "Next",
1617 tooltip => "Show the next <b>Tip of the day</b>.",
1618 on_activate => sub {
1619 $close->();
1620 &show_tip_of_the_day;
1621 },
1622 );
1623
1624 $dialog->show;
1625} 1627}
1626 1628
1627sub sdl_init { 1629sub sdl_init {
1628 CFPlus::SDL_Init 1630 CFPlus::SDL_Init
1629 and die "SDL::Init failed!\n"; 1631 and die "SDL::Init failed!\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines