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.114 by root, Mon Aug 14 01:21:02 2006 UTC vs.
Revision 1.117 by elmex, Tue Aug 15 06:30:05 2006 UTC

1126 1126
1127 $window 1127 $window
1128} 1128}
1129 1129
1130sub open_string_query { 1130sub open_string_query {
1131 my $cb = $_[1]; 1131 my ($title, $cb, $txt, $tooltip) = @_;
1132 my $dialog = new CFPlus::UI::Toplevel 1132 my $dialog = new CFPlus::UI::Toplevel
1133 x => "center", 1133 x => "center",
1134 y => "center", 1134 y => "center",
1135 z => 50, 1135 z => 50,
1136 force_w => $WIDTH * 4/5, 1136 force_w => $WIDTH * 4/5,
1137 title => $_[0]; 1137 title => $title;
1138 1138
1139 $dialog->add ( 1139 $dialog->add (
1140 my $e = new CFPlus::UI::Entry 1140 my $e = new CFPlus::UI::Entry
1141 on_activate => sub { $cb->(@_); $dialog->hide; 0 }, 1141 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
1142 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
1143 ); 1144 );
1144 1145
1145 $e->grab_focus; 1146 $e->grab_focus;
1147 $e->set_text ($txt) if $txt;
1146 $dialog->show; 1148 $dialog->show;
1147} 1149}
1148 1150
1149sub open_quit_dialog { 1151sub open_quit_dialog {
1150 unless ($QUIT_DIALOG) { 1152 unless ($QUIT_DIALOG) {
1528 my @history; 1530 my @history;
1529 my @future; 1531 my @future;
1530 my $curnode; 1532 my $curnode;
1531 1533
1532 my $load_node; $load_node = sub { 1534 my $load_node; $load_node = sub {
1533 my ($node) = @_; 1535 my ($node, $para) = @_;
1534 1536
1535 $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 );
1536 1549
1537 if (@history) { 1550 if (@history) {
1538 $buttons->add (new CFPlus::UI::Button 1551 $buttons->add (new CFPlus::UI::Button
1539 text => "⋘", 1552 text => "⋘",
1540 tooltip => "back to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $history[-1]) . "</i>", 1553 tooltip => "back to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $history[-1][0]) . "</i>",
1541 on_activate => sub { 1554 on_activate => sub {
1542 unshift @future, $curnode if $curnode; 1555 unshift @future, [$curnode, $viewer->current_paragraph] if $curnode;
1543 $load_node->(pop @history); 1556 $load_node->(@{pop @history});
1544 }, 1557 },
1545 ); 1558 );
1546 } 1559 }
1547 1560
1548 if (@future) { 1561 if (@future) {
1549 $buttons->add (new CFPlus::UI::Button 1562 $buttons->add (new CFPlus::UI::Button
1550 text => "⋙", 1563 text => "⋙",
1551 tooltip => "forward to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $future[0]) . "</i>", 1564 tooltip => "forward to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $future[0][0]) . "</i>",
1552 on_activate => sub { 1565 on_activate => sub {
1553 push @history, $curnode; 1566 push @history, [$curnode, $viewer->current_paragraph];
1554 $load_node->(shift @future); 1567 $load_node->(@{shift @future});
1555 }, 1568 },
1556 ); 1569 );
1557 } 1570 }
1558 1571
1559 $buttons->add (new CFPlus::UI::Label text => " "); 1572 $buttons->add (new CFPlus::UI::Label text => " ");
1564 for my $node (@path) { 1577 for my $node (@path) {
1565 $buttons->add (new CFPlus::UI::Button 1578 $buttons->add (new CFPlus::UI::Button
1566 text => $node->{kw}[0], 1579 text => $node->{kw}[0],
1567 tooltip => "go to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $node) . "</i>", 1580 tooltip => "go to <i>" . (CFPlus::asxml CFPlus::Pod::full_path $node) . "</i>",
1568 on_activate => sub { 1581 on_activate => sub {
1569 push @history, $curnode if $curnode; @future = (); 1582 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1570 $load_node->($node); 1583 $load_node->($node);
1571 }, 1584 },
1572 ); 1585 );
1573 $buttons->add (new CFPlus::UI::Label text => "/"); 1586 $buttons->add (new CFPlus::UI::Label text => "/");
1574 } 1587 }
1577 1590
1578 $curnode = $node; 1591 $curnode = $node;
1579 1592
1580 $viewer->clear; 1593 $viewer->clear;
1581 $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);
1582 $viewer->set_offset (0); 1595 $viewer->scroll_to ($para);
1583 }; 1596 };
1584 1597
1585 $load_node->(CFPlus::Pod::find pod => "mainpage"); 1598 $load_node->(CFPlus::Pod::find pod => "mainpage");
1586 1599
1587 $CFPlus::Pod::goto_document = sub { 1600 $CFPlus::Pod::goto_document = sub {
1588 my (@path) = @_; 1601 my (@path) = @_;
1589 1602
1590 push @history, $curnode if $curnode; @future = (); 1603 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1591 1604
1592 $load_node->(CFPlus::Pod::find @path); 1605 $load_node->((CFPlus::Pod::find @path)[0]);
1593 $win->show; 1606 $win->show;
1594 }; 1607 };
1595 1608
1596 $win 1609 $win
1597} 1610}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines