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.112 by root, Sun Aug 13 20:01:14 2006 UTC vs.
Revision 1.117 by elmex, Tue Aug 15 06:30:05 2006 UTC

155 155
156# server query dialog 156# server query dialog
157sub server_query { 157sub server_query {
158 my ($conn, $flags, $prompt) = @_; 158 my ($conn, $flags, $prompt) = @_;
159 159
160 $conn->{query_dialog} = my $dialog = new CFPlus::UI::FancyFrame 160 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
161 x => "center", 161 x => "center",
162 y => "center", 162 y => "center",
163 title => "Server Query", 163 title => "Server Query",
164 child => my $vbox = new CFPlus::UI::VBox, 164 child => my $vbox = new CFPlus::UI::VBox,
165 ; 165 ;
663 expand => 1, 663 expand => 1,
664 scroll_y => 1 664 scroll_y => 1
665 ); 665 );
666 $r->add (my $vb = new CFPlus::UI::VBox); 666 $r->add (my $vb = new CFPlus::UI::VBox);
667 667
668 $vb->add (new CFPlus::UI::FancyFrame
669 label => "Player",
670 child => (my $pi = new CFPlus::UI::VBox),
671 );
672
668 $vb->add ($STATWIDS->{title} = new CFPlus::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 673 $pi->add ($STATWIDS->{title} = new CFPlus::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
669 can_hover => 1, can_events => 1, 674 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."); 675 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, 676 $pi->add ($STATWIDS->{map} = new CFPlus::UI::Label valign => 0, align => -1, text => "Map:", expand => 1,
672 can_hover => 1, can_events => 1, 677 can_hover => 1, can_events => 1,
673 tooltip => "The map you are currently on (if supported by the server)."); 678 tooltip => "The map you are currently on (if supported by the server).");
674 679
675 $vb->add (my $hb0 = new CFPlus::UI::HBox); 680 $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, 681 $hb0->add ($STATWIDS->{weight} = new CFPlus::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1,
677 can_hover => 1, can_events => 1, 682 can_hover => 1, can_events => 1,
678 tooltip => "The weight of the player including all inventory items."); 683 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, 684 $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, 685 can_hover => 1, can_events => 1,
681 tooltip => "The weight limit: you cannot carry more than this."); 686 tooltip => "The weight limit: you cannot carry more than this.");
682 687
688 $vb->add (new CFPlus::UI::FancyFrame
689 label => "Primary/Secondary Statistics",
683 $vb->add (my $hb = new CFPlus::UI::HBox expand => 1); 690 child => (my $hb = new CFPlus::UI::HBox expand => 1),
691 );
684 $hb->add (my $tbl = new CFPlus::UI::Table expand => 1); 692 $hb->add (my $tbl = new CFPlus::UI::Table expand => 1);
685 693
686 my $color2 = [1, 1, 0]; 694 my $color2 = [1, 1, 0];
687 695
688 for ( 696 for (
709 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFPlus::UI::Label 717 $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, 718 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0,
711 align => -1, text => $label, tooltip => "#stat_$label"); 719 align => -1, text => $label, tooltip => "#stat_$label");
712 } 720 }
713 721
722 $vb->add (new CFPlus::UI::FancyFrame
723 label => "Resistancies",
714 $vb->add (my $tbl2 = new CFPlus::UI::Table expand => 1); 724 child => (my $tbl2 = new CFPlus::UI::Table expand => 1),
725 );
715 726
716 my $row = 0; 727 my $row = 0;
717 my $col = 0; 728 my $col = 0;
718 729
719 my %resist_names = ( 730 my %resist_names = (
913sub metaserver_dialog { 924sub metaserver_dialog {
914 my $vbox = new CFPlus::UI::VBox; 925 my $vbox = new CFPlus::UI::VBox;
915 my $table = new CFPlus::UI::Table; 926 my $table = new CFPlus::UI::Table;
916 $vbox->add (new CFPlus::UI::ScrolledWindow expand => 1, child => $table); 927 $vbox->add (new CFPlus::UI::ScrolledWindow expand => 1, child => $table);
917 928
918 my $dialog = new CFPlus::UI::FancyFrame 929 my $dialog = new CFPlus::UI::Toplevel
919 title => "Server List", 930 title => "Server List",
920 name => 'metaserver_dialog', 931 name => 'metaserver_dialog',
921 x => 'center', 932 x => 'center',
922 y => 'center', 933 y => 'center',
923 z => 3, 934 z => 3,
935} 946}
936 947
937sub server_setup { 948sub server_setup {
938 my $vbox = new CFPlus::UI::VBox; 949 my $vbox = new CFPlus::UI::VBox;
939 950
951 $vbox->add (new CFPlus::UI::FancyFrame
952 label => "Connection Settings",
940 $vbox->add (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]); 953 child => (my $table = new CFPlus::UI::Table expand => 1, col_expand => [0, 1]),
954 );
941 $table->add (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port"); 955 $table->add (0, 2, new CFPlus::UI::Label valign => 0, align => 1, text => "Host:Port");
942 956
943 { 957 {
944 $table->add (1, 2, my $vbox = new CFPlus::UI::VBox); 958 $table->add (1, 2, my $vbox = new CFPlus::UI::VBox);
945 959
1040 $CFG->{say_command} = $value; 1054 $CFG->{say_command} = $value;
1041 0 1055 0
1042 } 1056 }
1043 ); 1057 );
1044 1058
1045 $vbox->add (new CFPlus::UI::Label 1059 $vbox->add (new CFPlus::UI::FancyFrame
1046 text => "Server Info", 1060 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); 1061 child => ($SERVER_INFO = new CFPlus::UI::Label ellipsise => 0),
1062 );
1053 1063
1054 $vbox 1064 $vbox
1055} 1065}
1056 1066
1057sub message_window { 1067sub message_window {
1058 my $window = new CFPlus::UI::FancyFrame 1068 my $window = new CFPlus::UI::Toplevel
1059 name => "message_window", 1069 name => "message_window",
1060 title => "Messages", 1070 title => "Messages",
1061 border_bg => [1, 1, 1, 1], 1071 border_bg => [1, 1, 1, 1],
1062 x => "max", 1072 x => "max",
1063 y => 0, 1073 y => 0,
1116 1126
1117 $window 1127 $window
1118} 1128}
1119 1129
1120sub open_string_query { 1130sub open_string_query {
1121 my $cb = $_[1]; 1131 my ($title, $cb, $txt, $tooltip) = @_;
1122 my $dialog = new CFPlus::UI::FancyFrame 1132 my $dialog = new CFPlus::UI::Toplevel
1123 x => "center", 1133 x => "center",
1124 y => "center", 1134 y => "center",
1125 z => 50, 1135 z => 50,
1126 force_w => $WIDTH * 4/5, 1136 force_w => $WIDTH * 4/5,
1127 title => $_[0]; 1137 title => $title;
1128 1138
1129 $dialog->add ( 1139 $dialog->add (
1130 my $e = new CFPlus::UI::Entry 1140 my $e = new CFPlus::UI::Entry
1131 on_activate => sub { $cb->(@_); $dialog->hide; 0 }, 1141 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
1132 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 }, 1142 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 },
1143 tooltip => $tooltip
1133 ); 1144 );
1134 1145
1135 $e->grab_focus; 1146 $e->grab_focus;
1147 $e->set_text ($txt) if $txt;
1136 $dialog->show; 1148 $dialog->show;
1137} 1149}
1138 1150
1139sub open_quit_dialog { 1151sub open_quit_dialog {
1140 unless ($QUIT_DIALOG) { 1152 unless ($QUIT_DIALOG) {
1141 $QUIT_DIALOG = new CFPlus::UI::FancyFrame 1153 $QUIT_DIALOG = new CFPlus::UI::Toplevel
1142 x => "center", 1154 x => "center",
1143 y => "center", 1155 y => "center",
1144 z => 50, 1156 z => 50,
1145 title => "Really Quit?", 1157 title => "Really Quit?",
1146 on_key_down => sub { 1158 on_key_down => sub {
1335 $PL_WINDOW->show; 1347 $PL_WINDOW->show;
1336 } 1348 }
1337} 1349}
1338 1350
1339sub player_window { 1351sub player_window {
1340 my $plwin = $PL_WINDOW = new CFPlus::UI::FancyFrame 1352 my $plwin = $PL_WINDOW = new CFPlus::UI::Toplevel
1341 x => "center", 1353 x => "center",
1342 y => "center", 1354 y => "center",
1343 force_w => $WIDTH * 9/10, 1355 force_w => $WIDTH * 9/10,
1344 force_h => $HEIGHT * 9/10, 1356 force_h => $HEIGHT * 9/10,
1345 title => "Player", 1357 title => "Player",
1434 } 1446 }
1435 } 1447 }
1436 }; 1448 };
1437 1449
1438 my $vb = new CFPlus::UI::VBox; 1450 my $vb = new CFPlus::UI::VBox;
1451 $vb->add (new CFPlus::UI::FancyFrame
1452 label => "Options",
1439 $vb->add (my $hb = new CFPlus::UI::HBox); 1453 child => (my $hb = new CFPlus::UI::HBox),
1454 );
1440 $hb->add (new CFPlus::UI::Label text => "only shift-up stops fire"); 1455 $hb->add (new CFPlus::UI::Label text => "only shift-up stops fire");
1441 $hb->add (new CFPlus::UI::CheckBox 1456 $hb->add (new CFPlus::UI::CheckBox
1442 expand => 1, 1457 expand => 1,
1443 state => $CFG->{shift_fire_stop}, 1458 state => $CFG->{shift_fire_stop},
1444 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift", 1459 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift",
1446 my ($cbox, $value) = @_; 1461 my ($cbox, $value) = @_;
1447 $CFG->{shift_fire_stop} = $value; 1462 $CFG->{shift_fire_stop} = $value;
1448 0 1463 0
1449 }); 1464 });
1450 1465
1451 $vb->add ($binding_list); 1466 $vb->add (new CFPlus::UI::FancyFrame
1467 label => "Bindings",
1468 child => $binding_list);
1452 $vb->add (my $hb = new CFPlus::UI::HBox); 1469 $vb->add (my $hb = new CFPlus::UI::HBox);
1453 1470
1454 $hb->add (new CFPlus::UI::Button 1471 $hb->add (new CFPlus::UI::Button
1455 text => "record new", 1472 text => "record new",
1456 expand => 1, 1473 expand => 1,
1489 1506
1490 $vb 1507 $vb
1491} 1508}
1492 1509
1493sub help_window { 1510sub help_window {
1494 my $win = new CFPlus::UI::FancyFrame 1511 my $win = new CFPlus::UI::Toplevel
1495 x => 'center', 1512 x => 'center',
1496 y => 'center', 1513 y => 'center',
1497 z => 2, 1514 z => 2,
1498 name => 'doc_browser', 1515 name => 'doc_browser',
1499 force_w => int $WIDTH * 7/8, 1516 force_w => int $WIDTH * 7/8,
1501 title => "Help Browser", 1518 title => "Help Browser",
1502 has_close_button => 1; 1519 has_close_button => 1;
1503 1520
1504 $win->add (my $vbox = new CFPlus::UI::VBox); 1521 $win->add (my $vbox = new CFPlus::UI::VBox);
1505 1522
1523 $vbox->add (new CFPlus::UI::FancyFrame
1524 label => "Navigation",
1506 $vbox->add (my $buttons = new CFPlus::UI::HBox); 1525 child => (my $buttons = new CFPlus::UI::HBox),
1526 );
1507 $vbox->add (my $viewer = new CFPlus::UI::TextScroller 1527 $vbox->add (my $viewer = new CFPlus::UI::TextScroller
1508 expand => 1, fontsize => 0.8, padding_x => 4); 1528 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4);
1509 1529
1510 my @history; 1530 my @history;
1511 my @future; 1531 my @future;
1512 my $curnode; 1532 my $curnode;
1513 1533
1514 my $load_node; $load_node = sub { 1534 my $load_node; $load_node = sub {
1515 my ($node) = @_; 1535 my ($node, $para) = @_;
1516 1536
1517 $buttons->clear; 1537 $buttons->clear;
1538
1539 $buttons->add (new CFPlus::UI::Button
1540 text => "⇤",
1541 tooltip => "back to the starting page",
1542 on_activate => sub {
1543 unshift @future, [$curnode, $viewer->current_paragraph] if $curnode;
1544 unshift @future, @history;
1545 @history = ();
1546 $load_node->(@{shift @future});
1547 },
1548 );
1518 1549
1519 if (@history) { 1550 if (@history) {
1520 $buttons->add (new CFPlus::UI::Button 1551 $buttons->add (new CFPlus::UI::Button
1521 text => "<", 1552 text => "",
1522 tooltip => "back to " . CFPlus::Pod::full_path_of $history[-1], 1553 tooltip => "back to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $history[-1][0]) . "</i>",
1523 on_activate => sub { 1554 on_activate => sub {
1524 unshift @future, $curnode if $curnode; 1555 unshift @future, [$curnode, $viewer->current_paragraph] if $curnode;
1525 $load_node->(pop @history); 1556 $load_node->(@{pop @history});
1557 },
1526 }); 1558 );
1527 } 1559 }
1528 1560
1529 if (@future) { 1561 if (@future) {
1530 $buttons->add (new CFPlus::UI::Button 1562 $buttons->add (new CFPlus::UI::Button
1531 text => ">", 1563 text => "",
1532 tooltip => "forward to " . CFPlus::Pod::full_path_of $future[0], 1564 tooltip => "forward to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $future[0][0]) . "</i>",
1533 on_activate => sub { 1565 on_activate => sub {
1534 push @history, $curnode; 1566 push @history, [$curnode, $viewer->current_paragraph];
1535 $load_node->(shift @future); 1567 $load_node->(@{shift @future});
1568 },
1536 }); 1569 );
1537 } 1570 }
1571
1572 $buttons->add (new CFPlus::UI::Label text => " ");
1573
1574 my @path = CFPlus::Pod::full_path_of $node;
1575 pop @path; # drop current node
1576
1577 for my $node (@path) {
1578 $buttons->add (new CFPlus::UI::Button
1579 text => $node->{kw}[0],
1580 tooltip => "go to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $node) . "</i>",
1581 on_activate => sub {
1582 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1583 $load_node->($node);
1584 },
1585 );
1586 $buttons->add (new CFPlus::UI::Label text => "/");
1587 }
1588
1589 $buttons->add (new CFPlus::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4);
1538 1590
1539 $curnode = $node; 1591 $curnode = $node;
1540 1592
1541 $viewer->clear; 1593 $viewer->clear;
1542 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $curnode); 1594 $viewer->add_paragraph (CFPlus::Pod::as_paragraphs CFPlus::Pod::section_of $curnode);
1543 $viewer->set_offset (0); 1595 $viewer->scroll_to ($para);
1544 }; 1596 };
1545 1597
1546 $load_node->(CFPlus::Pod::find pod => "mainpage"); 1598 $load_node->(CFPlus::Pod::find pod => "mainpage");
1547 1599
1548 $CFPlus::Pod::on_link = sub { 1600 $CFPlus::Pod::goto_document = sub {
1549 my (@path) = @_; 1601 my (@path) = @_;
1550 1602
1551 push @history, $curnode if $curnode; 1603 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1552 @future = ();
1553 1604
1554 $load_node->(CFPlus::Pod::find @path); 1605 $load_node->((CFPlus::Pod::find @path)[0]);
1555 $win->show; 1606 $win->show;
1556 }; 1607 };
1557 1608
1558 $win 1609 $win
1559} 1610}
1610 force_x => 0, 1661 force_x => 0,
1611 force_y => "max", 1662 force_y => "max",
1612 child => $STATUSBOX, 1663 child => $STATUSBOX,
1613 )->show; 1664 )->show;
1614 1665
1615 CFPlus::UI::FancyFrame->new ( 1666 CFPlus::UI::Toplevel->new (
1616 title => "Map", 1667 title => "Map",
1617 name => "mapmap", 1668 name => "mapmap",
1618 x => 0, 1669 x => 0,
1619 y => $FONTSIZE + 8, 1670 y => $FONTSIZE + 8,
1620 border_bg => [1, 1, 1, 192/255], 1671 border_bg => [1, 1, 1, 192/255],
1648 can_hover => 1, 1699 can_hover => 1,
1649 can_events => 1, 1700 can_events => 1,
1650 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", 1701 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.",
1651 ; 1702 ;
1652 1703
1653 $SETUP_DIALOG = new CFPlus::UI::FancyFrame 1704 $SETUP_DIALOG = new CFPlus::UI::Toplevel
1654 title => "Setup", 1705 title => "Setup",
1655 name => "setup_dialog", 1706 name => "setup_dialog",
1656 x => 'center', 1707 x => 'center',
1657 y => 'center', 1708 y => 'center',
1658 z => 2, 1709 z => 2,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines