… | |
… | |
237 | |
237 | |
238 | # center: swap stats |
238 | # center: swap stats |
239 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
239 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
240 | value => $_, |
240 | value => $_, |
241 | options => [ |
241 | options => [ |
242 | [Str => 1, "Strength ($conn->{stat}{+CS_STAT_STR})"], |
242 | [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], |
243 | [Dex => 2, "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
243 | [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
244 | [Con => 3, "Constitution ($conn->{stat}{+CS_STAT_CON})"], |
244 | [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"], |
245 | [Int => 4, "Intelligence ($conn->{stat}{+CS_STAT_INT})"], |
245 | [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"], |
246 | [Wis => 5, "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], |
246 | [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], |
247 | [Pow => 6, "Power ($conn->{stat}{+CS_STAT_POW})"], |
247 | [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"], |
248 | [Cha => 7, "Charisma ($conn->{stat}{+CS_STAT_CHA})"], |
248 | [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"], |
249 | ], |
249 | ], |
250 | ), 1 .. 2; |
250 | ), 1 .. 2; |
251 | |
251 | |
252 | $table->add (2, 0, new CFClient::UI::Button |
252 | $table->add (2, 0, new CFClient::UI::Button |
253 | text => "Swap Stats", |
253 | text => "Swap Stats", |
… | |
… | |
1335 | $refresh->(); |
1335 | $refresh->(); |
1336 | |
1336 | |
1337 | $vb |
1337 | $vb |
1338 | } |
1338 | } |
1339 | |
1339 | |
1340 | sub make_help_window { |
1340 | sub help_window { |
1341 | my $win = new CFClient::UI::FancyFrame |
1341 | my $win = new CFClient::UI::FancyFrame |
1342 | x => 'center', |
1342 | x => 'center', |
1343 | y => 'center', |
1343 | y => 'center', |
1344 | z => 2, |
1344 | z => 2, |
1345 | name => 'doc_browser', |
1345 | name => 'doc_browser', |
… | |
… | |
1348 | title => "Documentation"; |
1348 | title => "Documentation"; |
1349 | |
1349 | |
1350 | $win->add (my $vbox = new CFClient::UI::VBox); |
1350 | $win->add (my $vbox = new CFClient::UI::VBox); |
1351 | |
1351 | |
1352 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1352 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1353 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1353 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1354 | expand => 1, fontsize => 0.8, padding_x => 4); |
1354 | |
1355 | |
1355 | for ( |
1356 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1357 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1358 | value => undef, |
|
|
1359 | options => [ |
1356 | [intro => "Introduction"], |
1360 | [intro => "Introduction"], |
1357 | [manual => "Manual"], |
1361 | [manual => "Manual"], |
|
|
1362 | [skill_help => "Skills"], |
1358 | [command_help => "Commands"], |
1363 | [command_help => "Commands"], |
1359 | [skill_help => "Skills"], |
1364 | [dmcommand_help => "DM Commands"], |
1360 | ) { |
1365 | [COPYING => "License Terms"], |
1361 | my ($pod, $label) = @$_; |
1366 | ], |
|
|
1367 | on_changed => sub { |
|
|
1368 | my ($self, $pod) = @_; |
1362 | |
1369 | |
1363 | $buttons->add (new CFClient::UI::Button |
|
|
1364 | text => $label, |
|
|
1365 | on_activate => sub { |
|
|
1366 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1370 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1367 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1371 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1368 | |
1372 | |
1369 | $viewer->clear; |
1373 | $viewer->clear; |
1370 | |
1374 | |
1371 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1375 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1372 | for @$pom; |
1376 | for @$pom; |
1373 | |
1377 | |
1374 | $viewer->set_offset (0); |
1378 | $viewer->set_offset (0); |
1375 | }, |
1379 | }, |
|
|
1380 | on_visibility_change => sub { |
|
|
1381 | my ($self, $visible) = @_; |
|
|
1382 | return unless $visible; |
|
|
1383 | return if $self->{value}; |
|
|
1384 | $self->set_value ("intro"); |
|
|
1385 | }, |
1376 | ); |
1386 | ); |
1377 | } |
|
|
1378 | |
|
|
1379 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1380 | |
1387 | |
1381 | $win |
1388 | $win |
1382 | } |
1389 | } |
1383 | |
1390 | |
1384 | sub sdl_init { |
1391 | sub sdl_init { |
… | |
… | |
1461 | } |
1468 | } |
1462 | }); |
1469 | }); |
1463 | $MAPWIDGET->show; |
1470 | $MAPWIDGET->show; |
1464 | $MAPWIDGET->focus_in; |
1471 | $MAPWIDGET->focus_in; |
1465 | |
1472 | |
1466 | $LOGVIEW = new CFClient::UI::TextView |
1473 | $LOGVIEW = new CFClient::UI::TextScroller |
1467 | expand => 1, |
1474 | expand => 1, |
1468 | font => $FONT_FIXED, |
1475 | font => $FONT_FIXED, |
1469 | fontsize => $::CFG->{log_fontsize}, |
1476 | fontsize => $::CFG->{log_fontsize}, |
1470 | indent => -4, |
1477 | indent => -4, |
1471 | can_hover => 1, |
1478 | can_hover => 1, |
… | |
… | |
1528 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1535 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1529 | status "Configuration Saved"; |
1536 | status "Configuration Saved"; |
1530 | }, |
1537 | }, |
1531 | ); |
1538 | ); |
1532 | |
1539 | |
1533 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1540 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1534 | tooltip => "View Documentation"); |
1541 | tooltip => "View Documentation"); |
1535 | |
1542 | |
1536 | $BUTTONBAR->add (new CFClient::UI::Button |
1543 | $BUTTONBAR->add (new CFClient::UI::Button |
1537 | text => "Quit", |
1544 | text => "Quit", |
1538 | tooltip => "Terminates the program", |
1545 | tooltip => "Terminates the program", |