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.110 by root, Sun Aug 13 18:48:57 2006 UTC vs.
Revision 1.119 by root, Fri Sep 29 00:56:06 2006 UTC

47 47
48$Event::Eval = 0; 48$Event::Eval = 0;
49$Event::DIED = sub { 49$Event::DIED = sub {
50 # TODO: display dialog box or so 50 # TODO: display dialog box or so
51 Carp::cluck $_[1];#d#TODO: remove when stable 51 Carp::cluck $_[1];#d#TODO: remove when stable
52 CFPlus::error $_[1]; 52 return;#d#
53 CFPlus::fatal ($_[1]);
53}; 54};
54 55
55$SIG{__DIE__} = sub {
56 return if CFPlus::in_destruct;
57 Carp::cluck $_[0];
58 CFPlus::error $_[0];
59 return;#d#
60 #return unless defined $^S && !$^S;
61 $Event::DIED->(undef, $_[0]);
62};
63
64our $VERSION = '0.1'; 56our $VERSION = '0.9';
65 57
66my $MAX_FPS = 60; 58my $MAX_FPS = 60;
67my $MIN_FPS = 5; # unused as of yet 59my $MIN_FPS = 5; # unused as of yet
68 60
69our $META_SERVER = "crossfire.real-time.com:13326"; 61our $META_SERVER = "crossfire.real-time.com:13326";
155 147
156# server query dialog 148# server query dialog
157sub server_query { 149sub server_query {
158 my ($conn, $flags, $prompt) = @_; 150 my ($conn, $flags, $prompt) = @_;
159 151
160 $conn->{query_dialog} = my $dialog = new CFPlus::UI::FancyFrame 152 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
161 x => "center", 153 x => "center",
162 y => "center", 154 y => "center",
163 title => "Server Query", 155 title => "Server Query",
164 child => my $vbox = new CFPlus::UI::VBox, 156 child => my $vbox = new CFPlus::UI::VBox,
165 ; 157 ;
367 user => $CFG->{profile}{default}{user}, 359 user => $CFG->{profile}{default}{user},
368 pass => $CFG->{profile}{default}{password}, 360 pass => $CFG->{profile}{default}{password},
369 mapw => $mapsize, 361 mapw => $mapsize,
370 maph => $mapsize, 362 maph => $mapsize,
371 363
364 client => "cfplus $VERSION $] $^O",
365
372 map_widget => $MAPWIDGET, 366 map_widget => $MAPWIDGET,
373 logview => $LOGVIEW, 367 logview => $LOGVIEW,
374 statusbox => $STATUSBOX, 368 statusbox => $STATUSBOX,
375 map => $MAP, 369 map => $MAP,
376 mapmap => $MAPMAP, 370 mapmap => $MAPMAP,
663 expand => 1, 657 expand => 1,
664 scroll_y => 1 658 scroll_y => 1
665 ); 659 );
666 $r->add (my $vb = new CFPlus::UI::VBox); 660 $r->add (my $vb = new CFPlus::UI::VBox);
667 661
662 $vb->add (new CFPlus::UI::FancyFrame
663 label => "Player",
664 child => (my $pi = new CFPlus::UI::VBox),
665 );
666
668 $vb->add ($STATWIDS->{title} = new CFPlus::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 667 $pi->add ($STATWIDS->{title} = new CFPlus::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
669 can_hover => 1, can_events => 1, 668 can_hover => 1, can_events => 1,
670 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); 669 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server.");
671 $vb->add ($STATWIDS->{map} = new CFPlus::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, 670 $pi->add ($STATWIDS->{map} = new CFPlus::UI::Label valign => 0, align => -1, text => "Map:", expand => 1,
672 can_hover => 1, can_events => 1, 671 can_hover => 1, can_events => 1,
673 tooltip => "The map you are currently on (if supported by the server)."); 672 tooltip => "The map you are currently on (if supported by the server).");
674 673
675 $vb->add (my $hb0 = new CFPlus::UI::HBox); 674 $pi->add (my $hb0 = new CFPlus::UI::HBox);
676 $hb0->add ($STATWIDS->{weight} = new CFPlus::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, 675 $hb0->add ($STATWIDS->{weight} = new CFPlus::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1,
677 can_hover => 1, can_events => 1, 676 can_hover => 1, can_events => 1,
678 tooltip => "The weight of the player including all inventory items."); 677 tooltip => "The weight of the player including all inventory items.");
679 $hb0->add ($STATWIDS->{m_weight} = new CFPlus::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, 678 $hb0->add ($STATWIDS->{m_weight} = new CFPlus::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1,
680 can_hover => 1, can_events => 1, 679 can_hover => 1, can_events => 1,
681 tooltip => "The weight limit: you cannot carry more than this."); 680 tooltip => "The weight limit: you cannot carry more than this.");
682 681
682 $vb->add (new CFPlus::UI::FancyFrame
683 label => "Primary/Secondary Statistics",
683 $vb->add (my $hb = new CFPlus::UI::HBox expand => 1); 684 child => (my $hb = new CFPlus::UI::HBox expand => 1),
685 );
684 $hb->add (my $tbl = new CFPlus::UI::Table expand => 1); 686 $hb->add (my $tbl = new CFPlus::UI::Table expand => 1);
685 687
686 my $color2 = [1, 1, 0]; 688 my $color2 = [1, 1, 0];
687 689
688 for ( 690 for (
709 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFPlus::UI::Label 711 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFPlus::UI::Label
710 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, 712 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0,
711 align => -1, text => $label, tooltip => "#stat_$label"); 713 align => -1, text => $label, tooltip => "#stat_$label");
712 } 714 }
713 715
716 $vb->add (new CFPlus::UI::FancyFrame
717 label => "Resistancies",
714 $vb->add (my $tbl2 = new CFPlus::UI::Table expand => 1); 718 child => (my $tbl2 = new CFPlus::UI::Table expand => 1),
719 );
715 720
716 my $row = 0; 721 my $row = 0;
717 my $col = 0; 722 my $col = 0;
718 723
719 my %resist_names = ( 724 my %resist_names = (
913sub metaserver_dialog { 918sub metaserver_dialog {
914 my $vbox = new CFPlus::UI::VBox; 919 my $vbox = new CFPlus::UI::VBox;
915 my $table = new CFPlus::UI::Table; 920 my $table = new CFPlus::UI::Table;
916 $vbox->add (new CFPlus::UI::ScrolledWindow expand => 1, child => $table); 921 $vbox->add (new CFPlus::UI::ScrolledWindow expand => 1, child => $table);
917 922
918 my $dialog = new CFPlus::UI::FancyFrame 923 my $dialog = new CFPlus::UI::Toplevel
919 title => "Server List", 924 title => "Server List",
920 name => 'metaserver_dialog', 925 name => 'metaserver_dialog',
921 x => 'center', 926 x => 'center',
922 y => 'center', 927 y => 'center',
923 z => 3, 928 z => 3,
935} 940}
936 941
937sub server_setup { 942sub server_setup {
938 my $vbox = new CFPlus::UI::VBox; 943 my $vbox = new CFPlus::UI::VBox;
939 944
945 $vbox->add (new CFPlus::UI::FancyFrame
946 label => "Connection Settings",
940 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]); 947 child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]),
948 );
941 $table->add (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); 949 $table->add (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port");
942 950
943 { 951 {
944 $table->add (1, 2, my $vbox = new CFPlus::UI::VBox); 952 $table->add (1, 2, my $vbox = new CFPlus::UI::VBox);
945 953
1029 }, 1037 },
1030 ); 1038 );
1031 1039
1032 $table->add (0, 12, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command"); 1040 $table->add (0, 12, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command");
1033 $table->add (1, 12, my $saycmd = new CFPlus::UI::Entry 1041 $table->add (1, 12, my $saycmd = new CFPlus::UI::Entry
1034 text => $CFG->{say_command}, 1042 text => $CFG->{say_command},
1035 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. " 1043 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. "
1036 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " 1044 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
1037 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", 1045 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
1038 on_changed => sub { 1046 on_changed => sub {
1039 my ($self, $value) = @_; 1047 my ($self, $value) = @_;
1040 $CFG->{say_command} = $value; 1048 $CFG->{say_command} = $value;
1041 0 1049 0
1042 } 1050 }
1043 ); 1051 );
1044 1052
1053 $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day");
1054 $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox
1055 state => $CFG->{show_tips},
1056 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1057 on_changed => sub {
1058 my ($self, $value) = @_;
1059 $CFG->{shop_tips} = $value;
1060 0
1061 }
1062 );
1063
1045 $vbox->add (new CFPlus::UI::Label 1064 $vbox->add (new CFPlus::UI::FancyFrame
1046 text => "Server Info", 1065 label => "Server Info",
1047 fontsize => 1.2,
1048 padding_y => 8,
1049 fg => [1, 1, 0, 1],
1050 );
1051
1052 $vbox->add ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0); 1066 child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0),
1067 );
1053 1068
1054 $vbox 1069 $vbox
1055} 1070}
1056 1071
1057sub message_window { 1072sub message_window {
1058 my $window = new CFPlus::UI::FancyFrame 1073 my $window = new CFPlus::UI::Toplevel
1059 name => "message_window", 1074 name => "message_window",
1060 title => "Messages", 1075 title => "Messages",
1061 border_bg => [1, 1, 1, 1], 1076 border_bg => [1, 1, 1, 1],
1062 x => "max", 1077 x => "max",
1063 y => 0, 1078 y => 0,
1113 window => $window, 1128 window => $window,
1114 input => $input, 1129 input => $input,
1115 }; 1130 };
1116 1131
1117 $window 1132 $window
1118}
1119
1120sub open_string_query {
1121 my $cb = $_[1];
1122 my $dialog = new CFPlus::UI::FancyFrame
1123 x => "center",
1124 y => "center",
1125 z => 50,
1126 force_w => $WIDTH * 4/5,
1127 title => $_[0];
1128
1129 $dialog->add (
1130 my $e = new CFPlus::UI::Entry
1131 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
1132 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 },
1133 );
1134
1135 $e->grab_focus;
1136 $dialog->show;
1137}
1138
1139sub open_quit_dialog {
1140 unless ($QUIT_DIALOG) {
1141 $QUIT_DIALOG = new CFPlus::UI::FancyFrame
1142 x => "center",
1143 y => "center",
1144 z => 50,
1145 title => "Really Quit?",
1146 on_key_down => sub {
1147 my ($dialog, $ev) = @_;
1148 $ev->{sym} == 27 and $dialog->hide;
1149 }
1150 ;
1151
1152 $QUIT_DIALOG->add (my $vb = new CFPlus::UI::VBox expand => 1);
1153
1154 $vb->add (new CFPlus::UI::Label
1155 text => "You should find a savebed and apply it first!",
1156 max_w => $WIDTH * 0.25,
1157 ellipsize => 0,
1158 );
1159 $vb->add (my $hb = new CFPlus::UI::HBox expand => 1);
1160 $hb->add (new CFPlus::UI::Button
1161 text => "Ok",
1162 expand => 1,
1163 on_activate => sub { $QUIT_DIALOG->hide; 0 },
1164 );
1165 $hb->add (new CFPlus::UI::Button
1166 text => "Quit anyway",
1167 expand => 1,
1168 on_activate => sub { exit },
1169 );
1170 }
1171
1172 $QUIT_DIALOG->show;
1173 $QUIT_DIALOG->grab_focus;
1174} 1133}
1175 1134
1176sub autopickup_setup { 1135sub autopickup_setup {
1177 my $table = new CFPlus::UI::Table; 1136 my $table = new CFPlus::UI::Table;
1178 1137
1335 $PL_WINDOW->show; 1294 $PL_WINDOW->show;
1336 } 1295 }
1337} 1296}
1338 1297
1339sub player_window { 1298sub player_window {
1340 my $plwin = $PL_WINDOW = new CFPlus::UI::FancyFrame 1299 my $plwin = $PL_WINDOW = new CFPlus::UI::Toplevel
1341 x => "center", 1300 x => "center",
1342 y => "center", 1301 y => "center",
1343 force_w => $WIDTH * 9/10, 1302 force_w => $WIDTH * 9/10,
1344 force_h => $HEIGHT * 9/10, 1303 force_h => $HEIGHT * 9/10,
1345 title => "Player", 1304 title => "Player",
1434 } 1393 }
1435 } 1394 }
1436 }; 1395 };
1437 1396
1438 my $vb = new CFPlus::UI::VBox; 1397 my $vb = new CFPlus::UI::VBox;
1398 $vb->add (new CFPlus::UI::FancyFrame
1399 label => "Options",
1439 $vb->add (my $hb = new CFPlus::UI::HBox); 1400 child => (my $hb = new CFPlus::UI::HBox),
1401 );
1440 $hb->add (new CFPlus::UI::Label text => "only shift-up stops fire"); 1402 $hb->add (new CFPlus::UI::Label text => "only shift-up stops fire");
1441 $hb->add (new CFPlus::UI::CheckBox 1403 $hb->add (new CFPlus::UI::CheckBox
1442 expand => 1, 1404 expand => 1,
1443 state => $CFG->{shift_fire_stop}, 1405 state => $CFG->{shift_fire_stop},
1444 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift", 1406 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift",
1446 my ($cbox, $value) = @_; 1408 my ($cbox, $value) = @_;
1447 $CFG->{shift_fire_stop} = $value; 1409 $CFG->{shift_fire_stop} = $value;
1448 0 1410 0
1449 }); 1411 });
1450 1412
1451 $vb->add ($binding_list); 1413 $vb->add (new CFPlus::UI::FancyFrame
1414 label => "Bindings",
1415 child => $binding_list);
1452 $vb->add (my $hb = new CFPlus::UI::HBox); 1416 $vb->add (my $hb = new CFPlus::UI::HBox);
1453 1417
1454 $hb->add (new CFPlus::UI::Button 1418 $hb->add (new CFPlus::UI::Button
1455 text => "record new", 1419 text => "record new",
1456 expand => 1, 1420 expand => 1,
1489 1453
1490 $vb 1454 $vb
1491} 1455}
1492 1456
1493sub help_window { 1457sub help_window {
1494 my $win = new CFPlus::UI::FancyFrame 1458 my $win = new CFPlus::UI::Toplevel
1495 x => 'center', 1459 x => 'center',
1496 y => 'center', 1460 y => 'center',
1497 z => 2, 1461 z => 4,
1498 name => 'doc_browser', 1462 name => 'doc_browser',
1499 force_w => int $WIDTH * 7/8, 1463 force_w => int $WIDTH * 7/8,
1500 force_h => int $HEIGHT * 7/8, 1464 force_h => int $HEIGHT * 7/8,
1501 title => "Help Browser", 1465 title => "Help Browser",
1502 has_close_button => 1; 1466 has_close_button => 1;
1503 1467
1504 $win->add (my $vbox = new CFPlus::UI::VBox); 1468 $win->add (my $vbox = new CFPlus::UI::VBox);
1505 1469
1470 $vbox->add (new CFPlus::UI::FancyFrame
1471 label => "Navigation",
1506 $vbox->add (my $buttons = new CFPlus::UI::HBox); 1472 child => (my $buttons = new CFPlus::UI::HBox),
1473 );
1507 $vbox->add (my $viewer = new CFPlus::UI::TextScroller 1474 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1508 expand => 1, fontsize => 0.8, padding_x => 4); 1475 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1509 1476
1510 $buttons->add (new CFPlus::UI::Label text => "Choose a document to display: "); 1477 my @history;
1511 $buttons->add (my $combo = new CFPlus::UI::Selector 1478 my @future;
1512 value => undef, 1479 my $curnode;
1513 options => [ 1480
1514 [intro => "Introduction"], 1481 my $load_node; $load_node = sub {
1515 [manual => "Main Manual"], 1482 my ($node, $para) = @_;
1516 [skill_help => "Skill Reference"], 1483
1517 [command_help => "Command Reference"], 1484 $buttons->clear;
1518 [dmcommand_help => "DM Commands"], 1485
1519 [COPYING => "License Terms"], 1486 $buttons->add (new CFPlus::UI::Button
1487 text => "⇤",
1488 tooltip => "back to the starting page",
1489 on_activate => sub {
1490 unshift @future, [$curnode, $viewer->current_paragraph] if $curnode;
1491 unshift @future, @history;
1492 @history = ();
1493 $load_node->(@{shift @future});
1494 },
1495 );
1496
1497 if (@history) {
1498 $buttons->add (new CFPlus::UI::Button
1499 text => "⋘",
1500 tooltip => "back to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $history[-1][0]) . "</i>",
1501 on_activate => sub {
1502 unshift @future, [$curnode, $viewer->current_paragraph] if $curnode;
1503 $load_node->(@{pop @history});
1504 },
1505 );
1520 ], 1506 }
1521 on_changed => sub {
1522 my ($self, $pod) = @_;
1523 1507
1508 if (@future) {
1509 $buttons->add (new CFPlus::UI::Button
1510 text => "⋙",
1511 tooltip => "forward to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $future[0][0]) . "</i>",
1512 on_activate => sub {
1513 push @history, [$curnode, $viewer->current_paragraph];
1514 $load_node->(@{shift @future});
1515 },
1516 );
1517 }
1518
1519 $buttons->add (new CFPlus::UI::Label text => " ");
1520
1521 my @path = CFPlus::Pod::full_path_of $node;
1522 pop @path; # drop current node
1523
1524 for my $node (@path) {
1525 $buttons->add (new CFPlus::UI::Button
1526 text => $node->{kw}[0],
1527 tooltip => "go to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $node) . "</i>",
1528 on_activate => sub {
1529 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1530 $load_node->($node);
1531 },
1532 );
1533 $buttons->add (new CFPlus::UI::Label text => "/");
1534 }
1535
1536 $buttons->add (new CFPlus::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4);
1537
1538 $curnode = $node;
1539
1524 $viewer->clear; 1540 $viewer->clear;
1525 $viewer->add_paragraph (CFPlus::Pod::section_paragraphs pod => $pod); 1541 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $curnode);
1526 $viewer->set_offset (0); 1542 $viewer->scroll_to ($para);
1543 };
1527 1544
1545 $load_node->(CFPlus::Pod::find pod => "mainpage");
1546
1547 $CFPlus::Pod::goto_document = sub {
1548 my (@path) = @_;
1549
1550 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1551
1552 $load_node->((CFPlus::Pod::find @path)[0]);
1553 $win->show;
1554 };
1555
1556 $win
1557}
1558
1559sub open_string_query {
1560 my ($title, $cb, $txt, $tooltip) = @_;
1561 my $dialog = new CFPlus::UI::Toplevel
1562 x => "center",
1563 y => "center",
1564 z => 50,
1565 force_w => $WIDTH * 4/5,
1566 title => $title;
1567
1568 $dialog->add (
1569 my $e = new CFPlus::UI::Entry
1570 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
1571 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 },
1572 tooltip => $tooltip
1573 );
1574
1575 $e->grab_focus;
1576 $e->set_text ($txt) if $txt;
1577 $dialog->show;
1578}
1579
1580sub open_quit_dialog {
1581 unless ($QUIT_DIALOG) {
1582 $QUIT_DIALOG = new CFPlus::UI::Toplevel
1583 x => "center",
1584 y => "center",
1585 z => 50,
1586 title => "Really Quit?",
1587 on_key_down => sub {
1588 my ($dialog, $ev) = @_;
1589 $ev->{sym} == 27 and $dialog->hide;
1528 0 1590 }
1591 ;
1592
1593 $QUIT_DIALOG->add (my $vb = new CFPlus::UI::VBox expand => 1);
1594
1595 $vb->add (new CFPlus::UI::Label
1596 text => "You should find a savebed and apply it first!",
1597 max_w => $WIDTH * 0.25,
1598 ellipsize => 0,
1599 );
1600 $vb->add (my $hb = new CFPlus::UI::HBox expand => 1);
1601 $hb->add (new CFPlus::UI::Button
1602 text => "Ok",
1603 expand => 1,
1604 on_activate => sub { $QUIT_DIALOG->hide; 0 },
1605 );
1606 $hb->add (new CFPlus::UI::Button
1607 text => "Quit anyway",
1608 expand => 1,
1609 on_activate => sub { exit },
1610 );
1611 }
1612
1613 $QUIT_DIALOG->show;
1614 $QUIT_DIALOG->grab_focus;
1615}
1616
1617sub show_tip_of_the_day {
1618 # find all tips
1619 my @tod = CFPlus::Pod::find tip_of_the_day => "*";
1620
1621 my $todindex = $CFPlus::DB_STATE->get ("tip_of_the_day");
1622 $todindex = 0 if $todindex >= @tod;
1623 $CFPlus::DB_STATE->put (tip_of_the_day => $todindex + 1);
1624
1625 # create dialog
1626 my $dialog;
1627
1628 my $close = sub {
1629 $dialog->destroy;
1630 };
1631
1632 $dialog = new CFPlus::UI::Toplevel
1633 x => "center",
1634 y => "center",
1635 z => 3,
1636 name => 'tip_of_the_day',
1637 force_w => int $WIDTH * 4/9,
1638 force_h => int $WIDTH * 2/9,
1639 title => "Tip of the day #" . (1 + $todindex),
1640 child => my $vbox = new CFPlus::UI::VBox,
1641 has_close_button => 1,
1642 on_delete => $close,
1643 ;
1644
1645 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1646 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1647 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $tod[$todindex]);
1648
1649 $vbox->add (my $table = new CFPlus::UI::Table);
1650
1651 $table->add (0, 0, new CFPlus::UI::Button
1652 text => "Close",
1653 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>.",
1654 on_activate => $close,
1655 );
1656
1657 $table->add (2, 0, new CFPlus::UI::Button
1658 text => "Next",
1659 tooltip => "Show the next <b>Tip of the day</b>.",
1660 on_activate => sub {
1661 $close->();
1662 &show_tip_of_the_day;
1529 }, 1663 },
1530 on_visibility_change => sub {
1531 my ($self, $visible) = @_;
1532 return unless $visible;
1533 return if $self->{value};
1534 $self->set_value ("intro");
1535 0
1536 },
1537 ); 1664 );
1538 1665
1539 $win 1666 $dialog->show;
1540} 1667}
1541 1668
1542sub sdl_init { 1669sub sdl_init {
1543 CFPlus::SDL_Init 1670 CFPlus::SDL_Init
1544 and die "SDL::Init failed!\n"; 1671 and die "SDL::Init failed!\n";
1591 force_x => 0, 1718 force_x => 0,
1592 force_y => "max", 1719 force_y => "max",
1593 child => $STATUSBOX, 1720 child => $STATUSBOX,
1594 )->show; 1721 )->show;
1595 1722
1596 CFPlus::UI::FancyFrame->new ( 1723 CFPlus::UI::Toplevel->new (
1597 title => "Map", 1724 title => "Map",
1598 name => "mapmap", 1725 name => "mapmap",
1599 x => 0, 1726 x => 0,
1600 y => $FONTSIZE + 8, 1727 y => $FONTSIZE + 8,
1601 border_bg => [1, 1, 1, 192/255], 1728 border_bg => [1, 1, 1, 192/255],
1629 can_hover => 1, 1756 can_hover => 1,
1630 can_events => 1, 1757 can_events => 1,
1631 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", 1758 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.",
1632 ; 1759 ;
1633 1760
1634 $SETUP_DIALOG = new CFPlus::UI::FancyFrame 1761 $SETUP_DIALOG = new CFPlus::UI::Toplevel
1635 title => "Setup", 1762 title => "Setup",
1636 name => "setup_dialog", 1763 name => "setup_dialog",
1637 x => 'center', 1764 x => 'center',
1638 y => 'center', 1765 y => 'center',
1639 z => 2, 1766 z => 2,
1903 output_sync => 1, 2030 output_sync => 1,
1904 output_count => 1, 2031 output_count => 1,
1905 pickup => 0, 2032 pickup => 0,
1906 inv_sort => "mtime", 2033 inv_sort => "mtime",
1907 default => "profile", # default profile 2034 default => "profile", # default profile
2035 show_tips => 1,
1908 ); 2036 );
1909 2037
1910 while (my ($k, $v) = each %DEF_CFG) { 2038 while (my ($k, $v) = each %DEF_CFG) {
1911 $CFG->{$k} = $v unless exists $CFG->{$k}; 2039 $CFG->{$k} = $v unless exists $CFG->{$k};
1912 } 2040 }
1960 2088
1961 video_init; 2089 video_init;
1962 audio_init; 2090 audio_init;
1963} 2091}
1964 2092
2093show_tip_of_the_day if $CFG->{show_tips};
2094
1965Event::loop; 2095Event::loop;
1966#CFPlus::SDL_Quit; 2096#CFPlus::SDL_Quit;
1967#CFPlus::_exit 0; 2097#CFPlus::_exit 0;
1968 2098
1969END { CFPlus::SDL_Quit } 2099END { CFPlus::SDL_Quit }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines