… | |
… | |
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", |
… | |
… | |
625 | &set_gauge_window_fontsize; |
625 | &set_gauge_window_fontsize; |
626 | |
626 | |
627 | $win |
627 | $win |
628 | } |
628 | } |
629 | |
629 | |
|
|
630 | sub debug_setup { |
|
|
631 | my $table = new CFClient::UI::Table; |
|
|
632 | |
|
|
633 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
|
|
634 | $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 }); |
|
|
635 | $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info"); |
|
|
636 | $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 }); |
|
|
637 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
|
|
638 | $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 }); |
|
|
639 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
|
|
640 | $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 }); |
|
|
641 | |
|
|
642 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
|
|
643 | |
|
|
644 | for my $x (0..2) { |
|
|
645 | for my $y (0 .. 2) { |
|
|
646 | $table->add ($x + 3, $y, |
|
|
647 | new CFClient::UI::Entry |
|
|
648 | text => $default_smooth[$x * 3 + $y], |
|
|
649 | on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, |
|
|
650 | ); |
|
|
651 | } |
|
|
652 | } |
|
|
653 | |
|
|
654 | |
|
|
655 | $table |
|
|
656 | } |
630 | |
657 | |
631 | sub stats_window { |
658 | sub stats_window { |
632 | my $tgw = new CFClient::UI::FancyFrame |
659 | my $tgw = new CFClient::UI::FancyFrame |
633 | y => $HEIGHT * (2/8), |
660 | y => $HEIGHT * (2/8), |
634 | x => "max", |
661 | x => "max", |
… | |
… | |
1335 | $refresh->(); |
1362 | $refresh->(); |
1336 | |
1363 | |
1337 | $vb |
1364 | $vb |
1338 | } |
1365 | } |
1339 | |
1366 | |
1340 | sub make_help_window { |
1367 | sub help_window { |
1341 | my $win = new CFClient::UI::FancyFrame |
1368 | my $win = new CFClient::UI::FancyFrame |
1342 | x => 'center', |
1369 | x => 'center', |
1343 | y => 'center', |
1370 | y => 'center', |
1344 | z => 2, |
1371 | z => 2, |
1345 | name => 'doc_browser', |
1372 | name => 'doc_browser', |
… | |
… | |
1348 | title => "Documentation"; |
1375 | title => "Documentation"; |
1349 | |
1376 | |
1350 | $win->add (my $vbox = new CFClient::UI::VBox); |
1377 | $win->add (my $vbox = new CFClient::UI::VBox); |
1351 | |
1378 | |
1352 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1379 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1353 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1380 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1381 | expand => 1, fontsize => 0.8, padding_x => 4); |
1354 | |
1382 | |
1355 | for ( |
1383 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1384 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1385 | value => undef, |
|
|
1386 | options => [ |
1356 | [intro => "Introduction"], |
1387 | [intro => "Introduction"], |
1357 | [manual => "Manual"], |
1388 | [manual => "Manual"], |
|
|
1389 | [skill_help => "Skills"], |
1358 | [command_help => "Commands"], |
1390 | [command_help => "Commands"], |
1359 | [skill_help => "Skills"], |
1391 | [dmcommand_help => "DM Commands"], |
1360 | ) { |
1392 | [COPYING => "License Terms"], |
1361 | my ($pod, $label) = @$_; |
1393 | ], |
|
|
1394 | on_changed => sub { |
|
|
1395 | my ($self, $pod) = @_; |
1362 | |
1396 | |
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", |
1397 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1367 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1398 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1368 | |
1399 | |
1369 | $viewer->clear; |
1400 | $viewer->clear; |
1370 | |
1401 | |
1371 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1402 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1372 | for @$pom; |
1403 | for @$pom; |
1373 | |
1404 | |
1374 | $viewer->set_offset (0); |
1405 | $viewer->set_offset (0); |
1375 | }, |
1406 | }, |
|
|
1407 | on_visibility_change => sub { |
|
|
1408 | my ($self, $visible) = @_; |
|
|
1409 | return unless $visible; |
|
|
1410 | return if $self->{value}; |
|
|
1411 | $self->set_value ("intro"); |
|
|
1412 | }, |
1376 | ); |
1413 | ); |
1377 | } |
|
|
1378 | |
|
|
1379 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1380 | |
1414 | |
1381 | $win |
1415 | $win |
1382 | } |
1416 | } |
1383 | |
1417 | |
1384 | sub sdl_init { |
1418 | sub sdl_init { |
… | |
… | |
1461 | } |
1495 | } |
1462 | }); |
1496 | }); |
1463 | $MAPWIDGET->show; |
1497 | $MAPWIDGET->show; |
1464 | $MAPWIDGET->focus_in; |
1498 | $MAPWIDGET->focus_in; |
1465 | |
1499 | |
1466 | $LOGVIEW = new CFClient::UI::TextView |
1500 | $LOGVIEW = new CFClient::UI::TextScroller |
1467 | expand => 1, |
1501 | expand => 1, |
1468 | font => $FONT_FIXED, |
1502 | font => $FONT_FIXED, |
1469 | fontsize => $::CFG->{log_fontsize}, |
1503 | fontsize => $::CFG->{log_fontsize}, |
1470 | indent => -4, |
1504 | indent => -4, |
1471 | can_hover => 1, |
1505 | can_hover => 1, |
… | |
… | |
1501 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1535 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1502 | . "After pressing the combo the binding will be saved automatically and the " |
1536 | . "After pressing the combo the binding will be saved automatically and the " |
1503 | . "binding editor closes"); |
1537 | . "binding editor closes"); |
1504 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1538 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1505 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1539 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1540 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
|
|
1541 | "Some debuggign options. Do not ask."); |
1506 | |
1542 | |
1507 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1543 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1508 | |
1544 | |
1509 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1545 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1510 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1546 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
… | |
… | |
1528 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1564 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1529 | status "Configuration Saved"; |
1565 | status "Configuration Saved"; |
1530 | }, |
1566 | }, |
1531 | ); |
1567 | ); |
1532 | |
1568 | |
1533 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1569 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1534 | tooltip => "View Documentation"); |
1570 | tooltip => "View Documentation"); |
1535 | |
1571 | |
1536 | $BUTTONBAR->add (new CFClient::UI::Button |
1572 | $BUTTONBAR->add (new CFClient::UI::Button |
1537 | text => "Quit", |
1573 | text => "Quit", |
1538 | tooltip => "Terminates the program", |
1574 | tooltip => "Terminates the program", |