blib/lib/Games/Axmud/PrefWin.pm untested

filter: Statementstmt 0.0% 0 / 7522 Branchbran 0.0% 0 / 2032 Conditioncond 0.0% 0 / 1596 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 283 Podpod 0.0% 0 / 259 totaltotal 0.0% 0 / 11692 CC 1017 SCAR 54.4
CC
1017
Cov
0%
chat2Tab
1332.0
checkObj
1122.0
protocolsTab2_updateWidgets
992.0
CRAP 229.3
1 # Copyright (C) 2011-2022 A S Lewis
2 #
3 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU
4 # General Public License as published by the Free Software Foundation, either version 3 of the
5 # License, or (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
8 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License along with this program. If not,
12 # see <http://www.gnu.org/licenses/>.
13 #
14 #
15 # Games::Axmud::PrefWin::XXX
16 # All 'pref' (preference) windows, inheriting from GA::Generic::ConfigWin
17  
18 { package Games::Axmud::PrefWin::Client;
19  
20 use strict;
21 use warnings;
22 use diagnostics;
23  
24 use Glib qw(TRUE FALSE);
25  
26 our @ISA = qw(
27 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
28 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
29 );
30  
31 ##################
32 # Constructors
33  
34 # Contents of $self->editConfigHash after $self->new has been called:
35 # (none, however $self->tasks1Tab and ->tasks1Tab_refreshList both store data there)
36  
37 # sub new {} # Inherited from GA::Generic::ConfigWin
38  
39 ##################
40 # Methods
41  
42 # Standard window object functions
43  
44 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
45  
46 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
47  
48 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
49  
50 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
51  
52 # sub winShowAll {} # Inherited from GA::Generic::Win
53  
54 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
55  
56 # sub redrawWidgets {} # Inherited from GA::Generic::Win
57  
58 # ->signal_connects
59  
60 # Other functions
61  
62 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
63  
64 sub enableButtons {
65  
66 # Called by $self->drawWidgets
67 # We only need a single button so, instead of calling the generic ->enableButtons, call a
68 # method that creates just one button
69 #
70 # Expected arguments
71 # $hBox - The horizontal packing box in which the buttons live (not yet stored as
72 # an IV)
73 #
74 # Return values
75 # An empty list on improper arguments
76 # Otherwise, a list containing the Gtk::Button object created
77  
78 my ($self, $hBox, $check) = @_;
79  
80 # Local variables
81 my @emptyList;
82  
83 # Check for improper arguments
84 if (! defined $hBox || defined $check) {
85  
86 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
87 return @emptyList;
88 }
89  
90 return $self->enableSingleButton($hBox);
91 }
92  
93 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
94  
95 sub setupNotebook {
96  
97 # Called by $self->enable
98 # Creates the first tab for the notebook. The remaining tabs are created by
99 # $self->expandNotebook
100 #
101 # Expected arguments
102 # (none besides $self)
103 #
104 # Return values
105 # 'undef' on improper arguments
106 # 1 otherwise
107  
108 my ($self, $check) = @_;
109  
110 # Check for improper arguments
111 if (defined $check) {
112  
113 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
114 }
115  
116 # # Tab setup
117 # my $grid = $self->addTab('_Client', $self->notebook);
118  
119 # Set up the rest of the first tab (all of it, in this case)
120 $self->clientTab();
121  
122 # Set up the remaining tabs
123 $self->expandNotebook();
124  
125 # Tab complete
126 return 1;
127 }
128  
129 sub expandNotebook {
130  
131 # Called by $self->setupNotebook
132 # Set up additional tabs for the notebook
133 #
134 # Expected arguments
135 # (none besides $self)
136 #
137 # Return values
138 # 'undef' on improper arguments
139 # 1 otherwise
140  
141 my ($self, $check) = @_;
142  
143 # Check for improper arguments
144 if (defined $check) {
145  
146 return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_);
147 }
148  
149 $self->settingsTab();
150 $self->pluginsTab();
151 $self->commandsTab();
152 $self->logsTab();
153 $self->coloursTab();
154 $self->workspacesTab();
155 $self->windowsTab();
156 $self->soundTab();
157 $self->tasksTab();
158 $self->scriptsTab();
159 $self->chatTab();
160  
161 return 1;
162 }
163  
164 # sub saveChanges {} # Inherited from GA::Generic::ConfigWin
165  
166 # Notebook tabs
167  
168 sub clientTab {
169  
170 # Client tab - called by $self->setupNotebook
171 #
172 # Expected arguments
173 # (none besides $self)
174 #
175 # Return values
176 # 'undef' on improper arguments
177 # 1 otherwise
178  
179 my ($self, $check) = @_;
180  
181 # Check for improper arguments
182 if (defined $check) {
183  
184 return $axmud::CLIENT->writeImproper($self->_objClass . '->clientTab', @_);
185 }
186  
187 # Tab setup
188 # Create a notebook within the main one, so that we have two rows of tabs
189 my $innerNotebook = $self->addInnerNotebookTab('_Client', $self->notebook);
190  
191 # Add tabs to the inner notebook
192 $self->client1Tab($innerNotebook);
193 $self->client2Tab($innerNotebook);
194 $self->client3Tab($innerNotebook);
195 $self->client4Tab($innerNotebook);
196 $self->client5Tab($innerNotebook);
197 $self->client6Tab($innerNotebook);
198 $self->client7Tab($innerNotebook);
199 $self->client8Tab($innerNotebook);
200  
201 return 1;
202 }
203  
204 sub client1Tab {
205  
206 # Client1 tab
207 #
208 # Expected arguments
209 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
210 #
211 # Return values
212 # 'undef' on improper arguments
213 # 1 otherwise
214  
215 my ($self, $innerNotebook, $check) = @_;
216  
217 # Check for improper arguments
218 if (! defined $innerNotebook || defined $check) {
219  
220 return $axmud::CLIENT->writeImproper($self->_objClass . '->client1Tab', @_);
221 }
222  
223 # Tab setup
224 my $grid = $self->addTab('Page _1', $innerNotebook);
225  
226 # Left column
227 $self->addLabel($grid, '<b>Client settings</b>',
228 0, 12, 0, 1);
229  
230 $self->addLabel($grid, 'Script name',
231 1, 3, 1, 2);
232 my $entry = $self->addEntry($grid, undef, FALSE,
233 3, 6, 1, 2);
234 $entry->set_text($axmud::SCRIPT);
235  
236 $self->addLabel($grid, 'Script version',
237 1, 3, 2, 3);
238 my $entry2 = $self->addEntry($grid, undef, FALSE,
239 3, 6, 2, 3);
240 $entry2->set_text($axmud::VERSION);
241  
242 $self->addLabel($grid, 'Script date',
243 1, 3, 3, 4);
244 my $entry3 = $self->addEntry($grid, undef, FALSE,
245 3, 6, 3, 4);
246 $entry3->set_text($axmud::DATE);
247  
248 $self->addLabel($grid, 'Authors',
249 1, 3, 4, 5);
250 my $entry4 = $self->addEntry($grid, undef, FALSE,
251 3, 12, 4, 5);
252 $entry4->set_text($axmud::AUTHORS);
253  
254 $self->addLabel($grid, 'Copyright',
255 1, 3, 5, 6);
256 my $entry5 = $self->addEntry($grid, undef, FALSE,
257 3, 12, 5, 6);
258 $entry5->set_text($axmud::COPYRIGHT);
259  
260 $self->addLabel($grid, 'Website',
261 1, 3, 6, 7);
262 my $entry6 = $self->addEntry($grid, undef, FALSE,
263 3, 10, 6, 7);
264 $entry6->set_text($axmud::URL);
265  
266 my $button = $self->addButton($grid, 'Open', 'Open this website in a web browser', undef,
267 10, 12, 6, 7);
268 if (! $axmud::URL) {
269  
270 $button->set_sensitive(FALSE);
271 }
272 $button->signal_connect('clicked' => sub {
273  
274 if ($axmud::URL) {
275  
276 $axmud::CLIENT->openURL($axmud::URL);
277 }
278 });
279  
280 $self->addLabel($grid, 'Description',
281 1, 3, 7, 8);
282 my $entry7 = $self->addEntry($grid, undef, FALSE,
283 3, 12, 7, 8);
284 $entry7->set_text($axmud::DESCRIP);
285  
286 my $button2 = $self->addButton($grid, 'About...', 'About ' . $axmud::SCRIPT, undef,
287 1, 4, 8, 9);
288 $button2->signal_connect('clicked' => sub {
289  
290 # Only one About window can be open at a time
291 if (! $axmud::CLIENT->aboutWin) {
292  
293 $self->quickFreeWin(
294 'Games::Axmud::OtherWin::About',
295 $self->session,
296 # config
297 'first_tab' => 'about',
298 )
299  
300 } else {
301  
302 # Only one About window can be open at a time
303 $axmud::CLIENT->aboutWin->restoreFocus();
304 # Open it at the right page
305 $axmud::CLIENT->aboutWin->notebook->set_current_page(0);
306 }
307 });
308  
309 my $button3 = $self->addButton(
310 $grid, 'Credits...', 'Show information about credits', undef,
311 4, 6, 8, 9);
312 $button3->signal_connect('clicked' => sub {
313  
314 # Only one About window can be open at a time
315 if (! $axmud::CLIENT->aboutWin) {
316  
317 $self->quickFreeWin(
318 'Games::Axmud::OtherWin::About',
319 $self->session,
320 # config
321 'first_tab' => 'credits',
322 )
323  
324 } else {
325  
326 # Only one About window can be open at a time
327 $axmud::CLIENT->aboutWin->restoreFocus();
328 # Open it at the right page
329 $axmud::CLIENT->aboutWin->notebook->set_current_page(1);
330 }
331 });
332  
333 my $button4 = $self->addButton($grid, 'Quick help...', 'Show quick help', undef,
334 6, 9, 8, 9);
335 $button4->signal_connect('clicked' => sub {
336  
337 # Only one About window can be open at a time
338 if (! $axmud::CLIENT->aboutWin) {
339  
340 $self->quickFreeWin(
341 'Games::Axmud::OtherWin::About',
342 $self->session,
343 # config
344 'first_tab' => 'help',
345 )
346  
347 } else {
348  
349 # Only one About window can be open at a time
350 $axmud::CLIENT->aboutWin->restoreFocus();
351 # Open it at the right page
352 $axmud::CLIENT->aboutWin->notebook->set_current_page(2);
353 }
354 });
355  
356 my $button5 = $self->addButton($grid,
357 'Peek/Poke list...',
358 'Show strings for Peek/Poke operations',
359 undef,
360 9, 12, 8, 9);
361 $button5->signal_connect('clicked' => sub {
362  
363 # Only one About window can be open at a time
364 if (! $axmud::CLIENT->aboutWin) {
365  
366 $self->quickFreeWin(
367 'Games::Axmud::OtherWin::About',
368 $self->session,
369 # config
370 'first_tab' => 'peek',
371 )
372  
373 } else {
374  
375 # Only one About window can be open at a time
376 $axmud::CLIENT->aboutWin->restoreFocus();
377 # Open it at the right page
378 $axmud::CLIENT->aboutWin->notebook->set_current_page(3);
379 }
380 });
381  
382 my $button6 = $self->addButton($grid, 'Changes...', 'Show list of changes', undef,
383 1, 4, 9, 10);
384 $button6->signal_connect('clicked' => sub {
385  
386 # Only one About window can be open at a time
387 if (! $axmud::CLIENT->aboutWin) {
388  
389 $self->quickFreeWin(
390 'Games::Axmud::OtherWin::About',
391 $self->session,
392 # config
393 'first_tab' => 'changes',
394 )
395  
396 } else {
397  
398 # Only one About window can be open at a time
399 $axmud::CLIENT->aboutWin->restoreFocus();
400 # Open it at the right page
401 $axmud::CLIENT->aboutWin->notebook->set_current_page(3);
402 }
403 });
404  
405 my $button7 = $self->addButton($grid, 'Installation...', 'Show installation guide', undef,
406 4, 6, 9, 10);
407 $button7->signal_connect('clicked' => sub {
408  
409 # Only one About window can be open at a time
410 if (! $axmud::CLIENT->aboutWin) {
411  
412 $self->quickFreeWin(
413 'Games::Axmud::OtherWin::About',
414 $self->session,
415 # config
416 'first_tab' => 'install',
417 )
418  
419 } else {
420  
421 # Only one About window can be open at a time
422 $axmud::CLIENT->aboutWin->restoreFocus();
423 # Open it at the right page
424 $axmud::CLIENT->aboutWin->notebook->set_current_page(3);
425 }
426 });
427  
428 my $button8 = $self->addButton($grid, 'GPL License...', 'Show text of GPL License', undef,
429 6, 9, 9, 10);
430 $button8->signal_connect('clicked' => sub {
431  
432 # Only one About window can be open at a time
433 if (! $axmud::CLIENT->aboutWin) {
434  
435 $self->quickFreeWin(
436 'Games::Axmud::OtherWin::About',
437 $self->session,
438 # config
439 'first_tab' => 'license',
440 )
441  
442 } else {
443  
444 # Only one About window can be open at a time
445 $axmud::CLIENT->aboutWin->restoreFocus();
446 # Open it at the right page
447 $axmud::CLIENT->aboutWin->notebook->set_current_page(3);
448 }
449 });
450  
451 my $button9 = $self->addButton($grid,
452 'LGPL License...',
453 'Show text of LGPL License',
454 undef,
455 9, 12, 9, 10);
456 $button9->signal_connect('clicked' => sub {
457  
458 # Only one About window can be open at a time
459 if (! $axmud::CLIENT->aboutWin) {
460  
461 $self->quickFreeWin(
462 'Games::Axmud::OtherWin::About',
463 $self->session,
464 # config
465 'first_tab' => 'license_2',
466 )
467  
468 } else {
469  
470 # Only one About window can be open at a time
471 $axmud::CLIENT->aboutWin->restoreFocus();
472 # Open it at the right page
473 $axmud::CLIENT->aboutWin->notebook->set_current_page(3);
474 }
475 });
476  
477 # Right column
478 $self->addLabel($grid, 'Name in data files',
479 7, 9, 1, 2);
480 my $entry8 = $self->addEntry($grid, undef, FALSE,
481 9, 12, 1, 2);
482 $entry8->set_text($axmud::NAME_FILE);
483  
484 # Tab complete
485 return 1;
486 }
487  
488 sub client2Tab {
489  
490 # Client2 tab
491 #
492 # Expected arguments
493 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
494 #
495 # Return values
496 # 'undef' on improper arguments
497 # 1 otherwise
498  
499 my ($self, $innerNotebook, $check) = @_;
500  
501 # Local variables
502 my @columnList;
503  
504 # Check for improper arguments
505 if (! defined $innerNotebook || defined $check) {
506  
507 return $axmud::CLIENT->writeImproper($self->_objClass . '->client2Tab', @_);
508 }
509  
510 # Tab setup
511 my $grid = $self->addTab('Page _2', $innerNotebook);
512  
513 # Session list
514 $self->addLabel($grid, '<b>Session list</b>',
515 0, 12, 0, 1);
516 $self->addLabel($grid,
517 '<i>List of sessions (each corresponding to a single connection to a world)</i>',
518 1, 12, 1, 2);
519  
520 # Add a simple list
521 @columnList = (
522 'Num', 'text',
523 'Current', 'bool',
524 'Visible', 'bool',
525 'Logged in', 'bool',
526 'Status', 'text',
527 'World', 'text',
528 'Character', 'text',
529 );
530  
531 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
532 1, 12, 2, 8);
533  
534 # Initialise the simple list
535 $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2));
536  
537 # Add buttons
538 my $button = $self->addButton($grid,
539 'Edit...', 'Edit the selected session', undef,
540 1, 3, 8, 9);
541 $button->signal_connect('clicked' => sub {
542  
543 my ($number, $session);
544  
545 ($number) = $self->getSimpleListData($slWidget, 0);
546 if (defined $number) {
547  
548 $session = $axmud::CLIENT->ivShow('sessionHash', $number);
549 if ($session) {
550  
551 # Open an 'pref' window for the selected session
552 $self->createFreeWin(
553 'Games::Axmud::PrefWin::Session',
554 $self,
555 $session,
556 'Session preferences',
557 );
558 }
559 }
560 });
561  
562 my $button2 = $self->addButton($grid,
563 'Switch to session', 'Make the selected session the current (visible) one', undef,
564 3, 6, 8, 9);
565 $button2->signal_connect('clicked' => sub {
566  
567 my ($number, $session);
568  
569 ($number) = $self->getSimpleListData($slWidget, 0);
570 if (defined $number) {
571  
572 $session = $axmud::CLIENT->ivShow('sessionHash', $number);
573 if ($session && $session->defaultTabObj) {
574  
575 $session->defaultTabObj->paneObj->setVisibleTab($session->defaultTabObj);
576 }
577  
578 # Refresh the simple list
579 $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2));
580 }
581 });
582  
583 my $button3 = $self->addButton($grid,
584 'Refresh list', 'Refresh the list of sessions', undef,
585 9, 12, 8, 9);
586 $button3->signal_connect('clicked' => sub {
587  
588 # Refresh the simple list
589 $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2));
590 });
591  
592 # Tab complete
593 return 1;
594 }
595  
596 sub client2Tab_refreshList {
597  
598 # Resets the simple list displayed by $self->client2Tab
599 #
600 # Expected arguments
601 # $slWidget - The GA::Obj::SimpleList
602 # $columns - The number of columns
603 #
604 # Return values
605 # 'undef' on improper arguments
606 # 1 otherwise
607  
608 my ($self, $slWidget, $columns, $check) = @_;
609  
610 # Local variables
611 my (@winList, @dataList);
612  
613 # Check for improper arguments
614 if (! defined $slWidget || ! defined $columns || defined $check) {
615  
616 return $axmud::CLIENT->writeImproper($self->_objClass . '->client2Tab_refreshList', @_);
617 }
618  
619 # Get a list of 'main' windows, so we can mark visible windows
620 @winList = $axmud::CLIENT->desktopObj->listGridWins('main');
621  
622 # Compile the simple list data
623 OUTER: foreach my $session ($axmud::CLIENT->listSessions()) {
624  
625 my ($currentFlag, $visibleFlag, $world, $char);
626  
627 if ($session eq $axmud::CLIENT->currentSession) {
628 $currentFlag = TRUE;
629 } else {
630 $currentFlag = FALSE;
631 }
632  
633 $visibleFlag = FALSE;
634 INNER: foreach my $winObj (@winList) {
635  
636 if ($winObj->visibleSession && $winObj->visibleSession eq $session) {
637  
638 $visibleFlag = TRUE;
639 last INNER;
640 }
641 }
642  
643 $world = $session->currentWorld->name;
644 if ($session->currentChar) {
645  
646 $char = $session->currentChar->name;
647 }
648  
649 push (@dataList,
650 $session->number,
651 $currentFlag,
652 $visibleFlag,
653 $session->loginFlag,
654 $session->status,
655 $world,
656 $char,
657 );
658 }
659  
660 # Reset the simple list
661 $self->resetListData($slWidget, [@dataList], $columns);
662  
663 return 1;
664 }
665  
666 sub client3Tab {
667  
668 # Client3 tab
669 #
670 # Expected arguments
671 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
672 #
673 # Return values
674 # 'undef' on improper arguments
675 # 1 otherwise
676  
677 my ($self, $innerNotebook, $check) = @_;
678  
679 # Check for improper arguments
680 if (! defined $innerNotebook || defined $check) {
681  
682 return $axmud::CLIENT->writeImproper($self->_objClass . '->client3Tab', @_);
683 }
684  
685 # Tab setup
686 my $grid = $self->addTab('Page _3', $innerNotebook);
687  
688 # File permissions
689 $self->addLabel($grid, '<b>File permissions</b>',
690 0, 12, 0, 1);
691  
692 my $checkButton = $self->addCheckButton($grid, 'Load config file', undef, FALSE,
693 1, 6, 1, 2);
694 $checkButton->set_active($axmud::CLIENT->loadConfigFlag);
695  
696 my $checkButton2 = $self->addCheckButton($grid, 'Save config file', undef, FALSE,
697 1, 6, 2, 3);
698 $checkButton2->set_active($axmud::CLIENT->saveConfigFlag);
699  
700 my $checkButton3 = $self->addCheckButton($grid, 'Load other files', undef, FALSE,
701 1, 6, 3, 4);
702 $checkButton3->set_active($axmud::CLIENT->loadDataFlag);
703  
704 my $checkButton4 = $self->addCheckButton($grid, 'Save other files', undef, FALSE,
705 7, 12, 1, 2);
706 $checkButton4->set_active($axmud::CLIENT->saveDataFlag);
707  
708 my $checkButton5 = $self->addCheckButton(
709 $grid, 'All files deleted at startup', undef, FALSE,
710 7, 12, 2, 3);
711 $checkButton5->set_active($axmud::CLIENT->deleteFilesAtStartFlag);
712  
713 my $checkButton6 = $self->addCheckButton($grid, 'File operation has failed', undef, FALSE,
714 7, 12, 3, 4);
715 $checkButton6->set_active($axmud::CLIENT->fileFailFlag);
716  
717 # Tab complete
718 return 1;
719 }
720  
721 sub client4Tab {
722  
723 # Client4 tab
724 #
725 # Expected arguments
726 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
727 #
728 # Return values
729 # 'undef' on improper arguments
730 # 1 otherwise
731  
732 my ($self, $innerNotebook, $check) = @_;
733  
734 # Check for improper arguments
735 if (! defined $innerNotebook || defined $check) {
736  
737 return $axmud::CLIENT->writeImproper($self->_objClass . '->client4Tab', @_);
738 }
739  
740 # Tab setup
741 my $grid = $self->addTab('Page _4', $innerNotebook);
742  
743 # Directories (folders)
744 $self->addLabel($grid, '<b>Directories (folders)</b>',
745 0, 12, 0, 1);
746  
747 $self->addLabel($grid, 'Installation (base) directory',
748 1, 3, 1, 2);
749 my $entry = $self->addEntry($grid, undef, FALSE,
750 3, 12, 1, 2);
751 $entry->set_text($axmud::TOP_DIR);
752  
753 $self->addLabel($grid, 'Shared install file directory',
754 1, 3, 2, 3);
755 my $entry2 = $self->addEntry($grid, undef, FALSE,
756 3, 12, 2, 3);
757 $entry2->set_text($axmud::SHARE_DIR);
758  
759 $self->addLabel($grid, 'Current data directory',
760 1, 3, 3, 4);
761 my $entry3 = $self->addEntry($grid, undef, FALSE,
762 3, 12, 3, 4);
763 $entry3->set_text($axmud::DATA_DIR);
764  
765 my $button = $self->addButton($grid,
766 'Set', 'Sets the location of ' . $axmud::SCRIPT . '\'s data directory', undef,
767 7, 9, 4, 5);
768 $button->signal_connect('clicked' => sub {
769  
770 # Set the directory
771 $self->session->pseudoCmd('setdatadirectory', $self->pseudoCmdMode);
772 });
773  
774 my $button2 = $self->addButton($grid,
775 'Reset', 'Resets the location of ' . $axmud::SCRIPT . '\'s data directory', undef,
776 9, 12, 4, 5);
777 $button2->signal_connect('clicked' => sub {
778  
779 # Reset the directory
780 $self->session->pseudoCmd('setdatadirectory -r', $self->pseudoCmdMode);
781 });
782  
783 $self->addLabel($grid, 'Default data directory',
784 1, 3, 5, 6);
785 my $entry4 = $self->addEntry($grid, undef, FALSE,
786 3, 12, 5, 6);
787 $entry4->set_text($axmud::DEFAULT_DATA_DIR);
788  
789 # Temporary backup file retention
790 $self->addLabel($grid, '<b>Temporary backup file retention</b>',
791 0, 12, 6, 7);
792  
793 my $checkButton7 = $self->addCheckButton(
794 $grid, 'Retain backup copies after saving', undef, FALSE,
795 1, 6, 7, 8);
796 $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag);
797  
798 my $button3 = $self->addButton($grid,
799 'Turn on', 'Retain backup copies after saving files', undef,
800 7, 9, 7, 8);
801 $button3->signal_connect('clicked' => sub {
802  
803 # Retain backups on
804 $self->session->pseudoCmd('retainbackups on', $self->pseudoCmdMode);
805  
806 # Update the checkbutton
807 $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag);
808 });
809  
810 my $button4 = $self->addButton($grid,
811 'Turn off', 'Don\'t retain backup copies after saving files', undef,
812 9, 12, 7, 8);
813 $button4->signal_connect('clicked' => sub {
814  
815 # Retain backups off
816 $self->session->pseudoCmd('retainbackups off', $self->pseudoCmdMode);
817  
818 # Update the checkbutton
819 $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag);
820 });
821  
822 # Auto-save
823 $self->addLabel($grid, '<b>Auto-save</b>',
824 0, 12, 8, 9);
825  
826 my $checkButton8 = $self->addCheckButton($grid, 'Enable auto-saves', undef, FALSE,
827 1, 6, 9, 10);
828 $checkButton8->set_active($axmud::CLIENT->autoSaveFlag);
829  
830 my $button5 = $self->addButton($grid,
831 'Turn on', 'Turns autosaves on', undef,
832 7, 9, 9, 10);
833 $button5->signal_connect('clicked' => sub {
834  
835 # Turn autosave on
836 $self->session->pseudoCmd('autosave on', $self->pseudoCmdMode);
837  
838 # Update the checkbutton
839 $checkButton8->set_active($axmud::CLIENT->autoSaveFlag);
840 });
841  
842 my $button6 = $self->addButton($grid,
843 'Turn off', 'Turns autosaves off', undef,
844 9, 12, 9, 10);
845 $button6->signal_connect('clicked' => sub {
846  
847 # Turn autosave off
848 $self->session->pseudoCmd('autosave off', $self->pseudoCmdMode);
849  
850 # Update the checkbutton
851 $checkButton8->set_active($axmud::CLIENT->autoSaveFlag);
852 });
853  
854 $self->addLabel($grid, 'Time interval (minutes)',
855 1, 3, 10, 11);
856 my $entry5 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
857 3, 6, 10, 11);
858 $entry5->set_text($axmud::CLIENT->autoSaveWaitTime);
859  
860 my $button7 = $self->addButton($grid,
861 'Set interval', 'Set the time between successive auto-saves', undef,
862 7, 9, 10, 11);
863 $button7->signal_connect('clicked' => sub {
864  
865 if ($self->checkEntryIcon($entry5)) {
866  
867 # Set autosave time
868 $self->session->pseudoCmd('autosave ' . $entry5->get_text(), $self->pseudoCmdMode);
869  
870 # Update the checkbutton
871 $checkButton8->set_active($axmud::CLIENT->autoSaveFlag);
872 }
873 });
874  
875 # Tab complete
876 return 1;
877 }
878  
879 sub client5Tab {
880  
881 # Client5 tab
882 #
883 # Expected arguments
884 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
885 #
886 # Return values
887 # 'undef' on improper arguments
888 # 1 otherwise
889  
890 my ($self, $innerNotebook, $check) = @_;
891  
892 # Local variables
893 my (
894 @initList, @initList2, @comboList, @comboList2,
895 %comboHash, %comboHash2,
896 );
897  
898 # Check for improper arguments
899 if (! defined $innerNotebook || defined $check) {
900  
901 return $axmud::CLIENT->writeImproper($self->_objClass . '->client5Tab', @_);
902 }
903  
904 # Tab setup
905 my $grid = $self->addTab('Page _5', $innerNotebook);
906  
907 # Auto-backup operations
908 $self->addLabel($grid, '<b>Auto-backup operations</b>',
909 0, 12, 0, 1);
910 $self->addLabel(
911 $grid,
912 '<i>Automatically create a backup of the entire ' . $axmud::SCRIPT
913 . ' data directory</i>',
914 1, 12, 1, 2);
915  
916 $self->addLabel($grid, 'Perform auto-backup',
917 1, 3, 2, 3);
918  
919 @initList = (
920 '-n' => 'Never',
921 '-a' => 'Whenever ' . $axmud::SCRIPT . ' starts',
922 '-p' => 'Whenever ' . $axmud::SCRIPT . ' shuts down',
923 '-x' => 'At regular intervals, when ' . $axmud::SCRIPT . ' starts',
924 '-y' => 'At regular intervals, when ' . $axmud::SCRIPT . ' shuts down',
925 );
926  
927 do {
928  
929 my $switch = shift @initList;
930 my $descrip = shift @initList;
931  
932 $comboHash{$descrip} = $switch;
933 push (@comboList, $descrip);
934  
935 } until (! @initList);
936  
937 my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
938 TRUE, # No 'undef' value used
939 3, 9, 2, 3);
940  
941 my $button = $self->addButton($grid,
942 'Set method', 'Set when auto-backups are performed', undef,
943 9, 12, 2, 3);
944 $button->signal_connect('clicked' => sub {
945  
946 my $choice = $comboBox->get_active_text();
947 if ($choice && exists $comboHash{$choice}) {
948  
949 $self->session->pseudoCmd(
950 'autobackup ' . $comboHash{$choice},
951 $self->pseudoCmdMode,
952 );
953 }
954 });
955  
956 $self->addLabel($grid, 'Backup interval (in days, range 0-366)',
957 1, 6, 3, 4);
958 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, 366,
959 6, 9, 3, 4);
960 $entry->set_text($axmud::CLIENT->autoSaveWaitTime);
961  
962 my $button2 = $self->addButton($grid,
963 'Set interval',
964 'Set how often auto-backups are performed, when doing auto-backup at intervals',
965 undef,
966 9, 12, 3, 4);
967 $button2->signal_connect('clicked' => sub {
968  
969 my $num = $entry->get_text();
970  
971 if ($self->checkEntryIcon($entry)) {
972  
973 $self->session->pseudoCmd('autobackup -i ' . $num);
974 }
975 });
976  
977  
978 $self->addLabel($grid, 'Use directory (folder)',
979 1, 3, 4, 5);
980 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
981 3, 12, 4, 5);
982 if (defined $axmud::CLIENT->autoBackupDir) {
983  
984 $entry2->set_text($axmud::CLIENT->autoBackupDir);
985 }
986  
987 my $button3 = $self->addButton($grid,
988 'Set this directory', 'Set the directory where backup files are created', undef,
989 6, 9, 5, 6);
990 $button3->signal_connect('clicked' => sub {
991  
992 # If entry icon is a cross, rather than a tick, reset the directory so the user must
993 # choose it manually every time a backup is done
994  
995 my $dir = $entry2->get_text();
996  
997 if ($self->checkEntryIcon($entry2)) {
998 $self->session->pseudoCmd('autobackup -f ' . $dir);
999 } else {
1000 $self->session->pseudoCmd('autobackup -o');
1001 }
1002 });
1003  
1004 my $button4 = $self->addButton($grid,
1005 '(or) Choose directory', 'Select a directory where backup files are created', undef,
1006 9, 12, 5, 6);
1007 $button4->signal_connect('clicked' => sub {
1008  
1009 my $dir = $self->showFileChooser(
1010 'Set backup directory',
1011 'select-folder',
1012 );
1013  
1014 if ($dir) {
1015  
1016 $entry2->set_text($dir);
1017 $self->session->pseudoCmd('autobackup -f ' . $dir);
1018 }
1019 });
1020  
1021 my $checkButton = $self->addCheckButton($grid, 'Append time to backup file', undef, FALSE,
1022 1, 6, 6, 7);
1023 $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag);
1024  
1025 my $button5 = $self->addButton($grid,
1026 'Turn on', 'Turns on appending time to backup file', undef,
1027 6, 9, 6, 7);
1028 $button5->signal_connect('clicked' => sub {
1029  
1030 $self->session->pseudoCmd('autobackup -a', $self->pseudoCmdMode);
1031  
1032 # Update the checkbutton
1033 $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag);
1034 });
1035  
1036 my $button6 = $self->addButton($grid,
1037 'Turn off', 'Turns off appending time to backup file', undef,
1038 9, 12, 6, 7);
1039 $button6->signal_connect('clicked' => sub {
1040  
1041 $self->session->pseudoCmd('autobackup -e', $self->pseudoCmdMode);
1042  
1043 # Update the checkbutton
1044 $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag);
1045 });
1046  
1047 $self->addLabel($grid, 'Backup file type',
1048 1, 3, 7, 8);
1049  
1050 @initList2 = (
1051 '-d' => 'Use the default for the system',
1052 '-t' => 'Create .tgz files',
1053 '-p' => 'Create .zip files',
1054 );
1055  
1056 do {
1057  
1058 my $switch = shift @initList2;
1059 my $descrip = shift @initList2;
1060  
1061 $comboHash2{$descrip} = $switch;
1062 push (@comboList2, $descrip);
1063  
1064 } until (! @initList2);
1065  
1066 my $comboBox2 = $self->addComboBox($grid, undef, \@comboList2, '',
1067 TRUE, # No 'undef' value used
1068 3, 9, 7, 8);
1069  
1070 my $button7 = $self->addButton($grid,
1071 'Set file type', 'Set the archive type for the backup file', undef,
1072 9, 12, 7, 8);
1073 $button7->signal_connect('clicked' => sub {
1074  
1075 my $choice = $comboBox2->get_active_text();
1076 if ($choice && exists $comboHash2{$choice}) {
1077  
1078 $self->session->pseudoCmd(
1079 'autobackup ' . $comboHash2{$choice},
1080 $self->pseudoCmdMode,
1081 );
1082 }
1083 });
1084  
1085 # Manual backup operations
1086 $self->addLabel($grid, '<b>Manual backup operations</b>',
1087 0, 12, 8, 9);
1088  
1089 my $button8 = $self->addButton(
1090 $grid,
1091 'Create a backup file now',
1092 'Manually create a backup file now',
1093 undef,
1094 1, 6, 9, 10);
1095 $button8->signal_connect('clicked' => sub {
1096  
1097 $self->session->pseudoCmd('backupdata', $self->pseudoCmdMode);
1098 });
1099  
1100 my $button9 = $self->addButton($grid,
1101 'Restore data from a backup up file now',
1102 'Manually restore data from a backup file', undef,
1103 6, 12, 9, 10);
1104 $button9->signal_connect('clicked' => sub {
1105  
1106 $self->session->pseudoCmd('restoredata', $self->pseudoCmdMode);
1107 });
1108  
1109 # Tab complete
1110 return 1;
1111 }
1112  
1113 sub client6Tab {
1114  
1115 # Client6 tab
1116 #
1117 # Expected arguments
1118 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1119 #
1120 # Return values
1121 # 'undef' on improper arguments
1122 # 1 otherwise
1123  
1124 my ($self, $innerNotebook, $check) = @_;
1125  
1126 # Local variables
1127 my @columnList;
1128  
1129 # Check for improper arguments
1130 if (! defined $innerNotebook || defined $check) {
1131  
1132 return $axmud::CLIENT->writeImproper($self->_objClass . '->client6Tab', @_);
1133 }
1134  
1135 # Tab setup
1136 my $grid = $self->addTab('Page _6', $innerNotebook);
1137  
1138 # Client file objects
1139 $self->addLabel($grid, '<b>Client file objects</b>',
1140 0, 12, 0, 1);
1141 $self->addLabel($grid,
1142 '<i>List of data files currently in use by the client (session-independent)</i>',
1143 1, 12, 1, 2);
1144  
1145 # Add a simple list
1146 @columnList = (
1147 'Not saved', 'bool',
1148 'File type', 'text',
1149 'File name', 'text',
1150 'Path', 'text',
1151 );
1152  
1153 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
1154 1, 12, 2, 10);
1155  
1156 # Initialise the simple list
1157 $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2));
1158  
1159 # Add buttons
1160 my $button = $self->addButton($grid,
1161 'Save', 'Save all files whose data has been modified', undef,
1162 1, 3, 10, 11);
1163 $button->signal_connect('clicked' => sub {
1164  
1165 # Save files
1166 $self->session->pseudoCmd('save', $self->pseudoCmdMode);
1167  
1168 # Refresh the simple list
1169 $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2));
1170 });
1171  
1172 my $button2 = $self->addButton($grid,
1173 'Force save', 'Save all files, even if their data has not been modified', undef,
1174 3, 6, 10, 11);
1175 $button2->signal_connect('clicked' => sub {
1176  
1177 # Save files
1178 $self->session->pseudoCmd('save -f', $self->pseudoCmdMode);
1179  
1180 # Refresh the simple list
1181 $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2));
1182 });
1183  
1184 my $button3 = $self->addButton($grid,
1185 'Refresh list', 'Refresh the list of file objects', undef,
1186 10, 12, 10, 11);
1187 $button3->signal_connect('clicked' => sub {
1188  
1189 # Refresh the simple list
1190 $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2));
1191 });
1192  
1193 # Tab complete
1194 return 1;
1195 }
1196  
1197 sub client6Tab_refreshList {
1198  
1199 # Resets the simple list displayed by $self->client6Tab
1200 #
1201 # Expected arguments
1202 # $slWidget - The GA::Obj::SimpleList
1203 # $columns - The number of columns
1204 #
1205 # Return values
1206 # 'undef' on improper arguments
1207 # 1 otherwise
1208  
1209 my ($self, $slWidget, $columns, $check) = @_;
1210  
1211 # Local variables
1212 my (@fileList, @dataList);
1213  
1214 # Check for improper arguments
1215 if (! defined $slWidget || ! defined $columns || defined $check) {
1216  
1217 return $axmud::CLIENT->writeImproper($self->_objClass . '->client6Tab_refreshList', @_);
1218 }
1219  
1220 # Import the list of file objects
1221 @fileList = sort {
1222 if (lc($a->fileType) ne lc($b->fileType)) {
1223 lc($a->fileType) cmp lc($b->fileType);
1224 } else {
1225 lc($a->name) cmp lc($b->name);
1226 }
1227  
1228 } ($axmud::CLIENT->ivValues('fileObjHash'));
1229  
1230 # Compile the simple list data
1231 foreach my $obj (@fileList) {
1232  
1233 push (@dataList,
1234 $obj->modifyFlag,
1235 $obj->fileType,
1236 $obj->name,
1237 $obj->actualPath,
1238 );
1239 }
1240  
1241 # Reset the simple list
1242 $self->resetListData($slWidget, [@dataList], $columns);
1243  
1244 return 1;
1245 }
1246  
1247 sub client7Tab {
1248  
1249 # Client7 tab
1250 #
1251 # Expected arguments
1252 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1253 #
1254 # Return values
1255 # 'undef' on improper arguments
1256 # 1 otherwise
1257  
1258 my ($self, $innerNotebook, $check) = @_;
1259  
1260 # Local variables
1261 my @columnList;
1262  
1263 # Check for improper arguments
1264 if (! defined $innerNotebook || defined $check) {
1265  
1266 return $axmud::CLIENT->writeImproper($self->_objClass . '->client7Tab', @_);
1267 }
1268  
1269 # Tab setup
1270 my $grid = $self->addTab('Page _7', $innerNotebook);
1271  
1272 # IP lookup services
1273 $self->addLabel($grid, '<b>IP lookup services</b>',
1274 0, 12, 0, 1);
1275 $self->addLabel($grid,
1276 '<i>List of URLs that return your IP address (one URL perl line, or use an empty'
1277 . ' list to disable lookup)</i>',
1278 1, 12, 1, 2);
1279  
1280 my $textView = $self->addTextView($grid, undef, TRUE,
1281 1, 12, 2, 10);
1282 my $buffer = $textView->get_buffer();
1283 $buffer->set_text(join("\n", $axmud::CLIENT->ipLookupList));
1284  
1285 my $button = $self->addButton(
1286 $grid, 'Set list', 'Set the list of IP lookup services', undef,
1287 1, 3, 10, 11);
1288 # (->signal_connect appears below)
1289  
1290 my $button2 = $self->addButton(
1291 $grid, 'Use default list', 'Uses the default list of IP lookup services', undef,
1292 3, 6, 10, 11);
1293 # (->signal_connect appears below)
1294  
1295 my $button3 = $self->addButton(
1296 $grid, 'Update list', 'Updates the list of IP lookup services', undef,
1297 9, 12, 10, 11);
1298 # (->signal_connect appears below)
1299  
1300 $self->addLabel($grid, '<b>Your IP address:</b>',
1301 1, 3, 11, 12);
1302 my $entry = $self->addEntry($grid, undef, FALSE,
1303 3, 9, 11, 12);
1304 if (! defined $axmud::CLIENT->currentIP) {
1305 $entry->set_text('<unknown>');
1306 } else {
1307 $entry->set_text($axmud::CLIENT->currentIP);
1308 }
1309  
1310 my $button4 = $self->addButton(
1311 $grid, 'Fetch', 'Fetch your current IP address', undef,
1312 9, 12, 11, 12);
1313 # (->signal_connect appears below)
1314  
1315 # Set values for the textview and the entry
1316 $self->client7Tab_updateWidgets($buffer, $entry);
1317  
1318 # (->signal_connects from above)
1319 $button->signal_connect('clicked' => sub {
1320  
1321 my (
1322 $text,
1323 @list,
1324 );
1325  
1326 $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
1327 if ($text =~ m/\S/) {
1328  
1329 # Split the contents of the textview into a list
1330 @list = split("\n", $text);
1331  
1332 # Set the list of IP lookup services. By using a join so soon after a split, we
1333 # safely eliminate newline chars
1334 $self->session->pseudoCmd(
1335 'setlookup ' . join(' ', @list),
1336 $self->pseudoCmdMode,
1337 );
1338  
1339 } else {
1340  
1341 # Empty the list of IP lookup services
1342 $self->session->pseudoCmd('setlookup', $self->pseudoCmdMode);
1343 }
1344  
1345 # Update the textview and the entry
1346 $self->client7Tab_updateWidgets($buffer, $entry);
1347 });
1348  
1349 $button2->signal_connect('clicked' => sub {
1350  
1351 # Reset the list of IP lookup services to the default list
1352 $self->session->pseudoCmd('resetlookup', $self->pseudoCmdMode);
1353  
1354 # Update the textview and the entry
1355 $self->client7Tab_updateWidgets($buffer, $entry);
1356 });
1357  
1358 $button3->signal_connect('clicked' => sub {
1359  
1360 # Update the textview and the entry
1361 $self->client7Tab_updateWidgets($buffer, $entry);
1362 });
1363  
1364 $button4->signal_connect('clicked' => sub {
1365  
1366 # Force the client to re-fetch the user's IP address
1367 $self->session->pseudoCmd('forcelookup', $self->pseudoCmdMode);
1368  
1369 # Update the textview and the entry
1370 $self->client7Tab_updateWidgets($buffer, $entry);
1371 });
1372  
1373 # Tab complete
1374 return 1;
1375 }
1376  
1377 sub client7Tab_updateWidgets {
1378  
1379 # Resets the textview and entry displayed by $self->client7Tab
1380 #
1381 # Expected arguments
1382 # $buffer - The Gtk3::TextBuffer
1383 # $entry - The Gtk3::Entry
1384 #
1385 # Return values
1386 # 'undef' on improper arguments
1387 # 1 otherwise
1388  
1389 my ($self, $buffer, $entry, $check) = @_;
1390  
1391 # Check for improper arguments
1392 if (! defined $buffer || ! defined $entry || defined $check) {
1393  
1394 return $axmud::CLIENT->writeImproper(
1395 $self->_objClass . '->client7Tab_updateWidgets',
1396 @_
1397 );
1398 }
1399  
1400 $buffer->set_text(join("\n", $axmud::CLIENT->ipLookupList));
1401 if (! defined $axmud::CLIENT->currentIP) {
1402 $entry->set_text('<unknown>');
1403 } else {
1404 $entry->set_text($axmud::CLIENT->currentIP);
1405 }
1406  
1407 return 1;
1408 }
1409  
1410 sub client8Tab {
1411  
1412 # Client8 tab
1413 #
1414 # Expected arguments
1415 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1416 #
1417 # Return values
1418 # 'undef' on improper arguments
1419 # 1 otherwise
1420  
1421 my ($self, $innerNotebook, $check) = @_;
1422  
1423 # Local variables
1424 my @columnList;
1425  
1426 # Check for improper arguments
1427 if (! defined $innerNotebook || defined $check) {
1428  
1429 return $axmud::CLIENT->writeImproper($self->_objClass . '->client8Tab', @_);
1430 }
1431  
1432 # Tab setup
1433 my $grid = $self->addTab('Page _8', $innerNotebook);
1434  
1435 # Reserved names
1436 $self->addLabel($grid, '<b>Reserved names</b>',
1437 0, 12, 0, 1);
1438 $self->addLabel($grid,
1439 '<i>List of names that can\'t be used as object names</i>',
1440 1, 12, 1, 2);
1441  
1442 # Add a simple list
1443 @columnList = (
1444 'Reserved name', 'text',
1445 );
1446  
1447 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
1448 1, 12, 2, 12);
1449  
1450 # Initialise the list
1451 @{$slWidget->{data}}
1452 = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('constReservedHash'));
1453  
1454 # Tab complete
1455 return 1;
1456 }
1457  
1458 sub settingsTab {
1459  
1460 # Settings tab - called by $self->setupNotebook
1461 #
1462 # Expected arguments
1463 # (none besides $self)
1464 #
1465 # Return values
1466 # 'undef' on improper arguments
1467 # 1 otherwise
1468  
1469 my ($self, $check) = @_;
1470  
1471 # Check for improper arguments
1472 if (defined $check) {
1473  
1474 return $axmud::CLIENT->writeImproper($self->_objClass . '->settingsTab', @_);
1475 }
1476  
1477 # Tab setup
1478 # Create a notebook within the main one, so that we have two rows of tabs
1479 my $innerNotebook = $self->addInnerNotebookTab('_Settings', $self->notebook);
1480  
1481 # Add tabs to the inner notebook
1482 $self->settings1Tab($innerNotebook);
1483 $self->settings2Tab($innerNotebook);
1484 $self->settings3Tab($innerNotebook);
1485 $self->settings4Tab($innerNotebook);
1486 $self->settings5Tab($innerNotebook);
1487 $self->settings6Tab($innerNotebook);
1488 $self->settings7Tab($innerNotebook);
1489 $self->settings8Tab($innerNotebook);
1490 $self->settings9Tab($innerNotebook);
1491 $self->settings10Tab($innerNotebook);
1492 $self->settings11Tab($innerNotebook);
1493 $self->settings12Tab($innerNotebook);
1494 $self->settings13Tab($innerNotebook);
1495  
1496 return 1;
1497 }
1498  
1499 sub settings1Tab {
1500  
1501 # Settings1 tab
1502 #
1503 # Expected arguments
1504 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1505 #
1506 # Return values
1507 # 'undef' on improper arguments
1508 # 1 otherwise
1509  
1510 my ($self, $innerNotebook, $check) = @_;
1511  
1512 # Local variables
1513 my (
1514 @initList, @comboList, @setList, @comboList2,
1515 %comboHash,
1516 );
1517  
1518 # Check for improper arguments
1519 if (! defined $innerNotebook || defined $check) {
1520  
1521 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings1Tab', @_);
1522 }
1523  
1524 # Tab setup
1525 my $grid = $self->addTab('Page _1', $innerNotebook);
1526  
1527 # Left column
1528 $self->addLabel($grid, '<b>Session settings</b>',
1529 0, 12, 0, 1);
1530  
1531 $self->addLabel($grid, 'Maximum sessions',
1532 1, 3, 1, 2);
1533 my $entry = $self->addEntry($grid, undef, FALSE,
1534 3, 6, 1, 2,
1535 4, 4);
1536 $entry->set_text($axmud::CLIENT->sessionMax);
1537  
1538 my $entry2 = $self->addEntryWithIcon(
1539 $grid,
1540 undef,
1541 'int',
1542 1,
1543 $axmud::CLIENT->constSessionMax,
1544 3, 5, 2, 3,
1545 4, 4);
1546 my $button = $self->addButton(
1547 $grid, 'Set', 'Set the maximum number of concurrent sessions', undef,
1548 5, 6, 2, 3);
1549 # (Need this line to prevent horizontal stretching of the grid)
1550 $button->set_hexpand(FALSE);
1551 $button->signal_connect('clicked' => sub {
1552  
1553 my $num = $entry2->get_text();
1554  
1555 if ($self->checkEntryIcon($entry2)) {
1556  
1557 $self->session->pseudoCmd('maxsession ' . $num);
1558  
1559 $entry2->set_text('');
1560 $entry->set_text($axmud::CLIENT->sessionMax);
1561 }
1562 });
1563  
1564 $self->addLabel($grid, 'Default character set',
1565 1, 3, 3, 4);
1566  
1567 @setList = $axmud::CLIENT->charSetList;
1568 # (Find the current character set, and put it at the top of the list)
1569 foreach my $item (@setList) {
1570  
1571 if ($item ne $axmud::CLIENT->charSet) {
1572  
1573 push (@comboList2, $item);
1574 }
1575 }
1576  
1577 unshift(@comboList2, $axmud::CLIENT->charSet);
1578  
1579 my $comboBox2 = $self->addComboBox($grid, undef, \@comboList2, '',
1580 TRUE, # No 'undef' value used
1581 3, 6, 3, 4);
1582 $comboBox2->signal_connect('changed' => sub {
1583  
1584 my ($choice, $index);
1585  
1586 $choice = $comboBox2->get_active_text();
1587 if ($choice) {
1588  
1589 $self->session->pseudoCmd(
1590 'setcharset -d ' . $choice,
1591 $self->pseudoCmdMode,
1592 );
1593 }
1594 });
1595  
1596 my $checkButton = $self->addCheckButton(
1597 $grid, 'Switch to \'connect offline\' mode on disconnection', undef, TRUE,
1598 1, 6, 4, 5);
1599 $checkButton->set_active($axmud::CLIENT->offlineOnDisconnectFlag);
1600 $checkButton->signal_connect('toggled' => sub {
1601  
1602 $self->session->pseudoCmd('setsession -o', $self->pseudoCmdMode);
1603 $checkButton->set_active($axmud::CLIENT->offlineOnDisconnectFlag);
1604 });
1605  
1606 my $checkButton2 = $self->addCheckButton(
1607 $grid, 'Make short weblinks like \'deathmud.com\' clickable', undef, TRUE,
1608 1, 6, 5, 6);
1609 $checkButton2->set_active($axmud::CLIENT->shortUrlFlag);
1610 $checkButton2->signal_connect('toggled' => sub {
1611  
1612 $self->session->pseudoCmd('toggleshortlink', $self->pseudoCmdMode);
1613 $checkButton2->set_active($axmud::CLIENT->shortUrlFlag);
1614 });
1615  
1616 # Right column
1617 $self->addLabel($grid, 'Tab format',
1618 7, 9, 1, 2);
1619  
1620 @initList = (
1621 'b' => 'World (Character)',
1622 'h' => 'World - Character',
1623 'w' => 'World',
1624 'c' => 'Character',
1625 );
1626  
1627 do {
1628  
1629 my ($value, $descrip);
1630  
1631 $value = shift @initList;
1632 $descrip = shift @initList;
1633  
1634 push (@comboList, $descrip);
1635 $comboHash{$descrip} = $value;
1636  
1637 } until (! @initList);
1638  
1639 my $comboBox = $self->addComboBox($grid, undef, \@comboList, 'Select format:',
1640 TRUE, # No 'undef' value used
1641 9, 12, 1, 2);
1642 $comboBox->signal_connect('changed' => sub {
1643  
1644 my $choice = $comboBox->get_active_text();
1645  
1646 $self->session->pseudoCmd('setsession -' . $comboHash{$choice}, $self->pseudoCmdMode);
1647 });
1648  
1649 my $checkButton3 = $self->addCheckButton(
1650 $grid, 'Use xterm title in tab instead (if available)', undef, TRUE,
1651 7, 12, 2, 3);
1652 $checkButton3->set_active($axmud::CLIENT->xTermTitleFlag);
1653 $checkButton3->signal_connect('toggled' => sub {
1654  
1655 $self->session->pseudoCmd('setsession -x', $self->pseudoCmdMode);
1656 $checkButton3->set_active($axmud::CLIENT->xTermTitleFlag);
1657 });
1658  
1659 my $checkButton4 = $self->addCheckButton(
1660 $grid, 'Use world\'s long name in tab (if available)', undef, TRUE,
1661 7, 12, 3, 4);
1662 $checkButton4->set_active($axmud::CLIENT->longTabLabelFlag);
1663 $checkButton4->signal_connect('toggled' => sub {
1664  
1665 $self->session->pseudoCmd('setsession -l', $self->pseudoCmdMode);
1666 $checkButton4->set_active($axmud::CLIENT->longTabLabelFlag);
1667 });
1668  
1669 my $checkButton5 = $self->addCheckButton(
1670 $grid, 'Don\'t use tabs for a single session', undef, TRUE,
1671  
1672 7, 12, 4, 5);
1673 $checkButton5->set_active($axmud::CLIENT->simpleTabFlag);
1674 $checkButton5->signal_connect('toggled' => sub {
1675  
1676 $self->session->pseudoCmd('setsession -s', $self->pseudoCmdMode);
1677 $checkButton5->set_active($axmud::CLIENT->simpleTabFlag);
1678 });
1679  
1680 my $checkButton6 = $self->addCheckButton(
1681 $grid, 'Sessions share a single \'main\' window', undef, FALSE,
1682 7, 12, 5, 6);
1683 $checkButton6->set_active($axmud::CLIENT->shareMainWinFlag);
1684  
1685 my $button2 = $self->addButton(
1686 $grid,
1687 'Toggle setting for restart',
1688 'Changes to this setting are applied when ' . $axmud::SCRIPT . ' restarts',
1689 undef,
1690 7, 10, 6, 7);
1691 # ->signal connect appears below
1692  
1693 my $entry3 = $self->addEntry($grid, undef, FALSE,
1694 10, 12, 6, 7,
1695 12, 12);
1696 # (The entry remains empty when the IV value is 'default')
1697 if ($axmud::CLIENT->restartShareMainWinMode eq 'on') {
1698 $entry3->set_text('share');
1699 } elsif ($axmud::CLIENT->restartShareMainWinMode eq 'off') {
1700 $entry3->set_text('don\'t share');
1701 }
1702  
1703 # ->signal_connect from above
1704 $button2->signal_connect('clicked' => sub {
1705  
1706 $self->session->pseudoCmd('toggleshare', $self->pseudoCmdMode);
1707 if ($axmud::CLIENT->restartShareMainWinMode eq 'default') {
1708 $entry3->set_text('');
1709 } elsif ($axmud::CLIENT->restartShareMainWinMode eq 'on') {
1710 $entry3->set_text('share');
1711 } else {
1712 $entry3->set_text('don\'t share');
1713 }
1714 });
1715  
1716 my $checkButton7 = $self->addCheckButton(
1717 $grid, 'Confirm before click-closing \'main\' window', undef, TRUE,
1718 7, 12, 7, 8);
1719 $checkButton7->set_active($axmud::CLIENT->confirmCloseMainWinFlag);
1720 $checkButton7->signal_connect('toggled' => sub {
1721  
1722 $self->session->pseudoCmd('setsession -m', $self->pseudoCmdMode);
1723 $checkButton7->set_active($axmud::CLIENT->confirmCloseMainWinFlag);
1724 });
1725  
1726 my $checkButton8 = $self->addCheckButton(
1727 $grid, 'Confirm before click-closing tab', undef, TRUE,
1728 7, 12, 8, 9);
1729 $checkButton8->set_active($axmud::CLIENT->confirmCloseTabFlag);
1730 $checkButton8->signal_connect('toggled' => sub {
1731  
1732 $self->session->pseudoCmd('setsession -t', $self->pseudoCmdMode);
1733 $checkButton8->set_active($axmud::CLIENT->confirmCloseTabFlag);
1734 });
1735  
1736 my $checkButton9 = $self->addCheckButton(
1737 $grid, 'Confirm before closing from menu', undef, TRUE,
1738 7, 12, 9, 10);
1739 $checkButton9->set_active($axmud::CLIENT->confirmCloseMenuFlag);
1740 $checkButton9->signal_connect('toggled' => sub {
1741  
1742 $self->session->pseudoCmd('setsession -e', $self->pseudoCmdMode);
1743 $checkButton9->set_active($axmud::CLIENT->confirmCloseMenuFlag);
1744 });
1745  
1746 my $checkButton10 = $self->addCheckButton(
1747 $grid, 'Confirm before closing from toolbar', undef, TRUE,
1748 7, 12, 10, 11);
1749 $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag);
1750 $checkButton10->signal_connect('toggled' => sub {
1751  
1752 $self->session->pseudoCmd('setsession -r', $self->pseudoCmdMode);
1753 $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag);
1754 });
1755  
1756 # Tab complete
1757 return 1;
1758 }
1759  
1760 sub settings2Tab {
1761  
1762 # Settings2 tab
1763 #
1764 # Expected arguments
1765 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1766 #
1767 # Return values
1768 # 'undef' on improper arguments
1769 # 1 otherwise
1770  
1771 my ($self, $innerNotebook, $check) = @_;
1772  
1773 # Check for improper arguments
1774 if (! defined $innerNotebook || defined $check) {
1775  
1776 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings2Tab', @_);
1777 }
1778  
1779 # Tab setup
1780 my $grid = $self->addTab('Page _2', $innerNotebook);
1781  
1782 # Favourite world list
1783 $self->addLabel($grid, '<b>Favourite world list</b>',
1784 0, 12, 0, 1);
1785 $self->addLabel(
1786 $grid, '<i>Worlds displayed at the top of the list in the Connections window</i>',
1787 1, 12, 1, 2);
1788  
1789 my $textView = $self->addTextView($grid, undef, TRUE,
1790 1, 12, 2, 5);
1791 my $buffer = $textView->get_buffer();
1792 $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));
1793  
1794 my $button = $self->addButton(
1795 $grid, 'Set list', 'Set the list of favourite worlds', undef,
1796 1, 4, 5, 6);
1797 $button->signal_connect('clicked' => sub {
1798  
1799 my (
1800 $text,
1801 @list,
1802 );
1803  
1804 $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
1805 if ($text =~ m/\S/) {
1806  
1807 # Split the contents of the textview into a list
1808 @list = split("\n", $text);
1809  
1810 # Set the favourite world list. By using a join so soon after a split, we safely
1811 # eliminate newline chars
1812 $self->session->pseudoCmd(
1813 'setfavouriteworld ' . join(' ', @list),
1814 $self->pseudoCmdMode,
1815 );
1816  
1817 } else {
1818  
1819 # Reset the favourite world list
1820 $self->session->pseudoCmd('setfavouriteworld', $self->pseudoCmdMode);
1821 }
1822  
1823 # Update the textview
1824 $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));
1825 });
1826  
1827 my $button2 = $self->addButton(
1828 $grid, 'Update list', 'Updates the list of favourite worlds', undef,
1829 9, 12, 5, 6);
1830 $button2->signal_connect('clicked' => sub {
1831  
1832 # Update the textview
1833 $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));
1834 });
1835  
1836 # Auto-connect world list
1837 $self->addLabel($grid, '<b>Auto-connect world list</b>',
1838 0, 12, 6, 7);
1839 $self->addLabel(
1840 $grid, "<i>Worlds to which " . $axmud::SCRIPT . " auto-connects when it starts. Each"
1841 . " world profile name can be followed by\none or more character profile names, e.g."
1842 . " <b>deathmud bilbo gandalf</b></i>",
1843 1, 12, 7, 8);
1844 my $textView2 = $self->addTextView($grid, undef, TRUE,
1845 1, 12, 8, 11);
1846 my $buffer2 = $textView2->get_buffer();
1847 $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));
1848  
1849 my $button3 = $self->addButton(
1850 $grid, 'Set list', 'Set the list of auto-connecting worlds', undef,
1851 1, 4, 11, 12);
1852 $button3->signal_connect('clicked' => sub {
1853  
1854 my $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer2);
1855 if ($text =~ m/\S/) {
1856  
1857 foreach my $item (split("\n", $text)) {
1858  
1859 # (Ignore empty lines)
1860 if ($item =~ m/\S/) {
1861  
1862 $self->session->pseudoCmd('setautoworld ' . $item, $self->pseudoCmdMode);
1863 }
1864 }
1865  
1866 } else {
1867  
1868 # Reset the list
1869 $self->session->pseudoCmd('setautoworld', $self->pseudoCmdMode);
1870 }
1871  
1872 # Update the textview
1873 $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));
1874 });
1875  
1876 my $button4 = $self->addButton(
1877 $grid, 'Update list', 'Updates the list of auto-connecting worlds', undef,
1878 9, 12, 11, 12);
1879 $button4->signal_connect('clicked' => sub {
1880  
1881 # Update the textview
1882 $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));
1883 });
1884  
1885 # Tab complete
1886 return 1;
1887 }
1888  
1889 sub settings3Tab {
1890  
1891 # Settings3 tab
1892 #
1893 # Expected arguments
1894 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1895 #
1896 # Return values
1897 # 'undef' on improper arguments
1898 # 1 otherwise
1899  
1900 my ($self, $innerNotebook, $check) = @_;
1901  
1902 # Check for improper arguments
1903 if (! defined $innerNotebook || defined $check) {
1904  
1905 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings3Tab', @_);
1906 }
1907  
1908 # Tab setup
1909 my $grid = $self->addTab('Page _3', $innerNotebook);
1910  
1911 # Pre-configured world list
1912 $self->addLabel($grid, '<b>Pre-configured world list</b>',
1913 0, 12, 0, 1);
1914 $self->addLabel(
1915 $grid,
1916 '<i>List of pre-configured world profiles supplied with ' . $axmud::SCRIPT . '</i>',
1917 1, 12, 1, 2);
1918  
1919 my $textView = $self->addTextView($grid, undef, FALSE,
1920 1, 12, 2, 10);
1921 my $buffer = $textView->get_buffer();
1922 $buffer->set_text(join("\n", sort {lc($a) cmp lc($b)} ($axmud::CLIENT->constWorldList)));
1923  
1924 $self->addLabel(
1925 $grid,
1926 "If you want to restore one of the pre-configured worlds - replacing any existing"
1927 . " world with\nthe same name - you can use the <i>\';restoreworld\'</i> command. Read"
1928 . " the help for <i>\';restoreworld\'</i>\n<b>carefully</b> before you attempt that"
1929 . " operation.",
1930 1, 12, 10, 12);
1931  
1932 # Tab complete
1933 return 1;
1934 }
1935  
1936 sub settings4Tab {
1937  
1938 # Settings4 tab
1939 #
1940 # Expected arguments
1941 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
1942 #
1943 # Return values
1944 # 'undef' on improper arguments
1945 # 1 otherwise
1946  
1947 my ($self, $innerNotebook, $check) = @_;
1948  
1949 # Local variables
1950 my @columnList;
1951  
1952 # Check for improper arguments
1953 if (! defined $innerNotebook || defined $check) {
1954  
1955 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings4Tab', @_);
1956 }
1957  
1958 # Tab setup
1959 my $grid = $self->addTab('Page _4', $innerNotebook);
1960  
1961 # Session list
1962 $self->addLabel($grid, '<b>Other world list</b>',
1963 0, 12, 0, 1);
1964 $self->addLabel($grid,
1965 '<i>List of worlds which did not originally have pre-configured world profiles</i>',
1966 1, 12, 1, 2);
1967  
1968 # Add a simple list
1969 @columnList = (
1970 'Adult', 'bool',
1971 'Short', 'text',
1972 'Long', 'text',
1973 'Host/Port', 'text',
1974 'Language', 'text',
1975 );
1976  
1977 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
1978 1, 12, 2, 10);
1979  
1980 # Initialise the simple list
1981 $self->settings4Tab_refreshList($slWidget, scalar (@columnList / 2));
1982  
1983 # Tab complete
1984 return 1;
1985 }
1986  
1987 sub settings4Tab_refreshList {
1988  
1989 # Resets the simple list displayed by $self->settings4Tab
1990 #
1991 # Expected arguments
1992 # $slWidget - The GA::Obj::SimpleList
1993 # $columns - The number of columns
1994 #
1995 # Return values
1996 # 'undef' on improper arguments
1997 # 1 otherwise
1998  
1999 my ($self, $slWidget, $columns, $check) = @_;
2000  
2001 # Local variables
2002 my @dataList;
2003  
2004 # Check for improper arguments
2005 if (! defined $slWidget || ! defined $columns || defined $check) {
2006  
2007 return $axmud::CLIENT->writeImproper(
2008 $self->_objClass . '->settings4Tab_refreshList',
2009 @_,
2010 );
2011 }
2012  
2013 # Compile the simple list data
2014 OUTER: foreach my $obj (
2015 sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('constBasicWorldHash'))
2016 ) {
2017 push (@dataList,
2018 $obj->adultFlag,
2019 $obj->name,
2020 $obj->longName,
2021 $obj->host . ' ' . $obj->port,
2022 $obj->language,
2023 );
2024 }
2025  
2026 # Reset the simple list
2027 $self->resetListData($slWidget, [@dataList], $columns);
2028  
2029 return 1;
2030 }
2031  
2032 sub settings5Tab {
2033  
2034 # Settings5 tab
2035 #
2036 # Expected arguments
2037 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
2038 #
2039 # Return values
2040 # 'undef' on improper arguments
2041 # 1 otherwise
2042  
2043 my ($self, $innerNotebook, $check) = @_;
2044  
2045 # Check for improper arguments
2046 if (! defined $innerNotebook || defined $check) {
2047  
2048 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings5Tab', @_);
2049 }
2050  
2051 # Tab setup
2052 my $grid = $self->addTab('Page _5', $innerNotebook);
2053  
2054 # External applications
2055 $self->addLabel($grid, '<b>External applications</b>',
2056 0, 12, 0, 1);
2057  
2058 $self->addLabel(
2059 $grid,
2060 '<i>System command to open a link in a web browser (%s is substituted for the URL)</i>',
2061 1, 12, 1, 2);
2062  
2063 my $entry = $self->addEntry($grid, undef, TRUE,
2064 1, 10, 2, 3);
2065 $entry->set_text($axmud::CLIENT->browserCmd);
2066  
2067 my $button = $self->addButton($grid,
2068 'Set', 'Set the system command to run a web browser', undef,
2069 10, 12, 2, 3);
2070 $button->signal_connect('clicked' => sub {
2071  
2072 my $cmd = $entry->get_text();
2073  
2074 # Set the system command
2075 if ($cmd) {
2076 $self->session->pseudoCmd('setapplication -b <' . $cmd . '>', $self->pseudoCmdMode);
2077 } else {
2078 $self->session->pseudoCmd('setapplication -b', $self->pseudoCmdMode);
2079 }
2080  
2081 # Update the entry box
2082 $entry->set_text($axmud::CLIENT->browserCmd);
2083 });
2084  
2085 $self->addLabel(
2086 $grid,
2087 '<i>System command to contact someone with an email application (%s is the email'
2088 . ' address to use)</i>',
2089 1, 12, 3, 4);
2090  
2091 my $entry2 = $self->addEntry($grid, undef, TRUE,
2092 1, 10, 4, 5);
2093 $entry2->set_text($axmud::CLIENT->emailCmd);
2094  
2095 my $button2 = $self->addButton($grid,
2096 'Set', 'Set the system command to run an email application', undef,
2097 10, 12, 4, 5);
2098 $button2->signal_connect('clicked' => sub {
2099  
2100 my $cmd = $entry2->get_text();
2101  
2102 # Set the system command
2103 if ($cmd) {
2104 $self->session->pseudoCmd('setapplication -e <' . $cmd . '>', $self->pseudoCmdMode);
2105 } else {
2106 $self->session->pseudoCmd('setapplication -e', $self->pseudoCmdMode);
2107 }
2108  
2109 # Update the entry box
2110 $entry2->set_text($axmud::CLIENT->audioCmd);
2111 });
2112  
2113 $self->addLabel(
2114 $grid,
2115 '<i>System command to open a file in an audio player (%s is the full file path)</i>',
2116 1, 12, 5, 6);
2117  
2118 my $entry3 = $self->addEntry($grid, undef, TRUE,
2119 1, 10, 6, 7);
2120 $entry3->set_text($axmud::CLIENT->audioCmd);
2121  
2122 my $button3 = $self->addButton($grid,
2123 'Set', 'Set the system command to run an audio player', undef,
2124 10, 12, 6, 7);
2125 $button3->signal_connect('clicked' => sub {
2126  
2127 my $cmd = $entry3->get_text();
2128  
2129 # Set the system command
2130 if ($cmd) {
2131 $self->session->pseudoCmd('setapplication -a <' . $cmd . '>', $self->pseudoCmdMode);
2132 } else {
2133 $self->session->pseudoCmd('setapplication -a', $self->pseudoCmdMode);
2134 }
2135  
2136 # Update the entry box
2137 $entry3->set_text($axmud::CLIENT->audioCmd);
2138 });
2139  
2140 $self->addLabel(
2141 $grid,
2142 '<i>System command to open a file in a text editor (%s is the full file path)</i>',
2143 1, 12, 7, 8);
2144  
2145 my $entry4 = $self->addEntry($grid, undef, TRUE,
2146 1, 10, 8, 9);
2147 $entry4->set_text($axmud::CLIENT->textEditCmd);
2148  
2149 my $button4 = $self->addButton($grid,
2150 'Set', 'Set the system command to open a text editor', undef,
2151 10, 12, 8, 9);
2152 $button4->signal_connect('clicked' => sub {
2153  
2154 my $cmd = $entry4->get_text();
2155  
2156 # Set the system command
2157 if ($cmd) {
2158 $self->session->pseudoCmd('setapplication -t <' . $cmd . '>', $self->pseudoCmdMode);
2159 } else {
2160 $self->session->pseudoCmd('setapplication -t', $self->pseudoCmdMode);
2161 }
2162  
2163 # Update the entry box
2164 $entry4->set_text($axmud::CLIENT->textEditCmd);
2165 });
2166  
2167 my $button5 = $self->addButton($grid,
2168 'Use default Linux commands',
2169 'Set system commands commonly used on Linux installations',
2170 undef,
2171 1, 4, 9, 10);
2172 $button5->signal_connect('clicked' => sub {
2173  
2174 # Update external application commands
2175 $self->session->pseudoCmd('resetapplication -l', $self->pseudoCmdMode);
2176 # Update widgets
2177 $entry->set_text($axmud::CLIENT->browserCmd);
2178 $entry2->set_text($axmud::CLIENT->emailCmd);
2179 $entry3->set_text($axmud::CLIENT->audioCmd);
2180 $entry4->set_text($axmud::CLIENT->textEditCmd);
2181 });
2182  
2183 my $button6 = $self->addButton($grid,
2184 'Use default MS Windows commands',
2185 'Set system commands commonly used on MS Windows installations',
2186 undef,
2187 4, 8, 9, 10);
2188 $button6->signal_connect('clicked' => sub {
2189  
2190 # Update external application commands
2191 $self->session->pseudoCmd('resetapplication -w', $self->pseudoCmdMode);
2192 # Update widgets
2193 $entry->set_text($axmud::CLIENT->browserCmd);
2194 $entry2->set_text($axmud::CLIENT->emailCmd);
2195 $entry3->set_text($axmud::CLIENT->audioCmd);
2196 $entry4->set_text($axmud::CLIENT->textEditCmd);
2197 });
2198  
2199 my $button7 = $self->addButton($grid,
2200 'Detect default commands',
2201 'Set system commands commonly used on the current operation system',
2202 undef,
2203 8, 12, 9, 10);
2204 $button7->signal_connect('clicked' => sub {
2205  
2206 # Update external application commands
2207 $self->session->pseudoCmd('resetapplication', $self->pseudoCmdMode);
2208 # Update widgets
2209 $entry->set_text($axmud::CLIENT->browserCmd);
2210 $entry2->set_text($axmud::CLIENT->emailCmd);
2211 $entry3->set_text($axmud::CLIENT->audioCmd);
2212 $entry4->set_text($axmud::CLIENT->textEditCmd);
2213 });
2214  
2215 # Tab complete
2216 return 1;
2217 }
2218  
2219 sub settings6Tab {
2220  
2221 # Settings6 tab
2222 #
2223 # Expected arguments
2224 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
2225 #
2226 # Return values
2227 # 'undef' on improper arguments
2228 # 1 otherwise
2229  
2230 my ($self, $innerNotebook, $check) = @_;
2231  
2232 # Local variables
2233 my ($min, $max, $string);
2234  
2235 # Check for improper arguments
2236 if (! defined $innerNotebook || defined $check) {
2237  
2238 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings6Tab', @_);
2239 }
2240  
2241 # Tab setup
2242 my $grid = $self->addTab('Page _6', $innerNotebook);
2243  
2244 # Buffer sizes
2245 $self->addLabel($grid, '<b>Buffer/textview sizes and system delays</b>',
2246 0, 12, 0, 1);
2247  
2248 $min = $axmud::CLIENT->constMinBufferSize;
2249 $max = $axmud::CLIENT->constMaxBufferSize;
2250 $string = 'range ' . $min . '-' . $max;
2251  
2252 $self->addLabel(
2253 $grid,
2254 '<i>Size of display buffers (stores text received from the world, ' . $string
2255 . ', recommended size ' . $axmud::CLIENT->constDisplayBufferSize . ')</i>',
2256 1, 12, 1, 2);
2257  
2258 my $entry = $self->addEntryWithIcon($grid, undef, 'int', $min, $max,
2259 1, 8, 2, 3);
2260 $entry->set_text($axmud::CLIENT->customDisplayBufferSize);
2261  
2262 my $button = $self->addButton($grid,
2263 'Set', 'Set the size of display buffers', undef,
2264 8, 10, 2, 3);
2265 $button->signal_connect('clicked' => sub {
2266  
2267 my $size = $entry->get_text();
2268  
2269 if ($self->checkEntryIcon($entry)) {
2270  
2271 # Set the buffer size
2272 $self->session->pseudoCmd('setdisplaybuffer ' . $size, $self->pseudoCmdMode);
2273 }
2274  
2275 # Update the entry box
2276 $entry->set_text($axmud::CLIENT->customDisplayBufferSize);
2277 });
2278  
2279 my $button2 = $self->addButton($grid,
2280 'Reset', 'Reset the size of display buffers', undef,
2281 10, 12, 2, 3);
2282 $button2->signal_connect('clicked' => sub {
2283  
2284 # Reset the buffer size
2285 $self->session->pseudoCmd('setdisplaybuffer', $self->pseudoCmdMode);
2286  
2287 # Update the entry box
2288 $entry->set_text($axmud::CLIENT->customDisplayBufferSize);
2289 });
2290  
2291 $self->addLabel(
2292 $grid,
2293 '<i>Size of instruction buffers (stores processed instructions, ' . $string
2294 . ', recommended size ' . $axmud::CLIENT->constInstructBufferSize . ')</i>',
2295 1, 12, 3, 4);
2296  
2297 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', $min, $max,
2298 1, 8, 4, 5);
2299 $entry2->set_text($axmud::CLIENT->customInstructBufferSize);
2300  
2301 my $button3 = $self->addButton($grid,
2302 'Set', 'Set the size of instruction buffers', undef,
2303 8, 10, 4, 5);
2304 $button3->signal_connect('clicked' => sub {
2305  
2306 my $size = $entry2->get_text();
2307  
2308 if ($self->checkEntryIcon($entry)) {
2309  
2310 # Set the buffer size
2311 $self->session->pseudoCmd('setinstructionbuffer ' . $size, $self->pseudoCmdMode);
2312 }
2313  
2314 # Update the entry box
2315 $entry2->set_text($axmud::CLIENT->customInstructBufferSize);
2316 });
2317  
2318 my $button4 = $self->addButton($grid,
2319 'Reset', 'Reset the size of instruction buffers', undef,
2320 10, 12, 4, 5);
2321 $button4->signal_connect('clicked' => sub {
2322  
2323 # Reset the buffer size
2324 $self->session->pseudoCmd('setinstructionbuffer', $self->pseudoCmdMode);
2325  
2326 # Update the entry box
2327 $entry2->set_text($axmud::CLIENT->customInstructBufferSize);
2328 });
2329  
2330 $self->addLabel(
2331 $grid,
2332 '<i>Size of world command buffers (stores commands sent to the world, ' . $string
2333 . ', recommended size ' . $axmud::CLIENT->constCmdBufferSize . ')</i>',
2334 1, 12, 5, 6);
2335  
2336 my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', $min, $max,
2337 1, 8, 6, 7);
2338 $entry3->set_text($axmud::CLIENT->customCmdBufferSize);
2339  
2340 my $button5 = $self->addButton($grid,
2341 'Set', 'Set the size of world command buffers', undef,
2342 8, 10, 6, 7);
2343 $button5->signal_connect('clicked' => sub {
2344  
2345 my $size = $entry3->get_text();
2346  
2347 if ($self->checkEntryIcon($entry)) {
2348  
2349 # Set the buffer size
2350 $self->session->pseudoCmd('setcommandbuffer ' . $size, $self->pseudoCmdMode);
2351 }
2352  
2353 # Update the entry box
2354 $entry3->set_text($axmud::CLIENT->customCmdBufferSize);
2355 });
2356  
2357 my $button6 = $self->addButton($grid,
2358 'Reset', 'Reset the size of world command buffers', undef,
2359 10, 12, 6, 7);
2360 $button6->signal_connect('clicked' => sub {
2361  
2362 # Reset the buffer size
2363 $self->session->pseudoCmd('setcommandbuffer', $self->pseudoCmdMode);
2364  
2365 # Update the entry box
2366 $entry3->set_text($axmud::CLIENT->customCmdBufferSize);
2367 });
2368  
2369 $self->addLabel(
2370 $grid,
2371 '<i>Size of textviews (used only when a maximum size is required, recommended size'
2372 . ' 10000, use 0 for no maximum)</i>',
2373 1, 12, 8, 9);
2374  
2375 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, $max,
2376 1, 8, 9, 10);
2377 $entry4->set_text($axmud::CLIENT->customTextBufferSize);
2378  
2379 my $button7 = $self->addButton($grid,
2380 'Set', 'Set the textview size', undef,
2381 8, 10, 9, 10);
2382 $button7->signal_connect('clicked' => sub {
2383  
2384 my $size = $entry4->get_text();
2385  
2386 if ($self->checkEntryIcon($entry)) {
2387  
2388 # Set the textview size
2389 $self->session->pseudoCmd('settextview ' . $size, $self->pseudoCmdMode);
2390 }
2391  
2392 # Update the entry box
2393 $entry4->set_text($axmud::CLIENT->customTextBufferSize);
2394 });
2395  
2396 my $button8 = $self->addButton($grid,
2397 'Reset', 'Reset the textview size', undef,
2398 10, 12, 9, 10);
2399 $button8->signal_connect('clicked' => sub {
2400  
2401 # Reset the textview size
2402 $self->session->pseudoCmd('settextview', $self->pseudoCmdMode);
2403  
2404 # Update the entry box
2405 $entry4->set_text($axmud::CLIENT->customTextBufferSize);
2406 });
2407  
2408 $self->addLabel(
2409 $grid,
2410 '<i>Time to wait (in seconds) before treating received text as a prompt (range 0.1 - 5,'
2411 . ' recommended delay 0.5)</i>',
2412 1, 12, 10, 11);
2413  
2414 my $entry5 = $self->addEntryWithIcon($grid, undef, 'float', 0.1, 5,
2415 1, 8, 11, 12);
2416 $entry5->set_text($axmud::CLIENT->promptWaitTime);
2417  
2418 my $button9 = $self->addButton($grid,
2419 'Set', 'Set the system prompt delay', undef,
2420 8, 10, 11, 12);
2421 $button9->signal_connect('clicked' => sub {
2422  
2423 my $interval = $entry5->get_text();
2424  
2425 if ($self->checkEntryIcon($entry5)) {
2426  
2427 # Set the system prompt delay
2428 $self->session->pseudoCmd('setdelay -p ' . $interval, $self->pseudoCmdMode);
2429  
2430 # Update the entry box
2431 $entry5->set_text($axmud::CLIENT->promptWaitTime);
2432 }
2433 });
2434  
2435 my $button10 = $self->addButton($grid,
2436 'Reset', 'Reset the system prompt delay', undef,
2437 10, 12, 11, 12);
2438 $button10->signal_connect('clicked' => sub {
2439  
2440 # Set the system prompt delay
2441 $self->session->pseudoCmd('setdelay -p', $self->pseudoCmdMode);
2442  
2443 # Update the entry box
2444 $entry5->set_text($axmud::CLIENT->promptWaitTime);
2445 });
2446  
2447 $self->addLabel(
2448 $grid,
2449 '<i>Time to wait for a login (in seconds) before displaying a warning (recommended'
2450 . ' delay 60, use 0 to show immediately)</i>',
2451 1, 12, 12, 13);
2452  
2453 my $entry6 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
2454 1, 8, 13, 14);
2455 $entry6->set_text($axmud::CLIENT->loginWarningTime);
2456  
2457 my $button11 = $self->addButton($grid,
2458 'Set', 'Set the system login warning delay', undef,
2459 8, 10, 13, 14);
2460 $button11->signal_connect('clicked' => sub {
2461  
2462 my $interval = $entry6->get_text();
2463  
2464 if ($self->checkEntryIcon($entry6)) {
2465  
2466 # Set the system login warning delay
2467 $self->session->pseudoCmd('setdelay -l ' . $interval, $self->pseudoCmdMode);
2468  
2469 # Update the entry box
2470 $entry6->set_text($axmud::CLIENT->loginWarningTime);
2471 }
2472 });
2473  
2474 my $button12 = $self->addButton($grid,
2475 'Reset', 'Reset the system login warning delay', undef,
2476 10, 12, 13, 14);
2477 $button12->signal_connect('clicked' => sub {
2478  
2479 # Set the system prompt delay
2480 $self->session->pseudoCmd('setdelay -l', $self->pseudoCmdMode);
2481  
2482 # Update the entry box
2483 $entry6->set_text($axmud::CLIENT->loginWarningTime);
2484 });
2485  
2486 # Tab complete
2487 return 1;
2488 }
2489  
2490 sub settings7Tab {
2491  
2492 # Settings7 tab
2493 #
2494 # Expected arguments
2495 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
2496 #
2497 # Return values
2498 # 'undef' on improper arguments
2499 # 1 otherwise
2500  
2501 my ($self, $innerNotebook, $check) = @_;
2502  
2503 # Check for improper arguments
2504 if (! defined $innerNotebook || defined $check) {
2505  
2506 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings7Tab', @_);
2507 }
2508  
2509 # Tab setup
2510 my $grid = $self->addTab('Page _7', $innerNotebook);
2511  
2512 # Telnet options
2513 $self->addLabel($grid, '<b>Telnet option negotiations</b>',
2514 0, 6, 0, 1);
2515  
2516 my $checkButton = $self->addCheckButton(
2517 $grid, 'Allow ECHO (hide passwords, etc)', undef, TRUE,
2518 1, 6, 1, 2);
2519 $checkButton->set_active($axmud::CLIENT->useEchoFlag);
2520 $checkButton->signal_connect('toggled' => sub {
2521  
2522 $axmud::CLIENT->toggle_telnetOption('echo', $checkButton->get_active());
2523 });
2524  
2525 my $checkButton2 = $self->addCheckButton(
2526 $grid, 'Allow SGA (Suppress Go Ahead)', undef, TRUE,
2527 1, 6, 2, 3);
2528 $checkButton2->set_active($axmud::CLIENT->useSgaFlag);
2529 $checkButton2->signal_connect('toggled' => sub {
2530  
2531 $axmud::CLIENT->toggle_telnetOption('sga', $checkButton2->get_active());
2532 });
2533  
2534 my $checkButton3 = $self->addCheckButton(
2535 $grid, 'Allow TTYPE (detect Terminal Type)', undef, TRUE,
2536 1, 6, 3, 4);
2537 $checkButton3->set_active($axmud::CLIENT->useTTypeFlag);
2538 $checkButton3->signal_connect('toggled' => sub {
2539  
2540 $axmud::CLIENT->toggle_telnetOption('ttype', $checkButton3->get_active());
2541 });
2542  
2543 my $checkButton4 = $self->addCheckButton(
2544 $grid, 'Allow EOR (negotiate End Of Record)', undef, TRUE,
2545 1, 6, 4, 5);
2546 $checkButton4->set_active($axmud::CLIENT->useEorFlag);
2547 $checkButton4->signal_connect('toggled' => sub {
2548  
2549 $axmud::CLIENT->toggle_telnetOption('eor', $checkButton4->get_active());
2550 });
2551  
2552 my $checkButton5 = $self->addCheckButton(
2553 $grid, 'Allow NAWS (Negotiate About Window Size)', undef, TRUE,
2554 1, 6, 5, 6);
2555 $checkButton5->set_active($axmud::CLIENT->useNawsFlag);
2556 $checkButton5->signal_connect('toggled' => sub {
2557  
2558 $axmud::CLIENT->toggle_telnetOption('naws', $checkButton5->get_active());
2559 });
2560  
2561 my $checkButton6 = $self->addCheckButton(
2562 $grid, 'Allow NEW-ENVIRON (New Environment option)', undef, TRUE,
2563 1, 6, 6, 7);
2564 $checkButton6->set_active($axmud::CLIENT->useNewEnvironFlag);
2565 $checkButton6->signal_connect('toggled' => sub {
2566  
2567 $axmud::CLIENT->toggle_telnetOption('new_environ', $checkButton6->get_active());
2568 });
2569  
2570 my $checkButton7 = $self->addCheckButton(
2571 $grid, 'Allow CHARSET (Character Set and translation)', undef, TRUE,
2572 1, 6, 7, 8);
2573 $checkButton7->set_active($axmud::CLIENT->useCharSetFlag);
2574 $checkButton7->signal_connect('toggled' => sub {
2575  
2576 $axmud::CLIENT->toggle_telnetOption('charset', $checkButton7->get_active());
2577 });
2578  
2579 # MUD protocols options
2580 $self->addLabel($grid, '<b>MUD protocols</b>',
2581 7, 12, 0, 1);
2582 my $checkButton8 = $self->addCheckButton(
2583 $grid, 'Allow MSDP (Mud Server Data Protocol)', undef, TRUE,
2584 7, 12, 1, 2);
2585 $checkButton8->set_active($axmud::CLIENT->useMsdpFlag);
2586 $checkButton8->signal_connect('toggled' => sub {
2587  
2588 $axmud::CLIENT->toggle_mudProtocol('msdp', $checkButton8->get_active());
2589 });
2590  
2591 my $checkButton9 = $self->addCheckButton(
2592 $grid, 'Allow MSSP (Mud Server Status Protocol)', undef, TRUE,
2593 7, 12, 2, 3);
2594 $checkButton9->set_active($axmud::CLIENT->useMsspFlag);
2595 $checkButton9->signal_connect('toggled' => sub {
2596  
2597 $axmud::CLIENT->toggle_mudProtocol('mssp', $checkButton9->get_active());
2598 });
2599  
2600 my $checkButton10 = $self->addCheckButton(
2601 $grid, 'Allow MCCP (Mud Client Compression Protocol)', undef, TRUE,
2602 7, 12, 3, 4);
2603 $checkButton10->set_active($axmud::CLIENT->useMccpFlag);
2604 $checkButton10->signal_connect('toggled' => sub {
2605  
2606 $axmud::CLIENT->toggle_mudProtocol('mccp', $checkButton10->get_active());
2607 });
2608  
2609 my $checkButton11 = $self->addCheckButton(
2610 $grid, 'Allow ZMP (Zenith Mud Protocol)', undef, TRUE,
2611 7, 12, 4, 5);
2612 $checkButton11->set_active($axmud::CLIENT->useZmpFlag);
2613 $checkButton11->signal_connect('toggled' => sub {
2614  
2615 $axmud::CLIENT->toggle_mudProtocol('zmp', $checkButton11->get_active());
2616 });
2617  
2618 my $checkButton12 = $self->addCheckButton(
2619 $grid, 'Allow AARD102 (Aardwolf 102 channel)', undef, TRUE,
2620 7, 12, 5, 6);
2621 $checkButton12->set_active($axmud::CLIENT->useAard102Flag);
2622 $checkButton12->signal_connect('toggled' => sub {
2623  
2624 $axmud::CLIENT->toggle_mudProtocol('aard102', $checkButton12->get_active());
2625 });
2626  
2627 my $checkButton13 = $self->addCheckButton(
2628 $grid, 'Allow ATCP (Achaea Telnet Client Protocol)', undef, TRUE,
2629 7, 12, 6, 7);
2630 $checkButton13->set_active($axmud::CLIENT->useAtcpFlag);
2631 $checkButton13->signal_connect('toggled' => sub {
2632  
2633 $axmud::CLIENT->toggle_mudProtocol('atcp', $checkButton13->get_active());
2634 });
2635  
2636 my $checkButton14 = $self->addCheckButton(
2637 $grid, 'Allow GMCP (Generic MUD Communication Protocol)', undef, TRUE,
2638 7, 12, 7, 8);
2639 $checkButton14->set_active($axmud::CLIENT->useGmcpFlag);
2640 $checkButton14->signal_connect('toggled' => sub {
2641  
2642 $axmud::CLIENT->toggle_mudProtocol('gmcp', $checkButton14->get_active());
2643 });
2644  
2645 my $checkButton15 = $self->addCheckButton(
2646 $grid, 'Allow MTTS (Mud Terminal Type Standard)', undef, TRUE,
2647 7, 12, 8, 9);
2648 $checkButton15->set_active($axmud::CLIENT->useMttsFlag);
2649 $checkButton15->signal_connect('toggled' => sub {
2650  
2651 $axmud::CLIENT->toggle_mudProtocol('mtts', $checkButton15->get_active());
2652 });
2653  
2654 my $checkButton16 = $self->addCheckButton(
2655 $grid, 'Allow MNES (MUD NEW-ENVIRON Standard)', undef, TRUE,
2656 7, 12, 9, 10);
2657 $checkButton16->set_active($axmud::CLIENT->useMnesFlag);
2658 # (->signal_connect appears below)
2659  
2660 my $checkButton17 = $self->addCheckButton(
2661 $grid, 'Allow MNES to send user\'s real IP address', undef, TRUE,
2662 8, 12, 10, 11);
2663 $checkButton17->set_active($axmud::CLIENT->allowMnesSendIPFlag);
2664 $checkButton17->signal_connect('toggled' => sub {
2665  
2666 $axmud::CLIENT->toggle_mnesFlag('send_ip', $checkButton17->get_active());
2667 });
2668  
2669 my $checkButton18 = $self->addCheckButton(
2670 $grid, 'Allow MCP (Mud Client Protocol)', undef, TRUE,
2671 7, 12, 11, 12);
2672 $checkButton18->set_active($axmud::CLIENT->useMcpFlag);
2673 $checkButton18->signal_connect('toggled' => sub {
2674  
2675 $axmud::CLIENT->toggle_mudProtocol('mcp', $checkButton18->get_active());
2676 });
2677  
2678 # (->signal_connect from above)
2679 $checkButton16->signal_connect('toggled' => sub {
2680  
2681 $axmud::CLIENT->toggle_mudProtocol('mnes', $checkButton16->get_active());
2682  
2683 if ($axmud::CLIENT->useMnesFlag) {
2684 $checkButton17->set_sensitive(TRUE);
2685 } else {
2686 $checkButton17->set_sensitive(FALSE);
2687 }
2688 });
2689  
2690 my $checkButton19 = $self->addCheckButton(
2691 $grid, 'Allow Pueblo (partial support)', undef, TRUE,
2692 7, 12, 12, 13);
2693 $checkButton19->set_active($axmud::CLIENT->usePuebloFlag);
2694 $checkButton19->signal_connect('toggled' => sub {
2695  
2696 $axmud::CLIENT->toggle_mudProtocol('pueblo', $checkButton19->get_active());
2697 });
2698  
2699  
2700 # Tab complete
2701 return 1;
2702 }
2703  
2704 sub settings8Tab {
2705  
2706 # Settings8 tab
2707 #
2708 # Expected arguments
2709 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
2710 #
2711 # Return values
2712 # 'undef' on improper arguments
2713 # 1 otherwise
2714  
2715 my ($self, $innerNotebook, $check) = @_;
2716  
2717 # Check for improper arguments
2718 if (! defined $innerNotebook || defined $check) {
2719  
2720 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings8Tab', @_);
2721 }
2722  
2723 # Tab setup
2724 my $grid = $self->addTab('Page _8', $innerNotebook);
2725  
2726 # MXP
2727 $self->addLabel($grid, '<b>MXP</b>',
2728 0, 6, 0, 1);
2729  
2730 my $checkButton = $self->addCheckButton(
2731 $grid, 'Allow MXP (MUD eXtension Protocol)', undef, TRUE,
2732 1, 6, 1, 2);
2733 $checkButton->set_active($axmud::CLIENT->useMxpFlag);
2734 # (->signal_connect appears below)
2735  
2736 my $checkButton2 = $self->addCheckButton(
2737 $grid, 'Allow MXP to change fonts', undef, TRUE,
2738 2, 6, 2, 3);
2739 $checkButton2->set_active($axmud::CLIENT->allowMxpFontFlag);
2740 $checkButton2->signal_connect('toggled' => sub {
2741  
2742 $axmud::CLIENT->set_allowMxpFlag('font', $checkButton2->get_active());
2743 });
2744  
2745 my $checkButton3 = $self->addCheckButton(
2746 $grid, 'Allow MXP to display images', undef, TRUE,
2747 2, 6, 3, 4);
2748 $checkButton3->set_active($axmud::CLIENT->allowMxpImageFlag);
2749 # (->signal_connect appears below)
2750  
2751 my $checkButton4 = $self->addCheckButton(
2752 $grid, 'Allow MXP to download image files', undef, TRUE,
2753 2, 6, 4, 5);
2754 $checkButton4->set_active($axmud::CLIENT->allowMxpLoadImageFlag);
2755 $checkButton4->signal_connect('toggled' => sub {
2756  
2757 $axmud::CLIENT->set_allowMxpFlag('load_image', $checkButton4->get_active());
2758 });
2759  
2760 my $checkButton5 = $self->addCheckButton(
2761 $grid, 'Allow MXP to use world\'s own graphics formats', undef, TRUE,
2762 2, 6, 5, 6);
2763 $checkButton5->set_active($axmud::CLIENT->allowMxpFilterImageFlag);
2764 $checkButton5->signal_connect('toggled' => sub {
2765  
2766 $axmud::CLIENT->set_allowMxpFlag('filter_image', $checkButton5->get_active());
2767 });
2768  
2769 my $checkButton6 = $self->addCheckButton(
2770 $grid, 'Allow MXP to play sound/music files', undef, TRUE,
2771 2, 6, 6, 7);
2772 $checkButton6->set_active($axmud::CLIENT->allowMxpSoundFlag);
2773 # (->signal_connect appears below)
2774  
2775 my $checkButton7 = $self->addCheckButton(
2776 $grid, 'Allow MXP to download sound/music files', undef, TRUE,
2777 2, 6, 7, 8);
2778 $checkButton7->set_active($axmud::CLIENT->allowMxpLoadSoundFlag);
2779 $checkButton7->signal_connect('toggled' => sub {
2780  
2781 $axmud::CLIENT->set_allowMxpFlag('load_sound', $checkButton7->get_active());
2782 });
2783  
2784 my $checkButton8 = $self->addCheckButton(
2785 $grid, 'Allow MXP to display gauges/status bars', undef, TRUE,
2786 2, 6, 8, 9);
2787 $checkButton8->set_active($axmud::CLIENT->allowMxpGaugeFlag);
2788 $checkButton8->signal_connect('toggled' => sub {
2789  
2790 $axmud::CLIENT->set_allowMxpFlag('gauge', $checkButton8->get_active());
2791 });
2792  
2793 # (right column)
2794  
2795 my $checkButton9 = $self->addCheckButton(
2796 $grid, 'Allow MXP to use frames', undef, TRUE,
2797 7, 12, 2, 3);
2798 $checkButton9->set_active($axmud::CLIENT->allowMxpFrameFlag);
2799 $checkButton9->signal_connect('toggled' => sub {
2800  
2801 $axmud::CLIENT->set_allowMxpFlag('frame', $checkButton9->get_active());
2802 });
2803  
2804 my $checkButton10 = $self->addCheckButton(
2805 $grid, 'Allow MXP to use frames inside \'main\' windows', undef, TRUE,
2806 7, 12, 3, 4);
2807 $checkButton10->set_active($axmud::CLIENT->allowMxpInteriorFlag);
2808 $checkButton10->signal_connect('toggled' => sub {
2809  
2810 $axmud::CLIENT->set_allowMxpFlag('interior', $checkButton10->get_active());
2811 });
2812  
2813 my $checkButton11 = $self->addCheckButton(
2814 $grid, 'Allow MXP to crosslink to new servers', undef, TRUE,
2815 7, 12, 4, 5);
2816 $checkButton11->set_active($axmud::CLIENT->allowMxpCrosslinkFlag);
2817 $checkButton11->signal_connect('toggled' => sub {
2818  
2819 $axmud::CLIENT->set_allowMxpFlag('crosslink', $checkButton11->get_active());
2820 });
2821  
2822 my $checkButton12 = $self->addCheckButton(
2823 $grid, 'Allow Locator task to rely on MXP room data', undef, TRUE,
2824 7, 12, 5, 6);
2825 $checkButton12->set_active($axmud::CLIENT->allowMxpRoomFlag);
2826 $checkButton12->signal_connect('toggled' => sub {
2827  
2828 $axmud::CLIENT->set_allowMxpFlag('room', $checkButton12->get_active());
2829 });
2830  
2831 my $checkButton13 = $self->addCheckButton(
2832 $grid, 'Allow some illegal keywords (not recommended)', undef, TRUE,
2833 7, 12, 6, 7);
2834 $checkButton13->set_active($axmud::CLIENT->allowMxpFlexibleFlag);
2835 $checkButton13->signal_connect('toggled' => sub {
2836  
2837 $axmud::CLIENT->set_allowMxpFlag('flexible', $checkButton13->get_active());
2838 });
2839  
2840 my $checkButton14 = $self->addCheckButton(
2841 $grid, 'Assume world has enabled MXP (for IRE MUDs)', undef, TRUE,
2842 7, 12, 7, 8);
2843 $checkButton14->set_active($axmud::CLIENT->allowMxpPermFlag);
2844 $checkButton14->signal_connect('toggled' => sub {
2845  
2846 $axmud::CLIENT->set_allowMxpFlag('perm', $checkButton14->get_active());
2847 });
2848  
2849 # (bottom left columN)
2850  
2851 # MSP
2852 $self->addLabel($grid, '<b>MSP</b>',
2853 0, 6, 9, 10);
2854  
2855 my $checkButton16 = $self->addCheckButton(
2856 $grid, 'Allow MSP (Mud Sound Protocol)', undef, TRUE,
2857 1, 6, 10, 11);
2858 $checkButton16->set_active($axmud::CLIENT->useMspFlag);
2859 # (->signal_connect appears below)
2860  
2861 my $checkButton17 = $self->addCheckButton(
2862 $grid, 'Allow MSP sounds to play concurrently', undef, TRUE,
2863 2, 6, 11, 12);
2864 $checkButton17->set_active($axmud::CLIENT->allowMspMultipleFlag);
2865 $checkButton17->signal_connect('toggled' => sub {
2866  
2867 $axmud::CLIENT->toggle_mspFlag('multiple', $checkButton17->get_active());
2868 });
2869  
2870 my $checkButton18 = $self->addCheckButton(
2871 $grid, 'Automatically download MSP sound files', undef, TRUE,
2872 2, 6, 12, 13);
2873 $checkButton18->set_active($axmud::CLIENT->allowMspLoadSoundFlag);
2874 $checkButton18->signal_connect('toggled' => sub {
2875  
2876 $axmud::CLIENT->toggle_mspFlag('load', $checkButton18->get_active());
2877 });
2878  
2879 my $checkButton19 = $self->addCheckButton(
2880 $grid, 'Allow flexible tag placement (not recommended)', undef, TRUE,
2881 2, 6, 13, 14);
2882 $checkButton19->set_active($axmud::CLIENT->allowMspFlexibleFlag);
2883 $checkButton19->signal_connect('toggled' => sub {
2884  
2885 $axmud::CLIENT->toggle_mspFlag('flexible', $checkButton19->get_active());
2886 });
2887  
2888 # Sensitise/desensitise buttons
2889 $self->settings8Tab_sensitiseButtons(
2890 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2891 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2892 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2893 $checkButton17, $checkButton18, $checkButton19,
2894 );
2895  
2896 # (->signal_connects from above)
2897  
2898 # Allow MXP (MUD eXtension Protocol)
2899 $checkButton->signal_connect('toggled' => sub {
2900  
2901 # Sensitise/desensitise buttons
2902 $self->settings8Tab_sensitiseButtons(
2903 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2904 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2905 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2906 $checkButton17, $checkButton18, $checkButton19,
2907 );
2908  
2909 $axmud::CLIENT->toggle_mudProtocol('mxp', $checkButton->get_active());
2910 });
2911  
2912 # Allow MXP to display images
2913 $checkButton3->signal_connect('toggled' => sub {
2914  
2915 if (! $checkButton3->get_active()) {
2916  
2917 # (Only send an unsoliciated <SUPPORTS> tag once)
2918 $axmud::CLIENT->set_mxpPreventSupportFlag(TRUE);
2919 $checkButton4->set_active(FALSE);
2920 $checkButton5->set_active(FALSE);
2921 $axmud::CLIENT->set_mxpPreventSupportFlag(FALSE);
2922 $axmud::CLIENT->set_allowMxpFlag('image', FALSE);
2923  
2924 } else {
2925  
2926 $checkButton4->set_sensitive(TRUE);
2927 $checkButton5->set_sensitive(TRUE);
2928 $axmud::CLIENT->set_allowMxpFlag('image', TRUE);
2929 }
2930  
2931 # Sensitise/desensitise buttons
2932 $self->settings8Tab_sensitiseButtons(
2933 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2934 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2935 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2936 $checkButton17, $checkButton18, $checkButton19,
2937  
2938 );
2939 });
2940  
2941 # Allow MXP to play sound/music files
2942 $checkButton6->signal_connect('toggled' => sub {
2943  
2944 if (! $checkButton6->get_active()) {
2945  
2946 # (Only send an unsoliciated <SUPPORTS> tag once)
2947 $axmud::CLIENT->set_mxpPreventSupportFlag(TRUE);
2948 $checkButton7->set_active(FALSE);
2949 $axmud::CLIENT->set_mxpPreventSupportFlag(FALSE);
2950 $axmud::CLIENT->set_allowMxpFlag('sound', FALSE);
2951  
2952 } else {
2953  
2954 $checkButton7->set_sensitive(TRUE);
2955 $axmud::CLIENT->set_allowMxpFlag('sound', TRUE);
2956 }
2957  
2958 # Sensitise/desensitise buttons
2959 $self->settings8Tab_sensitiseButtons(
2960 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2961 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2962 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2963 $checkButton17, $checkButton18, $checkButton19,
2964 );
2965 });
2966  
2967 # Allow MSP (Mud Sound Protocol)
2968 $checkButton16->signal_connect('toggled' => sub {
2969  
2970 # Sensitise/desensitise buttons
2971 $self->settings8Tab_sensitiseButtons(
2972 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2973 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2974 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2975 $checkButton17, $checkButton18, $checkButton19,
2976 );
2977  
2978 $axmud::CLIENT->toggle_mudProtocol('msp', $checkButton16->get_active());
2979 });
2980  
2981 # Tab complete
2982 return 1;
2983 }
2984  
2985 sub settings8Tab_sensitiseButtons {
2986  
2987 # Sensitises/desensitises various buttons in $self->settings8Tab, depending on current
2988 # conditions
2989 #
2990 # Expected arguments
2991 # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
2992 # $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
2993 # $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
2994 # $checkButton17, $checkButton18, $checkButton19
2995 # - The affected buttons
2996 #
2997 # Return values
2998 # 'undef' on improper arguments
2999 # 1 otherwise
3000  
3001 my (
3002 $self, $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
3003 $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10,
3004 $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16,
3005 $checkButton17, $checkButton18, $checkButton19, $check
3006 ) = @_;
3007  
3008 # Local variables
3009 my @dataList;
3010  
3011 # Check for improper arguments
3012 if (
3013 ! defined $checkButton || ! defined $checkButton2 || ! defined $checkButton3
3014 || ! defined $checkButton4 || ! defined $checkButton5 || ! defined $checkButton6
3015 || ! defined $checkButton7 || ! defined $checkButton8 || ! defined $checkButton9
3016 || ! defined $checkButton10 || ! defined $checkButton11 || ! defined $checkButton12
3017 || ! defined $checkButton13 || ! defined $checkButton14 || ! defined $checkButton16
3018 || ! defined $checkButton17 || ! defined $checkButton18 || ! defined $checkButton19
3019 || defined $check
3020 ) {
3021 return $axmud::CLIENT->writeImproper(
3022 $self->_objClass . '->settings8Tab_sensitiseButtons',
3023 @_,
3024 );
3025 }
3026  
3027 if (! $checkButton->get_active()) {
3028  
3029 $checkButton2->set_sensitive(FALSE);
3030 $checkButton3->set_sensitive(FALSE);
3031 $checkButton4->set_sensitive(FALSE);
3032 $checkButton5->set_sensitive(FALSE);
3033 $checkButton6->set_sensitive(FALSE);
3034 $checkButton7->set_sensitive(FALSE);
3035 $checkButton8->set_sensitive(FALSE);
3036 $checkButton9->set_sensitive(FALSE);
3037 $checkButton10->set_sensitive(FALSE);
3038 $checkButton11->set_sensitive(FALSE);
3039 $checkButton12->set_sensitive(FALSE);
3040 $checkButton13->set_sensitive(FALSE);
3041 $checkButton14->set_sensitive(FALSE);
3042  
3043 } else {
3044  
3045 $checkButton2->set_sensitive(TRUE);
3046 $checkButton3->set_sensitive(TRUE);
3047  
3048 if (! $checkButton3->get_active()) {
3049 $checkButton4->set_sensitive(FALSE);
3050 $checkButton5->set_sensitive(FALSE);
3051 } else {
3052 $checkButton4->set_sensitive(TRUE);
3053 $checkButton5->set_sensitive(TRUE);
3054 }
3055  
3056 $checkButton6->set_sensitive(TRUE);
3057  
3058 if (! $checkButton6->get_active()) {
3059 $checkButton7->set_sensitive(FALSE);
3060 } else {
3061 $checkButton7->set_sensitive(TRUE);
3062 }
3063  
3064 $checkButton8->set_sensitive(TRUE);
3065 $checkButton9->set_sensitive(TRUE);
3066 $checkButton10->set_sensitive(TRUE);
3067 $checkButton11->set_sensitive(TRUE);
3068 $checkButton12->set_sensitive(TRUE);
3069 $checkButton13->set_sensitive(TRUE);
3070 $checkButton14->set_sensitive(TRUE);
3071 }
3072  
3073  
3074 if (! $checkButton16->get_active()) {
3075  
3076 $checkButton17->set_sensitive(FALSE);
3077 $checkButton18->set_sensitive(FALSE);
3078 $checkButton19->set_sensitive(FALSE);
3079  
3080 } else {
3081  
3082 $checkButton17->set_sensitive(TRUE);
3083 $checkButton18->set_sensitive(TRUE);
3084 $checkButton19->set_sensitive(TRUE);
3085 }
3086  
3087 return 1;
3088 }
3089  
3090 sub settings9Tab {
3091  
3092 # Settings9 tab
3093 #
3094 # Expected arguments
3095 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
3096 #
3097 # Return values
3098 # 'undef' on improper arguments
3099 # 1 otherwise
3100  
3101 my ($self, $innerNotebook, $check) = @_;
3102  
3103 # Check for improper arguments
3104 if (! defined $innerNotebook || defined $check) {
3105  
3106 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings9Tab', @_);
3107 }
3108  
3109 # Tab setup
3110 my $grid = $self->addTab('Page _9', $innerNotebook);
3111  
3112 # Terminal emulation
3113 $self->addLabel($grid, '<b>Terminal emulation</b>',
3114 0, 6, 0, 1);
3115  
3116 my $checkButton8 = $self->addCheckButton($grid, 'Use VT100 control sequences', undef, TRUE,
3117 1, 6, 1, 2);
3118 $checkButton8->set_active($axmud::CLIENT->useCtrlSeqFlag);
3119 $checkButton8->signal_connect('toggled' => sub {
3120  
3121 $axmud::CLIENT->toggle_termSetting('use_ctrl_seq', $checkButton8->get_active());
3122 });
3123  
3124 my $checkButton9 = $self->addCheckButton(
3125 $grid, 'Show visible cursor in default textview', undef, TRUE,
3126 1, 6, 2, 3);
3127 $checkButton9->set_active($axmud::CLIENT->useVisibleCursorFlag);
3128 # ->signal_connect is below
3129  
3130 my $checkButton10 = $self->addCheckButton(
3131 $grid, 'Use a rapidly-blinking cursor', undef, TRUE,
3132 1, 6, 3, 4);
3133 $checkButton10->set_active($axmud::CLIENT->useFastCursorFlag);
3134 # ->signal_connect is below
3135 if (! $axmud::CLIENT->useVisibleCursorFlag) {
3136  
3137 $checkButton10->set_sensitive(FALSE);
3138 }
3139  
3140 # ->signal_connects from above
3141 $checkButton9->signal_connect('toggled' => sub {
3142  
3143 $axmud::CLIENT->toggle_termSetting('show_cursor', $checkButton9->get_active());
3144 if ($axmud::CLIENT->useVisibleCursorFlag) {
3145  
3146 $checkButton10->set_sensitive(TRUE);
3147  
3148 } else {
3149  
3150 $checkButton10->set_active(FALSE);
3151 $checkButton10->set_sensitive(FALSE);
3152 }
3153 });
3154  
3155 $checkButton10->signal_connect('toggled' => sub {
3156  
3157 $axmud::CLIENT->toggle_termSetting('fast_cursor', $checkButton10->get_active());
3158  
3159 });
3160  
3161 my $checkButton11 = $self->addCheckButton(
3162 $grid, 'Use direct keyboard input in terminal', undef, TRUE,
3163 1, 6, 4, 5);
3164 $checkButton11->set_active($axmud::CLIENT->useDirectKeysFlag);
3165 $checkButton11->signal_connect('toggled' => sub {
3166  
3167 $axmud::CLIENT->toggle_termSetting('direct_keys', $checkButton11->get_active());
3168 });
3169  
3170 # OSC colour palette
3171 $self->addLabel($grid, '<b>OSC colour palette</b>',
3172 0, 6, 5, 6);
3173  
3174 my $checkButton12 = $self->addCheckButton(
3175 $grid, 'Allow use of OSC colour palette sequences', undef, TRUE,
3176 1, 6, 6, 7);
3177 $checkButton12->set_active($axmud::CLIENT->oscPaletteFlag);
3178 $checkButton12->signal_connect('toggled' => sub {
3179  
3180 if (
3181 ($checkButton12->get_active && ! $axmud::CLIENT->oscPaletteFlag)
3182 || (! $checkButton12->get_active && $axmud::CLIENT->oscPaletteFlag)
3183 ) {
3184 $self->session->pseudoCmd('togglepalette', $self->pseudoCmdMode);
3185 }
3186 });
3187  
3188 # Terminal type negotiations
3189 $self->addLabel($grid, '<b>Terminal type negotiations</b>',
3190 7, 13, 0, 1);
3191  
3192 $self->addLabel(
3193 $grid,
3194 '<i>Custom client name (if not set, TTYPE/MTTS etc use \'' . $axmud::NAME_SHORT
3195 . '\')</i>',
3196 8, 13, 1, 2);
3197 my $entry = $self->addEntry($grid, undef, TRUE,
3198 8, 13, 2, 3);
3199 $entry->set_text($axmud::CLIENT->customClientName);
3200 $entry->signal_connect('changed' => sub {
3201  
3202 my $name = $entry->get_text();
3203  
3204 # (Default value is an empty string)
3205 if (! $name) {
3206  
3207 $name = '';
3208 }
3209  
3210 $axmud::CLIENT->set_customClientName($name);
3211 });
3212  
3213 $self->addLabel(
3214 $grid,
3215 '<i>Custom client version (if not set, not used by TTYPE/MTTS etc)</i>',
3216 8, 13, 3, 4);
3217 my $entry2 = $self->addEntry($grid, undef, TRUE,
3218 8, 13, 4, 5);
3219 $entry2->set_text($axmud::CLIENT->customClientVersion);
3220 $entry2->signal_connect('changed' => sub {
3221  
3222 my $version = $entry2->get_text();
3223  
3224 # (Default value is an empty string)
3225 if (! $version) {
3226  
3227 $version = '';
3228 }
3229  
3230 $axmud::CLIENT->set_customClientVersion($version);
3231 });
3232  
3233 # TTYPE (not MTTS) negotiations
3234 $self->addLabel($grid, '<i>TTYPE (not MTTS) negotiations (*also used by MXP/ZMP/MNES)</i>',
3235 8, 13, 5, 6);
3236  
3237 my ($group, $radioButton) = $self->addRadioButton(
3238 $grid, undef, '*Send nothing', undef,
3239 undef, # IV set to this value when toggled
3240 TRUE, # Sensitive widget
3241 8, 13, 6, 7);
3242 if ($axmud::CLIENT->termTypeMode eq 'send_nothing') {
3243  
3244 $radioButton->set_active(TRUE);
3245 }
3246 $radioButton->signal_connect('toggled' => sub {
3247  
3248 if ($radioButton->get_active()) {
3249  
3250 $axmud::CLIENT->set_termTypeMode('send_nothing');
3251 }
3252 });
3253  
3254 my ($group2, $radioButton2) = $self->addRadioButton(
3255 $grid, $group, '*Sent client name, then usual list', undef, undef, TRUE,
3256 8, 13, 7, 8);
3257 if ($axmud::CLIENT->termTypeMode eq 'send_client') {
3258  
3259 $radioButton2->set_active(TRUE);
3260 }
3261 $radioButton2->signal_connect('toggled' => sub {
3262  
3263 if ($radioButton2->get_active()) {
3264  
3265 $axmud::CLIENT->set_termTypeMode('send_client');
3266 }
3267 });
3268  
3269 my ($group3, $radioButton3) = $self->addRadioButton(
3270 $grid, $group2, '*Send client/name version, then usual list', undef, undef, TRUE,
3271 8, 13, 8, 9);
3272 if ($axmud::CLIENT->termTypeMode eq 'send_client_version') {
3273  
3274 $radioButton3->set_active(TRUE);
3275 }
3276 $radioButton3->signal_connect('toggled' => sub {
3277  
3278 if ($radioButton3->get_active()) {
3279  
3280 $axmud::CLIENT->set_termTypeMode('send_client_version');
3281 }
3282 });
3283  
3284 my ($group4, $radioButton4) = $self->addRadioButton(
3285 $grid, $group3, '*Send custom client name/version, then usual list',
3286 undef, undef, TRUE,
3287 8, 13, 9, 10);
3288 if ($axmud::CLIENT->termTypeMode eq 'send_custom_client') {
3289  
3290 $radioButton4->set_active(TRUE);
3291 }
3292 $radioButton4->signal_connect('toggled' => sub {
3293  
3294 if ($radioButton4->get_active()) {
3295  
3296 $axmud::CLIENT->set_termTypeMode('send_custom_client');
3297 }
3298 });
3299  
3300 my ($group5, $radioButton5) = $self->addRadioButton(
3301 $grid, $group4, 'Send usual terminal type list', undef, undef, TRUE,
3302 8, 13, 10, 11);
3303 if ($axmud::CLIENT->termTypeMode eq 'send_default') {
3304  
3305 $radioButton5->set_active(TRUE);
3306 }
3307 $radioButton5->signal_connect('toggled' => sub {
3308  
3309 if ($radioButton5->get_active()) {
3310  
3311 $axmud::CLIENT->set_termTypeMode('send_default');
3312 }
3313 });
3314  
3315 my ($group6, $radioButton6) = $self->addRadioButton(
3316 $grid, $group5, 'Send \'unknown\'', undef, undef, TRUE,
3317 8, 13, 11, 12);
3318 if ($axmud::CLIENT->termTypeMode eq 'send_unknown') {
3319  
3320 $radioButton6->set_active(TRUE);
3321 }
3322 $radioButton6->signal_connect('toggled' => sub {
3323  
3324 if ($radioButton6->get_active()) {
3325  
3326 $axmud::CLIENT->set_termTypeMode('send_unknown');
3327 }
3328 });
3329  
3330 # Tab complete
3331 return 1;
3332 }
3333  
3334 sub settings10Tab {
3335  
3336 # Settings10 tab
3337 #
3338 # Expected arguments
3339 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
3340 #
3341 # Return values
3342 # 'undef' on improper arguments
3343 # 1 otherwise
3344  
3345 my ($self, $innerNotebook, $check) = @_;
3346  
3347 # Check for improper arguments
3348 if (! defined $innerNotebook || defined $check) {
3349  
3350 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings10Tab', @_);
3351 }
3352  
3353 # Tab setup
3354 my $grid = $self->addTab('Page 1_0', $innerNotebook);
3355  
3356 # Debugging flags (telnet options/negotiations)
3357 $self->addLabel($grid, '<b>Debugging flags (telnet options/negotiations)</b>',
3358 0, 12, 0, 1);
3359  
3360 my $checkButton = $self->addCheckButton(
3361 $grid, 'Show debug messages for invalid escape sequences', undef, TRUE,
3362 1, 12, 1, 2);
3363 $checkButton->set_active($axmud::CLIENT->debugEscSequenceFlag);
3364 $checkButton->signal_connect('toggled' => sub {
3365  
3366 $axmud::CLIENT->set_debugFlag('debugEscSequenceFlag', $checkButton->get_active());
3367 });
3368  
3369 my $checkButton2 = $self->addCheckButton(
3370 $grid,
3371 'Show debug messages while negotiating telnet options/MUD protocols',
3372 undef,
3373 TRUE,
3374 1, 12, 2, 3);
3375 $checkButton2->set_active($axmud::CLIENT->debugTelnetFlag);
3376 $checkButton2->signal_connect('toggled' => sub {
3377  
3378 $axmud::CLIENT->set_debugFlag('debugTelnetFlag', $checkButton2->get_active());
3379 });
3380  
3381 my $checkButton3 = $self->addCheckButton(
3382 $grid,
3383 'Show short debug messages while negotiating telnet options/MUD protocols',
3384 undef,
3385 TRUE,
3386 1, 12, 3, 4);
3387 $checkButton3->set_active($axmud::CLIENT->debugTelnetMiniFlag);
3388 $checkButton3->signal_connect('toggled' => sub {
3389  
3390 $axmud::CLIENT->set_debugFlag('debugTelnetMiniFlag', $checkButton3->get_active());
3391 });
3392  
3393 my $checkButton4 = $self->addCheckButton(
3394 $grid,
3395 'Tell telnet library to write its own negotiation logfile in ' . $axmud::SCRIPT
3396 . ' base directory',
3397 undef,
3398 TRUE,
3399 1, 12, 4, 5);
3400 $checkButton4->set_active($axmud::CLIENT->debugTelnetLogFlag);
3401 $checkButton4->signal_connect('toggled' => sub {
3402  
3403 $axmud::CLIENT->set_debugFlag('debugTelnetLogFlag', $checkButton4->get_active());
3404 });
3405  
3406 my $checkButton5 = $self->addCheckButton(
3407 $grid,
3408 'Show debug messages when MSDP data is sent to Status/Locator tasks',
3409 undef,
3410 TRUE,
3411 1, 12, 5, 6);
3412 $checkButton5->set_active($axmud::CLIENT->debugMsdpFlag);
3413 $checkButton5->signal_connect('toggled' => sub {
3414  
3415 $axmud::CLIENT->set_debugFlag('debugMsdpFlag', $checkButton5->get_active());
3416 });
3417  
3418 my $checkButton6 = $self->addCheckButton(
3419 $grid, 'Show debug messages when invalid MXP tags are received', undef, TRUE,
3420 1, 12, 6, 7);
3421 $checkButton6->set_active($axmud::CLIENT->debugMxpFlag);
3422 $checkButton6->signal_connect('toggled' => sub {
3423  
3424 $axmud::CLIENT->set_debugFlag('debugMxpFlag', $checkButton6->get_active());
3425 });
3426  
3427 my $checkButton7 = $self->addCheckButton(
3428 $grid, 'Show debug messages when MXP comments are received', undef, TRUE,
3429 1, 12, 7, 8);
3430 $checkButton7->set_active($axmud::CLIENT->debugMxpCommentFlag);
3431 $checkButton7->signal_connect('toggled' => sub {
3432  
3433 $axmud::CLIENT->set_debugFlag('debugMxpCommentFlag', $checkButton7->get_active());
3434 });
3435  
3436 my $checkButton8 = $self->addCheckButton(
3437 $grid, 'Show debug messages when invalid Pueblo tags are received', undef, TRUE,
3438 1, 12, 8, 9);
3439 $checkButton8->set_active($axmud::CLIENT->debugPuebloFlag);
3440 $checkButton8->signal_connect('toggled' => sub {
3441  
3442 $axmud::CLIENT->set_debugFlag('debugPuebloFlag', $checkButton8->get_active());
3443 });
3444  
3445 my $checkButton9 = $self->addCheckButton(
3446 $grid, 'Show debug messages when Pueblo comments are received', undef, TRUE,
3447 1, 12, 9, 10);
3448 $checkButton9->set_active($axmud::CLIENT->debugPuebloCommentFlag);
3449 $checkButton9->signal_connect('toggled' => sub {
3450  
3451 $axmud::CLIENT->set_debugFlag('debugPuebloCommentFlag', $checkButton9->get_active());
3452 });
3453  
3454 my $checkButton10 = $self->addCheckButton(
3455 $grid, 'Show debug messages for incoming ZMP data', undef, TRUE,
3456 1, 12, 10, 11);
3457 $checkButton10->set_active($axmud::CLIENT->debugZmpFlag);
3458 $checkButton10->signal_connect('toggled' => sub {
3459  
3460 $axmud::CLIENT->set_debugFlag('debugZmpFlag', $checkButton10->get_active());
3461 });
3462  
3463 my $checkButton11 = $self->addCheckButton(
3464 $grid, 'Show debug messages for incoming ATCP data', undef, TRUE,
3465 1, 12, 11, 12);
3466 $checkButton11->set_active($axmud::CLIENT->debugAtcpFlag);
3467 $checkButton11->signal_connect('toggled' => sub {
3468  
3469 $axmud::CLIENT->set_debugFlag('debugAtcpFlag', $checkButton11->get_active());
3470 });
3471  
3472 my $checkButton12 = $self->addCheckButton(
3473 $grid, 'Show debug messages for incoming GMCP data', undef, TRUE,
3474 1, 12, 12, 13);
3475 $checkButton12->set_active($axmud::CLIENT->debugGmcpFlag);
3476 $checkButton12->signal_connect('toggled' => sub {
3477  
3478 $axmud::CLIENT->set_debugFlag('debugGmcpFlag', $checkButton12->get_active());
3479 });
3480  
3481 my $checkButton13 = $self->addCheckButton(
3482 $grid, 'Show debug messages when invalid MCP messages are received/sent', undef, TRUE,
3483 1, 12, 13, 14);
3484 $checkButton13->set_active($axmud::CLIENT->debugMcpFlag);
3485 $checkButton13->signal_connect('toggled' => sub {
3486  
3487 $axmud::CLIENT->set_debugFlag('debugMcpFlag', $checkButton13->get_active());
3488 });
3489  
3490 # Tab complete
3491 return 1;
3492 }
3493  
3494 sub settings11Tab {
3495  
3496 # Settings11 tab
3497 #
3498 # Expected arguments
3499 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
3500 #
3501 # Return values
3502 # 'undef' on improper arguments
3503 # 1 otherwise
3504  
3505 my ($self, $innerNotebook, $check) = @_;
3506  
3507 # Check for improper arguments
3508 if (! defined $innerNotebook || defined $check) {
3509  
3510 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings11Tab', @_);
3511 }
3512  
3513 # Tab setup
3514 my $grid = $self->addTab('Page 11', $innerNotebook);
3515  
3516 # Debugging flags
3517 $self->addLabel($grid, '<b>Debugging flags (other)</b>',
3518 0, 12, 0, 1);
3519  
3520 my $checkButton = $self->addCheckButton(
3521 $grid, '\'Main\' window shows explicit display buffer line numbers', undef, TRUE,
3522 1, 12, 1, 2);
3523 $checkButton->set_active($axmud::CLIENT->debugLineNumsFlag);
3524 $checkButton->signal_connect('toggled' => sub {
3525  
3526 $axmud::CLIENT->set_debugFlag('debugLineNumsFlag', $checkButton->get_active());
3527 });
3528  
3529 my $checkButton2 = $self->addCheckButton(
3530 $grid,
3531 '\'Main\' window shows explicit ' . $axmud::SCRIPT . ' colour/style tags',
3532 undef,
3533 TRUE,
3534 1, 12, 2, 3);
3535 $checkButton2->set_active($axmud::CLIENT->debugLineTagsFlag);
3536 $checkButton2->signal_connect('toggled' => sub {
3537  
3538 $axmud::CLIENT->set_debugFlag('debugLineTagsFlag', $checkButton2->get_active());
3539 });
3540  
3541 my $checkButton3 = $self->addCheckButton(
3542 $grid,
3543 'Locator task shows debug messages when it interprets room statements',
3544 undef,
3545 TRUE,
3546 1, 2, 3, 4);
3547 $checkButton3->set_active($axmud::CLIENT->debugLocatorFlag);
3548 # ( ->signal_connect appears below)
3549  
3550 my $checkButton4 = $self->addCheckButton(
3551 $grid,
3552 'Locator task shows extensive debug messages when it interprets room statements',
3553 undef,
3554 TRUE,
3555 1, 12, 4, 5);
3556 $checkButton4->set_active($axmud::CLIENT->debugMaxLocatorFlag);
3557  
3558 # (->signal_connects etc for the buttons above)
3559 if (! $axmud::CLIENT->debugLocatorFlag) {
3560  
3561 $checkButton4->set_sensitive(FALSE);
3562 }
3563  
3564 $checkButton3->signal_connect('toggled' => sub {
3565  
3566 $axmud::CLIENT->set_debugFlag('debugLocatorFlag', $checkButton3->get_active());
3567  
3568 if (! $axmud::CLIENT->debugLocatorFlag) {
3569  
3570 # Turning off this button, also turns off the one immediately below (and
3571 # desensitises it)
3572 $checkButton4->set_active(FALSE);
3573 $checkButton4->set_sensitive(FALSE);
3574  
3575 } else {
3576  
3577 # Re-sensitise the button below
3578 $checkButton4->set_sensitive(TRUE);
3579 }
3580 });
3581  
3582 $checkButton4->signal_connect('toggled' => sub {
3583  
3584 $axmud::CLIENT->set_debugFlag('debugMaxLocatorFlag', $checkButton4->get_active());
3585 });
3586  
3587 my $checkButton5 = $self->addCheckButton(
3588 $grid,
3589 'Illegal exit directions (e.g. longer than 64 characters) show debug messages',
3590 undef,
3591 TRUE,
3592 1, 12, 5, 6);
3593 $checkButton5->set_active($axmud::CLIENT->debugExitFlag);
3594 $checkButton5->signal_connect('toggled' => sub {
3595  
3596 $axmud::CLIENT->set_debugFlag('debugExitFlag', $checkButton5->get_active());
3597 });
3598  
3599 my $checkButton6 = $self->addCheckButton(
3600 $grid,
3601 'Locator task shows a summary of the number of room statements it\'s expecting',
3602 undef,
3603 TRUE,
3604 1, 12, 6, 7);
3605 $checkButton6->set_active($axmud::CLIENT->debugMoveListFlag);
3606 $checkButton6->signal_connect('toggled' => sub {
3607  
3608 $axmud::CLIENT->set_debugFlag('debugMoveListFlag', $checkButton6->get_active());
3609 });
3610  
3611 my $checkButton7 = $self->addCheckButton(
3612 $grid, 'Object parsing routines shows debug messages when parsing text', undef, TRUE,
3613 1, 12, 7, 8);
3614 $checkButton7->set_active($axmud::CLIENT->debugParseObjFlag);
3615 $checkButton7->signal_connect('toggled' => sub {
3616  
3617 $axmud::CLIENT->set_debugFlag('debugParseObjFlag', $checkButton7->get_active());
3618 });
3619  
3620 my $checkButton8 = $self->addCheckButton(
3621 $grid,
3622 'Object comparison routines shows debug messages when comparing objects',
3623 undef,
3624 TRUE,
3625 1, 12, 8, 9);
3626 $checkButton8->set_active($axmud::CLIENT->debugCompareObjFlag);
3627 $checkButton8->signal_connect('toggled' => sub {
3628  
3629 $axmud::CLIENT->set_debugFlag('debugCompareObjFlag', $checkButton8->get_active());
3630 });
3631  
3632 my $checkButton9 = $self->addCheckButton(
3633 $grid,
3634 'Show debug messages when a plugin fails to load, explaining the reason why',
3635 undef,
3636 TRUE,
3637 1, 12, 9, 10);
3638 $checkButton9->set_active($axmud::CLIENT->debugExplainPluginFlag);
3639 $checkButton9->signal_connect('toggled' => sub {
3640  
3641 $axmud::CLIENT->set_debugFlag('debugExplainPluginFlag', $checkButton9->get_active());
3642 });
3643  
3644 my $checkButton10 = $self->addCheckButton(
3645 $grid,
3646 'Show debug messages when any code accesses a non-existent property (IV)',
3647 undef,
3648 TRUE,
3649 1, 12, 10, 11);
3650 $checkButton10->set_active($axmud::CLIENT->debugCheckIVFlag);
3651 $checkButton10->signal_connect('toggled' => sub {
3652  
3653 $axmud::CLIENT->set_debugFlag('debugCheckIVFlag', $checkButton10->get_active());
3654 });
3655  
3656 my $checkButton11 = $self->addCheckButton(
3657 $grid,
3658 'Show error messages when table objects can\'t be added/resized in their windows',
3659 undef,
3660 TRUE,
3661 1, 12, 11, 12);
3662 $checkButton11->set_active($axmud::CLIENT->debugTableFitFlag);
3663 $checkButton11->signal_connect('toggled' => sub {
3664  
3665 $axmud::CLIENT->set_debugFlag('debugTableFitFlag', $checkButton11->get_active());
3666 });
3667  
3668 my $checkButton12 = $self->addCheckButton(
3669 $grid,
3670 'Trap Perl errors/warnings and display them in the \'main\' window',
3671 undef,
3672 TRUE,
3673 1, 12, 12, 13);
3674 $checkButton12->set_active($axmud::CLIENT->debugTrapErrorFlag);
3675 $checkButton12->signal_connect('toggled' => sub {
3676  
3677 $axmud::CLIENT->set_debugFlag('debugTrapErrorFlag', $checkButton12->get_active());
3678 });
3679  
3680 # Tab complete
3681 return 1;
3682 }
3683  
3684 sub settings12Tab {
3685  
3686 # Settings12 tab
3687 #
3688 # Expected arguments
3689 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
3690 #
3691 # Return values
3692 # 'undef' on improper arguments
3693 # 1 otherwise
3694  
3695 my ($self, $innerNotebook, $check) = @_;
3696  
3697 # Check for improper arguments
3698 if (! defined $innerNotebook || defined $check) {
3699  
3700 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings12Tab', @_);
3701 }
3702  
3703 # Tab setup
3704 my $grid = $self->addTab('Page 12', $innerNotebook);
3705  
3706 # Other flags
3707 $self->addLabel($grid, '<b>Other flags</b>',
3708 0, 12, 0, 1);
3709  
3710 my $checkButton = $self->addCheckButton(
3711 $grid,
3712 'Use \'page up\' / \'page down\' / \'home\' / \'end\' keys to scroll textviews',
3713 undef,
3714 TRUE,
3715 1, 12, 1, 2);
3716 $checkButton->set_active($axmud::CLIENT->useScrollKeysFlag);
3717 $checkButton->signal_connect('toggled' => sub {
3718  
3719 if (
3720 ($checkButton->get_active && ! $axmud::CLIENT->useScrollKeysFlag)
3721 || (! $checkButton->get_active && $axmud::CLIENT->useScrollKeysFlag)
3722 ) {
3723 $self->session->pseudoCmd('togglewindowkey -s', $self->pseudoCmdMode);
3724 }
3725 });
3726  
3727 my $checkButton2 = $self->addCheckButton(
3728 $grid,
3729 'When using those keys, don\'t scroll the entire height of the page (smooth scrolling)',
3730 undef,
3731 TRUE,
3732 1, 12, 2, 3);
3733 $checkButton2->set_active($axmud::CLIENT->smoothScrollKeysFlag);
3734 $checkButton2->signal_connect('toggled' => sub {
3735  
3736 if (
3737 ($checkButton2->get_active && ! $axmud::CLIENT->smoothScrollKeysFlag)
3738 || (! $checkButton2->get_active && $axmud::CLIENT->smoothScrollKeysFlag)
3739 ) {
3740 $self->session->pseudoCmd('togglewindowkey -m', $self->pseudoCmdMode);
3741 }
3742 });
3743  
3744 my $checkButton3 = $self->addCheckButton(
3745 $grid, 'Using those keys auto-engages split screen mode', undef, TRUE,
3746 1, 12, 3, 4);
3747 $checkButton3->set_active($axmud::CLIENT->autoSplitKeysFlag);
3748 $checkButton3->signal_connect('toggled' => sub {
3749  
3750 if (
3751 ($checkButton3->get_active && ! $axmud::CLIENT->autoSplitKeysFlag)
3752 || (! $checkButton3->get_active && $axmud::CLIENT->autoSplitKeysFlag)
3753 ) {
3754 $self->session->pseudoCmd('togglewindowkey -p', $self->pseudoCmdMode);
3755 }
3756 });
3757  
3758 my $checkButton4 = $self->addCheckButton(
3759 $grid,
3760 'Use \'tab\' / \'cursor up\' / \'cursor down\' keys to auto-complete commands',
3761 undef,
3762 TRUE,
3763 1, 12, 4, 5);
3764 $checkButton4->set_active($axmud::CLIENT->useCompleteKeysFlag);
3765 $checkButton4->signal_connect('toggled' => sub {
3766  
3767 if (
3768 ($checkButton4->get_active && ! $axmud::CLIENT->useCompleteKeysFlag)
3769 || (! $checkButton4->get_active && $axmud::CLIENT->useCompleteKeysFlag)
3770 ) {
3771 $self->session->pseudoCmd('togglewindowkey -t', $self->pseudoCmdMode);
3772 }
3773 });
3774 my $checkButton5 = $self->addCheckButton(
3775 $grid,
3776 'Use CTRL+TAB keys to switch between tabs in a window pane (or just TAB if there is'
3777 . ' no command entry box)',
3778 undef,
3779 TRUE,
3780 1, 12, 5, 6);
3781 $checkButton5->set_active($axmud::CLIENT->useSwitchKeysFlag);
3782 $checkButton5->signal_connect('toggled' => sub {
3783  
3784 if (
3785 ($checkButton5->get_active && ! $axmud::CLIENT->useSwitchKeysFlag)
3786 || (! $checkButton5->get_active && $axmud::CLIENT->useSwitchKeysFlag)
3787 ) {
3788 $self->session->pseudoCmd('togglewindowkey -c', $self->pseudoCmdMode);
3789 }
3790 });
3791  
3792 my $checkButton6 = $self->addCheckButton(
3793 $grid, 'Allow system messages to be displayed in \'main\' windows', undef, TRUE,
3794 1, 12, 6, 7);
3795 $checkButton6->set_active($axmud::CLIENT->mainWinSystemMsgFlag);
3796 $checkButton6->signal_connect('toggled' => sub {
3797  
3798 if (
3799 ($checkButton6->get_active && ! $axmud::CLIENT->mainWinSystemMsgFlag)
3800 || (! $checkButton6->get_active && $axmud::CLIENT->mainWinSystemMsgFlag)
3801 ) {
3802 $self->session->pseudoCmd('togglemainwindow -s', $self->pseudoCmdMode);
3803 }
3804 });
3805  
3806 my $checkButton7 = $self->addCheckButton(
3807 $grid,
3808 'Set the \'main\' window\'s urgency hint when text is received from the world',
3809 undef,
3810 TRUE,
3811 1, 12, 7, 8);
3812 $checkButton7->set_active($axmud::CLIENT->mainWinUrgencyFlag);
3813 $checkButton7->signal_connect('toggled' => sub {
3814  
3815 if (
3816 ($checkButton7->get_active && ! $axmud::CLIENT->mainWinUrgencyFlag)
3817 || (! $checkButton7->get_active && $axmud::CLIENT->mainWinUrgencyFlag)
3818 ) {
3819 $self->session->pseudoCmd('togglemainwindow -u', $self->pseudoCmdMode);
3820 }
3821 });
3822  
3823 my $checkButton8 = $self->addCheckButton(
3824 $grid, 'Show tooltips in a session\'s default tab', undef, TRUE,
3825 1, 12, 8, 9);
3826 $checkButton8->set_active($axmud::CLIENT->mainWinTooltipFlag);
3827 $checkButton8->signal_connect('toggled' => sub {
3828  
3829 if (
3830 ($checkButton8->get_active && ! $axmud::CLIENT->mainWinTooltipFlag)
3831 || (! $checkButton8->get_active && $axmud::CLIENT->mainWinTooltipFlag)
3832 ) {
3833 $self->session->pseudoCmd('togglemainwindow -t', $self->pseudoCmdMode);
3834 }
3835 });
3836  
3837 my $checkButton9 = $self->addCheckButton(
3838 $grid, 'Show toolbar labels in the \'main\'/automapper windows', undef, TRUE,
3839 1, 12, 9, 10);
3840 $checkButton9->set_active($axmud::CLIENT->toolbarLabelFlag);
3841 $checkButton9->signal_connect('toggled' => sub {
3842  
3843 if (
3844 ($checkButton9->get_active && ! $axmud::CLIENT->toolbarLabelFlag)
3845 || (! $checkButton9->get_active && $axmud::CLIENT->toolbarLabelFlag)
3846 ) {
3847 $self->session->pseudoCmd('togglelabel', $self->pseudoCmdMode);
3848 }
3849 });
3850  
3851 my $checkButton10 = $self->addCheckButton(
3852 $grid,
3853 'Show irreversible icon in \'edit\' windows for actions that take place immediately',
3854 undef,
3855 TRUE,
3856 1, 10, 10, 11);
3857 $checkButton10->set_active($axmud::CLIENT->irreversibleIconFlag);
3858 $checkButton10->signal_connect('toggled' => sub {
3859  
3860 if (
3861 ($checkButton10->get_active && ! $axmud::CLIENT->irreversibleIconFlag)
3862 || (! $checkButton10->get_active && $axmud::CLIENT->irreversibleIconFlag)
3863 ) {
3864 $self->session->pseudoCmd('toggleirreversible', $self->pseudoCmdMode);
3865 }
3866 });
3867  
3868 my $button = $self->addButton($grid,
3869 'Test icons', 'Test irreversible icons', undef,
3870 10, 12, 10, 11);
3871 $button->signal_connect('clicked' => sub {
3872  
3873 $self->session->pseudoCmd('toggleirreversible -t', $self->pseudoCmdMode);
3874 });
3875  
3876 my $checkButton11 = $self->addCheckButton(
3877 $grid,
3878 'Show popup windows during long operations (loading large files, drawing large maps'
3879 . ' etc)',
3880 undef,
3881 TRUE,
3882 1, 12, 11, 12);
3883 $checkButton11->set_active($axmud::CLIENT->allowBusyWinFlag);
3884 $checkButton11->signal_connect('toggled' => sub {
3885  
3886 if (
3887 ($checkButton11->get_active && ! $axmud::CLIENT->allowBusyWinFlag)
3888 || (! $checkButton11->get_active && $axmud::CLIENT->allowBusyWinFlag)
3889 ) {
3890 $self->session->pseudoCmd('togglepopup', $self->pseudoCmdMode);
3891 }
3892 });
3893  
3894 my $checkButton12 = $self->addCheckButton(
3895 $grid, 'Collect connection histories for each world', undef, TRUE,
3896 1, 12, 12, 13);
3897 $checkButton12->set_active($axmud::CLIENT->connectHistoryFlag);
3898 $checkButton12->signal_connect('toggled' => sub {
3899  
3900 if (
3901 ($checkButton12->get_active && ! $axmud::CLIENT->connectHistoryFlag)
3902 || (! $checkButton12->get_active && $axmud::CLIENT->connectHistoryFlag)
3903 ) {
3904 $self->session->pseudoCmd('togglehistory', $self->pseudoCmdMode);
3905 }
3906 });
3907  
3908 # Tab complete
3909 return 1;
3910 }
3911  
3912 sub settings13Tab {
3913  
3914 # Settings13 tab
3915 #
3916 # Expected arguments
3917 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
3918 #
3919 # Return values
3920 # 'undef' on improper arguments
3921 # 1 otherwise
3922  
3923 my ($self, $innerNotebook, $check) = @_;
3924  
3925 # Local variables
3926 my (@columnList, @columnList2);
3927  
3928 # Check for improper arguments
3929 if (! defined $innerNotebook || defined $check) {
3930  
3931 return $axmud::CLIENT->writeImproper($self->_objClass . '->settings13Tab', @_);
3932 }
3933  
3934 # Tab setup
3935 my $grid = $self->addTab('Page 13', $innerNotebook);
3936  
3937 # Custom months/days
3938 $self->addLabel($grid, '<b>Custom months/days</b>',
3939 0, 12, 0, 1);
3940 $self->addLabel($grid,
3941 '<i>List of months of the year and days of the week</i>',
3942 1, 12, 1, 2);
3943  
3944 # Add simple lists
3945 @columnList = (
3946 'Month', 'text',
3947 );
3948  
3949 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
3950 1, 6, 2, 8);
3951  
3952 @columnList2 = (
3953 'Day', 'text',
3954 );
3955  
3956 my $slWidget2 = $self->addSimpleList($grid, undef, \@columnList,
3957 7, 12, 2, 8);
3958  
3959 # Initialise the lists
3960 $self->settings13Tab_refreshList($slWidget, $slWidget2);
3961  
3962 # Add editing widgets
3963 $self->addLabel($grid, 'New list of custom months <i>e.g. Gen Feb Mar...</i>',
3964 1, 6, 8, 9);
3965 my $entry = $self->addEntry($grid, undef, TRUE,
3966 1, 6, 9, 10);
3967 my $button = $self->addButton($grid,
3968 'Set', 'Set the list of custom months', undef,
3969 1, 3, 10, 11);
3970 my $button2 = $self->addButton($grid,
3971 'Reset', 'Reset the list of custom months', undef,
3972 3, 6, 10, 11);
3973  
3974 $self->addLabel($grid, 'New list of custom days <i>e.g. Lun Mar Mer...</i>',
3975 7, 12, 8, 9);
3976 my $entry2 = $self->addEntry($grid, undef, TRUE,
3977 7, 12, 9, 10);
3978 my $button3 = $self->addButton($grid,
3979 'Set', 'Set the list of custom days', undef,
3980 7, 9, 10, 11);
3981 my $button4 = $self->addButton($grid,
3982 'Reset', 'Reset the list of custom days', undef,
3983 9, 12, 10, 11);
3984  
3985 # (->signal_connects from above)
3986 $button->signal_connect('clicked' => sub {
3987  
3988 my $string = $entry->get_text();
3989  
3990 if ($string ne '') {
3991  
3992 $self->session->pseudoCmd('setcustommonth ' . $string, $self->pseudoCmdMode);
3993  
3994 # Refresh the lists and reset the entries
3995 $self->settings13Tab_refreshList($slWidget, $slWidget2);
3996 $self->resetEntryBoxes($entry, $entry2);
3997 }
3998 });
3999 $button2->signal_connect('clicked' => sub {
4000  
4001 $self->session->pseudoCmd('setcustommonth -r', $self->pseudoCmdMode);
4002  
4003 # Refresh the lists and reset the entries
4004 $self->settings13Tab_refreshList($slWidget, $slWidget2);
4005 $self->resetEntryBoxes($entry, $entry2);
4006 });
4007 $button3->signal_connect('clicked' => sub {
4008  
4009 my $string = $entry2->get_text();
4010  
4011 if ($string ne '') {
4012  
4013 $self->session->pseudoCmd('setcustomday ' . $string, $self->pseudoCmdMode);
4014  
4015 # Refresh the lists and reset the entries
4016 $self->settings13Tab_refreshList($slWidget, $slWidget2);
4017 $self->resetEntryBoxes($entry, $entry2);
4018 }
4019 });
4020 $button4->signal_connect('clicked' => sub {
4021  
4022 $self->session->pseudoCmd('setcustomday -r', $self->pseudoCmdMode);
4023  
4024 # Refresh the lists and reset the entries
4025 $self->settings13Tab_refreshList($slWidget, $slWidget2);
4026 $self->resetEntryBoxes($entry, $entry2);
4027 });
4028  
4029 # Tab complete
4030 return 1;
4031 }
4032  
4033 sub settings13Tab_refreshList {
4034  
4035 # Resets the simple lists displayed by $self->settings13Tab
4036 #
4037 # Expected arguments
4038 # $slWidget, $slWidget2
4039 # - The GA::Obj::SimpleLists to reset
4040 #
4041 # Return values
4042 # 'undef' on improper arguments
4043 # 1 otherwise
4044  
4045 my ($self, $slWidget, $slWidget2, $check) = @_;
4046  
4047 # Check for improper arguments
4048 if (! defined $slWidget || ! defined $slWidget2 || defined $check) {
4049  
4050 return $axmud::CLIENT->writeImproper(
4051 $self->_objClass . '->settings13Tab_refreshList',
4052 @_,
4053 );
4054 }
4055  
4056 # Reset the simple list
4057 $self->resetListData($slWidget, [$axmud::CLIENT->customMonthList], 1);
4058 $self->resetListData($slWidget2, [$axmud::CLIENT->customDayList], 1);
4059  
4060 return 1;
4061 }
4062  
4063 sub pluginsTab {
4064  
4065 # Plugins tab - called by $self->setupNotebook
4066 #
4067 # Expected arguments
4068 # (none besides $self)
4069 #
4070 # Return values
4071 # 'undef' on improper arguments
4072 # 1 otherwise
4073  
4074 my ($self, $check) = @_;
4075  
4076 # Check for improper arguments
4077 if (defined $check) {
4078  
4079 return $axmud::CLIENT->writeImproper($self->_objClass . '->pluginsTab', @_);
4080 }
4081  
4082 # Tab setup
4083 # Create a notebook within the main one, so that we have two rows of tabs
4084 my $innerNotebook = $self->addInnerNotebookTab('_Plugins', $self->notebook);
4085  
4086 # Add tabs to the inner notebook
4087 $self->plugins1Tab($innerNotebook);
4088 $self->plugins2Tab($innerNotebook);
4089 $self->plugins3Tab($innerNotebook);
4090 $self->plugins4Tab($innerNotebook);
4091 $self->plugins5Tab($innerNotebook);
4092 $self->plugins6Tab($innerNotebook);
4093 $self->plugins7Tab($innerNotebook);
4094 $self->plugins8Tab($innerNotebook);
4095 $self->plugins9Tab($innerNotebook);
4096  
4097 return 1;
4098 }
4099  
4100 sub plugins1Tab {
4101  
4102 # Plugins1 tab
4103 #
4104 # Expected arguments
4105 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4106 #
4107 # Return values
4108 # 'undef' on improper arguments
4109 # 1 otherwise
4110  
4111 my ($self, $innerNotebook, $check) = @_;
4112  
4113 # Local variables
4114 my @columnList;
4115  
4116 # Check for improper arguments
4117 if (! defined $innerNotebook || defined $check) {
4118  
4119 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins1Tab', @_);
4120 }
4121  
4122 # Tab setup
4123 my $grid = $self->addTab('Page _1', $innerNotebook);
4124  
4125 # Loaded plugins
4126 $self->addLabel($grid, '<b>Loaded plugins</b>',
4127 0, 12, 0, 1);
4128 $self->addLabel($grid,
4129 '<i>List of ' . $axmud::SCRIPT . ' plugins currently loaded (session-independent)</i>',
4130 1, 12, 1, 2);
4131  
4132 # Add a simple list
4133 @columnList = (
4134 'Plugin', 'text',
4135 'Enabled', 'bool',
4136 'File path', 'text',
4137 'Version', 'text',
4138 'Requires', 'text',
4139 'Author', 'text',
4140 'Copyright', 'text',
4141 'Descrip', 'text',
4142 'Initial status', 'text',
4143 );
4144  
4145 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4146 1, 12, 2, 10);
4147  
4148 # Initialise the simple list
4149 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4150  
4151 # Add buttons
4152 my $button = $self->addButton($grid,
4153 'Enable', 'Enable the selected plugin', undef,
4154 1, 3, 10, 11);
4155 $button->signal_connect('clicked' => sub {
4156  
4157 my ($plugin) = $self->getSimpleListData($slWidget, 0);
4158 if (defined $plugin) {
4159  
4160 # Enable this plugin
4161 $self->session->pseudoCmd('enableplugin ' . $plugin, $self->pseudoCmdMode);
4162  
4163 # Refresh the simple list
4164 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4165 }
4166 });
4167  
4168 my $button2 = $self->addButton($grid,
4169 'Disable', 'Disable the selected plugin', undef,
4170 3, 5, 10, 11);
4171 $button2->signal_connect('clicked' => sub {
4172  
4173 my ($plugin) = $self->getSimpleListData($slWidget, 0);
4174 if (defined $plugin) {
4175  
4176 # Disable this plugin
4177 $self->session->pseudoCmd('disableplugin ' . $plugin, $self->pseudoCmdMode);
4178  
4179 # Refresh the simple list
4180 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4181 }
4182 });
4183  
4184 my $button3 = $self->addButton($grid,
4185 'Test', 'Test a ' . $axmud::SCRIPT . ' plugin that hasn\'t been loaded', undef,
4186 5, 7, 10, 11);
4187 $button3->signal_connect('clicked' => sub {
4188  
4189 my ($plugin, $pluginObj);
4190  
4191 ($plugin) = $self->getSimpleListData($slWidget, 0);
4192 if (defined $plugin) {
4193  
4194 # Test this plugin
4195 $pluginObj = $axmud::CLIENT->ivShow('pluginHash', $plugin);
4196 $self->session->pseudoCmd(
4197 'testplugin ' . $pluginObj->filePath,
4198 $self->pseudoCmdMode,
4199 );
4200  
4201 } else {
4202  
4203 # Prompt the user for a plugin to test
4204 $self->session->pseudoCmd('testplugin', $self->pseudoCmdMode);
4205 }
4206  
4207 # Refresh the simple list
4208 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4209 });
4210  
4211 my $button4 = $self->addButton($grid,
4212 'Load standard plugin', 'Load a new ' . $axmud::SCRIPT . ' standard plugin', undef,
4213 8, 10, 10, 11);
4214 $button4->signal_connect('clicked' => sub {
4215  
4216 # Disable this plugin
4217 $self->session->pseudoCmd('loadplugin -s', $self->pseudoCmdMode);
4218  
4219 # Refresh the simple list
4220 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4221 });
4222  
4223 my $button5 = $self->addButton($grid,
4224 'Load custom plugin', 'Load a new ' . $axmud::SCRIPT . ' custom plugin', undef,
4225 10, 12, 10, 11);
4226 $button5->signal_connect('clicked' => sub {
4227  
4228 # Disable this plugin
4229 $self->session->pseudoCmd('loadplugin', $self->pseudoCmdMode);
4230  
4231 # Refresh the simple list
4232 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4233 });
4234  
4235 my $button6 = $self->addButton($grid,
4236 'Refresh list', 'Refresh the list of loaded plugins', undef,
4237 10, 12, 11, 12);
4238 $button6->signal_connect('clicked' => sub {
4239  
4240 # Refresh the simple list
4241 $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2));
4242 });
4243  
4244 # Tab complete
4245 return 1;
4246 }
4247  
4248 sub plugins1Tab_refreshList {
4249  
4250 # Resets the simple list displayed by $self->plugins1Tab
4251 #
4252 # Expected arguments
4253 # $slWidget - The GA::Obj::SimpleList
4254 # $columns - The number of columns
4255 #
4256 # Return values
4257 # 'undef' on improper arguments
4258 # 1 otherwise
4259  
4260 my ($self, $slWidget, $columns, $check) = @_;
4261  
4262 # Local variables
4263 my (@pluginList, @dataList);
4264  
4265 # Check for improper arguments
4266 if (! defined $slWidget || ! defined $columns || defined $check) {
4267  
4268 return $axmud::CLIENT->writeImproper(
4269 $self->_objClass . '->plugins1Tab_refreshList',
4270 @_,
4271 );
4272 }
4273  
4274 # Import the list of plugins
4275 @pluginList = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('pluginHash'));
4276  
4277 # Compile the simple list data
4278 foreach my $obj (@pluginList) {
4279  
4280 my ($descrip, $author, $copyright);
4281  
4282 if ($obj->descrip) {
4283  
4284 # (Can't do a substr() operation on an 'undef' value)
4285 if (length ($obj->descrip) > 64) {
4286 $descrip = substr($obj->descrip, 0, 64) . '...';
4287 } else {
4288 $descrip = $obj->descrip;
4289 }
4290 }
4291  
4292 if ($obj->author) {
4293  
4294 if (length ($obj->author) > 64) {
4295 $author = substr($obj->author, 0, 64) . '...';
4296 } else {
4297 $author = $obj->author;
4298 }
4299 }
4300  
4301 if ($obj->copyright) {
4302  
4303 if (length ($obj->copyright) > 64) {
4304 $copyright = substr($obj->copyright, 0, 64) . '...';
4305 } else {
4306 $copyright = $obj->copyright;
4307 }
4308 }
4309  
4310 push (@dataList,
4311 $obj->name,
4312 $obj->enabledFlag,
4313 $obj->filePath,
4314 $obj->version,
4315 $obj->require,
4316 $descrip,
4317 $author,
4318 $copyright,
4319 $obj->init,
4320 );
4321 }
4322  
4323 # Reset the simple list
4324 $self->resetListData($slWidget, [@dataList], $columns);
4325  
4326 return 1;
4327 }
4328  
4329 sub plugins2Tab {
4330  
4331 # Plugins2 tab
4332 #
4333 # Expected arguments
4334 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4335 #
4336 # Return values
4337 # 'undef' on improper arguments
4338 # 1 otherwise
4339  
4340 my ($self, $innerNotebook, $check) = @_;
4341  
4342 # Local variables
4343 my @columnList;
4344  
4345 # Check for improper arguments
4346 if (! defined $innerNotebook || defined $check) {
4347  
4348 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins2Tab', @_);
4349 }
4350  
4351 # Tab setup
4352 my $grid = $self->addTab('Page _2', $innerNotebook);
4353  
4354 # Initial plugins
4355 $self->addLabel($grid, '<b>Initial plugins</b>',
4356 0, 12, 0, 1);
4357 $self->addLabel($grid,
4358 '<i>List of ' . $axmud::SCRIPT . ' plugins loaded at startup (session-independent)</i>',
4359 1, 12, 1, 2);
4360  
4361 # Add a simple list
4362 @columnList = (
4363 '#', 'int',
4364 'Plugin file', 'text',
4365 );
4366  
4367 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4368 1, 12, 2, 10);
4369  
4370 # Initialise the simple list
4371 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4372  
4373 # Add buttons
4374 my $button = $self->addButton($grid,
4375 'Add standard', 'Add a new standard initial plugin', undef,
4376 1, 3, 10, 11);
4377 $button->signal_connect('clicked' => sub {
4378  
4379 # Add a new initial plugin
4380 $self->session->pseudoCmd('addinitialplugin -s', $self->pseudoCmdMode);
4381  
4382 # Refresh the simple list
4383 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4384 });
4385  
4386 my $button2 = $self->addButton($grid,
4387 'Add custom', 'Add a new custom initial plugin', undef,
4388 3, 5, 10, 11);
4389 $button2->signal_connect('clicked' => sub {
4390  
4391 # Add a new initial plugin
4392 $self->session->pseudoCmd('addinitialplugin', $self->pseudoCmdMode);
4393  
4394 # Refresh the simple list
4395 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4396 });
4397  
4398 my $button3 = $self->addButton($grid,
4399 'Delete', 'Delete the selected initial plugin', undef,
4400 5, 7, 10, 11);
4401 $button3->signal_connect('clicked' => sub {
4402  
4403 my ($plugin) = $self->getSimpleListData($slWidget, 1);
4404 if (defined $plugin) {
4405  
4406 # Delete the initial plugin
4407 $self->session->pseudoCmd('deleteinitialplugin ' . $plugin, $self->pseudoCmdMode);
4408  
4409 # Refresh the simple list
4410 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4411 }
4412 });
4413  
4414 my $button4 = $self->addButton($grid,
4415 'Test', 'Test the selected initial plugin', undef,
4416 7, 9, 10, 11);
4417 $button4->signal_connect('clicked' => sub {
4418  
4419 my ($plugin) = $self->getSimpleListData($slWidget, 1);
4420 if (defined $plugin) {
4421  
4422 # Delete the initial plugin
4423 $self->session->pseudoCmd('testplugin ' . $plugin, $self->pseudoCmdMode);
4424  
4425 # Refresh the simple list
4426 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4427 }
4428 });
4429  
4430 my $button5 = $self->addButton($grid,
4431 'Refresh list', 'Refresh the list of initial plugins', undef,
4432 10, 12, 10, 11);
4433 $button5->signal_connect('clicked' => sub {
4434  
4435 # Refresh the simple list
4436 $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2));
4437 });
4438  
4439 # Tab complete
4440 return 1;
4441 }
4442  
4443 sub plugins2Tab_refreshList {
4444  
4445 # Resets the simple list displayed by $self->plugins2Tab
4446 #
4447 # Expected arguments
4448 # $slWidget - The GA::Obj::SimpleList
4449 # $columns - The number of columns
4450 #
4451 # Return values
4452 # 'undef' on improper arguments
4453 # 1 otherwise
4454  
4455 my ($self, $slWidget, $columns, $check) = @_;
4456  
4457 # Local variables
4458 my (
4459 $count,
4460 @dataList,
4461 );
4462  
4463 # Check for improper arguments
4464 if (! defined $slWidget || ! defined $columns || defined $check) {
4465  
4466 return $axmud::CLIENT->writeImproper(
4467 $self->_objClass . '->plugins2Tab_refreshList',
4468 @_,
4469 );
4470 }
4471  
4472 # Compile the simple list data
4473 $count = 0;
4474 foreach my $path ($axmud::CLIENT->initPluginList) {
4475  
4476 $count++;
4477  
4478 push (@dataList, $count, $path);
4479 }
4480  
4481 # Reset the simple list
4482 $self->resetListData($slWidget, [@dataList], $columns);
4483  
4484 return 1;
4485 }
4486  
4487 sub plugins3Tab {
4488  
4489 # Plugins3 tab
4490 #
4491 # Expected arguments
4492 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4493 #
4494 # Return values
4495 # 'undef' on improper arguments
4496 # 1 otherwise
4497  
4498 my ($self, $innerNotebook, $check) = @_;
4499  
4500 # Local variables
4501 my @columnList;
4502  
4503 # Check for improper arguments
4504 if (! defined $innerNotebook || defined $check) {
4505  
4506 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins3Tab', @_);
4507 }
4508  
4509 # Tab setup
4510 my $grid = $self->addTab('Page _3', $innerNotebook);
4511  
4512 # Plugin client commands
4513 $self->addLabel($grid, '<b>Plugin client commands</b>',
4514 0, 12, 0, 1);
4515 $self->addLabel($grid,
4516 '<i>List of client commands added by ' . $axmud::SCRIPT . ' plugins</i>',
4517 1, 12, 1, 2);
4518  
4519 # Add a simple list
4520 @columnList = (
4521 'Command', 'text',
4522 'Plugin', 'text',
4523 );
4524  
4525 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4526 1, 12, 2, 10);
4527  
4528 # Initialise the simple list
4529 $self->plugins3Tab_refreshList($slWidget, scalar (@columnList / 2));
4530  
4531 # Add buttons
4532 my $button = $self->addButton($grid,
4533 'Refresh list', 'Refresh the list of client commands', undef,
4534 10, 12, 10, 11);
4535 $button->signal_connect('clicked' => sub {
4536  
4537 # Refresh the simple list
4538 $self->plugins3Tab_refreshList($slWidget, scalar (@columnList / 2));
4539 });
4540  
4541 # Tab complete
4542 return 1;
4543 }
4544  
4545 sub plugins3Tab_refreshList {
4546  
4547 # Resets the simple list displayed by $self->plugins3Tab
4548 #
4549 # Expected arguments
4550 # $slWidget - The GA::Obj::SimpleList
4551 # $columns - The number of columns
4552 #
4553 # Return values
4554 # 'undef' on improper arguments
4555 # 1 otherwise
4556  
4557 my ($self, $slWidget, $columns, $check) = @_;
4558  
4559 # Local variables
4560 my (
4561 @cmdList, @dataList,
4562 %cmdHash,
4563 );
4564  
4565 # Check for improper arguments
4566 if (! defined $slWidget || ! defined $columns || defined $check) {
4567  
4568 return $axmud::CLIENT->writeImproper(
4569 $self->_objClass . '->plugins3Tab_refreshList',
4570 @_,
4571 );
4572 }
4573  
4574 # Import the list of commands
4575 %cmdHash = $axmud::CLIENT->pluginCmdHash;
4576 @cmdList = sort {lc($a) cmp lc($b)} (keys %cmdHash);
4577  
4578 # Compile the simple list data
4579 foreach my $cmd (@cmdList) {
4580  
4581 push (@dataList, $cmd, $cmdHash{$cmd});
4582 }
4583  
4584 # Reset the simple list
4585 $self->resetListData($slWidget, [@dataList], $columns);
4586  
4587 return 1;
4588 }
4589  
4590 sub plugins4Tab {
4591  
4592 # Plugins4 tab
4593 #
4594 # Expected arguments
4595 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4596 #
4597 # Return values
4598 # 'undef' on improper arguments
4599 # 1 otherwise
4600  
4601 my ($self, $innerNotebook, $check) = @_;
4602  
4603 # Local variables
4604 my @columnList;
4605  
4606 # Check for improper arguments
4607 if (! defined $innerNotebook || defined $check) {
4608  
4609 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins4Tab', @_);
4610 }
4611  
4612 # Tab setup
4613 my $grid = $self->addTab('Page _4', $innerNotebook);
4614  
4615 # Plugin tasks
4616 $self->addLabel($grid, '<b>Plugin tasks</b>',
4617 0, 12, 0, 1);
4618 $self->addLabel($grid,
4619 '<i>List of client tasks added by ' . $axmud::SCRIPT . ' plugins</i>',
4620 1, 12, 1, 2);
4621  
4622 # Add a simple list
4623 @columnList = (
4624 'Task', 'text',
4625 'Plugin', 'text',
4626 );
4627  
4628 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4629 1, 12, 2, 10);
4630  
4631 # Initialise the simple list
4632 $self->plugins4Tab_refreshList($slWidget, scalar (@columnList / 2));
4633  
4634 # Add buttons
4635 my $button = $self->addButton($grid,
4636 'Refresh list', 'Refresh the list of tasks', undef,
4637 10, 12, 10, 11);
4638 $button->signal_connect('clicked' => sub {
4639  
4640 # Refresh the simple list
4641 $self->plugins4Tab_refreshList($slWidget, scalar (@columnList / 2));
4642 });
4643  
4644 # Tab complete
4645 return 1;
4646 }
4647  
4648 sub plugins4Tab_refreshList {
4649  
4650 # Resets the simple list displayed by $self->plugins4Tab
4651 #
4652 # Expected arguments
4653 # $slWidget - The GA::Obj::SimpleList
4654 # $columns - The number of columns
4655 #
4656 # Return values
4657 # 'undef' on improper arguments
4658 # 1 otherwise
4659  
4660 my ($self, $slWidget, $columns, $check) = @_;
4661  
4662 # Local variables
4663 my (
4664 @taskList, @dataList,
4665 %taskHash,
4666 );
4667  
4668 # Check for improper arguments
4669 if (! defined $slWidget || ! defined $columns || defined $check) {
4670  
4671 return $axmud::CLIENT->writeImproper(
4672 $self->_objClass . '->plugins4Tab_refreshList',
4673 @_,
4674 );
4675 }
4676  
4677 # Import the list of tasks
4678 %taskHash = $axmud::CLIENT->pluginTaskHash;
4679 @taskList = sort {lc($a) cmp lc($b)} (keys %taskHash);
4680  
4681 # Compile the simple list data
4682 foreach my $task (@taskList) {
4683  
4684 push (@dataList, $task, $taskHash{$task});
4685 }
4686  
4687 # Reset the simple list
4688 $self->resetListData($slWidget, [@dataList], $columns);
4689  
4690 return 1;
4691 }
4692  
4693 sub plugins5Tab {
4694  
4695 # Plugins5 tab
4696 #
4697 # Expected arguments
4698 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4699 #
4700 # Return values
4701 # 'undef' on improper arguments
4702 # 1 otherwise
4703  
4704 my ($self, $innerNotebook, $check) = @_;
4705  
4706 # Local variables
4707 my @columnList;
4708  
4709 # Check for improper arguments
4710 if (! defined $innerNotebook || defined $check) {
4711  
4712 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins5Tab', @_);
4713 }
4714  
4715 # Tab setup
4716 my $grid = $self->addTab('Page _5', $innerNotebook);
4717  
4718 # Plugin tasks
4719 $self->addLabel($grid, '<b>Plugin cages</b>',
4720 0, 12, 0, 1);
4721 $self->addLabel($grid,
4722 '<i>List of cages added by ' . $axmud::SCRIPT . ' plugins</i>',
4723 1, 12, 1, 2);
4724  
4725 # Add a simple list
4726 @columnList = (
4727 'Cage type', 'text',
4728 'Plugin', 'text',
4729 'Package name', 'text',
4730 '\'Edit\' window package name', 'text',
4731 );
4732  
4733 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4734 1, 12, 2, 10);
4735  
4736 # Initialise the simple list
4737 $self->plugins5Tab_refreshList($slWidget, scalar (@columnList / 2));
4738  
4739 # Add buttons
4740 my $button = $self->addButton($grid,
4741 'Refresh list', 'Refresh the list of cages', undef,
4742 10, 12, 10, 11);
4743 $button->signal_connect('clicked' => sub {
4744  
4745 # Refresh the simple list
4746 $self->plugins5Tab_refreshList($slWidget, scalar (@columnList / 2));
4747 });
4748  
4749 # Tab complete
4750 return 1;
4751 }
4752  
4753 sub plugins5Tab_refreshList {
4754  
4755 # Resets the simple list displayed by $self->plugins5Tab
4756 #
4757 # Expected arguments
4758 # $slWidget - The GA::Obj::SimpleList
4759 # $columns - The number of columns
4760 #
4761 # Return values
4762 # 'undef' on improper arguments
4763 # 1 otherwise
4764  
4765 my ($self, $slWidget, $columns, $check) = @_;
4766  
4767 # Local variables
4768 my (
4769 @cageList, @dataList,
4770 %cageHash, %packageHash, %editWinHash,
4771 );
4772  
4773 # Check for improper arguments
4774 if (! defined $slWidget || ! defined $columns || defined $check) {
4775  
4776 return $axmud::CLIENT->writeImproper(
4777 $self->_objClass . '->plugins5Tab_refreshList',
4778 @_,
4779 );
4780 }
4781  
4782 # Import the list of cages
4783 %cageHash = $axmud::CLIENT->pluginCageHash;
4784 %packageHash = $axmud::CLIENT->pluginCagePackageHash;
4785 %editWinHash = $axmud::CLIENT->pluginCageEditWinHash;
4786 @cageList = sort {lc($a) cmp lc($b)} (keys %cageHash);
4787  
4788 # Compile the simple list data
4789 foreach my $cage (@cageList) {
4790  
4791 push (@dataList,
4792 $cage,
4793 $cageHash{$cage},
4794 $packageHash{$cage},
4795 $editWinHash{$cage},
4796 );
4797 }
4798  
4799 # Reset the simple list
4800 $self->resetListData($slWidget, [@dataList], $columns);
4801  
4802 return 1;
4803 }
4804  
4805 sub plugins6Tab {
4806  
4807 # Plugins6 tab
4808 #
4809 # Expected arguments
4810 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4811 #
4812 # Return values
4813 # 'undef' on improper arguments
4814 # 1 otherwise
4815  
4816 my ($self, $innerNotebook, $check) = @_;
4817  
4818 # Local variables
4819 my @columnList;
4820  
4821 # Check for improper arguments
4822 if (! defined $innerNotebook || defined $check) {
4823  
4824 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins6Tab', @_);
4825 }
4826  
4827 # Tab setup
4828 my $grid = $self->addTab('Page _6', $innerNotebook);
4829  
4830 # Plugin 'grid' windows
4831 $self->addLabel($grid, '<b>Plugin \'grid\' windows</b>',
4832 0, 12, 0, 1);
4833 $self->addLabel($grid,
4834 '<i>List of \'grid\' window packages added by ' . $axmud::SCRIPT . ' plugins</i>',
4835 1, 12, 1, 2);
4836  
4837 # Add a simple list
4838 @columnList = (
4839 'Package', 'text',
4840 'Plugin', 'text',
4841 );
4842  
4843 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4844 1, 12, 2, 10);
4845  
4846 # Initialise the simple list
4847 $self->plugins6Tab_refreshList($slWidget, scalar (@columnList / 2));
4848  
4849 # Add buttons
4850 my $button = $self->addButton($grid,
4851 'Refresh list', 'Refresh the list of packages', undef,
4852 10, 12, 10, 11);
4853 $button->signal_connect('clicked' => sub {
4854  
4855 # Refresh the simple list
4856 $self->plugins6Tab_refreshList($slWidget, scalar (@columnList / 2));
4857 });
4858  
4859 # Tab complete
4860 return 1;
4861 }
4862  
4863 sub plugins6Tab_refreshList {
4864  
4865 # Resets the simple list displayed by $self->plugins6Tab
4866 #
4867 # Expected arguments
4868 # $slWidget - The GA::Obj::SimpleList
4869 # $columns - The number of columns
4870 #
4871 # Return values
4872 # 'undef' on improper arguments
4873 # 1 otherwise
4874  
4875 my ($self, $slWidget, $columns, $check) = @_;
4876  
4877 # Local variables
4878 my (
4879 @winList, @dataList,
4880 %winHash,
4881 );
4882  
4883 # Check for improper arguments
4884 if (! defined $slWidget || ! defined $columns || defined $check) {
4885  
4886 return $axmud::CLIENT->writeImproper(
4887 $self->_objClass . '->plugins6Tab_refreshList',
4888 @_,
4889 );
4890 }
4891  
4892 # Import the list of packages
4893 %winHash = $axmud::CLIENT->pluginGridWinHash;
4894 @winList = sort {lc($a) cmp lc($b)} (keys %winHash);
4895  
4896 # Compile the simple list data
4897 foreach my $win (@winList) {
4898  
4899 push (@dataList, $win, $winHash{$win});
4900 }
4901  
4902 # Reset the simple list
4903 $self->resetListData($slWidget, [@dataList], $columns);
4904  
4905 return 1;
4906 }
4907  
4908 sub plugins7Tab {
4909  
4910 # Plugins7 tab
4911 #
4912 # Expected arguments
4913 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
4914 #
4915 # Return values
4916 # 'undef' on improper arguments
4917 # 1 otherwise
4918  
4919 my ($self, $innerNotebook, $check) = @_;
4920  
4921 # Local variables
4922 my @columnList;
4923  
4924 # Check for improper arguments
4925 if (! defined $innerNotebook || defined $check) {
4926  
4927 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins7Tab', @_);
4928 }
4929  
4930 # Tab setup
4931 my $grid = $self->addTab('Page _7', $innerNotebook);
4932  
4933 # Plugin 'free' windows
4934 $self->addLabel($grid, '<b>Plugin \'free\' windows</b>',
4935 0, 12, 0, 1);
4936 $self->addLabel($grid,
4937 '<i>List of \'free\' window packages added by ' . $axmud::SCRIPT . ' plugins</i>',
4938 1, 12, 1, 2);
4939  
4940 # Add a simple list
4941 @columnList = (
4942 'Package', 'text',
4943 'Plugin', 'text',
4944 );
4945  
4946 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
4947 1, 12, 2, 10);
4948  
4949 # Initialise the simple list
4950 $self->plugins7Tab_refreshList($slWidget, scalar (@columnList / 2));
4951  
4952 # Add buttons
4953 my $button = $self->addButton($grid,
4954 'Refresh list', 'Refresh the list of packages', undef,
4955 10, 12, 10, 11);
4956 $button->signal_connect('clicked' => sub {
4957  
4958 # Refresh the simple list
4959 $self->plugins7Tab_refreshList($slWidget, scalar (@columnList / 2));
4960 });
4961  
4962 # Tab complete
4963 return 1;
4964 }
4965  
4966 sub plugins7Tab_refreshList {
4967  
4968 # Resets the simple list displayed by $self->plugins7Tab
4969 #
4970 # Expected arguments
4971 # $slWidget - The GA::Obj::SimpleList
4972 # $columns - The number of columns
4973 #
4974 # Return values
4975 # 'undef' on improper arguments
4976 # 1 otherwise
4977  
4978 my ($self, $slWidget, $columns, $check) = @_;
4979  
4980 # Local variables
4981 my (
4982 @winList, @dataList,
4983 %winHash,
4984 );
4985  
4986 # Check for improper arguments
4987 if (! defined $slWidget || ! defined $columns || defined $check) {
4988  
4989 return $axmud::CLIENT->writeImproper(
4990 $self->_objClass . '->plugins7Tab_refreshList',
4991 @_,
4992 );
4993 }
4994  
4995 # Import the list of packages
4996 %winHash = $axmud::CLIENT->pluginFreeWinHash;
4997 @winList = sort {lc($a) cmp lc($b)} (keys %winHash);
4998  
4999 # Compile the simple list data
5000 foreach my $win (@winList) {
5001  
5002 push (@dataList, $win, $winHash{$win});
5003 }
5004  
5005 # Reset the simple list
5006 $self->resetListData($slWidget, [@dataList], $columns);
5007  
5008 return 1;
5009 }
5010  
5011 sub plugins8Tab {
5012  
5013 # Plugins8 tab
5014 #
5015 # Expected arguments
5016 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5017 #
5018 # Return values
5019 # 'undef' on improper arguments
5020 # 1 otherwise
5021  
5022 my ($self, $innerNotebook, $check) = @_;
5023  
5024 # Local variables
5025 my @columnList;
5026  
5027 # Check for improper arguments
5028 if (! defined $innerNotebook || defined $check) {
5029  
5030 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins8Tab', @_);
5031 }
5032  
5033 # Tab setup
5034 my $grid = $self->addTab('Page _8', $innerNotebook);
5035  
5036 # Plugin 'free' windows
5037 $self->addLabel($grid, '<b>Plugin strip objects</b>',
5038 0, 12, 0, 1);
5039 $self->addLabel($grid,
5040 '<i>List of strip object packages added by ' . $axmud::SCRIPT . ' plugins</i>',
5041 1, 12, 1, 2);
5042  
5043 # Add a simple list
5044 @columnList = (
5045 'Package', 'text',
5046 'Plugin', 'text',
5047 );
5048  
5049 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
5050 1, 12, 2, 10);
5051  
5052 # Initialise the simple list
5053 $self->plugins8Tab_refreshList($slWidget, scalar (@columnList / 2));
5054  
5055 # Add buttons
5056 my $button = $self->addButton($grid,
5057 'Refresh list', 'Refresh the list of packages', undef,
5058 10, 12, 10, 11);
5059 $button->signal_connect('clicked' => sub {
5060  
5061 # Refresh the simple list
5062 $self->plugins8Tab_refreshList($slWidget, scalar (@columnList / 2));
5063 });
5064  
5065 # Tab complete
5066 return 1;
5067 }
5068  
5069 sub plugins8Tab_refreshList {
5070  
5071 # Resets the simple list displayed by $self->plugins8Tab
5072 #
5073 # Expected arguments
5074 # $slWidget - The GA::Obj::SimpleList
5075 # $columns - The number of columns
5076 #
5077 # Return values
5078 # 'undef' on improper arguments
5079 # 1 otherwise
5080  
5081 my ($self, $slWidget, $columns, $check) = @_;
5082  
5083 # Local variables
5084 my (
5085 @objList, @dataList,
5086 %objHash,
5087 );
5088  
5089 # Check for improper arguments
5090 if (! defined $slWidget || ! defined $columns || defined $check) {
5091  
5092 return $axmud::CLIENT->writeImproper(
5093 $self->_objClass . '->plugins8Tab_refreshList',
5094 @_,
5095 );
5096 }
5097  
5098 # Import the list of packages
5099 %objHash = $axmud::CLIENT->pluginStripObjHash;
5100 @objList = sort {lc($a) cmp lc($b)} (keys %objHash);
5101  
5102 # Compile the simple list data
5103 foreach my $win (@objList) {
5104  
5105 push (@dataList, $win, $objHash{$win});
5106 }
5107  
5108 # Reset the simple list
5109 $self->resetListData($slWidget, [@dataList], $columns);
5110  
5111 return 1;
5112 }
5113  
5114 sub plugins9Tab {
5115  
5116 # Plugins9 tab
5117 #
5118 # Expected arguments
5119 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5120 #
5121 # Return values
5122 # 'undef' on improper arguments
5123 # 1 otherwise
5124  
5125 my ($self, $innerNotebook, $check) = @_;
5126  
5127 # Local variables
5128 my @columnList;
5129  
5130 # Check for improper arguments
5131 if (! defined $innerNotebook || defined $check) {
5132  
5133 return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins9Tab', @_);
5134 }
5135  
5136 # Tab setup
5137 my $grid = $self->addTab('Page _9', $innerNotebook);
5138  
5139 # Plugin 'free' windows
5140 $self->addLabel($grid, '<b>Plugin table objects</b>',
5141 0, 12, 0, 1);
5142 $self->addLabel($grid,
5143 '<i>List of table object packages added by ' . $axmud::SCRIPT . ' plugins</i>',
5144 1, 12, 1, 2);
5145  
5146 # Add a simple list
5147 @columnList = (
5148 'Package', 'text',
5149 'Plugin', 'text',
5150 );
5151  
5152 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
5153 1, 12, 2, 10);
5154  
5155 # Initialise the simple list
5156 $self->plugins9Tab_refreshList($slWidget, scalar (@columnList / 2));
5157  
5158 # Add buttons
5159 my $button = $self->addButton($grid,
5160 'Refresh list', 'Refresh the list of packages', undef,
5161 10, 12, 10, 11);
5162 $button->signal_connect('clicked' => sub {
5163  
5164 # Refresh the simple list
5165 $self->plugins9Tab_refreshList($slWidget, scalar (@columnList / 2));
5166 });
5167  
5168 # Tab complete
5169 return 1;
5170 }
5171  
5172 sub plugins9Tab_refreshList {
5173  
5174 # Resets the simple list displayed by $self->plugins9Tab
5175 #
5176 # Expected arguments
5177 # $slWidget - The GA::Obj::SimpleList
5178 # $columns - The number of columns
5179 #
5180 # Return values
5181 # 'undef' on improper arguments
5182 # 1 otherwise
5183  
5184 my ($self, $slWidget, $columns, $check) = @_;
5185  
5186 # Local variables
5187 my (
5188 @objList, @dataList,
5189 %objHash,
5190 );
5191  
5192 # Check for improper arguments
5193 if (! defined $slWidget || ! defined $columns || defined $check) {
5194  
5195 return $axmud::CLIENT->writeImproper(
5196 $self->_objClass . '->plugins9Tab_refreshList',
5197 @_,
5198 );
5199 }
5200  
5201 # Import the list of packages
5202 %objHash = $axmud::CLIENT->pluginTableObjHash;
5203 @objList = sort {lc($a) cmp lc($b)} (keys %objHash);
5204  
5205 # Compile the simple list data
5206 foreach my $win (@objList) {
5207  
5208 push (@dataList, $win, $objHash{$win});
5209 }
5210  
5211 # Reset the simple list
5212 $self->resetListData($slWidget, [@dataList], $columns);
5213  
5214 return 1;
5215 }
5216  
5217 sub commandsTab {
5218  
5219 # Commands tab - called by $self->setupNotebook
5220 #
5221 # Expected arguments
5222 # (none besides $self)
5223 #
5224 # Return values
5225 # 'undef' on improper arguments
5226 # 1 otherwise
5227  
5228 my ($self, $check) = @_;
5229  
5230 # Check for improper arguments
5231 if (defined $check) {
5232  
5233 return $axmud::CLIENT->writeImproper($self->_objClass . '->commandsTab', @_);
5234 }
5235  
5236 # Tab setup
5237 # Create a notebook within the main one, so that we have two rows of tabs
5238 my $innerNotebook = $self->addInnerNotebookTab('Co_mmands', $self->notebook);
5239  
5240 # Add tabs to the inner notebook
5241 $self->commands1Tab($innerNotebook);
5242 $self->commands2Tab($innerNotebook);
5243 $self->commands3Tab($innerNotebook);
5244 $self->commands4Tab($innerNotebook);
5245 $self->commands5Tab($innerNotebook);
5246 $self->commands6Tab($innerNotebook);
5247  
5248 return 1;
5249 }
5250  
5251 sub commands1Tab {
5252  
5253 # Commands1 tab
5254 #
5255 # Expected arguments
5256 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5257 #
5258 # Return values
5259 # 'undef' on improper arguments
5260 # 1 otherwise
5261  
5262 my ($self, $innerNotebook, $check) = @_;
5263  
5264 # Check for improper arguments
5265 if (! defined $innerNotebook || defined $check) {
5266  
5267 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands1Tab', @_);
5268 }
5269  
5270 # Tab setup
5271 my $grid = $self->addTab('Page _1', $innerNotebook);
5272  
5273 # Instruction sigils
5274 $self->addLabel($grid, '<b>Instruction sigils</b>',
5275 0, 12, 0, 1);
5276  
5277 $self->addLabel($grid, 'Client command sigil',
5278 1, 4, 1, 2);
5279 my $entry = $self->addEntry($grid, undef, FALSE,
5280 4, 6, 1, 2);
5281 $entry->set_text($axmud::CLIENT->constClientSigil);
5282  
5283 my $checkButton = $self->addCheckButton($grid, undef, undef, FALSE,
5284 6, 8, 1, 2);
5285 $checkButton->set_active(TRUE);
5286  
5287 $self->addLabel($grid, 'Forced world command sigil',
5288 1, 4, 2, 3);
5289 my $entry2 = $self->addEntry($grid, undef, FALSE,
5290 4, 6, 2, 3);
5291 $entry2->set_text($axmud::CLIENT->constForcedSigil);
5292  
5293 my $checkButton2 = $self->addCheckButton($grid, undef, undef, FALSE,
5294 6, 8, 2, 3);
5295 $checkButton2->set_active(TRUE);
5296  
5297 $self->addLabel($grid, 'Echo command sigil',
5298 1, 4, 3, 4);
5299 my $entry3 = $self->addEntry($grid, undef, FALSE,
5300 4, 6, 3, 4);
5301 $entry3->set_text($axmud::CLIENT->constEchoSigil);
5302  
5303 my $checkButton3 = $self->addCheckButton($grid, undef, undef, FALSE,
5304 6, 8, 3, 4);
5305 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
5306  
5307 my $button = $self->addButton($grid, 'Enable', 'Enable echo commands', undef,
5308 8, 10, 3, 4);
5309 $button->signal_connect('clicked' => sub {
5310  
5311 if (! $axmud::CLIENT->echoSigilFlag) {
5312  
5313 $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode);
5314 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
5315 }
5316 });
5317 my $button2 = $self->addButton($grid, 'Disable', 'Disable echo commands', undef,
5318 10, 12, 3, 4);
5319 $button2->signal_connect('clicked' => sub {
5320  
5321 if ($axmud::CLIENT->echoSigilFlag) {
5322  
5323 $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode);
5324 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
5325 }
5326 });
5327  
5328 $self->addLabel($grid, 'Perl command sigil',
5329 1, 4, 4, 5);
5330 my $entry4 = $self->addEntry($grid, undef, FALSE,
5331 4, 6, 4, 5);
5332 $entry4->set_text($axmud::CLIENT->constPerlSigil);
5333  
5334 my $checkButton4 = $self->addCheckButton($grid, undef, undef, FALSE,
5335 6, 8, 4, 5);
5336 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
5337  
5338 my $button3 = $self->addButton($grid, 'Enable', 'Enable Perl commands', undef,
5339 8, 10, 4, 5);
5340 $button3->signal_connect('clicked' => sub {
5341  
5342 if (! $axmud::CLIENT->perlSigilFlag) {
5343  
5344 $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode);
5345 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
5346 }
5347 });
5348 my $button4 = $self->addButton($grid, 'Disable', 'Disable Perl commands', undef,
5349 10, 12, 4, 5);
5350 $button4->signal_connect('clicked' => sub {
5351  
5352 if ($axmud::CLIENT->perlSigilFlag) {
5353  
5354 $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode);
5355 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
5356 }
5357 });
5358  
5359 $self->addLabel($grid, 'Script command sigil',
5360 1, 4, 5, 6);
5361 my $entry5 = $self->addEntry($grid, undef, FALSE,
5362 4, 6, 5, 6);
5363 $entry5->set_text($axmud::CLIENT->constScriptSigil);
5364  
5365 my $checkButton5 = $self->addCheckButton($grid, undef, undef, FALSE,
5366 6, 8, 5, 6);
5367 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
5368  
5369 my $button5 = $self->addButton($grid, 'Enable', 'Enable script commands', undef,
5370 8, 10, 5, 6);
5371 $button5->signal_connect('clicked' => sub {
5372  
5373 if (! $axmud::CLIENT->scriptSigilFlag) {
5374  
5375 $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode);
5376 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
5377 }
5378 });
5379 my $button6 = $self->addButton($grid, 'Disable', 'Disable script commands', undef,
5380 10, 12, 5, 6);
5381 $button6->signal_connect('clicked' => sub {
5382  
5383 if ($axmud::CLIENT->scriptSigilFlag) {
5384  
5385 $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode);
5386 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
5387 }
5388 });
5389  
5390 $self->addLabel($grid, 'Multi command sigil',
5391 1, 4, 6, 7);
5392 my $entry6 = $self->addEntry($grid, undef, FALSE,
5393 4, 6, 6, 7);
5394 $entry6->set_text($axmud::CLIENT->constMultiSigil);
5395  
5396 my $checkButton6 = $self->addCheckButton($grid, undef, undef, FALSE,
5397 6, 8, 6, 7);
5398 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
5399  
5400 my $button7 = $self->addButton($grid, 'Enable', 'Enable multi commands', undef,
5401 8, 10, 6, 7);
5402 $button7->signal_connect('clicked' => sub {
5403  
5404 if (! $axmud::CLIENT->multiSigilFlag) {
5405  
5406 $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode);
5407 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
5408 }
5409 });
5410 my $button8 = $self->addButton($grid, 'Disable', 'Disable multi commands', undef,
5411 10, 12, 6, 7);
5412 $button8->signal_connect('clicked' => sub {
5413  
5414 if ($axmud::CLIENT->multiSigilFlag) {
5415  
5416 $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode);
5417 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
5418 }
5419 });
5420  
5421 $self->addLabel($grid, 'Speedwalk command sigil',
5422 1, 4, 7, 8);
5423 my $entry7 = $self->addEntry($grid, undef, FALSE,
5424 4, 6, 7, 8);
5425 $entry7->set_text($axmud::CLIENT->constSpeedSigil);
5426  
5427 my $checkButton7 = $self->addCheckButton($grid, undef, undef, FALSE,
5428 6, 8, 7, 8);
5429 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
5430  
5431 my $button9 = $self->addButton($grid, 'Enable', 'Enable speedwalk commands', undef,
5432 8, 10, 7, 8);
5433 $button9->signal_connect('clicked' => sub {
5434  
5435 if (! $axmud::CLIENT->speedSigilFlag) {
5436  
5437 $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode);
5438 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
5439 }
5440 });
5441 my $button10 = $self->addButton($grid, 'Disable', 'Disable speedwalk commands', undef,
5442 10, 12, 7, 8);
5443 $button10->signal_connect('clicked' => sub {
5444  
5445 if ($axmud::CLIENT->speedSigilFlag) {
5446  
5447 $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode);
5448 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
5449 }
5450 });
5451  
5452 $self->addLabel($grid, 'Bypass command sigil',
5453 1, 4, 8, 9);
5454 my $entry8 = $self->addEntry($grid, undef, FALSE,
5455 4, 6, 8, 9);
5456 $entry8->set_text($axmud::CLIENT->constBypassSigil);
5457  
5458 my $checkButton8 = $self->addCheckButton($grid, undef, undef, FALSE,
5459 6, 8, 8, 9);
5460 $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag);
5461  
5462 my $button11 = $self->addButton($grid, 'Enable', 'Enable bypass commands', undef,
5463 8, 10, 8, 9);
5464 $button11->signal_connect('clicked' => sub {
5465  
5466 if (! $axmud::CLIENT->bypassSigilFlag) {
5467  
5468 $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode);
5469 $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag);
5470 }
5471 });
5472 my $button12 = $self->addButton($grid, 'Disable', 'Disable bypass commands', undef,
5473 10, 12, 8, 9);
5474 $button12->signal_connect('clicked' => sub {
5475  
5476 if ($axmud::CLIENT->bypassSigilFlag) {
5477  
5478 $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode);
5479 $checkButton8->set_active($axmud::CLIENT->speedSigilFlag);
5480 }
5481 });
5482  
5483 # World command separator
5484 $self->addLabel($grid, '<b>World command separator</b>',
5485 0, 12, 9, 10);
5486  
5487 $self->addLabel($grid, 'Separator',
5488 1, 4, 10, 11);
5489 my $entry9 = $self->addEntry($grid, undef, TRUE,
5490 4, 6, 10, 11,
5491 16, 16);
5492 $entry9->set_text($axmud::CLIENT->cmdSep);
5493 $entry9->set_icon_from_stock('secondary', 'gtk-yes');
5494 $entry9->signal_connect('changed' => sub {
5495  
5496 # (Borrowed from GA::Generic::EditWin->addEntryWithIcon and ->checkEntry. The value
5497 # must not contain any spaces)
5498  
5499 my $value = $entry9->get_text();
5500 # Check whether $text is a valid value, or not
5501  
5502 if (! $value || length ($value) > 4 || $value =~ m/\s/) {
5503 $entry9->set_icon_from_stock('secondary', 'gtk-no');
5504 } else {
5505 $entry9->set_icon_from_stock('secondary', 'gtk-yes');
5506 }
5507 });
5508  
5509 my $button13 = $self->addButton(
5510 $grid, 'Set', 'Sets the command separator (max 4 characters, no spaces)', undef,
5511 8, 10, 10, 11);
5512 $button13->signal_connect('clicked' => sub {
5513  
5514 my $separator = $entry9->get_text();
5515  
5516 if ($self->checkEntryIcon($entry9)) {
5517  
5518 # Set the command separator
5519 $self->session->pseudoCmd('commandseparator ' . $separator, $self->pseudoCmdMode);
5520  
5521 # Update the entry box
5522 $entry9->set_text($axmud::CLIENT->cmdSep);
5523 }
5524 });
5525  
5526 my $button14 = $self->addButton(
5527 $grid, 'Reset', 'Resets the command separator to its default value', undef,
5528 10, 12, 10, 11);
5529 $button14->signal_connect('clicked' => sub {
5530  
5531 # Set the command separator
5532 $self->session->pseudoCmd('commandseparator', $self->pseudoCmdMode);
5533  
5534 # Update the entry box
5535 $entry9->set_text($axmud::CLIENT->cmdSep);
5536 });
5537  
5538 # Tab complete
5539 return 1;
5540 }
5541  
5542 sub commands2Tab {
5543  
5544 # Commands2 tab
5545 #
5546 # Expected arguments
5547 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5548 #
5549 # Return values
5550 # 'undef' on improper arguments
5551 # 1 otherwise
5552  
5553 my ($self, $innerNotebook, $check) = @_;
5554  
5555 # Check for improper arguments
5556 if (! defined $innerNotebook || defined $check) {
5557  
5558 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands3Tab', @_);
5559 }
5560  
5561 # Tab setup
5562 my $grid = $self->addTab('Page _2', $innerNotebook);
5563  
5564 # Left column
5565 $self->addLabel($grid, '<b>Instruction settings</b>',
5566 0, 6, 0, 1);
5567 $self->addLabel($grid, '<i>Multi commands</i>',
5568 1, 6, 1, 2);
5569  
5570 my ($group, $radioButton) = $self->addRadioButton(
5571 $grid, undef, 'Send to sessions with same world profile', undef,
5572 undef, # IV set to this value when toggled
5573 TRUE, # Sensitive widget
5574 1, 6, 2, 3);
5575 $radioButton->signal_connect('toggled' => sub {
5576  
5577 if ($radioButton->get_active() && $axmud::CLIENT->maxMultiCmdFlag) {
5578  
5579 $self->session->pseudoCmd('toggleinstruct -m', $self->pseudoCmdMode);
5580 }
5581 });
5582  
5583 my ($group2, $radioButton2) = $self->addRadioButton(
5584 $grid, $group, 'Send to all sessions', undef, undef, TRUE,
5585 1, 6, 3, 4);
5586 if ($axmud::CLIENT->maxMultiCmdFlag) {
5587  
5588 $radioButton2->set_active(TRUE);
5589 }
5590 $radioButton2->signal_connect('toggled' => sub {
5591  
5592  
5593 if ($radioButton2->get_active() && ! $axmud::CLIENT->maxMultiCmdFlag) {
5594  
5595 $self->session->pseudoCmd('toggleinstruct -m', $self->pseudoCmdMode);
5596 }
5597 });
5598  
5599 $self->addLabel($grid, '<i>World / speedwalk / multi / bypass commands</i>',
5600 1, 6, 4, 5);
5601  
5602 my ($group11, $radioButton11) = $self->addRadioButton(
5603 $grid, undef, 'After processing, remove from command entry box', undef,
5604 undef, # IV set to this value when toggled
5605 TRUE, # Sensitive widget
5606 1, 6, 5, 6);
5607 $radioButton11->signal_connect('toggled' => sub {
5608  
5609 if ($radioButton11->get_active() && $axmud::CLIENT->preserveWorldCmdFlag) {
5610  
5611 $self->session->pseudoCmd('toggleinstruct -w', $self->pseudoCmdMode);
5612 }
5613 });
5614  
5615 my ($group12, $radioButton12) = $self->addRadioButton(
5616 $grid, $group11, 'After processing, retain in command entry box', undef, undef, TRUE,
5617 1, 6, 6, 7);
5618 if ($axmud::CLIENT->preserveWorldCmdFlag) {
5619  
5620 $radioButton12->set_active(TRUE);
5621 }
5622 $radioButton12->signal_connect('toggled' => sub {
5623  
5624 if ($radioButton12->get_active() && ! $axmud::CLIENT->preserveWorldCmdFlag) {
5625  
5626 $self->session->pseudoCmd('toggleinstruct -w', $self->pseudoCmdMode);
5627 }
5628 });
5629  
5630 $self->addLabel($grid, '<i>Client / echo / Perl / script commands</i>',
5631 1, 6, 7, 8);
5632  
5633 my ($group21, $radioButton21) = $self->addRadioButton(
5634 $grid, undef, 'After processing, remove from command entry box', undef,
5635 undef, # IV set to this value when toggled
5636 TRUE, # Sensitive widget
5637 1, 6, 8, 9);
5638 $radioButton21->signal_connect('toggled' => sub {
5639  
5640 if ($radioButton21->get_active() && $axmud::CLIENT->preserveOtherCmdFlag) {
5641  
5642 $self->session->pseudoCmd('toggleinstruct -o', $self->pseudoCmdMode);
5643 }
5644 });
5645  
5646 my ($group22, $radioButton22) = $self->addRadioButton(
5647 $grid,
5648 $group21,
5649 'After processing, retain in command entry box',
5650 undef,
5651 undef,
5652 TRUE,
5653 1, 6, 9, 10);
5654 if ($axmud::CLIENT->preserveOtherCmdFlag) {
5655  
5656 $radioButton22->set_active(TRUE);
5657 }
5658 $radioButton22->signal_connect('toggled' => sub {
5659  
5660 if ($radioButton22->get_active() && ! $axmud::CLIENT->preserveOtherCmdFlag) {
5661  
5662 $self->session->pseudoCmd('toggleinstruct -o', $self->pseudoCmdMode);
5663 }
5664 });
5665  
5666 # Right column
5667 $self->addLabel($grid, '<i>Other settings</i>',
5668 7, 12, 1, 2);
5669  
5670 my $checkButton = $self->addCheckButton(
5671 $grid, 'World commands also shown in \'main\' window', undef, TRUE,
5672 7, 12, 2, 3);
5673 $checkButton->set_active($axmud::CLIENT->confirmWorldCmdFlag);
5674 $checkButton->signal_connect('toggled' => sub {
5675  
5676 if (
5677 ($checkButton->get_active() && ! $axmud::CLIENT->confirmWorldCmdFlag)
5678 || (! $checkButton->get_active() && $axmud::CLIENT->confirmWorldCmdFlag)
5679 ) {
5680 $self->session->pseudoCmd('toggleinstruct -c', $self->pseudoCmdMode);
5681 }
5682 });
5683  
5684 my $checkButton2 = $self->addCheckButton(
5685 $grid, 'Send short world commands in lower-case letters', undef, TRUE,
5686 7, 12, 3, 4);
5687 $checkButton2->set_active($axmud::CLIENT->convertWorldCmdFlag);
5688 $checkButton2->signal_connect('toggled' => sub {
5689  
5690 if (
5691 ($checkButton2->get_active() && ! $axmud::CLIENT->convertWorldCmdFlag)
5692 || (! $checkButton2->get_active() && $axmud::CLIENT->convertWorldCmdFlag)
5693 ) {
5694 $self->session->pseudoCmd('toggleinstruct -v', $self->pseudoCmdMode);
5695 }
5696 });
5697  
5698 # Tab complete
5699 return 1;
5700 }
5701  
5702 sub commands3Tab {
5703  
5704 # Commands3 tab
5705 #
5706 # Expected arguments
5707 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5708 #
5709 # Return values
5710 # 'undef' on improper arguments
5711 # 1 otherwise
5712  
5713 my ($self, $innerNotebook, $check) = @_;
5714  
5715 # Check for improper arguments
5716 if (! defined $innerNotebook || defined $check) {
5717  
5718 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands3Tab', @_);
5719 }
5720  
5721 # Tab setup
5722 my $grid = $self->addTab('Page _3', $innerNotebook);
5723  
5724 # Left column
5725 $self->addLabel($grid, '<b>Redirect mode</b>',
5726 0, 6, 0, 1);
5727 my $entry6 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
5728 1, 6, 1, 2);
5729 $self->addLabel($grid, '<i>The \'@\' symbol is replaced by a direction</i>',
5730 1, 6, 2, 3);
5731  
5732 my $button4 = $self->addButton(
5733 $grid,
5734 'Redirect mode on',
5735 'Redirects direction commands, replacing the @ symbol with the direction',
5736 undef,
5737 1, 3, 3, 4);
5738 $button4->signal_connect('clicked' => sub {
5739  
5740 my $string = $entry6->get_text();
5741  
5742 if ($self->checkEntryIcon($entry6)) {
5743  
5744 # Turn redirect mode on
5745 $self->session->pseudoCmd('redirectmode <' . $string . '>', $self->pseudoCmdMode);
5746  
5747 # Reset the entry box
5748 $self->resetEntryBoxes($entry6);
5749 }
5750 });
5751  
5752 my $button5 = $self->addButton(
5753 $grid,
5754 'Redirect mode off',
5755 'Turns off redirect mode',
5756 undef,
5757 3, 5, 3, 4);
5758 $button5->signal_connect('clicked' => sub {
5759  
5760 # Turn redirect mode on
5761 $self->session->pseudoCmd('redirectmode', $self->pseudoCmdMode);
5762  
5763 # Reset the entry box
5764 $self->resetEntryBoxes($entry6);
5765 });
5766  
5767 my ($group, $radioButton) = $self->addRadioButton(
5768 $grid, undef, 'Redirect primary directions only', undef,
5769 undef, # IV set to this value when toggled
5770 TRUE, # Sensitive widget
5771 1, 6, 4, 5);
5772 if ($self->session->redirectMode eq 'primary_only') {
5773  
5774 $radioButton->set_active(TRUE);
5775 }
5776 $radioButton->signal_connect('toggled' => sub {
5777  
5778 if ($radioButton->get_active()) {
5779  
5780 $self->session->pseudoCmd('setredirectmode -p', $self->pseudoCmdMode);
5781 }
5782 });
5783  
5784 my ($group2, $radioButton2) = $self->addRadioButton(
5785 $grid, $group, 'Redirect primary & secondary directions', undef, undef, TRUE,
5786 1, 6, 5, 6);
5787 if ($self->session->redirectMode eq 'primary_secondary') {
5788  
5789 $radioButton2->set_active(TRUE);
5790 }
5791 $radioButton2->signal_connect('toggled' => sub {
5792  
5793 if ($radioButton2->get_active()) {
5794  
5795 $self->session->pseudoCmd('setredirectmode -b', $self->pseudoCmdMode);
5796 }
5797 });
5798  
5799 my ($group3, $radioButton3) = $self->addRadioButton(
5800 $grid, $group2, 'Redirect all direction commands', undef, undef, TRUE,
5801 1, 6, 6, 7);
5802 if ($self->session->redirectMode eq 'all_exits') {
5803  
5804 $radioButton3->set_active(TRUE);
5805 }
5806 $radioButton3->signal_connect('toggled' => sub {
5807  
5808 if ($radioButton3->get_active()) {
5809  
5810 $self->session->pseudoCmd('setredirectmode -a', $self->pseudoCmdMode);
5811 }
5812 });
5813  
5814 # Right column
5815 $self->addLabel($grid, '<b>Auto-complete mode</b>',
5816 7, 13, 0, 1);
5817  
5818 my ($group11, $radioButton11) = $self->addRadioButton(
5819 $grid, undef, 'Don\'t auto-complete instructions/world commands', undef,
5820 undef, # IV set to this value when toggled
5821 TRUE, # Sensitive widget
5822 8, 13, 1, 2);
5823 if ($axmud::CLIENT->autoCompleteMode eq 'none') {
5824  
5825 $radioButton11->set_active(TRUE);
5826 }
5827 $radioButton11->signal_connect('toggled' => sub {
5828  
5829 if ($radioButton11->get_active()) {
5830  
5831 $axmud::CLIENT->set_autoCompleteMode('none');
5832 }
5833 });
5834  
5835 my ($group12, $radioButton12) = $self->addRadioButton(
5836 $grid, $group11, 'Auto-complete instructions/world commands', undef, undef, TRUE,
5837 8, 13, 2, 3);
5838 if ($axmud::CLIENT->autoCompleteMode eq 'auto') {
5839  
5840 $radioButton12->set_active(TRUE);
5841 }
5842 $radioButton12->signal_connect('toggled' => sub {
5843  
5844 if ($radioButton12->get_active()) {
5845  
5846 $axmud::CLIENT->set_autoCompleteMode('auto');
5847 }
5848 });
5849  
5850 $self->addLabel($grid, '<i>Auto-complete type</i>',
5851 8, 13, 3, 4);
5852  
5853 my ($group21, $radioButton21) = $self->addRadioButton(
5854 $grid, undef, 'Navigate through an instruction buffer', undef,
5855 undef, # IV set to this value when toggled
5856 TRUE, # Sensitive widget
5857 8, 13, 4, 5);
5858 if ($axmud::CLIENT->autoCompleteType eq 'instruct') {
5859  
5860 $radioButton21->set_active(TRUE);
5861 }
5862 $radioButton21->signal_connect('toggled' => sub {
5863  
5864 if ($radioButton21->get_active()) {
5865  
5866 $axmud::CLIENT->set_autoCompleteType('instruct');
5867 }
5868 });
5869  
5870 my ($group22, $radioButton22) = $self->addRadioButton(
5871 $grid, $group21, 'Navigate through a world command buffer', undef, undef, TRUE,
5872 8, 13, 5, 6);
5873 if ($axmud::CLIENT->autoCompleteType eq 'cmd') {
5874  
5875 $radioButton22->set_active(TRUE);
5876 }
5877 $radioButton22->signal_connect('toggled' => sub {
5878  
5879 if ($radioButton22->get_active()) {
5880  
5881 $axmud::CLIENT->set_autoCompleteType('cmd');
5882 }
5883 });
5884  
5885 $self->addLabel($grid, '<i>Buffer location</i>',
5886 8, 13, 6, 7);
5887  
5888 my ($group31, $radioButton31) = $self->addRadioButton(
5889 $grid, undef, 'Use combined buffers', undef,
5890 undef, # IV set to this value when toggled
5891 TRUE, # Sensitive widget
5892 8, 13, 7, 8);
5893 if ($axmud::CLIENT->autoCompleteParent eq 'combined') {
5894  
5895 $radioButton31->set_active(TRUE);
5896 }
5897 $radioButton31->signal_connect('toggled' => sub {
5898  
5899 if ($radioButton31->get_active()) {
5900  
5901 $axmud::CLIENT->set_autoCompleteParent('combined');
5902 }
5903 });
5904  
5905 my ($group32, $radioButton32) = $self->addRadioButton(
5906 $grid, $group31, 'Use session buffers', undef, undef, TRUE,
5907 8, 13, 8, 9);
5908 if ($axmud::CLIENT->autoCompleteParent eq 'session') {
5909  
5910 $radioButton32->set_active(TRUE);
5911 }
5912 $radioButton32->signal_connect('toggled' => sub {
5913  
5914 if ($radioButton32->get_active()) {
5915  
5916 $axmud::CLIENT->set_autoCompleteParent('session');
5917 }
5918 });
5919  
5920 # Tab complete
5921 return 1;
5922 }
5923  
5924 sub commands4Tab {
5925  
5926 # Commands4 tab
5927 #
5928 # Expected arguments
5929 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
5930 #
5931 # Return values
5932 # 'undef' on improper arguments
5933 # 1 otherwise
5934  
5935 my ($self, $innerNotebook, $check) = @_;
5936  
5937 # Local variables
5938 my (@columnList, @comboList);
5939  
5940 # Check for improper arguments
5941 if (! defined $innerNotebook || defined $check) {
5942  
5943 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands4Tab', @_);
5944 }
5945  
5946 # Tab setup
5947 my $grid = $self->addTab('Page _4', $innerNotebook);
5948  
5949 # Custom user commands
5950 $self->addLabel($grid, '<b>User commands</b>',
5951 0, 12, 0, 1);
5952 $self->addLabel($grid,
5953 '<i>Customisable list of alternate forms for standard client commands</i>',
5954 1, 12, 1, 2);
5955  
5956 # Add a simple list
5957 @columnList = (
5958 'User command', 'text',
5959 'Standard client command', 'text',
5960 );
5961  
5962 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
5963 1, 12, 2, 10);
5964  
5965 # Initialise the list
5966 $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2));
5967  
5968 # Add entry boxes and editing buttons
5969 $self->addLabel($grid, 'User command',
5970 1, 3, 10, 11);
5971 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 32,
5972 3, 6, 10, 11);
5973  
5974 $self->addLabel($grid, 'Standard command',
5975 7, 9, 10, 11);
5976 @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('clientCmdHash'));
5977 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
5978 TRUE, # No 'undef' value used
5979 9, 12, 10, 11);
5980  
5981 my $button = $self->addButton($grid, 'Add', 'Add or replace a user command', undef,
5982 1, 3, 11, 12);
5983 $button->signal_connect('clicked' => sub {
5984  
5985 my ($user, $standard);
5986  
5987 $user = $entry->get_text();
5988 $standard = $combo->get_active_text();
5989  
5990 if ($self->checkEntryIcon($entry)) {
5991  
5992 # Add this user command
5993 $self->session->pseudoCmd(
5994 'addusercommand ' . $standard . ' ' . $user,
5995 $self->pseudoCmdMode,
5996 );
5997  
5998 # Refresh the simple list and entry boxes
5999 $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2));
6000 $self->resetEntryBoxes($entry);
6001 }
6002 });
6003  
6004 my $button2 = $self->addButton($grid, 'Delete', 'Delete the selected user command', undef,
6005 3, 5, 11, 12);
6006 $button2->signal_connect('clicked' => sub {
6007  
6008 my ($user) = $self->getSimpleListData($slWidget, 0);
6009 if (defined $user) {
6010  
6011 # Remove this user command
6012 $self->session->pseudoCmd(
6013 'deleteusercommand ' . $user,
6014 $self->pseudoCmdMode,
6015 );
6016  
6017 # Refresh the simple list
6018 $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2));
6019 $self->resetEntryBoxes($entry);
6020 }
6021 });
6022  
6023 my $button3 = $self->addButton(
6024 $grid,
6025 'Reset user commands',
6026 'Reset the list of user commands to the default list',
6027 undef,
6028 7, 10, 11, 12);
6029 $button3->signal_connect('clicked' => sub {
6030  
6031 $self->session->pseudoCmd('resetusercommand', $self->pseudoCmdMode);
6032  
6033 # Refresh the simple list
6034 $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2));
6035 });
6036  
6037 my $button4 = $self->addButton($grid,
6038 'Dump', 'Display the list of user commands in the \'main\' window', undef,
6039 10, 12, 11, 12);
6040 $button4->signal_connect('clicked' => sub {
6041  
6042 $self->session->pseudoCmd('listusercommand', $self->pseudoCmdMode);
6043 });
6044  
6045 # Tab complete
6046 return 1;
6047 }
6048  
6049 sub commands4Tab_refreshList {
6050  
6051 # Called by $self->commands4Tab to refresh the GA::Obj::SimpleList
6052 #
6053 # Expected arguments
6054 # $slWidget - The GA::Obj::SimpleList
6055 # $columns - The number of columns in the list
6056 #
6057 # Return values
6058 # 'undef' on improper arguments
6059 # 1 otherwise
6060  
6061 my ($self, $slWidget, $columns, $check) = @_;
6062  
6063 # Local variables
6064 my (
6065 @sortedList, @dataList,
6066 %hash,
6067 );
6068  
6069 # Check for improper arguments
6070 if (! defined $slWidget || ! defined $columns || defined $check) {
6071  
6072 return $axmud::CLIENT->writeImproper(
6073 $self->_objClass . '->commands4Tab_refreshList',
6074 @_,
6075 );
6076 }
6077  
6078 # Import the hash of user commands (for quick lookup)
6079 %hash = $axmud::CLIENT->userCmdHash;
6080 @sortedList = sort {lc($a) cmp lc($b)} (keys %hash);
6081  
6082 # Compile the simple list data
6083 foreach my $cmd (@sortedList) {
6084  
6085 push (@dataList, $cmd, $hash{$cmd});
6086 }
6087  
6088 # Reset the simple list
6089 $self->resetListData($slWidget, [@dataList], $columns);
6090  
6091 return 1;
6092 }
6093  
6094 sub commands5Tab {
6095  
6096 # Commands5 tab
6097 #
6098 # Expected arguments
6099 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6100 #
6101 # Return values
6102 # 'undef' on improper arguments
6103 # 1 otherwise
6104  
6105 my ($self, $innerNotebook, $check) = @_;
6106  
6107 # Local variables
6108 my (
6109 @columnList, @sortedList, @dataList,
6110 %hash,
6111 );
6112  
6113 # Check for improper arguments
6114 if (! defined $innerNotebook || defined $check) {
6115  
6116 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands5Tab', @_);
6117 }
6118  
6119 # Tab setup
6120 my $grid = $self->addTab('Page _5', $innerNotebook);
6121  
6122 # Default user commands
6123 $self->addLabel($grid, '<b>Default user commands</b>',
6124 0, 12, 0, 1);
6125 $self->addLabel($grid,
6126 '<i>Default list of alternate forms for standard client commands</i>',
6127 1, 12, 1, 2);
6128  
6129 # Add a simple list
6130 @columnList = (
6131 'User command', 'text',
6132 'Standard client command', 'text',
6133 );
6134  
6135 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
6136 1, 12, 2, 10);
6137  
6138 # Initialise the list
6139 %hash = $axmud::CLIENT->constUserCmdHash;
6140 @sortedList = sort {$a cmp $b} (keys %hash);
6141 foreach my $cmd (@sortedList) {
6142  
6143 push (@dataList, $cmd, $hash{$cmd});
6144 }
6145  
6146 $self->resetListData($slWidget, [@dataList], scalar (@columnList / 2));
6147  
6148 # Add a button
6149 my $button = $self->addButton($grid,
6150 'Dump', 'Display the default list of user commands in the \'main\' window', undef,
6151 10, 12, 11, 12);
6152 $button->signal_connect('clicked' => sub {
6153  
6154 $self->session->pseudoCmd('listusercommand -d', $self->pseudoCmdMode);
6155 });
6156  
6157 # Tab complete
6158 return 1;
6159 }
6160  
6161 sub commands6Tab {
6162  
6163 # Commands6 tab
6164 #
6165 # Expected arguments
6166 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6167 #
6168 # Return values
6169 # 'undef' on improper arguments
6170 # 1 otherwise
6171  
6172 my ($self, $innerNotebook, $check) = @_;
6173  
6174  
6175 # Check for improper arguments
6176 if (! defined $innerNotebook || defined $check) {
6177  
6178 return $axmud::CLIENT->writeImproper($self->_objClass . '->commands6Tab', @_);
6179 }
6180  
6181 # Tab setup
6182 my $grid = $self->addTab('Page _6', $innerNotebook);
6183  
6184 # Client buffer settings
6185 $self->addLabel($grid, '<b>Client buffer settings</b>',
6186 0, 12, 0, 1);
6187  
6188 # Left column - instruction buffer
6189 $self->addLabel($grid, '<i>Instruction buffer</i>',
6190 1, 12, 1, 2);
6191  
6192 $self->addLabel($grid, 'Max size',
6193 1, 3, 2, 3);
6194 my $entry = $self->addEntry($grid, undef, FALSE,
6195 3, 6, 2, 3);
6196  
6197 $self->addLabel($grid, 'Current size',
6198 1, 3, 3, 4);
6199 my $entry2 = $self->addEntry($grid, undef, FALSE,
6200 3, 6, 3, 4);
6201  
6202 $self->addLabel($grid, 'Total items processed',
6203 1, 3, 4, 5);
6204 my $entry3 = $self->addEntry($grid, undef, FALSE,
6205 3, 6, 4, 5);
6206  
6207 $self->addLabel($grid, 'Item number',
6208 1, 3, 5, 6);
6209 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
6210 3, 6, 5, 6);
6211  
6212 # Right column - instruction buffer
6213 my $button = $self->addButton($grid,
6214 'Update', 'Update the displayed data', undef,
6215 9, 12, 0, 1);
6216  
6217 $self->addLabel($grid, 'First item #',
6218 7, 9, 2, 3);
6219 my $entry5 = $self->addEntry($grid, undef, FALSE,
6220 9, 12, 2, 3);
6221  
6222 $self->addLabel($grid, 'Last item #',
6223 7, 9, 3, 4);
6224 my $entry6 = $self->addEntry($grid, undef, FALSE,
6225 9, 12, 3, 4);
6226  
6227 my $button2 = $self->addButton($grid,
6228 'View', 'View the specified buffer item', undef,
6229 7, 8, 5, 6);
6230  
6231 my $button3 = $self->addButton($grid,
6232 'Dump', 'Display the specified buffer item in the \'main\' window', undef,
6233 8, 9, 5, 6);
6234  
6235 my $button4 = $self->addButton($grid,
6236 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef,
6237 9, 11, 5, 6);
6238  
6239 my $button5 = $self->addButton($grid,
6240 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef,
6241 11, 12, 5, 6);
6242  
6243 # Left column - world command buffer
6244 $self->addLabel($grid, '<i>World command buffer</i>',
6245 1, 12, 6, 7);
6246  
6247 $self->addLabel($grid, 'Max size',
6248 1, 3, 7, 8);
6249 my $entry8 = $self->addEntry($grid, undef, FALSE,
6250 3, 6, 7, 8);
6251  
6252 $self->addLabel($grid, 'Current size',
6253 1, 3, 8, 9);
6254 my $entry9 = $self->addEntry($grid, undef, FALSE,
6255 3, 6, 8, 9);
6256  
6257 $self->addLabel($grid, 'Total items processed',
6258 1, 3, 9, 10);
6259 my $entry10 = $self->addEntry($grid, undef, FALSE,
6260 3, 6, 9, 10);
6261  
6262 $self->addLabel($grid, 'Item number',
6263 1, 3, 10, 11);
6264 my $entry11 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
6265 3, 6, 10, 11);
6266  
6267 # Right column - world command buffer
6268 $self->addLabel($grid, 'First item #',
6269 7, 9, 7, 8);
6270 my $entry12 = $self->addEntry($grid, undef, FALSE,
6271 9, 12, 7, 8);
6272  
6273 $self->addLabel($grid, 'Last item #',
6274 7, 9, 8, 9);
6275 my $entry13 = $self->addEntry($grid, undef, FALSE,
6276 9, 12, 8, 9);
6277  
6278 my $button6 = $self->addButton($grid,
6279 'View', 'View the specified buffer item', undef,
6280 7, 8, 10, 11);
6281  
6282 my $button7 = $self->addButton($grid,
6283 'Dump', 'Display the specified buffer item in the \'main\' window', undef,
6284 8, 9, 10, 11);
6285  
6286 my $button8 = $self->addButton($grid,
6287 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef,
6288 9, 11, 10, 11);
6289  
6290 my $button9 = $self->addButton($grid,
6291 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef,
6292 11, 12, 10, 11);
6293  
6294 # ->signal_connects
6295  
6296 # 'Update'
6297 $button->signal_connect('clicked' => sub {
6298  
6299 # Instruction buffer
6300 $entry->set_text($axmud::CLIENT->customInstructBufferSize);
6301 $entry2->set_text($axmud::CLIENT->ivPairs('instructBufferHash'));
6302 $entry3->set_text($axmud::CLIENT->instructBufferCount);
6303  
6304 if (defined $axmud::CLIENT->instructBufferFirst) {
6305  
6306 $entry5->set_text($axmud::CLIENT->instructBufferFirst);
6307 }
6308  
6309 if (defined $axmud::CLIENT->instructBufferLast) {
6310  
6311 $entry6->set_text($axmud::CLIENT->instructBufferLast);
6312 }
6313  
6314 # World command buffer
6315 $entry8->set_text($axmud::CLIENT->customCmdBufferSize);
6316 $entry9->set_text($axmud::CLIENT->ivPairs('cmdBufferHash'));
6317 $entry10->set_text($axmud::CLIENT->cmdBufferCount);
6318  
6319 if (defined $axmud::CLIENT->cmdBufferFirst) {
6320  
6321 $entry12->set_text($axmud::CLIENT->cmdBufferFirst);
6322 }
6323  
6324 if (defined $axmud::CLIENT->cmdBufferLast) {
6325  
6326 $entry13->set_text($axmud::CLIENT->cmdBufferLast);
6327 }
6328 });
6329  
6330 # 'View'
6331 $button2->signal_connect('clicked' => sub {
6332  
6333 my $number = $entry4->get_text();
6334  
6335 if ($self->checkEntryIcon($entry4)) {
6336  
6337 # Open an 'edit' window for the specified buffer item
6338 $self->session->pseudoCmd(
6339 'editinstructionbuffer -c ' . $number,
6340 $self->pseudoCmdMode,
6341 );
6342 }
6343 });
6344  
6345 # 'Dump'
6346 $button3->signal_connect('clicked' => sub {
6347  
6348 my $number = $entry4->get_text();
6349  
6350 if ($self->checkEntryIcon($entry4)) {
6351  
6352 # Display the specified buffer item
6353 $self->session->pseudoCmd(
6354 'dumpinstructionbuffer -c ' . $number,
6355 $self->pseudoCmdMode,
6356 );
6357 }
6358 });
6359  
6360 # 'Dump last'
6361 $button4->signal_connect('clicked' => sub {
6362  
6363 # Display most recent buffer item
6364 $self->session->pseudoCmd('dumpinstructionbuffer -c', $self->pseudoCmdMode);
6365 # Show the number of the most recent buffer item
6366 if (defined $axmud::CLIENT->instructBufferLast) {
6367  
6368 $entry4->set_text($axmud::CLIENT->instructBufferLast);
6369 }
6370 });
6371  
6372 # 'Dump 20'
6373 $button5->signal_connect('clicked' => sub {
6374  
6375 my ($start, $stop);
6376  
6377 $stop = $axmud::CLIENT->instructBufferLast;
6378 $start = $stop - 19;
6379 if ($start < 0) {
6380  
6381 $start = 0;
6382 }
6383  
6384 # Display most recent buffer items
6385 $self->session->pseudoCmd(
6386 'dumpinstructionbuffer -c ' . $start . ' ' . $stop,
6387 $self->pseudoCmdMode,
6388 );
6389 });
6390  
6391 # 'View'
6392 $button6->signal_connect('clicked' => sub {
6393  
6394 my $number = $entry11->get_text();
6395  
6396 if ($self->checkEntryIcon($entry11)) {
6397  
6398 # Open an 'edit' window for the specified buffer item
6399 $self->session->pseudoCmd('editcommandbuffer -c ' . $number, $self->pseudoCmdMode);
6400 }
6401 });
6402  
6403 # 'Dump'
6404 $button7->signal_connect('clicked' => sub {
6405  
6406 my $number = $entry11->get_text();
6407  
6408 if ($self->checkEntryIcon($entry11)) {
6409  
6410 # Display the specified buffer item
6411 $self->session->pseudoCmd('dumpcommandbuffer -c ' . $number, $self->pseudoCmdMode);
6412 }
6413 });
6414  
6415 # 'Dump last'
6416 $button8->signal_connect('clicked' => sub {
6417  
6418 # Display most recent buffer item
6419 $self->session->pseudoCmd('dumpcommandbuffer -c', $self->pseudoCmdMode);
6420 # Show the number of the most recent buffer item
6421 if (defined $axmud::CLIENT->cmdBufferLast) {
6422  
6423 $entry11->set_text($axmud::CLIENT->cmdBufferLast);
6424 }
6425 });
6426  
6427 # 'Dump 20'
6428 $button9->signal_connect('clicked' => sub {
6429  
6430 my ($start, $stop);
6431  
6432 $stop = $axmud::CLIENT->cmdBufferLast;
6433 $start = $stop - 19;
6434 if ($start < 0) {
6435  
6436 $start = 0;
6437 }
6438  
6439 # Display most recent buffer items
6440 $self->session->pseudoCmd(
6441 'dumpcommandbuffer ' . $start . ' ' . $stop,
6442 $self->pseudoCmdMode,
6443 );
6444 });
6445  
6446 # Pseudo-click the button to set all the widgets
6447 $button->clicked();
6448  
6449 # Tab complete
6450 return 1;
6451 }
6452  
6453 sub logsTab {
6454  
6455 # Logs tab - called by $self->setupNotebook
6456 #
6457 # Expected arguments
6458 # (none besides $self)
6459 #
6460 # Return values
6461 # 'undef' on improper arguments
6462 # 1 otherwise
6463  
6464 my ($self, $check) = @_;
6465  
6466 # Check for improper arguments
6467 if (defined $check) {
6468  
6469 return $axmud::CLIENT->writeImproper($self->_objClass . '->logsTab', @_);
6470 }
6471  
6472 # Tab setup
6473 # Create a notebook within the main one, so that we have two rows of tabs
6474 my $innerNotebook = $self->addInnerNotebookTab('_Logs', $self->notebook);
6475  
6476 # Add tabs to the inner notebook
6477 $self->logs1Tab($innerNotebook);
6478 $self->logs2Tab($innerNotebook);
6479 $self->logs3Tab($innerNotebook);
6480 $self->logs4Tab($innerNotebook);
6481  
6482 return 1;
6483 }
6484  
6485 sub logs1Tab {
6486  
6487 # Logs1 tab
6488 #
6489 # Expected arguments
6490 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6491 #
6492 # Return values
6493 # 'undef' on improper arguments
6494 # 1 otherwise
6495  
6496 my ($self, $innerNotebook, $check) = @_;
6497  
6498 # Check for improper arguments
6499 if (! defined $innerNotebook || defined $check) {
6500  
6501 return $axmud::CLIENT->writeImproper($self->_objClass . '->logs1Tab', @_);
6502 }
6503  
6504 # Tab setup
6505 my $grid = $self->addTab('Page _1', $innerNotebook);
6506  
6507 # Log settings
6508 $self->addLabel($grid, '<b>Log settings</b>',
6509 0, 12, 0, 1);
6510  
6511 my $checkButton = $self->addCheckButton($grid,'Enable logging in general', undef, TRUE,
6512 1, 12, 1, 2);
6513 $checkButton->set_active($axmud::CLIENT->allowLogsFlag);
6514 $checkButton->signal_connect('toggled' => sub {
6515  
6516 $self->session->pseudoCmd('log -l', $self->pseudoCmdMode);
6517 $checkButton->set_active($axmud::CLIENT->allowLogsFlag);
6518 });
6519  
6520 my $checkButton2 = $self->addCheckButton(
6521 $grid,
6522 'Enable deletion of standard logfiles (written by every session) when the'
6523 . ' client starts',
6524 undef,
6525 TRUE,
6526 1, 12, 2, 3);
6527 $checkButton2->set_active($axmud::CLIENT->deleteStandardLogsFlag);
6528 $checkButton2->signal_connect('toggled' => sub {
6529  
6530 $self->session->pseudoCmd('log -d', $self->pseudoCmdMode);
6531 $checkButton2->set_active($axmud::CLIENT->deleteStandardLogsFlag);
6532 });
6533  
6534 my $checkButton3 = $self->addCheckButton(
6535 $grid,
6536 'Enable deletion of world logfiles (written by every session) when a session'
6537 . ' starts',
6538 undef,
6539 TRUE,
6540 1, 12, 3, 4);
6541 $checkButton3->set_active($axmud::CLIENT->deleteWorldLogsFlag);
6542 $checkButton3->signal_connect('toggled' => sub {
6543  
6544 $self->session->pseudoCmd('log -w', $self->pseudoCmdMode);
6545 $checkButton3->set_active($axmud::CLIENT->deleteWorldLogsFlag);
6546 });
6547  
6548 my $checkButton4 = $self->addCheckButton(
6549 $grid, 'Enable creation of new logfiles when the client starts', undef, TRUE,
6550 1, 12, 4, 5);
6551 $checkButton4->set_active($axmud::CLIENT->logClientFlag);
6552 $checkButton4->signal_connect('toggled' => sub {
6553  
6554 $self->session->pseudoCmd('log -s', $self->pseudoCmdMode);
6555 $checkButton4->set_active($axmud::CLIENT->logClientFlag);
6556 });
6557  
6558 my $checkButton5 = $self->addCheckButton(
6559 $grid, 'Enable creation of new logfiles at the start of every day', undef, TRUE,
6560 1, 12, 5, 6);
6561 $checkButton5->set_active($axmud::CLIENT->logDayFlag);
6562 $checkButton5->signal_connect('toggled' => sub {
6563  
6564 $self->session->pseudoCmd('log -y', $self->pseudoCmdMode);
6565 $checkButton5->set_active($axmud::CLIENT->logDayFlag);
6566 });
6567  
6568 my $checkButton6 = $self->addCheckButton(
6569 $grid, 'Lines in logfiles are prefixed by the current date', undef, TRUE,
6570 1, 12, 6, 7);
6571 $checkButton6->set_active($axmud::CLIENT->logPrefixDateFlag);
6572 $checkButton6->signal_connect('toggled' => sub {
6573  
6574 $self->session->pseudoCmd('log -a', $self->pseudoCmdMode);
6575 $checkButton6->set_active($axmud::CLIENT->logPrefixDateFlag);
6576 });
6577  
6578 my $checkButton7 = $self->addCheckButton(
6579 $grid, 'Lines in logfiles are prefixed by the current time', undef, TRUE,
6580 1, 12, 7, 8);
6581 $checkButton7->set_active($axmud::CLIENT->logPrefixTimeFlag);
6582 $checkButton7->signal_connect('toggled' => sub {
6583  
6584 $self->session->pseudoCmd('log -t', $self->pseudoCmdMode);
6585 $checkButton7->set_active($axmud::CLIENT->logPrefixTimeFlag);
6586 });
6587  
6588 my $checkButton8 = $self->addCheckButton(
6589 $grid, 'Logfiles record image filenames', undef, TRUE,
6590 1, 12, 8, 9);
6591 $checkButton8->set_active($axmud::CLIENT->logImageFlag);
6592 $checkButton8->signal_connect('toggled' => sub {
6593  
6594 $self->session->pseudoCmd('log -i', $self->pseudoCmdMode);
6595 $checkButton8->set_active($axmud::CLIENT->logImageFlag);
6596 });
6597  
6598 # Tab complete
6599 return 1;
6600 }
6601  
6602 sub logs2Tab {
6603  
6604 # Logs2 tab
6605 #
6606 # Expected arguments
6607 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6608 #
6609 # Return values
6610 # 'undef' on improper arguments
6611 # 1 otherwise
6612  
6613 my ($self, $innerNotebook, $check) = @_;
6614  
6615 # Check for improper arguments
6616 if (! defined $innerNotebook || defined $check) {
6617  
6618 return $axmud::CLIENT->writeImproper($self->_objClass . '->logs2Tab', @_);
6619 }
6620  
6621 # Tab setup
6622 my $grid = $self->addTab('Page _2', $innerNotebook);
6623  
6624 # Logfile preamble
6625 $self->addLabel($grid, '<b>Logfile preamble</b>',
6626 0, 12, 0, 1);
6627 $self->addLabel($grid, '<i>Text to add to the beginning of every logfile</i>',
6628 1, 12, 1, 2);
6629  
6630 my $textView = $self->addTextView($grid, undef, TRUE,
6631 1, 12, 2, 10);
6632 my $buffer = $textView->get_buffer();
6633 $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));
6634  
6635 my $button = $self->addButton(
6636 $grid, 'Set list', 'Set the logfile preamble', undef,
6637 1, 4, 10, 11);
6638 $button->signal_connect('clicked' => sub {
6639  
6640 my (
6641 $text,
6642 @list,
6643 );
6644  
6645 $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
6646  
6647 # Split the contents of the textview into a list, and set the IV
6648 $axmud::CLIENT->set_logPreamble(split("\n", $text));
6649  
6650 # Update the textview
6651 $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));
6652 });
6653  
6654 my $button2 = $self->addButton(
6655 $grid, 'Reset list', 'Resets the logfile preamble', undef,
6656 9, 12, 10, 11);
6657 $button2->signal_connect('clicked' => sub {
6658  
6659 # Update the textview
6660 $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));
6661 });
6662  
6663 # Tab complete
6664 return 1;
6665 }
6666  
6667 sub logs3Tab {
6668  
6669 # Logs3 tab
6670 #
6671 # Expected arguments
6672 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6673 #
6674 # Return values
6675 # 'undef' on improper arguments
6676 # 1 otherwise
6677  
6678 my ($self, $innerNotebook, $check) = @_;
6679  
6680 # Check for improper arguments
6681 if (! defined $innerNotebook || defined $check) {
6682  
6683 return $axmud::CLIENT->writeImproper($self->_objClass . '->logs3Tab', @_);
6684 }
6685  
6686 # Tab setup
6687 my $grid = $self->addTab('Page _3', $innerNotebook);
6688  
6689 # Status task events
6690 $self->addLabel($grid, '<b>Status task events</b>',
6691 0, 12, 0, 1);
6692 $self->addLabel(
6693 $grid,
6694 '<i>Number of logfile lines to write before/after a change in the character\'s life'
6695 . ' status</i>',
6696 1, 12, 1, 2);
6697  
6698 $self->addLabel($grid, 'Lines to write before an event (0-999)',
6699 1, 6, 2, 3);
6700  
6701 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, 999,
6702 6, 10, 2, 3);
6703 $entry->set_text($axmud::CLIENT->statusEventBeforeCount);
6704  
6705 my $button = $self->addButton(
6706 $grid,
6707 'Set',
6708 'Set the number of lines to write before a change in life status',
6709 undef,
6710 10, 12, 2, 3);
6711 $button->signal_connect('clicked' => sub {
6712  
6713 my $number = $entry->get_text();
6714  
6715 if ($self->checkEntryIcon($entry)) {
6716  
6717 $self->session->pseudoCmd('setstatusevent -b ' . $number, $self->pseudoCmdMode);
6718 }
6719 });
6720  
6721 $self->addLabel($grid, 'Lines to write after an event (0-999)',
6722 1, 6, 3, 4);
6723  
6724 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 999,
6725 6, 10, 3, 4);
6726 $entry2->set_text($axmud::CLIENT->statusEventAfterCount);
6727  
6728 my $button2 = $self->addButton(
6729 $grid,
6730 'Set',
6731 'Set the number of lines to write after a change in life status',
6732 undef,
6733 10, 12, 3, 4);
6734 $button2->signal_connect('clicked' => sub {
6735  
6736 my $number = $entry2->get_text();
6737  
6738 if ($self->checkEntryIcon($entry2)) {
6739  
6740 $self->session->pseudoCmd('setstatusevent -a ' . $number, $self->pseudoCmdMode);
6741 }
6742 });
6743  
6744 # Tab complete
6745 return 1;
6746 }
6747  
6748 sub logs4Tab {
6749  
6750 # Logs4 tab
6751 #
6752 # Expected arguments
6753 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6754 #
6755 # Return values
6756 # 'undef' on improper arguments
6757 # 1 otherwise
6758  
6759 my ($self, $innerNotebook, $check) = @_;
6760  
6761 # Local variables
6762 my (@columnList, @comboList);
6763  
6764 # Check for improper arguments
6765 if (! defined $innerNotebook || defined $check) {
6766  
6767 return $axmud::CLIENT->writeImproper($self->_objClass . '->logs4Tab', @_);
6768 }
6769  
6770 # Tab setup
6771 my $grid = $self->addTab('Page _4', $innerNotebook);
6772  
6773 # Client logging settings
6774 $self->addLabel($grid, '<b>Client logging settings</b>',
6775 0, 12, 0, 1);
6776 $self->addLabel($grid,
6777 '<i>List of logfiles written by every session</i>',
6778 1, 12, 1, 2);
6779  
6780 # Add a simple list
6781 @columnList = (
6782 'Logfile', 'text',
6783 'Write?', 'bool',
6784 'Description', 'text',
6785 );
6786  
6787 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
6788 1, 12, 2, 10);
6789  
6790 # Initialise the list
6791 $self->logs4Tab_refreshList($slWidget, (scalar @columnList / 2));
6792  
6793 # Add a two combos and a button
6794 @comboList = $axmud::CLIENT->constLogOrderList;
6795 my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
6796 TRUE, # No 'undef' value used
6797 1, 4, 10, 11);
6798  
6799 my $button = $self->addButton($grid,
6800 'Toggle', 'Change the setting for the selected logfile', undef,
6801 4, 6, 10, 11);
6802 $button->signal_connect('clicked' => sub {
6803  
6804 my $logfile = $comboBox->get_active_text();
6805  
6806 # Update the IV
6807 $self->session->pseudoCmd('log ' . $logfile, $self->pseudoCmdMode);
6808  
6809 # Refresh the simple list
6810 $self->logs4Tab_refreshList($slWidget, (scalar @columnList / 2));
6811 });
6812  
6813 # Tab complete
6814 return 1;
6815 }
6816  
6817 sub logs4Tab_refreshList {
6818  
6819 # Resets the simple list displayed by $self->logs4Tab
6820 #
6821 # Expected arguments
6822 # $slWidget - The GA::Obj::SimpleList
6823 # $columns - The number of columns
6824 #
6825 # Return values
6826 # 'undef' on improper arguments
6827 # 1 otherwise
6828  
6829 my ($self, $slWidget, $columns, $check) = @_;
6830  
6831 # Local variables
6832 my (
6833 $hashRef,
6834 @dataList,
6835 %hash,
6836 );
6837  
6838 # Check for improper arguments
6839 if (! defined $slWidget || ! defined $columns || defined $check) {
6840  
6841 return $axmud::CLIENT->writeImproper($self->_objClass . '->logs4Tab_refreshList', @_);
6842 }
6843  
6844 # Compile the simple list data
6845 foreach my $logfile ($axmud::CLIENT->constLogOrderList) {
6846  
6847 push (@dataList,
6848 $logfile,
6849 $axmud::CLIENT->ivShow('logPrefHash', $logfile),
6850 $axmud::CLIENT->ivShow('constLogDescripHash', $logfile),
6851 );
6852 }
6853  
6854 # Reset the simple list
6855 $self->resetListData($slWidget, [@dataList], $columns);
6856  
6857 return 1;
6858 }
6859  
6860 sub coloursTab {
6861  
6862 # Colours tab - called by $self->setupNotebook
6863 #
6864 # Expected arguments
6865 # (none besides $self)
6866 #
6867 # Return values
6868 # 'undef' on improper arguments
6869 # 1 otherwise
6870  
6871 my ($self, $check) = @_;
6872  
6873 # Check for improper arguments
6874 if (defined $check) {
6875  
6876 return $axmud::CLIENT->writeImproper($self->_objClass . '->coloursTab', @_);
6877 }
6878  
6879 # Tab setup
6880 # Create a notebook within the main one, so that we have two rows of tabs
6881 my $innerNotebook = $self->addInnerNotebookTab('C_olours', $self->notebook);
6882  
6883 # Add tabs to the inner notebook
6884 $self->colours1Tab($innerNotebook);
6885 $self->colours2Tab($innerNotebook);
6886 $self->colours3Tab($innerNotebook);
6887 $self->colours4Tab($innerNotebook);
6888 $self->colours5Tab($innerNotebook);
6889  
6890 return 1;
6891 }
6892  
6893 sub colours1Tab {
6894  
6895 # Colours1 tab
6896 #
6897 # Expected arguments
6898 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
6899 #
6900 # Return values
6901 # 'undef' on improper arguments
6902 # 1 otherwise
6903  
6904 my ($self, $innerNotebook, $check) = @_;
6905  
6906 # Local variables
6907 my @tagList;
6908  
6909 # Check for improper arguments
6910 if (! defined $innerNotebook || defined $check) {
6911  
6912 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab', @_);
6913 }
6914  
6915 # Tab setup
6916 my $grid = $self->addTab('Page _1', $innerNotebook);
6917  
6918 # Axmud colour tags settings
6919 $self->addLabel($grid, '<b>' . $axmud::SCRIPT . ' standard (normal) colour tags</b>',
6920 0, 8, 0, 1);
6921  
6922 # Import IV from the GA::Client
6923 @tagList = $axmud::CLIENT->constColourTagList;
6924  
6925 for (my $row = 1; $row <= 8; $row++) {
6926  
6927 $self->colours1Tab_addRow(
6928 $grid,
6929 $row,
6930 'colourTagHash',
6931 'constColourTagHash',
6932 shift @tagList,
6933 );
6934 }
6935  
6936 # Tab complete
6937 return 1;
6938 }
6939  
6940 sub colours1Tab_addRow {
6941  
6942 # Called by $self->colours1Tab and ->colours2Tab
6943 # Adds a single row of labels, entry boxes and buttons to allow configuration of a single
6944 # colour tag
6945 #
6946 # Expected arguments
6947 # $grid - The Gtk3::Grid for this tab
6948 # $row - The number of the row in the Gtk3::Grid displayed in this tab
6949 # $iv - The IV used, e.g. 'colourTagHash'
6950 # $defaultIV - The default colour used to set this IV, e.g. 'constColourTagHash'
6951 # $tag - The Axmud colour tag to edit, e.g. 'red'
6952 #
6953 # Return values
6954 # 'undef' on improper arguments
6955 # 1 otherwise
6956  
6957 my ($self, $grid, $row, $iv, $defaultIV, $tag, $check) = @_;
6958  
6959 # Local variables
6960 my ($rgbColour, $rgbDefault);
6961  
6962 # Check for improper arguments
6963 if (
6964 ! defined $grid || ! defined $row || ! defined $iv || ! defined $defaultIV
6965 || ! defined $tag || defined $check
6966 ) {
6967 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab_addRow', @_);
6968 }
6969  
6970 # Initialise vars
6971 $rgbColour = $axmud::CLIENT->ivShow($iv, $tag);
6972 $rgbDefault = $axmud::CLIENT->ivShow($defaultIV, $tag);
6973  
6974 # Colour
6975 $self->addLabel($grid, $tag,
6976 1, 3, $row, ($row + 1));
6977  
6978 my ($frame, $canvas, $canvasObj) = $self->addSimpleCanvas($grid, $rgbColour, undef,
6979 3, 4, $row, ($row + 1));
6980  
6981 my $entry = $self->addEntry($grid, undef, FALSE,
6982 4, 6, $row, ($row + 1), 7, 7);
6983 $entry->set_text($axmud::CLIENT->ivShow($iv, $tag));
6984  
6985 my $button = $self->addButton($grid, 'Change', 'Change this colour', undef,
6986 6, 7, $row, ($row + 1));
6987 $button->signal_connect('clicked' => sub {
6988  
6989 # Prompt the user to select a new colour, using the existing colour as an initial value
6990 my $rgbModify = $self->showColourSelectionDialogue(
6991 'Set \'' . $tag . '\' tag',
6992 $rgbColour,
6993 );
6994  
6995 if ($rgbModify) {
6996  
6997 $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $rgbModify);
6998 $entry->set_text($rgbModify);
6999 $rgbColour = $rgbModify;
7000  
7001 # Modify the stored colour tag immediately
7002 $self->session->pseudoCmd(
7003 'setcolour ' . $tag . ' ' . $rgbModify,
7004 $self->pseudoCmdMode,
7005 );
7006 }
7007 });
7008  
7009 # Default colour
7010 my $button2 = $self->addButton($grid, 'Use default:', 'Use the default colour', undef,
7011 8, 9, $row, ($row + 1));
7012 $button2->signal_connect('clicked' => sub {
7013  
7014 $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $rgbDefault);
7015 $entry->set_text($rgbDefault);
7016  
7017 # Modify the stored colour tag immediately
7018 $self->session->pseudoCmd(
7019 'setcolour ' . $tag . ' ' . $rgbDefault,
7020 $self->pseudoCmdMode,
7021 );
7022 });
7023  
7024 $self->addSimpleCanvas($grid, $rgbDefault, undef,
7025 9, 10, $row, ($row + 1));
7026  
7027 my $entry2 = $self->addEntry($grid, undef, FALSE,
7028 10, 12, $row, ($row + 1), 7, 7);
7029 $entry2->set_text($axmud::CLIENT->ivShow($defaultIV, $tag));
7030  
7031 return 1;
7032 }
7033  
7034 sub colours1Tab_applyAll {
7035  
7036 # Called by $self->colours1Tab and ->colours2Tab
7037 # Re-applies any colour scheme that uses a standard colour tag (e.g. 'red' instead of
7038 # '#FF0000')
7039 #
7040 # Expected arguments
7041 # (none besides $self)
7042 #
7043 # Return values
7044 # 'undef' on improper arguments
7045 # 1 otherwise
7046  
7047 my ($self, $check) = @_;
7048  
7049 # Local variables
7050 my %hash;
7051  
7052 # Check for improper arguments
7053 if (defined $check) {
7054  
7055 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab_applyAll', @_);
7056 }
7057  
7058 # Compile a hash of colour scheme objects that use Axmud standard colour tags
7059 foreach my $obj (
7060 sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('colourSchemeHash'))
7061 ) {
7062 my ($type, $textFlag, $underlayFlag, $backgroundFlag);
7063  
7064 # (The flags are set to TRUE if the argument is an underlay tag, FALSE if not)
7065 ($type, $textFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);
7066 ($type, $underlayFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);
7067 ($type, $backgroundFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);
7068  
7069 if (! $textFlag || $underlayFlag || ! $backgroundFlag) {
7070  
7071 $hash{$obj->name} = undef;
7072 }
7073 }
7074  
7075 if (%hash) {
7076  
7077 # Update every 'internal' window
7078 foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
7079  
7080 foreach my $name (keys %hash) {
7081  
7082 $winObj->updateColourScheme($name);
7083 }
7084 }
7085 }
7086  
7087 return 1;
7088 }
7089  
7090 sub colours2Tab {
7091  
7092 # Colours2 tab
7093 #
7094 # Expected arguments
7095 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
7096 #
7097 # Return values
7098 # 'undef' on improper arguments
7099 # 1 otherwise
7100  
7101 my ($self, $innerNotebook, $check) = @_;
7102  
7103 # Local variables
7104 my @tagList;
7105  
7106 # Check for improper arguments
7107 if (! defined $innerNotebook || defined $check) {
7108  
7109 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours2Tab', @_);
7110 }
7111  
7112 # Tab setup
7113 my $grid = $self->addTab('Page _2', $innerNotebook);
7114  
7115 # Axmud bold colour tags settings
7116 $self->addLabel($grid, '<b>' . $axmud::SCRIPT . ' standard (bold) colour tags</b>',
7117 0, 8, 0, 1);
7118  
7119 # Import IV from the GA::Client
7120 @tagList = $axmud::CLIENT->constBoldColourTagList;
7121  
7122 for (my $row = 1; $row <= 8; $row++) {
7123  
7124 $self->colours1Tab_addRow(
7125 $grid,
7126 $row,
7127 'boldColourTagHash',
7128 'constBoldColourTagHash',
7129 shift @tagList,
7130 );
7131 }
7132  
7133 # Tab complete
7134 return 1;
7135 }
7136  
7137 sub colours3Tab {
7138  
7139 # Colours3 tab
7140 #
7141 # Expected arguments
7142 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
7143 #
7144 # Return values
7145 # 'undef' on improper arguments
7146 # 1 otherwise
7147  
7148 my ($self, $innerNotebook, $check) = @_;
7149  
7150 # Local variables
7151 my @columnList;
7152  
7153 # Check for improper arguments
7154 if (! defined $innerNotebook || defined $check) {
7155  
7156 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours3Tab', @_);
7157 }
7158  
7159 # Tab setup
7160 my $grid = $self->addTab('Page _3', $innerNotebook);
7161  
7162 # xterm-256 colours
7163 $self->addLabel($grid, '<b>xterm-256 colours</b>',
7164 0, 12, 0, 1);
7165 $self->addLabel($grid, 'Current colour cube:',
7166 1, 4, 1, 2);
7167 my $entry = $self->addEntry($grid, undef, FALSE,
7168 4, 8, 1, 2);
7169 $entry->set_text($axmud::CLIENT->currentColourCube);
7170  
7171 my $button = $self->addButton(
7172 $grid,
7173 'Switch cube',
7174 'Switch between xterm and netscape colour cubes', undef,
7175 8, 12, 1, 2);
7176 # ->signal_connect appears below
7177  
7178 # Add a simple list
7179 @columnList = (
7180 'xterm tag', 'text',
7181 'colour', 'text',
7182 );
7183  
7184 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
7185 1, 12, 2, 12);
7186  
7187 # Initialise the list
7188 $self->colours3Tab_refreshList($slWidget, scalar (@columnList / 2));
7189  
7190 # ->signal_connect from above
7191 $button->signal_connect('clicked' => sub {
7192  
7193 if ($axmud::CLIENT->currentColourCube eq 'xterm') {
7194 $self->session->pseudoCmd('setxterm -n', $self->pseudoCmdMode);
7195 } elsif ($axmud::CLIENT->currentColourCube eq 'netscape') {
7196 $self->session->pseudoCmd('setxterm -x', $self->pseudoCmdMode);
7197 }
7198  
7199 # Update widgets
7200 $entry->set_text($axmud::CLIENT->currentColourCube);
7201 $self->colours3Tab_refreshList($slWidget, scalar (@columnList / 2));
7202 });
7203  
7204 # Tab complete
7205 return 1;
7206 }
7207  
7208 sub colours3Tab_refreshList {
7209  
7210 # Called by $self->colours3Tab to refresh the GA::Obj::SimpleList
7211 #
7212 # Expected arguments
7213 # $slWidget - The GA::Obj::SimpleList
7214 # $columns - The number of columns in the list
7215 #
7216 # Return values
7217 # 'undef' on improper arguments
7218 # 1 otherwise
7219  
7220 my ($self, $slWidget, $columns, $check) = @_;
7221  
7222 # Local variables
7223 my (
7224 @dataList,
7225 %hash,
7226 );
7227  
7228 # Check for improper arguments
7229 if (! defined $slWidget || ! defined $columns || defined $check) {
7230  
7231 return $axmud::CLIENT->writeImproper(
7232 $self->_objClass . '->colours3Tab_refreshList',
7233 @_,
7234 );
7235 }
7236  
7237 # Import the IV (for speed)
7238 %hash = $axmud::CLIENT->xTermColourHash;
7239  
7240 # Compile the simple list data
7241 for (my $count = 0; $count < 256; $count++) {
7242  
7243 my $tag = 'x' . $count;
7244  
7245 push (@dataList,
7246 $tag,
7247 $hash{$tag},
7248 );
7249 }
7250  
7251 # Reset the simple list
7252 $self->resetListData($slWidget, [@dataList], $columns);
7253  
7254 return 1;
7255 }
7256  
7257 sub colours4Tab {
7258  
7259 # Colours4 tab
7260 #
7261 # Expected arguments
7262 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
7263 #
7264 # Return values
7265 # 'undef' on improper arguments
7266 # 1 otherwise
7267  
7268 my ($self, $innerNotebook, $check) = @_;
7269  
7270 # Local variables
7271 my @comboList;
7272  
7273 # Check for improper arguments
7274 if (! defined $innerNotebook || defined $check) {
7275  
7276 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours4Tab', @_);
7277 }
7278  
7279 # Tab setup
7280 my $grid = $self->addTab('Page _4', $innerNotebook);
7281  
7282 # Import a list of standard colour tags
7283 @comboList = ($axmud::CLIENT->constColourTagList, $axmud::CLIENT->constBoldColourTagList);
7284  
7285 # System message colours
7286 $self->addLabel($grid, '<b>System message colours</b>',
7287 0, 12, 0, 1);
7288  
7289 $self->colours4Tab_addRow(
7290 $grid,
7291 1,
7292 'customInsertCmdColour',
7293 'constInsertCmdColour',
7294 '-c',
7295 'World command colour',
7296 \@comboList,
7297 );
7298  
7299 $self->colours4Tab_addRow(
7300 $grid,
7301 2,
7302 'customShowSystemTextColour',
7303 'constShowSystemTextColour',
7304 '-m',
7305 'System message colour',
7306 \@comboList,
7307 );
7308  
7309 $self->colours4Tab_addRow(
7310 $grid,
7311 3,
7312 'customShowErrorColour',
7313 'constShowErrorColour',
7314 '-e',
7315 'System error colour',
7316 \@comboList,
7317 );
7318  
7319 $self->colours4Tab_addRow(
7320 $grid,
7321 4,
7322 'customShowWarningColour',
7323 'constShowWarningColour',
7324 '-w',
7325 'System warning colour',
7326 \@comboList,
7327 );
7328  
7329 $self->colours4Tab_addRow(
7330 $grid,
7331 5,
7332 'customShowDebugColour',
7333 'constShowDebugColour',
7334 '-d',
7335 'System debug colour',
7336 \@comboList,
7337 );
7338  
7339 $self->colours4Tab_addRow(
7340 $grid,
7341 6,
7342 'customShowImproperColour',
7343 'constShowImproperColour',
7344 '-i',
7345 'System improper arguments colour',
7346 \@comboList,
7347 );
7348  
7349 # Tab complete
7350 return 1;
7351 }
7352  
7353 sub colours4Tab_addRow {
7354  
7355 # Called by $self->colours4Tab
7356 # Adds a single row of labels, entry boxes and buttons to allow configuration of a single
7357 # system colour
7358 #
7359 # Expected arguments
7360 # $grid - The Gtk3::Grid for this tab
7361 # $row - The number of the row in the Gtk3::Grid displayed in this tab
7362 # $iv - The IV used, e.g. 'customShowSystemTextColour'
7363 # $defaultIV - The default colour used to set this IV, e.g. 'constShowSystemTextColour'
7364 # $switch - Switch used in ';setsystemcolour' for this IV
7365 # $descrip - A short description, e.g. 'System message colour'
7366 # $listRef - Reference to a list of standard colour tags to display in a combo
7367 #
7368 # Return values
7369 # 'undef' on improper arguments
7370 # 1 otherwise
7371  
7372 my ($self, $grid, $row, $iv, $defaultIV, $switch, $descrip, $listRef, $check) = @_;
7373  
7374 # Local variables
7375 my ($colour, $default);
7376  
7377 # Check for improper arguments
7378 if (
7379 ! defined $grid || ! defined $row || ! defined $iv || ! defined $defaultIV
7380 || ! defined $switch || ! defined $descrip || ! defined $listRef || defined $check
7381 ) {
7382 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours4Tab_addRow', @_);
7383 }
7384  
7385 # Initialise vars
7386 $colour = $axmud::CLIENT->$iv;
7387 $default = $axmud::CLIENT->$defaultIV;
7388  
7389 # Colour
7390 $self->addLabel($grid, $descrip,
7391 1, 3, $row, ($row + 1));
7392  
7393 my ($frame, $canvas, $canvasObj) = $self->addSimpleCanvas($grid, $colour, undef,
7394 3, 4, $row, ($row + 1));
7395  
7396 my $entry = $self->addEntry($grid, undef, FALSE,
7397 4, 6, $row, ($row + 1),
7398 10, 10);
7399 $entry->set_text($colour);
7400  
7401 my $comboBox = $self->addComboBox($grid, undef, $listRef, 'Change:',
7402 TRUE, # No 'undef' value used
7403 6, 8, $row, ($row + 1));
7404 $comboBox->signal_connect('changed' => sub {
7405  
7406 my $modColour = $comboBox->get_active_text();
7407  
7408 if ($modColour ne 'Change') {
7409  
7410 $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $modColour);
7411 $entry->set_text($modColour);
7412 $colour = $modColour;
7413  
7414 # Update IVs immediately
7415 $self->session->pseudoCmd(
7416 'setsystemcolour ' . $switch . ' ' . $modColour,
7417 $self->pseudoCmdMode,
7418 );
7419  
7420 # Need to reset the combo, too
7421 $comboBox->set_active(0);
7422 }
7423 });
7424  
7425 # Default colour
7426 my $button = $self->addButton($grid, 'Use default:', 'Use the default colour', undef,
7427 8, 10, $row, ($row + 1));
7428 $button->signal_connect('clicked' => sub {
7429  
7430 $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $default);
7431 $entry->set_text($default);
7432  
7433 # Update IVs immediately
7434 $self->session->pseudoCmd(
7435 'setsystemcolour ' . $switch,
7436 $self->pseudoCmdMode,
7437 );
7438 });
7439  
7440 $self->addSimpleCanvas($grid, $default, undef,
7441 10, 11, $row, ($row + 1));
7442  
7443 my $entry2 = $self->addEntry($grid, undef, FALSE,
7444 11, 13, $row, ($row + 1),
7445 10, 10);
7446 $entry2->set_text($default);
7447  
7448 return 1;
7449 }
7450  
7451 sub colours5Tab {
7452  
7453 # Colours5 tab
7454 #
7455 # Expected arguments
7456 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
7457 #
7458 # Return values
7459 # 'undef' on improper arguments
7460 # 1 otherwise
7461  
7462 my ($self, $innerNotebook, $check) = @_;
7463  
7464 # Local variables
7465 my (
7466 @columnList, @list, @comboList,
7467 %comboHash,
7468 );
7469  
7470 # Check for improper arguments
7471 if (! defined $innerNotebook || defined $check) {
7472  
7473 return $axmud::CLIENT->writeImproper($self->_objClass . '->colours5Tab', @_);
7474 }
7475  
7476 # Tab setup
7477 my $grid = $self->addTab('Page _5', $innerNotebook);
7478  
7479 # Colour schemes
7480 $self->addLabel($grid, '<b>Colour schemes</b>',
7481 0, 12, 0, 1);
7482 $self->addLabel($grid, '<i>List of colour schemes used by various windows</i>',
7483 1, 6, 1, 2);
7484  
7485 my $checkButton = $self->addCheckButton(
7486 $grid, 'Convert invisible text received from the world', undef, TRUE,
7487 6, 12, 1, 2);
7488 $checkButton->set_active($axmud::CLIENT->convertInvisibleFlag);
7489 $checkButton->signal_connect('toggled' => sub {
7490  
7491 my $flag = $checkButton->get_active();
7492  
7493 if (
7494 (! $flag && ! $axmud::CLIENT->convertInvisibleFlag)
7495 || ($flag && $axmud::CLIENT->convertInvisibleFlag)
7496 ) {
7497 $self->session->pseudoCmd('convertText');
7498 }
7499 });
7500  
7501 # Add a simple list
7502 @columnList = (
7503 'Standard', 'bool',
7504 'Name', 'text',
7505 'Text', 'text',
7506 'Underlay', 'text',
7507 'Background', 'text',
7508 'Font', 'text',
7509 'Font size', 'text',
7510 );
7511  
7512 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
7513 1, 12, 2, 10);
7514  
7515 # Initialise the list
7516 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7517  
7518 # Add entry boxes and editing buttons
7519 $self->addLabel($grid, 'Name',
7520 1, 3, 10, 11);
7521 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
7522 3, 6, 10, 11);
7523  
7524 my $button = $self->addButton($grid, 'Add', 'Add the specified colour scheme', undef,
7525 6, 8, 10, 11);
7526 $button->signal_connect('clicked' => sub {
7527  
7528 my $name = $entry->get_text();
7529  
7530 if ($self->checkEntryIcon($entry)) {
7531  
7532 # Add this colour scheme
7533 $self->session->pseudoCmd('addcolourscheme ' . $name, $self->pseudoCmdMode);
7534  
7535 # Refresh the simple list and entry boxes
7536 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7537 $self->resetEntryBoxes($entry);
7538 }
7539 });
7540  
7541 my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected colour scheme', undef,
7542 8, 10, 10, 11);
7543 $button2->signal_connect('clicked' => sub {
7544  
7545 my ($name, $obj, $childWinObj);
7546  
7547 ($name) = $self->getSimpleListData($slWidget, 1);
7548 if (defined $name) {
7549  
7550 $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name);
7551 if ($obj) {
7552  
7553 # Open an 'edit' window for the user to customise the colour scheme
7554 $childWinObj = $self->createFreeWin(
7555 'Games::Axmud::EditWin::ColourScheme',
7556 $self,
7557 $self->session,
7558 'Edit colour scheme \'' . $name . '\'',
7559 $obj,
7560 FALSE, # Not temporary
7561 );
7562  
7563 if ($childWinObj) {
7564  
7565 # When the 'edit' window closes, update widgets and/or IVs
7566 $self->add_childDestroy(
7567 $childWinObj,
7568 'colours5Tab_refreshList',
7569 [$slWidget, (scalar @columnList / 2)],
7570 );
7571 }
7572  
7573 # Refresh the simple list and entry boxes
7574 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7575 $self->resetEntryBoxes($entry);
7576 }
7577 }
7578 });
7579  
7580 my $button3 = $self->addButton($grid, 'Delete', 'Delete the selected colour scheme', undef,
7581 10, 12, 10, 11);
7582 $button3->signal_connect('clicked' => sub {
7583  
7584 my ($name, $obj);
7585  
7586 ($name) = $self->getSimpleListData($slWidget, 1);
7587 if (defined $name) {
7588  
7589 $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name);
7590 if ($obj) {
7591  
7592 # Delete this colour scheme
7593 $self->session->pseudoCmd('deletecolourscheme ' . $name, $self->pseudoCmdMode);
7594  
7595 # Refresh the simple list and entry boxes
7596 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7597 $self->resetEntryBoxes($entry);
7598 }
7599 }
7600 });
7601  
7602 my $button4 = $self->addButton(
7603 $grid,
7604 'Update windows',
7605 'Update \'internal\' windows which use the selected colour scheme',
7606 undef,
7607 1, 4, 11, 12);
7608 $button4->signal_connect('clicked' => sub {
7609  
7610 my ($name, $obj);
7611  
7612 ($name) = $self->getSimpleListData($slWidget, 1);
7613 if (defined $name) {
7614  
7615 $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name);
7616 if ($obj) {
7617  
7618 # Update 'internal' windows
7619 $self->session->pseudoCmd('updatecolourscheme ' . $name, $self->pseudoCmdMode);
7620  
7621 # Refresh the simple list and entry boxes
7622 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7623 $self->resetEntryBoxes($entry);
7624 }
7625 }
7626 });
7627  
7628 @list = (
7629 'Apply to \'main\' windows' => ' -m',
7630 'Apply to \'protocol\' windows' => ' -p',
7631 'Apply to \'custom\' windows' => ' -c',
7632 'Apply to this session\'s \'internal\' windows' => ' -s',
7633 'Apply to all \'internal\' windows' => '', # Empty switch
7634 );
7635  
7636 do {
7637 my ($descrip, $switch);
7638  
7639 $descrip = shift @list;
7640 $switch = shift @list;
7641  
7642 push (@comboList, $descrip);
7643 $comboHash{$descrip} = $switch;
7644  
7645 } until (! @list);
7646  
7647 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
7648 TRUE, # No 'undef' value used
7649 4, 8, 11, 12);
7650  
7651 my $button5 = $self->addButton(
7652 $grid,
7653 'Apply',
7654 'Apply the selected colour scheme',
7655 undef,
7656 8, 10, 11, 12);
7657 $button5->signal_connect('clicked' => sub {
7658  
7659 my ($name, $obj, $descrip, $switch);
7660  
7661 ($name) = $self->getSimpleListData($slWidget, 1);
7662 if (defined $name) {
7663  
7664 $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name);
7665 }
7666  
7667 $descrip = $combo->get_active_text();
7668 if ($descrip) {
7669  
7670 $switch = $comboHash{$descrip};
7671 }
7672  
7673 if ($obj && defined $switch) {
7674  
7675 $self->session->pseudoCmd(
7676 'applycolourscheme ' . $name . $switch,
7677 $self->pseudoCmdMode,
7678 );
7679 }
7680 });
7681  
7682 my $button6 = $self->addButton(
7683 $grid,
7684 'Reset list',
7685 'Reset the list of colour schemes',
7686 undef,
7687 10, 12, 11, 12);
7688 $button6->signal_connect('clicked' => sub {
7689  
7690 # Refresh the simple list and entry boxes
7691 $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2));
7692 $self->resetEntryBoxes($entry);
7693 });
7694  
7695 # Tab complete
7696 return 1;
7697 }
7698  
7699 sub colours5Tab_refreshList {
7700  
7701 # Called by $self->colours5Tab to refresh the GA::Obj::SimpleList
7702 #
7703 # Expected arguments
7704 # $slWidget - The GA::Obj::SimpleList
7705 # $columns - The number of columns in the list
7706 #
7707 # Return values
7708 # 'undef' on improper arguments
7709 # 1 otherwise
7710  
7711 my ($self, $slWidget, $columns, $check) = @_;
7712  
7713 # Local variables
7714 my (@sortedList, @dataList);
7715  
7716 # Check for improper arguments
7717 if (! defined $slWidget || ! defined $columns || defined $check) {
7718  
7719 return $axmud::CLIENT->writeImproper(
7720 $self->_objClass . '->colours5Tab_refreshList',
7721 @_,
7722 );
7723 }
7724  
7725 # Get a sorted list of colour schemes
7726 @sortedList
7727 = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('colourSchemeHash'));
7728  
7729 # Compile the simple list data
7730 foreach my $obj (@sortedList) {
7731  
7732 my $flag;
7733  
7734 if (
7735 $axmud::CLIENT->ivExists('constGridWinTypeHash', $obj->name)
7736 || $axmud::CLIENT->ivExists('constFreeWinTypeHash', $obj->name)
7737 ) {
7738 $flag = TRUE;
7739 } else {
7740 $flag = FALSE;
7741 }
7742  
7743 push (@dataList,
7744 $flag,
7745 $obj->name,
7746 $obj->textColour,
7747 $obj->underlayColour,
7748 $obj->backgroundColour,
7749 $obj->font,
7750 $obj->fontSize,
7751 );
7752 }
7753  
7754 # Reset the simple list
7755 $self->resetListData($slWidget, [@dataList], $columns);
7756  
7757 return 1;
7758 }
7759  
7760 sub workspacesTab {
7761  
7762 # Workspaces tab - called by $self->setupNotebook
7763 #
7764 # Expected arguments
7765 # (none besides $self)
7766 #
7767 # Return values
7768 # 'undef' on improper arguments
7769 # 1 otherwise
7770  
7771 my ($self, $check) = @_;
7772  
7773 # Check for improper arguments
7774 if (defined $check) {
7775  
7776 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspacesTab', @_);
7777 }
7778  
7779 # Tab setup
7780 # Create a notebook within the main one, so that we have two rows of tabs
7781 my $innerNotebook = $self->addInnerNotebookTab('_Workspaces', $self->notebook);
7782  
7783 # Add tabs to the inner notebook
7784 $self->workspaces1Tab($innerNotebook);
7785 $self->workspaces2Tab($innerNotebook);
7786 $self->workspaces3Tab($innerNotebook);
7787 $self->workspaces4Tab($innerNotebook);
7788 $self->workspaces5Tab($innerNotebook);
7789 $self->workspaces6Tab($innerNotebook);
7790 $self->workspaces7Tab($innerNotebook);
7791 $self->workspaces8Tab($innerNotebook);
7792  
7793 return 1;
7794 }
7795  
7796 sub workspaces1Tab {
7797  
7798 # Workspaces1 tab
7799 #
7800 # Expected arguments
7801 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
7802 #
7803 # Return values
7804 # 'undef' on improper arguments
7805 # 1 otherwise
7806  
7807 my ($self, $innerNotebook, $check) = @_;
7808  
7809 # Local variables
7810 my (
7811 $maxWidth, $maxHeight,
7812 @list, @comboList,
7813 %comboHash,
7814 );
7815  
7816 # Check for improper arguments
7817 if (! defined $innerNotebook || defined $check) {
7818  
7819 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces1Tab', @_);
7820 }
7821  
7822 # Tab setup
7823 my $grid = $self->addTab('Page _1', $innerNotebook);
7824  
7825 # Left column
7826 $self->addLabel($grid, '<b>Workspace (desktop) settings</b>',
7827 0, 12, 0, 1);
7828  
7829 $self->addLabel($grid, 'Maximum workspace width',
7830 1, 3, 1, 2);
7831 my $entry = $self->addEntry($grid, undef, FALSE,
7832 3, 6, 1, 2, 8, 8);
7833 $entry->set_text($axmud::CLIENT->constWorkspaceMaxWidth);
7834  
7835 $self->addLabel($grid, 'Maximum workspace height',
7836 1, 3, 2, 3);
7837 my $entry2 = $self->addEntry($grid, undef, FALSE,
7838 3, 6, 2, 3, 8, 8);
7839 $entry2->set_text($axmud::CLIENT->constWorkspaceMaxHeight);
7840  
7841 $self->addLabel($grid, 'When adding workspaces,',
7842 1, 3, 3, 4);
7843  
7844 @list = (
7845 'move left from default workspace' => '-l',
7846 'move right from default workspace' => '-r',
7847 'after default workspace, start from left' => '-b',
7848 'ffter default workspace, start from right' => '-e',
7849 );
7850  
7851 do {
7852 my ($string, $switch);
7853  
7854 $string = shift @list;
7855 $switch = shift @list;
7856  
7857 $comboHash{$string} = $switch;
7858 push (@comboList, $string);
7859  
7860 } until (! @list);
7861  
7862 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
7863 TRUE, # No 'undef' value used
7864 3, 8, 3, 4);
7865  
7866 my $button = $self->addButton($grid,
7867 'Set', 'Set the default width/height', undef,
7868 8, 10, 3, 4);
7869 $button->signal_connect('clicked' => sub {
7870  
7871 my ($string, $switch);
7872  
7873 $string = $combo->get_active_text();
7874 $switch = $comboHash{$string};
7875 if ($switch) {
7876  
7877 $self->session->pseudoCmd('setworkspacedirection ' . $switch, $self->pseudoCmdMode);
7878 }
7879 });
7880  
7881 # Right column
7882 $self->addLabel($grid, 'Minimum workspace width',
7883 6, 8, 1, 2);
7884 my $entry3 = $self->addEntry($grid, undef, FALSE,
7885 8, 12, 1, 2, 8, 8);
7886 $entry3->set_text($axmud::CLIENT->constWorkspaceMinWidth);
7887  
7888 $self->addLabel($grid, 'Minimum workspace height',
7889 6, 8, 2, 3);
7890 my $entry4 = $self->addEntry($grid, undef, FALSE,
7891 8, 12, 2, 3, 8, 8);
7892 $entry4->set_text($axmud::CLIENT->constWorkspaceMinHeight);
7893  
7894 # Bottom section
7895 $self->addLabel($grid, '<b>Window size settings</b>',
7896 0, 12, 4, 5);
7897  
7898 $maxWidth = $axmud::CLIENT->constWorkspaceMaxWidth;
7899 $maxHeight = $axmud::CLIENT->constWorkspaceMaxHeight;
7900  
7901 $self->addLabel($grid, 'Default width for \'main\' windows (range 100-' . $maxWidth . ')',
7902 1, 6, 5, 6);
7903 my $entry5 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth,
7904 6, 8, 5, 6, 8, 8);
7905 $entry5->set_text($axmud::CLIENT->customMainWinWidth);
7906  
7907 $self->addLabel(
7908 $grid,
7909 'Default height for \'main\' windows (range 100-' . $maxHeight . ')',
7910 1, 6, 6, 7);
7911 my $entry6 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight,
7912 6, 8, 6, 7, 8, 8);
7913 $entry6->set_text($axmud::CLIENT->customMainWinHeight);
7914  
7915 my $button2 = $self->addButton($grid,
7916 'Set', 'Set the default width/height', undef,
7917 8, 10, 6, 7);
7918 $button2->signal_connect('clicked' => sub {
7919  
7920 if ($self->checkEntryIcon($entry5, $entry6)) {
7921  
7922 $self->session->pseudoCmd(
7923 'setwindowsize -m ' . $entry5->get_text() . ' ' . $entry6->get_text(),
7924 $self->pseudoCmdMode,
7925 );
7926  
7927 $entry5->set_text($axmud::CLIENT->customMainWinWidth);
7928 $entry6->set_text($axmud::CLIENT->customMainWinHeight);
7929 }
7930 });
7931  
7932 my $button3 = $self->addButton($grid,
7933 'Reset', 'Reset the default width/height', undef,
7934 10, 12, 6, 7);
7935 $button3->signal_connect('clicked' => sub {
7936  
7937 $self->session->pseudoCmd(
7938 'setwindowsize -m',
7939 $self->pseudoCmdMode,
7940 );
7941  
7942 $entry5->set_text($axmud::CLIENT->customMainWinWidth);
7943 $entry6->set_text($axmud::CLIENT->customMainWinHeight);
7944 });
7945  
7946 $self->addLabel(
7947 $grid,
7948 'Default width for other \'grid\' windows (range 100-' . $maxWidth . ')',
7949 1, 6, 7, 8);
7950 my $entry7 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth,
7951 6, 8, 7, 8, 8, 8);
7952 $entry7->set_text($axmud::CLIENT->customGridWinWidth);
7953  
7954 $self->addLabel(
7955 $grid,
7956 'Default height for other \'grid\' windows (range 100-' . $maxHeight . ')',
7957 1, 6, 8, 9);
7958 my $entry8 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight,
7959 6, 8, 8, 9, 8, 8);
7960 $entry8->set_text($axmud::CLIENT->customGridWinHeight);
7961  
7962 my $button4 = $self->addButton($grid,
7963 'Set', 'Set the default width/height', undef,
7964 8, 10, 8, 9);
7965 $button4->signal_connect('clicked' => sub {
7966  
7967 if ($self->checkEntryIcon($entry7, $entry8)) {
7968  
7969 $self->session->pseudoCmd(
7970 'setwindowsize -g ' . $entry7->get_text() . ' ' . $entry8->get_text(),
7971 $self->pseudoCmdMode,
7972 );
7973  
7974 $entry7->set_text($axmud::CLIENT->customGridWinWidth);
7975 $entry8->set_text($axmud::CLIENT->customGridWinHeight);
7976 }
7977 });
7978  
7979 my $button5 = $self->addButton($grid,
7980 'Reset', 'Reset the default width/height', undef,
7981 10, 12, 8, 9);
7982 $button5->signal_connect('clicked' => sub {
7983  
7984 $self->session->pseudoCmd(
7985 'setwindowsize -g',
7986 $self->pseudoCmdMode,
7987 );
7988  
7989 $entry7->set_text($axmud::CLIENT->customGridWinWidth);
7990 $entry8->set_text($axmud::CLIENT->customGridWinHeight);
7991 });
7992  
7993 $self->addLabel(
7994 $grid,
7995 '<i>Tip: Only increase the \'free\' window size if <u>this</u> window is too small for'
7996 . ' comfort</i>',
7997 1, 12, 9, 10);
7998  
7999 $self->addLabel(
8000 $grid,
8001 'Default width for \'free\' windows (range 100-' . $maxWidth . ')',
8002 1, 6, 10, 11);
8003 my $entry9 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth,
8004 6, 8, 10, 11, 8, 8);
8005 $entry9->set_text($axmud::CLIENT->customFreeWinWidth);
8006  
8007 $self->addLabel(
8008 $grid,
8009 'Default height for \'free\' windows (range 100-' . $maxHeight . ')',
8010 1, 6, 11, 12);
8011 my $entry10 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight,
8012 6, 8, 11, 12, 8, 8);
8013 $entry10->set_text($axmud::CLIENT->customFreeWinHeight);
8014  
8015 my $button6 = $self->addButton($grid,
8016 'Set', 'Set the default width/height', undef,
8017 8, 10, 11, 12);
8018 $button6->signal_connect('clicked' => sub {
8019  
8020 if ($self->checkEntryIcon($entry9, $entry10)) {
8021  
8022 $self->session->pseudoCmd(
8023 'setwindowsize -f ' . $entry9->get_text() . ' ' . $entry10->get_text(),
8024 $self->pseudoCmdMode,
8025 );
8026  
8027 $entry9->set_text($axmud::CLIENT->customFreeWinWidth);
8028 $entry10->set_text($axmud::CLIENT->customFreeWinHeight);
8029 }
8030 });
8031  
8032 my $button7 = $self->addButton($grid,
8033 'Reset', 'Reset the default width/height', undef,
8034 10, 12, 11, 12);
8035 $button7->signal_connect('clicked' => sub {
8036  
8037 $self->session->pseudoCmd(
8038 'setwindowsize -f',
8039 $self->pseudoCmdMode,
8040 );
8041  
8042 $entry9->set_text($axmud::CLIENT->customFreeWinWidth);
8043 $entry10->set_text($axmud::CLIENT->customFreeWinHeight);
8044 });
8045  
8046 # Tab complete
8047 return 1;
8048 }
8049  
8050 sub workspaces2Tab {
8051  
8052 # Workspaces2 tab
8053 #
8054 # Expected arguments
8055 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
8056 #
8057 # Return values
8058 # 'undef' on improper arguments
8059 # 1 otherwise
8060  
8061 my ($self, $innerNotebook, $check) = @_;
8062  
8063 # Check for improper arguments
8064 if (! defined $innerNotebook || defined $check) {
8065  
8066 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces2Tab', @_);
8067 }
8068  
8069 # Tab setup
8070 my $grid = $self->addTab('Page _2', $innerNotebook);
8071  
8072 # Workspace panel sizes
8073 $self->addLabel($grid, '<b>Workspace panel/window controls sizes</b>',
8074 0, 12, 0, 1);
8075 $self->addLabel(
8076 $grid,
8077 '<i>Custom panel sizes. If set, used for all workspaces. If not set, sizes are'
8078 . ' detected in all workspaces</i>',
8079 1, 12, 1, 2);
8080  
8081 $self->workspaces2Tab_panelRow($grid, 'Left panel', 'customPanelLeftSize', '-l', 2);
8082 $self->workspaces2Tab_panelRow($grid, 'Right panel', 'customPanelRightSize', '-r', 3);
8083 $self->workspaces2Tab_panelRow($grid, 'Top panel', 'customPanelTopSize', '-t', 4);
8084 $self->workspaces2Tab_panelRow($grid, 'Bottom panel', 'customPanelBottomSize', '-b', 5);
8085  
8086 # Window controls sizes
8087 $self->addLabel(
8088 $grid,
8089 '<i>Window controls sizes. If all are set, used for all workspaces. If any are not set,'
8090 . ' sizes are detected in all workspaces</i>',
8091 1, 12, 6, 7);
8092  
8093 $self->workspaces2Tab_controlsRow($grid, 'Left edge', 'customControlsLeftSize', '-l', 7);
8094 $self->workspaces2Tab_controlsRow($grid, 'Right edge', 'customControlsRightSize', '-r', 8);
8095 $self->workspaces2Tab_controlsRow($grid, 'Top edge', 'customControlsTopSize', '-t', 9);
8096 $self->workspaces2Tab_controlsRow(
8097 $grid,
8098 'Bottom edge',
8099 'customControlsBottomSize',
8100 '-b',
8101 10,
8102 );
8103  
8104 # Tab complete
8105 return 1;
8106 }
8107  
8108 sub workspaces2Tab_panelRow {
8109  
8110 # Called by $self->workspaces2Tab; adds a row of widgets for a single GA::Client IV
8111 #
8112 # Expected arguments
8113 # $grid - The Gtk3::Grid for this tab
8114 # $text - The label text to use, e.g. 'Left panel'
8115 # $iv - The IV set by these widgets, e.g. ->customPanelLeftSize
8116 # $switch - The switch to use in a ';setpanel' command, e.g. '-l'
8117 # $row - The row number on the Gtk3::Grid
8118 #
8119 # Return values
8120 # 'undef' on improper arguments or if the check fails
8121 # 1 otherwise
8122  
8123 my ($self, $grid, $text, $iv, $switch, $row, $check) = @_;
8124  
8125 # Check for improper arguments
8126 if (
8127 ! defined $grid || ! defined $text || ! defined $iv || ! defined $switch
8128 || ! defined $row || defined $check
8129 ) {
8130 return $axmud::CLIENT->writeImproper(
8131 $self->_objClass . '->workspaces2Tab_panelRow',
8132 @_
8133 );
8134 }
8135  
8136 $self->addLabel($grid, $text,
8137 1, 3, $row, ($row + 1));
8138  
8139 my $entry = $self->addEntry($grid, undef, FALSE,
8140 3, 6, $row, ($row + 1), 16, 16);
8141 if (! defined ($axmud::CLIENT->$iv)) {
8142 $entry->set_text('(not set)');
8143 } else {
8144 $entry->set_text($axmud::CLIENT->$iv);
8145 }
8146  
8147 my $entry2 = $self->addEntryWithIcon(
8148 $grid, undef, 'int', 0, undef,
8149 6, 8, $row, ($row + 1), 8, 8);
8150  
8151 my $button = $self->addButton($grid,
8152 'Set', 'Set the panel size', undef,
8153 8, 10, $row, ($row + 1));
8154 $button->signal_connect('clicked' => sub {
8155  
8156 my $size = $entry2->get_text();
8157 if ($self->checkEntryIcon($entry2)) {
8158  
8159 $self->session->pseudoCmd(
8160 'setpanel ' . $switch . ' ' . $size,
8161 $self->pseudoCmdMode,
8162 );
8163 }
8164  
8165 if (! defined ($axmud::CLIENT->$iv)) {
8166 $entry->set_text('(not set)');
8167 } else {
8168 $entry->set_text($axmud::CLIENT->$iv);
8169 }
8170  
8171 $entry2->set_text('');
8172 });
8173  
8174 my $button2 = $self->addButton($grid,
8175 'Don\'t use', 'Detect this panel size on every workspace', undef,
8176 10, 12, $row, ($row + 1));
8177 $button2->signal_connect('clicked' => sub {
8178  
8179 $self->session->pseudoCmd('setpanel ' . $switch, $self->pseudoCmdMode);
8180  
8181 $entry->set_text('(not set)');
8182 $entry2->set_text('');
8183 });
8184  
8185 return 1;
8186 }
8187  
8188 sub workspaces2Tab_controlsRow {
8189  
8190 # Called by $self->workspaces2Tab; adds a row of widgets for a single GA::Client IV
8191 #
8192 # Expected arguments
8193 # $grid - The Gtk3::Grid for this tab
8194 # $text - The label text to use, e.g. 'Left side'
8195 # $iv - The IV set by these widgets, e.g. ->customControlsLeftSize
8196 # $switch - The switch to use in a ';setwindowcontrols' command, e.g. '-l'
8197 # $row - The row number on the Gtk3::Grid
8198 #
8199 # Return values
8200 # 'undef' on improper arguments or if the check fails
8201 # 1 otherwise
8202  
8203 my ($self, $grid, $text, $iv, $switch, $row, $check) = @_;
8204  
8205 # Check for improper arguments
8206 if (
8207 ! defined $grid || ! defined $text || ! defined $iv || ! defined $switch
8208 || ! defined $row || defined $check
8209 ) {
8210 return $axmud::CLIENT->writeImproper(
8211 $self->_objClass . '->workspaces2Tab_controlsRow',
8212 @_,
8213 );
8214 }
8215  
8216 $self->addLabel($grid, $text,
8217 1, 3, $row, ($row + 1));
8218  
8219 my $entry = $self->addEntry($grid, undef, FALSE,
8220 3, 6, $row, ($row + 1), 16, 16);
8221 if (! defined ($axmud::CLIENT->$iv)) {
8222 $entry->set_text('(not set)');
8223 } else {
8224 $entry->set_text($axmud::CLIENT->$iv);
8225 }
8226  
8227 my $entry2 = $self->addEntryWithIcon(
8228 $grid, undef, 'int', 0, undef,
8229 6, 8, $row, ($row + 1), 8, 8);
8230  
8231 my $button = $self->addButton($grid,
8232 'Set', 'Set the window controls size', undef,
8233 8, 10, $row, ($row + 1));
8234 $button->signal_connect('clicked' => sub {
8235  
8236 my $size = $entry2->get_text();
8237 if ($self->checkEntryIcon($entry2)) {
8238  
8239 $self->session->pseudoCmd(
8240 'setwindowcontrols ' . $switch . ' ' . $size,
8241 $self->pseudoCmdMode,
8242 );
8243 }
8244  
8245 if (! defined ($axmud::CLIENT->$iv)) {
8246 $entry->set_text('(not set)');
8247 } else {
8248 $entry->set_text($axmud::CLIENT->$iv);
8249 }
8250  
8251 $entry2->set_text('');
8252 });
8253  
8254 my $button2 = $self->addButton($grid,
8255 'Don\'t use', 'Detect this window controls size on every workspace', undef,
8256 10, 12, $row, ($row + 1));
8257 $button2->signal_connect('clicked' => sub {
8258  
8259 $self->session->pseudoCmd('setwindowcontrols ' . $switch, $self->pseudoCmdMode);
8260  
8261 $entry->set_text('(not set)');
8262 $entry2->set_text('');
8263 });
8264  
8265 return 1;
8266 }
8267  
8268 sub workspaces3Tab {
8269  
8270 # Workspaces3 tab
8271 #
8272 # Expected arguments
8273 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
8274 #
8275 # Return values
8276 # 'undef' on improper arguments
8277 # 1 otherwise
8278  
8279 my ($self, $innerNotebook, $check) = @_;
8280  
8281 # Local variables
8282 my (
8283 $title,
8284 @columnList, @columnList2, @comboList,
8285 );
8286  
8287 # Check for improper arguments
8288 if (! defined $innerNotebook || defined $check) {
8289  
8290 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces3Tab', @_);
8291 }
8292  
8293 # Tab setup
8294 my $grid = $self->addTab('Page _3', $innerNotebook);
8295  
8296 # Workspaces
8297 $self->addLabel($grid, '<b>Workspaces</b>',
8298 0, 12, 0, 1);
8299 $self->addLabel($grid,
8300 '<i>List of workspace objects (one for each workspace in use by ' . $axmud::SCRIPT
8301 . ')</i>',
8302 1, 12, 1, 2);
8303  
8304 # Add a simple list
8305 @columnList = (
8306 'Object num', 'int',
8307 'Default', 'bool',
8308 'System num', 'text',
8309 'System name', 'text',
8310 'Width', 'int',
8311 'Height', 'int',
8312 'Default zonemap', 'text',
8313 );
8314  
8315 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
8316 1, 12, 2, 6);
8317  
8318 # Initialise the list
8319 $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
8320  
8321 # Add another simple list
8322 $self->addLabel($grid,
8323 '<i>List of available (but unused) workspaces</i>',
8324 1, 12, 7, 8);
8325  
8326 @columnList2 = (
8327 'System num', 'int',
8328 );
8329  
8330 my $slWidget2 = $self->addSimpleList($grid, undef, \@columnList2,
8331 1, 12, 8, 12);
8332  
8333 # Initialise the list
8334 $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
8335  
8336 # Add editing widgets for both simple lists
8337 my $button = $self->addButton($grid, 'View...', 'View this workspace\'s settings', undef,
8338 1, 3, 6, 7);
8339 $button->signal_connect('clicked' => sub {
8340  
8341 my ($number, $obj);
8342  
8343 ($number) = $self->getSimpleListData($slWidget, 0);
8344 if (defined $number) {
8345  
8346 $obj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $number);
8347 if ($obj) {
8348  
8349 # Open an 'edit' window for the selected workspace object
8350 $self->createFreeWin(
8351 'Games::Axmud::EditWin::Workspace',
8352 $self,
8353 $self->session,,
8354 'Edit workspace object #' . $obj->number,
8355 $obj,
8356 FALSE, # Not temporary
8357 );
8358 }
8359 }
8360 });
8361  
8362 my $button2 = $self->addButton(
8363 $grid,
8364 'Remove',
8365 'Stop using this workspace for ' . $axmud::SCRIPT . ' windows',
8366 undef,
8367 3, 5, 6, 7);
8368 $button2->signal_connect('clicked' => sub {
8369  
8370 my ($num) = $self->getSimpleListData($slWidget, 0);
8371 if (defined $num) {
8372  
8373 $self->session->pseudoCmd(
8374 'removeworkspace ' . $num,
8375 $self->pseudoCmdMode,
8376 );
8377 }
8378  
8379 # Update simple lists
8380 $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
8381 $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
8382 });
8383  
8384 $title = '(Optional) default zonemap';
8385 @comboList = (sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash')));
8386  
8387 my $combo = $self->addComboBox($grid, undef, \@comboList, $title,
8388 TRUE, # No 'undef' value used
8389 1, 5, 12, 13);
8390  
8391 my $button3 = $self->addButton($grid, 'Use', 'Use the selected workspace', undef,
8392 5, 7, 12, 13);
8393 $button3->signal_connect('clicked' => sub {
8394  
8395 my ($num, $name, $zonemap, $string);
8396  
8397 ($num) = $self->getSimpleListData($slWidget2, 0);
8398 ($name) = $self->getSimpleListData($slWidget2, 1);
8399 $zonemap = $combo->get_active_text();
8400 if ($zonemap && $zonemap eq $title) {
8401  
8402 $zonemap = undef;
8403 }
8404  
8405 if ($zonemap) {
8406 $string = ' -z ' . $zonemap;
8407 } else {
8408 $string = '';
8409 }
8410  
8411 # Use either system number or name, depending on which is available (probably, both of
8412 # them are)
8413 if (defined $num) {
8414  
8415 $self->session->pseudoCmd(
8416 'useworkspace ' . $num . $string,
8417 $self->pseudoCmdMode,
8418 );
8419  
8420 } elsif (defined $name) {
8421  
8422 $self->session->pseudoCmd(
8423 'useworkspace ' . $name . $string,
8424 $self->pseudoCmdMode,
8425 );
8426 }
8427  
8428 # Update simple lists
8429 $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
8430 $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
8431 });
8432  
8433 my $button4 = $self->addButton(
8434 $grid,
8435 'Refresh lists',
8436 'Refresh the lists of workspaces',
8437 undef,
8438 10, 12, 12, 13);
8439 $button4->signal_connect('clicked' => sub {
8440  
8441 # Update simple lists
8442 $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
8443 $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
8444 });
8445  
8446 # Tab complete
8447 return 1;
8448 }
8449  
8450 sub workspaces3Tab_refreshList {
8451  
8452 # Called by $self->workspaces3Tab to refresh the first GA::Obj::SimpleList
8453 #
8454 # Expected arguments
8455 # $slWidget - The GA::Obj::SimpleList
8456 # $columns - The number of columns in the list
8457 #
8458 # Return values
8459 # 'undef' on improper arguments
8460 # 1 otherwise
8461  
8462 my ($self, $slWidget, $columns, $check) = @_;
8463  
8464 # Local variables
8465 my @dataList;
8466  
8467 # Check for improper arguments
8468 if (! defined $slWidget || ! defined $columns || defined $check) {
8469  
8470 return $axmud::CLIENT->writeImproper(
8471 $self->_objClass . '->workspaces3Tab_refreshList',
8472 @_,
8473 );
8474 }
8475  
8476 # Compile the simple list data
8477 foreach my $obj (
8478 sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
8479 ) {
8480 my ($flag, $name);
8481  
8482 if (! $obj->number) {
8483 $flag = TRUE;
8484 } else {
8485 $flag = FALSE;
8486 }
8487  
8488 push (@dataList,
8489 $obj->number,
8490 $flag,
8491 $obj->systemNum,
8492 $name,
8493 $obj->currentWidth,
8494 $obj->currentHeight,
8495 $obj->defaultZonemap,
8496 );
8497 }
8498  
8499 # Reset the simple list
8500 $self->resetListData($slWidget, [@dataList], $columns);
8501  
8502 return 1;
8503 }
8504  
8505 sub workspaces3Tab_refreshList2 {
8506  
8507 # Called by $self->workspaces3Tab to refresh the second GA::Obj::SimpleList
8508 #
8509 # Expected arguments
8510 # $slWidget - The GA::Obj::SimpleList
8511 # $columns - The number of columns in the list
8512 #
8513 # Return values
8514 # 'undef' on improper arguments
8515 # 1 otherwise
8516  
8517 my ($self, $slWidget, $columns, $check) = @_;
8518  
8519 # Local variables
8520 my (@workspaceList, @dataList);
8521  
8522 # Check for improper arguments
8523 if (! defined $slWidget || ! defined $columns || defined $check) {
8524  
8525 return $axmud::CLIENT->writeImproper(
8526 $self->_objClass . '->workspaces3Tab_refreshList2',
8527 @_,
8528 );
8529 }
8530  
8531 # Get an ordered list of unused workspaces
8532 @dataList = $axmud::CLIENT->desktopObj->detectUnusedWorkspaces();
8533  
8534 # Reset the simple list
8535 $self->resetListData($slWidget, [@dataList], $columns);
8536  
8537 return 1;
8538 }
8539  
8540 sub workspaces4Tab {
8541  
8542 # Workspaces4 tab
8543 #
8544 # Expected arguments
8545 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
8546 #
8547 # Return values
8548 # 'undef' on improper arguments
8549 # 1 otherwise
8550  
8551 my ($self, $innerNotebook, $check) = @_;
8552  
8553 # Local variables
8554 my (
8555 $defaultString,
8556 @columnList, @comboList,
8557 );
8558  
8559 # Check for improper arguments
8560 if (! defined $innerNotebook || defined $check) {
8561  
8562 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces4Tab', @_);
8563 }
8564  
8565 # Tab setup
8566 my $grid = $self->addTab('Page _4', $innerNotebook);
8567  
8568 # Initial workspaces
8569 $self->addLabel($grid, '<b>Initial workspaces</b>',
8570 0, 12, 0, 1);
8571 $self->addLabel($grid,
8572 '<i>List of workspaces to use when ' . $axmud::SCRIPT . ' starts</i>',
8573 1, 12, 1, 2);
8574  
8575 # Add a simple list
8576 @columnList = (
8577 'Number', 'int',
8578 'Default zonemap', 'text',
8579 );
8580  
8581 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
8582 1, 12, 2, 10);
8583  
8584 # Initialise the list
8585 $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));
8586  
8587 # Add editing widgets
8588 $self->addLabel($grid, 'Zonemap',
8589 1, 3, 10, 11);
8590  
8591 @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
8592 $defaultString = '(use default zonemap)';
8593 unshift (@comboList, $defaultString);
8594  
8595 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
8596 TRUE, # No 'undef' value used
8597 3, 6, 10, 11);
8598  
8599 my $button = $self->addButton(
8600 $grid,
8601 'Add workspace',
8602 'Add an initial workspace to those used when ' . $axmud::SCRIPT . ' starts',
8603 undef,
8604 6, 9, 10, 11);
8605 $button->signal_connect('clicked' => sub {
8606  
8607 my $zonemap = $combo->get_active_text();
8608 if ($zonemap eq $defaultString) {
8609 $self->session->pseudoCmd('addinitialworkspace', $self->pseudoCmdMode);
8610 } else {
8611 $self->session->pseudoCmd('addinitialworkspace ' . $zonemap, $self->pseudoCmdMode);
8612 }
8613  
8614 # Refresh the list
8615 $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));
8616 $combo->set_active(0);
8617 });
8618  
8619 my $button2 = $self->addButton(
8620 $grid,
8621 'Modify workspace',
8622 'Modify the selected workspace to use this zonemap',
8623 undef,
8624 9, 12, 10, 11);
8625 $button2->signal_connect('clicked' => sub {
8626  
8627 my ($number, $zonemap);
8628  
8629 ($number) = $self->getSimpleListData($slWidget, 0);
8630 $zonemap = $combo->get_active_text();
8631  
8632 if (defined $number) {
8633  
8634 if ($zonemap eq $defaultString) {
8635  
8636 $self->session->pseudoCmd(
8637 'modifyinitialworkspace ' . $number,
8638 $self->pseudoCmdMode,
8639 );
8640  
8641 } else {
8642  
8643 $self->session->pseudoCmd(
8644 'modifyinitialworkspace ' . $number . ' ' . $zonemap,
8645 $self->pseudoCmdMode,
8646 );
8647 }
8648 }
8649  
8650 # Refresh the list
8651 $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));
8652 $combo->set_active(0);
8653 });
8654  
8655 my $button3 = $self->addButton(
8656 $grid,
8657 'Delete workspace',
8658 'Delete the selected initial workspace',
8659 undef,
8660 6, 9, 11, 12);
8661 $button3->signal_connect('clicked' => sub {
8662  
8663 my ($number) = $self->getSimpleListData($slWidget, 0);
8664  
8665 if (defined $number) {
8666  
8667 $self->session->pseudoCmd(
8668 'deleteinitialworkspace ' . $number,
8669 $self->pseudoCmdMode,
8670 );
8671 }
8672  
8673 # Refresh the list
8674 $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));
8675 $combo->set_active(0);
8676 });
8677  
8678 my $button4 = $self->addButton(
8679 $grid,
8680 'Refresh list',
8681 'Refresh the list of initial workspaces',
8682 undef,
8683 9, 12, 11, 12);
8684 $button3->signal_connect('clicked' => sub {
8685  
8686 # Refresh the list
8687 $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));
8688 });
8689  
8690 # Tab complete
8691 return 1;
8692 }
8693  
8694 sub workspaces4Tab_refreshList {
8695  
8696 # Called by $self->workspaces4Tab to refresh the first GA::Obj::SimpleList
8697 #
8698 # Expected arguments
8699 # $slWidget - The GA::Obj::SimpleList
8700 # $columns - The number of columns in the list
8701 #
8702 # Return values
8703 # 'undef' on improper arguments
8704 # 1 otherwise
8705  
8706 my ($self, $slWidget, $columns, $check) = @_;
8707  
8708 # Local variables
8709 my @dataList;
8710  
8711 # Check for improper arguments
8712 if (! defined $slWidget || ! defined $columns || defined $check) {
8713  
8714 return $axmud::CLIENT->writeImproper(
8715 $self->_objClass . '->workspaces4Tab_refreshList',
8716 @_,
8717 );
8718 }
8719  
8720 # Compile the simple list data
8721 foreach my $number (sort {$a <=> $b} ($axmud::CLIENT->ivKeys('initWorkspaceHash'))) {
8722  
8723 my $zonemap = $axmud::CLIENT->ivShow('initWorkspaceHash', $number);
8724 if (! defined $zonemap) {
8725  
8726 $zonemap = '(default zonemap)';
8727 }
8728  
8729 push (@dataList,
8730 $number,
8731 $zonemap,
8732 );
8733 }
8734  
8735 # Reset the simple list
8736 $self->resetListData($slWidget, [@dataList], $columns);
8737  
8738 return 1;
8739 }
8740  
8741 sub workspaces5Tab {
8742  
8743 # Workspaces5 tab
8744 #
8745 # Expected arguments
8746 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
8747 #
8748 # Return values
8749 # 'undef' on improper arguments
8750 # 1 otherwise
8751  
8752 my ($self, $innerNotebook, $check) = @_;
8753  
8754 # Check for improper arguments
8755 if (! defined $innerNotebook || defined $check) {
8756  
8757 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces5Tab', @_);
8758 }
8759  
8760 # Tab setup
8761 my $grid = $self->addTab('Page _5', $innerNotebook);
8762  
8763 # General workspace grid settings
8764 $self->addLabel($grid, '<b>General workspace grid settings</b>',
8765 0, 12, 0, 1);
8766  
8767 $self->addLabel($grid, 'Gridblock size (pixels)',
8768 1, 3, 1, 2);
8769 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 1, 100,
8770 3, 6, 1, 2, 4, 4);
8771 $entry->set_text($axmud::CLIENT->gridBlockSize);
8772  
8773 my $button = $self->addButton($grid, 'Set size', 'Set the standard gridblock size', undef,
8774 6, 9, 1, 2);
8775 $button->signal_connect('clicked' => sub {
8776  
8777 if ($self->checkEntryIcon($entry)) {
8778  
8779 # Set gridblock size
8780 $self->session->pseudoCmd(
8781 'setgrid -b ' . $entry->get_text(),
8782 $self->pseudoCmdMode,
8783 );
8784  
8785 # Update the entry box
8786 $entry->set_text($axmud::CLIENT->gridBlockSize);
8787 }
8788 });
8789  
8790 my $button2 = $self->addButton(
8791 $grid, 'Reset size', 'Reset the standard gridblock size', undef,
8792 9, 12, 1, 2);
8793 $button2->signal_connect('clicked' => sub {
8794  
8795 # Reset gridblock size
8796 $self->session->pseudoCmd('setgrid -b', $self->pseudoCmdMode);
8797  
8798 # Update the entry box
8799 $entry->set_text($axmud::CLIENT->gridBlockSize);
8800 });
8801  
8802 $self->addLabel($grid, 'Max grid gap (gridblocks)',
8803 1, 3, 2, 3);
8804 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 100,
8805 3, 6, 2, 3, 4, 4);
8806 $entry2->set_text($axmud::CLIENT->gridGapMaxSize);
8807  
8808 my $button3 = $self->addButton($grid,
8809 'Set size',
8810 'Set the maximum size of the gap in the grid that is automatically filled in',
8811 undef,
8812 6, 9, 2, 3);
8813 $button3->signal_connect('clicked' => sub {
8814  
8815 if ($self->checkEntryIcon($entry2)) {
8816  
8817 # Set the max grid gap size
8818 $self->session->pseudoCmd(
8819 'setgrid -g ' . $entry2->get_text(),
8820 $self->pseudoCmdMode,
8821 );
8822  
8823 # Update the entry box
8824 $entry2->set_text($axmud::CLIENT->gridGapMaxSize);
8825 }
8826 });
8827  
8828 my $button4 = $self->addButton($grid,
8829 'Reset size',
8830 'Reset the maximum size of the gap in the grid that is automatically filled in',
8831 undef,
8832 9, 12, 2, 3);
8833 $button4->signal_connect('clicked' => sub {
8834  
8835 # Reset max grid gap size
8836 $self->session->pseudoCmd('setgrid -g', $self->pseudoCmdMode);
8837  
8838 # Update the entry box
8839 $entry2->set_text($axmud::CLIENT->gridBlockSize);
8840 });
8841  
8842 my $checkButton = $self->addCheckButton(
8843 $grid, 'Workspace grids activated in general', undef, FALSE,
8844 1, 6, 3, 4);
8845 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
8846  
8847 my $button5 = $self->addButton(
8848 $grid,
8849 'Activate grids',
8850 'Actcvate workspace grids in general',
8851 undef,
8852 6, 9, 3, 4);
8853 $button5->signal_connect('clicked' => sub {
8854  
8855 $self->session->pseudoCmd('activategrid', $self->pseudoCmdMode);
8856  
8857 # Update widgets
8858 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
8859 });
8860  
8861 my $button6 = $self->addButton(
8862 $grid,
8863 'Disactivate grids',
8864 'Disactivate workspace grids in general',
8865 undef,
8866 9, 12, 3, 4);
8867 $button6->signal_connect('clicked' => sub {
8868  
8869 $self->session->pseudoCmd('disactivategrid', $self->pseudoCmdMode);
8870  
8871 # Update widgets
8872 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
8873 });
8874  
8875 my $checkButton2 = $self->addCheckButton(
8876 $grid, 'Enable grid adjustment (fill small gaps)', undef, TRUE,
8877 1, 6, 5, 6);
8878 $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag);
8879 $checkButton2->signal_connect('toggled' => sub {
8880  
8881 my $flag = $checkButton2->get_active();
8882 if (! $flag) {
8883 $flag = 0;
8884 } else {
8885 $flag = 1;
8886 }
8887  
8888 # Toggle grid adjustment
8889 $self->session->pseudoCmd('setgrid -a ' . $flag);
8890  
8891 # Update the checkbutton
8892 $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag);
8893 });
8894  
8895 my $checkButton3 = $self->addCheckButton(
8896 $grid, 'Enable edge correction (edge of desktop)', undef, TRUE,
8897 1, 6, 6, 7);
8898 $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag);
8899 $checkButton3->signal_connect('toggled' => sub {
8900  
8901 my $flag = $checkButton3->get_active();
8902 if (! $flag) {
8903 $flag = 0;
8904 } else {
8905 $flag = 1;
8906 }
8907  
8908 # Toggle edge correction
8909 $self->session->pseudoCmd('setgrid -e ' . $flag);
8910  
8911 # Update the checkbutton
8912 $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag);
8913 });
8914  
8915 my $checkButton4 = $self->addCheckButton(
8916 $grid, 'Enable window reshuffling', undef, TRUE,
8917 1, 6, 7, 8);
8918 $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag);
8919 $checkButton4->signal_connect('toggled' => sub {
8920  
8921 my $flag = $checkButton4->get_active();
8922 if (! $flag) {
8923 $flag = 0;
8924 } else {
8925 $flag = 1;
8926 }
8927  
8928 # Toggle window reshuffling
8929 $self->session->pseudoCmd('setgrid -r ' . $flag);
8930  
8931 # Update the checkbutton
8932 $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag);
8933 });
8934  
8935 my $checkButton5 = $self->addCheckButton(
8936 $grid, 'Enable hiding of other session\'s windows', undef, TRUE,
8937 1, 6, 8, 9);
8938 $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag);
8939 $checkButton5->signal_connect('toggled' => sub {
8940  
8941 my $flag = $checkButton5->get_active();
8942 if (! $flag) {
8943 $flag = 0;
8944 } else {
8945 $flag = 1;
8946 }
8947  
8948 # Toggle window reshuffling
8949 $self->session->pseudoCmd('setgrid -i ' . $flag);
8950  
8951 # Update the checkbutton
8952 $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag);
8953 });
8954  
8955 # Tab complete
8956 return 1;
8957 }
8958  
8959 sub workspaces6Tab {
8960  
8961 # workspaces6 tab
8962 #
8963 # Expected arguments
8964 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
8965 #
8966 # Return values
8967 # 'undef' on improper arguments
8968 # 1 otherwise
8969  
8970 my ($self, $innerNotebook, $check) = @_;
8971  
8972 # Local variables
8973 my (
8974 $allString, $defaultString,
8975 @columnList, @emptyList,
8976 );
8977  
8978 # Check for improper arguments
8979 if (! defined $innerNotebook || defined $check) {
8980  
8981 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces6Tab', @_);
8982 }
8983  
8984 # Tab setup
8985 my $grid = $self->addTab('Page _6', $innerNotebook);
8986  
8987 # Workspace grids
8988 $self->addLabel($grid, '<b>Workspace grids</b>',
8989 0, 12, 0, 1);
8990 $self->addLabel($grid,
8991 '<i>List of workspace grids on which \'grid\' windows are arranged</i>',
8992 1, 6, 1, 2);
8993 my $checkButton = $self->addCheckButton(
8994 $grid, 'Grids are activated in general', undef, FALSE,
8995 8, 12, 1, 2);
8996 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
8997  
8998 # Add a simple list
8999 @columnList = (
9000 'Workspace', 'int',
9001 'Grid num', 'int',
9002 'Session', 'text',
9003 'Zonemap', 'text',
9004 'Layers', 'int',
9005 'Max', 'int',
9006 'No. zones', 'int',
9007 'No. windows', 'int',
9008 );
9009  
9010 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
9011 1, 12, 2, 9);
9012  
9013 # Initialise the list
9014 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9015  
9016 # Add editing widgets
9017 $self->addLabel($grid, 'Workspace:',
9018 1, 3, 9, 10);
9019 my $combo = $self->addComboBox($grid, undef, \@emptyList, '',
9020 TRUE, # No 'undef' value used
9021 3, 6, 9, 10);
9022 $allString = '(all workspaces)';
9023 $self->workspaces6Tab_resetCombo($combo, $allString);
9024  
9025 $self->addLabel($grid, 'Default zonemap:',
9026 6, 9, 9, 10);
9027 my $combo2 = $self->addComboBox($grid, undef, \@emptyList, '',
9028 TRUE, # No 'undef' value used
9029 9, 12, 9, 10);
9030 $defaultString = '(' . $axmud::SCRIPT . ' chooses a zonemap)';
9031 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9032  
9033 my $button = $self->addButton(
9034 $grid,
9035 'Activate grids',
9036 'Activate workspace grid(s) on the specified workspace using the specified default'
9037 . ' zonemap',
9038 undef,
9039 1, 3, 10, 11);
9040 $button->signal_connect('clicked' => sub {
9041  
9042 my ($cmd, $number, $zonemap);
9043  
9044 $cmd = 'activategrid';
9045  
9046 $number = $combo->get_active_text();
9047 if ($number ne $allString) {
9048  
9049 $cmd .= ' ' . $number;
9050 }
9051  
9052 $zonemap = $combo2->get_active_text();
9053 if ($zonemap ne $defaultString) {
9054  
9055 $cmd .= ' -z ' . $zonemap;
9056 }
9057  
9058 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
9059  
9060 # Refresh the list
9061 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9062 # Update widgets
9063 $self->workspaces6Tab_resetCombo($combo, $allString);
9064 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9065 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
9066 });
9067  
9068 my $button2 = $self->addButton(
9069 $grid,
9070 'Disactivate grids',
9071 'Disactivate workspace grid(s) on the specified workspace',
9072 undef,
9073 3, 6, 10, 11);
9074 $button2->signal_connect('clicked' => sub {
9075  
9076 my ($cmd, $number);
9077  
9078 $cmd = 'disactivategrid';
9079  
9080 $number = $combo->get_active_text();
9081 if ($number ne $allString) {
9082  
9083 $cmd .= ' ' . $number;
9084 }
9085  
9086 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
9087  
9088 # Refresh the list
9089 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9090 # Update widgets
9091 $self->workspaces6Tab_resetCombo($combo, $allString);
9092 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9093 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
9094 });
9095  
9096 my $button3 = $self->addButton(
9097 $grid,
9098 'Reset selected grids',
9099 'Reset selected workspace grid using the specified default zonemap',
9100 undef,
9101 6, 10, 10, 11);
9102 $button3->signal_connect('clicked' => sub {
9103  
9104 my ($number, $cmd, $zonemap);
9105  
9106 ($number) = $self->getSimpleListData($slWidget, 1);
9107 if (defined $number) {
9108  
9109 $cmd = 'resetgrid ' . $number;
9110  
9111 $zonemap = $combo2->get_active_text();
9112 if ($zonemap ne $defaultString) {
9113  
9114 $cmd .= ' ' . $zonemap;
9115 }
9116  
9117 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
9118 }
9119  
9120 # Refresh the list
9121 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9122 # Update widgets
9123 $self->workspaces6Tab_resetCombo($combo, $allString);
9124 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9125 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
9126 });
9127  
9128 my $button4 = $self->addButton(
9129 $grid,
9130 'Reset grids',
9131 'Reset workspace grid(s) on the specified workspace using the specified default'
9132 . ' zonemap',
9133 undef,
9134 10, 12, 10, 11);
9135 $button4->signal_connect('clicked' => sub {
9136  
9137 my ($cmd, $number, $zonemap);
9138  
9139 $cmd = 'resetgrid';
9140  
9141 $number = $combo->get_active_text();
9142 if (defined $number) {
9143  
9144 if ($number eq $allString) {
9145 $cmd .= ' -s';
9146 } else {
9147 $cmd .= ' -w ' . $number;
9148 }
9149  
9150 $zonemap = $combo2->get_active_text();
9151 if ($zonemap ne $defaultString) {
9152  
9153 $cmd .= ' ' . $zonemap;
9154 }
9155  
9156 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
9157 }
9158  
9159 # Refresh the list
9160 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9161 # Update widgets
9162 $self->workspaces6Tab_resetCombo($combo, $allString);
9163 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9164 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
9165 });
9166  
9167 my $button5 = $self->addButton(
9168 $grid,
9169 'View selected grid...',
9170 'View settings for the selected workspace grid',
9171 undef,
9172 6, 10, 11, 12);
9173 $button5->signal_connect('clicked' => sub {
9174  
9175 my ($number, $obj);
9176  
9177 ($number) = $self->getSimpleListData($slWidget, 1);
9178 if (defined $number) {
9179  
9180 $obj = $axmud::CLIENT->desktopObj->ivShow('gridHash', $number);
9181 if ($obj) {
9182  
9183 # Open an 'edit' window to edit the workspace grid
9184 $self->createFreeWin(
9185 'Games::Axmud::EditWin::WorkspaceGrid',
9186 $self,
9187 $self->session,
9188 'Edit workspace grid #' . $number,
9189 $obj,
9190 FALSE, # Not temporary
9191 );
9192 }
9193 }
9194 });
9195  
9196 my $button6 = $self->addButton(
9197 $grid,
9198 'Refresh list',
9199 'Refresh the list of workspace grids',
9200 undef,
9201 10, 12, 11, 12);
9202 $button6->signal_connect('clicked' => sub {
9203  
9204 # Refresh the list
9205 $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
9206 # Update widgets
9207 $self->workspaces6Tab_resetCombo($combo, $allString);
9208 $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
9209 $checkButton->set_active($axmud::CLIENT->activateGridFlag);
9210 });
9211  
9212 # Tab complete
9213 return 1;
9214 }
9215  
9216 sub workspaces6Tab_refreshList {
9217  
9218 # Called by $self->workspaces6Tab to refresh the first GA::Obj::SimpleList
9219 #
9220 # Expected arguments
9221 # $slWidget - The GA::Obj::SimpleList
9222 # $columns - The number of columns in the list
9223 #
9224 # Return values
9225 # 'undef' on improper arguments
9226 # 1 otherwise
9227  
9228 my ($self, $slWidget, $columns, $check) = @_;
9229  
9230 # Local variables
9231 my @dataList;
9232  
9233 # Check for improper arguments
9234 if (! defined $slWidget || ! defined $columns || defined $check) {
9235  
9236 return $axmud::CLIENT->writeImproper(
9237 $self->_objClass . '->workspaces6Tab_refreshList',
9238 @_,
9239 );
9240 }
9241  
9242 # Compile the simple list data
9243 foreach my $obj (
9244 sort {
9245 if ($a->workspaceObj->number != $b->workspaceObj->number) {
9246 return $a->workspaceObj->number <=> $b->workspaceObj->number;
9247 } else {
9248 return $a->number <=> $b->number;
9249 }
9250 }
9251 ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
9252 ) {
9253 my $string;
9254  
9255 if ($obj->owner) {
9256 $string = $obj->owner->number;
9257 } else {
9258 $string = '(shared)';
9259 }
9260  
9261 push (@dataList,
9262 $obj->workspaceObj->number,
9263 $obj->number,
9264 $string,
9265 $obj->zonemap,
9266 $obj->currentLayer,
9267 $obj->maxLayers,
9268 $obj->ivPairs('zoneHash'),
9269 $obj->ivPairs('gridWinHash'),
9270 );
9271 }
9272  
9273 # Reset the simple list
9274 $self->resetListData($slWidget, [@dataList], $columns);
9275  
9276 return 1;
9277 }
9278  
9279 sub workspaces6Tab_resetCombo {
9280  
9281 # Called by $self->workspaces6Tab to reset the contents of the first combobox
9282 #
9283 # Expected arguments
9284 # $combo - The combobox whose contents should be reset
9285 # $title - The title used in the combobox
9286 #
9287 # Return values
9288 # 'undef' on improper arguments
9289 # 1 otherwise
9290  
9291 my ($self, $combo, $title, $check) = @_;
9292  
9293 # Local variables
9294 my @comboList;
9295  
9296 # Check for improper arguments
9297 if (! defined $combo || ! defined $title || defined $check) {
9298  
9299 return $axmud::CLIENT->writeImproper(
9300 $self->_objClass . '->workspaces6Tab_resetCombo',
9301 @_,
9302 );
9303 }
9304  
9305 # Compile a list of combobox items
9306 @comboList = sort {$a <=> $b} ($axmud::CLIENT->desktopObj->ivKeys('workspaceHash'));
9307 unshift (@comboList, $title);
9308  
9309 # Reset the combobox
9310 $self->resetComboBox($combo, @comboList);
9311  
9312 return 1;
9313 }
9314  
9315 sub workspaces6Tab_resetCombo2 {
9316  
9317 # Called by $self->workspaces6Tab to reset the contents of the second combobox
9318 #
9319 # Expected arguments
9320 # $combo - The combobox whose contents should be reset
9321 # $title - The title used in the combobox
9322 #
9323 # Return values
9324 # 'undef' on improper arguments
9325 # 1 otherwise
9326  
9327 my ($self, $combo, $title, $check) = @_;
9328  
9329 # Local variables
9330 my @comboList;
9331  
9332 # Check for improper arguments
9333 if (! defined $combo || ! defined $title || defined $check) {
9334  
9335 return $axmud::CLIENT->writeImproper(
9336 $self->_objClass . '->workspaces6Tab_resetCombo2',
9337 @_,
9338 );
9339 }
9340  
9341 # Compile a list of combobox items
9342 @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
9343 unshift (@comboList, $title);
9344  
9345 # Reset the combobox
9346 $self->resetComboBox($combo, @comboList);
9347  
9348 return 1;
9349 }
9350  
9351 sub workspaces7Tab {
9352  
9353 # Workspaces7 tab
9354 #
9355 # Expected arguments
9356 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
9357 #
9358 # Return values
9359 # 'undef' on improper arguments
9360 # 1 otherwise
9361  
9362 my ($self, $innerNotebook, $check) = @_;
9363  
9364 # Local variables
9365 my @columnList;
9366  
9367 # Check for improper arguments
9368 if (! defined $innerNotebook || defined $check) {
9369  
9370 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces7Tab', @_);
9371 }
9372  
9373 # Tab setup
9374 my $grid = $self->addTab('Page _7', $innerNotebook);
9375  
9376 # Zonemaps
9377 $self->addLabel($grid, '<b>Zonemaps</b>',
9378 0, 12, 0, 1);
9379 $self->addLabel($grid,
9380 '<i>List of zonemaps, which divide a workspace grid into distinct zones</i>',
9381 1, 12, 1, 2);
9382  
9383 # Add a simple list
9384 @columnList = (
9385 'Name', 'text',
9386 'Standard', 'bool',
9387 'Full', 'bool',
9388 'Temporary', 'bool',
9389 'Number of zone models', 'int',
9390 );
9391  
9392 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
9393 1, 12, 2, 9);
9394  
9395 # Initialise the list
9396 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9397  
9398 # Add entry boxes and editing buttons
9399 $self->addLabel($grid, 'Name',
9400 1, 2, 9, 10);
9401 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
9402 2, 5, 9, 10, 16, 16);
9403 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
9404 7, 10, 9, 10, 16, 16);
9405  
9406 my $button = $self->addButton($grid, 'Add', 'Add the specified zonemap', undef,
9407 5, 7, 9, 10);
9408 $button->signal_connect('clicked' => sub {
9409  
9410 my $name = $entry->get_text();
9411  
9412 if ($self->checkEntryIcon($entry)) {
9413  
9414 # Add this zonemap
9415 $self->session->pseudoCmd('addzonemap ' . $name, $self->pseudoCmdMode);
9416  
9417 # Refresh the simple list and entry boxes
9418 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9419 $self->resetEntryBoxes($entry, $entry2);
9420 }
9421 });
9422  
9423 my $button2 = $self->addButton($grid,
9424 'Clone', 'Clone the selected zonemap as a copy with this name', undef,
9425 10, 12, 9, 10);
9426 $button2->signal_connect('clicked' => sub {
9427  
9428 my ($zonemap, $clone);
9429  
9430 ($zonemap) = $self->getSimpleListData($slWidget, 0);
9431 $clone = $entry2->get_text();
9432  
9433 if (defined $zonemap && $self->checkEntryIcon($entry2)) {
9434  
9435 # Clone the zonemap
9436 $self->session->pseudoCmd(
9437 'clonezonemap ' . $zonemap . ' ' . $clone,
9438 $self->pseudoCmdMode,
9439 );
9440  
9441 # Refresh the simple list and reset entry boxes
9442 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9443 $self->resetEntryBoxes($entry, $entry2);
9444 }
9445 });
9446  
9447 my $button3 = $self->addButton($grid, 'Edit...', 'Edit the selected zonemap', undef,
9448 3, 5, 10, 11);
9449 $button3->signal_connect('clicked' => sub {
9450  
9451 my ($zonemap, $obj, $childWinObj);
9452  
9453 ($zonemap) = $self->getSimpleListData($slWidget, 0);
9454 if (defined $zonemap) {
9455  
9456 $obj = $axmud::CLIENT->ivShow('zonemapHash', $zonemap);
9457 if ($obj) {
9458  
9459 # Open an 'edit' window to edit the zonemap
9460 $childWinObj = $self->createFreeWin(
9461 'Games::Axmud::EditWin::Zonemap',
9462 $self,
9463 $self->session,
9464 'Edit zonemap \'' . $zonemap . '\'',
9465 $obj,
9466 FALSE, # Not temporary
9467 );
9468  
9469 if ($childWinObj) {
9470  
9471 # When the 'edit' window closes, update widgets and/or IVs
9472 $self->add_childDestroy(
9473 $childWinObj,
9474 'workspaces7Tab_refreshList',
9475 [$slWidget, (scalar @columnList / 2)],
9476 );
9477 }
9478 }
9479 }
9480 });
9481  
9482 my $button4 = $self->addButton($grid, 'Delete', 'Delete the selected zonemap', undef,
9483 5, 7, 10, 11);
9484 $button4->signal_connect('clicked' => sub {
9485  
9486 my ($zonemap) = $self->getSimpleListData($slWidget, 0);
9487 if (defined $zonemap) {
9488  
9489 # Delete the zonemap
9490 $self->session->pseudoCmd('deletezonemap ' . $zonemap, $self->pseudoCmdMode);
9491  
9492 # Refresh the simple list and reset entry boxes
9493 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9494 $self->resetEntryBoxes($entry, $entry2);
9495 }
9496 });
9497  
9498 my $button5 = $self->addButton($grid,
9499 'Reset zonemap', 'Reset the selected zonemap, emptying its list of zone models', undef,
9500 7, 10, 10, 11);
9501 $button5->signal_connect('clicked' => sub {
9502  
9503 my ($zonemap) = $self->getSimpleListData($slWidget, 0);
9504 if (defined $zonemap) {
9505  
9506 # Reset the zonemap
9507 $self->session->pseudoCmd('resetzonemap ' . $zonemap, $self->pseudoCmdMode);
9508  
9509 # Refresh the simple list and reset entry boxes
9510 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9511 $self->resetEntryBoxes($entry, $entry2);
9512 }
9513 });
9514  
9515 my $button6 = $self->addButton($grid,
9516 'Reset list', 'Reset the list of zonemaps', undef,
9517 10, 12, 10, 11);
9518 $button6->signal_connect('clicked' => sub {
9519  
9520 # Refresh the simple list and reset entry boxes
9521 $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2));
9522 $self->resetEntryBoxes($entry, $entry2);
9523 });
9524  
9525 # Tab complete
9526 return 1;
9527 }
9528  
9529 sub workspaces7Tab_refreshList {
9530  
9531 # Called by $self->workspaces7Tab to refresh the GA::Obj::SimpleList
9532 #
9533 # Expected arguments
9534 # $slWidget - The GA::Obj::SimpleList
9535 # $columns - The number of columns in the list
9536 #
9537 # Return values
9538 # 'undef' on improper arguments
9539 # 1 otherwise
9540  
9541 my ($self, $slWidget, $columns, $check) = @_;
9542  
9543 # Local variables
9544 my (@sortedList, @dataList);
9545  
9546 # Check for improper arguments
9547 if (! defined $slWidget || ! defined $columns || defined $check) {
9548  
9549 return $axmud::CLIENT->writeImproper(
9550 $self->_objClass . '->workspaces7Tab_refreshList',
9551 @_,
9552 );
9553 }
9554  
9555 # Get a sorted list of zonemaps
9556 @sortedList
9557 = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('zonemapHash'));
9558  
9559 # Compile the simple list data
9560 foreach my $zonemapObj (@sortedList) {
9561  
9562 my ($standardFlag, $count);
9563  
9564 if ($axmud::CLIENT->ivExists('standardZonemapHash', $zonemapObj->name)) {
9565  
9566 $standardFlag = TRUE;
9567 }
9568  
9569 push (@dataList,
9570 $zonemapObj->name,
9571 $standardFlag,
9572 $zonemapObj->fullFlag,
9573 $zonemapObj->tempFlag,
9574 $zonemapObj->ivPairs('modelHash'),
9575 );
9576 }
9577  
9578 # Reset the simple list
9579 $self->resetListData($slWidget, [@dataList], $columns);
9580  
9581 return 1;
9582 }
9583  
9584 sub workspaces8Tab {
9585  
9586 # Workspaces8 tab
9587 #
9588 # Expected arguments
9589 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
9590 #
9591 # Return values
9592 # 'undef' on improper arguments
9593 # 1 otherwise
9594  
9595 my ($self, $innerNotebook, $check) = @_;
9596  
9597 # Local variables
9598 my @columnList;
9599  
9600 # Check for improper arguments
9601 if (! defined $innerNotebook || defined $check) {
9602  
9603 return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces8Tab', @_);
9604 }
9605  
9606 # Tab setup
9607 my $grid = $self->addTab('Page _8', $innerNotebook);
9608  
9609 # Window size/position storage
9610 $self->addLabel($grid, '<b>Window size/position storage</b>',
9611 0, 6, 0, 1);
9612  
9613 my $checkButton = $self->addCheckButton(
9614 $grid, 'Automatically store size/position of all \'grid\' windows', undef, TRUE,
9615 6, 12, 0, 1);
9616 $checkButton->set_active($axmud::CLIENT->storeGridPosnFlag);
9617 $checkButton->signal_connect('toggled' => sub {
9618  
9619 if (
9620 ($checkButton->get_active() && ! $axmud::CLIENT->storeGridPosnFlag)
9621 || (! $checkButton->get_active() && $axmud::CLIENT->storeGridPosnFlag)
9622 ) {
9623 $self->session->pseudoCmd('togglewindowstorage', $self->pseudoCmdMode);
9624 }
9625 });
9626  
9627 $self->addLabel($grid,
9628 '<i>List of stored \'grid\' window size/positions (used when workspace grids are'
9629 . ' disactivated)</i>',
9630 1, 12, 1, 2);
9631  
9632 # Add a simple list
9633 @columnList = (
9634 'Window name', 'text',
9635 'X', 'int',
9636 'Y', 'int',
9637 'Width', 'int',
9638 'Height', 'int',
9639 );
9640  
9641 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
9642 1, 12, 2, 10);
9643  
9644 # Initialise the list
9645 $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
9646  
9647 # Add editing widgets
9648 my $button = $self->addButton($grid,
9649 'Store current sizes/positions',
9650 'Store the sizes of this session\'s \'grid\' windows',
9651 undef,
9652 1, 4, 10, 11);
9653 $button->signal_connect('clicked' => sub {
9654  
9655 $axmud::CLIENT->desktopObj->storeGridWinPosn($self->session);
9656  
9657 # Refresh the simple list
9658 $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
9659 });
9660  
9661 my $button2 = $self->addButton($grid,
9662 'Clear selected', 'Clear the selected stored size/position', undef,
9663 4, 6, 10, 11);
9664 $button2->signal_connect('clicked' => sub {
9665  
9666 my ($winName) = $self->getSimpleListData($slWidget, 0);
9667 if (defined $winName) {
9668  
9669 $self->session->pseudoCmd(
9670 'clearwindowstorage <' . $winName . '>',
9671 $self->pseudoCmdMode,
9672 );
9673  
9674 # Refresh the simple list
9675 $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
9676 }
9677 });
9678  
9679 my $button3 = $self->addButton($grid,
9680 'Clear all', 'Clear all stored sizes/positions', undef,
9681 6, 8, 10, 11);
9682 $button3->signal_connect('clicked' => sub {
9683  
9684 $self->session->pseudoCmd('clearwindowstorage', $self->pseudoCmdMode);
9685  
9686 # Refresh the simple list
9687 $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
9688 });
9689  
9690 my $button4 = $self->addButton($grid,
9691 'Refresh list', 'Refresh the list of stored sizes/positions', undef,
9692 10, 12, 10, 11);
9693 $button4->signal_connect('clicked' => sub {
9694  
9695 # Refresh the simple list
9696 $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
9697 });
9698  
9699 # Tab complete
9700 return 1;
9701 }
9702  
9703 sub workspaces8Tab_refreshList {
9704  
9705 # Called by $self->workspaces8Tab to refresh the GA::Obj::SimpleList
9706 #
9707 # Expected arguments
9708 # $slWidget - The GA::Obj::SimpleList
9709 # $columns - The number of columns in the list
9710 #
9711 # Return values
9712 # 'undef' on improper arguments
9713 # 1 otherwise
9714  
9715 my ($self, $slWidget, $columns, $check) = @_;
9716  
9717 # Local variables
9718 my (
9719 @dataList,
9720 %ivHash,
9721 );
9722  
9723 # Check for improper arguments
9724 if (! defined $slWidget || ! defined $columns || defined $check) {
9725  
9726 return $axmud::CLIENT->writeImproper(
9727 $self->_objClass . '->workspaces8Tab_refreshList',
9728 @_,
9729 );
9730 }
9731  
9732 # Import the hash of stored sizes/positions
9733 %ivHash = $axmud::CLIENT->storeGridPosnHash;
9734  
9735 # Compile the simple list data
9736 foreach my $winName (sort {lc($a) cmp lc($b)} (keys %ivHash)) {
9737  
9738 my $listRef = $ivHash{$winName};
9739  
9740 push (@dataList,
9741 $winName,
9742 $$listRef[0],
9743 $$listRef[1],
9744 $$listRef[2],
9745 $$listRef[3],
9746 );
9747 }
9748  
9749 # Reset the simple list
9750 $self->resetListData($slWidget, [@dataList], $columns);
9751  
9752 return 1;
9753 }
9754  
9755 sub windowsTab {
9756  
9757 # Workspaces tab - called by $self->setupNotebook
9758 #
9759 # Expected arguments
9760 # (none besides $self)
9761 #
9762 # Return values
9763 # 'undef' on improper arguments
9764 # 1 otherwise
9765  
9766 my ($self, $check) = @_;
9767  
9768 # Check for improper arguments
9769 if (defined $check) {
9770  
9771 return $axmud::CLIENT->writeImproper($self->_objClass . '->windowsTab', @_);
9772 }
9773  
9774 # Tab setup
9775 # Create a notebook within the main one, so that we have two rows of tabs
9776 my $innerNotebook = $self->addInnerNotebookTab('W_indows', $self->notebook);
9777  
9778 # Add tabs to the inner notebook
9779 $self->windows1Tab($innerNotebook);
9780 $self->windows2Tab($innerNotebook);
9781 $self->windows3Tab($innerNotebook);
9782 $self->windows4Tab($innerNotebook);
9783 $self->windows5Tab($innerNotebook);
9784  
9785 return 1;
9786 }
9787  
9788 sub windows1Tab {
9789  
9790 # Windows1 tab
9791 #
9792 # Expected arguments
9793 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
9794 #
9795 # Return values
9796 # 'undef' on improper arguments
9797 # 1 otherwise
9798  
9799 my ($self, $innerNotebook, $check) = @_;
9800  
9801 # Local variables
9802 my @columnList;
9803  
9804 # Check for improper arguments
9805 if (! defined $innerNotebook || defined $check) {
9806  
9807 return $axmud::CLIENT->writeImproper($self->_objClass . '->windows1Tab', @_);
9808 }
9809  
9810 # Tab setup
9811 my $grid = $self->addTab('Page _1', $innerNotebook);
9812  
9813 # 'Grid' windows
9814 $self->addLabel($grid, '<b>\'Grid\' windows</b>',
9815 0, 13, 0, 1);
9816 $self->addLabel($grid, '<i>List of windows that can be arranged on a workspace grid</i>',
9817 1, 13, 1, 2);
9818  
9819 # Add a simple list
9820 @columnList = (
9821 '#', 'int',
9822 'Type', 'text',
9823 'Name', 'text',
9824 'Enab', 'bool',
9825 'Vis', 'bool',
9826 'Gtk', 'bool',
9827 'Wsp', 'int',
9828 'WGrd', 'text',
9829 'Sesn', 'text',
9830 'Zone', 'int',
9831 'Layer', 'int',
9832 'X/Y', 'text',
9833 'Wid/Hei', 'text',
9834 'Zone X/Y', 'text',
9835 'Wid/Hei', 'text',
9836 );
9837  
9838 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
9839 1, 13, 2, 8);
9840  
9841 # Refresh the list
9842 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
9843  
9844 # Add editing buttons
9845 my $button = $self->addButton($grid,
9846 'View...', 'View the selected window\'s settings', undef,
9847 1, 3, 8, 9);
9848 $button->signal_connect('clicked' => sub {
9849  
9850 my ($number, $winObj);
9851  
9852 ($number) = $self->getSimpleListData($slWidget, 0);
9853 if (defined $number) {
9854  
9855 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9856 if ($winObj) {
9857  
9858 # Open an 'edit' window for the selected 'grid' window
9859 $self->createFreeWin(
9860 'Games::Axmud::EditWin::Window',
9861 $self,
9862 $self->session,
9863 'Edit \'grid\' window #' . $number,
9864 $winObj,
9865 FALSE, # Not temporary
9866 );
9867 }
9868 }
9869  
9870 # Refresh the simple list
9871 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
9872 });
9873  
9874 my $button2 = $self->addButton($grid,
9875 'Restore', 'Restore the selected window to its allocated zone', undef,
9876 3, 5, 8, 9);
9877 $button2->signal_connect('clicked' => sub {
9878  
9879 my ($number, $winObj);
9880  
9881 ($number) = $self->getSimpleListData($slWidget, 0);
9882 if (defined $number) {
9883  
9884 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9885 if ($winObj) {
9886  
9887 # Restore the window
9888 $self->session->pseudoCmd('restorewindow ' . $number, $self->pseudoCmdMode);
9889 }
9890 }
9891  
9892 # Refresh the simple list
9893 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
9894 });
9895  
9896 my $button3 = $self->addButton($grid,
9897 'Restore all', 'Restore all windows to their allocated zones', undef,
9898 5, 7, 8, 9);
9899 $button3->signal_connect('clicked' => sub {
9900  
9901 # Restore all windows
9902 $self->session->pseudoCmd('restorewindow', $self->pseudoCmdMode);
9903  
9904 # Refresh the simple list and entry boxes
9905 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
9906 });
9907  
9908 my $button4 = $self->addButton($grid, 'Close', 'Close the selected window', undef,
9909 7, 9, 8, 9);
9910 $button4->signal_connect('clicked' => sub {
9911  
9912 my ($number, $winObj);
9913  
9914 ($number) = $self->getSimpleListData($slWidget, 0);
9915 if (defined $number) {
9916  
9917 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9918 if ($winObj) {
9919  
9920 # Close the window
9921 $self->session->pseudoCmd('closewindow ' . $number, $self->pseudoCmdMode);
9922 }
9923 }
9924  
9925 # Refresh the simple list
9926 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
9927 });
9928  
9929 my $button5 = $self->addButton($grid,
9930 'Fix', 'Fix the selected window in whichever zone it is currently located', undef,
9931 9, 11, 8, 9);
9932 $button5->signal_connect('clicked' => sub {
9933  
9934 my ($number, $winObj);
9935  
9936 ($number) = $self->getSimpleListData($slWidget, 0);
9937 if (defined $number) {
9938  
9939 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9940 if ($winObj) {
9941  
9942 # Fix the window
9943 $self->session->pseudoCmd('fixwindow ' . $number, $self->pseudoCmdMode);
9944 }
9945 }
9946  
9947 # Refresh the simple list
9948 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
9949 });
9950  
9951 my $button6 = $self->addButton(
9952 $grid,
9953 'Fix/Resize',
9954 'Fix the selected window in whichever zone it is currently located, and resize to fit'
9955 . ' if possible',
9956 undef,
9957 11, 13, 8, 9);
9958 $button6->signal_connect('clicked' => sub {
9959  
9960 my ($number, $winObj);
9961  
9962 ($number) = $self->getSimpleListData($slWidget, 0);
9963 if (defined $number) {
9964  
9965 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9966 if ($winObj) {
9967  
9968 # Fix/resize the window
9969 $self->session->pseudoCmd('fixwindow -r ' . $number, $self->pseudoCmdMode);
9970 }
9971 }
9972  
9973 # Refresh the simple list
9974 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
9975 });
9976  
9977 $self->addLabel($grid, 'Workspace',
9978 1, 2, 9, 10);
9979 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
9980 2, 5, 9, 10);
9981 $self->addLabel($grid, 'Zone',
9982 5, 6, 9, 10);
9983 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
9984 6, 9, 9, 10);
9985  
9986 my $button7 = $self->addButton($grid,
9987 'Move',
9988 'Move the selected window to the specified workspace and/or zone',
9989 undef,
9990 9, 11, 9, 10);
9991 $button7->signal_connect('clicked' => sub {
9992  
9993 my ($number, $winObj, $cmd);
9994  
9995 ($number) = $self->getSimpleListData($slWidget, 0);
9996 if (defined $number) {
9997  
9998 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
9999 if ($winObj) {
10000  
10001 $cmd = 'movewindow ' . $number;
10002  
10003 if ($self->checkEntryIcon($entry)) {
10004  
10005 # Use specified workspace
10006 $cmd .= ' ' . $entry->get_text();
10007  
10008 } else {
10009  
10010 # Use window's existing workspace
10011 $cmd .= ' ' . $winObj->workspaceObj->number;
10012 }
10013  
10014 if ($self->checkEntryIcon($entry2)) {
10015  
10016 $cmd .= ' ' . $entry2->get_text();
10017 }
10018  
10019 # Move the window and reset entry boxes
10020 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
10021 $self->resetEntryBoxes($entry, $entry2);
10022 }
10023 }
10024  
10025 # Refresh the simple list
10026 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
10027 $self->resetEntryBoxes($entry, $entry2);
10028 });
10029  
10030 my $button8 = $self->addButton(
10031 $grid,
10032 'Move/Resize',
10033 'Move the selected window to the specified workspace and/or zone, and resize'
10034 . ' if possible',
10035 undef,
10036 11, 13, 9, 10);
10037 $button8->signal_connect('clicked' => sub {
10038  
10039 my ($number, $winObj, $cmd);
10040  
10041 ($number) = $self->getSimpleListData($slWidget, 0);
10042 if (defined $number) {
10043  
10044 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
10045 if ($winObj) {
10046  
10047 $cmd = 'movewindow -r ' . $number;
10048  
10049 if ($self->checkEntryIcon($entry)) {
10050  
10051 # Use specified workspace
10052 $cmd .= ' ' . $entry->get_text();
10053  
10054 } else {
10055  
10056 # Use window's existing workspace
10057 $cmd .= ' ' . $winObj->workspaceObj->number;
10058 }
10059  
10060 if ($self->checkEntryIcon($entry2)) {
10061  
10062 $cmd .= ' ' . $entry2->get_text();
10063 }
10064  
10065 # Move the window and reset entry boxes
10066 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
10067 $self->resetEntryBoxes($entry, $entry2);
10068 }
10069 }
10070  
10071 # Refresh the simple list
10072 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
10073 });
10074  
10075 $self->addLabel($grid, 'Pattern',
10076 1, 2, 10, 11);
10077 my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
10078 2, 5, 10, 11);
10079 my $button9 = $self->addButton($grid,
10080 'Grab', 'Incorporate the first window matching the specified pattern (regex)', undef,
10081 5, 7, 10, 11);
10082 $button9->signal_connect('clicked' => sub {
10083  
10084 my $regex;
10085  
10086 if ($self->checkEntryIcon($entry3)) {
10087  
10088 $regex = $entry3->get_text();
10089  
10090 # Grab the window matching the regex
10091 $self->session->pseudoCmd(
10092 'grabwindow <' . $regex . '>',
10093 $self->pseudoCmdMode,
10094 );
10095  
10096 # Refresh the simple list and entry boxes
10097 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
10098 $self->resetEntryBoxes($entry3);
10099 }
10100 });
10101  
10102 my $button10 = $self->addButton($grid,
10103 'Grab All', 'Incorporate all windows matching the specified pattern (regex)', undef,
10104 7, 9, 10, 11);
10105 $button10->signal_connect('clicked' => sub {
10106  
10107 my $regex;
10108  
10109 if ($self->checkEntryIcon($entry3)) {
10110  
10111 $regex = $entry3->get_text();
10112  
10113 # Grab all windows matching the regex
10114 $self->session->pseudoCmd(
10115 'grabwindow -a <' . $regex . '>',
10116 $self->pseudoCmdMode,
10117 );
10118  
10119 # Refresh the simple list and entry boxes
10120 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
10121 $self->resetEntryBoxes($entry3);
10122 }
10123 });
10124  
10125 my $button11 = $self->addButton($grid,
10126 'Banish', 'Remove the selected external window from its workspace grid', undef,
10127 9, 11, 10, 11);
10128 $button11->signal_connect('clicked' => sub {
10129  
10130 my ($number, $winObj);
10131  
10132 ($number) = $self->getSimpleListData($slWidget, 0);
10133 if (defined $number) {
10134  
10135 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
10136 if ($winObj) {
10137  
10138  
10139 # Banish the external window
10140 $self->session->pseudoCmd('banishwindow ' . $number, $self->pseudoCmdMode);
10141 }
10142 }
10143  
10144 # Refresh the simple list
10145 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
10146 });
10147  
10148 my $button12 = $self->addButton($grid,
10149 'Banish all', 'Remove all external windows from their workspace grids', undef,
10150 11, 13, 10, 11);
10151 $button12->signal_connect('clicked' => sub {
10152  
10153 # Banish all external windows
10154 $self->session->pseudoCmd('banishwindow', $self->pseudoCmdMode);
10155  
10156 # Refresh the simple list
10157 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
10158 });
10159  
10160 $self->addLabel($grid, 'Window',
10161 1, 2, 11, 12);
10162 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
10163 2, 5, 11, 12);
10164 my $button13 = $self->addButton($grid,
10165 'Swap', 'Swap the selected window with the specified window', undef,
10166 5, 7, 11, 12);
10167 $button13->signal_connect('clicked' => sub {
10168  
10169 my ($number, $winObj, $swapNumber, $swapWinObj);
10170  
10171 ($number) = $self->getSimpleListData($slWidget, 0);
10172 if (defined $number) {
10173  
10174 $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
10175 if ($self->checkEntryIcon($entry4)) {
10176  
10177 $swapNumber = $entry4->get_text();
10178 $swapWinObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $swapNumber);
10179 }
10180  
10181 if ($winObj && $swapWinObj) {
10182  
10183 # Swap the two windows
10184 $self->session->pseudoCmd(
10185 'swapwindow ' . $number . ' ' . $swapNumber,
10186 $self->pseudoCmdMode,
10187 );
10188 }
10189 }
10190  
10191 # Refresh the simple list
10192 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
10193 });
10194  
10195 my $button14 = $self->addButton($grid,
10196 'Dump', 'Display this list of windows in the \'main\' window', undef,
10197 9, 11, 11, 12);
10198 $button14->signal_connect('clicked' => sub {
10199  
10200 # List windows
10201 $self->session->pseudoCmd('listwindow', $self->pseudoCmdMode);
10202  
10203 # Refresh the simple list
10204 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
10205 });
10206  
10207 my $button15 = $self->addButton($grid,
10208 'Refresh list', 'Refresh the list of windows', undef,
10209 11, 13, 11, 12);
10210 $button15->signal_connect('clicked' => sub {
10211  
10212 # Refresh the simple list and entry boxes
10213 $self->windows1Tab_refreshList($slWidget, scalar (@columnList / 2));
10214 });
10215  
10216 # Tab complete
10217 return 1;
10218 }
10219  
10220 sub windows1Tab_refreshList {
10221  
10222 # Called by $self->windows1Tab to refresh the GA::Obj::SimpleList
10223 #
10224 # Expected arguments
10225 # $slWidget - The GA::Obj::SimpleList
10226 # $columns - The number of columns in the list
10227 #
10228 # Optional arguments
10229 # $number - A 'grid' window number which should be selected in the list (if specified)
10230 #
10231 # Return values
10232 # 'undef' on improper arguments
10233 # 1 otherwise
10234  
10235 my ($self, $slWidget, $columns, $number, $check) = @_;
10236  
10237 # Local variables
10238 my (
10239 $count, $selectRow,
10240 @dataList,
10241 );
10242  
10243 # Check for improper arguments
10244 if (! defined $slWidget || ! defined $columns || defined $check) {
10245  
10246 return $axmud::CLIENT->writeImproper(
10247 $self->_objClass . '->windows1Tab_refreshList',
10248 @_,
10249 );
10250 }
10251  
10252 # Compile the simple list data
10253 $count = 0;
10254 foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins()) {
10255  
10256 my ($gtkFlag, $gridString, $sessionString, $areaObj);
10257  
10258 if ($winObj->winWidget) {
10259  
10260 $gtkFlag = TRUE;
10261 }
10262  
10263 if (! $winObj->workspaceGridObj) {
10264 $gridString = ('n/a');
10265 } else {
10266 $gridString = $winObj->workspaceGridObj->number;
10267 }
10268  
10269 if (! $winObj->session) {
10270 $sessionString = ('n/a');
10271 } else {
10272 $sessionString = $winObj->session->number;
10273 }
10274  
10275 push (@dataList,
10276 $winObj->number,
10277 $winObj->winType,
10278 $winObj->winName,
10279 $winObj->enabledFlag,
10280 $winObj->visibleFlag,
10281 $gtkFlag,
10282 $winObj->workspaceObj->number,
10283 $gridString,
10284 $sessionString,
10285 );
10286  
10287 $areaObj = $winObj->areaObj;
10288 if (! $areaObj) {
10289  
10290 push (@dataList, undef, undef, undef, undef, undef, undef);
10291  
10292 } else {
10293  
10294 push (@dataList,
10295 $areaObj->zoneObj->number,
10296 $areaObj->layer,
10297 $areaObj->xPosPixels . '/' . $areaObj->yPosPixels,
10298 $areaObj->widthPixels . '/' . $areaObj->heightPixels,
10299 $areaObj->leftBlocks . '/' . $areaObj->topBlocks,
10300 $areaObj->widthBlocks . '/' . $areaObj->heightBlocks,
10301 );
10302 }
10303  
10304 if (defined $number && $winObj->number eq $number) {
10305  
10306 $selectRow = $count;
10307 }
10308  
10309 $count++;
10310 }
10311  
10312 # Reset the simple list
10313 $self->resetListData($slWidget, [@dataList], $columns);
10314  
10315 # Select a row, if required
10316 if (defined $selectRow) {
10317  
10318 $slWidget->select($selectRow);
10319 }
10320  
10321 return 1;
10322 }
10323  
10324 sub windows2Tab {
10325  
10326 # Windows2 tab
10327 #
10328 # Expected arguments
10329 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
10330 #
10331 # Return values
10332 # 'undef' on improper arguments
10333 # 1 otherwise
10334  
10335 my ($self, $innerNotebook, $check) = @_;
10336  
10337 # Local variables
10338 my @columnList;
10339  
10340 # Check for improper arguments
10341 if (! defined $innerNotebook || defined $check) {
10342  
10343 return $axmud::CLIENT->writeImproper($self->_objClass . '->windows2Tab', @_);
10344 }
10345  
10346 # Tab setup
10347 my $grid = $self->addTab('Page _2', $innerNotebook);
10348  
10349 # 'Free' windows
10350 $self->addLabel($grid, '<b>\'Free\' windows</b>',
10351 0, 12, 0, 1);
10352 $self->addLabel(
10353 $grid,
10354 '<i>List of windows that can\'t be arranged on a workspace grid (doesn\'t include'
10355 . ' \'dialogue\' windows)</i>',
10356 1, 12, 1, 2);
10357  
10358 # Add a simple list
10359 @columnList = (
10360 '#', 'int',
10361 'Type', 'text',
10362 'Name', 'text',
10363 'Enab', 'bool',
10364 'Vis', 'bool',
10365 'Gtk', 'bool',
10366 'Wsp', 'int',
10367 'Sesn', 'int',
10368 );
10369  
10370 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
10371 1, 12, 2, 10);
10372  
10373 # Refresh the list
10374 $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
10375  
10376 # Add editing buttons
10377 my $button = $self->addButton($grid,
10378 'View...', 'View the selected window\'s settings', undef,
10379 1, 3, 10, 11);
10380 $button->signal_connect('clicked' => sub {
10381  
10382 my ($number, $winObj);
10383  
10384 ($number) = $self->getSimpleListData($slWidget, 0);
10385 if (defined $number) {
10386  
10387 $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number);
10388 if ($winObj) {
10389  
10390 # Open an 'edit' window for the selected 'free' window
10391 $self->createFreeWin(
10392 'Games::Axmud::EditWin::Window',
10393 $self,
10394 $self->session,
10395 'Edit \'free\' window #' . $number,
10396 $winObj,
10397 FALSE, # Not temporary
10398 );
10399 }
10400 }
10401  
10402 # Refresh the simple list
10403 $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
10404 });
10405  
10406 my $button2 = $self->addButton($grid, 'Close', 'Close the selected window', undef,
10407 3, 5, 10, 11);
10408 $button2->signal_connect('clicked' => sub {
10409  
10410 my ($number, $winObj);
10411  
10412 ($number) = $self->getSimpleListData($slWidget, 0);
10413 if (defined $number) {
10414  
10415 $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number);
10416 if ($winObj) {
10417  
10418 # Close the window
10419 $self->session->pseudoCmd('closefreewindow ' . $number, $self->pseudoCmdMode);
10420  
10421 if ($winObj ne $self) {
10422  
10423 # Refresh the simple list
10424 $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
10425 }
10426 }
10427 }
10428 });
10429  
10430 my $button14 = $self->addButton($grid,
10431 'Dump', 'Display this list of windows in the \'main\' window', undef,
10432 8, 10, 10, 11);
10433 $button14->signal_connect('clicked' => sub {
10434  
10435 # List windows
10436 $self->session->pseudoCmd('listfreewindow', $self->pseudoCmdMode);
10437  
10438 # Refresh the simple list
10439 $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
10440 });
10441  
10442 my $button15 = $self->addButton($grid,
10443 'Refresh list', 'Refresh the list of windows', undef,
10444 10, 12, 10, 11);
10445 $button15->signal_connect('clicked' => sub {
10446  
10447 # Refresh the simple list and entry boxes
10448 $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
10449 });
10450  
10451 # Tab complete
10452 return 1;
10453 }
10454  
10455 sub windows2Tab_refreshList {
10456  
10457 # Called by $self->windows2Tab to refresh the GA::Obj::SimpleList
10458 #
10459 # Expected arguments
10460 # $slWidget - The GA::Obj::SimpleList
10461 # $columns - The number of columns in the list
10462 #
10463 # Return values
10464 # 'undef' on improper arguments
10465 # 1 otherwise
10466  
10467 my ($self, $slWidget, $columns, $check) = @_;
10468  
10469 # Local variables
10470 my @dataList;
10471  
10472 # Check for improper arguments
10473 if (! defined $slWidget || ! defined $columns || defined $check) {
10474  
10475 return $axmud::CLIENT->writeImproper(
10476 $self->_objClass . '->windows2Tab_refreshList',
10477 @_,
10478 );
10479 }
10480  
10481 # Compile the simple list data
10482 foreach my $winObj ($axmud::CLIENT->desktopObj->listFreeWins()) {
10483  
10484 my ($gktFlag, $sessionString);
10485  
10486 if ($winObj->winWidget) {
10487  
10488 $gktFlag = TRUE;
10489 }
10490  
10491 if (! $winObj->session) {
10492 $sessionString = ('n/a');
10493 } else {
10494 $sessionString = $winObj->session->number;
10495 }
10496  
10497 push (@dataList,
10498 $winObj->number,
10499 $winObj->winType,
10500 $winObj->winName,
10501 $winObj->enabledFlag,
10502 $winObj->visibleFlag,
10503 $gktFlag,
10504 $winObj->workspaceObj->number,
10505 $sessionString,
10506 );
10507 }
10508  
10509 # Reset the simple list
10510 $self->resetListData($slWidget, [@dataList], $columns);
10511  
10512 return 1;
10513 }
10514  
10515 sub windows3Tab {
10516  
10517 # Windows3 tab
10518 #
10519 # Expected arguments
10520 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
10521 #
10522 # Return values
10523 # 'undef' on improper arguments
10524 # 1 otherwise
10525  
10526 my ($self, $innerNotebook, $check) = @_;
10527  
10528 # Local variables
10529 my @columnList;
10530  
10531 # Check for improper arguments
10532 if (! defined $innerNotebook || defined $check) {
10533  
10534 return $axmud::CLIENT->writeImproper($self->_objClass . '->windows3Tab', @_);
10535 }
10536  
10537 # Tab setup
10538 my $grid = $self->addTab('Page _3', $innerNotebook);
10539  
10540 # Winmaps
10541 $self->addLabel($grid, '<b>Winmaps</b>',
10542 0, 12, 0, 1);
10543 $self->addLabel($grid,
10544 '<i>List of winmaps, which determine the layout of \'internal\' windows when they are'
10545 . ' created</i>',
10546 1, 12, 1, 2);
10547  
10548 # Add a simple list
10549 @columnList = (
10550 'Name', 'text',
10551 'Strips', 'int',
10552 'Winzones', 'int',
10553 'Table full', 'bool',
10554 'Default \'main\'', 'bool',
10555 '\'main\', no grids', 'bool',
10556 'Default \'internal\'', 'bool',
10557 'Default for worlds', 'text',
10558 );
10559  
10560 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
10561 1, 12, 2, 8);
10562  
10563 # Initialise the list
10564 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10565  
10566 # Add entry boxes and editing buttons
10567 $self->addLabel($grid, 'Name',
10568 1, 3, 8, 9);
10569 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
10570 3, 5, 8, 9,
10571 16, 16);
10572 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
10573 7, 10, 8, 9,
10574 16, 16);
10575  
10576 my $button = $self->addButton($grid, 'Add', 'Add the specified winmap', undef,
10577 5, 7, 8, 9);
10578 $button->signal_connect('clicked' => sub {
10579  
10580 my $name = $entry->get_text();
10581  
10582 if ($self->checkEntryIcon($entry)) {
10583  
10584 # Add this zonemap
10585 $self->session->pseudoCmd('addwinmap ' . $name, $self->pseudoCmdMode);
10586  
10587 # Refresh the simple list and entry boxes
10588 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10589 $self->resetEntryBoxes($entry, $entry2);
10590 }
10591 });
10592  
10593 my $button2 = $self->addButton($grid,
10594 'Clone', 'Clone the selected zonemap as a copy with this name', undef,
10595 10, 12, 8, 9);
10596 $button2->signal_connect('clicked' => sub {
10597  
10598 my ($winmap, $clone);
10599  
10600 ($winmap) = $self->getSimpleListData($slWidget, 0);
10601 $clone = $entry2->get_text();
10602  
10603 if (defined $winmap && $self->checkEntryIcon($entry2)) {
10604  
10605 # Clone the winmap
10606 $self->session->pseudoCmd(
10607 'clonewinmap ' . $winmap . ' ' . $clone,
10608 $self->pseudoCmdMode,
10609 );
10610  
10611 # Refresh the simple list and reset entry boxes
10612 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10613 $self->resetEntryBoxes($entry, $entry2);
10614 }
10615 });
10616  
10617 my $button3 = $self->addButton($grid, 'Edit...', 'Edit the selected winmap', undef,
10618 1, 3, 9, 10);
10619 $button3->signal_connect('clicked' => sub {
10620  
10621 my ($winmap, $obj, $childWinObj);
10622  
10623 ($winmap) = $self->getSimpleListData($slWidget, 0);
10624 if (defined $winmap) {
10625  
10626 $obj = $axmud::CLIENT->ivShow('winmapHash', $winmap);
10627 if ($obj) {
10628  
10629 # Open an 'edit' window to edit the winmap
10630 $childWinObj = $self->createFreeWin(
10631 'Games::Axmud::EditWin::Winmap',
10632 $self,
10633 $self->session,
10634 'Edit winmap \'' . $winmap . '\'',
10635 $obj,
10636 FALSE, # Not temporary
10637 );
10638  
10639 if ($childWinObj) {
10640  
10641 # When the 'edit' window closes, update widgets and/or IVs
10642 $self->add_childDestroy(
10643 $childWinObj,
10644 'windows3Tab_refreshList',
10645 [$slWidget, (scalar @columnList / 2)],
10646 );
10647 }
10648 }
10649 }
10650 });
10651  
10652 my $button4 = $self->addButton($grid, 'Delete', 'Delete the selected winmap', undef,
10653 3, 5, 9, 10);
10654 $button4->signal_connect('clicked' => sub {
10655  
10656 my ($winmap) = $self->getSimpleListData($slWidget, 0);
10657 if (defined $winmap) {
10658  
10659 # Delete the winmap
10660 $self->session->pseudoCmd('deletewinmap ' . $winmap, $self->pseudoCmdMode);
10661  
10662 # Refresh the simple list and reset entry boxes
10663 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10664 $self->resetEntryBoxes($entry, $entry2);
10665 }
10666 });
10667  
10668 my $button5 = $self->addButton($grid,
10669 'Reset winmap', 'Reset the selected winmap, emptying its list of winzones', undef,
10670 8, 10, 9, 10);
10671 $button5->signal_connect('clicked' => sub {
10672  
10673 my ($winmap) = $self->getSimpleListData($slWidget, 0);
10674 if (defined $winmap) {
10675  
10676 # Reset the winmap
10677 $self->session->pseudoCmd('resetwinmap ' . $winmap, $self->pseudoCmdMode);
10678  
10679 # Refresh the simple list and reset entry boxes
10680 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10681 $self->resetEntryBoxes($entry, $entry2);
10682 }
10683 });
10684  
10685 my $button6 = $self->addButton($grid,
10686 'Reset list', 'Reset the list of winmaps', undef,
10687 10, 12, 9, 10);
10688 $button6->signal_connect('clicked' => sub {
10689  
10690 # Refresh the simple list and reset entry boxes
10691 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10692 $self->resetEntryBoxes($entry, $entry2);
10693 });
10694  
10695 my $button7 = $self->addButton($grid,
10696 'Set default \'main\' winmap when workspace grids activated',
10697 'Set the default winmap for \'main\' windows',
10698 undef,
10699 1, 8, 10, 11);
10700 $button7->signal_connect('clicked' => sub {
10701  
10702 my ($winmap) = $self->getSimpleListData($slWidget, 0);
10703 if (defined $winmap) {
10704  
10705 # Reset the default winmap
10706 $self->session->pseudoCmd('setdefaultwinmap -a ' . $winmap, $self->pseudoCmdMode);
10707 }
10708  
10709 # Refresh the simple list and reset entry boxes
10710 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10711 $self->resetEntryBoxes($entry, $entry2);
10712 });
10713  
10714 my $button8 = $self->addButton($grid,
10715 '...when workspace grids disactivated',
10716 'Set the default winmap for \'main\' windows',
10717 undef,
10718 8, 12, 10, 11);
10719 $button8->signal_connect('clicked' => sub {
10720  
10721 my ($winmap) = $self->getSimpleListData($slWidget, 0);
10722 if (defined $winmap) {
10723  
10724 # Reset the default winmap
10725 $self->session->pseudoCmd('setdefaultwinmap -d ' . $winmap, $self->pseudoCmdMode);
10726 }
10727  
10728 # Refresh the simple list and reset entry boxes
10729 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10730 $self->resetEntryBoxes($entry, $entry2);
10731 });
10732  
10733 my $button9 = $self->addButton($grid,
10734 'Set default \'internal\' winmap',
10735 'Set the default winmap for other \'internal\' windows',
10736 undef,
10737 1, 6, 11, 12);
10738 $button9->signal_connect('clicked' => sub {
10739  
10740 my ($winmap) = $self->getSimpleListData($slWidget, 0);
10741 if (defined $winmap) {
10742  
10743 # Reset the default winmap
10744 $self->session->pseudoCmd('setdefaultwinmap -g ' . $winmap, $self->pseudoCmdMode);
10745 }
10746  
10747 # Refresh the simple list and reset entry boxes
10748 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10749 $self->resetEntryBoxes($entry, $entry2);
10750 });
10751  
10752 my $button10 = $self->addButton(
10753 $grid,
10754 'Reset default winmaps',
10755 'Reset default winmaps for \'main\' and \'internal\' windows',
10756 undef,
10757 6, 12, 11, 12);
10758 $button10->signal_connect('clicked' => sub {
10759  
10760 # Reset default winmaps
10761 $self->session->pseudoCmd('setdefaultwinmap -r', $self->pseudoCmdMode);
10762  
10763 # Refresh the simple list and reset entry boxes
10764 $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
10765 $self->resetEntryBoxes($entry, $entry2);
10766 });
10767  
10768 # Tab complete
10769 return 1;
10770 }
10771  
10772 sub windows3Tab_refreshList {
10773  
10774 # Called by $self->windows3Tab to refresh the GA::Obj::SimpleList
10775 #
10776 # Expected arguments
10777 # $slWidget - The GA::Obj::SimpleList
10778 # $columns - The number of columns in the list
10779 #
10780 # Return values
10781 # 'undef' on improper arguments
10782 # 1 otherwise
10783  
10784 my ($self, $slWidget, $columns, $check) = @_;
10785  
10786 # Local variables
10787 my (@sortedList, @dataList);
10788  
10789 # Check for improper arguments
10790 if (! defined $slWidget || ! defined $columns || defined $check) {
10791  
10792 return $axmud::CLIENT->writeImproper(
10793 $self->_objClass . '->windows3Tab_refreshList',
10794 @_,
10795 );
10796 }
10797  
10798 # Get a sorted list of winmaps
10799 @sortedList = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('winmapHash'));
10800  
10801 # Compile the simple list data
10802 foreach my $winmapObj (@sortedList) {
10803  
10804 my ($string, $enabledFlag, $disabledFlag, $internalFlag);
10805  
10806 if ($winmapObj->worldHash) {
10807  
10808 $string = join(' ', sort {lc($a) cmp lc($b)} ($winmapObj->ivKeys('worldHash')));
10809 }
10810  
10811 if ($axmud::CLIENT->defaultEnabledWinmap eq $winmapObj->name) {
10812 $enabledFlag = TRUE;
10813 } else {
10814 $enabledFlag = FALSE;
10815 }
10816  
10817 if ($axmud::CLIENT->defaultDisabledWinmap eq $winmapObj->name) {
10818 $disabledFlag = TRUE;
10819 } else {
10820 $disabledFlag = FALSE;
10821 }
10822  
10823 if ($axmud::CLIENT->defaultInternalWinmap eq $winmapObj->name) {
10824 $internalFlag = TRUE;
10825 } else {
10826 $internalFlag = FALSE;
10827 }
10828  
10829 push (@dataList,
10830 $winmapObj->name,
10831 ($winmapObj->ivNumber('stripInitList') / 2),
10832 $winmapObj->ivPairs('zoneHash'),
10833 $winmapObj->fullFlag,
10834 $enabledFlag,
10835 $disabledFlag,
10836 $internalFlag,
10837 $string,
10838 );
10839 }
10840  
10841 # Reset the simple list
10842 $self->resetListData($slWidget, [@dataList], $columns);
10843  
10844 return 1;
10845 }
10846  
10847 sub windows4Tab {
10848  
10849 # Windows4 tab
10850 #
10851 # Expected arguments
10852 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
10853 #
10854 # Return values
10855 # 'undef' on improper arguments
10856 # 1 otherwise
10857  
10858 my ($self, $innerNotebook, $check) = @_;
10859  
10860 # Local variables
10861 my (
10862 $scriptDir, $posn, $shortPath,
10863 @buttonList, @columnList, @fileList,
10864 %buttonHash,
10865 );
10866  
10867 # Check for improper arguments
10868 if (! defined $innerNotebook || defined $check) {
10869  
10870 return $axmud::CLIENT->writeImproper($self->_objClass . '->windows4Tab', @_);
10871 }
10872  
10873 # Tab setup
10874 my $grid = $self->addTab('Page _4', $innerNotebook);
10875  
10876 # Import the IVs, so that the user can edit the list freely, without the changes becoming
10877 # permanent (until they use the 'Apply changes' button, of course)
10878 @buttonList = $axmud::CLIENT->toolbarList;
10879 %buttonHash = $axmud::CLIENT->toolbarHash;
10880  
10881 # Toolbar buttons
10882 $self->addLabel($grid, '<b>Toolbar buttons for \'internal\' windows</b>',
10883 0, 12, 0, 1);
10884  
10885 # Add a simple list
10886 @columnList = (
10887 '#', 'int',
10888 'Icon', 'pixbuf',
10889 'Name', 'text',
10890 'Custom', 'bool',
10891 'Description', 'text',
10892 'Instruction', 'text',
10893 );
10894  
10895 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
10896 1, 12, 1, 8);
10897  
10898 # Initialise the list
10899 $self->windows4Tab_refreshList(
10900 $slWidget,
10901 scalar (@columnList / 2),
10902 \@buttonList,
10903 \%buttonHash,
10904 );
10905  
10906 # Get a list of .png files in /icons/custom
10907 $scriptDir = $axmud::SHARE_DIR;
10908 if ($^O eq 'MSWin32') {
10909 @fileList = glob($scriptDir . '\\icons\\custom\\*.png');
10910 } else {
10911 @fileList = glob($scriptDir . '/icons/custom/*.png');
10912 }
10913  
10914 $posn = 0;
10915  
10916 # Add editing widgets
10917 my ($image, $frame, $viewPort) = $self->addImage($grid, $fileList[$posn], undef,
10918 FALSE, # Don't use a scrolled window
10919 24, 24,
10920 1, 3, 8, 10);
10921  
10922 my $button = $self->addButton($grid, '<<', 'Switch to previous icon', undef,
10923 3, 4, 8, 9);
10924 $button->set_hexpand(FALSE);
10925 $button->signal_connect('clicked' => sub {
10926  
10927 $posn--;
10928 if ($posn < 0) {
10929  
10930 $posn = (scalar @fileList) - 1;
10931 }
10932  
10933 # Change the displayed image
10934 my $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
10935 if ($newImage) {
10936  
10937 $shortPath = $fileList[$posn];
10938 if ($shortPath) {
10939  
10940 $shortPath =~ s/$scriptDir//;
10941 $image = $newImage;
10942 }
10943 }
10944 });
10945  
10946 $self->addLabel($grid, 'Name',
10947 4, 5, 8, 9);
10948 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
10949 5, 8, 8, 9);
10950 $self->addLabel($grid, 'Description',
10951 8, 9, 8, 9);
10952 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 32,
10953 9, 12, 8, 9);
10954  
10955 my $button2 = $self->addButton($grid, '>>', 'Switch to next icon', undef,
10956 3, 4, 9, 10);
10957 $button2->set_hexpand(FALSE);
10958 $button2->signal_connect('clicked' => sub {
10959  
10960 $posn++;
10961 if ($posn >= scalar @fileList) {
10962  
10963 $posn = 0;
10964 }
10965  
10966 # Change the displayed image, and store it as the current chat icon
10967 my $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
10968 if ($newImage) {
10969  
10970 $shortPath = $fileList[$posn];
10971 if ($shortPath) {
10972  
10973 $shortPath =~ s/$scriptDir//;
10974 $image = $newImage;
10975 }
10976 }
10977 });
10978  
10979 $self->addLabel($grid, 'Instruction',
10980 4, 5, 9, 10);
10981 my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
10982 5, 8, 9, 10);
10983  
10984 my $button3 = $self->addButton($grid, 'Add custom', 'Add a custom toolbar button', undef,
10985 8, 10, 9, 10);
10986 $button3->signal_connect('clicked' => sub {
10987  
10988 my ($name, $descrip, $instruct, $buttonObj);
10989  
10990 $name = $entry->get_text();
10991 $descrip = $entry2->get_text();
10992 $instruct = $entry3->get_text();
10993  
10994 if ($self->checkEntryIcon($entry, $entry2, $entry3) && $shortPath) {
10995  
10996 # Check a toolbar button with that name doesn't already exist
10997 if (exists $buttonHash{$name}) {
10998  
10999 $self->showMsgDialogue(
11000 'Add toolbar button',
11001 'error',
11002 'A toolbar button called \''. $name . '\' already exists',
11003 'ok',
11004 );
11005  
11006 } elsif (! $axmud::CLIENT->nameCheck($name, 16)) {
11007  
11008 $self->showMsgDialogue(
11009 'Add toolbar button',
11010 'error',
11011 'Registry naming error: invalid name \'' . $name . '\'',
11012 'ok',
11013 );
11014  
11015 } else {
11016  
11017 # Create a new toolbar button
11018 $buttonObj = Games::Axmud::Obj::Toolbar->new(
11019 $name,
11020 $descrip,
11021 TRUE, # Custom toolbar button
11022 $scriptDir . $shortPath,
11023 $instruct,
11024 TRUE, # Require current session
11025 TRUE, # Require connection
11026 );
11027  
11028 # Add the new toolbar button at the end of the list
11029 if ($buttonObj) {
11030  
11031 push (@buttonList, $name);
11032 $buttonHash{$name} = $buttonObj;
11033  
11034 # Refresh the simple list
11035 $self->windows4Tab_refreshList(
11036 $slWidget,
11037 scalar (@columnList / 2),
11038 \@buttonList,
11039 \%buttonHash,
11040 );
11041  
11042 # Reset the entry boxes
11043 $self->resetEntryBoxes($entry, $entry2, $entry3);
11044 }
11045 }
11046 }
11047 });
11048  
11049 my $button4 = $self->addButton(
11050 $grid,
11051 'Add separator',
11052 'Add a separator between toolbar button',
11053 undef,
11054 10, 12, 9, 10);
11055 $button4->signal_connect('clicked' => sub {
11056  
11057 # Add a separator to the list of toolbar buttons
11058 push (@buttonList, 'separator');
11059  
11060 # Refresh the simple list
11061 $self->windows4Tab_refreshList(
11062 $slWidget,
11063 scalar (@columnList / 2),
11064 \@buttonList,
11065 \%buttonHash,
11066 );
11067 });
11068  
11069 my $button5 = $self->addButton(
11070 $grid,
11071 'View / edit...',
11072 'View of edit the selected item',
11073 undef,
11074 1, 3, 10, 11);
11075 $button5->signal_connect('clicked' => sub {
11076  
11077 my ($posn, $name, $obj);
11078  
11079 ($posn) = $self->getSimpleListData($slWidget, 0);
11080 if (defined $posn) {
11081  
11082 # First item in list is numbered 1
11083 $posn--;
11084  
11085 $name = $buttonList[$posn];
11086 if ($name ne 'separator') {
11087  
11088 $obj = $buttonHash{$name};
11089  
11090 # Open an 'edit' window to edit the toolbar button
11091 $self->createFreeWin(
11092 'Games::Axmud::EditWin::Toolbar',
11093 $self,
11094 $self->session,
11095 'Edit toolbar button \'' . $name . '\'',
11096 $obj,
11097 FALSE, # Not temporary
11098 );
11099  
11100 # Refresh the simple list
11101 $self->windows4Tab_refreshList(
11102 $slWidget,
11103 scalar (@columnList / 2),
11104 \@buttonList,
11105 \%buttonHash,
11106 );
11107 }
11108 }
11109 });
11110  
11111 my $button6 = $self->addButton($grid, 'Move up', 'Move the selected item up', undef,
11112 3, 5, 10, 11);
11113 $button6->signal_connect('clicked' => sub {
11114  
11115 my ($posn, $item);
11116  
11117 ($posn) = $self->getSimpleListData($slWidget, 0);
11118 if (defined $posn && $posn > 1) {
11119  
11120 # First item in list is numbered 1
11121 $posn--;
11122  
11123 # Remove the selected item from the list
11124 $item = splice (@buttonList, $posn, 1);
11125 # Move it one place higher
11126 splice (@buttonList, ($posn - 1), 0, $item);
11127  
11128 # Refresh the simple list
11129 $self->windows4Tab_refreshList(
11130 $slWidget,
11131 scalar (@columnList / 2),
11132 \@buttonList,
11133 \%buttonHash,
11134 );
11135  
11136 # Re-select the item at its new position
11137 $slWidget->select($posn - 1);
11138 }
11139 });
11140  
11141 my $button7 = $self->addButton($grid, 'Move down', 'Move the selected item down', undef,
11142 5, 7, 10, 11);
11143 $button7->signal_connect('clicked' => sub {
11144  
11145 my ($posn, $item);
11146  
11147 ($posn) = $self->getSimpleListData($slWidget, 0);
11148 if (defined $posn && $posn < ((scalar @buttonList) - 1)) {
11149  
11150 # First item in list is numbered 1
11151 $posn--;
11152  
11153 # Remove the selected item from the list
11154 $item = splice (@buttonList, $posn, 1);
11155 # Move it one place lower
11156 splice (@buttonList, ($posn + 1), 0, $item);
11157  
11158 # Refresh the simple list
11159 $self->windows4Tab_refreshList(
11160 $slWidget,
11161 scalar (@columnList / 2),
11162 \@buttonList,
11163 \%buttonHash,
11164 );
11165  
11166 # Re-select the item at its new position
11167 $slWidget->select($posn + 1);
11168 }
11169 });
11170  
11171 my $button8 = $self->addButton(
11172 $grid, 'Delete', 'Remove the selected item from the list', undef,
11173 7, 8, 10, 11);
11174 $button8->signal_connect('clicked' => sub {
11175  
11176 my ($posn) = $self->getSimpleListData($slWidget, 0);
11177 if (defined $posn) {
11178  
11179 # First item in list is numbered 1
11180 $posn--;
11181  
11182 # Remove the selected item from the list
11183 splice (@buttonList, $posn, 1);
11184  
11185 # Refresh the simple list
11186 $self->windows4Tab_refreshList(
11187 $slWidget,
11188 scalar (@columnList / 2),
11189 \@buttonList,
11190 \%buttonHash,
11191 );
11192 }
11193 });
11194  
11195 my $button9 = $self->addButton(
11196 $grid, 'Reset buttons', 'Reset your changes to this list', undef,
11197 8, 10, 10, 11);
11198 $button9->signal_connect('clicked' => sub {
11199  
11200 # Re-import the IVs
11201 @buttonList = $axmud::CLIENT->toolbarList;
11202 %buttonHash = $axmud::CLIENT->toolbarHash;
11203  
11204 # Refresh the simple list
11205 $self->windows4Tab_refreshList(
11206 $slWidget,
11207 scalar (@columnList / 2),
11208 \@buttonList,
11209 \%buttonHash,
11210 );
11211 });
11212  
11213 my $button10 = $self->addButton(
11214 $grid, 'Refresh list', 'Refresh the list of toolbar buttons', undef,
11215 10, 12, 10, 11);
11216 $button10->signal_connect('clicked' => sub {
11217  
11218 # Refresh the simple list
11219 $self->windows4Tab_refreshList(
11220 $slWidget,
11221 scalar (@columnList / 2),
11222 \@buttonList,
11223 \%buttonHash,
11224 );
11225 });
11226  
11227 my $button11 = $self->addButton(
11228 $grid, 'Apply changes now', 'Apply changes to \'internal\' windows now', undef,
11229 7, 9, 11, 12);
11230 $button11->signal_connect('clicked' => sub {
11231  
11232 my $choice = $self->showMsgDialogue(
11233 'Apply changes',
11234 'question',
11235 'Are you sure you want to apply your changes now?',
11236 'yes-no',
11237 );
11238  
11239 if ($choice && $choice eq 'yes') {
11240  
11241 # Update the Client's IVs
11242 $axmud::CLIENT->set_toolbarHash(%buttonHash);
11243 $axmud::CLIENT->set_toolbarList(@buttonList);
11244  
11245 # Tell all 'internal' windows to re-draw their toolbar strip objects
11246 foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
11247  
11248 my $stripObj
11249 = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');
11250  
11251 if ($stripObj) {
11252  
11253 $stripObj->resetToolbar();
11254 }
11255 }
11256  
11257 # Refresh the simple list
11258 $self->windows4Tab_refreshList(
11259 $slWidget,
11260 scalar (@columnList / 2),
11261 \@buttonList,
11262 \%buttonHash,
11263 );
11264 }
11265 });
11266  
11267 my $button12 = $self->addButton(
11268 $grid, 'Use default buttons', 'Use the default set of toolbar buttons', undef,
11269 9, 12, 11, 12);
11270 $button12->signal_connect('clicked' => sub {
11271  
11272 my $choice = $self->showMsgDialogue(
11273 'Use default toolbar buttons',
11274 'question',
11275 'Are you sure you want to reset the toolbar? (Any custom buttons you\'ve created'
11276 . ' will be destroyed)',
11277 'yes-no',
11278 );
11279  
11280 if ($choice && $choice eq 'yes') {
11281  
11282 # Replace the contents of the client's IVs with the default values
11283 $axmud::CLIENT->initialiseToolbar();
11284 # Re-import the IVs
11285 @buttonList = $axmud::CLIENT->toolbarList;
11286 %buttonHash = $axmud::CLIENT->toolbarHash;
11287  
11288 # Tell all 'internal' windows to re-draw their toolbar strip objects
11289 foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
11290  
11291 my $stripObj
11292 = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');
11293  
11294 if ($stripObj) {
11295  
11296 $stripObj->resetToolbar();
11297 }
11298 }
11299  
11300 # Refresh the simple list
11301 $self->windows4Tab_refreshList(
11302 $slWidget,
11303 scalar (@columnList / 2),
11304 \@buttonList,
11305 \%buttonHash,
11306 );
11307 }
11308 });
11309  
11310 # Tab complete
11311 return 1;
11312 }
11313  
11314 sub windows4Tab_refreshList {
11315  
11316 # Called by $self->windows4Tab to refresh the GA::Obj::SimpleList
11317 #
11318 # Expected arguments
11319 # $slWidget - The GA::Obj::SimpleList
11320 # $columns - The number of columns in the list
11321 # $buttonListRef - Reference to a list containing a local copy of GA::Client->buttonList
11322 # $buttonHashRef - Reference to a hash containing a local copy of GA::Client->buttonHash
11323 #
11324 # Return values
11325 # 'undef' on improper arguments
11326 # 1 otherwise
11327  
11328 my ($self, $slWidget, $columns, $buttonListRef, $buttonHashRef, $check) = @_;
11329  
11330 # Local variables
11331 my (
11332 $count,
11333 @dataList,
11334 );
11335  
11336 # Check for improper arguments
11337 if (! defined $slWidget || ! defined $columns || defined $check) {
11338  
11339 return $axmud::CLIENT->writeImproper(
11340 $self->_objClass . '->windows4Tab_refreshList',
11341 @_,
11342 );
11343 }
11344  
11345 # Compile the simple list data
11346 $count = 0;
11347 foreach my $buttonName (@$buttonListRef) {
11348  
11349 my ($buttonObj, $path, $pixBuffer);
11350  
11351 $count++;
11352  
11353 if ($buttonName eq 'separator') {
11354  
11355 # Create a pixbuff for an icon which isn't used for built-in toolbar buttons
11356 $path = $axmud::SHARE_DIR . '/icons/main/separator.png';
11357 $pixBuffer = Gtk3::Gdk::Pixbuf->new_from_file($path);
11358 push (@dataList,
11359 $count,
11360 $pixBuffer,
11361 $buttonName,
11362 FALSE,
11363 '(Separator between buttons)',
11364 undef,
11365 );
11366  
11367 } else {
11368  
11369 # Get the GA::Obj::Toolbar
11370 $buttonObj = $$buttonHashRef{$buttonName};
11371  
11372 # Get the icon's file path
11373 if ($buttonObj->customFlag) {
11374 $path = $buttonObj->iconPath;
11375 } else {
11376 $path = $axmud::SHARE_DIR . '/icons/main/' . $buttonObj->iconPath;
11377 }
11378  
11379 # Create a pixbuff for the icon (unless the file doesn't exist)
11380 if (-e $path) {
11381  
11382 $pixBuffer = Gtk3::Gdk::Pixbuf->new_from_file($path);
11383 }
11384  
11385 push (@dataList,
11386 $count,
11387 $pixBuffer,
11388 $buttonName,
11389 $buttonObj->customFlag,
11390 $buttonObj->descrip,
11391 $buttonObj->instruct,
11392 );
11393 }
11394 }
11395  
11396 # Reset the simple list
11397 $self->resetListData($slWidget, [@dataList], $columns);
11398  
11399 return 1;
11400 }
11401  
11402 sub windows5Tab {
11403  
11404 # Windows5 tab
11405 #
11406 # Expected arguments
11407 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
11408 #
11409 # Return values
11410 # 'undef' on improper arguments
11411 # 1 otherwise
11412  
11413 my ($self, $innerNotebook, $check) = @_;
11414  
11415 # Local variables
11416 my @columnList;
11417  
11418 # Check for improper arguments
11419 if (! defined $innerNotebook || defined $check) {
11420  
11421 return $axmud::CLIENT->writeImproper($self->_objClass . '->windows5Tab', @_);
11422 }
11423  
11424 # Tab setup
11425 my $grid = $self->addTab('Page _5', $innerNotebook);
11426  
11427 # Textview objects
11428 $self->addLabel($grid, '<b>Textview objects</b>',
11429 0, 12, 0, 1);
11430 $self->addLabel($grid,
11431 '<i>List of textview objects, handling areas of the window where text is displayed</i>',
11432 1, 12, 1, 2);
11433  
11434 # Add a simple list
11435 @columnList = (
11436 'Num', 'int',
11437 'Ses', 'int',
11438 'Win', 'int',
11439 'Pane', 'int',
11440 'Lock', 'bool',
11441 'O/W', 'bool',
11442 'Split', 'text',
11443 'Wid', 'text',
11444 'Hei', 'text',
11445 'Scheme', 'text',
11446 'Mono', 'bool',
11447 'Text', 'text',
11448 'Undly', 'text',
11449 'Bckgrnd', 'text',
11450 'Font', 'text',
11451 );
11452  
11453 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
11454 1, 12, 2, 10);
11455  
11456 # Initialise the list
11457 $self->windows5Tab_refreshList($slWidget, scalar (@columnList / 2));
11458  
11459 # Add editing widgets
11460 $self->addLabel($grid, 'Size',
11461 1, 2, 10, 11);
11462 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
11463 2, 4, 10, 11);
11464 my $button = $self->addButton(
11465 $grid,
11466 'Set default size', 'Sets the default size for textview objects', undef,
11467 4, 6, 10, 11);
11468 $button->signal_connect('clicked' => sub {
11469  
11470 if ($self->checkEntryIcon($entry)) {
11471  
11472 $self->session->pseudoCmd(
11473 'settextview ' . $entry->get_text(),
11474 $self->pseudoCmdMode,
11475 );
11476 }
11477 });
11478  
11479 my $button2 = $self->addButton(
11480 $grid,
11481 'Reset default size', 'Resets the default size for textview objects', undef,
11482 6, 9, 10, 11);
11483 $button2->signal_connect('clicked' => sub {
11484  
11485 $self->session->pseudoCmd('settextview', $self->pseudoCmdMode);
11486 });
11487  
11488 my $button3 = $self->addButton(
11489 $grid,
11490 'Clear textview', 'Removes all text from the selected textview object', undef,
11491 9, 12, 10, 11);
11492 $button3->signal_connect('clicked' => sub {
11493  
11494 my ($number, $textViewObj);
11495  
11496 ($number) = $self->getSimpleListData($slWidget, 0);
11497 if (defined $number) {
11498  
11499 $textViewObj = $axmud::CLIENT->desktopObj->ivShow('textViewHash', $number);
11500 if ($textViewObj && $textViewObj->paneObj) {
11501  
11502 # Clear the textview of text
11503 $self->session->pseudoCmd('cleartextview -t ' . $number, $self->pseudoCmdMode);
11504 }
11505 }
11506  
11507 # Refresh the simple list and entry boxes
11508 $self->windows5Tab_refreshList($slWidget, scalar (@columnList / 2));
11509 });
11510  
11511 my $button4 = $self->addButton(
11512 $grid,
11513 'Dump', 'Display the list of textview objects in the \'main\' window', undef,
11514 8, 10, 11, 12);
11515 $button4->signal_connect('clicked' => sub {
11516  
11517 $self->session->pseudoCmd('listtextview', $self->pseudoCmdMode);
11518  
11519 # Refresh the simple list and entry boxes
11520 $self->windows5Tab_refreshList($slWidget, scalar (@columnList / 2));
11521 });
11522  
11523 my $button5 = $self->addButton(
11524 $grid,
11525 'Refresh', 'Refresh the list of textview objects', undef,
11526 10, 12, 11, 12);
11527 $button5->signal_connect('clicked' => sub {
11528  
11529 # Refresh the simple list and entry boxes
11530 $self->windows5Tab_refreshList($slWidget, scalar (@columnList / 2));
11531 });
11532  
11533 # Tab complete
11534 return 1;
11535 }
11536  
11537 sub windows5Tab_refreshList {
11538  
11539 # Called by $self->windows5Tab to refresh the GA::Obj::SimpleList
11540 #
11541 # Expected arguments
11542 # $slWidget - The GA::Obj::SimpleList
11543 # $columns - The number of columns in the list
11544 #
11545 # Return values
11546 # 'undef' on improper arguments
11547 # 1 otherwise
11548  
11549 my ($self, $slWidget, $columns, $check) = @_;
11550  
11551 # Local variables
11552 my @dataList;
11553  
11554 # Check for improper arguments
11555 if (! defined $slWidget || ! defined $columns || defined $check) {
11556  
11557 return $axmud::CLIENT->writeImproper(
11558 $self->_objClass . '->windows5Tab_refreshList',
11559 @_,
11560 );
11561 }
11562  
11563 # Compile the simple list data
11564 foreach my $textViewObj (
11565 sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('textViewHash'))
11566 ) {
11567 my $paneString;
11568  
11569 if ($textViewObj->paneObj) {
11570  
11571 $paneString = $textViewObj->paneObj->number;
11572 }
11573  
11574 push (@dataList,
11575 $textViewObj->number,
11576 $textViewObj->session->number,
11577 $textViewObj->winObj->number,
11578 $paneString,
11579 $textViewObj->scrollLockFlag,
11580 $textViewObj->overwriteFlag,
11581 $textViewObj->splitScreenMode,
11582 $textViewObj->textWidthChars,
11583 $textViewObj->textHeightChars,
11584 $textViewObj->colourScheme,
11585 $textViewObj->monochromeFlag,
11586 $textViewObj->textColour,
11587 $textViewObj->underlayColour,
11588 $textViewObj->backgroundColour,
11589 $textViewObj->font . ' ' . $textViewObj->fontSize,
11590 );
11591 }
11592  
11593 # Reset the simple list
11594 $self->resetListData($slWidget, [@dataList], $columns);
11595  
11596 return 1;
11597 }
11598  
11599 sub soundTab {
11600  
11601 # Sound tab - called by $self->setupNotebook
11602 #
11603 # Expected arguments
11604 # (none besides $self)
11605 #
11606 # Return values
11607 # 'undef' on improper arguments
11608 # 1 otherwise
11609  
11610 my ($self, $check) = @_;
11611  
11612 # Check for improper arguments
11613 if (defined $check) {
11614  
11615 return $axmud::CLIENT->writeImproper($self->_objClass . '->soundTab', @_);
11616 }
11617  
11618 # Tab setup
11619 # Create a notebook within the main one, so that we have two rows of tabs
11620 my $innerNotebook = $self->addInnerNotebookTab('So_und', $self->notebook);
11621  
11622 # Add tabs to the inner notebook
11623 $self->sound1Tab($innerNotebook);
11624 $self->sound2Tab($innerNotebook);
11625 $self->sound3Tab($innerNotebook);
11626 $self->sound4Tab($innerNotebook);
11627 $self->sound5Tab($innerNotebook);
11628 $self->sound6Tab($innerNotebook);
11629 $self->sound7Tab($innerNotebook);
11630  
11631 return 1;
11632 }
11633  
11634 sub sound1Tab {
11635  
11636 # Sound1 tab
11637 #
11638 # Expected arguments
11639 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
11640 #
11641 # Return values
11642 # 'undef' on improper arguments
11643 # 1 otherwise
11644  
11645 my ($self, $innerNotebook, $check) = @_;
11646  
11647 # Local variables
11648 my (
11649 $standardFlag,
11650 @columnList,
11651 );
11652  
11653 # Check for improper arguments
11654 if (! defined $innerNotebook || defined $check) {
11655  
11656 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound1Tab', @_);
11657 }
11658  
11659 # Tab setup
11660 my $grid = $self->addTab('Page _1', $innerNotebook);
11661  
11662 # Sound effects
11663 $self->addLabel($grid, '<b>Sound effects</b>',
11664 0, 12, 0, 1);
11665 $self->addLabel($grid, '<i>List of shortcuts to available sound effects</i>',
11666 1, 6, 1, 2);
11667  
11668 $standardFlag = FALSE;
11669 my $checkButton = $self->addCheckButton(
11670 $grid, 'List only standard sound effects', undef, TRUE,
11671 6, 12, 1, 2);
11672 # (->signal_connect appears below)
11673  
11674 # Add a simple list
11675 @columnList = (
11676 'Standard', 'bool',
11677 'Name', 'text',
11678 'File', 'text',
11679 );
11680  
11681 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
11682 1, 12, 2, 8);
11683  
11684 # Initialise the list
11685 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11686  
11687 # Add entry boxes and buttons
11688 $self->addLabel($grid, 'Name',
11689 1, 3, 8, 9);
11690 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
11691 3, 6, 8, 9);
11692  
11693 my $button = $self->addButton($grid,
11694 'Add...', 'Add or replace a sound effect with the specified name', undef,
11695 6, 9, 8, 9);
11696 $button->signal_connect('clicked' => sub {
11697  
11698 my $name = $entry->get_text();
11699  
11700 if ($self->checkEntryIcon($entry)) {
11701  
11702 # Add the sound effect. A dialogue window is opened to choose a file
11703 $self->session->pseudoCmd('addsoundeffect <' . $name . '>', $self->pseudoCmdMode);
11704  
11705 # Refresh the simple list and reset the entry box
11706 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11707 $self->resetEntryBoxes($entry);
11708 }
11709 });
11710  
11711 my $button2 = $self->addButton($grid,
11712 'Add with no file',
11713 'Add or replace a sound effect with the specified name, without a file',
11714 undef,
11715 9, 12, 8, 9);
11716 $button2->signal_connect('clicked' => sub {
11717  
11718 my $name = $entry->get_text();
11719  
11720 if ($self->checkEntryIcon($entry)) {
11721  
11722 # Add the sound effect. A dialogue window is opened to choose a file
11723 $self->session->pseudoCmd(
11724 'addsoundeffect -d <' . $name . '>',
11725 $self->pseudoCmdMode,
11726 );
11727  
11728 # Refresh the simple list and reset the entry box
11729 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11730 $self->resetEntryBoxes($entry);
11731 }
11732 });
11733  
11734 my $button3 = $self->addButton(
11735 $grid,
11736 'Play selected',
11737 'Play the selected sound effect',
11738 undef,
11739 1, 3, 9, 10);
11740 $button3->signal_connect('clicked' => sub {
11741  
11742 my ($name) = $self->getSimpleListData($slWidget, 1);
11743 if (defined $name) {
11744  
11745 # Play the sound effect
11746 $self->session->pseudoCmd('playsoundeffect <' . $name . '>', $self->pseudoCmdMode);
11747  
11748 # Refresh the simple list
11749 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11750 }
11751 });
11752  
11753 my $button4 = $self->addButton(
11754 $grid,
11755 'Play random',
11756 'Play a random sound effect sound effect',
11757 undef,
11758 3, 6, 9, 10);
11759 $button4->signal_connect('clicked' => sub {
11760  
11761 # Play the sound effect
11762 $self->session->pseudoCmd('playsoundeffect', $self->pseudoCmdMode);
11763  
11764 # Refresh the simple list
11765 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11766 });
11767  
11768 my $button5 = $self->addButton(
11769 $grid,
11770 'Change sound file',
11771 'Change the file for the selected sound effect',
11772 undef,
11773 6, 9, 9, 10);
11774 $button5->signal_connect('clicked' => sub {
11775  
11776 my ($name) = $self->getSimpleListData($slWidget, 1);
11777 if (defined $name) {
11778  
11779 # Edit the sound effect. A dialogue window is opened to choose a file
11780 $self->session->pseudoCmd('addsoundeffect <' . $name . '>', $self->pseudoCmdMode);
11781  
11782 # Refresh the simple list and reset the entry box
11783 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11784 $self->resetEntryBoxes($entry);
11785 }
11786 });
11787  
11788 my $button6 = $self->addButton(
11789 $grid,
11790 'Use no sound file',
11791 'Use no file with the selected sound effect',
11792 undef,
11793 9, 12, 9, 10);
11794 $button6->signal_connect('clicked' => sub {
11795  
11796 my ($name) = $self->getSimpleListData($slWidget, 1);
11797 if (defined $name) {
11798  
11799 # Edit the sound effect. A dialogue window is opened to choose a file
11800 $self->session->pseudoCmd(
11801 'addsoundeffect <' . $name . '> -d',
11802 $self->pseudoCmdMode,
11803 );
11804  
11805 # Refresh the simple list and reset the entry box
11806 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11807 $self->resetEntryBoxes($entry);
11808 }
11809 });
11810  
11811 my $button7 = $self->addButton(
11812 $grid, 'Delete selected ', 'Delete the selected sound effect', undef,
11813 1, 3, 10, 11);
11814 $button7->signal_connect('clicked' => sub {
11815  
11816 my ($name) = $self->getSimpleListData($slWidget, 1);
11817 if (defined $name) {
11818  
11819 # Delete the sound effect
11820 $self->session->pseudoCmd(
11821 'deletesoundeffect <' . $name . '>',
11822 $self->pseudoCmdMode,
11823 );
11824  
11825 # Refresh the simple list and reset the entry box
11826 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11827 $self->resetEntryBoxes($entry);
11828 }
11829 });
11830  
11831 my $button8 = $self->addButton($grid, 'Delete all', 'Delete all sound effects', undef,
11832 3, 6, 10, 11);
11833 $button8->signal_connect('clicked' => sub {
11834  
11835 # Delete all sound effects
11836 $self->session->pseudoCmd('deletesoundeffect -a', $self->pseudoCmdMode);
11837  
11838 # Refresh the simple list and reset the entry box
11839 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11840 $self->resetEntryBoxes($entry);
11841 });
11842  
11843 my $button9 = $self->addButton($grid,
11844 'Reset all', 'Resets the list of sound effects to the default list', undef,
11845 6, 9, 10, 11);
11846 $button9->signal_connect('clicked' => sub {
11847  
11848 # Reset sound effects
11849 $self->session->pseudoCmd('resetsoundeffect', $self->pseudoCmdMode);
11850  
11851 # Refresh the simple list and reset the entry box
11852 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11853 $self->resetEntryBoxes($entry);
11854 });
11855  
11856 my $button10 = $self->addButton($grid,
11857 'Dump all', 'Display the list of sound effects in the \'main\' window', undef,
11858 9, 12, 10, 11);
11859 $button10->signal_connect('clicked' => sub {
11860  
11861 # List sound effects
11862 $self->session->pseudoCmd('listsoundeffect', $self->pseudoCmdMode);
11863  
11864 # Refresh the simple list
11865 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11866 });
11867  
11868 # (->signal_connect from above)
11869 $checkButton->signal_connect('toggled' => sub {
11870  
11871 $standardFlag = $checkButton->get_active();
11872  
11873 # Refresh the simple list
11874 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11875 });
11876  
11877 my $checkButton2 = $self->addCheckButton(
11878 $grid, 'Enable sound effects in general', undef, TRUE,
11879 1, 4, 11, 12);
11880 $checkButton2->set_active($axmud::CLIENT->allowSoundFlag);
11881 $checkButton2->signal_connect('toggled' => sub {
11882  
11883 if ($checkButton2->get_active()) {
11884 $self->session->pseudoCmd('sound on', $self->pseudoCmdMode);
11885 } else {
11886 $self->session->pseudoCmd('sound off', $self->pseudoCmdMode);
11887 }
11888  
11889 # Refresh the simple list
11890 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11891 });
11892  
11893 my $checkButton3 = $self->addCheckButton(
11894 $grid, 'Enable beeps sent by the world (while sound effects are on)', undef, TRUE,
11895 4, 12, 11, 12);
11896 $checkButton3->set_active($axmud::CLIENT->allowAsciiBellFlag);
11897 $checkButton3->signal_connect('toggled' => sub {
11898  
11899 if ($checkButton3->get_active()) {
11900 $self->session->pseudoCmd('asciibell on', $self->pseudoCmdMode);
11901 } else {
11902 $self->session->pseudoCmd('asciibell off', $self->pseudoCmdMode);
11903 }
11904 # Refresh the simple list
11905 $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag);
11906 });
11907  
11908 # Tab complete
11909 return 1;
11910 }
11911  
11912 sub sound1Tab_refreshList {
11913  
11914 # Called by $self->sound1Tab to refresh the GA::Obj::SimpleList
11915 #
11916 # Expected arguments
11917 # $slWidget - The GA::Obj::SimpleList
11918 # $columns - The number of columns in the list
11919 # $standardFlag - If TRUE, only standard sound effects in the sound effects bank are
11920 # shown. If FALSE, all sound effects in the sound effects bank are
11921 # shown
11922 #
11923 #
11924 # Return values
11925 # 'undef' on improper arguments
11926 # 1 otherwise
11927  
11928 my ($self, $slWidget, $columns, $standardFlag, $check) = @_;
11929  
11930 # Local variables
11931 my (
11932 @sortedList, @dataList,
11933 %standardHash, %customHash,
11934 );
11935  
11936 # Check for improper arguments
11937 if (
11938 ! defined $slWidget || ! defined $columns || ! defined $standardFlag
11939 || defined $check
11940 ) {
11941 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound1Tab_refreshList', @_);
11942 }
11943  
11944 # Import the hash of sound effects, and sort them
11945 %standardHash = $axmud::CLIENT->constStandardSoundHash;
11946 %customHash = $axmud::CLIENT->customSoundHash;
11947 @sortedList = sort {lc($a) cmp lc($b)} (keys %customHash);
11948  
11949 # Compile the simple list data
11950 foreach my $effect (@sortedList) {
11951  
11952 my $flag;
11953  
11954 if (! exists $standardHash{$effect}) {
11955 $flag = FALSE;
11956 } else {
11957 $flag = TRUE;
11958 }
11959  
11960 if ($flag || ! $standardFlag) {
11961  
11962 push (@dataList, $flag, $effect, $customHash{$effect});
11963 }
11964 }
11965  
11966 # Reset the simple list
11967 $self->resetListData($slWidget, [@dataList], $columns);
11968  
11969 return 1;
11970 }
11971  
11972 sub sound2Tab {
11973  
11974 # Sound2 tab
11975 #
11976 # Expected arguments
11977 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
11978 #
11979 # Return values
11980 # 'undef' on improper arguments
11981 # 1 otherwise
11982  
11983 my ($self, $innerNotebook, $check) = @_;
11984  
11985 # Local variables
11986 my @comboList;
11987  
11988 # Check for improper arguments
11989 if (! defined $innerNotebook || defined $check) {
11990  
11991 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound2Tab', @_);
11992 }
11993  
11994 # Tab setup
11995 my $grid = $self->addTab('Page _2', $innerNotebook);
11996  
11997 # Text-to-speech (TTS)
11998 $self->addLabel($grid, '<b>Text-to-speech (TTS)</b>',
11999 0, 12, 0, 1);
12000 $self->addLabel(
12001 $grid,
12002 '<i>Convert text to audible speech, using any of the TTS engines that '
12003 . $axmud::SCRIPT . ' supports</i>',
12004 1, 12, 1, 2);
12005  
12006 my $checkButton = $self->addCheckButton(
12007 $grid, 'Enable text-to-speech for all users', undef, TRUE,
12008 1, 12, 2, 3);
12009 $checkButton->set_active($axmud::CLIENT->customAllowTTSFlag);
12010 # (->signal_connect appears below)
12011  
12012 my $checkButton2 = $self->addCheckButton(
12013 $grid,
12014 'Allow TTS smoothing (makes the voice sound more natural by guessing sentences)',
12015 undef,
12016 TRUE,
12017 1, 12, 3, 4);
12018 $checkButton2->set_active($axmud::CLIENT->ttsSmoothFlag);
12019 $checkButton2->signal_connect('toggled' => sub {
12020  
12021 if ($checkButton2->get_active()) {
12022 $axmud::CLIENT->set_ttsFlag('smooth', TRUE);
12023 } else {
12024 $axmud::CLIENT->set_ttsFlag('smooth', FALSE);
12025 }
12026 });
12027  
12028 my $checkButton3 = $self->addCheckButton(
12029 $grid,
12030 'In blind mode, replay speech using the cursor/page up/page down/home/end/tab/escape'
12031 . ' keys',
12032 undef,
12033 TRUE,
12034 1, 12, 4, 5);
12035 $checkButton3->set_active($axmud::CLIENT->ttsHijackFlag);
12036 $checkButton3->signal_connect('toggled' => sub {
12037  
12038 if ($checkButton3->get_active()) {
12039 $axmud::CLIENT->set_ttsHijackFlag(TRUE);
12040 } else {
12041 $axmud::CLIENT->set_ttsHijackFlag(FALSE);
12042 }
12043 });
12044 if (! $axmud::BLIND_MODE_FLAG) {
12045  
12046 $checkButton3->set_sensitive(FALSE);
12047 }
12048  
12049 my $checkButton4 = $self->addCheckButton(
12050 $grid,
12051 'Hijack those keys when not in blind mode',
12052 undef,
12053 TRUE,
12054 2, 12, 5, 6);
12055 $checkButton4->set_active($axmud::CLIENT->ttsForceHijackFlag);
12056 $checkButton4->signal_connect('toggled' => sub {
12057  
12058 if ($checkButton4->get_active()) {
12059 $axmud::CLIENT->set_ttsForceHijackFlag(TRUE);
12060 } else {
12061 $axmud::CLIENT->set_ttsForceHijackFlag(FALSE);
12062 }
12063 });
12064 if ($axmud::BLIND_MODE_FLAG || ! $axmud::CLIENT->customAllowTTSFlag) {
12065  
12066 $checkButton4->set_sensitive(FALSE);
12067 }
12068  
12069 # (->signal_connect from above)
12070 $checkButton->signal_connect('toggled' => sub {
12071  
12072 if ($checkButton->get_active()) {
12073 $axmud::CLIENT->set_customAllowTTSFlag(TRUE);
12074 } else {
12075 $axmud::CLIENT->set_customAllowTTSFlag(FALSE);
12076 }
12077  
12078 $checkButton4->set_active($axmud::CLIENT->ttsForceHijackFlag);
12079 if (! $axmud::CLIENT->customAllowTTSFlag) {
12080 $checkButton4->set_sensitive(FALSE);
12081 } else {
12082 $checkButton4->set_sensitive(TRUE);
12083 }
12084 });
12085  
12086 # Settings for text-to-speech conversion in specific contexts
12087 $self->addLabel(
12088 $grid,
12089 '<i>Settings for text-to-speech conversion in specific contexts</i>',
12090 1, 12, 6, 7);
12091  
12092 my $checkButton5 = $self->addCheckButton(
12093 $grid, 'Convert text received from the world', undef, TRUE,
12094 1, 12, 7, 8);
12095 $checkButton5->set_active($axmud::CLIENT->ttsReceiveFlag);
12096 $checkButton5->signal_connect('toggled' => sub {
12097  
12098 if ($checkButton5->get_active()) {
12099 $axmud::CLIENT->set_ttsFlag('receive', TRUE);
12100 } else {
12101 $axmud::CLIENT->set_ttsFlag('receive', FALSE);
12102 }
12103 });
12104  
12105 my $checkButton6 = $self->addCheckButton(
12106 $grid,
12107 'Don\'t convert received text before an automatic login is processed (but do convert'
12108 . ' prompts)',
12109 undef,
12110 TRUE,
12111 2, 12, 8, 9);
12112 $checkButton6->set_active($axmud::CLIENT->ttsLoginFlag);
12113 $checkButton6->signal_connect('toggled' => sub {
12114  
12115 if ($checkButton6->get_active()) {
12116 $axmud::CLIENT->set_ttsFlag('login', TRUE);
12117 } else {
12118 $axmud::CLIENT->set_ttsFlag('login', FALSE);
12119 }
12120 });
12121  
12122 my $checkButton7 = $self->addCheckButton(
12123 $grid,
12124 'Don\'t convert world profile\'s recognised prompts in received text after a login',
12125 undef,
12126 TRUE,
12127 2, 12, 9, 10);
12128 $checkButton7->set_active($axmud::CLIENT->ttsPromptFlag);
12129 $checkButton7->signal_connect('toggled' => sub {
12130  
12131 if ($checkButton7->get_active()) {
12132 $axmud::CLIENT->set_ttsFlag('prompt', TRUE);
12133 } else {
12134 $axmud::CLIENT->set_ttsFlag('prompt', FALSE);
12135 }
12136 });
12137  
12138 my $checkButton8 = $self->addCheckButton(
12139 $grid, 'Convert system messages', undef, TRUE,
12140 1, 6, 10, 11);
12141 $checkButton8->set_active($axmud::CLIENT->ttsSystemFlag);
12142 $checkButton8->signal_connect('toggled' => sub {
12143  
12144 if ($checkButton8->get_active()) {
12145 $axmud::CLIENT->set_ttsFlag('system', TRUE);
12146 } else {
12147 $axmud::CLIENT->set_ttsFlag('system', FALSE);
12148 }
12149 });
12150  
12151 my $checkButton9 = $self->addCheckButton(
12152 $grid,'Convert system error messages', undef, TRUE,
12153 1, 6, 11, 12);
12154 $checkButton9->set_active($axmud::CLIENT->ttsSystemErrorFlag);
12155 $checkButton9->signal_connect('toggled' => sub {
12156  
12157 if ($checkButton9->get_active()) {
12158 $axmud::CLIENT->set_ttsFlag('error', TRUE);
12159 } else {
12160 $axmud::CLIENT->set_ttsFlag('error', FALSE);
12161 }
12162 });
12163  
12164 my $checkButton10 = $self->addCheckButton(
12165 $grid, 'Convert world commands', undef, TRUE,
12166 7, 12, 10, 11);
12167 $checkButton10->set_active($axmud::CLIENT->ttsWorldCmdFlag);
12168 $checkButton10->signal_connect('toggled' => sub {
12169  
12170 if ($checkButton10->get_active()) {
12171 $axmud::CLIENT->set_ttsFlag('command', TRUE);
12172 } else {
12173 $axmud::CLIENT->set_ttsFlag('command', FALSE);
12174 }
12175 });
12176  
12177 my $checkButton11 = $self->addCheckButton(
12178 $grid, 'Convert \'dialogue\' windows', undef, TRUE,
12179 7, 12, 11, 12);
12180 $checkButton11->set_active($axmud::CLIENT->ttsDialogueFlag);
12181 $checkButton11->signal_connect('toggled' => sub {
12182  
12183 if ($checkButton11->get_active()) {
12184 $axmud::CLIENT->set_ttsFlag('dialogue', TRUE);
12185 } else {
12186 $axmud::CLIENT->set_ttsFlag('dialogue', FALSE);
12187 }
12188 });
12189  
12190 my $checkButton12 = $self->addCheckButton(
12191 $grid,
12192 'Allow some tasks (e.g. the Status and Locator tasks) to convert certain strings to'
12193 . ' speech',
12194 undef,
12195 TRUE,
12196 1, 12, 12, 13);
12197 $checkButton12->set_active($axmud::CLIENT->ttsTaskFlag);
12198 $checkButton12->signal_connect('toggled' => sub {
12199  
12200 if ($checkButton12->get_active()) {
12201 $axmud::CLIENT->set_ttsFlag('task', TRUE);
12202 } else {
12203 $axmud::CLIENT->set_ttsFlag('task', FALSE);
12204 }
12205 });
12206  
12207 # Tab complete
12208 return 1;
12209 }
12210  
12211 sub sound3Tab {
12212  
12213 # Sound3 tab
12214 #
12215 # Expected arguments
12216 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12217 #
12218 # Return values
12219 # 'undef' on improper arguments
12220 # 1 otherwise
12221  
12222 my ($self, $innerNotebook, $check) = @_;
12223  
12224 # Local variables
12225 my (@compatList, @comboList);
12226  
12227 # Check for improper arguments
12228 if (! defined $innerNotebook || defined $check) {
12229  
12230 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound3Tab', @_);
12231 }
12232  
12233 # Tab setup
12234 my $grid = $self->addTab('Page _3', $innerNotebook);
12235  
12236 # Text-to-speech (cont.)
12237 $self->addLabel($grid, '<b>Text-to-speech (cont.)</b>',
12238 0, 12, 0, 1);
12239  
12240 # Top-left
12241 $self->addLabel($grid, '<i>' . $axmud::SCRIPT . '-supported TTS engines</i>',
12242 1, 6, 1, 2);
12243 my $textView = $self->addTextView($grid, undef, FALSE,
12244 1, 6, 2, 7,
12245 FALSE, # Don't treat as a list
12246 FALSE, # Don't remove empty lines
12247 TRUE, # ...but do remove leading/trailing whitespace
12248 FALSE, # Allow horizontal scrolling
12249 );
12250 my $buffer = $textView->get_buffer();
12251 $buffer->set_text(join("\n", $axmud::CLIENT->constTTSList));
12252  
12253 # Bottom-left
12254 $self->addLabel($grid, '<i>Compatible TTS engines</i>',
12255 1, 6, 7, 8);
12256  
12257 foreach my $engine ($axmud::CLIENT->constTTSCompatList) {
12258  
12259 if (
12260 $^O eq 'MSWin32'
12261 && (
12262 (
12263 $engine eq 'espeak'
12264 && (
12265 (
12266 defined $axmud::CLIENT->msWinPathESpeak
12267 && -e $axmud::CLIENT->msWinPathESpeak
12268 ) || (
12269 defined $axmud::CLIENT->msWinAltPathESpeak
12270 && -e $axmud::CLIENT->msWinAltPathESpeak
12271 )
12272 )
12273 ) || (
12274 $engine eq 'esng'
12275 && defined $axmud::CLIENT->msWinPathESNG
12276 && -e $axmud::CLIENT->msWinPathESNG
12277 ) || (
12278 $engine eq 'festival'
12279 && defined $axmud::CLIENT->msWinPathFestival
12280 && -e $axmud::CLIENT->msWinPathFestival
12281 ) || (
12282 $engine eq 'swift'
12283 && defined $axmud::CLIENT->msWinPathSwift
12284 && -e $axmud::CLIENT->msWinPathSwift
12285 )
12286 )
12287 ) {
12288 push (@compatList, $engine . ' <detected>');
12289 } else {
12290 push (@compatList, $engine);
12291 }
12292 }
12293  
12294 my $textView2 = $self->addTextView($grid, undef, FALSE,
12295 1, 6, 8, 13,
12296 FALSE, # Don't treat as a list
12297 FALSE, # Don't remove empty lines
12298 TRUE, # ...but do remove leading/trailing whitespace
12299 FALSE, # Allow horizontal scrolling
12300 );
12301 my $buffer2 = $textView2->get_buffer();
12302 $buffer2->set_text(join("\n", @compatList));
12303  
12304 # Top-right
12305 $self->addLabel($grid, '<i>Festival server settings</i>',
12306 7, 12, 1, 2);
12307  
12308 $self->addLabel(
12309 $grid, 'Festival server port (0-65535, or leave empty to use the command line engine)',
12310 7, 12, 2, 3);
12311 my $entry = $self->addEntry($grid, undef, TRUE,
12312 7, 8, 3, 4,
12313 5, 5);
12314 if (
12315 defined $axmud::CLIENT->ttsFestivalServerPort
12316 && $axmud::CLIENT->ttsFestivalServerPort ne ''
12317 ) {
12318 $entry->set_text($axmud::CLIENT->ttsFestivalServerPort);
12319 }
12320 my $button = $self->addButton(
12321 $grid, 'Use server with this port', 'Set the Festival server port', undef,
12322 8, 10, 3, 4);
12323 $button->signal_connect('clicked' => sub {
12324  
12325 my $port = $entry->get_text();
12326  
12327 if ($port eq '') {
12328 $self->session->pseudoCmd('speech port none', $self->pseudoCmdMode);
12329 } else {
12330 $self->session->pseudoCmd('speech port ' . $port, $self->pseudoCmdMode);
12331 }
12332  
12333 if (defined $axmud::CLIENT->ttsFestivalServerPort) {
12334 $entry->set_text($axmud::CLIENT->ttsFestivalServerPort);
12335 } else {
12336 $entry->set_text('');
12337 }
12338 });
12339 my $button2 = $self->addButton(
12340 $grid,
12341 'Use server with default port',
12342 'Use the default Festival server port',
12343 undef,
12344 10, 12, 3, 4);
12345 $button2->signal_connect('clicked' => sub {
12346  
12347 $self->session->pseudoCmd('speech port default', $self->pseudoCmdMode);
12348 if (defined $axmud::CLIENT->ttsFestivalServerPort) {
12349 $entry->set_text($axmud::CLIENT->ttsFestivalServerPort);
12350 } else {
12351 $entry->set_text('');
12352 }
12353 });
12354 my $button3 = $self->addButton(
12355 $grid,
12356 'Don\'t use server',
12357 'Use the Festival command-line engine',
12358 undef,
12359 10, 12, 4, 5);
12360 $button3->signal_connect('clicked' => sub {
12361  
12362 $self->session->pseudoCmd('speech port none', $self->pseudoCmdMode);
12363 if (defined $axmud::CLIENT->ttsFestivalServerPort) {
12364 $entry->set_text($axmud::CLIENT->ttsFestivalServerPort);
12365 } else {
12366 $entry->set_text('');
12367 }
12368 });
12369  
12370 # Axmud currently doesn't support the Festival server on MS Windows
12371 if ($^O eq 'MSWin32') {
12372  
12373 $entry->set_sensitive(FALSE);
12374 $button->set_sensitive(FALSE);
12375 $button2->set_sensitive(FALSE);
12376 $button3->set_sensitive(FALSE);
12377 }
12378  
12379 # (add more labels, to get the spacing right)
12380 $self->addLabel($grid, '',
12381 7, 12, 5, 6);
12382 $self->addLabel($grid, '',
12383 7, 12, 6, 7);
12384  
12385 # Bottom-right
12386 $self->addLabel($grid, '<i>Text-to-speech engine test</i>',
12387 7, 12, 7, 8);
12388 my $entry2 = $self->addEntry($grid, undef, TRUE,
12389 7, 12, 8, 9);
12390 $entry2->set_text('Hello, my name is ' . $axmud::SCRIPT . ' and I am your mud client.');
12391  
12392 @comboList = $axmud::CLIENT->constTTSCompatList;
12393 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
12394 TRUE, # No 'undef' value used
12395 8, 10, 9, 10);
12396  
12397 my $button4 = $self->addButton(
12398 $grid, 'Test engine', 'Read aloud this text using the selected TTS engine', undef,
12399 10, 12, 9, 10);
12400 $button4->signal_connect('clicked' => sub {
12401  
12402 # (Actually, we use settings for the TTS configuration with the same name as the engine)
12403  
12404 my ($text, $configuration);
12405  
12406 $text = $entry2->get_text();
12407 $configuration = $combo->get_active_text();
12408  
12409 if ($text) {
12410  
12411 $self->session->pseudoCmd(
12412 'speak -n ' . $configuration . ' <' . $text . '>',
12413 $self->pseudoCmdMode,
12414 );
12415 }
12416 });
12417  
12418 # (add more labels, to get the spacing right)
12419 $self->addLabel($grid, '',
12420 7, 12, 10, 11);
12421 $self->addLabel($grid, '',
12422 7, 12, 11, 12);
12423 $self->addLabel($grid, '',
12424 7, 12, 12, 13);
12425  
12426 # Tab complete
12427 return 1;
12428 }
12429  
12430 sub sound4Tab {
12431  
12432 # Sound4 tab
12433 #
12434 # Expected arguments
12435 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12436 #
12437 # Return values
12438 # 'undef' on improper arguments
12439 # 1 otherwise
12440  
12441 my ($self, $innerNotebook, $check) = @_;
12442  
12443 # Local variables
12444 my (@columnList, @comboList);
12445  
12446 # Check for improper arguments
12447 if (! defined $innerNotebook || defined $check) {
12448  
12449 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound4Tab', @_);
12450 }
12451  
12452 # Tab setup
12453 my $grid = $self->addTab('Page _4', $innerNotebook);
12454  
12455 # Text-to-speech configurations
12456 $self->addLabel($grid, '<b>Text-to-speech configurations</b>',
12457 0, 13, 0, 1);
12458 $self->addLabel(
12459 $grid,
12460 '<i>Text-to-speech configurations store voice settings for use in all kinds of'
12461 . ' situations</i>',
12462 1, 13, 1, 2);
12463  
12464 # Add a simple list
12465 @columnList = (
12466 'Name', 'text',
12467 'Engine', 'text',
12468 'Modifiable', 'bool',
12469 'Deletable', 'bool',
12470 'Voice', 'text',
12471 'Speed', 'text',
12472 'Rate', 'text',
12473 'Pitch', 'text',
12474 'Volume', 'text',
12475 );
12476  
12477 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
12478 1, 13, 2, 10);
12479  
12480 # Initialise the list
12481 $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2));
12482  
12483 # Add entries and buttons
12484 $self->addLabel($grid, 'Configuration name',
12485 1, 3, 10, 11);
12486 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
12487 3, 5, 10, 11);
12488  
12489 $self->addLabel($grid, 'Engine',
12490 5, 7, 10, 11);
12491 @comboList = $axmud::CLIENT->constTTSList;
12492 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
12493 TRUE, # No 'undef' value used
12494 7, 9, 10, 11);
12495  
12496 my $button = $self->addButton(
12497 $grid,
12498 'Add',
12499 'Add a new text-to-speech configuration',
12500 undef,
12501 9, 11, 10, 11);
12502 $button->signal_connect('clicked' => sub {
12503  
12504 my ($configuration, $engine);
12505  
12506 if ($self->checkEntryIcon($entry)) {
12507  
12508 $configuration = $entry->get_text();
12509 $engine = $combo->get_active_text();
12510  
12511 # Add the configuration
12512 $self->session->pseudoCmd(
12513 'addconfig ' . $configuration . ' ' . $engine,
12514 $self->pseudoCmdMode,
12515 );
12516  
12517 # Refresh the simple list
12518 $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2));
12519 }
12520 });
12521  
12522 my $button2 = $self->addButton(
12523 $grid,
12524 'Clone',
12525 'Clone the selected text-to-speech configuration',
12526 undef,
12527 11, 13, 10, 11);
12528 $button2->signal_connect('clicked' => sub {
12529  
12530 my ($original, $copy);
12531  
12532 if ($self->checkEntryIcon($entry)) {
12533  
12534 $copy = $entry->get_text();
12535 ($original) = $self->getSimpleListData($slWidget, 0);
12536 if (defined $original) {
12537  
12538 # Clone the configuration
12539 $self->session->pseudoCmd(
12540 'cloneconfig ' . $original . ' ' . $copy,
12541 $self->pseudoCmdMode,
12542 );
12543  
12544 # Refresh the simple list
12545 $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2));
12546 }
12547 }
12548 });
12549  
12550 my $button3 = $self->addButton(
12551 $grid,
12552 'Edit...',
12553 'Edit the selected text-to-speech configuration',
12554 undef,
12555 7, 9, 11, 12);
12556 $button3->signal_connect('clicked' => sub {
12557  
12558 my ($configuration, $ttsObj, $childWinObj);
12559  
12560 ($configuration) = $self->getSimpleListData($slWidget, 0);
12561 if (defined $configuration) {
12562  
12563 # Get the corresponding GA::Obj::Tts object
12564 $ttsObj = $axmud::CLIENT->ivShow('ttsObjHash', $configuration);
12565 if ($ttsObj) {
12566  
12567 # Open an 'edit' window for the configuration object
12568 $self->createFreeWin(
12569 'Games::Axmud::EditWin::TTS',
12570 $self,
12571 $self->session,
12572 'Edit text-to-speech configuration \'' . $configuration . '\'',
12573 $ttsObj,
12574 FALSE, # Not temporary
12575 );
12576 }
12577  
12578 if ($childWinObj) {
12579  
12580 # When the 'edit' window closes, update widgets and/or IVs
12581 $self->add_childDestroy(
12582 $childWinObj,
12583 'sound4Tab_refreshList',
12584 [$slWidget, (scalar @columnList / 2)],
12585 );
12586 }
12587 }
12588 });
12589  
12590 my $button4 = $self->addButton(
12591 $grid,
12592 'Delete',
12593 'Delete the selected text-to-speech configuration',
12594 undef,
12595 9, 11, 11, 12);
12596 $button4->signal_connect('clicked' => sub {
12597  
12598 my ($configuration) = $self->getSimpleListData($slWidget, 0);
12599 if (defined $configuration) {
12600  
12601 # Delete the configuration
12602 $self->session->pseudoCmd(
12603 'deleteconfig ' . $configuration,
12604 $self->pseudoCmdMode,
12605 );
12606  
12607 # Refresh the simple list
12608 $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2));
12609 }
12610 });
12611  
12612 my $button5 = $self->addButton($grid, 'Reset', 'Reset the list of configurations', undef,
12613 11, 13, 11, 12);
12614 $button5->signal_connect('clicked' => sub {
12615  
12616 my %ivHash;
12617  
12618 # Refresh the simple list and reset entry boxes
12619 $self->sound4Tab_refreshList($slWidget, (scalar @columnList / 2));
12620 $self->resetEntryBoxes($entry);
12621 $combo->set_active(0);
12622 });
12623  
12624 # Tab complete
12625 return 1;
12626 }
12627  
12628 sub sound4Tab_refreshList {
12629  
12630 # Called by $self->sound4Tab to refresh the GA::Obj::SimpleList
12631 #
12632 # Expected arguments
12633 # $slWidget - The GA::Obj::SimpleList
12634 # $columns - The number of columns in the list
12635 #
12636 # Return values
12637 # 'undef' on improper arguments
12638 # 1 otherwise
12639  
12640 my ($self, $slWidget, $columns, $check) = @_;
12641  
12642 # Local variables
12643 my (
12644 @sortedList, @dataList,
12645 %hash,
12646 );
12647  
12648 # Check for improper arguments
12649 if (! defined $slWidget || ! defined $columns || defined $check) {
12650  
12651 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound4Tab_refreshList', @_);
12652 }
12653  
12654 # Import the hash of TTS configurations, and sort them
12655 %hash = $axmud::CLIENT->ttsObjHash;
12656 @sortedList = sort {lc($a->name) cmp lc($b->name)} (values %hash);
12657  
12658 # Compile the simple list data
12659 foreach my $obj (@sortedList) {
12660  
12661 push (@dataList, $obj->name, $obj->engine);
12662  
12663 if ($axmud::CLIENT->ivExists('constTtsFixedObjHash', $obj->name)) {
12664 push (@dataList, FALSE, FALSE); # Not modifiable, not deletable
12665 } elsif ($axmud::CLIENT->ivExists('constTtsPermObjHash', $obj->name)) {
12666 push (@dataList, TRUE, FALSE); # Modifiable, not deletable
12667 } else {
12668 push (@dataList, TRUE, TRUE); # Modifiable, deletable
12669 }
12670  
12671 push (@dataList, $obj->voice, $obj->speed, $obj->rate, $obj->pitch, $obj->volume);
12672 }
12673  
12674 # Reset the simple list
12675 $self->resetListData($slWidget, [@dataList], $columns);
12676  
12677 return 1;
12678 }
12679  
12680 sub sound5Tab {
12681  
12682 # Sound5 tab
12683 #
12684 # Expected arguments
12685 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12686 #
12687 # Return values
12688 # 'undef' on improper arguments
12689 # 1 otherwise
12690  
12691 my ($self, $innerNotebook, $check) = @_;
12692  
12693 # Local variables
12694 my @columnList;
12695  
12696 # Check for improper arguments
12697 if (! defined $innerNotebook || defined $check) {
12698  
12699 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound5Tab', @_);
12700 }
12701  
12702 # Tab setup
12703 my $grid = $self->addTab('Page _5', $innerNotebook);
12704  
12705 # Text-to-speech attributes
12706 $self->addLabel($grid, '<b>Text-to-speech attributes</b>',
12707 0, 12, 0, 1);
12708 $self->addLabel(
12709 $grid,
12710 '<i>Attributes used with the \';read\' and \';permread\' commands</i>',
12711 1, 12, 1, 2);
12712  
12713 # Add a simple list
12714 @columnList = (
12715 'Attribute', 'text',
12716 'Assigned to task', 'text',
12717 'Built-in task', 'bool',
12718 '', 'text', # Dummy to keep the to the left
12719 );
12720  
12721 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
12722 1, 12, 2, 10);
12723  
12724 # Initialise the list
12725 $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAttribHash');
12726  
12727 # Add buttons
12728 my $button = $self->addButton($grid,
12729 'Refresh list', 'Refresh the list of assigned attributes', undef,
12730 10, 12, 10, 11);
12731 $button->signal_connect('clicked' => sub {
12732  
12733 # Refresh the simple list
12734 $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAttribHash');
12735 });
12736  
12737 # Tab complete
12738 return 1;
12739 }
12740  
12741 sub sound5Tab_refreshList {
12742  
12743 # Called by $self->sound5Tab, ->sound6Tab and ->sound7Tab Tab to refresh the
12744 # GA::Obj::SimpleList
12745 #
12746 # Expected arguments
12747 # $slWidget - The GA::Obj::SimpleList
12748 # $columns - The number of columns in the list
12749 # $iv - 'ttsAttribHash', 'ttsFlagAttribHash' or 'ttsAlertAttribHash'
12750 #
12751 # Return values
12752 # 'undef' on improper arguments
12753 # 1 otherwise
12754  
12755 my ($self, $slWidget, $columns, $iv, $check) = @_;
12756  
12757 # Local variables
12758 my @dataList;
12759  
12760 # Check for improper arguments
12761 if (! defined $slWidget || ! defined $columns || defined $check) {
12762  
12763 return $axmud::CLIENT->writeImproper(
12764 $self->_objClass . '->sound5Tab_refreshList',
12765 @_,
12766 );
12767 }
12768  
12769 # Compile the simple list data
12770 foreach my $key (sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys($iv))) {
12771  
12772 my ($taskName, $flag);
12773  
12774 # A built-in task, or not?
12775 $taskName = $axmud::CLIENT->ivShow($iv, $key);
12776 if (! $axmud::CLIENT->ivExists('pluginTaskHash', $taskName)) {
12777 $flag = TRUE;
12778 } else {
12779 $flag = FALSE;
12780 }
12781  
12782 push (@dataList, $key, $taskName, $flag, '');
12783 }
12784  
12785 # Reset the simple list
12786 $self->resetListData($slWidget, [@dataList], $columns);
12787  
12788 return 1;
12789 }
12790  
12791 sub sound6Tab {
12792  
12793 # Sound6 tab
12794 #
12795 # Expected arguments
12796 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12797 #
12798 # Return values
12799 # 'undef' on improper arguments
12800 # 1 otherwise
12801  
12802 my ($self, $innerNotebook, $check) = @_;
12803  
12804 # Local variables
12805 my @columnList;
12806  
12807 # Check for improper arguments
12808 if (! defined $innerNotebook || defined $check) {
12809  
12810 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound6Tab', @_);
12811 }
12812  
12813 # Tab setup
12814 my $grid = $self->addTab('Page _6', $innerNotebook);
12815  
12816 # Text-to-speech flag attributes
12817 $self->addLabel($grid, '<b>Text-to-speech flag attributes</b>',
12818 0, 12, 0, 1);
12819 $self->addLabel(
12820 $grid,
12821 '<i>Attributes used with the \';switch\' and \';permswitch\' commands</i>',
12822 1, 12, 1, 2);
12823  
12824 # Add a simple list
12825 @columnList = (
12826 'Attribute', 'text',
12827 'Assigned to task', 'text',
12828 'Built-in task', 'bool',
12829 '', 'text', # Dummy to keep the to the left
12830 );
12831  
12832 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
12833 1, 12, 2, 10);
12834  
12835 # Initialise the list
12836 $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsFlagAttribHash');
12837  
12838 # Add buttons
12839 my $button = $self->addButton($grid,
12840 'Refresh list', 'Refresh the list of assigned attributes', undef,
12841 10, 12, 10, 11);
12842 $button->signal_connect('clicked' => sub {
12843  
12844 # Refresh the simple list
12845 $self->sound5Tab_refreshList(
12846 $slWidget,
12847 scalar (@columnList / 2),
12848 'ttsFlagAttribHash',
12849 );
12850 });
12851  
12852 # Tab complete
12853 return 1;
12854 }
12855  
12856 sub sound7Tab {
12857  
12858 # Sound7 tab
12859 #
12860 # Expected arguments
12861 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12862 #
12863 # Return values
12864 # 'undef' on improper arguments
12865 # 1 otherwise
12866  
12867 my ($self, $innerNotebook, $check) = @_;
12868  
12869 # Local variables
12870 my @columnList;
12871  
12872 # Check for improper arguments
12873 if (! defined $innerNotebook || defined $check) {
12874  
12875 return $axmud::CLIENT->writeImproper($self->_objClass . '->sound7Tab', @_);
12876 }
12877  
12878 # Tab setup
12879 my $grid = $self->addTab('Page _7', $innerNotebook);
12880  
12881 # Text-to-speech alert attributes
12882 $self->addLabel($grid, '<b>Text-to-speech alert attributes</b>',
12883 0, 12, 0, 1);
12884 $self->addLabel(
12885 $grid,
12886 '<i>Attributes used with the \';alert\' and \';permalert\' commands</i>',
12887 1, 12, 1, 2);
12888  
12889 # Add a simple list
12890 @columnList = (
12891 'Attribute', 'text',
12892 'Assigned to task', 'text',
12893 'Built-in task', 'bool',
12894 '', 'text', # Dummy to keep the to the left
12895 );
12896  
12897 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
12898 1, 12, 2, 10);
12899  
12900 # Initialise the list
12901 $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAlertAttribHash');
12902  
12903 # Add buttons
12904 my $button = $self->addButton($grid,
12905 'Refresh list', 'Refresh the list of assigned attributes', undef,
12906 10, 12, 10, 11);
12907 $button->signal_connect('clicked' => sub {
12908  
12909 # Refresh the simple list
12910 $self->sound5Tab_refreshList(
12911 $slWidget,
12912 scalar (@columnList / 2),
12913 'ttsAlertAttribHash',
12914 );
12915 });
12916  
12917 # Tab complete
12918 return 1;
12919 }
12920  
12921 sub tasksTab {
12922  
12923 # Tasks tab - called by $self->setupNotebook
12924 #
12925 # Expected arguments
12926 # (none besides $self)
12927 #
12928 # Return values
12929 # 'undef' on improper arguments
12930 # 1 otherwise
12931  
12932 my ($self, $check) = @_;
12933  
12934 # Check for improper arguments
12935 if (defined $check) {
12936  
12937 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab', @_);
12938 }
12939  
12940 # Tab setup
12941 # Create a notebook within the main one, so that we have two rows of tabs
12942 my $innerNotebook = $self->addInnerNotebookTab('_Tasks', $self->notebook);
12943  
12944 # Add tabs to the inner notebook
12945 $self->tasks1Tab($innerNotebook, 'first');
12946 $self->tasks1Tab($innerNotebook, 'last');
12947 $self->tasks3Tab($innerNotebook);
12948  
12949 return 1;
12950 }
12951  
12952 sub tasks1Tab {
12953  
12954 # Tasks1 tab
12955 #
12956 # Expected arguments
12957 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
12958 # $type - Which runlist is being edited - 'first' or 'last'
12959 #
12960 # Return values
12961 # 'undef' on improper arguments
12962 # 1 otherwise
12963  
12964 my ($self, $innerNotebook, $type, $check) = @_;
12965  
12966 # Local variables
12967 my (@columnList, @comboList);
12968  
12969 # Check for improper arguments
12970 if (! defined $innerNotebook || ! defined $type || defined $check) {
12971  
12972 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks1Tab', @_);
12973 }
12974  
12975 # Tab setup
12976 my $grid;
12977  
12978 if ($type eq 'first') {
12979 $grid = $self->addTab('Page _1', $innerNotebook);
12980 } else {
12981 $grid = $self->addTab('Page _2', $innerNotebook);
12982 }
12983  
12984 # Task runlists
12985 if ($type eq 'first') {
12986  
12987 $self->addLabel($grid, '<b>Task first runlist</b>',
12988 0, 12, 0, 1);
12989 $self->addLabel($grid,
12990 '<i>List of tasks that are run first, before any others, in each task loop</i>',
12991 1, 12, 1, 2);
12992  
12993 } else {
12994  
12995 $self->addLabel($grid, '<b>Task last runlist</b>',
12996 0, 12, 0, 1);
12997 $self->addLabel($grid,
12998 '<i>List of tasks that are run last, after any others, in each task loop</i>',
12999 1, 12, 1, 2);
13000 }
13001  
13002 # Add a simple list
13003 @columnList = (
13004 'Task name', 'text',
13005 );
13006  
13007 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
13008 1, 12, 2, 10);
13009  
13010 # Unusual step - need to save the simple list, because $self->tasks1Tab_refreshList
13011 # updates both simple lists together. Because this is a 'pref' window, the lists are
13012 # stored in $self->editConfigHash
13013 if ($type eq 'first') {
13014 $self->ivAdd('editConfigHash', 'first_list', $slWidget);
13015 } else {
13016 $self->ivAdd('editConfigHash', 'last_list', $slWidget);
13017 }
13018  
13019 # Initialise the simple list
13020 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13021  
13022 # Add buttons
13023 @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('taskPackageHash'));
13024 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
13025 TRUE, # No 'undef' value used
13026 1, 3, 10, 11);
13027  
13028 my $button = $self->addButton($grid, 'Add', 'Add the selected task to the runlist', undef,
13029 3, 5, 10, 11);
13030 $button->signal_connect('clicked' => sub {
13031  
13032 my (
13033 $task, $match,
13034 @newList,
13035 );
13036  
13037 $task = $combo->get_active_text();
13038  
13039 # Import the existing runlist
13040 if ($type eq 'first') {
13041 @newList = $axmud::CLIENT->taskRunFirstList;
13042 } else {
13043 @newList = $axmud::CLIENT->taskRunLastList;
13044 }
13045  
13046 # Check the task isn't already on the list
13047 OUTER: foreach my $item (@newList) {
13048  
13049 if ($item eq $task) {
13050  
13051 $match = $item;
13052 last OUTER;
13053 }
13054 }
13055  
13056 if (! $match) {
13057  
13058 # Task isn't already on the list, so put it there
13059 push (@newList, $task);
13060 }
13061  
13062 # Update the runlist
13063 if ($type eq 'first') {
13064  
13065 $self->session->pseudoCmd(
13066 'setrunlist -f ' . join(' ', @newList),
13067 $self->pseudoCmdMode,
13068 );
13069  
13070 } else {
13071  
13072 $self->session->pseudoCmd(
13073 'setrunlist -l ' . join(' ', @newList),
13074 $self->pseudoCmdMode,
13075 );
13076 }
13077  
13078 # Refresh the simple list
13079 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13080 });
13081  
13082 my $button2 = $self->addButton($grid,
13083 'Delete', 'Delete the selected task from the runlist', undef,
13084 5, 7, 10, 11);
13085 $button2->signal_connect('clicked' => sub {
13086  
13087 my (
13088 $task,
13089 @newList, @reducedList,
13090 );
13091  
13092 ($task) = $self->getSimpleListData($slWidget, 0);
13093  
13094 # Import the existing runlist
13095 if ($type eq 'first') {
13096 @newList = $axmud::CLIENT->taskRunFirstList;
13097 } else {
13098 @newList = $axmud::CLIENT->taskRunLastList;
13099 }
13100  
13101 # Remove the selected task from the list (if it is present)
13102 foreach my $item (@newList) {
13103  
13104 if ($item ne $task) {
13105  
13106 push (@reducedList, $item);
13107 }
13108 }
13109  
13110 # Update the runlist
13111 if ($type eq 'first') {
13112  
13113 $self->session->pseudoCmd(
13114 'setrunlist -f ' . join(' ', @reducedList),
13115 $self->pseudoCmdMode,
13116 );
13117  
13118 } else {
13119  
13120 $self->session->pseudoCmd(
13121 'setrunlist -l ' . join(' ', @reducedList),
13122 $self->pseudoCmdMode,
13123 );
13124 }
13125  
13126 # Refresh the simple list
13127 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13128 });
13129  
13130 my $button3 = $self->addButton($grid,
13131 'Use default list', 'Use the default first and last runlists', undef,
13132 7, 10, 10, 11);
13133 $button3->signal_connect('clicked' => sub {
13134  
13135 # Set the default runlists
13136 $self->session->pseudoCmd('setrunlist -d', $self->pseudoCmdMode);
13137  
13138 # Refresh the simple list
13139 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13140 });
13141  
13142 my $button4 = $self->addButton($grid,
13143 'Dump', 'Display both runlists in the \'main\' window', undef,
13144 10, 12, 10, 11);
13145 $button4->signal_connect('clicked' => sub {
13146  
13147 # Display runlists
13148 $self->session->pseudoCmd('setrunlist', $self->pseudoCmdMode);
13149  
13150 # Refresh the simple list
13151 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13152 });
13153  
13154  
13155 my $button5 = $self->addButton($grid,
13156 'Move up', 'Move the selected task up the runlist', undef,
13157 1, 3, 11, 12);
13158 $button5->signal_connect('clicked' => sub {
13159  
13160 my (
13161 $task, $match, $count,
13162 @newList, @modList,
13163 );
13164  
13165 ($task) = $self->getSimpleListData($slWidget, 0);
13166 if ($task) {
13167  
13168 # Import the existing runlist
13169 if ($type eq 'first') {
13170 @newList = $axmud::CLIENT->taskRunFirstList;
13171 } else {
13172 @newList = $axmud::CLIENT->taskRunLastList;
13173 }
13174  
13175 # Remove the selected task from the list
13176 $count = -1;
13177 foreach my $item (@newList) {
13178  
13179 $count++;
13180  
13181 if ($item ne $task || $count == 0) {
13182  
13183 push (@modList, $item);
13184  
13185 } else {
13186  
13187 $match = $count;
13188 }
13189 }
13190  
13191 if (defined $match) {
13192  
13193 # A task was removed. Replace it one place higher
13194 $match--;
13195 splice (@modList, $match, 0, $task);
13196 }
13197  
13198 # Update the runlist
13199 if ($type eq 'first') {
13200  
13201 $self->session->pseudoCmd(
13202 'setrunlist -f ' . join(' ', @modList),
13203 $self->pseudoCmdMode,
13204 );
13205  
13206 } else {
13207  
13208 $self->session->pseudoCmd(
13209 'setrunlist -l ' . join(' ', @modList),
13210 $self->pseudoCmdMode,
13211 );
13212 }
13213 }
13214  
13215 # Refresh the simple list and select the same line
13216 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13217 if (defined $match) {
13218  
13219 $slWidget->select($match);
13220 }
13221 });
13222  
13223 my $button6 = $self->addButton($grid,
13224 'Move down', 'Move the selected task up the runlist', undef,
13225 10, 12, 11, 12);
13226 $button6->signal_connect('clicked' => sub {
13227  
13228 my (
13229 $task, $match, $count,
13230 @newList, @modList,
13231 );
13232  
13233 ($task) = $self->getSimpleListData($slWidget, 0);
13234 if ($task) {
13235  
13236 # Import the existing runlist
13237 if ($type eq 'first') {
13238 @newList = $axmud::CLIENT->taskRunFirstList;
13239 } else {
13240 @newList = $axmud::CLIENT->taskRunLastList;
13241 }
13242  
13243 # Remove the selected task from the list
13244 $count = -1;
13245 foreach my $item (@newList) {
13246  
13247 $count++;
13248  
13249 if ($item ne $task || $count == (scalar (@newList) - 1)) {
13250  
13251 push (@modList, $item);
13252  
13253 } else {
13254  
13255 $match = $count;
13256 }
13257 }
13258  
13259 if (defined $match) {
13260  
13261 # A task was removed. Replace it one place lower
13262 $match++;
13263 splice (@modList, $match, 0, $task);
13264 }
13265  
13266 # Update the runlist
13267 if ($type eq 'first') {
13268  
13269 $self->session->pseudoCmd(
13270 'setrunlist -f ' . join(' ', @modList),
13271 $self->pseudoCmdMode,
13272 );
13273  
13274 } else {
13275  
13276 $self->session->pseudoCmd(
13277 'setrunlist -l ' . join(' ', @modList),
13278 $self->pseudoCmdMode,
13279 );
13280 }
13281 }
13282  
13283 # Refresh the simple list and select the same line
13284 $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2));
13285 if (defined $match) {
13286  
13287 $slWidget->select($match);
13288 }
13289 });
13290  
13291 # Tab complete
13292 return 1;
13293 }
13294  
13295 sub tasks1Tab_refreshList {
13296  
13297 # Called by $self->tasks1Tab to refresh the GA::Obj::SimpleLists
13298 #
13299 # Expected arguments
13300 # $slWidget - The GA::Obj::SimpleList (not used here)
13301 # $columns - The number of columns in the list
13302 #
13303 # Return values
13304 # 'undef' on improper arguments
13305 # 1 otherwise
13306  
13307 my ($self, $slWidget, $columns, $check) = @_;
13308  
13309 # Local variables
13310 my (
13311 $thisSimpleList,
13312 @firstList, @lastList,
13313 );
13314  
13315 # Check for improper arguments
13316 if (! defined $slWidget || ! defined $columns || defined $check) {
13317  
13318 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks1Tab_refreshList', @_);
13319 }
13320  
13321 # $self->tasks1Tab is used for two tabs; refresh the simple list in both
13322 $thisSimpleList = $self->ivShow('editConfigHash', 'first_list');
13323 @firstList = $axmud::CLIENT->taskRunFirstList;
13324  
13325 $self->resetListData($thisSimpleList, [@firstList], $columns);
13326  
13327 # (The second simple list may not have been created yet)
13328 if ($self->ivExists('editConfigHash', 'last_list')) {
13329  
13330 $thisSimpleList = $self->ivShow('editConfigHash', 'last_list');
13331 @lastList = $axmud::CLIENT->taskRunLastList;
13332  
13333 $self->resetListData($thisSimpleList, [@lastList], $columns);
13334 }
13335  
13336 return 1;
13337 }
13338  
13339 sub tasks3Tab {
13340  
13341 # Tasks3 tab
13342 #
13343 # Expected arguments
13344 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
13345 #
13346 # Return values
13347 # 'undef' on improper arguments
13348 # 1 otherwise
13349  
13350 my ($self, $innerNotebook, $check) = @_;
13351  
13352 # Check for improper arguments
13353 if (! defined $innerNotebook || defined $check) {
13354  
13355 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks3Tab', @_);
13356 }
13357  
13358 # Tab setup
13359 my $grid = $self->addTab('Page _3', $innerNotebook);
13360  
13361 # Commify mode
13362 $self->addLabel($grid, '<b>Commify mode</b>',
13363 0, 12, 0, 1);
13364 $self->addLabel(
13365 $grid,
13366 '<i>How long numbers are made more readable (mostly used by the Status task, but'
13367 . ' available to plugins/scripts)</i>',
13368 1, 12, 1, 2);
13369  
13370 my ($group, $radioButton) = $self->addRadioButton(
13371 $grid, undef, 'Add commas, e.g. 1,000,000', undef,
13372 undef, # IV set to this value when toggled
13373 TRUE, # Sensitive widget
13374 1, 12, 2, 3);
13375 if ($axmud::CLIENT->commifyMode eq 'comma') {
13376  
13377 $radioButton->set_active(TRUE);
13378 }
13379 $radioButton->signal_connect('toggled' => sub {
13380  
13381 if ($radioButton->get_active()) {
13382  
13383 $axmud::CLIENT->set_commifyMode('comma');
13384 }
13385 });
13386  
13387 my ($group2, $radioButton2) = $self->addRadioButton(
13388 $grid, $group, 'Add full stops/periods, e.g. 1.000.000', undef, undef, TRUE,
13389 1, 12, 3, 4);
13390 if ($axmud::CLIENT->commifyMode eq 'europe') {
13391  
13392 $radioButton2->set_active(TRUE);
13393 }
13394 $radioButton2->signal_connect('toggled' => sub {
13395  
13396 if ($radioButton2->get_active()) {
13397  
13398 $axmud::CLIENT->set_commifyMode('europe');
13399 }
13400 });
13401  
13402 my ($group3, $radioButton3) = $self->addRadioButton(
13403 $grid, $group, 'Add spaces, e.g. 1 000 000', undef, undef, TRUE,
13404 1, 12, 4, 5);
13405 if ($axmud::CLIENT->commifyMode eq 'brit') {
13406  
13407 $radioButton3->set_active(TRUE);
13408 }
13409 $radioButton3->signal_connect('toggled' => sub {
13410  
13411 if ($radioButton3->get_active()) {
13412  
13413 $axmud::CLIENT->set_commifyMode('brit');
13414 }
13415 });
13416  
13417 my ($group4, $radioButton4) = $self->addRadioButton(
13418 $grid, $group, 'Add underlines/undescores, e.g. 1_000_000', undef, undef, TRUE,
13419 1, 12, 5, 6);
13420 if ($axmud::CLIENT->commifyMode eq 'underline') {
13421  
13422 $radioButton4->set_active(TRUE);
13423 }
13424 $radioButton4->signal_connect('toggled' => sub {
13425  
13426 if ($radioButton4->get_active()) {
13427  
13428 $axmud::CLIENT->set_commifyMode('underline');
13429 }
13430 });
13431  
13432 my ($group5, $radioButton5) = $self->addRadioButton(
13433 $grid, $group, 'Don\'t commify large numbers', undef, undef, TRUE,
13434 1, 12, 6, 7);
13435 if ($axmud::CLIENT->commifyMode eq 'none') {
13436  
13437 $radioButton5->set_active(TRUE);
13438 }
13439 $radioButton5->signal_connect('toggled' => sub {
13440  
13441 if ($radioButton5->get_active()) {
13442  
13443 $axmud::CLIENT->set_commifyMode('none');
13444 }
13445 });
13446  
13447 # Tab complete
13448 return 1;
13449 }
13450  
13451 sub scriptsTab {
13452  
13453 # Scripts tab
13454 #
13455 # Expected arguments
13456 # (none besides $self)
13457 #
13458 # Return values
13459 # 'undef' on improper arguments
13460 # 1 otherwise
13461  
13462 my ($self, $check) = @_;
13463  
13464 # Local variables
13465 my (
13466 @columnList, @initList, @comboList,
13467 %comboHash,
13468 );
13469  
13470 # Check for improper arguments
13471 if (defined $check) {
13472  
13473 return $axmud::CLIENT->writeImproper($self->_objClass . '->scriptsTab', @_);
13474 }
13475  
13476 # Tab setup
13477 my $grid = $self->addTab('Sc_ripts', $self->notebook);
13478  
13479 # Initial tasks
13480 $self->addLabel($grid, '<b>Initial scripts</b>',
13481 0, 13, 0, 1);
13482 $self->addLabel($grid,
13483 '<i>List of initial scripts that start with every new session (after the character'
13484 . ' logs in)</i>',
13485 1, 13, 1, 2);
13486  
13487 # Add a simple list
13488 @columnList = (
13489 'Script' => 'text',
13490 'Run mode' => 'text',
13491 );
13492  
13493 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
13494 1, 13, 2, 10);
13495  
13496 # Initialise the list
13497 $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2));
13498  
13499 # Add editing entry boxes/buttons
13500 $self->addLabel($grid, 'Script name',
13501 1, 3, 10, 11);
13502 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
13503 3, 7, 10, 11);
13504  
13505 @initList = (
13506 'no_task' => 'Run without a task',
13507 'run_task' => 'Run from within a task',
13508 'run_task_win' => 'Run in \'forced window\' mode',
13509 );
13510  
13511 do {
13512  
13513 my ($value, $string, $descrip);
13514  
13515 $value = shift @initList;
13516 $string = shift @initList;
13517 $descrip = 'Mode \'' . $value . '\' - ' . $string;
13518  
13519 push (@comboList, $descrip);
13520 $comboHash{$descrip} = $value;
13521  
13522 } until (! @initList);
13523  
13524 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
13525 TRUE, # No 'undef' value used
13526 7, 13, 10, 11);
13527  
13528 my $button = $self->addButton(
13529 $grid,
13530 'Add',
13531 'Add this script to the global list of initial scripts',
13532 undef,
13533 1, 3, 11, 12,
13534 );
13535 $button->signal_connect('clicked' => sub {
13536  
13537 my ($scriptName, $descrip, $mode, $switch);
13538  
13539 if ($self->checkEntryIcon($entry)) {
13540  
13541 $scriptName = $entry->get_text();
13542 $descrip = $combo->get_active_text();
13543 $mode = $comboHash{$descrip};
13544  
13545 if ($mode eq 'no_task') {
13546 $switch = '-r';
13547 } elsif ($mode eq 'run_task') {
13548 $switch = '-t';
13549 } else {
13550 $switch = '-c';
13551 }
13552  
13553 $self->session->pseudoCmd(
13554 'addinitialscript ' . $scriptName . ' ' . $switch,
13555 $self->pseudoCmdMode,
13556 );
13557  
13558 # Reset the simple list and reset the entry box
13559 $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2));
13560 $self->resetEntryBoxes($entry);
13561 }
13562 });
13563  
13564 my $button2 = $self->addButton(
13565 $grid,
13566 'Delete',
13567 'Delete the selected script',
13568 undef,
13569 3, 5, 11, 12);
13570 $button2->signal_connect('clicked' => sub {
13571  
13572 my ($name) = $self->getSimpleListData($slWidget, 0);
13573 if (defined $name) {
13574  
13575 $self->session->pseudoCmd(
13576 'deleteinitialscript ' . $name,
13577 $self->pseudoCmdMode,
13578 );
13579  
13580 # Reset the simple list and reset the entry box
13581 $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2));
13582 $self->resetEntryBoxes($entry);
13583 }
13584 });
13585  
13586 my $button3 = $self->addButton($grid,
13587 'Move up', 'Move the selected script up the list', undef,
13588 5, 7, 11, 12);
13589 $button3->signal_connect('clicked' => sub {
13590  
13591 my (
13592 $script, $match, $count,
13593 @orderList, @modList,
13594 );
13595  
13596 ($script) = $self->getSimpleListData($slWidget, 0);
13597 if (defined $script) {
13598  
13599 # Import the existing order list
13600 @orderList = $axmud::CLIENT->initScriptOrderList;
13601  
13602 # Remove the selected script from the list
13603 $count = -1;
13604 foreach my $item (@orderList) {
13605  
13606 $count++;
13607  
13608 if ($item ne $script || $count == 0) {
13609  
13610 push (@modList, $item);
13611  
13612 } else {
13613  
13614 $match = $count;
13615 }
13616 }
13617  
13618 if (defined $match) {
13619  
13620 # A script was removed. Replace it one place higher
13621 $match--;
13622 splice (@modList, $match, 0, $script);
13623 }
13624  
13625 # Update the list
13626 $axmud::CLIENT->set_initScriptOrderList(@modList);
13627  
13628 # Refresh the simple list and select the same line
13629 $self->scriptsTab_refreshList($slWidget, scalar (@columnList / 2));
13630 if (defined $match) {
13631  
13632 $slWidget->select($match);
13633 }
13634 }
13635 });
13636  
13637 my $button4 = $self->addButton($grid,
13638 'Move down', 'Move the selected script down the list', undef,
13639 7, 9, 11, 12);
13640 $button4->signal_connect('clicked' => sub {
13641  
13642 my (
13643 $script, $match, $count,
13644 @orderList, @modList,
13645 );
13646  
13647 ($script) = $self->getSimpleListData($slWidget, 0);
13648 if (defined $script) {
13649  
13650 # Import the existing order list
13651 @orderList = $axmud::CLIENT->initScriptOrderList;
13652  
13653 # Remove the selected script from the list
13654 $count = -1;
13655 foreach my $item (@orderList) {
13656  
13657 $count++;
13658  
13659 if ($item ne $script || $count == (scalar (@orderList) - 1)) {
13660  
13661 push (@modList, $item);
13662  
13663 } else {
13664  
13665 $match = $count;
13666 }
13667 }
13668  
13669 if (defined $match) {
13670  
13671 # A script was removed. Replace it one place lower
13672 $match++;
13673 splice (@modList, $match, 0, $script);
13674 }
13675  
13676 # Update the list
13677 $axmud::CLIENT->set_initScriptOrderList(@modList);
13678  
13679 # Refresh the simple list and select the same line
13680 $self->scriptsTab_refreshList($slWidget, scalar (@columnList / 2));
13681 if (defined $match) {
13682  
13683 $slWidget->select($match);
13684 }
13685 }
13686 });
13687  
13688 my $button5 = $self->addButton(
13689 $grid,
13690 'Dump',
13691 'Display this profile\'s list of initial tasks in the \'main\' window',
13692 undef,
13693 9, 11, 11, 12,
13694 );
13695 $button5->signal_connect('clicked' => sub {
13696  
13697 # Display initial scripts
13698 $self->session->pseudoCmd('listinitialscript', $self->pseudoCmdMode);
13699  
13700 # Reset the simple list
13701 $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2));
13702 });
13703  
13704 my $button6 = $self->addButton(
13705 $grid,
13706 'Refresh list',
13707 'Refresh the list of initial scripts',
13708 undef,
13709 11, 13, 11, 12,
13710 );
13711 $button6->signal_connect('clicked' => sub {
13712  
13713 # Reset the simple list
13714 $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2));
13715 });
13716  
13717 # Tab complete
13718 return 1;
13719 }
13720  
13721 sub scriptsTab_refreshList {
13722  
13723 # Called by $self->scriptsTab to refresh the GA::Obj::SimpleList
13724 #
13725 # Expected arguments
13726 # $slWidget - The GA::Obj::SimpleList
13727 # $columns - Number of columns in the simple list
13728 #
13729 # Return values
13730 # 'undef' on improper arguments
13731 # 1 otherwise
13732  
13733 my ($self, $slWidget, $columns, $check) = @_;
13734  
13735 # Local variables
13736 my @dataList;
13737  
13738 # Check for improper arguments
13739 if (! defined $slWidget || ! defined $columns || defined $check) {
13740  
13741 return $axmud::CLIENT->writeImproper(
13742 $self->_objClass . '->scriptsTab_refreshList',
13743 @_,
13744 );
13745 }
13746  
13747 # Compile the simple list data
13748 OUTER: foreach my $scriptName ($axmud::CLIENT->initScriptOrderList) {
13749  
13750 push (@dataList,
13751 $scriptName,
13752 $axmud::CLIENT->ivShow('initScriptHash', $scriptName),
13753 );
13754 }
13755  
13756 # Reset the simple list
13757 $self->resetListData($slWidget, [@dataList], $columns);
13758  
13759 return 1;
13760 }
13761  
13762 sub chatTab {
13763  
13764 # Chat tab - called by $self->setupNotebook
13765 #
13766 # Expected arguments
13767 # (none besides $self)
13768 #
13769 # Return values
13770 # 'undef' on improper arguments
13771 # 1 otherwise
13772  
13773 my ($self, $check) = @_;
13774  
13775 # Check for improper arguments
13776 if (defined $check) {
13777  
13778 return $axmud::CLIENT->writeImproper($self->_objClass . '->chatTab', @_);
13779 }
13780  
13781 # Tab setup
13782 # Create a notebook within the main one, so that we have two rows of tabs
13783 my $innerNotebook = $self->addInnerNotebookTab('C_hat', $self->notebook);
13784  
13785 # Add tabs to the inner notebook
13786 $self->chat1Tab($innerNotebook);
13787 $self->chat2Tab($innerNotebook);
13788 $self->chat3Tab($innerNotebook);
13789 $self->chat4Tab($innerNotebook);
13790 $self->chat5Tab($innerNotebook);
13791  
13792 return 1;
13793 }
13794  
13795 sub chat1Tab {
13796  
13797 # Chat1 tab
13798 #
13799 # Expected arguments
13800 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
13801 #
13802 # Return values
13803 # 'undef' on improper arguments
13804 # 1 otherwise
13805  
13806 my ($self, $innerNotebook, $check) = @_;
13807  
13808 # Check for improper arguments
13809 if (! defined $innerNotebook || defined $check) {
13810  
13811 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat1Tab', @_);
13812 }
13813  
13814 # Tab setup
13815 my $grid = $self->addTab('Page _1', $innerNotebook);
13816  
13817 # Chat task actions
13818 $self->addLabel($grid, '<b>Chat task actions</b>',
13819 0, 12, 0, 1);
13820  
13821 # Left column
13822 $self->addLabel($grid, '<i>Incoming calls</i>',
13823 1, 6, 1, 2);
13824  
13825 my $button = $self->addButton(
13826 $grid,
13827 'Listen out for incoming calls',
13828 'Listen out for incoming calls',
13829 undef,
13830 1, 6, 2, 3);
13831 $button->signal_connect('clicked' => sub {
13832  
13833 $self->session->pseudoCmd('chatlisten', $self->pseudoCmdMode);
13834 });
13835  
13836 my $button2 = $self->addButton(
13837 $grid,
13838 'Stop listening for incoming calls',
13839 'Stop listening for incoming calls',
13840 undef,
13841 1, 6, 3, 4);
13842 $button2->signal_connect('clicked' => sub {
13843  
13844 $self->session->pseudoCmd('chatignore', $self->pseudoCmdMode);
13845 });
13846  
13847 my ($group, $radioButton) = $self->addRadioButton(
13848 $grid, undef,
13849 'Auto-accept all incoming calls',
13850 undef, undef, TRUE,
13851 1, 6, 4, 5);
13852 if ($axmud::CLIENT->chatAcceptMode eq 'accept_all') {
13853  
13854 $radioButton->set_active(TRUE);
13855 }
13856  
13857 my ($group2, $radioButton2) = $self->addRadioButton(
13858 $grid, $group,
13859 'Auto-accept calls from known contacts',
13860 undef, undef, TRUE,
13861 1, 6, 5, 6);
13862 if ($axmud::CLIENT->chatAcceptMode eq 'accept_contact') {
13863  
13864 $radioButton2->set_active(TRUE);
13865 }
13866  
13867 my ($group3, $radioButton3) = $self->addRadioButton(
13868 $grid, $group,
13869 'Ask before accepting incoming calls',
13870 undef, undef, TRUE,
13871 1, 6, 6, 7);
13872 if ($axmud::CLIENT->chatAcceptMode eq 'prompt') {
13873  
13874 $radioButton3->set_active(TRUE);
13875 }
13876  
13877 $radioButton->signal_connect('toggled' => sub {
13878  
13879 if ($radioButton->get_active()) {
13880  
13881 $self->session->pseudoCmd('chatset -i', $self->pseudoCmdMode);
13882 }
13883 });
13884 $radioButton2->signal_connect('toggled' => sub {
13885  
13886 if ($radioButton2->get_active()) {
13887  
13888 $self->session->pseudoCmd('chatset -c', $self->pseudoCmdMode);
13889 }
13890 });
13891 $radioButton3->signal_connect('toggled' => sub {
13892  
13893 if ($radioButton3->get_active()) {
13894  
13895 $self->session->pseudoCmd('chatset -u', $self->pseudoCmdMode);
13896 }
13897 });
13898  
13899 # Right column
13900 $self->addLabel($grid, '<i>Outgoing calls (see also <b>Page 4</b>)</i>',
13901 7, 13, 1, 2);
13902  
13903 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 3, 128,
13904 7, 10, 2, 3);
13905 $self->addLabel($grid, 'IP address',
13906 10, 12, 2, 3);
13907  
13908 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 65535,
13909 7, 10, 3, 4);
13910 $entry2->set_text($axmud::CLIENT->constChatPort);
13911 $self->addLabel($grid, 'Port',
13912 10, 12, 3, 4);
13913  
13914 my $button4 = $self->addButton($grid,
13915 'MudMaster call', 'Call using the MudMaster protocol', undef,
13916 7, 9, 4, 5);
13917 $button4->signal_connect('clicked' => sub {
13918  
13919 my ($ip, $port);
13920  
13921 if ($self->checkEntryIcon($entry, $entry2)) {
13922  
13923 $ip = $entry->get_text();
13924 $port = $entry2->get_text();
13925  
13926 $self->session->pseudoCmd(
13927 'chatmcall ' . $ip . ' ' . $port,
13928 $self->pseudoCmdMode,
13929 );
13930 }
13931 });
13932  
13933 my $button5 = $self->addButton($grid, 'zChat call', 'Call using the zChat protocol', undef,
13934 9, 12, 4, 5);
13935 $button5->signal_connect('clicked' => sub {
13936  
13937 my ($ip, $port);
13938  
13939 if ($self->checkEntryIcon($entry, $entry2)) {
13940  
13941 $ip = $entry->get_text();
13942 $port = $entry2->get_text();
13943  
13944 $self->session->pseudoCmd(
13945 'chatzcall ' . $ip . ' ' . $port,
13946 $self->pseudoCmdMode,
13947 );
13948 }
13949 });
13950  
13951 $self->addLabel($grid, '<i>Current calls</i>',
13952 7, 12, 5, 6);
13953 my $button3 = $self->addButton($grid,
13954 'Terminate all current chat sessions', 'Terminate all current chat sessions', undef,
13955 7, 12, 6, 7);
13956 $button3->signal_connect('clicked' => sub {
13957  
13958 $self->session->pseudoCmd('chathangup', $self->pseudoCmdMode);
13959 });
13960  
13961 # Tab complete
13962 return 1;
13963 }
13964  
13965 sub chat2Tab {
13966  
13967 # Chat2 tab
13968 #
13969 # Expected arguments
13970 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
13971 #
13972 # Return values
13973 # 'undef' on improper arguments
13974 # 1 otherwise
13975  
13976 my ($self, $innerNotebook, $check) = @_;
13977  
13978 # Local variables
13979 my (
13980 $radioChoice, $switchString,
13981 @buttonList, @textButtonList, @noTextButtonList,
13982 );
13983  
13984 # Check for improper arguments
13985 if (! defined $innerNotebook || defined $check) {
13986  
13987 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat2Tab', @_);
13988 }
13989  
13990 # Tab setup
13991 my $grid = $self->addTab('Page _2', $innerNotebook);
13992  
13993 # Chat task actions
13994 $self->addLabel($grid, '<b>Chat task actions (cont.)</b>',
13995 0, 12, 0, 1);
13996  
13997 # Left column
13998 my ($group, $radioButton) = $self->addRadioButton(
13999 $grid, undef, 'Apply to all sessions', undef, undef, TRUE,
14000 1, 6, 1, 2);
14001  
14002 my ($group2, $radioButton2) = $self->addRadioButton(
14003 $grid, $group, 'Apply to group:', undef, undef, TRUE,
14004 1, 3, 2, 3);
14005 my $entry = $self->addEntryWithIcon($grid,
14006 undef, 'string', 1, 16,
14007 3, 6, 2, 3);
14008 $entry->set_sensitive(FALSE); # Starts insensitive
14009  
14010 my ($group3, $radioButton3) = $self->addRadioButton(
14011 $grid, $group, 'Apply to name:', undef, undef, TRUE,
14012 1, 3, 3, 4);
14013 my $entry2 = $self->addEntryWithIcon($grid,
14014 undef, 'string', 1, 16,
14015 3, 6, 3, 4);
14016 $entry2->set_sensitive(FALSE); # Starts insensitive
14017  
14018 $radioChoice = 0;
14019 $switchString = '';
14020  
14021 my $button = $self->addButton($grid,
14022 'Allow snooping', 'Allow the selected contacts to snoop you', undef,
14023 1, 3, 6, 7);
14024 $button->signal_connect('clicked' => sub {
14025  
14026 if (defined $switchString) {
14027  
14028 $self->session->pseudoCmd('chatset -a' . $switchString, $self->pseudoCmdMode);
14029 }
14030 });
14031  
14032 my $button2 = $self->addButton($grid,
14033 'Forbid snooping ', 'Forbid the selected contacts from snooping you', undef,
14034 3, 6, 6, 7);
14035 $button2->signal_connect('clicked' => sub {
14036  
14037 if (defined $switchString) {
14038  
14039 $self->session->pseudoCmd('chatset -f' . $switchString, $self->pseudoCmdMode);
14040 }
14041 });
14042  
14043 my $button3 = $self->addButton($grid,
14044 'Mark public', 'Mark the selected chat sessions as \'public\'', undef,
14045 1, 3, 7, 8);
14046 $button3->signal_connect('clicked' => sub {
14047  
14048 if (defined $switchString) {
14049  
14050 $self->session->pseudoCmd('chatset -p' . $switchString, $self->pseudoCmdMode);
14051 }
14052 });
14053 my $button4 = $self->addButton($grid,
14054 'Mark private ', 'Mark the selected chat sessions as \'private\'', undef,
14055 3, 6, 7, 8);
14056 $button4->signal_connect('clicked' => sub {
14057  
14058 if (defined $switchString) {
14059  
14060 $self->session->pseudoCmd('chatset -v' . $switchString, $self->pseudoCmdMode);
14061 }
14062 });
14063  
14064 my $button5 = $self->addButton($grid,
14065 'Mark serving', 'Mark the selected chat sessions as \'serving\'', undef,
14066 1, 3, 8, 9);
14067 $button5->signal_connect('clicked' => sub {
14068  
14069 if (defined $switchString) {
14070  
14071 $self->session->pseudoCmd('chatset -s' . $switchString, $self->pseudoCmdMode);
14072 }
14073 });
14074 my $button6 = $self->addButton($grid,
14075 'Mark not serving ', 'Mark the selected chat sessions as \'not serving\'', undef,
14076 3, 6, 8, 9);
14077 $button6->signal_connect('clicked' => sub {
14078  
14079 if (defined $switchString) {
14080  
14081 $self->session->pseudoCmd('chatset -z' . $switchString, $self->pseudoCmdMode);
14082 }
14083 });
14084  
14085 # Right column
14086 my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
14087 7, 13, 1, 2);
14088  
14089 my $button7 = $self->addButton($grid, 'Chat', 'Chat to the selected contacts', undef,
14090 7, 10, 2, 3);
14091 $button7->signal_connect('clicked' => sub {
14092  
14093 if ($radioButton->get_active()) {
14094  
14095 # ;chatall <text>
14096 $self->session->pseudoCmd('chatall ' . $entry3->get_text(), $self->pseudoCmdMode);
14097  
14098 } elsif ($self->checkEntryIcon($entry)) {
14099  
14100 # ;chatgroup <group> <text>
14101 $self->session->pseudoCmd(
14102 'chatgroup ' . $entry->get_text() . ' ' . $entry3->get_text(),
14103 $self->pseudoCmdMode,
14104 );
14105  
14106 } elsif ($self->checkEntryIcon($entry2)) {
14107  
14108 # ;chat <name> <text>
14109 $self->session->pseudoCmd(
14110 'chat ' . $entry2->get_text() . ' ' . $entry3->get_text(),
14111 $self->pseudoCmdMode,
14112 );
14113 }
14114 });
14115 my $button8 = $self->addButton($grid, 'Emote', 'Emote to the selected contacts', undef,
14116 10, 13, 2, 3);
14117 $button8->signal_connect('clicked' => sub {
14118  
14119 if ($radioButton->get_active()) {
14120  
14121 # ;emoteall <text>
14122 $self->session->pseudoCmd('emoteall ' . $entry3->get_text(), $self->pseudoCmdMode);
14123  
14124 } elsif ($self->checkEntryIcon($entry)) {
14125  
14126 # ;emotegroup <group> <text>
14127 $self->session->pseudoCmd(
14128 'emotegroup ' . $entry->get_text() . ' ' . $entry3->get_text(),
14129 $self->pseudoCmdMode,
14130 );
14131  
14132 } elsif ($self->checkEntryIcon($entry2)) {
14133  
14134 # ;emote <name> <text>
14135 $self->session->pseudoCmd(
14136 'emote ' . $entry2->get_text() . ' ' . $entry3->get_text(),
14137 $self->pseudoCmdMode,
14138 );
14139 }
14140 });
14141  
14142 my $button9 = $self->addButton($grid, 'Ping', 'Ping the selected contacts', undef,
14143 7, 10, 3, 4);
14144 $button9->signal_connect('clicked' => sub {
14145  
14146 if (defined $switchString) {
14147  
14148 $self->session->pseudoCmd('chatping' . $switchString, $self->pseudoCmdMode);
14149 }
14150 });
14151 my $button10 = $self->addButton($grid,
14152 'DND', 'Send \'Do not disturb\' message to selected contacts (MM only)', undef,
14153 10, 13, 3, 4);
14154 $button10->signal_connect('clicked' => sub {
14155  
14156 if (defined $switchString) {
14157  
14158 $self->session->pseudoCmd('chatdnd' . $switchString, $self->pseudoCmdMode);
14159 }
14160 });
14161  
14162 my $button11 = $self->addButton($grid,
14163 'Submit', 'Allow the selected contacts to send you remote commands', undef,
14164 7, 9, 4, 5);
14165 $button11->signal_connect('clicked' => sub {
14166  
14167 if (defined $switchString) {
14168  
14169 $self->session->pseudoCmd('chatsubmit' . $switchString, $self->pseudoCmdMode);
14170 }
14171 });
14172 my $button12 = $self->addButton($grid,
14173 'Escape', 'Forbid the selected contacts from sending you remote commands', undef,
14174 9, 11, 4, 5);
14175 $button12->signal_connect('clicked' => sub {
14176  
14177 if (defined $switchString) {
14178  
14179 $self->session->pseudoCmd('chatescape' . $switchString, $self->pseudoCmdMode);
14180 }
14181 });
14182 my $button13 = $self->addButton($grid,
14183 'Send cmd', 'Send a command to the selected contacts', undef,
14184 11, 13, 4, 5);
14185 $button13->signal_connect('clicked' => sub {
14186  
14187 if (defined $switchString) {
14188  
14189 # ;chatcmd <switches> <text>
14190 $self->session->pseudoCmd(
14191 'chatcommand' . $switchString . ' ' . $entry3->get_text(),
14192 $self->pseudoCmdMode,
14193 );
14194 }
14195 });
14196  
14197 my $button14 = $self->addButton($grid,
14198 'Send file', 'Sends a file to the selected contacts', undef,
14199 7, 10, 5, 6);
14200 $button14->signal_connect('clicked' => sub {
14201  
14202 if (defined $switchString) {
14203  
14204 if ($self->checkEntryIcon($entry3)) {
14205  
14206 # ;chatsendfile <switches> <file>
14207 $self->session->pseudoCmd(
14208 'chatsendfile' . $switchString . ' ' . $entry3->get_text(),
14209 $self->pseudoCmdMode,
14210 );
14211  
14212 } else {
14213  
14214 # ;chatsendfile <switches>
14215 $self->session->pseudoCmd('chatsendfile' . $switchString, $self->pseudoCmdMode);
14216 }
14217 }
14218 });
14219 my $button15 = $self->addButton($grid,
14220 'Stop file',
14221 'Cancels any files transfers in progress with the selected contacts',
14222 undef,
14223 10, 13, 5, 6);
14224 $button15->signal_connect('clicked' => sub {
14225  
14226 if (defined $switchString) {
14227  
14228 $self->session->pseudoCmd('chatstopfile' . $switchString, $self->pseudoCmdMode);
14229 }
14230 });
14231  
14232 my $button16 = $self->addButton($grid,
14233 'Snoop', 'Requests to snoop on the selected contacts', undef,
14234 7, 10, 6, 7);
14235 $button16->signal_connect('clicked' => sub {
14236  
14237 if (defined $switchString) {
14238  
14239 $self->session->pseudoCmd('chatsnoop' . $switchString, $self->pseudoCmdMode);
14240 }
14241 });
14242 my $button17 = $self->addButton($grid,
14243 'Hang up', 'Hang up on the selected contacts', undef,
14244 10, 13, 6, 7);
14245 $button17->signal_connect('clicked' => sub {
14246  
14247 if (defined $switchString) {
14248  
14249 $self->session->pseudoCmd('chathangup' . $switchString, $self->pseudoCmdMode);
14250 }
14251 });
14252  
14253 my $button18 = $self->addButton($grid,
14254 'Peek', 'Ask for a list of the selected contacts\' own chat connections', undef,
14255 7, 10, 7, 8);
14256 $button18->signal_connect('clicked' => sub {
14257  
14258 if (defined $switchString) {
14259  
14260 $self->session->pseudoCmd('chatpeek' . $switchString, $self->pseudoCmdMode);
14261 }
14262 });
14263 my $button19 = $self->addButton($grid,
14264 'Request', 'Connect to all of the selected contacts\' own chat connections', undef,
14265 10, 13, 7, 8);
14266 $button19->signal_connect('clicked' => sub {
14267  
14268 if (defined $switchString) {
14269  
14270 $self->session->pseudoCmd('chatrequest' . $switchString, $self->pseudoCmdMode);
14271 }
14272 });
14273  
14274 my $button20 = $self->addButton($grid,
14275 'Set encoding', 'Set the encoding used in the selected chat sessions', undef,
14276 7, 10, 8, 9);
14277 $button20->signal_connect('clicked' => sub {
14278  
14279 if (defined $switchString) {
14280  
14281 # ;chatset -e <encoding> <switches>
14282 $self->session->pseudoCmd(
14283 'chatset -e ' . $entry3->get_text() . $switchString,
14284 $self->pseudoCmdMode,
14285 );
14286 }
14287  
14288 });
14289 my $button21 = $self->addButton($grid,
14290 'Default encoding ', 'Use default encoding in the selected chat sessions', undef,
14291 10, 13, 8, 9);
14292 $button21->signal_connect('clicked' => sub {
14293  
14294 if (defined $switchString) {
14295  
14296 # ;chatset -e <switches>
14297 $self->session->pseudoCmd(
14298 'chatset -e' . $switchString,
14299 $self->pseudoCmdMode,
14300 );
14301 }
14302 });
14303  
14304 # List of all buttons which are sensitised, or not, depending on the radio buttons and entry
14305 # boxes
14306 @buttonList = (
14307 $button, $button2, $button3, $button4, $button5, $button6, $button7, $button8, $button9,
14308 $button10, $button11, $button12, $button13, $button14, $button15, $button16, $button17,
14309 $button18, $button19, $button20, $button21,
14310 );
14311  
14312 # List of buttons which only be sensitised when there is acceptable text in $entry3
14313 @textButtonList = (
14314 $button7, $button8, $button13, $button20,
14315 );
14316  
14317 # List of buttons which are not in @textButtonList
14318 @noTextButtonList = (
14319 $button, $button2, $button3, $button4, $button5, $button6, $button9, $button10,
14320 $button11, $button12, $button14, $button15, $button16, $button17, $button18, $button19,
14321 $button21,
14322 );
14323  
14324 # Some buttons start desensitised
14325 $self->desensitiseWidgets(@textButtonList);
14326  
14327 # Entry/radio button signal_connects
14328 $radioButton->signal_connect('toggled' => sub {
14329  
14330 $radioChoice = 0;
14331 $switchString = ''; # Apply to all sessions - no switch needed
14332  
14333 $entry->set_sensitive(FALSE);
14334 $entry->set_text('');
14335 $entry2->set_sensitive(FALSE);
14336 $entry2->set_text('');
14337  
14338 $self->sensitiseWidgets(@noTextButtonList);
14339 if ($self->checkEntryIcon($entry3)) {
14340 $self->sensitiseWidgets(@textButtonList);
14341 } else {
14342 $self->desensitiseWidgets(@textButtonList);
14343 }
14344 });
14345  
14346 $radioButton2->signal_connect('toggled' => sub {
14347  
14348 $radioChoice = 1;
14349 $switchString = ''; # $switchString set below
14350  
14351 $entry->set_sensitive(TRUE);
14352 $entry->set_text('');
14353 $entry2->set_sensitive(FALSE);
14354 $entry2->set_text('');
14355 $self->desensitiseWidgets(@buttonList);
14356 });
14357  
14358 $radioButton3->signal_connect('toggled' => sub {
14359  
14360 $radioChoice = 2;
14361 $switchString = ''; # $switchString set below
14362  
14363 $entry->set_sensitive(FALSE);
14364 $entry->set_text('');
14365 $entry2->set_sensitive(TRUE);
14366 $entry2->set_text('');
14367 $self->desensitiseWidgets(@buttonList);
14368 });
14369  
14370 $entry->signal_connect('changed' => sub {
14371  
14372 if ($self->checkEntryIcon($entry)) {
14373  
14374 # e.g. '-g mygroup'
14375 $switchString = ' -g ' . $entry->get_text();
14376  
14377 $self->sensitiseWidgets(@noTextButtonList);
14378 if ($self->checkEntryIcon($entry3)) {
14379 $self->sensitiseWidgets(@textButtonList);
14380 } else {
14381 $self->desensitiseWidgets(@textButtonList);
14382 }
14383  
14384 } else {
14385  
14386 # No buttons can be used
14387 $switchString = undef;
14388 $self->desensitiseWidgets(@buttonList);
14389 }
14390 });
14391 $entry2->signal_connect('changed' => sub {
14392  
14393 if ($self->checkEntryIcon($entry2)) {
14394  
14395 # e.g. '-n myname'
14396 $switchString = ' -n ' . $entry2->get_text();
14397  
14398 $self->sensitiseWidgets(@noTextButtonList);
14399 if ($self->checkEntryIcon($entry3)) {
14400 $self->sensitiseWidgets(@textButtonList);
14401 } else {
14402 $self->desensitiseWidgets(@textButtonList);
14403 }
14404  
14405 } else {
14406  
14407 # No buttons can be used
14408 $switchString = undef;
14409 $self->desensitiseWidgets(@buttonList);
14410 }
14411 });
14412 $entry3->signal_connect('changed' => sub {
14413  
14414 if ($self->checkEntryIcon($entry3)) {
14415  
14416 if (
14417 $self->checkEntryIcon($entry)
14418 || $self->checkEntryIcon($entry2)
14419 || $radioButton->get_active()
14420 ) {
14421 $self->sensitiseWidgets(@buttonList);
14422  
14423 } else {
14424  
14425 $self->sensitiseWidgets(@noTextButtonList);
14426 $self->desensitiseWidgets(@textButtonList);
14427 }
14428  
14429 } else {
14430  
14431 if (
14432 $self->checkEntryIcon($entry)
14433 || $self->checkEntryIcon($entry2)
14434 || $radioButton->get_active()
14435 ) {
14436 $self->sensitiseWidgets(@noTextButtonList);
14437 $self->desensitiseWidgets(@textButtonList);
14438  
14439 } else {
14440  
14441 $self->desensitiseWidgets(@buttonList);
14442 }
14443 }
14444 });
14445  
14446 # Tab complete
14447 return 1;
14448 }
14449  
14450 sub chat3Tab {
14451  
14452 # Chat3 tab
14453 #
14454 # Expected arguments
14455 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
14456 #
14457 # Return values
14458 # 'undef' on improper arguments
14459 # 1 otherwise
14460  
14461 my ($self, $innerNotebook, $check) = @_;
14462  
14463 # Local variables
14464 my (
14465 $scriptDir, $posn, $count, $shortPath,
14466 @fileList, @taskList,
14467 );
14468  
14469 # Check for improper arguments
14470 if (! defined $innerNotebook || defined $check) {
14471  
14472 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat3Tab', @_);
14473 }
14474  
14475 # Tab setup
14476 my $grid = $self->addTab('Page _3', $innerNotebook);
14477  
14478 # Chat options
14479 $self->addLabel($grid, '<b>Chat options</b>',
14480 0, 12, 0, 1);
14481  
14482 # Left column
14483 $self->addLabel($grid, '<i>Choose an icon for all your chat sessions</i>',
14484 1, 6, 1, 2);
14485  
14486 # Get a list of .bmp files in /icons/chat
14487 $scriptDir = $axmud::SHARE_DIR;
14488 if ($^O eq 'MSWin32') {
14489 @fileList = glob($scriptDir . '\\icons\\chat\\*.bmp');
14490 } else {
14491 @fileList = glob($scriptDir . '/icons/chat/*.bmp');
14492 }
14493  
14494 # Move the default chat icon to the top of the list (not sure if different code for MSWin is
14495 # actually necessary, but let's keep items in @fileList consistent)
14496 if ($^O eq 'MSWin32') {
14497 unshift (@fileList, $scriptDir . '\\' . $axmud::CLIENT->constChatIcon);
14498 } else {
14499 unshift (@fileList, $scriptDir . '/' . $axmud::CLIENT->constChatIcon);
14500 }
14501  
14502 # Find the position of the current chat icon in the list
14503 $count = -1;
14504 OUTER: foreach my $file (@fileList) {
14505  
14506 $count++;
14507 if ($file eq $axmud::CLIENT->chatIcon) {
14508  
14509 $posn = $count;
14510 last OUTER;
14511 }
14512 }
14513  
14514 # If the .bmp file used for the current icon no longer exists, use the default chat icon
14515 # instead
14516 if (! defined $posn) {
14517  
14518 $posn = 0;
14519 $axmud::CLIENT->set_chatIcon($scriptDir . '/' . $axmud::CLIENT->constChatIcon);
14520 }
14521  
14522 # Add a frame, containing one of the chat icons
14523 my ($image, $frame, $viewPort) = $self->addImage($grid, $fileList[$posn], undef,
14524 FALSE, # Don't use a scrolled window
14525 128, 128,
14526 1, 4, 2, 6);
14527  
14528 # Add an entry beneath the frame to display the current icon shown
14529 my $entry = $self->addEntry($grid, undef, FALSE,
14530 1, 6, 6, 7);
14531 $shortPath = $fileList[$posn];
14532 if ($shortPath) {
14533  
14534 # Repair MSWin paths, so $scriptDir can be used in a substitution
14535 $scriptDir =~ s/\\/\\\\/g;
14536 # Do the substitution
14537 $shortPath =~ s/$scriptDir//;
14538  
14539 $entry->set_text($shortPath);
14540 }
14541  
14542 # Add two buttons to cycle through images
14543 my $button = $self->addButton($grid, '<<', 'Switch to previous image', undef,
14544 4, 5, 2, 3);
14545 $button->signal_connect('clicked' => sub {
14546  
14547 my $newImage;
14548  
14549 $posn--;
14550 if ($posn < 0) {
14551  
14552 $posn = (scalar @fileList) - 1;
14553 }
14554  
14555 # Change the displayed image
14556 $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
14557 if ($newImage) {
14558  
14559 $shortPath = $fileList[$posn];
14560 $shortPath =~ s/$scriptDir//;
14561 $entry->set_text($shortPath);
14562 $image = $newImage;
14563 }
14564 });
14565  
14566 my $button2 = $self->addButton($grid, '>>', 'Switch to next image', undef,
14567 5, 6, 2, 3);
14568 $button2->signal_connect('clicked' => sub {
14569  
14570 my $newImage;
14571  
14572 $posn++;
14573 if ($posn >= scalar @fileList) {
14574  
14575 $posn = 0;
14576 }
14577  
14578 # Change the displayed image, and store it as the current chat icon
14579 $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
14580 if ($newImage) {
14581  
14582 $shortPath = $fileList[$posn];
14583 $shortPath =~ s/$scriptDir//;
14584 $entry->set_text($shortPath);
14585 $image = $newImage;
14586 }
14587 });
14588  
14589 my $button3 = $self->addButton($grid,
14590 'Choose file...', 'Select a .bmp file to use as the chat icon', undef,
14591 4, 6, 3, 4);
14592 $button3->signal_connect('clicked' => sub {
14593  
14594 my ($newFile, $count, $newImage);
14595  
14596 $newFile = $self->showFileChooser(
14597 'Select an icon file (must be .bmp)',
14598 'open',
14599 );
14600  
14601 if ($newFile) {
14602  
14603 # Check it's a .bmp file
14604 if (substr($newFile, -4) ne '.bmp') {
14605  
14606 return $self->showMsgDialogue(
14607 'Choose chat icon',
14608 'warning',
14609 'Only Windows bitmap (.bmp) files can be used as chat icons',
14610 'ok',
14611 );
14612 }
14613  
14614 # Insert this file into the list of files just after the current position
14615 $posn++;
14616 if ($posn >= scalar @fileList) {
14617  
14618 $posn = 0;
14619 }
14620  
14621 splice(@fileList, $posn, 0, $newFile);
14622  
14623 # Change the displayed image, and store it as the current chat icon
14624 $newImage = $self->changeImage($viewPort, $frame, $image, $newFile);
14625 if ($newImage) {
14626  
14627 $shortPath = $fileList[$posn];
14628 $shortPath =~ s/$scriptDir//;
14629 $entry->set_text($shortPath);
14630 $image = $newImage;
14631 }
14632  
14633 # If this file exists somewhere else in the list, remove the duplicate
14634 $count = -1;
14635 OUTER: foreach my $item (@fileList) {
14636  
14637 $count++;
14638 if ($count != $posn && $item eq $newFile) {
14639  
14640 splice(@fileList, $count, 1);
14641 last OUTER;
14642  
14643 if ($count < $posn) {
14644  
14645 # The duplicate came before $posn; since the duplicate has been
14646 # removed, $posn shifts one to the left
14647 $posn--;
14648 }
14649 }
14650 }
14651 }
14652 });
14653  
14654 my $button4 = $self->addButton($grid, 'Use random', 'Choose a random icon', undef,
14655 4, 6, 4, 5);
14656 $button4->signal_connect('clicked' => sub {
14657  
14658 my $newImage;
14659  
14660 $posn = int(rand(scalar @fileList));
14661  
14662 # Change the displayed image, and store it as the current chat icon
14663 $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
14664 if ($newImage) {
14665  
14666 $shortPath = $fileList[$posn];
14667 $shortPath =~ s/$scriptDir//;
14668 $entry->set_text($shortPath);
14669 $image = $newImage;
14670 }
14671 });
14672  
14673 my $button5 = $self->addButton($grid, 'Use default', 'Use the default icon', undef,
14674 4, 6, 5, 6);
14675 $button5->signal_connect('clicked' => sub {
14676  
14677 my $newImage;
14678  
14679 # It's the first icon in the list
14680 $posn = 0;
14681  
14682 # Change the displayed image
14683 $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]);
14684 if ($newImage) {
14685  
14686 $shortPath = $fileList[$posn];
14687 $shortPath =~ s/$scriptDir//;
14688 $entry->set_text($shortPath);
14689 $image = $newImage;
14690 }
14691 });
14692  
14693 # Right column
14694 $self->addLabel($grid, '<i>Choose a chat name (or leave empty)</i>',
14695 7, 12, 1, 2);
14696  
14697 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 3, 16,
14698 7, 12, 2, 3);
14699 my $entry3 = $self->addEntry($grid, undef, FALSE,
14700 7, 12, 3, 4);
14701 if ($axmud::CLIENT->chatName) {
14702 $entry3->set_text($axmud::CLIENT->chatName);
14703 } elsif ($self->session->currentChar) {
14704 $entry3->set_text($self->session->currentChar->name);
14705 }
14706  
14707 $self->addLabel($grid, '<i>Choose an email address to broadcast (or leave empty)</i>',
14708 7, 12, 4, 5);
14709  
14710 my $entry4 = $self->addEntryWithIcon($grid, undef, 'string', 3, 128,
14711 7, 12, 5, 6);
14712 my $entry5 = $self->addEntry($grid, undef, FALSE,
14713 7, 12, 6, 7);
14714 if ($axmud::CLIENT->chatEmail) {
14715  
14716 $entry5->set_text($axmud::CLIENT->chatEmail);
14717 }
14718  
14719 my $button6 = $self->addButton(
14720 $grid,
14721 'Apply these changes now',
14722 'Store the icon, chat name and email and inform any running Chat tasks',
14723 undef,
14724 1, 12, 7, 8);
14725 $button6->signal_connect('clicked' => sub {
14726  
14727 my ($name, $email);
14728  
14729 # Update the icon
14730 if ($fileList[$posn] ne $axmud::CLIENT->chatIcon) {
14731  
14732 $self->session->pseudoCmd(
14733 'chatseticon ' . $fileList[$posn],
14734 $self->pseudoCmdMode,
14735 );
14736 }
14737  
14738 # Update the chat name
14739 if ($self->checkEntryIcon($entry2)) {
14740  
14741 $name = $entry2->get_text();
14742 $self->session->pseudoCmd('chatsetname ' . $name, $self->pseudoCmdMode);
14743  
14744 } else {
14745  
14746 # Use the current character's name
14747 $self->session->pseudoCmd('chatsetname', $self->pseudoCmdMode);
14748 }
14749  
14750 # Update the chat email
14751 if ($self->checkEntryIcon($entry4)) {
14752  
14753 $email = $entry4->get_text();
14754 $self->session->pseudoCmd(
14755 'chatsetemail ' . $email,
14756 $self->pseudoCmdMode,
14757 );
14758  
14759 } else {
14760  
14761 # Don't use an email
14762 $self->session->pseudoCmd('chatsetemail', $self->pseudoCmdMode);
14763 }
14764  
14765 # Update the two insensitive entry boxes
14766 if ($axmud::CLIENT->chatName) {
14767 $entry3->set_text($axmud::CLIENT->chatName);
14768 } elsif ($self->session->currentChar) {
14769 $entry3->set_text($self->session->currentChar->name);
14770 }
14771  
14772 if ($axmud::CLIENT->chatEmail) {
14773  
14774 $entry5->set_text($axmud::CLIENT->chatEmail);
14775 }
14776 });
14777  
14778 # Tab complete
14779 return 1;
14780 }
14781  
14782 sub chat4Tab {
14783  
14784 # Chat4 tab
14785 #
14786 # Expected arguments
14787 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
14788 #
14789 # Return values
14790 # 'undef' on improper arguments
14791 # 1 otherwise
14792  
14793 my ($self, $innerNotebook, $check) = @_;
14794  
14795 # Local variables
14796 my @columnList;
14797  
14798 # Check for improper arguments
14799 if (! defined $innerNotebook || defined $check) {
14800  
14801 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat4Tab', @_);
14802 }
14803  
14804 # Tab setup
14805 my $grid = $self->addTab('Page _4', $innerNotebook);
14806  
14807 # Chat task actions
14808 $self->addLabel($grid, '<b>Chat contact list</b>',
14809 0, 12, 0, 1);
14810 $self->addLabel($grid, '<i>List of stored chat contacts available to the Chat task</i>',
14811 1, 12, 1, 2);
14812  
14813 # Add a simple list
14814 @columnList = (
14815 'Icon', 'pixbuf', # GA::Obj::ChatContact->lastIconScaled
14816 'Name', 'text',
14817 'Protocol', 'text',
14818 'IP', 'text',
14819 'Port', 'text',
14820 'Email', 'text',
14821 );
14822  
14823 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
14824 1, 12, 2, 8);
14825  
14826 # Initialise the list
14827 $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2));
14828  
14829 # Add entry boxes for new chat contacts
14830 $self->addLabel($grid, 'Name',
14831 1, 3, 8, 9);
14832 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16,
14833 3, 6, 8, 9);
14834 $self->addLabel($grid, 'IP address',
14835 7, 9, 8, 9);
14836 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
14837 9, 12, 8, 9);
14838 $self->addLabel($grid, 'Port',
14839 1, 3, 9, 10);
14840 my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, 65535,
14841 3, 6, 9, 10);
14842 $entry3->set_text($axmud::CLIENT->constChatPort);
14843  
14844 # Add editing buttons
14845 my $button = $self->addButton($grid, 'Add', 'Add the chat contact', undef,
14846 7, 9, 9, 10);
14847 $button->signal_connect('clicked' => sub {
14848  
14849 my ($name, $ip, $port);
14850  
14851 if ($self->checkEntryIcon($entry, $entry2, $entry3)) {
14852  
14853 $name = $entry->get_text();
14854 $ip = $entry2->get_text();
14855 $port = $entry3->get_text();
14856  
14857 # Create a new GA::Obj::ChatContact, using the zChat protocol as the default
14858 $self->session->pseudoCmd(
14859 'addcontact ' . $name . ' ' . $ip . ' ' . $port,
14860 $self->pseudoCmdMode,
14861 );
14862  
14863 # Refresh the simple list and entry boxes
14864 $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2));
14865 $self->resetEntryBoxes($entry, $entry2);
14866 $entry3->set_text($axmud::CLIENT->constChatPort);
14867 }
14868 });
14869  
14870 my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected chat contact', undef,
14871 9, 10, 9, 10);
14872 $button2->signal_connect('clicked' => sub {
14873  
14874 my ($name, $contactObj, $childWinObj);
14875  
14876 ($name) = $self->getSimpleListData($slWidget, 1);
14877 if (defined $name) {
14878  
14879 # Get the blessed reference
14880 $contactObj = $axmud::CLIENT->ivShow('chatContactHash', $name);
14881 if ($contactObj) {
14882  
14883 # Open up an 'edit' window to edit the GA::Obj::ChatContact
14884 $self->createFreeWin(
14885 'Games::Axmud::EditWin::ChatContact',
14886 $self,
14887 $self->session,
14888 'Edit chat contact \'' . $name . '\'',
14889 $contactObj,
14890 FALSE, # Not temporary
14891 );
14892 }
14893  
14894 if ($childWinObj) {
14895  
14896 # When the 'edit' window closes, update widgets and/or IVs
14897 $self->add_childDestroy(
14898 $childWinObj,
14899 'chat4Tab_refreshList',
14900 [$slWidget, (scalar @columnList / 2)],
14901 );
14902 }
14903 }
14904 });
14905  
14906 my $button3 = $self->addButton($grid, 'Delete', 'Delete the selected chat contact', undef,
14907 10, 12, 9, 10);
14908 $button3->signal_connect('clicked' => sub {
14909  
14910 my ($name) = $self->getSimpleListData($slWidget, 1);
14911 if (defined $name) {
14912  
14913 # Delete the contact
14914 $self->session->pseudoCmd('deletecontact ' . $name, $self->pseudoCmdMode);
14915  
14916 # Refresh the simple list
14917 $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2));
14918 }
14919 });
14920  
14921 my $button4 = $self->addButton($grid, 'Call...', 'Call the selected chat contact', undef,
14922 7, 9, 10, 11);
14923 $button4->signal_connect('clicked' => sub {
14924  
14925 my ($name) = $self->getSimpleListData($slWidget, 1);
14926 if (defined $name) {
14927  
14928 # Call the contact
14929 $self->session->pseudoCmd('chatcall ' . $name, $self->pseudoCmdMode);
14930  
14931 # Refresh the simple list
14932 $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2));
14933 }
14934 });
14935  
14936 my $button5 = $self->addButton(
14937 $grid, 'Refresh list', 'Refresh the list of chat contacts', undef,
14938 9, 12, 10, 11);
14939 $button5->signal_connect('clicked' => sub {
14940  
14941 # Refresh the simple list
14942 $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2));
14943 });
14944  
14945 # Tab complete
14946 return 1;
14947 }
14948  
14949 sub chat4Tab_refreshList {
14950  
14951 # Called by $self->chat4Tab to refresh the GA::Obj::SimpleList
14952 #
14953 # Expected arguments
14954 # $slWidget - The GA::Obj::SimpleList
14955 # $columns - The number of columns in the list
14956 #
14957 # Return values
14958 # 'undef' on improper arguments
14959 # 1 otherwise
14960  
14961 my ($self, $slWidget, $columns, $check) = @_;
14962  
14963 # Local variables
14964 my (@objList, @dataList);
14965  
14966 # Check for improper arguments
14967 if (! defined $slWidget || ! defined $columns || defined $check) {
14968  
14969 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat4Tab_refreshList', @_);
14970 }
14971  
14972 # Get a sorted list of GA::Obj::ChatContact objects
14973 @objList
14974 = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('chatContactHash'));
14975  
14976 # Compile the simple list data
14977 foreach my $obj (@objList) {
14978  
14979 my $protocol;
14980  
14981 if ($obj->protocol == 0) {
14982 $protocol = 'MM';
14983 } else {
14984 $protocol = 'zChat';
14985 }
14986  
14987 push (@dataList,
14988 $obj->lastIconScaled,
14989 $obj->name,
14990 $protocol,
14991 $obj->ip,
14992 $obj->port,
14993 $obj->email,
14994 );
14995 }
14996  
14997 # Reset the simple list
14998 $self->resetListData($slWidget, [@dataList], $columns);
14999  
15000 return 1;
15001 }
15002  
15003 sub chat5Tab {
15004  
15005 # Chat5 tab
15006 #
15007 # Expected arguments
15008 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
15009 #
15010 # Return values
15011 # 'undef' on improper arguments
15012 # 1 otherwise
15013  
15014 my ($self, $innerNotebook, $check) = @_;
15015  
15016 # Local variables
15017 my @columnList;
15018  
15019 # Check for improper arguments
15020 if (! defined $innerNotebook || defined $check) {
15021  
15022 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat5Tab', @_);
15023 }
15024  
15025 # Tab setup
15026 my $grid = $self->addTab('Page _5', $innerNotebook);
15027  
15028 # Chat task actions
15029 $self->addLabel($grid, '<b>Current chat connections</b>',
15030 0, 12, 0, 1);
15031 $self->addLabel(
15032 $grid, '<i>List of current connections to chat contacts (in all sessions)</i>',
15033 1, 12, 1, 2);
15034  
15035 # Add a simple list
15036 @columnList = (
15037 'Session', 'int',
15038 'Icon', 'pixbuf', # GA::Obj::ChatContact->lastIconScaled
15039 'Name', 'text',
15040 'Contact', 'text',
15041 'Protocol', 'text',
15042 'IP', 'text',
15043 'Port', 'text',
15044 'Group', 'text',
15045 'Can snoop', 'bool',
15046 'Is snooping', 'bool',
15047 'Public', 'bool',
15048 'Serving', 'bool',
15049 );
15050  
15051 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
15052 1, 12, 2, 8);
15053  
15054 # Initialise the list
15055 $self->chat5Tab_refreshList($slWidget, scalar (@columnList / 2));
15056  
15057 # Add editing buttons
15058 my $button = $self->addButton($grid,
15059 'Refresh list', 'Refresh the list of connections', undef,
15060 9, 12, 8, 9);
15061 $button->signal_connect('clicked' => sub {
15062  
15063 # Refresh the list
15064 $self->chat5Tab_refreshList($slWidget, scalar (@columnList / 2));
15065 });
15066  
15067 # Tab complete
15068 return 1;
15069 }
15070  
15071 sub chat5Tab_refreshList {
15072  
15073 # Called by $self->chat5Tab to refresh the GA::Obj::SimpleList
15074 #
15075 # Expected arguments
15076 # $slWidget - The GA::Obj::SimpleList
15077 # $columns - The number of columns in the list
15078 #
15079 # Return values
15080 # 'undef' on improper arguments
15081 # 1 otherwise
15082  
15083 my ($self, $slWidget, $columns, $check) = @_;
15084  
15085 # Local variables
15086 my (@taskList, @dataList);
15087  
15088 # Check for improper arguments
15089 if (! defined $slWidget || ! defined $columns || defined $check) {
15090  
15091 return $axmud::CLIENT->writeImproper($self->_objClass . '->chat5Tab_refreshList', @_);
15092 }
15093  
15094 # Get a list of chat tasks running in every GA::Session
15095 foreach my $session ($axmud::CLIENT->listSessions()) {
15096  
15097 my @list;
15098  
15099 # If this session has a lead chat task...
15100 if ($session->chatTask) {
15101  
15102 # Add all chat tasks for this session
15103 @list = sort {
15104 if ($a->remoteName && $b->remoteName) {
15105 lc($a->remoteName) cmp lc($b->remoteName);
15106 } else {
15107 lc($a) cmp lc($b);
15108 }
15109 } ($session->chatTask->findAllTasks());
15110  
15111 if (@list) {
15112  
15113 push (@taskList, @list);
15114 }
15115 }
15116 }
15117  
15118 # Compile the simple list data
15119 foreach my $taskObj (@taskList) {
15120  
15121 my ($protocol, $contact, $icon);
15122  
15123 # Only display Chat tasks connected to someone
15124 if ($taskObj->sessionFlag) {
15125  
15126 if ($taskObj->chatType == 0) {
15127 $protocol = 'MM';
15128 } else {
15129 $protocol = 'zChat';
15130 }
15131  
15132 if ($taskObj->chatContactObj) {
15133  
15134 $icon = $taskObj->chatContactObj->lastIconScaled;
15135 $contact = $taskObj->chatContactObj->name;
15136  
15137 } else {
15138  
15139 $icon = $taskObj->remoteIconScaled;
15140 }
15141  
15142 push (@dataList,
15143 $taskObj->session->number,
15144 $icon,
15145 $taskObj->remoteName,
15146 $contact,
15147 $protocol,
15148 $taskObj->remoteIP,
15149 $taskObj->remotePort,
15150 $taskObj->localGroup,
15151 $taskObj->allowSnoopFlag,
15152 $taskObj->isSnoopedFlag,
15153 $taskObj->publicConnectionFlag,
15154 $taskObj->servingFlag,
15155 );
15156 }
15157 }
15158  
15159 # Reset the simple list
15160 $self->resetListData($slWidget, [@dataList], $columns);
15161  
15162 return 1;
15163 }
15164  
15165 ##################
15166 # Accessors - set
15167  
15168 ##################
15169 # Accessors - get
15170 }
15171  
15172 { package Games::Axmud::PrefWin::Path;
15173  
15174 use strict;
15175 use warnings;
15176 use diagnostics;
15177  
15178 use Glib qw(TRUE FALSE);
15179  
15180 our @ISA = qw(
15181 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
15182 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
15183 );
15184  
15185 ##################
15186 # Constructors
15187  
15188 # Contents of $self->editConfigHash after $self->new has been called:
15189 # 'room_list' => A list of GA::ModelObj::Room objects along the path
15190 # 'exit_list' => A list of GA::Obj::Exit objects linking the rooms on the path
15191 # 'cmd_list' => A list of commands used to move along the path
15192 # 'reverse_list' => A list of commands used to move along the path in the reverse direction
15193 # (an empty list, if unknown)
15194  
15195 sub new {
15196  
15197 # Called by GA::Generic::Win->createFreeWin
15198 # Creates a new instance of a 'config' window (any 'free' window object inheriting from this
15199 # object, namely 'edit' windows and 'pref' windows)
15200 #
15201 # Expected arguments
15202 # $number - Unique number for this window object
15203 # $workspaceObj - The GA::Obj::Workspace handling the workspace in which this window
15204 # should be created
15205 # $owner - The owner; a 'grid' window object (but not an 'external' window) or a
15206 # 'free' window object. When this window opens/closes, the owner is
15207 # informed via calls to its ->add_childFreeWin / ->del_childFreeWin
15208 # functions
15209 #
15210 # Optional arguments
15211 # $session - The GA::Session from which this function was called. 'undef' if the
15212 # calling function didn't specify a session and $owner's ->session IV
15213 # is also 'undef'
15214 # $title - A string to use as the window title. If 'undef', a generic title is
15215 # used
15216 # $editObj - The object to be edited in the window (for 'edit' windows only;
15217 # should be 'undef' for 'pref' windows)
15218 # $tempFlag - Flag set to TRUE if $editObj is either temporary, or has not yet been
15219 # added to any registry (usually because the user needs to name it
15220 # first). Set to FALSE (or 'undef') otherwise. Ignored if $editObj is
15221 # not specified
15222 # %configHash - Hash containing any number of key-value pairs needed for this
15223 # particular 'config' window; for example, for example,
15224 # GA::PrefWin::TaskStart uses it to specify a task name and type.
15225 # Set to an empty hash if not required
15226 #
15227 # Return values
15228 # 'undef' on improper arguments
15229 # Blessed reference to the newly-created object on success
15230  
15231 my (
15232 $class, $number, $workspaceObj, $owner, $session, $title, $editObj, $tempFlag,
15233 %configHash,
15234 ) = @_;
15235  
15236 # Local variables
15237 my ($winType, $winName);
15238  
15239 # Check for improper arguments
15240 if (! defined $class || ! defined $number || ! defined $workspaceObj || ! defined $owner) {
15241  
15242 return $axmud::CLIENT->writeImproper($class . '->new', @_);
15243 }
15244  
15245 # Set the values to use for some standard window IVs
15246 if ($editObj) {
15247  
15248 $winType = 'edit';
15249 $winName = 'edit';
15250 if (! defined $title) {
15251  
15252 $title = 'Edit window';
15253 }
15254  
15255 } else {
15256  
15257 $winType = 'pref';
15258 $winName = 'pref';
15259 if (! defined $title) {
15260  
15261 $title = 'Preference window';
15262 }
15263 }
15264  
15265 # Setup
15266 my $self = {
15267 _objName => $winType . '_win_' . $number,
15268 _objClass => $class,
15269 _parentFile => undef, # No parent file object
15270 _parentWorld => undef, # No parent file object
15271 _privFlag => TRUE, # All IVs are private
15272  
15273 # Standard window object IVs
15274 # --------------------------
15275  
15276 # Unique number for this window object
15277 number => $number,
15278 # The window category - 'grid' or 'free'
15279 winCategory => 'free',
15280 # The window type, any of the keys in GA::Client->constFreeWinTypeHash
15281 winType => $winType,
15282 # A name for the window (for 'config' windows, the same as the window type)
15283 winName => $winName,
15284 # The GA::Obj::Workspace object for the workspace in which this window is created
15285 workspaceObj => $workspaceObj,
15286 # The owner; a 'grid' window object (but not an 'external' window) or a 'free' window
15287 # object. When this window opens/closes, the owner is informed via calls to its
15288 # ->add_childFreeWin / ->del_childFreeWin functions
15289 owner => $owner,
15290 # The GA::Session from which this function was called. 'undef' if the calling function
15291 # didn't specify a session and $owner's ->session IV is also 'undef'
15292 session => $session,
15293 # When GA::Session->pseudoCmd is called to execute a client command, the mode in which
15294 # it should be called (usually 'win_error' or 'win_only', which causes errors to be
15295 # displayed in a 'dialogue' window)
15296 pseudoCmdMode => 'win_error',
15297  
15298 # The window widget. For most window objects, the Gtk3::Window. For pseudo-windows, the
15299 # parent 'main' window's Gtk3::Window
15300 # The code should use this IV when it wants to do something to the window itself
15301 # (minimise it, make it active, etc)
15302 winWidget => undef,
15303 # The window container. For most window objects, the Gtk3::Window. For pseudo-windows,
15304 # the parent GA::Table::PseudoWin table object
15305 # The code should use this IV when it wants to add, modify or remove widgets inside the
15306 # window itself
15307 winBox => undef,
15308 # Flag set to TRUE if the window actually exists (after a call to $self->winEnable),
15309 # FALSE if not
15310 enabledFlag => FALSE,
15311 # Flag set to TRUE if the Gtk3 window itself is visible (after a call to
15312 # $self->setVisible), FALSE if it is not visible (after a call to $self->setInvisible)
15313 visibleFlag => TRUE,
15314 # Registry hash of 'free' windows (excluding 'dialogue' windows) for which this window
15315 # is the parent, a subset of GA::Obj::Desktop->freeWinHash. Hash in the form
15316 # $childFreeWinHash{unique_number} = blessed_reference_to_window_object
15317 childFreeWinHash => {},
15318 # When a child 'free' window (excluding 'dialogue' windows) is destroyed, this parent
15319 # window is informed via a call to $self->del_childFreeWin
15320 # When the child is destroyed, this window might want to call some of its own functions
15321 # to update various widgets and/or IVs, in which case this window adds an entry to
15322 # this hash; a hash in the form
15323 # $childDestroyHash{unique_number} = list_reference
15324 # ...where 'unique_number' is the child window's ->number, and 'list_reference' is a
15325 # reference to a list in groups of 2, in the form
15326 # (sub_name, argument_list_ref, sub_name, argument_list_ref...)
15327 childDestroyHash => {},
15328  
15329 # The container widget into which all other widgets are packed (usually a Gtk3::VBox or
15330 # Gtk3::HBox, but any container widget can be used; takes up the whole window client
15331 # area)
15332 packingBox => undef, # Gtk3::VBox
15333  
15334 # Standard IVs for 'free' windows
15335  
15336 # The window's default size, in pixels
15337 widthPixels => $axmud::CLIENT->customFreeWinWidth,
15338 heightPixels => $axmud::CLIENT->customFreeWinHeight,
15339 # Default border/item spacing sizes used in the window, in pixels
15340 borderPixels => $axmud::CLIENT->constFreeBorderPixels,
15341 spacingPixels => $axmud::CLIENT->constFreeSpacingPixels,
15342  
15343 # A string to use as the window title. If 'undef', a generic title is used
15344 title => $title,
15345 # Hash containing any number of key-value pairs needed for this particular 'config'
15346 # window; for example, for example, GA::PrefWin::TaskStart uses it to specify a task
15347 # name and type. Set to an empty hash if not required
15348 configHash => {%configHash},
15349  
15350 # Standard IVs for 'config' windows
15351  
15352 # Widgets
15353 notebook => undef, # Gtk3::Notebook
15354 hBox => undef, # Gtk3::HBox
15355 okButton => undef, # Gtk3::Button
15356 cancelButton => undef, # Gtk3::Button
15357 resetButton => undef, # Gtk3::Button
15358 saveButton => undef, # Gtk3::Button
15359  
15360 # The standard grid size for the notebook (any 'edit'/'pref' window can use a different
15361 # size, if it wants)
15362 gridSize => 12,
15363  
15364 # The object to be edited in the window (for 'edit' windows only; should be 'undef' for
15365 # 'pref' windows)
15366 editObj => $editObj,
15367 # Flag set to TRUE if $editObj is either temporary, or has not yet been added to any
15368 # registry (usually because the user needs to name it first). Set to FALSE
15369 # (or 'undef') otherwise. Ignored if $editObj is not specified
15370 tempFlag => $tempFlag,
15371 # Flag that can be set to TRUE (usually by $self->setupNotebook or ->expandNotebook) if
15372 # $editObj is a current object (e.g. if it is a current profile); set to FALSE at all
15373 # other times
15374 currentFlag => FALSE,
15375 # For 'edit' windows, a hash of IVs in $editObj that should be changed. If no changes
15376 # have been made in the 'edit' window, the hash is empty; otherwise the hash contains
15377 # the new values for each IV to be modified
15378 # Hash in the form:
15379 # $editHash{iv_name} = scalar;
15380 # $editHash{iv_name} = list_reference;
15381 # $editHash{iv_name} = hash_reference;
15382 # For 'pref' windows, a hash of key-value pairs set by the window's widgets;
15383 # $self->enableButtons can access this hash to perform any necessary actions
15384 # ('pref' windows don't make a call to ->saveChanges)
15385 editHash => {},
15386 # Hash containing any number of key-value pairs needed for this particular
15387 # 'edit'/'pref' window; for example, GA::PrefWin::TaskStart uses it to specify a task
15388 # name and type. Set to an empty hash if not required
15389 editConfigHash => \%configHash,
15390  
15391 # IVs for this type of window
15392  
15393 # A list of GA::ModelObj::Room objects along the path
15394 roomList => [],
15395 # The first room in the list
15396 initialRoomObj => undef,
15397 # The last room in the list
15398 targetRoomObj => undef,
15399  
15400 # A list of GA::Obj::Exit objects, linking the room objects on the path
15401 exitList => [],
15402 # A list of commands (using assisted moves if allowed) to go along the path
15403 cmdList => [],
15404 reverseCmdList => [],
15405 };
15406  
15407 # Bless the object into existence
15408 bless $self, $class;
15409  
15410 return $self;
15411 }
15412  
15413 ##################
15414 # Methods
15415  
15416 # Standard window object functions
15417  
15418 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
15419  
15420 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
15421  
15422 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
15423  
15424 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
15425  
15426 # sub winShowAll {} # Inherited from GA::Generic::Win
15427  
15428 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
15429  
15430 # sub redrawWidgets {} # Inherited from GA::Generic::Win
15431  
15432 # ->signal_connects
15433  
15434 # Other functions
15435  
15436 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
15437  
15438 sub enableButtons {
15439  
15440 # Called by $self->drawWidgets
15441 # We only need a single button so, instead of calling the generic ->enableButtons, call a
15442 # method that creates just one button
15443 #
15444 # Expected arguments
15445 # $hBox - The horizontal packing box in which the buttons live (not yet stored as
15446 # an IV)
15447 #
15448 # Return values
15449 # An empty list on improper arguments
15450 # Otherwise, a list containing the Gtk::Button object created
15451  
15452 my ($self, $hBox, $check) = @_;
15453  
15454 # Local variables
15455 my @emptyList;
15456  
15457 # Check for improper arguments
15458 if (! defined $hBox || defined $check) {
15459  
15460 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
15461 return @emptyList;
15462 }
15463  
15464 return $self->enableSingleButton($hBox);
15465 }
15466  
15467 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
15468  
15469 sub setupNotebook {
15470  
15471 # Called by $self->winEnable
15472 # Creates the first tab for the notebook. The remaining tabs are created by
15473 # $self->expandNotebook
15474 #
15475 # Expected arguments
15476 # (none besides $self)
15477 #
15478 # Return values
15479 # 'undef' on improper arguments
15480 # 1 otherwise
15481  
15482 my ($self, $check) = @_;
15483  
15484 # Local variables
15485 my ($roomListRef, $exitListRef, $cmdListRef, $reverseListRef);
15486  
15487 # Check for improper arguments
15488 if (defined $check) {
15489  
15490 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
15491 }
15492  
15493 # Tab setup, using the standard grid size
15494 my $grid = $self->addTab('_Summary', $self->notebook);
15495  
15496 # Extract data from $self->editConfigHash, and use it to set initial values for the
15497 # non-standard IVs
15498 $roomListRef = $self->ivShow('editConfigHash', 'room_list');
15499 $self->ivPoke('roomList', @$roomListRef);
15500  
15501 $exitListRef = $self->ivShow('editConfigHash', 'exit_list');
15502 $self->ivPoke('exitList', @$exitListRef);
15503  
15504 $cmdListRef = $self->ivShow('editConfigHash', 'cmd_list');
15505 $self->ivPoke('cmdList', @$cmdListRef);
15506  
15507 $reverseListRef = $self->ivShow('editConfigHash', 'reverse_list');
15508 $self->ivPoke('reverseCmdList', @$reverseListRef);
15509  
15510 $self->ivPoke('initialRoomObj', $$roomListRef[0]);
15511 $self->ivPoke('targetRoomObj', $$roomListRef[-1]);
15512  
15513 # Set up the rest of the tab
15514 $self->summaryTab($grid);
15515  
15516 # Set up the remaining tabs
15517 $self->expandNotebook();
15518  
15519 # Tab complete
15520 return 1;
15521 }
15522  
15523 sub expandNotebook {
15524  
15525 # Called by $self->setupNotebook
15526 # Set up additional tabs for the notebook
15527 #
15528 # Expected arguments
15529 # (none besides $self)
15530 #
15531 # Return values
15532 # 'undef' on improper arguments
15533 # 1 otherwise
15534  
15535 my ($self, $check) = @_;
15536  
15537 # Check for improper arguments
15538 if (defined $check) {
15539  
15540 return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_);
15541 }
15542  
15543 $self->pathTab();
15544 if ($self->reverseCmdList) {
15545  
15546 $self->reversePathTab();
15547 }
15548  
15549 return 1;
15550 }
15551  
15552 sub saveChanges {
15553  
15554 # Called by $self->buttonOK
15555 # Unlike GA::Generic::EditWin, there is no Perl object in which we have to store IVs. This
15556 # function does nothing except to get called by the inherited functions
15557 #
15558 # Expected arguments
15559 # (none besides $self)
15560 #
15561 # Return values
15562 # 'undef' on improper arguments
15563 # 1 otherwise
15564  
15565 my ($self, $check) = @_;
15566  
15567 # Check for improper arguments
15568 if (defined $check) {
15569  
15570 return $axmud::CLIENT->writeImproper($self->_objClass . '->saveChanges', @_);
15571 }
15572  
15573 # Nothing to do
15574 return 1;
15575 }
15576  
15577 # Notebook tabs
15578  
15579 sub summaryTab {
15580  
15581 # Summary tab
15582 #
15583 # Expected arguments
15584 # $grid - The Gtk3::Grid for this tab
15585 #
15586 # Return values
15587 # 'undef' on improper arguments
15588 # 1 otherwise
15589  
15590 my ($self, $grid, $check) = @_;
15591  
15592 # Local variables
15593 my @columnList;
15594  
15595 # Check for improper arguments
15596 if (! defined $grid || defined $check) {
15597  
15598 return $axmud::CLIENT->writeImproper($self->_objClass . '->summaryTab', @_);
15599 }
15600  
15601 # # Tab setup (already created by the calling function)
15602 # my $grid = $self->addTab('_Summary', $self->notebook);
15603  
15604 # Shortest path found
15605 $self->addLabel(
15606 $grid,
15607 '<b>Shortest path found in ' . $self->ivNumber('exitList') . ' steps</b>',
15608 0, 12, 0, 1,
15609 );
15610  
15611 if ($self->reverseCmdList) {
15612  
15613 $self->addLabel($grid, '<i>(Reverse path also found)</i>',
15614 1, 12, 1, 2);
15615  
15616 } else {
15617  
15618 $self->addLabel($grid, '<i>(Reverse path not found)</i>',
15619 1, 12, 1, 2);
15620 }
15621  
15622 # Add a simple list
15623 @columnList = (
15624 '#', 'text',
15625 'Region', 'text',
15626 'Room #', 'text',
15627 'Room tag', 'text',
15628 'Exit #', 'text',
15629 'Nominal dir', 'text',
15630 );
15631  
15632 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
15633 1, 12, 2, 10);
15634  
15635 # Initialise the list
15636 $self->summaryTab_refreshList($slWidget, (scalar @columnList / 2));
15637  
15638 # Add editing buttons
15639 my $button = $self->addButton(
15640 $grid,
15641 'Edit room...',
15642 'Edit the selected room model object',
15643 undef,
15644 8, 10, 10, 11,
15645 );
15646 $button->signal_connect('clicked' => sub {
15647  
15648 my ($roomNum, $roomObj);
15649  
15650 ($roomNum) = $self->getSimpleListData($slWidget, 2);
15651 if (defined $roomNum) {
15652  
15653 $roomObj = $self->session->worldModelObj->ivShow('modelHash', $roomNum);
15654  
15655 # Open the room's 'edit' window
15656 $self->createFreeWin(
15657 'Games::Axmud::EditWin::ModelObj::Room',
15658 $self,
15659 $self->session,
15660 'Edit ' . $roomObj->category . ' model object #' . $roomObj->number,
15661 $roomObj,
15662 FALSE, # Not temporary
15663 );
15664 }
15665 });
15666  
15667 my $button2 = $self->addButton(
15668 $grid, 'Edit exit...', 'Edit the selected exit object', undef,
15669 10, 12, 10, 11);
15670 $button2->signal_connect('clicked' => sub {
15671  
15672 my ($exitNum, $exitObj);
15673  
15674 ($exitNum) = $self->getSimpleListData($slWidget, 4);
15675 if (defined $exitNum) {
15676  
15677 $exitObj = $self->session->worldModelObj->ivShow('exitModelHash', $exitNum);
15678  
15679 # Open up an 'edit' window to edit the object
15680 $self->createFreeWin(
15681 'Games::Axmud::EditWin::Exit',
15682 $self,
15683 $self->session,
15684 'Edit exit model object #' . $exitObj->number,
15685 $exitObj,
15686 FALSE, # Not temporary
15687 );
15688 }
15689 });
15690  
15691 # Tab complete
15692 return 1;
15693 }
15694  
15695 sub summaryTab_refreshList {
15696  
15697 # Called by $self->summaryTab to refresh the GA::Obj::SimpleList
15698 #
15699 # Expected arguments
15700 # $slWidget - The GA::Obj::SimpleList
15701 # $columns - The number of columns in the list
15702 #
15703 # Return values
15704 # 'undef' on improper arguments
15705 # 1 otherwise
15706  
15707 my ($self, $slWidget, $columns, $check) = @_;
15708  
15709 # Local variables
15710 my (
15711 $count,
15712 @dataList,
15713 );
15714  
15715 # Check for improper arguments
15716 if (! defined $slWidget || ! defined $columns || defined $check) {
15717  
15718 return $axmud::CLIENT->writeImproper($self->_objClass . '->summaryTab_refreshList', @_);
15719 }
15720  
15721 # Compile the simple list data (these IVs are not saved to $self->editHash)
15722 $count = -1;
15723 foreach my $roomObj ($self->roomList) {
15724  
15725 my ($regionObj, $regionName, $exitObj, $exitNum, $dir);
15726  
15727 $count++;
15728  
15729 if ($roomObj->parent) {
15730  
15731 $regionObj = $self->session->worldModelObj->ivShow('modelHash', $roomObj->parent);
15732 $regionName = $regionObj->name;
15733 }
15734  
15735 $exitObj = $self->ivIndex('exitList', $count);
15736 if ($exitObj) {
15737  
15738 # $exitObj is undefined for the last spin of this loop
15739 $exitNum = $exitObj->number;
15740 $dir = $exitObj->dir;
15741 }
15742  
15743 push (@dataList,
15744 $count + 1,
15745 $regionName, # May be 'undef'
15746 $roomObj->number,
15747 $roomObj->roomTag, # May be 'undef'
15748 $exitNum, # May be 'undef'
15749 $dir, # May be 'undef'
15750 );
15751 }
15752  
15753 # Reset the simple list
15754 $self->resetListData($slWidget, [@dataList], $columns);
15755  
15756 return 1;
15757 }
15758  
15759 sub pathTab {
15760  
15761 # Path tab
15762 #
15763 # Expected arguments
15764 # (none besides $self)
15765 #
15766 # Return values
15767 # 'undef' on improper arguments
15768 # 1 otherwise
15769  
15770 my ($self, $check) = @_;
15771  
15772 # Check for improper arguments
15773 if (defined $check) {
15774  
15775 return $axmud::CLIENT->writeImproper($self->_objClass . '->pathTab', @_);
15776 }
15777  
15778 # Tab setup
15779 my $grid = $self->addTab('_Path', $self->notebook);
15780  
15781 # Path
15782 $self->addLabel($grid, '<b>Path</b>',
15783 0, 12, 0, 1);
15784  
15785 $self->pathTab_addWidgets(
15786 $grid,
15787 $self->initialRoomObj->roomTag,
15788 $self->targetRoomObj->roomTag,
15789 $self->cmdList,
15790 );
15791  
15792 # Tab complete
15793 return 1;
15794 }
15795  
15796 sub reversePathTab {
15797  
15798 # ReversePath tab
15799 #
15800 # Expected arguments
15801 # (none besides $self)
15802 #
15803 # Return values
15804 # 'undef' on improper arguments
15805 # 1 otherwise
15806  
15807 my ($self, $check) = @_;
15808  
15809 # Check for improper arguments
15810 if (defined $check) {
15811  
15812 return $axmud::CLIENT->writeImproper($self->_objClass . '->reversePathTab', @_);
15813 }
15814  
15815 # Tab setup
15816 my $grid = $self->addTab('_Reverse path', $self->notebook);
15817  
15818 # Path
15819 $self->addLabel($grid, '<b>Reverse path</b>',
15820 0, 12, 0, 1);
15821  
15822 $self->pathTab_addWidgets(
15823 $grid,
15824 $self->targetRoomObj->roomTag,
15825 $self->initialRoomObj->roomTag,
15826 $self->reverseCmdList,
15827 );
15828  
15829 # Tab complete
15830 return 1;
15831 }
15832  
15833 sub pathTab_addWidgets {
15834  
15835 # Called by $self->pathTab and $self->reversePathTab
15836 # Adds common widgets to both tabs
15837 #
15838 # Expected arguments
15839 # $grid - The Gtk3::Grid for this tab
15840 #
15841 # Optional arguments
15842 # $roomTag, $otherRoomTag
15843 # - The room tags at each end of the path (may not exits)
15844 # @cmdList - A list of commands to move between them (from either $self->cmdList or
15845 # $self->reverseCmdList)
15846 #
15847 # Return values
15848 # 'undef' on improper arguments
15849 # 1 otherwise
15850  
15851 my ($self, $grid, $roomTag, $otherRoomTag, @cmdList) = @_;
15852  
15853 # Local variables
15854 my (
15855 $worldString,
15856 @comboList, @profList,
15857 );
15858  
15859 # Check for improper arguments
15860 if (! defined $grid) {
15861  
15862 return $axmud::CLIENT->writeImproper($self->_objClass . '->pathTab_addWidgets', @_);
15863 }
15864  
15865 # Add widgets to the grid
15866 $self->addLabel($grid, '<i>Combined commands (copy the path from here)</i>',
15867 1, 6, 1, 2);
15868 my $textView = $self->addTextView($grid, undef, FALSE,
15869 1, 12, 2, 5,
15870 FALSE, # Don't treat as a list
15871 FALSE, # Don't remove empty lines
15872 TRUE, # ...but do remove leading/trailing whitespace
15873 FALSE, # Allow horizontal scrolling
15874 );
15875 my $buffer = $textView->get_buffer();
15876 $buffer->set_text(join($axmud::CLIENT->cmdSep, @cmdList));
15877  
15878 $self->addLabel($grid, '<i>Split commands (edit the path here)</i>',
15879 1, 6, 5, 6);
15880 my $textView2 = $self->addTextView($grid, undef, TRUE,
15881 1, 6, 6, 12,
15882 TRUE, # Treat as a list
15883 TRUE, # Remove empty lines
15884 TRUE, # Remove leading/trailing whitespace
15885 FALSE, # Allow horizontal scrolling
15886 );
15887 my $buffer2 = $textView2->get_buffer();
15888 $buffer2->set_text(join("\n", @cmdList));
15889  
15890 # Editing the second textview automatically updates the first one
15891 $buffer2->signal_connect('changed' => sub {
15892  
15893 my (
15894 $startIter, $endIter, $text,
15895 @lineList,
15896 );
15897  
15898 $startIter = $buffer2->get_start_iter();
15899 $endIter = $buffer2->get_end_iter();
15900 $text = $buffer2->get_text($startIter, $endIter, 1);
15901  
15902 # Set the other textview's contents to match this one
15903 @lineList = split("\n", $text);
15904 $buffer->set_text(join($axmud::CLIENT->cmdSep, @lineList));
15905 });
15906  
15907 $self->addLabel($grid, 'Initial tag',
15908 7, 9, 6, 7);
15909 my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
15910 9, 12, 6, 7);
15911 if ($roomTag) {
15912  
15913 $entry->set_text($roomTag);
15914 }
15915  
15916 $self->addLabel($grid, 'Target tag',
15917 7, 9, 7, 8);
15918 my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
15919 9, 12, 7, 8);
15920 if ($otherRoomTag) {
15921  
15922 $entry2->set_text($otherRoomTag);
15923 }
15924  
15925 $self->addLabel($grid, 'Route type',
15926 7, 9, 8, 9);
15927 @comboList = ('road', 'quick'); # Circuit routes can't be created here
15928 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
15929 TRUE, # No 'undef' value used
15930 9, 12, 8, 9);
15931  
15932 my $checkButton = $self->addCheckButton($grid, 'Hoppable', undef, TRUE,
15933 9, 12, 9, 10);
15934 $checkButton->set_active(TRUE);
15935  
15936 $self->addLabel($grid, 'Profile',
15937 7, 9, 10, 11);
15938 # Get a list of non-world current profiles
15939 foreach my $category ($self->session->profPriorityList) {
15940  
15941 my $profObj;
15942  
15943 if ($category ne 'world' && $self->session->ivExists('currentProfHash', $category)) {
15944  
15945 $profObj = $self->session->ivShow('currentProfHash', $category);
15946 push (@profList, $profObj->name);
15947 }
15948 }
15949  
15950 # Default combo option is 'use current world'
15951 $worldString = '<use current world>';
15952 push (@profList, $worldString);
15953  
15954 # Reverse the list, so that it is in reverse-priority order (and so that 'use current world'
15955 # appears at the top)
15956 @profList = reverse @profList;
15957  
15958 my $combo2 = $self->addComboBox($grid, undef, \@profList, '',
15959 TRUE, # No 'undef' value used
15960 9, 12, 10, 11);
15961  
15962 my $button = $self->addButton(
15963 $grid,
15964 'Add pre-defined route',
15965 'Create a pre-defined route using this path',
15966 undef,
15967 7, 12, 11, 12,
15968 );
15969 $button->set_sensitive(FALSE); # Button initially desensitised
15970 $button->signal_connect('clicked' => sub {
15971  
15972 my ($initialTag, $targetTag, $routeType, $flag, $profName, $cmd, $pathText);
15973  
15974 # Only create a route if both entry boxes are full
15975 if ($self->checkEntryIcon($entry, $entry2)) {
15976  
15977 $initialTag = $entry->get_text();
15978 $targetTag = $entry2->get_text();
15979 $routeType = $combo->get_active_text();
15980 $flag = $checkButton->get_active();
15981 $profName = $combo2->get_active_text();
15982  
15983 # Use the edited (not necessarily the original) path
15984 $pathText = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
15985  
15986 # Prepare the client command
15987 $cmd = 'addroute <' . $initialTag . '> <' . $targetTag . '> <' . $pathText . '>';
15988  
15989 if ($routeType eq 'quick') {
15990 $cmd .= ' -q';
15991 } else {
15992 $cmd .= ' -o'; # Road route
15993 }
15994  
15995 if ($profName ne $worldString) {
15996  
15997 $cmd .= ' -d ' . $profName;
15998 }
15999  
16000 if (! $flag) {
16001  
16002 $cmd .= ' -h';
16003 }
16004  
16005 # Create the GA::Obj::Route
16006 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
16007 }
16008 });
16009  
16010 # The 'Add pre-defined route' button should be desensitised when $entry and $entry2 contain
16011 # unacceptable text
16012 $entry->signal_connect('changed' => sub {
16013  
16014 if ($self->checkEntryIcon($entry, $entry2)) {
16015 $button->set_sensitive(TRUE);
16016 } else {
16017 $button->set_sensitive(FALSE);
16018 }
16019 });
16020 $entry2->signal_connect('changed' => sub {
16021  
16022 if ($self->checkEntryIcon($entry, $entry2)) {
16023 $button->set_sensitive(TRUE);
16024 } else {
16025 $button->set_sensitive(FALSE);
16026 }
16027 });
16028  
16029 my $button2 = $self->addButton(
16030 $grid,
16031 'Abbreviate',
16032 'Abbreviate the directions displayed in this tab',
16033 undef,
16034 7, 10, 1, 2,
16035 );
16036 $button2->signal_connect('clicked' => sub {
16037  
16038 my (
16039 $dictObj, $startIter, $endIter, $text,
16040 @lineList, @newList,
16041 );
16042  
16043 # Import the session's current dictionary (for convenience)
16044 $dictObj = $self->session->currentDict;
16045  
16046 # Get a list of directions from the second textview
16047 $startIter = $buffer2->get_start_iter();
16048 $endIter = $buffer2->get_end_iter();
16049 $text = $buffer2->get_text($startIter, $endIter, 1);
16050  
16051 @lineList = split("\n", $text);
16052  
16053 # Abbreviate each direction, if possible
16054 foreach my $cmd (@lineList) {
16055  
16056 my $abbrevDir = $dictObj->abbrevDir($cmd);
16057  
16058 if ($abbrevDir) {
16059 push (@newList, $abbrevDir);
16060 } else {
16061 push (@newList, $cmd);
16062 }
16063 }
16064  
16065 # Update each textview
16066 $buffer->set_text(join($axmud::CLIENT->cmdSep, @newList));
16067 $buffer2->set_text(join("\n", @newList));
16068 });
16069  
16070 my $button3 = $self->addButton(
16071 $grid,
16072 'Unabbreviate',
16073 'Unabbreviate the directions displayed in this tab',
16074 undef,
16075 10, 12, 1, 2,
16076 );
16077 $button3->signal_connect('clicked' => sub {
16078  
16079 my (
16080 $dictObj, $startIter, $endIter, $text,
16081 @lineList, @newList,
16082 );
16083  
16084 # Import the session's current dictionary (for convenience)
16085 $dictObj = $self->session->currentDict;
16086  
16087 # Get a list of directions from the second textview
16088 $startIter = $buffer2->get_start_iter();
16089 $endIter = $buffer2->get_end_iter();
16090 $text = $buffer2->get_text($startIter, $endIter, 1);
16091  
16092 @lineList = split("\n", $text);
16093  
16094 # Unabbreviate each direction, if possible
16095 foreach my $cmd (@lineList) {
16096  
16097 push (@newList, $dictObj->unabbrevDir($cmd));
16098 }
16099  
16100 # Update each textview
16101 $buffer->set_text(join($axmud::CLIENT->cmdSep, @newList));
16102 $buffer2->set_text(join("\n", @newList));
16103 });
16104  
16105 return 1;
16106 }
16107  
16108 ##################
16109 # Accessors - set
16110  
16111 ##################
16112 # Accessors - get
16113  
16114 sub roomList
16115 { my $self = shift; return @{$self->{roomList}}; }
16116 sub initialRoomObj
16117 { $_[0]->{initialRoomObj} }
16118 sub targetRoomObj
16119 { $_[0]->{targetRoomObj} }
16120  
16121 sub exitList
16122 { my $self = shift; return @{$self->{exitList}}; }
16123 sub cmdList
16124 { my $self = shift; return @{$self->{cmdList}}; }
16125 sub reverseCmdList
16126 { my $self = shift; return @{$self->{reverseCmdList}}; }
16127 }
16128  
16129 { package Games::Axmud::PrefWin::Quick;
16130  
16131 use strict;
16132 use warnings;
16133 use diagnostics;
16134  
16135 use Glib qw(TRUE FALSE);
16136  
16137 our @ISA = qw(
16138 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
16139 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
16140 );
16141  
16142 ##################
16143 # Constructors
16144  
16145 # Contents of $self->editConfigHash after $self->new has been called:
16146 # (none)
16147  
16148 # sub new {} # Inherited from GA::Generic::ConfigWin
16149  
16150 ##################
16151 # Methods
16152  
16153 # Standard window object functions
16154  
16155 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
16156  
16157 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
16158  
16159 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
16160  
16161 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
16162  
16163 # sub winShowAll {} # Inherited from GA::Generic::Win
16164  
16165 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
16166  
16167 # sub redrawWidgets {} # Inherited from GA::Generic::Win
16168  
16169 # ->signal_connects
16170  
16171 # Other functions
16172  
16173 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
16174  
16175 sub enableButtons {
16176  
16177 # Called by $self->drawWidgets
16178 # We only need a single button so, instead of calling the generic ->enableButtons, call a
16179 # method that creates just one button
16180 #
16181 # Expected arguments
16182 # $hBox - The horizontal packing box in which the buttons live (not yet stored as
16183 # an IV)
16184 #
16185 # Return values
16186 # An empty list on improper arguments
16187 # Otherwise, a list containing the Gtk::Button object created
16188  
16189 my ($self, $hBox, $check) = @_;
16190  
16191 # Local variables
16192 my @emptyList;
16193  
16194 # Check for improper arguments
16195 if (! defined $hBox || defined $check) {
16196  
16197 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
16198 return @emptyList;
16199 }
16200  
16201 return $self->enableSingleButton($hBox);
16202 }
16203  
16204 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
16205  
16206 sub setupNotebook {
16207  
16208 # Called by $self->enable
16209 # Creates the first tab for the notebook. The remaining tabs are created by
16210 # $self->expandNotebook
16211 #
16212 # Expected arguments
16213 # (none besides $self)
16214 #
16215 # Return values
16216 # 'undef' on improper arguments
16217 # 1 otherwise
16218  
16219 my ($self, $check) = @_;
16220  
16221 # Check for improper arguments
16222 if (defined $check) {
16223  
16224 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
16225 }
16226  
16227 # # Tab setup
16228 # my $grid = $self->addTab('_Session', $self->notebook);
16229  
16230 # Set up the rest of the first tab (all of it, in this case)
16231 $self->shortcutTab();
16232  
16233 # Set up the remaining tabs
16234 $self->expandNotebook();
16235  
16236 # Tab complete
16237 return 1;
16238 }
16239  
16240 sub expandNotebook {
16241  
16242 # Called by $self->setupNotebook
16243 # Set up additional tabs for the notebook
16244 #
16245 # Expected arguments
16246 # (none besides $self)
16247 #
16248 # Return values
16249 # 'undef' on improper arguments
16250 # 1 otherwise
16251  
16252 my ($self, $check) = @_;
16253  
16254 # Check for improper arguments
16255 if (defined $check) {
16256  
16257 return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_);
16258 }
16259  
16260 $self->autoSaveTab();
16261 $self->charSetTab();
16262 $self->coloursFontsTab();
16263 $self->commandsTab();
16264 $self->logsTab();
16265 $self->soundTab();
16266 $self->speechTab();
16267 $self->windowsTab();
16268  
16269 return 1;
16270 }
16271  
16272 # sub saveChanges {} # Inherited from GA::Generic::ConfigWin
16273  
16274 # Notebook tabs
16275  
16276 sub shortcutTab {
16277  
16278 # Shortcut tab
16279 #
16280 # Expected arguments
16281 # (none besides $self)
16282 #
16283 # Return values
16284 # 'undef' on improper arguments
16285 # 1 otherwise
16286  
16287 my ($self, $check) = @_;
16288  
16289 # Check for improper arguments
16290 if (defined $check) {
16291  
16292 return $axmud::CLIENT->writeImproper($self->_objClass . '->shortcutTab', @_);
16293 }
16294  
16295 # Tab setup
16296 my $grid = $self->addTab('_Shortcuts', $self->notebook);
16297  
16298 # Shortcuts to other windows
16299 $self->addLabel($grid, '<b>Shortcuts to other windows</b>',
16300 0, 12, 0, 1);
16301  
16302 $self->addLabel($grid, '<i>Preference windows</i>',
16303 1, 12, 1, 2);
16304  
16305 my $button = $self->addButton($grid,
16306 'Open client preferences', 'Opens the client preference window', undef,
16307 1, 6, 2, 3);
16308 $button->signal_connect('clicked' => sub {
16309  
16310 $self->session->pseudoCmd('editclient', $self->pseudoCmdMode);
16311 });
16312  
16313 my $button2 = $self->addButton($grid,
16314 'Open session preferences', 'Opens the session preference window', undef,
16315 6, 12, 2, 3);
16316 $button2->signal_connect('clicked' => sub {
16317  
16318 $self->session->pseudoCmd('editsession', $self->pseudoCmdMode);
16319 });
16320  
16321 $self->addLabel($grid, '<i>Edit windows for profiles</i>',
16322 1, 12, 3, 4);
16323  
16324 my $button3 = $self->addButton($grid,
16325 'Edit current world', 'Opens an edit window for the current world profile', undef,
16326 1, 6, 4, 5);
16327 $button3->signal_connect('clicked' => sub {
16328  
16329 $self->session->pseudoCmd('editworld', $self->pseudoCmdMode);
16330 });
16331  
16332 my $button4 = $self->addButton($grid,
16333 'Edit current guild', 'Opens an edit window for the current guild profile', undef,
16334 6, 12, 4, 5);
16335 $button4->signal_connect('clicked' => sub {
16336  
16337 $self->session->pseudoCmd('editguild', $self->pseudoCmdMode);
16338 });
16339  
16340 my $button5 = $self->addButton($grid,
16341 'Edit current race', 'Opens an edit window for the current race profile', undef,
16342 1, 6, 5, 6);
16343 $button5->signal_connect('clicked' => sub {
16344  
16345 $self->session->pseudoCmd('editrace', $self->pseudoCmdMode);
16346 });
16347  
16348 my $button6 = $self->addButton($grid,
16349 'Edit current character', 'Opens an edit window for the current char profile', undef,
16350 6, 12, 5, 6);
16351 $button6->signal_connect('clicked' => sub {
16352  
16353 $self->session->pseudoCmd('editchar', $self->pseudoCmdMode);
16354 });
16355  
16356 $self->addLabel($grid, '<i>Edit windows for other data</i>',
16357 1, 12, 6, 7);
16358  
16359 my $button7 = $self->addButton($grid,
16360 'Edit current dictionary', 'Opens an edit window for the current dictionary', undef,
16361 1, 6, 7, 8);
16362 $button7->signal_connect('clicked' => sub {
16363  
16364 $self->session->pseudoCmd('editdictionary', $self->pseudoCmdMode);
16365 });
16366  
16367 my $button8 = $self->addButton($grid,
16368 'Edit world model', 'Opens an edit window for the current world model', undef,
16369 6, 12, 7, 8);
16370 $button8->signal_connect('clicked' => sub {
16371  
16372 $self->session->pseudoCmd('editmodel', $self->pseudoCmdMode);
16373 });
16374  
16375 $self->addLabel($grid, '<i>Current world\'s interfaces</i>',
16376 1, 12, 8, 9);
16377  
16378 my $button9 = $self->addButton($grid,
16379 'Edit triggers', 'Edits the current world\'s trigger cage', undef,
16380 1, 3, 9, 10);
16381 $button9->signal_connect('clicked' => sub {
16382  
16383 $self->session->pseudoCmd('editcage -t', $self->pseudoCmdMode);
16384 });
16385  
16386 my $button10 = $self->addButton($grid,
16387 'Edit aliases', 'Edits the current world\'s alias cage', undef,
16388 3, 5, 9, 10);
16389 $button10->signal_connect('clicked' => sub {
16390  
16391 $self->session->pseudoCmd('editcage -a', $self->pseudoCmdMode);
16392 });
16393  
16394 my $button11 = $self->addButton($grid,
16395 'Edit macros', 'Edits the current world\'s macro cage', undef,
16396 5, 7, 9, 10);
16397 $button11->signal_connect('clicked' => sub {
16398  
16399 $self->session->pseudoCmd('editcage -m', $self->pseudoCmdMode);
16400 });
16401  
16402 my $button12 = $self->addButton($grid,
16403 'Edit timers', 'Edits the current world\'s timer cage', undef,
16404 7, 9, 9, 10);
16405 $button12->signal_connect('clicked' => sub {
16406  
16407 $self->session->pseudoCmd('editcage -i', $self->pseudoCmdMode);
16408 });
16409  
16410 my $button13 = $self->addButton($grid,
16411 'Edit hooks', 'Edits the current world\'s hook cage', undef,
16412 9, 12, 9, 10);
16413 $button13->signal_connect('clicked' => sub {
16414  
16415 $self->session->pseudoCmd('editcage -h', $self->pseudoCmdMode);
16416 });
16417  
16418 $self->addLabel($grid, '<i>Other windows</i>',
16419 1, 12, 10, 11);
16420  
16421 my $button14 = $self->addButton($grid,
16422 'Open automapper', 'Opens the automapper window', undef,
16423 1, 4, 11, 12);
16424 $button14->signal_connect('clicked' => sub {
16425  
16426 $self->session->pseudoCmd('openautomapper', $self->pseudoCmdMode);
16427 });
16428  
16429 my $button15 = $self->addButton($grid,
16430 'Open object viewer', 'Opens the object viewer window', undef,
16431 4, 8, 11, 12);
16432 $button15->signal_connect('clicked' => sub {
16433  
16434 $self->session->pseudoCmd('openobjectviewer', $self->pseudoCmdMode);
16435 });
16436  
16437 my $button16 = $self->addButton($grid,
16438 'Open Locator wizard', 'Opens the Locator wizard window', undef,
16439 8, 12, 11, 12);
16440 $button16->signal_connect('clicked' => sub {
16441  
16442 $self->session->pseudoCmd('locatorwizard', $self->pseudoCmdMode);
16443 });
16444  
16445 my $button17 = $self->addButton($grid,
16446 'Open About window', 'Opens the About window', undef,
16447 1, 6, 12, 13);
16448 $button17->signal_connect('clicked' => sub {
16449  
16450 $self->session->pseudoCmd('openaboutwindow', $self->pseudoCmdMode);
16451 });
16452  
16453 my $button18 = $self->addButton($grid,
16454 'Open Pattern Test window', 'Opens the Pattern Test window', undef,
16455 6, 12, 12, 13);
16456 $button18->signal_connect('clicked' => sub {
16457  
16458 $self->session->pseudoCmd('testpattern', $self->pseudoCmdMode);
16459 });
16460  
16461 # Tab complete
16462 return 1;
16463 }
16464  
16465 sub autoSaveTab {
16466  
16467 # Auto-save tab
16468 #
16469 # Expected arguments
16470 # (none besides $self)
16471 #
16472 # Return values
16473 # 'undef' on improper arguments
16474 # 1 otherwise
16475  
16476 my ($self, $check) = @_;
16477  
16478 # Check for improper arguments
16479 if (defined $check) {
16480  
16481 return $axmud::CLIENT->writeImproper($self->_objClass . '->autoSaveTab', @_);
16482 }
16483  
16484 # Tab setup
16485 my $grid = $self->addTab('_Auto-save', $self->notebook);
16486  
16487 # Auto-save settings
16488 $self->addLabel($grid, '<b>Auto-save settings</b>',
16489 0, 12, 0, 1);
16490  
16491 $self->addLabel($grid, 'Enable auto-saves',
16492 1, 4, 1, 2);
16493  
16494 my $button = $self->addButton($grid,
16495 'Turn on', 'Turns autosaves on', undef,
16496 4, 6, 1, 2);
16497 # ->signal_connect appears below
16498  
16499  
16500 my $button2 = $self->addButton($grid,
16501 'Turn off', 'Turns autosaves off', undef,
16502 6, 8, 1, 2);
16503 # ->signal_connect appears below
16504  
16505 my $checkButton = $self->addCheckButton($grid, 'Turned on', undef, FALSE,
16506 9, 12, 1, 2);
16507 $checkButton->set_active($axmud::CLIENT->autoSaveFlag);
16508  
16509 $self->addLabel($grid, 'Time interval (minutes)',
16510 1, 4, 2, 3);
16511 my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
16512 4, 6, 2, 3,
16513 8, 8);
16514 $entry3->set_text($axmud::CLIENT->autoSaveWaitTime);
16515  
16516 my $button3 = $self->addButton($grid,
16517 'Set interval', 'Set the time between successive auto-saves', undef,
16518 6, 8, 2, 3);
16519 # ->signal_connect appears below
16520  
16521 # ->signal_connects from above
16522 $button->signal_connect('clicked' => sub {
16523  
16524 # Turn autosave on
16525 $self->session->pseudoCmd('autosave on', $self->pseudoCmdMode);
16526  
16527 # Update the checkbutton
16528 $checkButton->set_active($axmud::CLIENT->autoSaveFlag);
16529 });
16530  
16531 $button2->signal_connect('clicked' => sub {
16532  
16533 # Turn autosave off
16534 $self->session->pseudoCmd('autosave off', $self->pseudoCmdMode);
16535  
16536 # Update the checkbutton
16537 $checkButton->set_active($axmud::CLIENT->autoSaveFlag);
16538 });
16539  
16540 $button3->signal_connect('clicked' => sub {
16541  
16542 if ($self->checkEntryIcon($entry3)) {
16543  
16544 # Set autosave time
16545 $self->session->pseudoCmd('autosave ' . $entry3->get_text(), $self->pseudoCmdMode);
16546  
16547 # Update the checkbutton
16548 $checkButton->set_active($axmud::CLIENT->autoSaveFlag);
16549 }
16550 });
16551  
16552 # Tab complete
16553 return 1;
16554 }
16555  
16556 sub charSetTab {
16557  
16558 # CharSet tab
16559 #
16560 # Expected arguments
16561 # (none besides $self)
16562 #
16563 # Return values
16564 # 'undef' on improper arguments
16565 # 1 otherwise
16566  
16567 my ($self, $check) = @_;
16568  
16569 # Local variables
16570 my (@setList, @comboList);
16571  
16572 # Check for improper arguments
16573 if (defined $check) {
16574  
16575 return $axmud::CLIENT->writeImproper($self->_objClass . '->charSetTab', @_);
16576 }
16577  
16578 # Tab setup
16579 my $grid = $self->addTab('C_harset', $self->notebook);
16580  
16581 # Character set settings
16582 $self->addLabel($grid, '<b>Character set settings</b>',
16583 0, 12, 0, 1);
16584  
16585 $self->addLabel($grid, 'Default character set (for incoming text)',
16586 1, 6, 1, 2);
16587  
16588 @setList = $axmud::CLIENT->charSetList;
16589 # (Find the current character set, and put it at the top of the list)
16590 foreach my $item (@setList) {
16591  
16592 if ($item ne $axmud::CLIENT->charSet) {
16593  
16594 push (@comboList, $item);
16595 }
16596 }
16597  
16598 unshift(@comboList, $axmud::CLIENT->charSet);
16599  
16600 my $comboBox = $self->addComboBox($grid, undef, \@comboList, '',
16601 TRUE, # No 'undef' value used
16602 6, 12, 1, 2);
16603 $comboBox->signal_connect('changed' => sub {
16604  
16605 my ($choice, $index);
16606  
16607 $choice = $comboBox->get_active_text();
16608 if ($choice) {
16609  
16610 $self->session->pseudoCmd(
16611 'setcharset -d ' . $choice,
16612 $self->pseudoCmdMode,
16613 );
16614 }
16615 });
16616  
16617 # Tab complete
16618 return 1;
16619 }
16620  
16621 sub coloursFontsTab {
16622  
16623 # ColoursFonts tab
16624 #
16625 # Expected arguments
16626 # (none besides $self)
16627 #
16628 # Return values
16629 # 'undef' on improper arguments
16630 # 1 otherwise
16631  
16632 my ($self, $check) = @_;
16633  
16634 # Local variables
16635 my ($mainObj, $customObj);
16636  
16637 # Check for improper arguments
16638 if (defined $check) {
16639  
16640 return $axmud::CLIENT->writeImproper($self->_objClass . '->coloursFontsTab', @_);
16641 }
16642  
16643 # Tab setup
16644 my $grid = $self->addTab('_Colours/Fonts', $self->notebook);
16645  
16646 # Import colour schemes
16647 $mainObj = $axmud::CLIENT->ivShow('colourSchemeHash', 'main');
16648 $customObj = $axmud::CLIENT->ivShow('colourSchemeHash', 'custom');
16649  
16650 # Colour/font settings
16651 $self->addLabel($grid, '<b>Colour/font settings</b>',
16652 0, 12, 0, 1);
16653  
16654 my $button = $self->addButton($grid,
16655 'Set the colours / fonts used in \'main\' windows',
16656 'Edit the colour scheme \'main\'',
16657 undef,
16658 1, 12, 1, 2);
16659 $button->signal_connect('clicked' => sub {
16660  
16661 $self->session->pseudoCmd('editcolourscheme main');
16662 });
16663  
16664 my $button2 = $self->addButton($grid,
16665 'Set the colours / fonts used in (most) task windows',
16666 'Edit the colour scheme \'custom\'',
16667 undef,
16668 1, 12, 2, 3);
16669 $button2->signal_connect('clicked' => sub {
16670  
16671 $self->session->pseudoCmd('editcolourscheme custom');
16672 });
16673  
16674 my $checkButton = $self->addCheckButton(
16675 $grid,
16676 'Convert invisble text (i.e. text that\'s the same colour as the background)',
16677 undef,
16678 TRUE,
16679 1, 12, 3, 4);
16680 $checkButton->set_active($axmud::CLIENT->convertInvisibleFlag);
16681 $checkButton->signal_connect('toggled' => sub {
16682  
16683 my $flag = $checkButton->get_active();
16684  
16685 if (
16686 (! $flag && ! $axmud::CLIENT->convertInvisibleFlag)
16687 || ($flag && $axmud::CLIENT->convertInvisibleFlag)
16688 ) {
16689 $self->session->pseudoCmd('convertText');
16690 }
16691 });
16692  
16693 # Tab complete
16694 return 1;
16695 }
16696  
16697 sub commandsTab {
16698  
16699 # Commands tab
16700 #
16701 # Expected arguments
16702 # (none besides $self)
16703 #
16704 # Return values
16705 # 'undef' on improper arguments
16706 # 1 otherwise
16707  
16708 my ($self, $check) = @_;
16709  
16710 # Check for improper arguments
16711 if (defined $check) {
16712  
16713 return $axmud::CLIENT->writeImproper($self->_objClass . '->commandsTab', @_);
16714 }
16715  
16716 # Tab setup
16717 my $grid = $self->addTab('C_ommands', $self->notebook);
16718  
16719 # Command sigils
16720 $self->addLabel($grid, '<b>Command sigils</b>',
16721 0, 12, 0, 1);
16722  
16723 $self->addLabel($grid, 'Echo command sigil',
16724 1, 4, 1, 2);
16725 my $entry = $self->addEntry($grid, undef, FALSE,
16726 4, 6, 1, 2);
16727 $entry->set_text($axmud::CLIENT->constEchoSigil);
16728  
16729 my $checkButton3 = $self->addCheckButton($grid, undef, undef, FALSE,
16730 6, 8, 1, 2);
16731 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
16732  
16733 my $button = $self->addButton($grid, 'Enable', 'Enable echo commands', undef,
16734 8, 10, 1, 2);
16735 $button->signal_connect('clicked' => sub {
16736  
16737 if (! $axmud::CLIENT->echoSigilFlag) {
16738  
16739 $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode);
16740 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
16741 }
16742 });
16743 my $button2 = $self->addButton($grid, 'Disable', 'Disable echo commands', undef,
16744 10, 12, 1, 2);
16745 $button2->signal_connect('clicked' => sub {
16746  
16747 if ($axmud::CLIENT->echoSigilFlag) {
16748  
16749 $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode);
16750 $checkButton3->set_active($axmud::CLIENT->echoSigilFlag);
16751 }
16752 });
16753  
16754 $self->addLabel($grid, 'Perl command sigil',
16755 1, 4, 2, 3);
16756 my $entry2 = $self->addEntry($grid, undef, FALSE,
16757 4, 6, 2, 3);
16758 $entry2->set_text($axmud::CLIENT->constPerlSigil);
16759  
16760 my $checkButton4 = $self->addCheckButton($grid, undef, undef, FALSE,
16761 6, 8, 2, 3);
16762 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
16763  
16764 my $button3 = $self->addButton($grid, 'Enable', 'Enable Perl commands', undef,
16765 8, 10, 2, 3);
16766 $button3->signal_connect('clicked' => sub {
16767  
16768 if (! $axmud::CLIENT->perlSigilFlag) {
16769  
16770 $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode);
16771 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
16772 }
16773 });
16774 my $button4 = $self->addButton($grid, 'Disable', 'Disable Perl commands', undef,
16775 10, 12, 2, 3);
16776 $button4->signal_connect('clicked' => sub {
16777  
16778 if ($axmud::CLIENT->perlSigilFlag) {
16779  
16780 $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode);
16781 $checkButton4->set_active($axmud::CLIENT->perlSigilFlag);
16782 }
16783 });
16784  
16785 $self->addLabel($grid, 'Script command sigil',
16786 1, 4, 3, 4);
16787 my $entry3 = $self->addEntry($grid, undef, FALSE,
16788 4, 6, 3, 4);
16789 $entry3->set_text($axmud::CLIENT->constScriptSigil);
16790  
16791 my $checkButton5 = $self->addCheckButton($grid, undef, undef, FALSE,
16792 6, 8, 3, 4);
16793 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
16794  
16795 my $button5 = $self->addButton($grid, 'Enable', 'Enable script commands', undef,
16796 8, 10, 3, 4);
16797 $button5->signal_connect('clicked' => sub {
16798  
16799 if (! $axmud::CLIENT->scriptSigilFlag) {
16800  
16801 $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode);
16802 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
16803 }
16804 });
16805 my $button6 = $self->addButton($grid, 'Disable', 'Disable script commands', undef,
16806 10, 12, 3, 4);
16807 $button6->signal_connect('clicked' => sub {
16808  
16809 if ($axmud::CLIENT->scriptSigilFlag) {
16810  
16811 $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode);
16812 $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag);
16813 }
16814 });
16815  
16816 $self->addLabel($grid, 'Multi command sigil',
16817 1, 4, 4, 5);
16818 my $entry4 = $self->addEntry($grid, undef, FALSE,
16819 4, 6, 4, 5);
16820 $entry4->set_text($axmud::CLIENT->constMultiSigil);
16821  
16822 my $checkButton6 = $self->addCheckButton($grid, undef, undef, FALSE,
16823 6, 8, 4, 5);
16824 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
16825  
16826 my $button7 = $self->addButton($grid, 'Enable', 'Enable multi commands', undef,
16827 8, 10, 4, 5);
16828 $button7->signal_connect('clicked' => sub {
16829  
16830 if (! $axmud::CLIENT->multiSigilFlag) {
16831  
16832 $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode);
16833 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
16834 }
16835 });
16836 my $button8 = $self->addButton($grid, 'Disable', 'Disable multi commands', undef,
16837 10, 12, 4, 5);
16838 $button8->signal_connect('clicked' => sub {
16839  
16840 if ($axmud::CLIENT->multiSigilFlag) {
16841  
16842 $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode);
16843 $checkButton6->set_active($axmud::CLIENT->multiSigilFlag);
16844 }
16845 });
16846  
16847 $self->addLabel($grid, 'Speedwalk command sigil',
16848 1, 4, 5, 6);
16849 my $entry5 = $self->addEntry($grid, undef, FALSE,
16850 4, 6, 5, 6);
16851 $entry5->set_text($axmud::CLIENT->constSpeedSigil);
16852  
16853 my $checkButton7 = $self->addCheckButton($grid, undef, undef, FALSE,
16854 6, 8, 5, 6);
16855 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
16856  
16857 my $button9 = $self->addButton($grid, 'Enable', 'Enable speedwalk commands', undef,
16858 8, 10, 5, 6);
16859 $button9->signal_connect('clicked' => sub {
16860  
16861 if (! $axmud::CLIENT->speedSigilFlag) {
16862  
16863 $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode);
16864 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
16865 }
16866 });
16867 my $button10 = $self->addButton($grid, 'Disable', 'Disable speedwalk commands', undef,
16868 10, 12, 5, 6);
16869 $button10->signal_connect('clicked' => sub {
16870  
16871 if ($axmud::CLIENT->speedSigilFlag) {
16872  
16873 $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode);
16874 $checkButton7->set_active($axmud::CLIENT->speedSigilFlag);
16875 }
16876 });
16877  
16878 $self->addLabel($grid, 'Bypass command sigil',
16879 1, 4, 6, 7);
16880 my $entry6 = $self->addEntry($grid, undef, FALSE,
16881 4, 6, 6, 7);
16882 $entry6->set_text($axmud::CLIENT->constBypassSigil);
16883  
16884 my $checkButton8 = $self->addCheckButton($grid, undef, undef, FALSE,
16885 6, 8, 6, 7);
16886 $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag);
16887  
16888 my $button11 = $self->addButton($grid, 'Enable', 'Enable bypass commands', undef,
16889 8, 10, 6, 7);
16890 $button11->signal_connect('clicked' => sub {
16891  
16892 if (! $axmud::CLIENT->bypassSigilFlag) {
16893  
16894 $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode);
16895 $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag);
16896 }
16897 });
16898 my $button12 = $self->addButton($grid, 'Disable', 'Disable bypass commands', undef,
16899 10, 12, 6, 7);
16900 $button12->signal_connect('clicked' => sub {
16901  
16902 if ($axmud::CLIENT->bypassSigilFlag) {
16903  
16904 $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode);
16905 $checkButton8->set_active($axmud::CLIENT->speedSigilFlag);
16906 }
16907 });
16908  
16909 # World commands
16910 $self->addLabel($grid, '<b>World commands</b>',
16911 0, 12, 7, 8);
16912 my $checkButton9 = $self->addCheckButton(
16913 $grid, 'World commands also shown in \'main\' windows', undef, TRUE,
16914 1, 12, 8, 9);
16915 $checkButton9->set_active($axmud::CLIENT->confirmWorldCmdFlag);
16916 $checkButton9->signal_connect('toggled' => sub {
16917  
16918 if (
16919 ($checkButton9->get_active() && ! $axmud::CLIENT->confirmWorldCmdFlag)
16920 || (! $checkButton9->get_active() && $axmud::CLIENT->confirmWorldCmdFlag)
16921 ) {
16922 $self->session->pseudoCmd('toggleinstruct -c', $self->pseudoCmdMode);
16923 }
16924 });
16925  
16926 my $checkButton10 = $self->addCheckButton(
16927 $grid, 'Show a visible cursor in \'main\' windows', undef, TRUE,
16928 1, 12, 9, 10);
16929 $checkButton10->set_active($axmud::CLIENT->useVisibleCursorFlag);
16930 $checkButton10->signal_connect('toggled' => sub {
16931  
16932 if (
16933 ($checkButton10->get_active() && ! $axmud::CLIENT->useVisibleCursorFlag)
16934 || (! $checkButton10->get_active() && $axmud::CLIENT->useVisibleCursorFlag)
16935 ) {
16936 $self->session->pseudoCmd('configureterminal -c', $self->pseudoCmdMode);
16937 }
16938 });
16939  
16940 # System messages
16941 $self->addLabel($grid, '<b>System messages</b>',
16942 0, 12, 10, 11);
16943  
16944 my $checkButton11 = $self->addCheckButton(
16945 $grid,
16946 'Allow system messages to be displayed in \'main\' windows',
16947 undef,
16948 TRUE,
16949 1, 12, 11, 12);
16950 $checkButton11->set_active($axmud::CLIENT->mainWinSystemMsgFlag);
16951 $checkButton11->signal_connect('toggled' => sub {
16952  
16953 if (
16954 ($checkButton11->get_active && ! $axmud::CLIENT->mainWinSystemMsgFlag)
16955 || (! $checkButton11->get_active && $axmud::CLIENT->mainWinSystemMsgFlag)
16956 ) {
16957 $self->session->pseudoCmd('togglemainwindow -s', $self->pseudoCmdMode);
16958 }
16959 });
16960  
16961 # Tab complete
16962 return 1;
16963 }
16964  
16965 sub logsTab {
16966  
16967 # Logs tab
16968 #
16969 # Expected arguments
16970 # (none besides $self)
16971 #
16972 # Return values
16973 # 'undef' on improper arguments
16974 # 1 otherwise
16975  
16976 my ($self, $check) = @_;
16977  
16978 # Check for improper arguments
16979 if (defined $check) {
16980  
16981 return $axmud::CLIENT->writeImproper($self->_objClass . '->logsTab', @_);
16982 }
16983  
16984 # Tab setup
16985 my $grid = $self->addTab('_Logs', $self->notebook);
16986  
16987 # Log settings
16988 $self->addLabel($grid, '<b>Log settings</b>',
16989 0, 12, 0, 1);
16990  
16991 my $checkButton = $self->addCheckButton($grid, 'Enable logging in general', undef, TRUE,
16992 1, 12, 1, 2);
16993 $checkButton->set_active($axmud::CLIENT->allowLogsFlag);
16994 $checkButton->signal_connect('toggled' => sub {
16995  
16996 $self->session->pseudoCmd('log -l', $self->pseudoCmdMode);
16997 $checkButton->set_active($axmud::CLIENT->allowLogsFlag);
16998 });
16999  
17000 my $checkButton2 = $self->addCheckButton($grid, 'Lines show the current date', undef, TRUE,
17001 1, 12, 2, 3);
17002 $checkButton2->set_active($axmud::CLIENT->logPrefixDateFlag);
17003 $checkButton2->signal_connect('toggled' => sub {
17004  
17005 $self->session->pseudoCmd('log -a', $self->pseudoCmdMode);
17006 $checkButton2->set_active($axmud::CLIENT->logPrefixDateFlag);
17007 });
17008  
17009 my $checkButton3 = $self->addCheckButton($grid, 'Lines show the current time', undef, TRUE,
17010 1, 12, 3, 4);
17011 $checkButton3->set_active($axmud::CLIENT->logPrefixTimeFlag);
17012 $checkButton3->signal_connect('toggled' => sub {
17013  
17014 $self->session->pseudoCmd('log -t', $self->pseudoCmdMode);
17015 $checkButton3->set_active($axmud::CLIENT->logPrefixTimeFlag);
17016 });
17017  
17018 # Tab complete
17019 return 1;
17020 }
17021  
17022 sub soundTab {
17023  
17024 # Sound tab
17025 #
17026 # Expected arguments
17027 # (none besides $self)
17028 #
17029 # Return values
17030 # 'undef' on improper arguments
17031 # 1 otherwise
17032  
17033 my ($self, $check) = @_;
17034  
17035 # Check for improper arguments
17036 if (defined $check) {
17037  
17038 return $axmud::CLIENT->writeImproper($self->_objClass . '->soundTab', @_);
17039 }
17040  
17041 # Tab setup
17042 my $grid = $self->addTab('So_und', $self->notebook);
17043  
17044 # Sound settings
17045 $self->addLabel($grid, '<b>Sound settings</b>',
17046 0, 12, 0, 1);
17047  
17048 my $checkButton = $self->addCheckButton(
17049 $grid, 'Enable sound effects in general', undef, TRUE,
17050 1, 12, 1, 2);
17051 $checkButton->set_active($axmud::CLIENT->allowSoundFlag);
17052 $checkButton->signal_connect('toggled' => sub {
17053  
17054 if ($checkButton->get_active()) {
17055 $self->session->pseudoCmd('sound on', $self->pseudoCmdMode);
17056 } else {
17057 $self->session->pseudoCmd('sound off', $self->pseudoCmdMode);
17058 }
17059 });
17060  
17061 my $checkButton2 = $self->addCheckButton(
17062 $grid,
17063 'Enable beeps sent by the world (while sound effects are on)',
17064 undef,
17065 TRUE,
17066 1, 12, 2, 3);
17067 $checkButton2->set_active($axmud::CLIENT->allowAsciiBellFlag);
17068 $checkButton2->signal_connect('toggled' => sub {
17069  
17070 if ($checkButton2->get_active()) {
17071 $self->session->pseudoCmd('asciibell on', $self->pseudoCmdMode);
17072 } else {
17073 $self->session->pseudoCmd('asciibell off', $self->pseudoCmdMode);
17074 }
17075 });
17076  
17077 my $button = $self->addButton(
17078 $grid,
17079 'Test sound by playing a random sound effect',
17080 'Play a random sound effect',
17081 undef,
17082 1, 12, 3, 4);
17083 $button->signal_connect('clicked' => sub {
17084  
17085 # Play the sound effect
17086 $self->session->pseudoCmd('playsoundeffect', $self->pseudoCmdMode);
17087 });
17088  
17089 # Tab complete
17090 return 1;
17091 }
17092  
17093 sub speechTab {
17094  
17095 # Speech tab
17096 #
17097 # Expected arguments
17098 # (none besides $self)
17099 #
17100 # Return values
17101 # 'undef' on improper arguments
17102 # 1 otherwise
17103  
17104 my ($self, $check) = @_;
17105  
17106 # Check for improper arguments
17107 if (defined $check) {
17108  
17109 return $axmud::CLIENT->writeImproper($self->_objClass . '->speechTab', @_);
17110 }
17111  
17112 # Tab setup
17113 my $grid = $self->addTab('S_peech', $self->notebook);
17114  
17115 # Text-to-speech settings
17116 $self->addLabel($grid, '<b>Text-to-speech (TTS) settings</b>',
17117 0, 12, 0, 1);
17118  
17119 my $checkButton = $self->addCheckButton(
17120 $grid, 'Enable text-to-speech for all users', undef, TRUE,
17121 1, 12, 1, 2);
17122 $checkButton->set_active($axmud::CLIENT->customAllowTTSFlag);
17123 $checkButton->signal_connect('toggled' => sub {
17124  
17125 if ($checkButton->get_active()) {
17126 $axmud::CLIENT->set_customAllowTTSFlag(TRUE);
17127 } else {
17128 $axmud::CLIENT->set_customAllowTTSFlag(FALSE);
17129 }
17130 });
17131  
17132 my $checkButton2 = $self->addCheckButton(
17133 $grid, 'Convert text received from the world', undef, TRUE,
17134 1, 12, 2, 3);
17135 $checkButton2->set_active($axmud::CLIENT->ttsReceiveFlag);
17136 $checkButton2->signal_connect('toggled' => sub {
17137  
17138 if ($checkButton2->get_active()) {
17139 $axmud::CLIENT->set_ttsFlag('receive', TRUE);
17140 } else {
17141 $axmud::CLIENT->set_ttsFlag('receive', FALSE);
17142 }
17143 });
17144  
17145 my $checkButton3 = $self->addCheckButton($grid, 'Convert system messages', undef, TRUE,
17146 1, 12, 3, 4);
17147 $checkButton3->set_active($axmud::CLIENT->ttsSystemFlag);
17148 $checkButton3->signal_connect('toggled' => sub {
17149  
17150 if ($checkButton3->get_active()) {
17151 $axmud::CLIENT->set_ttsFlag('system', TRUE);
17152 } else {
17153 $axmud::CLIENT->set_ttsFlag('system', FALSE);
17154 }
17155 });
17156  
17157 my $checkButton4 = $self->addCheckButton(
17158 $grid, 'Convert system error messages', undef, TRUE,
17159 1, 12, 4, 5);
17160 $checkButton4->set_active($axmud::CLIENT->ttsSystemErrorFlag);
17161 $checkButton4->signal_connect('toggled' => sub {
17162  
17163 if ($checkButton4->get_active()) {
17164 $axmud::CLIENT->set_ttsFlag('error', TRUE);
17165 } else {
17166 $axmud::CLIENT->set_ttsFlag('error', FALSE);
17167 }
17168 });
17169  
17170 my $checkButton5 = $self->addCheckButton($grid, 'Convert world commands', undef, TRUE,
17171 1, 12, 5, 6);
17172 $checkButton5->set_active($axmud::CLIENT->ttsWorldCmdFlag);
17173 $checkButton5->signal_connect('toggled' => sub {
17174  
17175 if ($checkButton5->get_active()) {
17176 $axmud::CLIENT->set_ttsFlag('command', TRUE);
17177 } else {
17178 $axmud::CLIENT->set_ttsFlag('command', FALSE);
17179 }
17180 });
17181  
17182 my $checkButton6 = $self->addCheckButton(
17183 $grid, 'Convert \'dialogue\' windows', undef, TRUE,
17184 1, 12, 6, 7);
17185 $checkButton6->set_active($axmud::CLIENT->ttsDialogueFlag);
17186 $checkButton6->signal_connect('toggled' => sub {
17187  
17188 if ($checkButton6->get_active()) {
17189 $axmud::CLIENT->set_ttsFlag('dialogue', TRUE);
17190 } else {
17191 $axmud::CLIENT->set_ttsFlag('dialogue', FALSE);
17192 }
17193 });
17194  
17195 my $checkButton7 = $self->addCheckButton(
17196 $grid,
17197 'Allow some tasks (e.g. the Status and Locator tasks) to convert certain strings to'
17198 . ' speech',
17199 undef,
17200 TRUE,
17201 1, 12, 7, 8);
17202 $checkButton7->set_active($axmud::CLIENT->ttsTaskFlag);
17203 $checkButton7->signal_connect('toggled' => sub {
17204  
17205 if ($checkButton7->get_active()) {
17206 $axmud::CLIENT->set_ttsFlag('task', TRUE);
17207 } else {
17208 $axmud::CLIENT->set_ttsFlag('task', FALSE);
17209 }
17210 });
17211  
17212 # Tab complete
17213 return 1;
17214 }
17215  
17216 sub windowsTab {
17217  
17218 # Windows tab
17219 #
17220 # Expected arguments
17221 # (none besides $self)
17222 #
17223 # Return values
17224 # 'undef' on improper arguments
17225 # 1 otherwise
17226  
17227 my ($self, $check) = @_;
17228  
17229 # Local variables
17230 my @comboList;
17231  
17232 # Check for improper arguments
17233 if (defined $check) {
17234  
17235 return $axmud::CLIENT->writeImproper($self->_objClass . '->windowsTab', @_);
17236 }
17237  
17238 # Tab setup
17239 my $grid = $self->addTab('_Windows', $self->notebook);
17240  
17241 # Window tiling settings
17242 $self->addLabel($grid, '<b>Window tiling settings</b>',
17243 0, 12, 0, 1);
17244  
17245 $self->addLabel(
17246 $grid,
17247 '<i>Zonemap used for window tiling:</i>',
17248 1, 6, 1, 2);
17249  
17250 @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
17251 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
17252 TRUE, # No 'undef' value used
17253 6, 12, 1, 2);
17254  
17255 my $button = $self->addButton(
17256 $grid,
17257 'Apply to the default workspace (desktop) now',
17258 'Apply the selected zonemap to the default (first) workspace',
17259 undef,
17260 1, 12, 2, 3,
17261 );
17262 $button->signal_connect('clicked' => sub {
17263  
17264 my $choice = $combo->get_active_text();
17265 if (defined $choice) {
17266  
17267 $self->session->pseudoCmd('resetgrid -w 0 ' . $choice);
17268 }
17269 });
17270  
17271 my $button2 = $self->addButton(
17272 $grid,
17273 'Apply to the default workspace whenever ' . $axmud::SCRIPT . ' starts',
17274 'Apply the selected zonemap to the default (first) initial workspace',
17275 undef,
17276 1, 12, 3, 4,
17277 );
17278 $button2->signal_connect('clicked' => sub {
17279  
17280 my $choice = $combo->get_active_text();
17281 if (defined $choice) {
17282  
17283 $self->session->pseudoCmd(
17284 'modifyinitialworkspace 0 ' . $choice,
17285 $self->pseudoCmdMode,
17286 );
17287 }
17288 });
17289  
17290 # Tab complete
17291 return 1;
17292 }
17293  
17294 ##################
17295 # Accessors - set
17296  
17297 ##################
17298 # Accessors - get
17299 }
17300  
17301 { package Games::Axmud::PrefWin::Search;
17302  
17303 use strict;
17304 use warnings;
17305 use diagnostics;
17306  
17307 use Glib qw(TRUE FALSE);
17308  
17309 our @ISA = qw(
17310 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
17311 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
17312 );
17313  
17314 ##################
17315 # Constructors
17316  
17317 # Contents of $self->editConfigHash after $self->new has been called:
17318 # (none)
17319  
17320 sub new {
17321  
17322 # Called by GA::Generic::Win->createFreeWin
17323 # Creates a new instance of a 'config' window (any 'free' window object inheriting from this
17324 # object, namely 'edit' windows and 'pref' windows)
17325 #
17326 # Expected arguments
17327 # $number - Unique number for this window object
17328 # $workspaceObj - The GA::Obj::Workspace handling the workspace in which this window
17329 # should be created
17330 # $owner - The owner; a 'grid' window object (but not an 'external' window) or a
17331 # 'free' window object. When this window opens/closes, the owner is
17332 # informed via calls to its ->add_childFreeWin / ->del_childFreeWin
17333 # functions
17334 #
17335 # Optional arguments
17336 # $session - The GA::Session from which this function was called. 'undef' if the
17337 # calling function didn't specify a session and $owner's ->session IV
17338 # is also 'undef'
17339 # $title - A string to use as the window title. If 'undef', a generic title is
17340 # used
17341 # $editObj - The object to be edited in the window (for 'edit' windows only;
17342 # should be 'undef' for 'pref' windows)
17343 # $tempFlag - Flag set to TRUE if $editObj is either temporary, or has not yet been
17344 # added to any registry (usually because the user needs to name it
17345 # first). Set to FALSE (or 'undef') otherwise. Ignored if $editObj is
17346 # not specified
17347 # %configHash - Hash containing any number of key-value pairs needed for this
17348 # particular 'config' window; for example, for example,
17349 # GA::PrefWin::TaskStart uses it to specify a task name and type. Set
17350 # to an empty hash if not required
17351 #
17352 # Return values
17353 # 'undef' on improper arguments
17354 # Blessed reference to the newly-created object on success
17355  
17356 my (
17357 $class, $number, $workspaceObj, $owner, $session, $title, $editObj, $tempFlag,
17358 %configHash,
17359 ) = @_;
17360  
17361 # Local variables
17362 my ($winType, $winName);
17363  
17364 # Check for improper arguments
17365 if (! defined $class || ! defined $number || ! defined $workspaceObj || ! defined $owner) {
17366  
17367 return $axmud::CLIENT->writeImproper($class . '->new', @_);
17368 }
17369  
17370 # Set the values to use for some standard window IVs
17371 if ($editObj) {
17372  
17373 $winType = 'edit';
17374 $winName = 'edit';
17375 if (! defined $title) {
17376  
17377 $title = 'Edit window';
17378 }
17379  
17380 } else {
17381  
17382 $winType = 'pref';
17383 $winName = 'pref';
17384 if (! defined $title) {
17385  
17386 $title = 'Preference window';
17387 }
17388 }
17389  
17390 # Setup
17391 my $self = {
17392 _objName => $winType . '_win_' . $number,
17393 _objClass => $class,
17394 _parentFile => undef, # No parent file object
17395 _parentWorld => undef, # No parent file object
17396 _privFlag => TRUE, # All IVs are private
17397  
17398 # Standard window object IVs
17399 # --------------------------
17400  
17401 # Unique number for this window object
17402 number => $number,
17403 # The window category - 'grid' or 'free'
17404 winCategory => 'free',
17405 # The window type, any of the keys in GA::Client->constFreeWinTypeHash
17406 winType => $winType,
17407 # A name for the window (for 'config' windows, the same as the window type)
17408 winName => $winName,
17409 # The GA::Obj::Workspace object for the workspace in which this window is created
17410 workspaceObj => $workspaceObj,
17411 # The owner; a 'grid' window object (but not an 'external' window) or a 'free' window
17412 # object. When this window opens/closes, the owner is informed via calls to its
17413 # ->add_childFreeWin / ->del_childFreeWin functions
17414 owner => $owner,
17415 # The GA::Session from which this function was called. 'undef' if the calling function
17416 # didn't specify a session and $owner's ->session IV is also 'undef'
17417 session => $session,
17418 # When GA::Session->pseudoCmd is called to execute a client command, the mode in which
17419 # it should be called (usually 'win_error' or 'win_only', which causes errors to be
17420 # displayed in a 'dialogue' window)
17421 pseudoCmdMode => 'win_error',
17422  
17423 # The window widget. For most window objects, the Gtk3::Window. For pseudo-windows, the
17424 # parent 'main' window's Gtk3::Window
17425 # The code should use this IV when it wants to do something to the window itself
17426 # (minimise it, make it active, etc)
17427 winWidget => undef,
17428 # The window container. For most window objects, the Gtk3::Window. For pseudo-windows,
17429 # the parent GA::Table::PseudoWin table object
17430 # The code should use this IV when it wants to add, modify or remove widgets inside the
17431 # window itself
17432 winBox => undef,
17433 # Flag set to TRUE if the window actually exists (after a call to $self->winEnable),
17434 # FALSE if not
17435 enabledFlag => FALSE,
17436 # Flag set to TRUE if the Gtk3 window itself is visible (after a call to
17437 # $self->setVisible), FALSE if it is not visible (after a call to $self->setInvisible)
17438 visibleFlag => TRUE,
17439 # Registry hash of 'free' windows (excluding 'dialogue' windows) for which this window
17440 # is the parent, a subset of GA::Obj::Desktop->freeWinHash. Hash in the form
17441 # $childFreeWinHash{unique_number} = blessed_reference_to_window_object
17442 childFreeWinHash => {},
17443 # When a child 'free' window (excluding 'dialogue' windows) is destroyed, this parent
17444 # window is informed via a call to $self->del_childFreeWin
17445 # When the child is destroyed, this window might want to call some of its own functions
17446 # to update various widgets and/or IVs, in which case this window adds an entry to
17447 # this hash; a hash in the form
17448 # $childDestroyHash{unique_number} = list_reference
17449 # ...where 'unique_number' is the child window's ->number, and 'list_reference' is a
17450 # reference to a list in groups of 2, in the form
17451 # (sub_name, argument_list_ref, sub_name, argument_list_ref...)
17452 childDestroyHash => {},
17453  
17454 # The container widget into which all other widgets are packed (usually a Gtk3::VBox or
17455 # Gtk3::HBox, but any container widget can be used; takes up the whole window client
17456 # area)
17457 packingBox => undef, # Gtk3::VBox
17458  
17459 # Standard IVs for 'free' windows
17460  
17461 # The window's default size, in pixels
17462 widthPixels => $axmud::CLIENT->customFreeWinWidth,
17463 heightPixels => $axmud::CLIENT->customFreeWinHeight,
17464 # Default border/item spacing sizes used in the window, in pixels
17465 borderPixels => $axmud::CLIENT->constFreeBorderPixels,
17466 spacingPixels => $axmud::CLIENT->constFreeSpacingPixels,
17467  
17468 # A string to use as the window title. If 'undef', a generic title is used
17469 title => $title,
17470 # Hash containing any number of key-value pairs needed for this particular 'config'
17471 # window; for example, for example, GA::PrefWin::TaskStart uses it to specify a task
17472 # name and type. Set to an empty hash if not required
17473 configHash => {%configHash},
17474  
17475 # Standard IVs for 'config' windows
17476  
17477 # Widgets
17478 notebook => undef, # Gtk3::Notebook
17479 hBox => undef, # Gtk3::HBox
17480 okButton => undef, # Gtk3::Button
17481 cancelButton => undef, # Gtk3::Button
17482 resetButton => undef, # Gtk3::Button
17483 saveButton => undef, # Gtk3::Button
17484  
17485 # The standard grid size for the notebook (any 'edit'/'pref' window can use a different
17486 # size, if it wants)
17487 gridSize => 12,
17488  
17489 # The object to be edited in the window (for 'edit' windows only; should be 'undef' for
17490 # 'pref' windows)
17491 editObj => $editObj,
17492 # Flag set to TRUE if $editObj is either temporary, or has not yet been added to any
17493 # registry (usually because the user needs to name it first). Set to FALSE
17494 # (or 'undef') otherwise. Ignored if $editObj is not specified
17495 tempFlag => $tempFlag,
17496 # Flag that can be set to TRUE (usually by $self->setupNotebook or ->expandNotebook) if
17497 # $editObj is a current object (e.g. if it is a current profile); set to FALSE at all
17498 # other times
17499 currentFlag => FALSE,
17500 # For 'edit' windows, a hash of IVs in $editObj that should be changed. If no changes
17501 # have been made in the 'edit' window, the hash is empty; otherwise the hash contains
17502 # the new values for each IV to be modified
17503 # Hash in the form:
17504 # $editHash{iv_name} = scalar;
17505 # $editHash{iv_name} = list_reference;
17506 # $editHash{iv_name} = hash_reference;
17507 # For 'pref' windows, a hash of key-value pairs set by the window's widgets;
17508 # $self->enableButtons can access this hash to perform any necessary actions
17509 # ('pref' windows don't make a call to ->saveChanges)
17510 editHash => {},
17511 # Hash containing any number of key-value pairs needed for this particular
17512 # 'edit'/'pref' window; for example, GA::PrefWin::TaskStart uses it to specify a
17513 # task name and type. Set to an empty hash if not required
17514 editConfigHash => \%configHash,
17515  
17516 # IVs for this type of window
17517  
17518 # A flag which, if set to TRUE, means that every object in every region of the world
17519 # model is searched
17520 searchAllFlag => TRUE,
17521 # If ->searchAllFlag is not set, then the name of the region in which to search
17522 searchRegion => undef,
17523  
17524 # Which categories of world model objects to search, in the form
17525 # $categoryHash{world_model_category} = undef
17526 categoryHash => {
17527 'region' => undef,
17528 'room' => undef,
17529 'weapon' => undef,
17530 'armour' => undef,
17531 'garment' => undef,
17532 'char' => undef,
17533 'minion' => undef,
17534 'sentient' => undef,
17535 'creature' => undef,
17536 'portable' => undef,
17537 'decoration' => undef,
17538 'custom' => undef,
17539 },
17540  
17541 # IVs required by this 'edit' window (but not by GA::Generic::EditWin)
17542 # A hash to specify which world model IVs should be searched, in the form
17543 # $searchHash{iv_name} = search_string
17544 # Each IV to be checked is added to this hash as a key. The key's value is a search
17545 # string (where appropriate); otherwise the value is 'undef'
17546 # NB Some IVs can be checked in two ways, in which case there are two keys added to the
17547 # hash: 'name' and '_name'
17548 searchHash => {},
17549 # A parallel hash for IVs that should be checked against a range of values, in the form
17550 # $searchRangeHash{iv_name} = operator
17551 # ...where 'operator' is set to '==', '>', '>=', '<', '<=' or 'min-max'
17552 searchRangeHash => {},
17553 # A parallel hash for IVs that should be checked against a range of values, when the
17554 # operator is 'min-max'
17555 # The minimum value is the value stored in ->searchHash; the maximum value is the value
17556 # stored in this hash
17557 searchUpperHash => {},
17558 # Another parallel hash which, this time, contains all possible IVs (i.e. all possible
17559 # keys in ->searchHash), and tells us what kind of check is done on this IV, in the
17560 # form
17561 # $searchTypeHash{iv_name} = type
17562 # 'type' is one of the following:
17563 # 'match' - perform a regex on the IV's value
17564 # 'flag' - check whether the IV flag is set (or not)
17565 # 'string_equal' - check whether the IV string is an exact match for the IV's value
17566 # 'range' - check whether the IV number is in a certain range, or not
17567 # 'include' - check whether the an exact match is found in the IV list
17568 # 'list_match' - perform a regex on every item in the IV list
17569 # 'key' - check whether the key exists in the IV hash
17570 # 'not_key' - check whether the key doesn't exist in the IV hash
17571 # 'used_hash' - check that the IV hash is not empty
17572 # 'value_match' - perform a regex on the values in every key-value pair in the hash
17573 # IV
17574 # 'special' - do something else
17575 searchTypeHash => {},
17576  
17577 # A hash used by $self->performSearch to compile a list of all world model objects in a
17578 # region
17579 compileHash => {},
17580 };
17581  
17582 # Bless the object into existence
17583 bless $self, $class;
17584  
17585 return $self;
17586 }
17587  
17588 ##################
17589 # Methods
17590  
17591 # Standard window object functions
17592  
17593 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
17594  
17595 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
17596  
17597 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
17598  
17599 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
17600  
17601 # sub winShowAll {} # Inherited from GA::Generic::Win
17602  
17603 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
17604  
17605 # sub redrawWidgets {} # Inherited from GA::Generic::Win
17606  
17607 # ->signal_connects
17608  
17609 # Other functions
17610  
17611 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
17612  
17613 sub enableButtons {
17614  
17615 # Called by $self->drawWidgets
17616 # We only need a single button so, instead of calling the generic ->enableButtons, call a
17617 # method that creates just one button
17618 #
17619 # Expected arguments
17620 # $hBox - The horizontal packing box in which the buttons live (not yet stored as
17621 # an IV)
17622 #
17623 # Return values
17624 # An empty list on improper arguments
17625 # Otherwise, a list containing the Gtk::Button object created
17626  
17627 my ($self, $hBox, $check) = @_;
17628  
17629 # Local variables
17630 my @emptyList;
17631  
17632 # Check for improper arguments
17633 if (! defined $hBox || defined $check) {
17634  
17635 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
17636 return @emptyList;
17637 }
17638  
17639 return $self->enableSingleButton($hBox);
17640 }
17641  
17642 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
17643  
17644 sub setupNotebook {
17645  
17646 # Called by $self->winEnable
17647 # Creates the first tab for the notebook. The remaining tabs are created by
17648 # $self->expandNotebook
17649 #
17650 # Expected arguments
17651 # (none besides $self)
17652 #
17653 # Return values
17654 # 'undef' on improper arguments
17655 # 1 otherwise
17656  
17657 my ($self, $check) = @_;
17658  
17659 # Check for improper arguments
17660 if (defined $check) {
17661  
17662 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
17663 }
17664  
17665 # Tab setup
17666 my $grid = $self->addTab('_Search', $self->notebook);
17667  
17668 # Set up the rest of the tab
17669 $self->searchTab($grid);
17670  
17671 # Set up the remaining tabs
17672 $self->expandNotebook();
17673  
17674 # Tab complete
17675 return 1;
17676 }
17677  
17678 sub expandNotebook {
17679  
17680 # Called by $self->setupNotebook
17681 # Set up additional tabs for the notebook
17682 #
17683 # Expected arguments
17684 # (none besides $self)
17685 #
17686 # Return values
17687 # 'undef' on improper arguments
17688 # 1 otherwise
17689  
17690 my ($self, $check) = @_;
17691  
17692 # Check for improper arguments
17693 if (defined $check) {
17694  
17695 return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_);
17696 }
17697  
17698 $self->propertiesTab();
17699 $self->properties2Tab();
17700 $self->properties3Tab();
17701 $self->properties4Tab();
17702 $self->resultsTab();
17703  
17704 return 1;
17705 }
17706  
17707 # sub saveChanges {} # Inherited from GA::Generic::ConfigWin
17708  
17709 # Notebook tabs
17710  
17711 sub searchTab {
17712  
17713 # Search tab
17714 #
17715 # Expected arguments
17716 # $grid - The Gtk3::Grid for this tab
17717 #
17718 # Return values
17719 # 'undef' on improper arguments
17720 # 1 otherwise
17721  
17722 my ($self, $grid, $check) = @_;
17723  
17724 # Local variables
17725 my (@comboList, @widgetList);
17726  
17727 # Check for improper arguments
17728 if (! defined $grid || defined $check) {
17729  
17730 return $axmud::CLIENT->writeImproper($self->_objClass . '->searchTab', @_);
17731 }
17732  
17733 # # Tab setup (already created by the calling function)
17734 # my $grid = $self->addTab('_Search', $self->notebook);
17735  
17736 # Top section
17737 $self->addLabel($grid, '<b>Search options</b>',
17738 0, 12, 0, 1);
17739 $self->addLabel($grid, '<i>Specify which parts of the world model to search</i>',
17740 1, 12, 1, 2);
17741  
17742 my ($radioGroup, $radioButton, $radioButton2, $radioButton3);
17743  
17744 ($radioGroup, $radioButton) = $self->addRadioButton(
17745 $grid,
17746 undef,
17747 'Search entire world model',
17748 undef, undef, TRUE,
17749 1, 12, 2, 3,
17750 );
17751 $radioButton->signal_connect('toggled' => sub {
17752  
17753 if ($radioButton->get_active()) {
17754  
17755 $self->ivPoke('searchAllFlag', TRUE);
17756 $self->ivUndef('searchRegion');
17757 }
17758 });
17759  
17760 ($radioGroup, $radioButton2) = $self->addRadioButton(
17761 $grid,
17762 $radioGroup,
17763 'Search in current region',
17764 undef, undef,
17765 TRUE,
17766 1, 12, 3, 4
17767 );
17768 $radioButton2->signal_connect('toggled' => sub {
17769  
17770 $self->ivPoke('searchAllFlag', FALSE);
17771 $self->ivPoke('searchRegion', $self->session->mapWin->currentRegionmap->name);
17772 });
17773 # This widget is insensitive, if the current session doesn't have an Automapper window open,
17774 # or if the Automapper window has no current regionmap
17775 if (! $self->session->mapWin || ! $self->session->mapWin->currentRegionmap) {
17776  
17777 $radioButton2->set_state('insensitive');
17778 }
17779  
17780 ($radioGroup, $radioButton3) = $self->addRadioButton(
17781 $grid,
17782 $radioGroup,
17783 'Search in region:',
17784 undef, undef,
17785 TRUE,
17786 1, 4, 4, 5,
17787 );
17788  
17789 # Get a sorted list of regionmap names
17790 @comboList = sort {lc($a) cmp lc($b)}
17791 ($self->session->worldModelObj->ivKeys('regionmapHash'));
17792  
17793 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
17794 TRUE, # No 'undef' value used
17795 4, 8, 4, 5);
17796 $combo->signal_connect('changed' => sub {
17797  
17798 if ($radioButton3->get_active()) {
17799  
17800 $self->ivPoke('searchAllFlag', TRUE);
17801 $self->ivPoke('searchRegion', $combo->get_active_text());
17802 }
17803 });
17804  
17805 $radioButton3->signal_connect('toggled' => sub {
17806  
17807 $self->ivPoke('searchAllFlag', FALSE);
17808 $self->ivPoke('searchRegion', $combo->get_active_text());
17809 });
17810  
17811 # This radiobutton and its combobox are insensitive, if there are no regions
17812 if (! $self->session->worldModelObj->regionmapHash) {
17813  
17814 $radioButton3->set_state('insensitive');
17815 $combo->set_state('insensitive');
17816 }
17817  
17818 # Bottom section
17819 $self->addLabel($grid, '<i>Specify which categories of model object to search</i>',
17820 1, 12, 6, 7);
17821  
17822 # Add check buttons, one for each category of world model object
17823 push (
17824 @widgetList,
17825 $self->searchTab_addCheckButton($grid, 'region', 'Search regions', 1, 4, 7, 8),
17826 );
17827  
17828 push (
17829 @widgetList,
17830 $self->searchTab_addCheckButton($grid, 'room', 'Search rooms', 1, 4, 8, 9),
17831 );
17832  
17833 push (
17834 @widgetList,
17835 $self->searchTab_addCheckButton($grid, 'weapon', 'Search weapons', 1, 4, 10, 11),
17836 );
17837  
17838 push (
17839 @widgetList,
17840 $self->searchTab_addCheckButton($grid, 'armour', 'Search armour', 1, 4, 11, 12),
17841 );
17842  
17843 push (
17844 @widgetList,
17845 $self->searchTab_addCheckButton($grid, 'garment', 'Search garments', 4, 8, 7, 8),
17846 );
17847  
17848 push (
17849 @widgetList,
17850 $self->searchTab_addCheckButton($grid, 'char', 'Search characters', 4, 8, 8, 9),
17851 );
17852  
17853 push (
17854 @widgetList,
17855 $self->searchTab_addCheckButton($grid, 'minion', 'Search minions', 4, 8, 10, 11),
17856 );
17857  
17858 push (
17859 @widgetList,
17860 $self->searchTab_addCheckButton($grid, 'sentient', 'Search sentients', 4, 8, 11, 12),
17861 );
17862  
17863 push (
17864 @widgetList,
17865 $self->searchTab_addCheckButton($grid, 'creature', 'Search creatures', 8, 12, 7, 8),
17866 );
17867  
17868 push (
17869 @widgetList,
17870 $self->searchTab_addCheckButton($grid, 'portable', 'Search portables', 8, 12, 8, 9),
17871 );
17872  
17873 push (
17874 @widgetList,
17875 $self->searchTab_addCheckButton(
17876 $grid,
17877 'decoration',
17878 'Search decorations',
17879 8, 12, 10, 11,
17880 ),
17881 );
17882  
17883 push (
17884 @widgetList,
17885 $self->searchTab_addCheckButton(
17886 $grid,
17887 'custom',
17888 'Search custom objects',
17889 8, 12, 11, 12,
17890 ),
17891 );
17892  
17893 my $checkButton = $self->addCheckButton($grid, 'Select matching rooms on map', undef, TRUE,
17894 2, 12, 9, 10,);
17895 $checkButton->set_active($self->session->worldModelObj->searchSelectRoomsFlag);
17896 $checkButton->signal_connect('toggled' => sub {
17897  
17898 if ($checkButton->get_active()) {
17899 $self->session->worldModelObj->set_searchSelectRoomsFlag(TRUE);
17900 } else {
17901 $self->session->worldModelObj->set_searchSelectRoomsFlag(FALSE);
17902 }
17903 });
17904  
17905 # Add buttons
17906 my $button = $self->addButton(
17907 $grid,
17908 'Select all',
17909 'Select all the categories of model object',
17910 undef,
17911 1, 4, 12, 13,
17912 );
17913  
17914 $button->signal_connect('clicked' => sub {
17915  
17916 foreach my $widget (@widgetList) {
17917  
17918 $widget->set_active(TRUE);
17919 }
17920  
17921 $self->ivPoke('categoryHash',
17922 'region', undef,
17923 'room', undef,
17924 'weapon', undef,
17925 'armour', undef,
17926 'garment', undef,
17927 'character', undef,
17928 'minion', undef,
17929 'sentient', undef,
17930 'creature', undef,
17931 'portable', undef,
17932 'decoration', undef,
17933 'custom', undef,
17934 );
17935 });
17936  
17937 my $button2 = $self->addButton(
17938 $grid,
17939 'Unselect all',
17940 'Unselect all the categories of model object',
17941 undef,
17942 4, 8, 12, 13,
17943 );
17944 $button2->signal_connect('clicked' => sub {
17945  
17946 foreach my $widget (@widgetList) {
17947  
17948 $widget->set_active(FALSE);
17949 }
17950  
17951 $self->ivEmpty('categoryHash');
17952 });
17953  
17954 # Tab complete
17955 return 1;
17956 }
17957  
17958 sub searchTab_addCheckButton {
17959  
17960 # Called by $self->searchTab
17961 # Creates a single Gtk3::CheckButton at the specified grid position
17962 #
17963 # Expected arguments
17964 # $grid - The Gtk3::Grid for this tab
17965 # $category - The category of model object, e.g. 'room', 'weapon' etc
17966 # $label - The text of the accompanying label
17967 # $leftAttach, $rightAttach, $topAttach, $bottomAttach
17968 # - The position of the checkbutton in the grid
17969 #
17970 # Return values
17971 # 'undef' on improper arguments
17972 # Otherwise, returns the Gtk3::CheckButton created
17973  
17974 my (
17975 $self, $grid, $category, $label, $leftAttach, $rightAttach, $topAttach, $bottomAttach,
17976 $check,
17977 ) = @_;
17978  
17979 # Check for improper arguments
17980 if (
17981 ! defined $grid || ! defined $category || ! defined $label || ! defined $leftAttach
17982 || ! defined $rightAttach || ! defined $topAttach || ! defined $bottomAttach
17983 ) {
17984 return $axmud::CLIENT->writeImproper(
17985 $self->_objClass . '->searchTab_addCheckButton',
17986 @_,
17987 );
17988 }
17989  
17990 # Add the checkbutton
17991 my $checkButton = $self->addCheckButton(
17992 $grid,
17993 $label,
17994 undef,
17995 TRUE,
17996 $leftAttach, $rightAttach, $topAttach, $bottomAttach,
17997 );
17998  
17999 # All the checkbuttons start selected
18000 $checkButton->set_active(TRUE);
18001  
18002 # Signal connect
18003 $checkButton->signal_connect('toggled' => sub {
18004  
18005 if ($checkButton->get_active()) {
18006 $self->ivAdd('categoryHash', $category, undef);
18007 } else {
18008 $self->ivDelete('categoryHash', $category);
18009 }
18010 });
18011  
18012 return $checkButton;
18013 }
18014  
18015 sub propertiesTab {
18016  
18017 # Properties tab
18018 #
18019 # Expected arguments
18020 # (none besides $self)
18021 #
18022 # Return values
18023 # 'undef' on improper arguments
18024 # 1 otherwise
18025  
18026 my ($self, $check) = @_;
18027  
18028 # Check for improper arguments
18029 if (defined $check) {
18030  
18031 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesTab', @_);
18032 }
18033  
18034 # Tab setup
18035 # Create a notebook within the main one, so that we have two rows of tabs
18036 my $innerNotebook = $self->addInnerNotebookTab('S_hared properties', $self->notebook);
18037  
18038 # Add tabs to the inner notebook
18039 $self->propertiesGroup1Tab($innerNotebook);
18040 $self->propertiesGroup2Tab($innerNotebook);
18041 $self->propertiesGroup3Tab($innerNotebook);
18042 $self->propertiesGroup4Tab($innerNotebook);
18043  
18044 return 1;
18045 }
18046  
18047 sub properties2Tab {
18048  
18049 # Properties2 tab
18050 #
18051 # Expected arguments
18052 # (none besides $self)
18053 #
18054 # Return values
18055 # 'undef' on improper arguments
18056 # 1 otherwise
18057  
18058 my ($self, $check) = @_;
18059  
18060 # Check for improper arguments
18061 if (defined $check) {
18062  
18063 return $axmud::CLIENT->writeImproper($self->_objClass . '->properties2Tab', @_);
18064 }
18065  
18066 # Tab setup
18067 # Create a notebook within the main one, so that we have two rows of tabs
18068 my $innerNotebook = $self->addInnerNotebookTab('_Regions/Rooms', $self->notebook);
18069  
18070 # Add tabs to the inner notebook
18071 $self->propertiesRegionsTab($innerNotebook);
18072 $self->propertiesRooms1Tab($innerNotebook);
18073 $self->propertiesRooms2Tab($innerNotebook);
18074  
18075 return 1;
18076 }
18077  
18078 sub properties3Tab {
18079  
18080 # Properties3 tab
18081 #
18082 # Expected arguments
18083 # (none besides $self)
18084 #
18085 # Return values
18086 # 'undef' on improper arguments
18087 # 1 otherwise
18088  
18089 my ($self, $check) = @_;
18090  
18091 # Check for improper arguments
18092 if (defined $check) {
18093  
18094 return $axmud::CLIENT->writeImproper($self->_objClass . '->properties3Tab', @_);
18095 }
18096  
18097 # Tab setup
18098 # Create a notebook within the main one, so that we have two rows of tabs
18099 my $innerNotebook = $self->addInnerNotebookTab('_Beings', $self->notebook);
18100  
18101 # Add tabs to the inner notebook
18102 $self->propertiesCharactersTab($innerNotebook);
18103 $self->propertiesMinionsTab($innerNotebook);
18104 $self->propertiesSentients1Tab($innerNotebook);
18105 $self->propertiesSentients2Tab($innerNotebook);
18106 $self->propertiesCreatures1Tab($innerNotebook);
18107 $self->propertiesCreatures2Tab($innerNotebook);
18108  
18109 return 1;
18110 }
18111  
18112 sub properties4Tab {
18113  
18114 # Properties4 tab
18115 #
18116 # Expected arguments
18117 # (none besides $self)
18118 #
18119 # Return values
18120 # 'undef' on improper arguments
18121 # 1 otherwise
18122  
18123 my ($self, $check) = @_;
18124  
18125 # Local variables
18126 my (@portList, @decList);
18127  
18128 # Check for improper arguments
18129 if (defined $check) {
18130  
18131 return $axmud::CLIENT->writeImproper($self->_objClass . '->properties4Tab', @_);
18132 }
18133  
18134 # Tab setup
18135 my $grid = $self->addTab('_Portables/Decorations', $self->notebook);
18136  
18137 # Group 5 properties
18138 $self->addLabel($grid, '<b>Group 5 properties</b>',
18139 0, 12, 0, 1);
18140 $self->addLabel($grid, '<i>Properties which only apply to portables/decorations</i>',
18141 1, 12, 1, 2);
18142  
18143 @portList = $self->session->currentDict->portableTypeList;
18144 @decList = $self->session->currentDict->decorationTypeList;
18145  
18146 $self->propertiesTab_addComboBox($grid, 'type', 'special',
18147 'Portable object type is', \@portList, 2);
18148 $self->propertiesTab_addComboBox($grid, '_type', 'special',
18149 'Decoration object type is', \@decList, 3);
18150  
18151 # Tab complete
18152 return 1;
18153 }
18154  
18155 sub propertiesGroup1Tab {
18156  
18157 # PropertiesGroup1 tab
18158 #
18159 # Expected arguments
18160 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18161 #
18162 # Return values
18163 # 'undef' on improper arguments
18164 # 1 otherwise
18165  
18166 my ($self, $innerNotebook, $check) = @_;
18167  
18168 # Check for improper arguments
18169 if (! defined $innerNotebook || defined $check) {
18170  
18171 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup1Tab', @_);
18172 }
18173  
18174 # Tab setup
18175 my $grid = $self->addTab('Group _1', $innerNotebook);
18176  
18177 # Group 1 properties
18178 $self->addLabel($grid, '<b>Group 1 properties</b>',
18179 0, 12, 0, 1);
18180 $self->addLabel($grid, '<i>Applies to all categories of world model object</i>',
18181 1, 12, 1, 2);
18182  
18183 $self->propertiesTab_addEntryWithIcon($grid, 'name', 'match',
18184 'Name matches (pattern)', 'regex', 1, undef, 2);
18185 $self->propertiesTab_addEntryWithIcon($grid, 'privateHash', 'key',
18186 'Has private property', 'string', 1, undef, 3);
18187 $self->propertiesTab_addEntryWithIcon($grid, 'sourceCodePath', 'match',
18188 'Source code path matches (pattern)', 'regex', 1, undef, 4);
18189 $self->propertiesTab_addEntryWithIcon($grid, 'notesList', 'list_match',
18190 'Line in notes matches (pattern)', 'string', 1, undef, 5);
18191  
18192 # Tab complete
18193 return 1;
18194 }
18195  
18196 sub propertiesGroup2Tab {
18197  
18198 # PropertiesGroup2 tab
18199 #
18200 # Expected arguments
18201 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18202 #
18203 # Return values
18204 # 'undef' on improper arguments
18205 # 1 otherwise
18206  
18207 my ($self, $innerNotebook, $check) = @_;
18208  
18209 # Check for improper arguments
18210 if (! defined $innerNotebook || defined $check) {
18211  
18212 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup2Tab', @_);
18213 }
18214  
18215 # Tab setup
18216 my $grid = $self->addTab('Group _2', $innerNotebook);
18217  
18218 # Group 2 properties
18219 $self->addLabel($grid, '<b>Group 2 properties</b>',
18220 0, 12, 0, 1);
18221 $self->addLabel(
18222 $grid,
18223 '<i>Applies to all categories of world model object except regions and rooms</i>',
18224 1, 12, 1, 2,
18225 );
18226  
18227 $self->propertiesTab_addEntryWithIcon($grid, 'noun', 'match',
18228 'Main noun matches (pattern)', 'regex', 1, undef, 2);
18229 $self->propertiesTab_addEntryWithIcon($grid, 'otherNounList', 'include',
18230 'Other noun list includes', 'string', 1, undef, 3);
18231 $self->propertiesTab_addEntryWithIcon($grid, 'adjList', 'include',
18232 'Adjective list includes', 'string', 1, undef, 4);
18233 $self->propertiesTab_addEntryWithIcon($grid, 'pseudoAdjList', 'include',
18234 'Pseudo-adjective list includes', 'string', 1, undef, 5);
18235 $self->propertiesTab_addEntryWithIcon($grid, 'rootAdjList', 'include',
18236 'Root adjective list includes', 'string', 1, undef, 6);
18237 $self->propertiesTab_addEntryWithIcon($grid, 'unknownWordList', 'include',
18238 'Unknown word list includes', 'string', 1, undef, 7);
18239 $self->propertiesTab_addEntryWithIcon($grid, 'baseString', 'match',
18240 'Base string matches (pattern)', 'regex', 1, undef, 8);
18241 $self->propertiesTab_addEntryWithIcon($grid, 'descrip', 'match',
18242 'Description matches (pattern)', 'regex', 1, undef, 9);
18243  
18244 # Tab complete
18245 return 1;
18246 }
18247  
18248 sub propertiesGroup3Tab {
18249  
18250 # PropertiesGroup3 tab
18251 #
18252 # Expected arguments
18253 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18254 #
18255 # Return values
18256 # 'undef' on improper arguments
18257 # 1 otherwise
18258  
18259 my ($self, $innerNotebook, $check) = @_;
18260  
18261 # Check for improper arguments
18262 if (! defined $innerNotebook || defined $check) {
18263  
18264 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup3Tab', @_);
18265 }
18266  
18267 # Tab setup
18268 my $grid = $self->addTab('Group _3', $innerNotebook);
18269  
18270 # Group 3 properties
18271 $self->addLabel($grid, '<b>Group 3 properties</b>',
18272 0, 12, 0, 1);
18273 $self->addLabel(
18274 $grid,
18275 '<i>Applies to characters, minions, sentients, creatures and custom objects</i>',
18276 1, 12, 1, 2,
18277 );
18278  
18279 $self->propertiesTab_addCheckButton($grid, 'explicitFlag', 'flag',
18280 'Explicit in room description?', 2);
18281 $self->propertiesTab_addCheckButton($grid, 'alreadyAttackedFlag', 'flag',
18282 'Already attacked?', 3);
18283  
18284 # Tab complete
18285 return 1;
18286 }
18287  
18288 sub propertiesGroup4Tab {
18289  
18290 # PropertiesGroup4 tab
18291 #
18292 # Expected arguments
18293 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18294 #
18295 # Return values
18296 # 'undef' on improper arguments
18297 # 1 otherwise
18298  
18299 my ($self, $innerNotebook, $check) = @_;
18300  
18301 # Check for improper arguments
18302 if (! defined $innerNotebook || defined $check) {
18303  
18304 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup4Tab', @_);
18305 }
18306  
18307 # Tab setup
18308 my $grid = $self->addTab('Group _4', $innerNotebook);
18309  
18310 # Group 4 properties
18311 $self->addLabel($grid, '<b>Group 4 properties</b>',
18312 0, 12, 0, 1);
18313 $self->addLabel(
18314 $grid,
18315 '<i>Applies to weapons, armour, garments, portables, decorations and custom'
18316 . ' objects</i>',
18317 1, 12, 1, 2,
18318 );
18319  
18320 $self->propertiesTab_addCheckButton($grid, 'explicitFlag', 'flag',
18321 'Explicit in room description?', 2);
18322 $self->propertiesTab_addEntryWithRange($grid, 'weight', 'range',
18323 'Object\'s weight', 'float', 0, undef, 3);
18324 $self->propertiesTab_addEntryWithRange($grid, 'bonusHash', 'range',
18325 'Stat bonuses', 'int', undef, undef, 4);
18326 $self->propertiesTab_addEntryWithRange($grid, 'condition', 'range',
18327 'Condition (0-100)', 'int', 0, undef, 5);
18328 $self->propertiesTab_addCheckButton($grid, 'fixableFlag', 'flag',
18329 'Fixable/repairable?', 6);
18330 $self->propertiesTab_addCheckButton($grid, 'sellableFlag', 'flag',
18331 'Sellable?', 7);
18332 $self->propertiesTab_addEntryWithRange($grid, 'buyValue', 'range',
18333 'Value when bought', 'float', 0, undef, 8);
18334 $self->propertiesTab_addEntryWithRange($grid, 'sellValue', 'range',
18335 'Value when sold', 'float', 0, undef, 9);
18336 $self->propertiesTab_addEntryWithIcon($grid, 'exclusiveHash', 'key',
18337 'Exclusive hash includes profile', 'string', 1, undef, 10);
18338  
18339 # Tab complete
18340 return 1;
18341 }
18342  
18343 sub propertiesRegionsTab {
18344  
18345 # PropertiesRegions tab
18346 #
18347 # Expected arguments
18348 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18349 #
18350 # Return values
18351 # 'undef' on improper arguments
18352 # 1 otherwise
18353  
18354 my ($self, $innerNotebook, $check) = @_;
18355  
18356 # Check for improper arguments
18357 if (! defined $innerNotebook || defined $check) {
18358  
18359 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRegionsTab', @_);
18360 }
18361  
18362 # Tab setup
18363 my $grid = $self->addTab('Re_gions', $innerNotebook);
18364  
18365 # Group 5 properties
18366 $self->addLabel($grid, '<b>Group 5 properties</b>',
18367 0, 12, 0, 1);
18368 $self->addLabel($grid, '<i>Properties which apply only to regions</i>',
18369 1, 12, 1, 2);
18370  
18371 $self->propertiesTab_addCheckButton($grid, 'tempRegionFlag', 'flag',
18372 'Region is temporary?', 2);
18373  
18374 # Tab complete
18375 return 1;
18376 }
18377  
18378 sub propertiesRooms1Tab {
18379  
18380 # PropertiesRooms1 tab
18381 #
18382 # Expected arguments
18383 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18384 #
18385 # Return values
18386 # 'undef' on improper arguments
18387 # 1 otherwise
18388  
18389 my ($self, $innerNotebook, $check) = @_;
18390  
18391 # Check for improper arguments
18392 if (! defined $innerNotebook || defined $check) {
18393  
18394 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRooms1Tab', @_);
18395 }
18396  
18397 # Tab setup
18398 my $grid = $self->addTab('_Rooms 1', $innerNotebook);
18399  
18400 # Group 5 properties
18401 $self->addLabel($grid, '<b>Group 5 properties</b>',
18402 0, 12, 0, 1);
18403 $self->addLabel($grid, '<i>Properties which apply only to rooms (page 1/2)</i>',
18404 1, 12, 1, 2);
18405  
18406 $self->propertiesTab_addEntryWithIcon($grid, 'descripHash', 'value_match',
18407 'Verbose descrips match (pattern)', 'regex', 1, undef, 2);
18408 $self->propertiesTab_addEntryWithIcon($grid, 'titleList', 'list_match',
18409 'Room titles match (pattern)', 'regex', 1, undef, 3);
18410 $self->propertiesTab_addEntryWithIcon($grid, 'sortedExitList', 'include',
18411 'Exits include', 'string', 1, undef, 4);
18412 $self->propertiesTab_addEntryWithIcon($grid, 'visitHash', 'key',
18413 'Visitors include', 'string', 1, undef, 5);
18414 $self->propertiesTab_addEntryWithIcon($grid, '_visitHash', 'not_key',
18415 'Visitors don\'t include', 'string', 1, undef, 6);
18416 $self->propertiesTab_addEntryWithIcon($grid, 'exclusiveHash', 'key',
18417 'Exclusive hash includes profile', 'string', 1, undef, 7);
18418 $self->propertiesTab_addEntryWithIcon($grid, 'roomFlagHash', 'key',
18419 'Room flags include', 'string', 1, undef, 8);
18420 $self->propertiesTab_addEntryWithIcon($grid, 'roomGuild', 'match',
18421 'Room guild matches (pattern)', 'regex', 1, undef, 9);
18422  
18423 # Tab complete
18424 return 1;
18425 }
18426  
18427 sub propertiesRooms2Tab {
18428  
18429 # PropertiesRooms2 tab
18430 #
18431 # Expected arguments
18432 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18433 #
18434 # Return values
18435 # 'undef' on improper arguments
18436 # 1 otherwise
18437  
18438 my ($self, $innerNotebook, $check) = @_;
18439  
18440 # Check for improper arguments
18441 if (! defined $innerNotebook || defined $check) {
18442  
18443 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRooms2Tab', @_);
18444 }
18445  
18446 # Tab setup
18447 my $grid = $self->addTab('Rooms 2', $innerNotebook);
18448  
18449 # Group 5 properties
18450 $self->addLabel($grid, '<b>Group 5 properties</b>',
18451 0, 12, 0, 1);
18452 $self->addLabel($grid, '<i>Properties which apply only to rooms (page 2/2)</i>',
18453 1, 12, 1, 2);
18454  
18455 $self->propertiesTab_addCheckButton($grid, 'hiddenObjHash', 'used_hash',
18456 'Contains hidden objects?', 2);
18457 $self->propertiesTab_addEntryWithIcon($grid, '_hiddenObjHash', 'special',
18458 'Hidden object name matches (pattern)', 'regex', 1, undef, 3);
18459 $self->propertiesTab_addEntryWithIcon($grid, 'searchHash', 'key',
18460 'Search strings include', 'string', 1, undef, 4);
18461 $self->propertiesTab_addEntryWithIcon($grid, '_searchHash', 'value_match',
18462 'Search responses match (pattern)', 'regex', 1, undef, 5);
18463 $self->propertiesTab_addEntryWithIcon($grid, 'nounList', 'include',
18464 'Noun list includes', 'string', 1, undef, 6);
18465 $self->propertiesTab_addEntryWithIcon($grid, 'adjList', 'include',
18466 'Adjective list includes', 'string', 1, undef, 7);
18467 $self->propertiesTab_addEntryWithIcon($grid, 'arriveScriptList', 'include',
18468 'Arrival scripts to run include', 'string', 1, undef, 8);
18469  
18470 # Tab complete
18471 return 1;
18472 }
18473  
18474 sub propertiesCharactersTab {
18475  
18476 # PropertiesCharacters tab
18477 #
18478 # Expected arguments
18479 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18480 #
18481 # Return values
18482 # 'undef' on improper arguments
18483 # 1 otherwise
18484  
18485 my ($self, $innerNotebook, $check) = @_;
18486  
18487 # Local variables
18488 my @list;
18489  
18490 # Check for improper arguments
18491 if (! defined $innerNotebook || defined $check) {
18492  
18493 return $axmud::CLIENT->writeImproper(
18494 $self->_objClass . '->propertiesCharactersTab',
18495 @_,
18496 );
18497 }
18498  
18499 # Tab setup
18500 my $grid = $self->addTab('_Characters', $innerNotebook);
18501  
18502 # Group 5 properties
18503 $self->addLabel($grid, '<b>Group 5 properties</b>',
18504 0, 12, 0, 1);
18505 $self->addLabel($grid, '<i>Properties which apply only to characters</i>',
18506 1, 12, 1, 2);
18507  
18508 $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match',
18509 'Guild matches (pattern)', 'regex', 1, undef, 2);
18510 $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match',
18511 'Race matches (pattern)', 'regex', 1, undef, 3);
18512 $self->propertiesTab_addCheckButton($grid, 'ownCharFlag', 'flag',
18513 'Belongs to you?', 4);
18514 $self->propertiesTab_addEntryWithIcon($grid, 'owner', 'match',
18515 'Owner\'s name matches (pattern)', 'regex', 1, undef, 5);
18516 @list = ('mortal', 'wiz', 'test');
18517 $self->propertiesTab_addComboBox($grid, 'mortalStatus', 'string_equal',
18518 'Mortal status is', \@list, 6);
18519 @list = ('friendly', 'neutral', 'hostile');
18520 $self->propertiesTab_addComboBox($grid, 'diplomaticStatus', 'string_equal',
18521 'Diplomatic status is', \@list, 7);
18522 $self->propertiesTab_addCheckButton($grid, 'grudgeFlag', 'flag',
18523 'Ever attacked you?', 8);
18524 $self->propertiesTab_addEntryWithRange($grid, 'level', 'range',
18525 'Level', 'int', 0, undef, 9);
18526 $self->propertiesTab_addEntryWithIcon($grid, 'questList', 'key',
18527 'Quest list includes', 'string', 1, undef, 10);
18528  
18529 # Tab complete
18530 return 1;
18531 }
18532  
18533 sub propertiesMinionsTab {
18534  
18535 # PropertiesMinions tab
18536 #
18537 # Expected arguments
18538 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18539 #
18540 # Return values
18541 # 'undef' on improper arguments
18542 # 1 otherwise
18543  
18544 my ($self, $innerNotebook, $check) = @_;
18545  
18546 # Check for improper arguments
18547 if (! defined $innerNotebook || defined $check) {
18548  
18549 return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesMinionsTab', @_);
18550 }
18551  
18552 # Tab setup
18553 my $grid = $self->addTab('_Minions', $innerNotebook);
18554  
18555 # Group 5 properties
18556 $self->addLabel($grid, '<b>Group 5 properties</b>',
18557 0, 12, 0, 1);
18558 $self->addLabel($grid, '<i>Properties which apply only to minions</i>',
18559 1, 12, 1, 2);
18560  
18561 $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match',
18562 'Guild matches (pattern)', 'regex', 1, undef, 2);
18563 $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match',
18564 'Race matches (pattern)', 'regex', 1, undef, 3);
18565 $self->propertiesTab_addCheckButton($grid, 'ownMinionFlag', 'flag',
18566 'Belongs to you?', 4);
18567 $self->propertiesTab_addEntryWithRange($grid, 'level', 'range',
18568 'Level', 'int', 0, undef, 5);
18569 $self->propertiesTab_addEntryWithRange($grid, 'value', 'range',
18570 'Cost of acquiring', 'int', 0, undef, 6);
18571  
18572 # Tab complete
18573 return 1;
18574 }
18575  
18576 sub propertiesSentients1Tab {
18577  
18578 # PropertiesSentients1 tab
18579 #
18580 # Expected arguments
18581 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18582 #
18583 # Return values
18584 # 'undef' on improper arguments
18585 # 1 otherwise
18586  
18587 my ($self, $innerNotebook, $check) = @_;
18588  
18589 # Local variables
18590 my @list;
18591  
18592 # Check for improper arguments
18593 if (! defined $innerNotebook || defined $check) {
18594  
18595 return $axmud::CLIENT->writeImproper(
18596 $self->_objClass . '->propertiesSentients1Tab',
18597 @_,
18598 );
18599 }
18600  
18601 # Tab setup
18602 my $grid = $self->addTab('_Sentients 1', $innerNotebook);
18603  
18604 # Group 5 properties
18605 $self->addLabel($grid, '<b>Group 5 properties</b>',
18606 0, 12, 0, 1);
18607 $self->addLabel($grid, '<i>Properties which apply only to sentients (page 1/2)</i>',
18608 1, 12, 1, 2);
18609  
18610 $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match',
18611 'Guild matches (pattern)', 'regex', 1, undef, 2);
18612 $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match',
18613 'Race matches (pattern)', 'regex', 1, undef, 3);
18614 $self->propertiesTab_addCheckButton($grid, 'talkativeFlag', 'flag',
18615 'Talkative?', 4);
18616 $self->propertiesTab_addEntryWithIcon($grid, 'talkList', 'list_match',
18617 'Talk list includes match (pattern)', 'regex', 1, undef, 5);
18618 $self->propertiesTab_addCheckButton($grid, 'actionFlag', 'flag',
18619 'Seen performing actions?', 6);
18620 $self->propertiesTab_addEntryWithIcon($grid, 'actionList', 'list_match',
18621 'Action list includes match (pattern)', 'regex', 1, undef, 7);
18622 $self->propertiesTab_addCheckButton($grid, 'unfriendlyFlag', 'flag',
18623 'Ever initiated combat?', 8);
18624 @list = ('good', 'evil', 'neutral');
18625 $self->propertiesTab_addComboBox($grid, 'morality', 'string_equal',
18626 'Morality is', \@list, 9);
18627  
18628 # Tab complete
18629 return 1;
18630 }
18631  
18632 sub propertiesSentients2Tab {
18633  
18634 # PropertiesSentients2 tab
18635 #
18636 # Expected arguments
18637 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18638 #
18639 # Return values
18640 # 'undef' on improper arguments
18641 # 1 otherwise
18642  
18643 my ($self, $innerNotebook, $check) = @_;
18644  
18645 # Check for improper arguments
18646 if (! defined $innerNotebook || defined $check) {
18647  
18648 return $axmud::CLIENT->writeImproper(
18649 $self->_objClass . '->propertiesSentients2Tab',
18650 @_,
18651 );
18652 }
18653  
18654 # Tab setup
18655 my $grid = $self->addTab('_Sentients 2', $innerNotebook);
18656  
18657 # Group 5 properties
18658 $self->addLabel($grid, '<b>Group 5 properties</b>',
18659 0, 12, 0, 1);
18660 $self->addLabel($grid, '<i>Properties which apply only to sentients (page 2/2)</i>',
18661 1, 12, 1, 2);
18662  
18663 $self->propertiesTab_addCheckButton($grid, 'wanderFlag', 'flag',
18664 'Tends to wander off (of own volition)?', 2);
18665 $self->propertiesTab_addCheckButton($grid, 'fleeFlag', 'flag',
18666 'Has ever fleed combat?', 3);
18667 $self->propertiesTab_addCheckButton($grid, 'quickFleeFlag', 'flag',
18668 'Tends to flee combat quickly?', 4);
18669 $self->propertiesTab_addCheckButton($grid, 'noAttackFlag', 'flag',
18670 'Should NEVER be attacked?', 5);
18671 $self->propertiesTab_addCheckButton($grid, 'mercyFlag', 'flag',
18672 'Mercies, rather than kills, opponents?', 6);
18673 $self->propertiesTab_addEntryWithIcon($grid, 'questName', 'match',
18674 'Associated with quest matching (pattern)', 'regex', 1, undef, 7);
18675 $self->propertiesTab_addEntryWithRange($grid, 'level', 'range',
18676 'Level', 'int', 0, undef, 8);
18677 $self->propertiesTab_addEntryWithRange($grid, 'cashList', 'range',
18678 'Average cash', 'float', 0, undef, 9);
18679  
18680 # Tab complete
18681 return 1;
18682 }
18683  
18684 sub propertiesCreatures1Tab {
18685  
18686 # PropertiesCreatures1 tab
18687 #
18688 # Expected arguments
18689 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18690 #
18691 # Return values
18692 # 'undef' on improper arguments
18693 # 1 otherwise
18694  
18695 my ($self, $innerNotebook, $check) = @_;
18696  
18697 # Local variables
18698 my @list;
18699  
18700 # Check for improper arguments
18701 if (! defined $innerNotebook || defined $check) {
18702  
18703 return $axmud::CLIENT->writeImproper(
18704 $self->_objClass . '->propertiesCreatures1Tab',
18705 @_,
18706 );
18707 }
18708  
18709 # Tab setup
18710 my $grid = $self->addTab('_Creatures 1', $innerNotebook);
18711  
18712 # Group 5 properties
18713 $self->addLabel($grid, '<b>Group 5 properties</b>',
18714 0, 12, 0, 1);
18715 $self->addLabel($grid, '<i>Properties which apply only to creatures (page 1/2)</i>',
18716 1, 12, 1, 2);
18717  
18718 $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match',
18719 'Guild matches (pattern)', 'regex', 1, undef, 2);
18720 $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match',
18721 'Race matches (pattern)', 'regex', 1, undef, 3);
18722 $self->propertiesTab_addCheckButton($grid, 'actionFlag', 'flag',
18723 'Seen performing actions?', 4);
18724 $self->propertiesTab_addEntryWithIcon($grid, 'actionList', 'list_match',
18725 'Action list includes match (pattern)', 'regex', 1, undef, 5);
18726 $self->propertiesTab_addCheckButton($grid, 'unfriendlyFlag', 'flag',
18727 'Ever initiated combat?', 6);
18728 @list = ('good', 'evil', 'neutral');
18729 $self->propertiesTab_addComboBox($grid, 'morality', 'string_equal',
18730 'Morality is', \@list, 7);
18731  
18732 # Tab complete
18733 return 1;
18734 }
18735  
18736 sub propertiesCreatures2Tab {
18737  
18738 # PropertiesCreatures2 tab
18739 #
18740 # Expected arguments
18741 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
18742 #
18743 # Return values
18744 # 'undef' on improper arguments
18745 # 1 otherwise
18746  
18747 my ($self, $innerNotebook, $check) = @_;
18748  
18749 # Check for improper arguments
18750 if (! defined $innerNotebook || defined $check) {
18751  
18752 return $axmud::CLIENT->writeImproper(
18753 $self->_objClass . '->propertiesCreatures2Tab',
18754 @_,
18755 );
18756 }
18757  
18758 # Tab setup
18759 my $grid = $self->addTab('_Creatures 2', $innerNotebook);
18760  
18761 # Group 5 properties
18762 $self->addLabel($grid, '<b>Group 5 properties</b>',
18763 0, 12, 0, 1);
18764 $self->addLabel($grid, '<i>Properties which apply only to creatures (page 2/2)</i>',
18765 1, 12, 1, 2);
18766  
18767 $self->propertiesTab_addCheckButton($grid, 'wanderFlag', 'flag',
18768 'Tends to wander off (of own volition)?', 2);
18769 $self->propertiesTab_addCheckButton($grid, 'fleeFlag', 'flag',
18770 'Has ever fleed combat?', 3);
18771 $self->propertiesTab_addCheckButton($grid, 'quickFleeFlag', 'flag',
18772 'Tends to flee combat quickly?', 4);
18773 $self->propertiesTab_addCheckButton($grid, 'noAttackFlag', 'flag',
18774 'Should NEVER be attacked?', 5);
18775 $self->propertiesTab_addCheckButton($grid, 'mercyFlag', 'flag',
18776 'Mercies, rather than kills, opponents?', 6);
18777 $self->propertiesTab_addEntryWithIcon($grid, 'questName', 'match',
18778 'Associated with quest matching (pattern)', 'regex', 1, undef, 7);
18779 $self->propertiesTab_addEntryWithRange($grid, 'level', 'range',
18780 'Level', 'int', 0, undef, 8);
18781 $self->propertiesTab_addEntryWithRange($grid, 'cashList', 'range',
18782 'Average cash', 'float', 0, undef, 9);
18783  
18784 # Tab complete
18785 return 1;
18786 }
18787  
18788 sub propertiesTab_addCheckButton {
18789  
18790 # Called by several $self->propertiesXXX tabs
18791 # Adds a single line to the tab with a main checkbutton, a label and a second checkbutton
18792 # to specify the state of the flag
18793 #
18794 # Expected arguments
18795 # $grid - The Gtk3::Grid for this tab
18796 # $iv - The IV to add to the search - matches a key in $self->searchHash
18797 # $ivType - What kind of checking should be done on this IV (see the comments in
18798 # ->new)
18799 # $label - The accompanying label text
18800 # $topAttach - The position of the line in the grid
18801 #
18802 # Return values
18803 # 'undef' on improper arguments
18804 # 1 otherwise
18805  
18806 my ($self, $grid, $iv, $ivType, $label, $topAttach, $check) = @_;
18807  
18808 # Check for improper arguments
18809 if (
18810 ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label
18811 || ! defined $topAttach || defined $check
18812 ) {
18813 return $axmud::CLIENT->writeImproper(
18814 $self->_objClass . '->propertiesTab_addCheckButton',
18815 @_,
18816 );
18817 }
18818  
18819 # Add a checkbutton which turns on/off checking this IV completely
18820 my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE,
18821 1, 6, $topAttach, ($topAttach + 1));
18822  
18823 # Add a second checkbutton to specify the state of the flag
18824 my $checkButton2 = $self->addCheckButton(
18825 $grid, 'Select or deselect this setting', undef, TRUE,
18826 6, 12, $topAttach, ($topAttach + 1));
18827  
18828 # Signal connects
18829 $checkButton->signal_connect('toggled' => sub {
18830  
18831 if ($checkButton->get_active()) {
18832  
18833 if ($checkButton2->get_active()) {
18834 $self->ivAdd('searchHash', $iv, TRUE);
18835 } else {
18836 $self->ivAdd('searchHash', $iv, FALSE);
18837 }
18838  
18839 } else {
18840  
18841 $self->ivDelete('searchHash', $iv);
18842 }
18843 });
18844  
18845 $checkButton2->signal_connect('toggled' => sub {
18846  
18847 if ($checkButton->get_active()) {
18848  
18849 if ($checkButton2->get_active()) {
18850 $self->ivAdd('searchHash', $iv, TRUE);
18851 } else {
18852 $self->ivAdd('searchHash', $iv, FALSE);
18853 }
18854  
18855 } else {
18856  
18857 $self->ivDelete('searchHash', $iv);
18858 }
18859 });
18860  
18861 $self->ivAdd('searchTypeHash', $iv, $ivType);
18862  
18863 return 1;
18864 }
18865  
18866 sub propertiesTab_addComboBox {
18867  
18868 # Called by several $self->propertiesXXX tabs
18869 # Adds a single line to the tab with a main checkbutton, a label and a combobox
18870 #
18871 # Expected arguments
18872 # $grid - The Gtk3::Grid for this tab
18873 # $iv - The IV to add to the search - matches a key in $self->searchHash
18874 # $ivType - What kind of checking should be done on thiss IV (see the comments in
18875 # ->new)
18876 # $label - The accompanying label text
18877 # $listRef - Reference to a list containing the values to put in the combobox
18878 # $topAttach - The position of the line in the grid
18879 #
18880 # Return values
18881 # 'undef' on improper arguments
18882 # 1 otherwise
18883  
18884 my ($self, $grid, $iv, $ivType, $label, $listRef, $topAttach, $check) = @_;
18885  
18886 # Check for improper arguments
18887 if (
18888 ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label
18889 || ! defined $listRef || ! defined $topAttach || defined $check
18890 ) {
18891 return $axmud::CLIENT->writeImproper(
18892 $self->_objClass . '->propertiesTab_addComboBox',
18893 @_,
18894 );
18895 }
18896  
18897 # Add a checkbutton which turns on/off checking this IV completely
18898 my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE,
18899 1, 6, $topAttach, ($topAttach + 1));
18900  
18901 # Add a combobox
18902 my $combo = $self->addComboBox($grid, undef, $listRef, '',
18903 TRUE, # No 'undef' value used
18904 6, 12, $topAttach, ($topAttach + 1));
18905  
18906 # Signal connects
18907 $checkButton->signal_connect('toggled' => sub {
18908  
18909 if ($checkButton->get_active()) {
18910 $self->ivAdd('searchHash', $iv, $combo->get_active_text());
18911 } else {
18912 $self->ivDelete('searchHash', $iv);
18913 }
18914 });
18915  
18916 $combo->signal_connect('changed' => sub {
18917  
18918 if ($checkButton->get_active()) {
18919 $self->ivAdd('searchHash', $iv, $combo->get_active_text());
18920 } else {
18921 $self->ivDelete('searchHash', $iv);
18922 }
18923 });
18924  
18925 $self->ivAdd('searchTypeHash', $iv, $ivType);
18926  
18927 return 1;
18928 }
18929  
18930 sub propertiesTab_addEntryWithIcon {
18931  
18932 # Called by several $self->propertiesXXX tabs
18933 # Adds a single line to the tab with a main checkbutton, a label and an entry
18934 #
18935 # Expected arguments
18936 # $grid - The Gtk3::Grid for this tab
18937 # $iv - The IV to add to the search - matches a key in $self->searchHash
18938 # $ivType - What kind of checking should be done on this IV (see the comments in
18939 # ->new)
18940 # $label - The accompanying label text
18941 # $mode - 'int', 'float', 'string' or a reference to a function
18942 # - if 'int', an integer is expected with the specified min/max values
18943 # - if 'float', a floating point number is expected with the specified min/max
18944 # values
18945 # - if 'string', a string is expected (which might be a number) with the
18946 # specified min/max length
18947 # - if 'regex', a regex is expected with the specified min/max length
18948 # - if a function reference, a function is called which should return FALSE or
18949 # TRUE, depending on the value of the entry; the icon is set accordingly
18950 # $min, $max - The values described above (ignored when $mode is a function reference).
18951 # If $min is 'undef', there is no minimum; if $max is 'undef', there is no
18952 # maximum
18953 # $topAttach - The position of the line in the grid
18954 #
18955 # Return values
18956 # 'undef' on improper arguments
18957 # 1 otherwise
18958  
18959  
18960 my ($self, $grid, $iv, $ivType, $label, $mode, $min, $max, $topAttach, $check) = @_;
18961  
18962 # Check for improper arguments
18963 if (
18964 ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label
18965 || ! defined $mode || ! defined $topAttach || defined $check
18966 ) {
18967 return $axmud::CLIENT->writeImproper(
18968 $self->_objClass . '->propertiesTab_addEntryWithIcon',
18969 @_,
18970 );
18971 }
18972  
18973 # Add a checkbutton which turns on/off checking this IV completely
18974 my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE,
18975 1, 6, $topAttach, ($topAttach + 1));
18976  
18977 # Add the entry box
18978 my $entry = $self->addEntryWithIcon($grid, undef, $mode, $min, $max,
18979 6, 12, $topAttach, ($topAttach + 1));
18980  
18981 # Signal connects
18982 $checkButton->signal_connect('toggled' => sub {
18983  
18984 if ($checkButton->get_active() && $self->checkEntryIcon($entry)) {
18985 $self->ivAdd('searchHash', $iv, $entry->get_text());
18986 } else {
18987 $self->ivDelete('searchHash', $iv);
18988 }
18989 });
18990  
18991 $entry->signal_connect('changed' => sub {
18992  
18993 if ($checkButton->get_active()) {
18994 $self->ivAdd('searchHash', $iv, $entry->get_text());
18995 } else {
18996 $self->ivDelete('searchHash', $iv);
18997 }
18998 });
18999  
19000 $self->ivAdd('searchTypeHash', $iv, $ivType);
19001  
19002 return 1;
19003 }
19004  
19005 sub propertiesTab_addEntryWithRange {
19006  
19007 # Called by several $self->propertiesXXX tabs
19008 # Adds a single line to the tab with a main checkbutton, a label, a combobox specifiying an
19009 # operator (equals, less than, etc) and one or two entry boxes
19010 # Used with IVs that have numeric values
19011 #
19012 # Expected arguments
19013 # $grid - The Gtk3::Grid for this tab
19014 # $iv - The IV to add to the search - matches a key in $self->searchHash
19015 # $ivType - What kind of checking should be done on this IV (see the comments in
19016 # ->new)
19017 # $label - The accompanying label text
19018 # $mode - What kind of value is expected - should be 'int' or 'float'
19019 # $min, $max - The values described above (ignored when $mode is a function reference).
19020 # If $min is 'undef', there is no minimum; if $max is 'undef', there is no
19021 # maximum
19022 # $topAttach - The position of the line in the grid
19023 #
19024 # Return values
19025 # 'undef' on improper arguments
19026 # 1 otherwise
19027  
19028 my ($self, $grid, $iv, $ivType, $label, $mode, $min, $max, $topAttach, $check) = @_;
19029  
19030 # Local variables
19031 my @comboList;
19032  
19033 # Check for improper arguments
19034 if (
19035 ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label
19036 || ! defined $mode || ! defined $topAttach || defined $check
19037 ) {
19038 return $axmud::CLIENT->writeImproper(
19039 $self->_objClass . '->propertiesTab_addEntryWithRange',
19040 @_,
19041 );
19042 }
19043  
19044 # Add a checkbutton which turns on/off checking this IV completely
19045 my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE,
19046 1, 4, $topAttach, ($topAttach + 1));
19047  
19048 # Add a combo
19049 @comboList = (
19050 '==',
19051 '>',
19052 '>=',
19053 '<',
19054 '<=',
19055 'min-max',
19056 );
19057  
19058 my $combo = $self->addComboBox($grid, undef, \@comboList, '',
19059 TRUE, # No 'undef' value used
19060 4, 6, $topAttach, ($topAttach + 1));
19061  
19062 # Add two entry boxes, the second only available when the combo box is set to 'min-max',
19063 my $entry = $self->addEntryWithIcon($grid, undef, $mode, $min, $max,
19064 6, 8, $topAttach, ($topAttach + 1));
19065 $self->addLabel($grid, '(Max:)',
19066 8, 10, $topAttach, ($topAttach + 1));
19067 my $entry2 = $self->addEntryWithIcon($grid, undef, $mode, $min, $max,
19068 10, 12, $topAttach, ($topAttach + 1));
19069  
19070 # Signal connects - since it's not a trivially simple check (but the same for all the
19071 # widgets), call a special function to respond
19072 $checkButton->signal_connect('toggled' => sub {
19073  
19074 $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2);
19075 });
19076  
19077 $combo->signal_connect('changed' => sub {
19078  
19079 my $comboText = $combo->get_active_text;
19080  
19081 $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2);
19082 });
19083  
19084 $entry->signal_connect('changed' => sub {
19085  
19086 $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2);
19087 });
19088  
19089 $entry2->signal_connect('changed' => sub {
19090  
19091 $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2);
19092 });
19093  
19094 $self->ivAdd('searchTypeHash', $iv, $ivType);
19095  
19096 return 1;
19097 }
19098  
19099 sub resultsTab {
19100  
19101 # Results tab
19102 #
19103 # Expected arguments
19104 # (none besides $self)
19105 #
19106 # Return values
19107 # 'undef' on improper arguments
19108 # 1 otherwise
19109  
19110 my ($self, $check) = @_;
19111  
19112 # Local variables
19113 my (
19114 $wmObj,
19115 @columnList,
19116 );
19117  
19118 # Check for improper arguments
19119 if (defined $check) {
19120  
19121 return $axmud::CLIENT->writeImproper($self->_objClass . '->resultsTab', @_);
19122 }
19123  
19124 # Tab setup
19125 my $grid = $self->addTab('R_esults', $self->notebook);
19126  
19127 # Import the world model object
19128 $wmObj = $self->session->worldModelObj;
19129  
19130 # Search results
19131 $self->addLabel($grid, '<b>Search results</b>',
19132 0, 12, 0, 1);
19133 $self->addLabel($grid, '<i>List of matching world model objects</i>',
19134 1, 12, 1, 2);
19135  
19136 # Add a simple list
19137 @columnList = (
19138 'Model #', 'int',
19139 'Category', 'text',
19140 'Name', 'text',
19141 'Parent #', 'text', # Must be 'text', or objects without parents shown as 0
19142 'Parent category', 'text',
19143 'Parent name', 'text',
19144 );
19145  
19146 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
19147 1, 12, 2, 8);
19148  
19149 # Add some entries
19150 $self->addLabel($grid, 'Max matches:',
19151 1, 3, 8, 9);
19152 my $entry = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
19153 3, 6, 8, 9);
19154  
19155 $self->addLabel($grid, 'Max objects to search:',
19156 6, 9, 8, 9);
19157 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef,
19158 9, 12, 8, 9);
19159  
19160 $self->addLabel($grid, 'No. matches:',
19161 1, 3, 9, 10);
19162 my $entry3 = $self->addEntry($grid, undef, FALSE,
19163 3, 6, 9, 10);
19164 $self->addLabel($grid, 'Size of world model:',
19165 6, 9, 9, 10);
19166 my $entry4 = $self->addEntry($grid, undef, FALSE,
19167 9, 12, 9, 10);
19168  
19169 # Set entry box initial values
19170 $entry->set_text($wmObj->searchMaxMatches);
19171 $entry2->set_text($wmObj->searchMaxObjects);
19172 $entry4->set_text($wmObj->modelActualCount);
19173  
19174 # Add some buttons
19175 my $button = $self->addButton(
19176 $grid, 'Search model', 'Perform a world model search', undef,
19177 1, 12, 10, 11);
19178 $button->signal_connect('clicked' => sub {
19179  
19180 my ($matchMax, $objMax, $matchCount);
19181  
19182 if ($self->checkEntryIcon($entry)) {
19183  
19184 $matchMax = $entry->get_text();
19185 if ($matchMax > $wmObj->modelObjCount) {
19186  
19187 # (Use the actual number of objects in the model)
19188 $matchMax = $wmObj->modelObjCount;
19189 }
19190  
19191 } else {
19192  
19193 # (Use the actual number of objects in the model once again)
19194 $matchMax = $wmObj->modelObjCount;
19195 }
19196  
19197 if ($self->checkEntryIcon($entry2)) {
19198  
19199 $objMax = $entry2->get_text();
19200 if ($objMax > $wmObj->modelObjCount) {
19201  
19202 $objMax = $wmObj->modelObjCount;
19203 }
19204  
19205 } else {
19206  
19207 $objMax = $wmObj->modelObjCount;
19208 }
19209  
19210 # Check that there's at least on entry in ->categoryHash (if it's empty, then no objects
19211 # in the world model can match)
19212 if (! $self->categoryHash) {
19213  
19214 $self->showMsgDialogue(
19215 'Search',
19216 'error',
19217 'You have unselected all categories of model object, so your search won\'t'
19218 . ' match anything (go to the \'Search\' tab to select some categories)',
19219 'ok',
19220 );
19221  
19222 } elsif (! $wmObj->modelHash) {
19223  
19224 $self->showMsgDialogue(
19225 'Search',
19226 'error',
19227 'The world model is currently empty',
19228 'ok',
19229 );
19230  
19231 } else {
19232  
19233 # Perform the search, and display the results in the simple list
19234 # Change the label on the button so that, during long searches, the user can see
19235 # when the search starts, and when it stops
19236 $button->set_label('Searching...');
19237 $matchCount = $self->performSearch($slWidget, $matchMax, $objMax);
19238 $button->set_label('Search');
19239  
19240 # Display the number of matches in the entry box
19241 $entry3->set_text($matchCount);
19242 # While we're at it, update the size of the world model
19243 $entry4->set_text($wmObj->modelActualCount);
19244 }
19245 });
19246  
19247 my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected model object', undef,
19248 1, 3, 11, 12);
19249 $button2->signal_connect('clicked' => sub {
19250  
19251 my ($number) = $self->getSimpleListData($slWidget, 0);
19252 if (defined $number && $wmObj->ivExists('modelHash', $number)) {
19253  
19254 # Open up an 'edit' window for the child object
19255 $self->openChildEditWin($number);
19256 }
19257 });
19258  
19259 my $button3 = $self->addButton(
19260 $grid,
19261 'Clear',
19262 'Clear the list of world model objects',
19263 undef,
19264 10, 12, 11, 12,
19265 );
19266 $button3->signal_connect('clicked' => sub {
19267  
19268 # Empty the list
19269 @{$slWidget->{data}} = ();
19270 });
19271  
19272 # Tab complete
19273 return 1;
19274 }
19275  
19276 # Support functions
19277  
19278 sub propertiesTab_checkRange {
19279  
19280 # Called by several parts of $self->propertiesTab_addEntryWithRange, in the
19281 # ->signal_connect anonymous subroutine
19282 # Since it's not a trivally simple check (but the same for all four widgets created by the
19283 # calling function), use the same function for each
19284 #
19285 # Expected arguments
19286 # $iv - The IV to add to the search - matches a key in $self->searchHash
19287 # $checkButton - The Gtk3::CheckButton
19288 # $combo - The Gtk3::ComboBox
19289 # $entry, $entry2 - The two Gtk3::Entry boxes
19290 #
19291 # Return values
19292 # 'undef' on improper arguments
19293 # 1 otherwise
19294  
19295 my ($self, $iv, $checkButton, $combo, $entry, $entry2, $check) = @_;
19296  
19297 # Local variables
19298 my ($comboText, $entryText, $entryText2);
19299  
19300 # Check for improper arguments
19301 if (
19302 ! defined $iv || ! defined $checkButton || ! defined $combo || ! defined $entry
19303 || ! defined $entry2 || defined $check
19304 ) {
19305 return $axmud::CLIENT->writeImproper(
19306 $self->_objClass . '->propertiesTab_checkRange',
19307 @_,
19308 );
19309 }
19310  
19311 $comboText = $combo->get_active_text();
19312 if ($self->checkEntryIcon($entry)) {
19313  
19314 $entryText = $entry->get_text();
19315 }
19316  
19317 if ($self->checkEntryIcon($entry2)) {
19318  
19319 $entryText2 = $entry2->get_text();
19320 }
19321  
19322 if ($checkButton->get_active() && $comboText) {
19323  
19324 if ($comboText ne 'min-max' && $entryText) {
19325  
19326 $self->ivAdd('searchHash', $iv, $entryText);
19327 $self->ivAdd('searchRangeHash', $iv, $comboText);
19328 $self->ivDelete('searchUpperHash', $iv);
19329  
19330 } elsif ($comboText eq 'min-max' && $self->checkEntryIcon($entry, $entry2)) {
19331  
19332 # Use the higher value as the maximum
19333 if ($entryText2 < $entryText) {
19334  
19335 ($entryText2, $entryText) = ($entryText, $entryText2);
19336 }
19337  
19338 $self->ivAdd('searchHash', $iv, $entryText);
19339 $self->ivAdd('searchRangeHash', $iv, $comboText);
19340 $self->ivAdd('searchUpperHash', $iv, $entryText2);
19341  
19342 } else {
19343  
19344 $self->ivDelete('searchHash', $iv);
19345 $self->ivDelete('searchRangeHash', $iv);
19346 $self->ivDelete('searchUpperHash', $iv);
19347 }
19348  
19349 } else {
19350  
19351 $self->ivDelete('searchHash', $iv);
19352 $self->ivDelete('searchRangeHash', $iv);
19353 $self->ivDelete('searchUpperHash', $iv);
19354 }
19355  
19356 # $entry2 is only sensitive when the combo is set to 'min-max'
19357 if ($comboText eq 'min-max') {
19358  
19359 $entry2->set_sensitive(TRUE);
19360  
19361 } else {
19362  
19363 $entry2->set_text('');
19364 $entry2->set_sensitive(TRUE);
19365 }
19366  
19367 return 1;
19368 }
19369  
19370 sub performSearch {
19371  
19372 # Called by $self->resultsTab
19373 # Perform a search for world model objects matching the parameters specified by the user and
19374 # stored (mainly) in $self->searchHash
19375 #
19376 # Expected arguments
19377 # $slWidget - The GA::Obj::SimpleList
19378 # $matchMax - The maximum number of matching model objects before the search
19379 # algorithm gives up
19380 # $objMax - The maximum number of model objects searched before the search
19381 # algorithm gives up
19382 #
19383 # Return values
19384 # 'undef' on improper arguments or if the search yields no matches
19385 # Otherwise returns the number of matches
19386  
19387 my ($self, $slWidget, $matchMax, $objMax, $check) = @_;
19388  
19389 # Local variables
19390 my (
19391 $wmObj, $count, $regionmapObj, $regionmapNum,
19392 @objList, @matchList, @matchRoomList, @dataList, @mapWinList,
19393 );
19394  
19395 # (Error checking removed for speed)
19396  
19397 # # Check for improper arguments
19398 # if (! defined $slWidget || ! defined $matchMax || ! defined $objMax || defined $check) {
19399 #
19400 # return $axmud::CLIENT->writeImproper($self->_objClass . '->performSearch', @_);
19401 # }
19402  
19403 # Import the world model
19404 $wmObj = $self->session->worldModelObj;
19405  
19406 if ($self->searchAllFlag) {
19407  
19408 # Start at model object #1, and continue until we reach the supplied limits (the calling
19409 # function has already checked that these limits aren't larger than the model itself)
19410 $count = 0;
19411 do {
19412  
19413 my $obj;
19414  
19415 $count++;
19416 # (Don't use usual ->ivShow method for improved speed)
19417 $obj = $wmObj->{modelHash}{$count};
19418  
19419 # Check that the object's category, ->category, is one of the ones we want to
19420 # search (in which case, it appears as a key in $self->categoryHash)
19421 if (defined $obj && exists $self->{'categoryHash'}{$obj->category}) {
19422  
19423 # If the object matches our search terms, add it to the list of matches
19424 if ($self->checkObj($obj)) {
19425  
19426 push (@matchList, $obj);
19427 if ($obj->category eq 'room') {
19428  
19429 push (@matchRoomList, $obj, 'room');
19430 }
19431 }
19432 }
19433  
19434 } until ($count == $objMax || scalar @matchList == $matchMax);
19435  
19436 } else {
19437  
19438 # Compile a list of all model objects in the specified region, saving it as a hash
19439 # in the form
19440 # $hash{model_number} = blessed_reference_to_model_object
19441  
19442 # First, empty the hash after previous searches
19443 $self->ivEmpty('compileHash');
19444  
19445 # Find the model object for the region specified by $self->searchRegion, and use it
19446 # as the first item in the hash
19447 $regionmapObj = $wmObj->ivShow('regionmapHash', $self->searchRegion);
19448 if (defined $regionmapObj) {
19449  
19450 $regionmapNum = $regionmapObj->number;
19451 $self->{'compileHash'}{$regionmapNum} = $wmObj->{'modelHash'}{$regionmapNum};
19452  
19453 # Compile a list of all model objects in the specified region, by calling
19454 # ->compileObjHash recursively
19455 $self->compileObjHash($wmObj->{'modelHash'}{$regionmapNum});
19456 }
19457  
19458 # Sort the objects in the hash in order of model number
19459 @objList = sort {$a->number <=> $b->number} ( values %{$self->{'compileHash'}} );
19460  
19461 # Perform the same search as above
19462 foreach my $obj (@objList) {
19463  
19464 if (exists $self->{'categoryHash'}{$obj->category}) {
19465  
19466 # If the object matches our search terms, add it to the list of matches
19467 if ($self->checkObj($obj)) {
19468  
19469 push (@matchList, $obj);
19470 if ($obj->category eq 'room') {
19471  
19472 push (@matchRoomList, $obj, 'room');
19473 }
19474 }
19475 }
19476 }
19477 }
19478  
19479 # Display the list of objects in the simple list
19480 if (! @matchList) {
19481  
19482 # No matches were found
19483 $self->showMsgDialogue(
19484 'Search',
19485 'info',
19486 'No matching objects were found in the world model',
19487 'ok',
19488 );
19489  
19490 } else {
19491  
19492 # Update the simple list
19493 foreach my $obj (@matchList) {
19494  
19495 my $parentObj;
19496  
19497 if ($obj->parent) {
19498  
19499 $parentObj = $wmObj->{'modelHash'}{$obj->parent};
19500 }
19501  
19502 if ($parentObj) {
19503  
19504 push (@dataList,
19505 $obj->number,
19506 $obj->category,
19507 $obj->name,
19508 $parentObj->number,
19509 $parentObj->category,
19510 $parentObj->name,
19511 );
19512  
19513 } else {
19514  
19515 push (@dataList,
19516 $obj->number,
19517 $obj->category,
19518 $obj->name,
19519 undef,
19520 undef,
19521 undef,
19522 );
19523 }
19524 }
19525  
19526 # Reset the simple list
19527 $self->resetListData($slWidget, [@dataList], 6);
19528  
19529 # If there were any matching rooms, and if the flag is set, tell the world model to
19530 # select all matching rooms in Automapper windows
19531 # select the rooms on the map
19532 if (@matchRoomList && $wmObj->searchSelectRoomsFlag) {
19533  
19534 # Get a list of Automapper windows using this world model
19535 @mapWinList = $wmObj->collectMapWins();
19536 foreach my $mapWin (@mapWinList) {
19537  
19538 # Clear the previous selection(s)
19539 $mapWin->setSelectedObj();
19540  
19541 # Select the matching room(s)
19542 $mapWin->setSelectedObj(\@matchRoomList, TRUE);
19543 }
19544 }
19545 }
19546  
19547 # Operation complete
19548 return scalar @matchList;
19549 }
19550  
19551 sub checkObj {
19552  
19553 # Called by $self->performSearch
19554 # Given the number of a world model object, checks whether its IVs match those specified by
19555 # the IVs in $self->searchHash
19556 #
19557 # Expected arguments
19558 # $obj - Blessed reference of the model object to check
19559 #
19560 # Return values
19561 # 'undef' on improper arguments or if the object doesn't match IVs specified by
19562 # $self->searchHash
19563 # 1 if the object matches
19564  
19565 my ($self, $obj, $check) = @_;
19566  
19567 # Local variables
19568 my $wmObj;
19569  
19570 # (Error checking removed for speed)
19571  
19572 # # Check for improper arguments
19573 # if (! defined $obj || defined $check) {
19574 #
19575 # return $axmud::CLIENT->writeImproper($self->_objClass . '->checkObj', @_);
19576 # }
19577  
19578 # Import the world model object
19579 $wmObj = $self->session->worldModelObj;
19580  
19581 # Check each IV in turn (for improved speed, we don't use ->ivKeys, etc)
19582 OUTER: foreach my $iv ( keys %{$self->{'searchHash'}} ) {
19583  
19584 my ($search, $type, $ivCode, $rangeOp, $flag);
19585  
19586 # Get the value corresponding to the key $iv in the hash $self->searchHash
19587 $search = $self->{'searchHash'}{$iv};
19588 # Get the search type (e.g. 'match', 'key', 'special' etc)
19589 $type = $self->{'searchTypeHash'}{$iv};
19590  
19591 # Some settings of $iv begin with an underline; e.g. $iv can be set to both
19592 # 'visitHash' (when we want to check a key exists in the hash) and '_visitHash'
19593 # (when we want to check the key doesn't exit)
19594 # By having both 'visitHash' and '_visitHash', we can perform two different operation on
19595 # the same IV (i.e. there can be two entries in the hash $self->searchHash, not one
19596 # which potentially overwrites another)
19597 $ivCode = $iv; # Might begin with an underline
19598 $iv =~ s/_//; # Does not begin with an underline
19599  
19600 # Some IVs exist in one category of model object, but not in other categories. We need
19601 # to check that the IV actually exists
19602 if (! exists $obj->{$iv}) {
19603  
19604 # Can't be a match if the IV isn't used in this category of model object
19605 return undef;
19606  
19607 } elsif ($type eq 'match') {
19608  
19609 # Perform a regex on the scalar IV's value, to see whether it matches the
19610 # user-specified value in $search (NB The search is case-insensitive)
19611 if (! defined $obj->$iv || ! ($obj->$iv =~ m/$search/i)) {
19612  
19613 # This object doesn't match
19614 return undef;
19615 }
19616  
19617 } elsif ($type eq 'flag') {
19618  
19619 # Check whether the scalar IV, which is a flag, matches the user-specified value in
19620 # $search (i.e. either 'on' or 'off')
19621 if (($obj->$iv && ! $search) || (! $obj->$iv && $search)) {
19622  
19623 return undef;
19624 }
19625  
19626 } elsif ($type eq 'string_equal') {
19627  
19628 # Check whether the scalar IV's value is an exact match for the value of $search
19629 if ($obj->$iv ne $search) {
19630  
19631 return undef;
19632 }
19633  
19634 } elsif ($type eq 'range') {
19635  
19636 # Get the range operator specified by the user
19637 $rangeOp = $self->{'searchRangeHash'}{$ivCode};
19638  
19639 if (
19640 ! defined $obj->$iv
19641 || ($rangeOp eq '==' && $obj->$iv != $search)
19642 || ($rangeOp eq '>' && $obj->$iv <= $search)
19643 || ($rangeOp eq '>=' && $obj->$iv < $search)
19644 || ($rangeOp eq '<' && $obj->$iv >= $search)
19645 || ($rangeOp eq '<=' && $obj->$iv > $search)
19646 # Min/max: minimum value stored in $search, maximum value stored in
19647 # $self->searchUpperHash)
19648 || (
19649 $rangeOp eq 'min-max'
19650 && ($obj->$iv < $search || $obj->$iv > $self->{'searchUpperHash'}{$ivCode})
19651 )
19652 ) {
19653 return undef;
19654 }
19655  
19656  
19657 } elsif ($type eq 'include') {
19658  
19659 # Check whether the list IV includes an element which is an exact match for the
19660 # value of $search
19661 INNER: foreach my $element ($obj->$iv) {
19662  
19663 if ($element eq $search) {
19664  
19665 $flag = TRUE;
19666 last INNER;
19667 }
19668 }
19669  
19670 if (! $flag) {
19671  
19672 return undef;
19673 }
19674  
19675 } elsif ($type eq 'list_match') {
19676  
19677 # Perform a regex on every element in a list IV, to see whether it matches the value
19678 # of $search
19679 INNER: foreach my $element ($obj->$iv) {
19680  
19681 if ($element =~ m/$search/i) {
19682  
19683 $flag = TRUE;
19684 last INNER;
19685 }
19686 }
19687  
19688 if (! $flag) {
19689  
19690 return undef;
19691 }
19692  
19693 } elsif ($type eq 'key') {
19694  
19695 # Check whether the hash IV contains a key which is an exact match for the value of
19696 # $search
19697 if (! exists $obj->{$iv}{$search}) {
19698  
19699 return undef;
19700 }
19701  
19702 } elsif ($type eq 'not_key') {
19703  
19704 # Check whether the hash IV does NOT contain a key which is an exact match for the
19705 # value of $search
19706 if (exists $obj->{$iv}{$search}) {
19707  
19708 return undef;
19709 }
19710  
19711 } elsif ($type eq 'used_hash') {
19712  
19713 # Check whether the hash IV contains at least one key
19714 if (
19715 ($obj->$iv && ! $search)
19716 || (! $obj->$iv && $search)
19717 ) {
19718 return undef;
19719 }
19720  
19721 } elsif ($type eq 'value_match') {
19722  
19723 # Perform a regex on all of the values in the hash IV, hoping to find one that
19724 # matches $search
19725 INNER: foreach my $value ( values %{$obj->{$iv}} ) {
19726  
19727 if ($value =~ m/$search/i) {
19728  
19729 $flag = TRUE;
19730 last INNER;
19731 }
19732 }
19733  
19734 if (! $flag) {
19735  
19736 return undef;
19737 }
19738  
19739 } elsif ($type eq 'special') {
19740  
19741 if ($ivCode eq '_hiddenObjHash') {
19742  
19743 # $obj->hiddenObjHash is in the form
19744 # hash{unique_number_of_hidden_object} = 'commands_to_obtain_it'
19745 # Check whether the any of the objects stored in this hash have a ->name
19746 # matching $search
19747 INNER: foreach my $number ( keys %{$obj->{$iv}} ) {
19748  
19749 my $obj = $wmObj->{'modelHash'}{$number};
19750  
19751 if (defined $obj && ($obj->name =~ m/$search/i)) {
19752  
19753 $flag = TRUE;
19754 last INNER;
19755 }
19756 }
19757  
19758 if (! $flag) {
19759  
19760 return undef;
19761 }
19762  
19763 } elsif ($ivCode eq 'type') {
19764  
19765 # We are checking a portable object's type - we must check that it's not a
19766 # decoration
19767 if ($obj->category ne 'portable' || $obj->$iv ne $search) {
19768  
19769 return undef;
19770 }
19771  
19772 } elsif ($ivCode eq '_type') {
19773  
19774 # We are checking a decoration object's type - we must check that it's not a
19775 # decoration
19776 if ($obj->category ne 'decoration' || $obj->$iv ne $search) {
19777  
19778 return undef;
19779 }
19780  
19781 # Error checking removed for speed
19782 # } else {
19783 #
19784 # return $self->writeError(
19785 # 'Search error: unrecognised ivCode \'' . $ivCode . '\'',
19786 # $self->_objClass . '->new',
19787 # );
19788 }
19789  
19790 # Error checking removed for speed
19791 # } else {
19792 #
19793 # return $self->session->writeError(
19794 # 'Search error: unrecognised type \'' . $type . '\'',
19795 # $self->_objClass . '->new',
19796 # );
19797 }
19798 }
19799  
19800 # The world model object $obj is a match
19801 return 1;
19802 }
19803  
19804 sub compileObjHash {
19805  
19806 # Called by $self->performSearch when $self->searchAllFlag is not set, and by this function
19807 # recursively
19808 # Given a world model object which already exists as a key-value pair in $self->compileHash,
19809 # add all of its child objects to the same hash, and then call this function recursively
19810 # for each of those objects
19811 #
19812 # Expected arguments
19813 # $obj - Blessed reference to a model object
19814 #
19815 # Return values
19816 # 'undef' on improper arguments
19817 # 1 otherwise
19818  
19819 my ($self, $obj, $check) = @_;
19820  
19821 # (Error checking removed for speed)
19822  
19823 # # Check for improper arguments
19824 # if (! defined $obj || defined $check) {
19825 #
19826 # return $axmud::CLIENT->writeImproper($self->_objClass . '->compileObjHash', @_);
19827 # }
19828  
19829 # (For improved speed, don't use ->ivValues, etc)
19830 foreach my $childObj ( values %{$obj->{childHash}} ) {
19831  
19832 # Add the child object to the main hash
19833 $self->{compileHash}{$childObj->number} = $childObj;
19834 # Call this function recursively to add its children, too
19835 $self->compileObjHash($childObj);
19836 }
19837  
19838 return 1;
19839 }
19840  
19841 ##################
19842 # Accessors - set
19843  
19844 ##################
19845 # Accessors - get
19846  
19847 sub searchAllFlag
19848 { $_[0]->{searchAllFlag} }
19849 sub searchRegion
19850 { $_[0]->{searchRegion} }
19851  
19852 sub categoryHash
19853 { my $self = shift; return %{$self->{categoryHash}}; }
19854  
19855 sub searchHash
19856 { my $self = shift; return %{$self->{searchHash}}; }
19857 sub searchRangeHash
19858 { my $self = shift; return %{$self->{searchRangeHash}}; }
19859 sub searchUpperHash
19860 { my $self = shift; return %{$self->{searchUpperHash}}; }
19861 sub searchTypeHash
19862 { my $self = shift; return %{$self->{searchTypeHash}}; }
19863  
19864 sub compileHash
19865 { my $self = shift; return %{$self->{compileHash}}; }
19866 }
19867  
19868 { package Games::Axmud::PrefWin::Session;
19869  
19870 use strict;
19871 use warnings;
19872 use diagnostics;
19873  
19874 use Glib qw(TRUE FALSE);
19875  
19876 our @ISA = qw(
19877 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
19878 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
19879 );
19880  
19881 ##################
19882 # Constructors
19883  
19884 # Contents of $self->editConfigHash after $self->new has been called:
19885 # (none)
19886  
19887 # sub new {} # Inherited from GA::Generic::ConfigWin
19888  
19889 ##################
19890 # Methods
19891  
19892 # Standard window object functions
19893  
19894 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
19895  
19896 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
19897  
19898 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
19899  
19900 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
19901  
19902 # sub winShowAll {} # Inherited from GA::Generic::Win
19903  
19904 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
19905  
19906 # sub redrawWidgets {} # Inherited from GA::Generic::Win
19907  
19908 # ->signal_connects
19909  
19910 # Other functions
19911  
19912 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
19913  
19914 sub enableButtons {
19915  
19916 # Called by $self->drawWidgets
19917 # We only need a single button so, instead of calling the generic ->enableButtons, call a
19918 # method that creates just one button
19919 #
19920 # Expected arguments
19921 # $hBox - The horizontal packing box in which the buttons live (not yet stored as
19922 # an IV)
19923 #
19924 # Return values
19925 # An empty list on improper arguments
19926 # Otherwise, a list containing the Gtk::Button object created
19927  
19928 my ($self, $hBox, $check) = @_;
19929  
19930 # Local variables
19931 my @emptyList;
19932  
19933 # Check for improper arguments
19934 if (! defined $hBox || defined $check) {
19935  
19936 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
19937 return @emptyList;
19938 }
19939  
19940 return $self->enableSingleButton($hBox);
19941 }
19942  
19943 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
19944  
19945 sub setupNotebook {
19946  
19947 # Called by $self->enable
19948 # Creates the first tab for the notebook. The remaining tabs are created by
19949 # $self->expandNotebook
19950 #
19951 # Expected arguments
19952 # (none besides $self)
19953 #
19954 # Return values
19955 # 'undef' on improper arguments
19956 # 1 otherwise
19957  
19958 my ($self, $check) = @_;
19959  
19960 # Check for improper arguments
19961 if (defined $check) {
19962  
19963 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
19964 }
19965  
19966 # # Tab setup
19967 # my $grid = $self->addTab('_Session', $self->notebook);
19968  
19969 # Set up the rest of the first tab (all of it, in this case)
19970 $self->sessionTab();
19971  
19972 # Set up the remaining tabs
19973 $self->expandNotebook();
19974  
19975 # Tab complete
19976 return 1;
19977 }
19978  
19979 sub expandNotebook {
19980  
19981 # Called by $self->setupNotebook
19982 # Set up additional tabs for the notebook
19983 #
19984 # Expected arguments
19985 # (none besides $self)
19986 #
19987 # Return values
19988 # 'undef' on improper arguments
19989 # 1 otherwise
19990  
19991 my ($self, $check) = @_;
19992  
19993 # Check for improper arguments
19994 if (defined $check) {
19995  
19996 return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_);
19997 }
19998  
19999 $self->interfacesTab();
20000 $self->tasksTab();
20001 $self->recordingTab();
20002 $self->protocolsTab();
20003 $self->msdpTab();
20004 $self->msspTab();
20005 $self->mxpTab();
20006 $self->zmpTab();
20007 $self->aard102Tab();
20008 $self->atcpTab();
20009 $self->gmcpTab();
20010 $self->mcpTab();
20011  
20012 return 1;
20013 }
20014  
20015 # sub saveChanges {} # Inherited from GA::Generic::ConfigWin
20016  
20017 # Notebook tabs
20018  
20019 sub sessionTab {
20020  
20021 # Session tab - called by $self->setupNotebook
20022 #
20023 # Expected arguments
20024 # (none besides $self)
20025 #
20026 # Return values
20027 # 'undef' on improper arguments
20028 # 1 otherwise
20029  
20030 my ($self, $check) = @_;
20031  
20032 # Check for improper arguments
20033 if (defined $check) {
20034  
20035 return $axmud::CLIENT->writeImproper($self->_objClass . '->sessionTab', @_);
20036 }
20037  
20038 # Tab setup
20039 # Create a notebook within the main one, so that we have two rows of tabs
20040 my $innerNotebook = $self->addInnerNotebookTab('_Session', $self->notebook);
20041  
20042 # Add tabs to the inner notebook
20043 $self->session1Tab($innerNotebook);
20044 $self->session2Tab($innerNotebook);
20045 $self->session3Tab($innerNotebook);
20046 $self->session4Tab($innerNotebook);
20047  
20048 return 1;
20049 }
20050  
20051 sub session1Tab {
20052  
20053 # Session1 tab
20054 #
20055 # Expected arguments
20056 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
20057 #
20058 # Return values
20059 # 'undef' on improper arguments
20060 # 1 otherwise
20061  
20062 my ($self, $innerNotebook, $check) = @_;
20063  
20064 # Check for improper arguments
20065 if (! defined $innerNotebook || defined $check) {
20066  
20067 return $axmud::CLIENT->writeImproper($self->_objClass . '->session1Tab', @_);
20068 }
20069  
20070 # Tab setup
20071 my $grid = $self->addTab('Page _1', $innerNotebook);
20072  
20073 # Left column
20074 $self->addLabel($grid, '<b>Session settings</b>',
20075 0, 6, 0, 1);
20076  
20077 $self->addLabel($grid, 'Session number',
20078 1, 3, 1, 2);
20079 my $entry = $self->addEntry($grid, undef, FALSE,
20080 3, 6, 1, 2);
20081  
20082 my $checkButton = $self->addCheckButton($grid, 'Session start complete', undef, FALSE,
20083 1, 6, 2, 3);
20084 my $checkButton2 = $self->addCheckButton($grid, 'Automatic login complete', undef, FALSE,
20085 1, 6, 3, 4);
20086  
20087 $self->addLabel($grid, 'Client (system) time (secs)',
20088 1, 3, 4, 5);
20089 my $entry2 = $self->addEntry($grid, undef, FALSE,
20090 3, 6, 4, 5);
20091  
20092 $self->addLabel($grid, 'Session time (secs)',
20093 1, 3, 5, 6);
20094 my $entry3 = $self->addEntry($grid, undef, FALSE,
20095 3, 6, 5, 6);
20096  
20097 $self->addLabel($grid, 'Delayed quit',
20098 1, 3, 6, 7);
20099 my $entry4 = $self->addEntry($grid, undef, FALSE,
20100 3, 6, 6, 7);
20101  
20102 $self->addLabel($grid, 'Current character set',
20103 1, 3, 7, 8);
20104 my $entry5 = $self->addEntry($grid, undef, FALSE,
20105 3, 6, 7, 8);
20106  
20107 $self->addLabel($grid, '<b>Current connection</b>',
20108 0, 6, 8, 9);
20109  
20110 $self->addLabel($grid, 'Host',
20111 1, 3, 9, 10);
20112 my $entry6 = $self->addEntry($grid, undef, FALSE,
20113 3, 6, 9, 10);
20114  
20115 $self->addLabel($grid, 'Protocol',
20116 1, 3, 10, 11);
20117 my $entry7 = $self->addEntry($grid, undef, FALSE,
20118 3, 6, 10, 11);
20119  
20120 # Right column
20121 my $button = $self->addButton($grid, 'Update', 'Update the displayed data', undef,
20122 10, 12, 0, 1);
20123 # (->signal_connect appears below)
20124  
20125 $self->addLabel($grid, 'Current world',
20126 7, 9, 1, 2);
20127 my $entry8 = $self->addEntry($grid, undef, FALSE,
20128 9, 12, 1, 2);
20129  
20130 $self->addLabel($grid, 'Current guild',
20131 7, 9, 2, 3);
20132 my $entry9 = $self->addEntry($grid, undef, FALSE,
20133 9, 12, 2, 3);
20134  
20135 $self->addLabel($grid, 'Current race',
20136 7, 9, 3, 4);
20137 my $entry10 = $self->addEntry($grid, undef, FALSE,
20138 9, 12, 3, 4);
20139  
20140 $self->addLabel($grid, 'Current character',
20141 7, 9, 4, 5);
20142 my $entry11 = $self->addEntry($grid, undef, FALSE,
20143 9, 12, 4, 5);
20144  
20145 $self->addLabel($grid, 'Current dictionary',
20146 7, 9, 5, 6);
20147 my $entry12 = $self->addEntry($grid, undef, FALSE,
20148 9, 12, 5, 6);
20149  
20150 $self->addLabel($grid, 'Current mission',
20151 7, 9, 6, 7);
20152 my $entry13 = $self->addEntry($grid, undef, FALSE,
20153 9, 12, 6, 7);
20154  
20155 $self->addLabel($grid, 'Port',
20156 7, 9, 9, 10);
20157 my $entry14 = $self->addEntry($grid, undef, FALSE,
20158 9, 12, 9, 10);
20159  
20160 $self->addLabel($grid, 'Connection status',
20161 7, 9, 10, 11);
20162 my $entry15 = $self->addEntry($grid, undef, FALSE,
20163 9, 12, 10, 11);
20164  
20165 # ->signal_connects
20166 $button->signal_connect('clicked' => sub {
20167  
20168 $checkButton->set_active($self->session->startCompleteFlag);
20169 $checkButton2->set_active($self->session->loginFlag);
20170  
20171 $entry->set_text($self->session->number);
20172 $entry2->set_text($axmud::CLIENT->clientTime);
20173 $entry3->set_text($self->session->sessionTime);
20174  
20175 if (defined $self->session->delayedQuitTime) {
20176  
20177 $entry4->set_text(
20178 $axmud::CLIENT->clientSigil . $self->session->delayedQuitCmd . ' at '
20179 . $self->session->delayedQuitTime,
20180 );
20181  
20182 } else {
20183  
20184 $entry4->set_text('');
20185 }
20186  
20187 $entry5->set_text($self->session->sessionCharSet);
20188  
20189 if ($self->session->host) {
20190 $entry6->set_text($self->session->host);
20191 } else {
20192 $entry6->set_text('(none)');
20193 }
20194  
20195 if ($self->session->protocol) {
20196 $entry7->set_text($self->session->protocol);
20197 } else {
20198 $entry7->set_text('(none)');
20199 }
20200  
20201 if ($self->session->currentWorld) {
20202 $entry8->set_text($self->session->currentWorld->name);
20203 } else {
20204 $entry8->set_text('(none)');
20205 }
20206  
20207 if ($self->session->currentGuild) {
20208 $entry9->set_text($self->session->currentGuild->name);
20209 } else {
20210 $entry9->set_text('(none)');
20211 }
20212  
20213 if ($self->session->currentRace) {
20214 $entry10->set_text($self->session->currentRace->name);
20215 } else {
20216 $entry10->set_text('(none)');
20217 }
20218  
20219 if ($self->session->currentChar) {
20220 $entry11->set_text($self->session->currentChar->name);
20221 } else {
20222 $entry11->set_text('(none)');
20223 }
20224  
20225 $entry12->set_text($self->session->currentDict->name);
20226  
20227 if ($self->session->currentMission) {
20228 $entry13->set_text($self->session->currentMission->name);
20229 } else {
20230 $entry13->set_text('(none)');
20231 }
20232  
20233 if ($self->session->port) {
20234 $entry14->set_text($self->session->port);
20235 } else {
20236 $entry14->set_text('(none)');
20237 }
20238  
20239 $entry15->set_text($self->session->status);
20240 });
20241  
20242 # Pseudo-click the button to set all the widgets
20243 $button->clicked();
20244  
20245 # Tab complete
20246 return 1;
20247 }
20248  
20249 sub session2Tab {
20250  
20251 # Session2 tab
20252 #
20253 # Expected arguments
20254 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
20255 #
20256 # Return values
20257 # 'undef' on improper arguments
20258 # 1 otherwise
20259  
20260 my ($self, $innerNotebook, $check) = @_;
20261  
20262 # Local variables
20263 my @columnList;
20264  
20265 # Check for improper arguments
20266 if (! defined $innerNotebook || defined $check) {
20267  
20268 return $axmud::CLIENT->writeImproper($self->_objClass . '->session2Tab', @_);
20269 }
20270  
20271 # Tab setup
20272 my $grid = $self->addTab('Page _2', $innerNotebook);
20273  
20274 # Session file objects
20275 $self->addLabel($grid, '<b>Session file objects</b>',
20276 0, 12, 0, 1);
20277 $self->addLabel($grid, '<i>List of data files currently in use by this session</i>',
20278 1, 12, 1, 2);
20279  
20280 # Add a simple list
20281 @columnList = (
20282 'Not saved', 'bool',
20283 'File type', 'text',
20284 'File name', 'text',
20285 'Path', 'text',
20286 );
20287  
20288 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
20289 1, 12, 2, 10);
20290  
20291 # Add more widgets (displayed values set by the call to $self->session2Tab_refreshList)
20292 my $checkButton = $self->addCheckButton($grid, 'No saving on disconnection', undef, FALSE,
20293 1, 4, 10, 11);
20294  
20295 $self->addLabel($grid, 'Next autosave time',
20296 4, 6, 10, 11);
20297 my $entry = $self->addEntry($grid, undef, FALSE,
20298 6, 8, 10, 11, 8, 8);
20299  
20300 $self->addLabel($grid, 'Previous autosave time',
20301 8, 10, 10, 11);
20302 my $entry2 = $self->addEntry($grid, undef, FALSE,
20303 10, 12, 10, 11, 8, 8);
20304  
20305 my $button = $self->addButton($grid,
20306 'Save', 'Save all files whose data has been modified', undef,
20307 1, 3, 11, 12);
20308 $button->signal_connect('clicked' => sub {
20309  
20310 $self->session->pseudoCmd('save', $self->pseudoCmdMode);
20311  
20312 # Refresh the simple list
20313 $self->session2Tab_refreshList(
20314 $slWidget,
20315 scalar (@columnList / 2),
20316 $checkButton,
20317 $entry,
20318 $entry2,
20319 );
20320 });
20321  
20322 my $button2 = $self->addButton($grid,
20323 'Force save', 'Save all files, even if their data has not been modified', undef,
20324 3, 6, 11, 12);
20325 $button2->signal_connect('clicked' => sub {
20326  
20327 $self->session->pseudoCmd('save -f', $self->pseudoCmdMode);
20328  
20329 # Refresh the simple list
20330 $self->session2Tab_refreshList(
20331 $slWidget,
20332 scalar (@columnList / 2),
20333 $checkButton,
20334 $entry,
20335 $entry2,
20336 );
20337 });
20338  
20339 my $button3 = $self->addButton($grid,
20340 'Refresh list', 'Refresh the list of file objects', undef,
20341 9, 12, 11, 12);
20342 $button3->signal_connect('clicked' => sub {
20343  
20344 # Refresh the simple list
20345 $self->session2Tab_refreshList(
20346 $slWidget,
20347 scalar (@columnList / 2),
20348 $checkButton,
20349 $entry,
20350 $entry2,
20351 );
20352 });
20353  
20354 # We can now initialise the widgets
20355 $self->session2Tab_refreshList(
20356 $slWidget,
20357 scalar (@columnList / 2),
20358 $checkButton,
20359 $entry,
20360 $entry2,
20361 );
20362  
20363 # Tab complete
20364 return 1;
20365 }
20366  
20367 sub session2Tab_refreshList {
20368  
20369 # Resets the simple list displayed by $self->session2Tab
20370 #
20371 # Expected arguments
20372 # $slWidget - The GA::Obj::SimpleList
20373 # $columns - The number of columns
20374 # $checkButton, $entry, $entry2
20375 # - Three widgets whose values should be refreshed at the same time
20376 #
20377 # Return values
20378 # 'undef' on improper arguments
20379 # 1 otherwise
20380  
20381 my ($self, $slWidget, $columns, $checkButton, $entry, $entry2, $check) = @_;
20382  
20383 # Local variables
20384 my (@fileList, @dataList);
20385  
20386 # Check for improper arguments
20387 if (
20388 ! defined $slWidget || ! defined $columns || ! defined $checkButton
20389 || ! defined $entry || ! defined $entry2 || defined $check
20390 ) {
20391 return $axmud::CLIENT->writeImproper(
20392 $self->_objClass . '->session2Tab_refreshList',
20393 @_,
20394 );
20395 }
20396  
20397 # Get a sorted list of file objects
20398 @fileList = sort {lc($a->name) cmp lc($b->name)}
20399 ($self->session->ivValues('sessionFileObjHash'));
20400  
20401 # Compile the simple list data
20402 foreach my $obj (@fileList) {
20403  
20404 push (@dataList,
20405 $obj->modifyFlag,
20406 $obj->fileType,
20407 $obj->name,
20408 $obj->actualPath,
20409 );
20410 }
20411  
20412 # Reset the simple list
20413 $self->resetListData($slWidget, [@dataList], $columns);
20414  
20415 # Refresh the other widgets
20416 $checkButton->set_active($self->session->disconnectNoSaveFlag);
20417 $entry->set_text($self->session->autoSaveCheckTime);
20418 $entry2->set_text($self->session->autoSaveLastTime);
20419  
20420 return 1;
20421 }
20422  
20423 sub session3Tab {
20424  
20425 # Session3 tab
20426 #
20427 # Expected arguments
20428 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
20429 #
20430 # Return values
20431 # 'undef' on improper arguments
20432 # 1 otherwise
20433  
20434 my ($self, $innerNotebook, $check) = @_;
20435  
20436  
20437 # Check for improper arguments
20438 if (! defined $innerNotebook || defined $check) {
20439  
20440 return $axmud::CLIENT->writeImproper($self->_objClass . '->session3Tab', @_);
20441 }
20442  
20443 # Tab setup
20444 my $grid = $self->addTab('Page _3', $innerNotebook);
20445  
20446 # Left column
20447 $self->addLabel($grid, '<b>Session buffer settings (1/2)</b>',
20448 0, 12, 0, 1);
20449  
20450 $self->addLabel($grid, '<i>Display buffer</i>',
20451 1, 12, 1, 2);
20452  
20453 $self->addLabel($grid, 'Max size',
20454 1, 3, 2, 3);
20455 my $entry = $self->addEntry($grid, undef, FALSE,
20456 3, 6, 2, 3);
20457  
20458 $self->addLabel($grid, 'Current size',
20459 1, 3, 3, 4);
20460 my $entry2 = $self->addEntry($grid, undef, FALSE,
20461 3, 6, 3, 4);
20462  
20463 $self->addLabel($grid, 'Total lines received',
20464 1, 3, 4, 5);
20465 my $entry3 = $self->addEntry($grid, undef, FALSE,
20466 3, 6, 4, 5);
20467  
20468 $self->addLabel($grid, 'Line number',
20469 1, 3, 5, 6);
20470 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
20471 3, 6, 5, 6);
20472  
20473 # Right column
20474 my $button = $self->addButton($grid,
20475 'Update', 'Update the displayed data', undef,
20476 9, 12, 0, 1);
20477  
20478 $self->addLabel($grid, 'First line #',
20479 7, 9, 2, 3);
20480 my $entry5 = $self->addEntry($grid, undef, FALSE,
20481 9, 12, 2, 3);
20482  
20483 $self->addLabel($grid, 'Last line #',
20484 7, 9, 3, 4);
20485 my $entry6 = $self->addEntry($grid, undef, FALSE,
20486 9, 12, 3, 4);
20487  
20488 $self->addLabel($grid, 'Since last line (secs)',
20489 7, 9, 4, 5);
20490 my $entry7 = $self->addEntry($grid, undef, FALSE,
20491 9, 12, 4, 5);
20492  
20493 my $button2 = $self->addButton($grid,
20494 'View', 'View the specified buffer line', undef,
20495 7, 8, 5, 6);
20496  
20497 my $button3 = $self->addButton($grid,
20498 'Dump', 'Display the specified buffer line in the \'main\' window', undef,
20499 8, 9, 5, 6);
20500  
20501 my $button4 = $self->addButton($grid,
20502 'Dump last', 'Display the most recent buffer line in the \'main\' window', undef,
20503 9, 11, 5, 6);
20504  
20505 my $button5 = $self->addButton($grid,
20506 'Dump 20', 'Display the most recent 20 buffer lines in the \'main\' window', undef,
20507 11, 12, 5, 6);
20508  
20509 # ->signal_connects
20510  
20511 # 'Update'
20512 $button->signal_connect('clicked' => sub {
20513  
20514 $entry->set_text($axmud::CLIENT->customDisplayBufferSize);
20515 $entry2->set_text($self->session->ivPairs('displayBufferHash'));
20516 $entry3->set_text($self->session->displayBufferCount);
20517  
20518 if (defined $self->session->displayBufferFirst) {
20519  
20520 $entry5->set_text($self->session->displayBufferFirst);
20521 }
20522  
20523 if (defined $self->session->displayBufferLast) {
20524  
20525 $entry6->set_text($self->session->displayBufferLast);
20526 }
20527  
20528 if (defined $self->session->lastDisplayTime) {
20529  
20530 $entry7->set_text($self->session->sessionTime - $self->session->lastDisplayTime);
20531 }
20532 });
20533  
20534 # 'View'
20535 $button2->signal_connect('clicked' => sub {
20536  
20537 my $number = $entry4->get_text();
20538  
20539 if ($self->checkEntryIcon($entry4)) {
20540  
20541 # Open an 'edit' window for the specified buffer line
20542 $self->session->pseudoCmd('editdisplaybuffer ' . $number, $self->pseudoCmdMode);
20543 }
20544 });
20545  
20546 # 'Dump'
20547 $button3->signal_connect('clicked' => sub {
20548  
20549 my $number = $entry4->get_text();
20550  
20551 if ($self->checkEntryIcon($entry4)) {
20552  
20553 # Display the specified buffer line
20554 $self->session->pseudoCmd('dumpdisplaybuffer ' . $number, $self->pseudoCmdMode);
20555 }
20556 });
20557  
20558 # 'Dump last'
20559 $button4->signal_connect('clicked' => sub {
20560  
20561 # Display most recent buffer line
20562 $self->session->pseudoCmd('dumpdisplaybuffer', $self->pseudoCmdMode);
20563 # Show the number of the most recent buffer line
20564 if (defined $self->session->displayBufferLast) {
20565  
20566 $entry4->set_text($self->session->displayBufferLast);
20567 }
20568 });
20569  
20570 # 'Dump 20'
20571 $button5->signal_connect('clicked' => sub {
20572  
20573 my ($start, $stop);
20574  
20575 $stop = $self->session->displayBufferLast;
20576 $start = $stop - 19;
20577 if ($start < 0) {
20578  
20579 $start = 0;
20580 }
20581  
20582 # Display most recent buffer lines
20583 $self->session->pseudoCmd(
20584 'dumpdisplaybuffer ' . $start . ' ' . $stop,
20585 $self->pseudoCmdMode,
20586 );
20587 });
20588  
20589 # Pseudo-click the button to set all the widgets
20590 $button->clicked();
20591  
20592 # Tab complete
20593 return 1;
20594 }
20595  
20596 sub session4Tab {
20597  
20598 # Session4 tab
20599 #
20600 # Expected arguments
20601 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
20602 #
20603 # Return values
20604 # 'undef' on improper arguments
20605 # 1 otherwise
20606  
20607 my ($self, $innerNotebook, $check) = @_;
20608  
20609  
20610 # Check for improper arguments
20611 if (! defined $innerNotebook || defined $check) {
20612  
20613 return $axmud::CLIENT->writeImproper($self->_objClass . '->session4Tab', @_);
20614 }
20615  
20616 # Tab setup
20617 my $grid = $self->addTab('Page _4', $innerNotebook);
20618  
20619 # Session buffer settings
20620 $self->addLabel($grid, '<b>Session buffer settings (2/2)</b>',
20621 0, 12, 0, 1);
20622  
20623 # Left column - instruction buffer
20624 $self->addLabel($grid, '<i>Instruction buffer</i>',
20625 1, 12, 1, 2);
20626  
20627 $self->addLabel($grid, 'Max size',
20628 1, 3, 2, 3);
20629 my $entry = $self->addEntry($grid, undef, FALSE,
20630 3, 6, 2, 3);
20631  
20632 $self->addLabel($grid, 'Current size',
20633 1, 3, 3, 4);
20634 my $entry2 = $self->addEntry($grid, undef, FALSE,
20635 3, 6, 3, 4);
20636  
20637 $self->addLabel($grid, 'Total items processed',
20638 1, 3, 4, 5);
20639 my $entry3 = $self->addEntry($grid, undef, FALSE,
20640 3, 6, 4, 5);
20641  
20642 $self->addLabel($grid, 'Item number',
20643 1, 3, 5, 6);
20644 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
20645 3, 6, 5, 6);
20646  
20647 # Right column - instruction buffer
20648 my $button = $self->addButton($grid,
20649 'Update', 'Update the displayed data', undef,
20650 9, 12, 0, 1);
20651  
20652 $self->addLabel($grid, 'First item #',
20653 7, 9, 2, 3);
20654 my $entry5 = $self->addEntry($grid, undef, FALSE,
20655 9, 12, 2, 3);
20656  
20657 $self->addLabel($grid, 'Last item #',
20658 7, 9, 3, 4);
20659 my $entry6 = $self->addEntry($grid, undef, FALSE,
20660 9, 12, 3, 4);
20661  
20662 $self->addLabel($grid, 'Since last item (secs)',
20663 7, 9, 4, 5);
20664 my $entry7 = $self->addEntry($grid, undef, FALSE,
20665 9, 12, 4, 5);
20666  
20667 my $button2 = $self->addButton($grid,
20668 'View', 'View the specified buffer item', undef,
20669 7, 8, 5, 6);
20670  
20671 my $button3 = $self->addButton($grid,
20672 'Dump', 'Display the specified buffer item in the \'main\' window', undef,
20673 8, 9, 5, 6);
20674  
20675 my $button4 = $self->addButton($grid,
20676 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef,
20677 9, 11, 5, 6);
20678  
20679 my $button5 = $self->addButton($grid,
20680 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef,
20681 11, 12, 5, 6);
20682  
20683 # Left column - world command buffer
20684 $self->addLabel($grid, '<i>World command buffer</i>',
20685 1, 12, 6, 7);
20686  
20687 $self->addLabel($grid, 'Max size',
20688 1, 3, 7, 8);
20689 my $entry8 = $self->addEntry($grid, undef, FALSE,
20690 3, 6, 7, 8);
20691  
20692 $self->addLabel($grid, 'Current size',
20693 1, 3, 8, 9);
20694 my $entry9 = $self->addEntry($grid, undef, FALSE,
20695 3, 6, 8, 9);
20696  
20697 $self->addLabel($grid, 'Total items processed',
20698 1, 3, 9, 10);
20699 my $entry10 = $self->addEntry($grid, undef, FALSE,
20700 3, 6, 9, 10);
20701  
20702 $self->addLabel($grid, 'Item number',
20703 1, 3, 10, 11);
20704 my $entry11 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
20705 3, 6, 10, 11);
20706  
20707 # Right column - world command buffer
20708 $self->addLabel($grid, 'First item #',
20709 7, 9, 7, 8);
20710 my $entry12 = $self->addEntry($grid, undef, FALSE,
20711 9, 12, 7, 8);
20712  
20713 $self->addLabel($grid, 'Last item #',
20714 7, 9, 8, 9);
20715 my $entry13 = $self->addEntry($grid, undef, FALSE,
20716 9, 12, 8, 9);
20717  
20718 $self->addLabel($grid, 'Since last item (secs)',
20719 7, 9, 9, 10);
20720 my $entry14 = $self->addEntry($grid, undef, FALSE,
20721 9, 12, 9, 10);
20722  
20723 my $button6 = $self->addButton($grid,
20724 'View', 'View the specified buffer item', undef,
20725 7, 8, 10, 11);
20726  
20727 my $button7 = $self->addButton($grid,
20728 'Dump', 'Display the specified buffer item in the \'main\' window', undef,
20729 8, 9, 10, 11);
20730  
20731 my $button8 = $self->addButton($grid,
20732 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef,
20733 9, 11, 10, 11);
20734  
20735 my $button9 = $self->addButton($grid,
20736 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef,
20737 11, 12, 10, 11);
20738  
20739 # ->signal_connects
20740  
20741 # 'Update'
20742 $button->signal_connect('clicked' => sub {
20743  
20744 # Instruction buffer
20745 $entry->set_text($axmud::CLIENT->customInstructBufferSize);
20746 $entry2->set_text($self->session->ivPairs('instructBufferHash'));
20747 $entry3->set_text($self->session->instructBufferCount);
20748  
20749 if (defined $self->session->instructBufferFirst) {
20750  
20751 $entry5->set_text($self->session->instructBufferFirst);
20752 }
20753  
20754 if (defined $self->session->instructBufferLast) {
20755  
20756 $entry6->set_text($self->session->instructBufferLast);
20757 }
20758  
20759 if (defined $self->session->lastInstructTime) {
20760  
20761 $entry7->set_text($self->session->sessionTime - $self->session->lastInstructTime);
20762 }
20763  
20764 # World command buffer
20765 $entry8->set_text($axmud::CLIENT->customCmdBufferSize);
20766 $entry9->set_text($self->session->ivPairs('cmdBufferHash'));
20767 $entry10->set_text($self->session->cmdBufferCount);
20768  
20769 if (defined $self->session->cmdBufferFirst) {
20770  
20771 $entry12->set_text($self->session->cmdBufferFirst);
20772 }
20773  
20774 if (defined $self->session->cmdBufferLast) {
20775  
20776 $entry13->set_text($self->session->cmdBufferLast);
20777 }
20778  
20779 if (defined $self->session->lastCmdTime) {
20780  
20781 $entry14->set_text($self->session->sessionTime - $self->session->lastCmdTime);
20782 }
20783 });
20784  
20785 # 'View'
20786 $button2->signal_connect('clicked' => sub {
20787  
20788 my $number = $entry4->get_text();
20789  
20790 if ($self->checkEntryIcon($entry4)) {
20791  
20792 # Open an 'edit' window for the specified buffer item
20793 $self->session->pseudoCmd(
20794 'editinstructionbuffer -s ' . $number,
20795 $self->pseudoCmdMode,
20796 );
20797 }
20798 });
20799  
20800 # 'Dump'
20801 $button3->signal_connect('clicked' => sub {
20802  
20803 my $number = $entry4->get_text();
20804  
20805 if ($self->checkEntryIcon($entry4)) {
20806  
20807 # Display the specified buffer item
20808 $self->session->pseudoCmd(
20809 'dumpinstructionbuffer -s ' . $number,
20810 $self->pseudoCmdMode,
20811 );
20812 }
20813 });
20814  
20815 # 'Dump last'
20816 $button4->signal_connect('clicked' => sub {
20817  
20818 # Display most recent buffer item
20819 $self->session->pseudoCmd('dumpinstructionbuffer -s', $self->pseudoCmdMode);
20820 # Show the number of the most recent buffer item
20821 if (defined $self->session->instructBufferLast) {
20822  
20823 $entry4->set_text($self->session->instructBufferLast);
20824 }
20825 });
20826  
20827 # 'Dump 20'
20828 $button5->signal_connect('clicked' => sub {
20829  
20830 my ($start, $stop);
20831  
20832 $stop = $self->session->instructBufferLast;
20833 $start = $stop - 19;
20834 if ($start < 0) {
20835  
20836 $start = 0;
20837 }
20838  
20839 # Display most recent buffer items
20840 $self->session->pseudoCmd(
20841 'dumpinstructionbuffer ' . $start . ' ' . $stop,
20842 $self->pseudoCmdMode,
20843 );
20844 });
20845  
20846 # 'View'
20847 $button6->signal_connect('clicked' => sub {
20848  
20849 my $number = $entry11->get_text();
20850  
20851 if ($self->checkEntryIcon($entry11)) {
20852  
20853 # Open an 'edit' window for the specified buffer item
20854 $self->session->pseudoCmd('editcommandbuffer -s ' . $number, $self->pseudoCmdMode);
20855 }
20856 });
20857  
20858 # 'Dump'
20859 $button7->signal_connect('clicked' => sub {
20860  
20861 my $number = $entry11->get_text();
20862  
20863 if ($self->checkEntryIcon($entry11)) {
20864  
20865 # Display the specified buffer item
20866 $self->session->pseudoCmd('dumpcommandbuffer -s ' . $number, $self->pseudoCmdMode);
20867 }
20868 });
20869  
20870 # 'Dump last'
20871 $button8->signal_connect('clicked' => sub {
20872  
20873 # Display most recent buffer item
20874 $self->session->pseudoCmd('dumpcommandbuffer -s', $self->pseudoCmdMode);
20875 # Show the number of the most recent buffer item
20876 if (defined $self->session->cmdBufferLast) {
20877  
20878 $entry11->set_text($self->session->cmdBufferLast);
20879 }
20880 });
20881  
20882 # 'Dump 20'
20883 $button9->signal_connect('clicked' => sub {
20884  
20885 my ($start, $stop);
20886  
20887 $stop = $self->session->cmdBufferLast;
20888 $start = $stop - 19;
20889 if ($start < 0) {
20890  
20891 $start = 0;
20892 }
20893  
20894 # Display most recent buffer items
20895 $self->session->pseudoCmd(
20896 'dumpcommandbuffer ' . $start . ' ' . $stop,
20897 $self->pseudoCmdMode,
20898 );
20899 });
20900  
20901 # Pseudo-click the button to set all the widgets
20902 $button->clicked();
20903  
20904 # Tab complete
20905 return 1;
20906 }
20907  
20908 sub interfacesTab {
20909  
20910 # Interfaces tab - called by $self->setupNotebook
20911 #
20912 # Expected arguments
20913 # (none besides $self)
20914 #
20915 # Return values
20916 # 'undef' on improper arguments
20917 # 1 otherwise
20918  
20919 my ($self, $check) = @_;
20920  
20921 # Check for improper arguments
20922 if (defined $check) {
20923  
20924 return $axmud::CLIENT->writeImproper($self->_objClass . '->interfacesTab', @_);
20925 }
20926  
20927 # Tab setup
20928 # Create a notebook within the main one, so that we have two rows of tabs
20929 my $innerNotebook = $self->addInnerNotebookTab('_Interfaces', $self->notebook);
20930  
20931 # Add tabs to the inner notebook
20932 $self->interfaces1Tab($innerNotebook);
20933 $self->interfaces2Tab($innerNotebook, 'trigger', 2);
20934 $self->interfaces2Tab($innerNotebook, 'alias', 3);
20935 $self->interfaces2Tab($innerNotebook, 'macro', 4);
20936 $self->interfaces2Tab($innerNotebook, 'timer', 5);
20937 $self->interfaces2Tab($innerNotebook, 'hook', 6);
20938  
20939 return 1;
20940 }
20941  
20942 sub interfaces1Tab {
20943  
20944 # Interfaces1 tab
20945 #
20946 # Expected arguments
20947 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
20948 #
20949 # Return values
20950 # 'undef' on improper arguments
20951 # 1 otherwise
20952  
20953 my ($self, $innerNotebook, $check) = @_;
20954  
20955 # Local variables
20956 my (
20957 $listType,
20958 @columnList, @list, @comboList, $title,
20959 %comboHash,
20960 );
20961  
20962 # Check for improper arguments
20963 if (! defined $innerNotebook || defined $check) {
20964  
20965 return $axmud::CLIENT->writeImproper($self->_objClass . '->interfaces1Tab', @_);
20966 }
20967  
20968 # Tab setup
20969 my $grid = $self->addTab('Page _1', $innerNotebook);
20970  
20971 # Left column
20972 $self->addLabel($grid, '<b>Active interfaces</b>',
20973 0, 12, 0, 1);
20974 $self->addLabel($grid, '<i>List of interfaces which are currently active</i>',
20975 1, 12, 1, 2);
20976  
20977 # Add a simple list
20978 @columnList = (
20979 '#', 'int',
20980 'Name', 'text',
20981 'Category', 'text',
20982 'Indep', 'bool',
20983 'Enabled', 'bool',
20984 'Associated profile', 'text',
20985 'Cooldown expires (seconds)', 'text',
20986 );
20987  
20988 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
20989 1, 12, 2, 10);
20990  
20991 # Initialise the list
20992 $listType = 'all';
20993 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
20994  
20995 # Add buttons and combos
20996 my $button = $self->addButton($grid,
20997 'Enable', 'Enable the selected active interface', undef,
20998 1, 3, 10, 11);
20999 $button->signal_connect('clicked' => sub {
21000  
21001 my ($name) = $self->getSimpleListData($slWidget, 1);
21002 if (defined $name) {
21003  
21004 # Enable the active interface
21005 $self->session->pseudoCmd('enableactiveinterface ' . $name, $self->pseudoCmdMode);
21006 # Refresh the simple list
21007 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21008 }
21009 });
21010  
21011 my $button2 = $self->addButton($grid,
21012 'Disable', 'Disable the selected active interface', undef,
21013 3, 5, 10, 11);
21014 $button2->signal_connect('clicked' => sub {
21015  
21016 my ($name) = $self->getSimpleListData($slWidget, 1);
21017 if (defined $name) {
21018  
21019 # Disable the active interface
21020 $self->session->pseudoCmd('disableactiveinterface ' . $name, $self->pseudoCmdMode);
21021 # Refresh the simple list
21022 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21023 }
21024 });
21025  
21026 my $button3 = $self->addButton($grid,
21027 'Edit...', 'Edit the selected active interface', undef,
21028 5, 7, 10, 11);
21029 $button3->signal_connect('clicked' => sub {
21030  
21031 my ($number, $interfaceObj);
21032  
21033 ($number) = $self->getSimpleListData($slWidget, 0);
21034 if (defined $number) {
21035  
21036 $interfaceObj = $self->session->ivShow('interfaceNumHash', $number);
21037 if ($interfaceObj) {
21038  
21039 # Open up an 'edit' window to edit the object
21040 $self->createFreeWin(
21041 'Games::Axmud::EditWin::Interface::Active',
21042 $self,
21043 $self->session,
21044 'Edit active ' . $interfaceObj->category . ' interface \''
21045 . $interfaceObj->name . '\'',
21046 $interfaceObj,
21047 FALSE, # Not temporary
21048 );
21049 }
21050  
21051 # Refresh the simple list
21052 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21053 }
21054 });
21055  
21056 # Prepare a list of combo items. The keys are the combo items themselves, the corresponding
21057 # values are arguments to send to $self->interfaces1Tab_refreshList
21058 @list = (
21059 'Numerically' => 'all',
21060 'Alphabetically' => 'alpha',
21061 'Dependent only' => 'dependent',
21062 'Independent only' => 'independent',
21063 'Triggers only' => 'trigger',
21064 'Aliases only' => 'alias',
21065 'Macros only' => 'macro',
21066 'Timers only' => 'timer',
21067 'Hooks only' => 'hook',
21068 );
21069  
21070 do {
21071  
21072 my $key = shift @list;
21073 my $value = shift @list;
21074  
21075 push (@comboList, $key);
21076 $comboHash{$key} = $value;
21077  
21078 } until (! @list);
21079  
21080 # Add the combo
21081 $title = 'View interfaces:';
21082 my $comboBox = $self->addComboBox($grid, undef, \@comboList, $title,
21083 FALSE, # Title, so no 'undef' value seen
21084 9, 12, 10, 11);
21085 $comboBox->signal_connect('changed' => sub {
21086  
21087 my $text = $comboBox->get_active_text();
21088  
21089 if ($text ne $title) {
21090  
21091 # Refresh the simple list
21092 $listType = $comboHash{$text};
21093 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21094 }
21095 });
21096  
21097 my $button4 = $self->addButton($grid,
21098 'Enable all', 'Enable all active interfaces', undef,
21099 1, 4, 11, 12);
21100 $button4->signal_connect('clicked' => sub {
21101  
21102 # Enable all active interfaces
21103 $self->session->pseudoCmd('enableactiveinterface', $self->pseudoCmdMode);
21104 # Refresh the simple list
21105 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21106 });
21107  
21108 my $button5 = $self->addButton($grid,
21109 'Disable all', 'Disable all active interfaces', undef,
21110 4, 7, 11, 12);
21111 $button5->signal_connect('clicked' => sub {
21112  
21113 # Disable all active interfaces
21114 $self->session->pseudoCmd('disableactiveinterface', $self->pseudoCmdMode);
21115 # Refresh the simple list
21116 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21117 });
21118  
21119 my $button6 = $self->addButton($grid,
21120 'Update list', 'Update the list of interfaces', undef,
21121 10, 12, 11, 12);
21122 $button6->signal_connect('clicked' => sub {
21123  
21124 # Refresh the simple list
21125 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
21126 });
21127  
21128 # Tab complete
21129 return 1;
21130 }
21131  
21132 sub interfaces1Tab_refreshList {
21133  
21134 # Resets the simple list displayed by $self->interface1Tab and ->interface2Tab
21135 #
21136 # Expected arguments
21137 # $slWidget - The GA::Obj::SimpleList
21138 # $columns - The number of columns
21139 # $type - A string desribing the subset of active interfaces to show - set to
21140 # 'all', 'alpha', 'dependent', 'independent', 'trigger', 'alias',
21141 # 'macro', 'timer', 'hook'
21142 #
21143 # Return values
21144 # 'undef' on improper arguments
21145 # 1 otherwise
21146  
21147 my ($self, $slWidget, $columns, $type, $check) = @_;
21148  
21149 # Local variables
21150 my (
21151 $iv,
21152 @modList, @sortedList, @dataList,
21153 );
21154  
21155 # Check for improper arguments
21156 if (! defined $slWidget || ! defined $columns || ! defined $type || defined $check) {
21157  
21158 return $axmud::CLIENT->writeImproper(
21159 $self->_objClass . '->interfaces1Tab_refreshList',
21160 @_,
21161 );
21162 }
21163  
21164 # Get a list of active interfaces, and then remove any that we don't want to show (according
21165 # to the value of $type)
21166 foreach my $obj ($self->session->ivValues('interfaceHash')) {
21167  
21168 if (
21169 $type eq 'all'
21170 || $type eq 'alpha'
21171 || ($type eq 'dependent' && ! $obj->indepFlag)
21172 || ($type eq 'independent' && $obj->indepFlag)
21173 || ($obj->category eq $type) # 'trigger', 'alias', etc
21174 ) {
21175 push (@modList, $obj);
21176 }
21177 }
21178  
21179 # Sort the list, as appropriate. The default is to sort numerically
21180 if ($type eq 'all') {
21181  
21182 @sortedList = sort {$a->number <=> $b->number} (@modList);
21183  
21184 } elsif ($type eq 'alpha' || $type eq 'dependent' || $type eq 'independent') {
21185  
21186 @sortedList = sort {lc($a->name) cmp lc($b->name)} (@modList);
21187  
21188 } else {
21189  
21190 $iv = $type . 'OrderList'; # e.g. 'triggerOrderList'
21191  
21192 foreach my $number ($self->session->$iv) {
21193  
21194 push (@sortedList, $self->session->ivShow('interfaceNumHash', $number));
21195 }
21196 }
21197  
21198 # Compile the simple list data
21199 foreach my $obj (@sortedList) {
21200  
21201 my $seconds;
21202  
21203 if ($obj->category ne 'timer') {
21204  
21205 $iv = $obj->category . 'CooldownHash';
21206 $seconds = $self->session->ivShow($iv, $obj->number);
21207 if (defined $seconds) {
21208  
21209 $seconds = $seconds - $self->session->sessionTime;
21210 if ($seconds < 0) {
21211  
21212 # Already expired, but IV not updated yet
21213 $seconds = undef;
21214  
21215 } else {
21216  
21217 $seconds = sprintf("%.1f", $seconds);
21218 }
21219 }
21220 }
21221  
21222 push (@dataList,
21223 $obj->number,
21224 $obj->name,
21225 $obj->category,
21226 $obj->indepFlag,
21227 $obj->enabledFlag,
21228 $obj->assocProf,
21229 $seconds,
21230 );
21231 }
21232  
21233 # Reset the simple list
21234 $self->resetListData($slWidget, [@dataList], $columns);
21235  
21236 return 1;
21237 }
21238  
21239 sub interfaces2Tab {
21240  
21241 # Interfaces2 tab
21242 #
21243 # Expected arguments
21244 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
21245 # $category - The category of interface to show: 'trigger', 'alias', 'macro',
21246 # 'timer' or 'hook'
21247 # $number - The page number to use
21248 #
21249 # Return values
21250 # 'undef' on improper arguments
21251 # 1 otherwise
21252  
21253 my ($self, $innerNotebook, $category, $number, $check) = @_;
21254  
21255 # Local variables
21256 my @columnList;
21257  
21258 # Check for improper arguments
21259 if (
21260 ! defined $innerNotebook || ! defined $category || ! defined $number || defined $check
21261 ) {
21262 return $axmud::CLIENT->writeImproper($self->_objClass . '->interfaces2Tab', @_);
21263 }
21264  
21265 # Tab setup
21266 my $grid = $self->addTab('Page _' . $number, $innerNotebook);
21267  
21268 # Left column
21269 $self->addLabel($grid, '<b>Active ' . $category . ' interfaces</b>',
21270 0, 12, 0, 1);
21271 $self->addLabel(
21272 $grid, '<i>List of ' . $category . ' interfaces, in the order in which they are'
21273 . ' consulted</i>',
21274 1, 12, 1, 2);
21275  
21276 # Add a simple list
21277 @columnList = (
21278 '#', 'int',
21279 'Name', 'text',
21280 'Category', 'text',
21281 'Indep', 'bool',
21282 'Enabled', 'bool',
21283 'Associated profile', 'text',
21284 'Cooldown expires (seconds)', 'text',
21285 );
21286  
21287 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
21288 1, 12, 2, 10);
21289  
21290 # Initialise the list
21291 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category);
21292  
21293 # Add buttons and combos
21294 my $button = $self->addButton($grid,
21295 'Enable', 'Enable the selected active interface', undef,
21296 1, 3, 10, 11);
21297 $button->signal_connect('clicked' => sub {
21298  
21299 my ($name) = $self->getSimpleListData($slWidget, 1);
21300 if (defined $name) {
21301  
21302 # Enable the active interface
21303 $self->session->pseudoCmd('enableactiveinterface ' . $name, $self->pseudoCmdMode);
21304  
21305 # Refresh the simple list
21306 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category);
21307 }
21308 });
21309  
21310 my $button2 = $self->addButton($grid,
21311 'Disable', 'Disable the selected active interface', undef,
21312 3, 5, 10, 11);
21313 $button2->signal_connect('clicked' => sub {
21314  
21315 my ($name) = $self->getSimpleListData($slWidget, 1);
21316 if (defined $name) {
21317  
21318 # Enable the active interface
21319 $self->session->pseudoCmd('disableactiveinterface ' . $name, $self->pseudoCmdMode);
21320  
21321 # Refresh the simple list
21322 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category);
21323 }
21324 });
21325  
21326 my $button3 = $self->addButton($grid,
21327 'Edit...', 'Edit the selected active interface', undef,
21328 5, 7, 10, 11);
21329 $button3->signal_connect('clicked' => sub {
21330  
21331 my ($number, $interfaceObj);
21332  
21333 ($number) = $self->getSimpleListData($slWidget, 0);
21334 if (defined $number) {
21335  
21336 $interfaceObj = $self->session->ivShow('interfaceNumHash', $number);
21337 if ($interfaceObj) {
21338  
21339 # Open up an 'edit' window to edit the object
21340 $self->createFreeWin(
21341 'Games::Axmud::EditWin::Interface::Active',
21342 $self,
21343 $self->session,
21344 'Edit active ' . $interfaceObj->category . ' interface \''
21345 . $interfaceObj->name . '\'',
21346 $interfaceObj,
21347 FALSE, # Not temporary
21348 );
21349 }
21350  
21351 # Refresh the simple list
21352 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category);
21353 }
21354 });
21355  
21356 my $button4 = $self->addButton($grid,
21357 'Move up', 'Move the selected active interface up the list', undef,
21358 8, 10, 10, 11);
21359 $button4->signal_connect('clicked' => sub {
21360  
21361 my ($number, $iv, $posn);
21362  
21363 ($number) = $self->getSimpleListData($slWidget, 0);
21364 if (defined $number) {
21365  
21366 # Get the interface's current position in the list
21367 $iv = $category . 'OrderList'; # e.g. 'triggerOrderList'
21368 $posn = $self->session->ivFind($iv, $number);
21369 # Can't move the interface if it's already at the top of the list
21370 if (defined $posn && $posn != 0) {
21371  
21372 # Move the active interface. The client command understands the position to be
21373 # a number in the range 1..., whereas $posn is an index in the range 0...,
21374 # so to move the interface up one position, we just use $posn
21375 $self->session->pseudoCmd(
21376 'moveactiveinterface ' . $number . ' ' . $posn,
21377 $self->pseudoCmdMode,
21378 );
21379  
21380 # Refresh the simple list
21381 $self->interfaces1Tab_refreshList(
21382 $slWidget,
21383 scalar (@columnList / 2),
21384 $category,
21385 );
21386  
21387 # The interface should still be highlighted, after being moved up
21388 $slWidget->select($posn - 1);
21389 }
21390 }
21391 });
21392  
21393 my $button5 = $self->addButton($grid,
21394 'Move down', 'Move the selected active interface down the list', undef,
21395 10, 12, 10, 11);
21396 $button5->signal_connect('clicked' => sub {
21397  
21398 my ($number, $iv, $posn);
21399  
21400 ($number) = $self->getSimpleListData($slWidget, 0);
21401 if (defined $number) {
21402  
21403 # Get the interface's current position in the list
21404 $iv = $category . 'OrderList'; # e.g. 'triggerOrderList'
21405 $posn = $self->session->ivFind($iv, $number);
21406 # Can't move the interface if it's already at the bottom of the list
21407 if (defined $posn && $posn < ((scalar $self->session->$iv) - 1)) {
21408  
21409 # Move the active interface. The client command understands the position to be
21410 # a number in the range 1..., whereas $posn is an index in the range 0...,
21411 # so to move the interface down one position, we must add 2 to $posn
21412 $self->session->pseudoCmd(
21413 'moveactiveinterface ' . $number . ' ' . ($posn + 2),
21414 $self->pseudoCmdMode,
21415 );
21416  
21417 # Refresh the simple list
21418 $self->interfaces1Tab_refreshList(
21419 $slWidget,
21420 scalar (@columnList / 2),
21421 $category,
21422 );
21423  
21424 # The interface should still be highlighted, after being moved down
21425 $slWidget->select($posn + 1);
21426 }
21427 }
21428 });
21429  
21430 my $button6 = $self->addButton(
21431 $grid,
21432 'Edit ' . $category . ' interface model...',
21433 'Edit the model for this type of interface',
21434 undef,
21435 1, 5, 11, 12);
21436 $button6->signal_connect('clicked' => sub {
21437  
21438 my $obj = $axmud::CLIENT->ivShow('interfaceModelHash', 'trigger');
21439 if ($obj) {
21440  
21441 # Open up an 'edit' window to edit the object
21442 $self->createFreeWin(
21443 'Games::Axmud::EditWin::InterfaceModel',
21444 $self,
21445 $self->session,
21446 'Edit ' . $category . ' interface model',
21447 $obj,
21448 FALSE, # Not temporary
21449 );
21450 }
21451 });
21452  
21453 my $button7 = $self->addButton($grid,
21454 'Update list', 'Update the list of interfaces', undef,
21455 10, 12, 11, 12);
21456 $button7->signal_connect('clicked' => sub {
21457  
21458 # Refresh the simple list
21459 $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category);
21460 });
21461  
21462 # Tab complete
21463 return 1;
21464 }
21465  
21466 sub tasksTab {
21467  
21468 # Tasks tab
21469 #
21470 # Expected arguments
21471 # (none besides $self)
21472 #
21473 # Return values
21474 # 'undef' on improper arguments
21475 # 1 otherwise
21476  
21477 my ($self, $check) = @_;
21478  
21479 # Local variables
21480 my @columnList;
21481  
21482 # Check for improper arguments
21483 if (defined $check) {
21484  
21485 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab', @_);
21486 }
21487  
21488 # Tab setup
21489 my $grid = $self->addTab('_Tasks', $self->notebook);
21490  
21491 # Current tasks
21492 $self->addLabel($grid, '<b>Current tasks</b>',
21493 0, 12, 0, 1);
21494 $self->addLabel($grid,
21495 '<i>List of tasks in this session\'s current tasklist (showing task window status)</i>',
21496 1, 12, 1, 2);
21497  
21498 # Add a simple list
21499 @columnList = (
21500 'Task', 'text',
21501 'Allowed', 'bool',
21502 'Required', 'bool',
21503 'Open on start', 'bool',
21504 'Open now', 'bool',
21505 'Preferred locations', 'text',
21506 'Use winmap', 'text',
21507 );
21508  
21509 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
21510 1, 12, 2, 10);
21511  
21512 # Refresh the list
21513 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21514  
21515 # Add buttons to open/close windows
21516 my $button = $self->addButton($grid,
21517 'Open window', 'Open a task window for the selected task (if allowed)', undef,
21518 1, 3, 10, 11);
21519 $button->signal_connect('clicked' => sub {
21520  
21521 my ($task) = $self->getSimpleListData($slWidget, 0);
21522 if (defined $task) {
21523  
21524 # Open a task window for this task
21525 $self->session->pseudoCmd(
21526 'opentaskwindow ' . $task,
21527 $self->pseudoCmdMode,
21528 );
21529  
21530 # Refresh the simple list
21531 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21532 }
21533 });
21534  
21535 my $button2 = $self->addButton($grid,
21536 'Open all windows', 'Open task windows for all tasks (where possible)', undef,
21537 3, 5, 10, 11);
21538 $button2->signal_connect('clicked' => sub {
21539  
21540 # Open a task window for all tasks
21541 $self->session->pseudoCmd('opentaskwindow -a', $self->pseudoCmdMode);
21542  
21543 # Refresh the simple list
21544 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21545 });
21546  
21547 my $button3 = $self->addButton($grid,
21548 'Close window', 'Closes the task window for the selected task (if open)', undef,
21549 5, 7, 10, 11);
21550 $button3->signal_connect('clicked' => sub {
21551  
21552 my ($task) = $self->getSimpleListData($slWidget, 0);
21553 if (defined $task) {
21554  
21555 # Close the task window for this task
21556 $self->session->pseudoCmd(
21557 'closetaskwindow ' . $task,
21558 $self->pseudoCmdMode,
21559 );
21560  
21561 # Refresh the simple list
21562 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21563 }
21564 });
21565  
21566 my $button4 = $self->addButton($grid,
21567 'Close all windows', 'Close task windows for all tasks (when open)', undef,
21568 7, 9, 10, 11);
21569 $button4->signal_connect('clicked' => sub {
21570  
21571 # Close the task window for all tasks
21572 $self->session->pseudoCmd('closetaskwindow -a', $self->pseudoCmdMode);
21573  
21574 # Refresh the simple list
21575 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21576 });
21577  
21578 my $button5 = $self->addButton($grid,
21579 'Refresh list', 'Refresh the list of tasks and their task windows', undef,
21580 10, 12, 10, 11);
21581 $button5->signal_connect('clicked' => sub {
21582  
21583 # Refresh the simple list
21584 $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2));
21585 });
21586  
21587 # Tab complete
21588 return 1;
21589 }
21590  
21591 sub tasksTab_refreshList {
21592  
21593 # Called by $self->tasksTab to refresh the GA::Obj::SimpleList
21594 #
21595 # Expected arguments
21596 # $slWidget - The GA::Obj::SimpleList
21597 # $columns - The number of columns in the list
21598 #
21599 # Return values
21600 # 'undef' on improper arguments
21601 # 1 otherwise
21602  
21603 my ($self, $slWidget, $columns, $check) = @_;
21604  
21605 # Local variables
21606 my (@sortedList, @dataList);
21607  
21608 # Check for improper arguments
21609 if (! defined $slWidget || ! defined $columns || defined $check) {
21610  
21611 return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab_refreshList', @_);
21612 }
21613  
21614 # Get a sorted list of current tasks
21615 @sortedList = sort {lc($a->name) cmp lc($b->name)}
21616 ($self->session->ivValues('currentTaskHash'));
21617  
21618 # Compile the simple list data
21619 foreach my $obj (@sortedList) {
21620  
21621 push (@dataList,
21622 $obj->name,
21623 $obj->allowWinFlag,
21624 $obj->requireWinFlag,
21625 $obj->startWithWinFlag,
21626 $obj->taskWinFlag,
21627 join(' ', $obj->winPreferList),
21628 $obj->winmap,
21629 );
21630 }
21631  
21632 # Reset the simple list
21633 $self->resetListData($slWidget, [@dataList], $columns);
21634  
21635 return 1;
21636 }
21637  
21638 sub recordingTab {
21639  
21640 # Recording tab
21641 #
21642 # Expected arguments
21643 # (none besides $self)
21644 #
21645 # Return values
21646 # 'undef' on improper arguments
21647 # 1 otherwise
21648  
21649 my ($self, $check) = @_;
21650  
21651 # Local variables
21652 my (@columnList, @widgetList);
21653  
21654 # Check for improper arguments
21655 if (defined $check) {
21656  
21657 return $axmud::CLIENT->writeImproper($self->_objClass . '->recordingTab', @_);
21658 }
21659  
21660 # Tab setup
21661 my $grid = $self->addTab('_Recording', $self->notebook);
21662  
21663 # Current tasks
21664 $self->addLabel($grid, '<b>Current recording</b>',
21665 0, 12, 0, 1);
21666  
21667 my $checkButton = $self->addCheckButton($grid, 'Recording in progress', undef, FALSE,
21668 1, 6, 1, 2);
21669 my $checkButton2 = $self->addCheckButton($grid, 'Recording paused', undef, FALSE,
21670 7, 12, 1, 2);
21671  
21672 # (Other local variables required as arguments in calls to $self->recordingTab_refreshList)
21673 my ($entry, $entry2, $entry3, $entry4);
21674  
21675 # Add a simple list
21676 @columnList = (
21677 'Line', 'text', # When no recording in progress, don't want '0' to appear in column
21678 'Insert', 'text',
21679 'Instruction', 'text',
21680 );
21681  
21682 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
21683 1, 12, 2, 6);
21684  
21685 # Add buttons to open/close windows
21686 $self->addLabel($grid, '<b>Commands:</b> ',
21687 1, 3, 6, 7);
21688 $self->addLabel($grid,
21689 '<b>></b> <i>world command,</i> '
21690 . '<b>;</b> <i>client command,</i> '
21691 . '<b>#</b> <i>\'main\' window comment</i>',
21692 3, 12, 6, 7);
21693  
21694 $self->addLabel($grid, '<b>Breaks:</b> ',
21695 1, 3, 7, 8);
21696 $self->addLabel($grid,
21697 '<b>@</b> <i>ordinary break,</i> '
21698 . '<b>t</b> <i>trigger break,</i> '
21699 . '<b>p</b> <i>pause break,</i> '
21700 . '<b>l</b> <i>locator break</i>',
21701 3, 12, 7, 8);
21702  
21703 my $button = $self->addButton($grid,
21704 'Start/stop', 'Starts or stops the current recording', undef,
21705 1, 3, 8, 9);
21706 # (->signal_connect appears at the bottom)
21707  
21708 my $button2 = $self->addButton($grid,
21709 'Pause/resume', 'Pauses or resumes the current recording', undef,
21710 3, 5, 8, 9);
21711 $button2->signal_connect('clicked' => sub {
21712  
21713 # Pause/resume the recording
21714 $self->session->pseudoCmd('pauserecording', $self->pseudoCmdMode);
21715  
21716 # Refresh the simple list and reset widgets
21717 $self->recordingTab_refreshList(
21718 $slWidget,
21719 scalar (@columnList / 2),
21720 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21721 );
21722 });
21723  
21724 my $button3 = $self->addButton($grid,
21725 'Add as mission', 'Save this recording as a new mission', undef,
21726 7, 10, 8, 9);
21727 $button3->signal_connect('clicked' => sub {
21728  
21729 my ($name, $descrip);
21730  
21731 if ($self->session->recordingList) {
21732  
21733 # Prompt the user for a mission name (and optional description)
21734 ($name, $descrip) = $self->showDoubleEntryDialogue(
21735 'Add mission',
21736 'Add a name for the mission',
21737 '(Optional) add a description',
21738 );
21739  
21740 # Add the mission
21741 if ($name && $descrip) {
21742  
21743 $self->session->pseudoCmd(
21744 'add mission <' . $name . '> <' . $descrip . '>',
21745 $self->pseudoCmdMode,
21746 );
21747  
21748 } elsif ($name) {
21749  
21750 $self->session->pseudoCmd('add mission <' . $name . '>', $self->pseudoCmdMode);
21751 }
21752 }
21753  
21754 # Refresh the simple list and reset widgets
21755 $self->recordingTab_refreshList(
21756 $slWidget,
21757 scalar (@columnList / 2),
21758 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21759 );
21760 });
21761  
21762 my $button4 = $self->addButton($grid,
21763 'Update list', 'Update the recording list', undef,
21764 10, 12, 8, 9);
21765 $button4->signal_connect('clicked' => sub {
21766  
21767 # Refresh the simple list and reset widgets
21768 $self->recordingTab_refreshList(
21769 $slWidget,
21770 scalar (@columnList / 2),
21771 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21772 );
21773 });
21774  
21775 $self->addLabel($grid, 'Instruction:',
21776 1, 3, 9, 10);
21777 $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
21778 3, 6, 9, 10);
21779  
21780 my $button5 = $self->addButton($grid,
21781 'World cmd', 'Add a world command at the insertion point', undef,
21782 6, 8, 9, 10);
21783 $button5->signal_connect('clicked' => sub {
21784  
21785 if ($self->checkEntryIcon($entry)) {
21786  
21787 # Add the world command
21788 $self->session->pseudoCmd(
21789 'worldcommand ' . $entry->get_text(),
21790 $self->pseudoCmdMode,
21791 );
21792  
21793 # Refresh the simple list and reset widgets
21794 $self->recordingTab_refreshList(
21795 $slWidget,
21796 scalar (@columnList / 2),
21797 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21798 );
21799 }
21800 });
21801  
21802 my $button6 = $self->addButton($grid,
21803 'Client cmd', 'Add a client command at the insertion point', undef,
21804 8, 10, 9, 10);
21805 $button6->signal_connect('clicked' => sub {
21806  
21807 if ($self->checkEntryIcon($entry)) {
21808  
21809 # Add the client command
21810 $self->session->pseudoCmd(
21811 'clientcommand ' . $entry->get_text(),
21812 $self->pseudoCmdMode,
21813 );
21814  
21815 # Refresh the simple list and reset widgets
21816 $self->recordingTab_refreshList(
21817 $slWidget,
21818 scalar (@columnList / 2),
21819 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21820 );
21821 }
21822 });
21823  
21824 my $button7 = $self->addButton($grid,
21825 'Comment', 'Add a \'main\' window comment at the insertion point', undef,
21826 10, 12, 9, 10);
21827 $button7->signal_connect('clicked' => sub {
21828  
21829 if ($self->checkEntryIcon($entry)) {
21830  
21831 # Add the client command
21832 $self->session->pseudoCmd(
21833 'clientcommand ' . $entry->get_text(),
21834 $self->pseudoCmdMode,
21835 );
21836  
21837 # Refresh the simple list and reset widgets
21838 $self->recordingTab_refreshList(
21839 $slWidget,
21840 scalar (@columnList / 2),
21841 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21842 );
21843 }
21844 });
21845  
21846 $self->addLabel($grid, 'Pattern/interval:',
21847 1, 3, 10, 11);
21848 $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
21849 3, 5, 10, 11);
21850  
21851 my $button8 = $self->addButton($grid,
21852 'Break',
21853 'Add an ordinary break at the insertion point',
21854 undef,
21855 5, 6, 10, 11);
21856 $button8->signal_connect('clicked' => sub {
21857  
21858 # Add the ordinary break
21859 $self->session->pseudoCmd('break', $self->pseudoCmdMode);
21860  
21861 # Refresh the simple list and reset widgets
21862 $self->recordingTab_refreshList(
21863 $slWidget,
21864 scalar (@columnList / 2),
21865 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21866 );
21867 });
21868  
21869 my $button9 = $self->addButton($grid,
21870 'Trigger break',
21871 'Add a trigger break at the insertion point, using the specified pattern',
21872 undef,
21873 6, 8, 10, 11);
21874 $button9->signal_connect('clicked' => sub {
21875  
21876 if ($self->checkEntryIcon($entry2)) {
21877  
21878 # Add the client command
21879 $self->session->pseudoCmd(
21880 'break -t ' . $entry2->get_text(),
21881 $self->pseudoCmdMode,
21882 );
21883  
21884 # Refresh the simple list and reset widgets
21885 $self->recordingTab_refreshList(
21886 $slWidget,
21887 scalar (@columnList / 2),
21888 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21889 );
21890 }
21891 });
21892  
21893 my $button10 = $self->addButton($grid,
21894 'Pause break',
21895 'Add a pause break at the insertion point, using the specified interval',
21896 undef,
21897 8, 10, 10, 11);
21898 $button10->signal_connect('clicked' => sub {
21899  
21900 if ($self->checkEntryIcon($entry2)) {
21901  
21902 # Add the trigger break
21903 $self->session->pseudoCmd(
21904 'break -p ' . $entry2->get_text(),
21905 $self->pseudoCmdMode,
21906 );
21907  
21908 # Refresh the simple list and reset widgets
21909 $self->recordingTab_refreshList(
21910 $slWidget,
21911 scalar (@columnList / 2),
21912 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21913 );
21914 }
21915 });
21916  
21917 my $button11 = $self->addButton($grid,
21918 'Locator break',
21919 'Add a pause break at the insertion point, using the specified interval',
21920 undef,
21921 10, 12, 10, 11);
21922 $button11->signal_connect('clicked' => sub {
21923  
21924 # Add the locator break
21925 $self->session->pseudoCmd('break -l', $self->pseudoCmdMode);
21926  
21927 # Refresh the simple list and reset widgets
21928 $self->recordingTab_refreshList(
21929 $slWidget,
21930 scalar (@columnList / 2),
21931 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21932 );
21933 });
21934  
21935 $self->addLabel($grid, 'Insertion point:',
21936 1, 3, 11, 12);
21937 $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
21938 3, 5, 11, 12);
21939  
21940 my $button12 = $self->addButton($grid,
21941 'Set',
21942 'Sets the insertion point (use 0 to move it to the end)',
21943 undef,
21944 5, 6, 11, 12);
21945 $button12->signal_connect('clicked' => sub {
21946  
21947 if ($self->checkEntryIcon($entry3)) {
21948  
21949 # Set the insertion point
21950 $self->session->pseudoCmd(
21951 'insertrecording ' . $entry3->get_text(),
21952 $self->pseudoCmdMode,
21953 );
21954  
21955 # Refresh the simple list and reset widgets
21956 $self->recordingTab_refreshList(
21957 $slWidget,
21958 scalar (@columnList / 2),
21959 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21960 );
21961 }
21962 });
21963  
21964 my $button13 = $self->addButton($grid,
21965 'Reset',
21966 'Moves the insertion point to the end',
21967 undef,
21968 6, 8, 11, 12);
21969 $button13->signal_connect('clicked' => sub {
21970  
21971 # Move the insertion point to the end
21972 $self->session->pseudoCmd('insertrecording', $self->pseudoCmdMode);
21973  
21974 # Refresh the simple list and reset widgets
21975 $self->recordingTab_refreshList(
21976 $slWidget,
21977 scalar (@columnList / 2),
21978 $checkButton, $checkButton2, $entry, $entry2, $entry3,
21979 );
21980 });
21981  
21982 my $button14 = $self->addButton($grid,
21983 'Delete selected line',
21984 'Deletes the selected line',
21985 undef,
21986 8, 12, 11, 12);
21987 $button14->signal_connect('clicked' => sub {
21988  
21989 my ($number) = $self->getSimpleListData($slWidget, 0);
21990 if (defined $number) {
21991  
21992 # Delete the selected line
21993 $self->session->pseudoCmd('deleterecording ' . $number, $self->pseudoCmdMode);
21994  
21995 # Refresh the simple list and reset widgets
21996 $self->recordingTab_refreshList(
21997 $slWidget,
21998 scalar (@columnList / 2),
21999 $checkButton, $checkButton2, $entry, $entry2, $entry3,
22000 );
22001 }
22002 });
22003  
22004 # Now we can initialise the list
22005 $self->recordingTab_refreshList(
22006 $slWidget,
22007 scalar (@columnList / 2),
22008 $checkButton, $checkButton2, $entry, $entry2, $entry3,
22009 );
22010  
22011 # If there is no recording in progress, many widgets begin desensitised
22012 @widgetList = (
22013 $button2, $button5, $button6, $button7, $button8, $button9, $button10, $button11,
22014 $button12, $button13, $button14, $entry, $entry2, $entry3,
22015 );
22016  
22017 if (! $self->session->recordingFlag) {
22018  
22019 $self->desensitiseWidgets(@widgetList);
22020 }
22021  
22022 # Finally, add a ->signal_connect for the 'Start/stop' button
22023 $button->signal_connect('clicked' => sub {
22024  
22025 # Start/stop the recording
22026 $self->session->pseudoCmd('record', $self->pseudoCmdMode);
22027  
22028 # When there is no recording in progress, most buttons are desensitised
22029 if ($self->session->recordingFlag) {
22030 $self->sensitiseWidgets(@widgetList);
22031 } else {
22032 $self->desensitiseWidgets(@widgetList);
22033 }
22034  
22035 # Refresh the simple list and reset widgets
22036 $self->recordingTab_refreshList(
22037 $slWidget,
22038 scalar (@columnList / 2),
22039 $checkButton, $checkButton2, $entry, $entry2, $entry3,
22040 );
22041 });
22042  
22043 # Tab complete
22044 return 1;
22045 }
22046  
22047 sub recordingTab_refreshList {
22048  
22049 # Called by $self->recordingTab to refresh the GA::Obj::SimpleList
22050 #
22051 # Expected arguments
22052 # $slWidget - The GA::Obj::SimpleList
22053 # $columns - The number of columns in the list
22054 # $checkButton, $checkButton2, $entry, $entry2, $entry3
22055 # - Widgets which must be updated at the same time as the simple list
22056 #
22057 # Return values
22058 # 'undef' on improper arguments
22059 # 1 otherwise
22060  
22061 my (
22062 $self, $slWidget, $columns, $checkButton, $checkButton2, $entry, $entry2, $entry3,
22063 $check
22064 ) = @_;
22065  
22066 # Local variables
22067 my (@list, @dataList);
22068  
22069 # Check for improper arguments
22070 if (
22071 ! defined $slWidget || ! defined $columns || ! defined $checkButton
22072 || ! defined $checkButton2 || ! defined $entry || ! defined $entry2 || ! defined $entry3
22073 || defined $check
22074 ) {
22075 return $axmud::CLIENT->writeImproper(
22076 $self->_objClass . '->recordingTab_refreshList',
22077 @_,
22078 );
22079 }
22080  
22081 # Import the recording list
22082 @list = $self->session->recordingList;
22083 if (@list) {
22084  
22085 # Compile the simple list data
22086 for (my $count = 0; $count < (scalar @list); $count++) {
22087  
22088 my $flag;
22089  
22090 # (If ->recordingPosn is 'undef', new lines are just added to the end of the list)
22091 if ($self->session->recordingPosn && $count == $self->session->recordingPosn) {
22092 $flag = '>>>';
22093 } else {
22094 $flag = '';
22095 }
22096  
22097 push (@dataList, ($count + 1), $flag, $list[$count]);
22098 }
22099 }
22100  
22101 # If ->recordingPosn is 'undef', add a blank line to the end of the simple list
22102 if (! $self->session->recordingPosn) {
22103  
22104 push (@dataList, '', '>>>', '');
22105 }
22106  
22107 # Reset the simple list
22108 $self->resetListData($slWidget, [@dataList], $columns);
22109  
22110 # Update other widgets
22111 $checkButton->set_active($self->session->recordingFlag);
22112 $checkButton2->set_active($self->session->recordingPausedFlag);
22113 $self->resetEntryBoxes($entry, $entry2, $entry3);
22114  
22115 return 1;
22116 }
22117  
22118 sub protocolsTab {
22119  
22120 # Protocols tab - called by $self->setupNotebook
22121 #
22122 # Expected arguments
22123 # (none besides $self)
22124 #
22125 # Return values
22126 # 'undef' on improper arguments
22127 # 1 otherwise
22128  
22129 my ($self, $check) = @_;
22130  
22131 # Check for improper arguments
22132 if (defined $check) {
22133  
22134 return $axmud::CLIENT->writeImproper($self->_objClass . '->protocolsTab', @_);
22135 }
22136  
22137 # Tab setup
22138 # Create a notebook within the main one, so that we have two rows of tabs
22139 my $innerNotebook = $self->addInnerNotebookTab('_Protocols', $self->notebook);
22140  
22141 # Add tabs to the inner notebook
22142 $self->protocols1Tab($innerNotebook);
22143 $self->protocols2Tab($innerNotebook);
22144 $self->protocols3Tab($innerNotebook);
22145  
22146 return 1;
22147 }
22148  
22149 sub protocols1Tab {
22150  
22151 # Protocols1 tab
22152 #
22153 # Expected arguments
22154 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22155 #
22156 # Return values
22157 # 'undef' on improper arguments
22158 # 1 otherwise
22159  
22160 my ($self, $innerNotebook, $check) = @_;
22161  
22162 # Check for improper arguments
22163 if (! defined $innerNotebook || defined $check) {
22164  
22165 return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols1Tab', @_);
22166 }
22167  
22168 # Tab setup
22169 my $grid = $self->addTab('Page _1', $innerNotebook);
22170  
22171 # Telnet option negotiations
22172 $self->addLabel($grid, '<b>Telnet option negotiations</b>',
22173 0, 12, 0, 1);
22174 $self->addLabel(
22175 $grid,
22176 '<i>Current status of telnet options for this session (checkbutton selected if protocol'
22177 . ' is enabled generally)</i>',
22178 1, 12, 1, 2);
22179  
22180 my $checkButton = $self->addCheckButton($grid, 'ECHO (hide passwords)', undef, FALSE,
22181 1, 3, 2, 3);
22182 my $entry = $self->addEntry($grid, undef, FALSE,
22183 3, 12, 2, 3);
22184  
22185 my $checkButton2 = $self->addCheckButton($grid, 'SGA (Suppress Go Ahead)', undef, FALSE,
22186 1, 3, 3, 4);
22187 my $entry2 = $self->addEntry($grid, undef, FALSE,
22188 3, 12, 3, 4);
22189  
22190 my $checkButton3 = $self->addCheckButton(
22191 $grid, 'TTYPE (detect Terminal Type)', undef, FALSE,
22192 1, 3, 4, 5);
22193 my $entry3 = $self->addEntry($grid, undef, FALSE,
22194 3, 12, 4, 5);
22195  
22196 my $checkButton4 = $self->addCheckButton(
22197 $grid, 'EOR (negotiate End Of Record)', undef, FALSE,
22198 1, 3, 5, 6);
22199 my $entry4 = $self->addEntry($grid, undef, FALSE,
22200 3, 12, 5, 6);
22201  
22202 my $checkButton5 = $self->addCheckButton(
22203 $grid, 'NAWS (Negotiate About Window Size)', undef, FALSE,
22204 1, 3, 6, 7);
22205 my $entry5 = $self->addEntry($grid, undef, FALSE,
22206 3, 12, 6, 7);
22207  
22208 my $checkButton6 = $self->addCheckButton(
22209 $grid, 'NEW-ENVIRON (New Environment option)', undef, FALSE,
22210 1, 3, 7, 8);
22211 my $entry6 = $self->addEntry($grid, undef, FALSE,
22212 3, 12, 7, 8);
22213  
22214 my $checkButton7 = $self->addCheckButton(
22215 $grid, 'CHARSET (Character Set and translation)', undef, FALSE,
22216 1, 3, 8, 9);
22217 my $entry7 = $self->addEntry($grid, undef, FALSE,
22218 3, 12, 8, 9);
22219  
22220 $self->protocols1Tab_updateWidgets(
22221 $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton,
22222 $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22223 $checkButton7,
22224 );
22225  
22226 my $button = $self->addButton($grid, 'Update', 'Update the telnet options shown', undef,
22227 10, 12, 9, 10);
22228 $button->signal_connect('clicked' => sub {
22229  
22230 $self->protocols1Tab_updateWidgets(
22231 $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton,
22232 $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22233 $checkButton7,
22234 );
22235 });
22236  
22237 # Tab complete
22238 return 1;
22239 }
22240  
22241 sub protocols1Tab_updateWidgets {
22242  
22243 # Called by $self->optionsTab to update the Gtk3::Entry boxes
22244 #
22245 # Expected arguments
22246 # $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7
22247 # - List of Gtk3::Entry boxes to update
22248 # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22249 # $checkButton7
22250 # - List of Gtk3::CheckButtons to update
22251  
22252 #
22253 # Return values
22254 # 'undef' on improper arguments
22255 # 1 otherwise
22256  
22257 my (
22258 $self, $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton,
22259 $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22260 $checkButton7, $check,
22261 ) = @_;
22262  
22263 # Check for improper arguments
22264 if (
22265 ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4
22266 || ! defined $entry5 || ! defined $entry6 || ! defined $entry7 || ! defined $checkButton
22267 || ! defined $checkButton2 || ! defined $checkButton3 || ! defined $checkButton4
22268 || ! defined $checkButton5 || ! defined $checkButton6 || ! defined $checkButton7
22269 || defined $check
22270 ) {
22271 return $axmud::CLIENT->writeImproper(
22272 $self->_objClass . '->protocols1Tab_updateWidgets',
22273 @_,
22274 );
22275 }
22276  
22277 if ($self->session->echoMode eq 'no_invite') {
22278 $entry->set_text('Server has not suggested stopping ECHO yet');
22279 } elsif ($self->session->echoMode eq 'client_agree') {
22280 $entry->set_text('Server has suggested stopping ECHO and client has agreed');
22281 } elsif ($self->session->echoMode eq 'client_refuse') {
22282 $entry->set_text('Server has suggested stopping ECHO and client has refused');
22283 } elsif ($self->session->echoMode eq 'server_stop') {
22284 $entry->set_text('Server has resumed ECHO and client has agreeed');
22285 }
22286  
22287 if ($self->session->sgaMode eq 'no_invite') {
22288 $entry2->set_text('Server has not suggested SGA yet');
22289 } elsif ($self->session->sgaMode eq 'client_agree') {
22290 $entry2->set_text('Server has suggested SGA and client has agreed');
22291 } elsif ($self->session->sgaMode eq 'client_refuse') {
22292 $entry2->set_text('Server has suggested SGA and client has refused');
22293 } elsif ($self->session->sgaMode eq 'server_stop') {
22294 $entry3->set_text('Server has stopped SGA and client has agreeed');
22295 }
22296  
22297 if ($self->session->specifiedTType) {
22298 $entry3->set_text('Preferred terminal: ' . $self->session->specifiedTType);
22299 } else {
22300 $entry3->set_text('Preferred terminal: (not sent)');
22301 }
22302  
22303 if ($self->session->eorMode eq 'no_invite') {
22304 $entry4->set_text('Server has not negotiated EOR yet');
22305 } elsif ($self->session->eorMode eq 'client_agree') {
22306 $entry4->set_text('Server has suggested EOR negotiation and client has agreed');
22307 } elsif ($self->session->eorMode eq 'client_refuse') {
22308 $entry4->set_text('Server has suggested EOR negotiation and client has refused');
22309 }
22310  
22311 if ($self->session->nawsMode eq 'no_invite') {
22312 $entry5->set_text('Server has not suggested NAWS yet');
22313 } elsif ($self->session->nawsMode eq 'client_agree') {
22314 $entry5->set_text('Server has suggested NAWS and client has agreed');
22315 } elsif ($self->session->nawsMode eq 'client_refuse') {
22316 $entry5->set_text('Server has suggested NAWS and client has refused');
22317 }
22318  
22319 if ($self->session->nawsMode eq 'no_invite') {
22320 $entry6->set_text('Server has not suggested NEW-ENVIRON yet');
22321 } elsif ($self->session->nawsMode eq 'client_agree') {
22322 $entry6->set_text('Server has suggested NEW-ENVIRON and client has agreed');
22323 } elsif ($self->session->nawsMode eq 'client_refuse') {
22324 $entry6->set_text('Server has suggested NEW-ENVIRON and client has refused');
22325 }
22326  
22327 if ($self->session->nawsMode eq 'no_invite') {
22328 $entry7->set_text('Server has not suggested CHARSET yet');
22329 } elsif ($self->session->nawsMode eq 'client_agree') {
22330 $entry7->set_text('Server has suggested CHARSET and client has agreed');
22331 } elsif ($self->session->nawsMode eq 'client_refuse') {
22332 $entry7->set_text('Server has suggested CHARSET and client has refused');
22333 }
22334  
22335 $checkButton->set_active($axmud::CLIENT->useEchoFlag);
22336 $checkButton2->set_active($axmud::CLIENT->useSgaFlag);
22337 $checkButton3->set_active($axmud::CLIENT->useTTypeFlag);
22338 $checkButton4->set_active($axmud::CLIENT->useEorFlag);
22339 $checkButton5->set_active($axmud::CLIENT->useNawsFlag);
22340 $checkButton6->set_active($axmud::CLIENT->useNewEnvironFlag);
22341 $checkButton7->set_active($axmud::CLIENT->useCharSetFlag);
22342  
22343 return 1;
22344 }
22345  
22346 sub protocols2Tab {
22347  
22348 # Protocols2 tab
22349 #
22350 # Expected arguments
22351 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22352 #
22353 # Return values
22354 # 'undef' on improper arguments
22355 # 1 otherwise
22356  
22357 my ($self, $innerNotebook, $check) = @_;
22358  
22359 # Check for improper arguments
22360 if (! defined $innerNotebook || defined $check) {
22361  
22362 return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols2Tab', @_);
22363 }
22364  
22365 # Tab setup
22366 my $grid = $self->addTab('Page _2', $innerNotebook);
22367  
22368 # MUD Protocol negotiations
22369 $self->addLabel($grid, '<b>MUD protocol negotiations (1/2)</b>',
22370 0, 12, 0, 1);
22371 $self->addLabel($grid, '<i>Current status of MUD protocols for this session</i>',
22372 1, 12, 1, 2);
22373  
22374 my $checkButton = $self->addCheckButton(
22375 $grid, 'MSDP (Mud Server Data Protocol)', undef, FALSE,
22376 1, 3, 2, 3);
22377 my $entry = $self->addEntry($grid, undef, FALSE,
22378 3, 12, 2, 3);
22379  
22380 my $checkButton2 = $self->addCheckButton(
22381 $grid, 'MSSP (Mud Server Status Protocol)', undef, FALSE,
22382 1, 3, 3, 4);
22383 my $entry2 = $self->addEntry($grid, undef, FALSE,
22384 3, 12, 3, 4);
22385  
22386 my $checkButton3 = $self->addCheckButton(
22387 $grid, 'MCCP (Mud Client Compression Protocol)', undef, FALSE,
22388 1, 3, 4, 5);
22389 my $entry3 = $self->addEntry($grid, undef, FALSE,
22390 3, 12, 4, 5);
22391  
22392 my $checkButton4 = $self->addCheckButton($grid, 'MSP (Mud Sound Protocol)', undef, FALSE,
22393 1, 3, 5, 6);
22394 my $entry4 = $self->addEntry($grid, undef, FALSE,
22395 3, 12, 5, 6);
22396  
22397 my $checkButton5 = $self->addCheckButton(
22398 $grid, 'MXP (Mud Xtension Protocol)', undef, FALSE,
22399 1, 3, 6, 7);
22400 my $entry5 = $self->addEntry($grid, undef, FALSE,
22401 3, 12, 6, 7);
22402  
22403 my $checkButton6 = $self->addCheckButton($grid, 'PUEBLO', undef, FALSE,
22404 1, 3, 7, 8);
22405 my $entry6 = $self->addEntry($grid, undef, FALSE,
22406 3, 12, 7, 8);
22407  
22408 my $checkButton7 = $self->addCheckButton($grid, 'ZMP (Zenith Mud Protocol)', undef, FALSE,
22409 1, 3, 8, 9);
22410 my $entry7 = $self->addEntry($grid, undef, FALSE,
22411 3, 12, 8, 9);
22412  
22413 my $checkButton8 = $self->addCheckButton(
22414 $grid, 'AARD102 (Aardwolf 102 channel)', undef, FALSE,
22415 1, 3, 9, 10);
22416 my $entry8 = $self->addEntry($grid, undef, FALSE,
22417 3, 12, 9, 10);
22418  
22419 $self->protocolsTab2_updateWidgets(
22420 $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8, $checkButton,
22421 $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22422 $checkButton7, $checkButton8,
22423 );
22424  
22425 my $button = $self->addButton($grid, 'Update', 'Update the MUD protocols shown', undef,
22426 10, 12, 10, 11);
22427 $button->signal_connect('clicked' => sub {
22428  
22429 $self->protocolsTab2_updateWidgets(
22430 $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8, $checkButton,
22431 $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22432 $checkButton7, $checkButton8,
22433 );
22434 });
22435  
22436 # Tab complete
22437 return 1;
22438 }
22439  
22440 sub protocolsTab2_updateWidgets {
22441  
22442 # Called by $self->protocolsTab2 to update the Gtk3::Entry boxes
22443 #
22444 # Expected arguments
22445 # $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8
22446 # - List of Gtk3::Entry boxes to update
22447 # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5,
22448 # $checkButton6, $checkButton7, $checkButton8
22449 # - List of Gtk3::CheckButtons to update
22450 #
22451 # Return values
22452 # 'undef' on improper arguments
22453 # 1 otherwise
22454  
22455 my (
22456 $self, $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8,
22457 $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6,
22458 $checkButton7, $checkButton8, $check,
22459 ) = @_;
22460  
22461 # Check for improper arguments
22462 if (
22463 ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4
22464 || ! defined $entry5 || ! defined $entry6 || ! defined $entry7 || ! defined $entry8
22465 || ! defined $checkButton || ! defined $checkButton2 || ! defined $checkButton3
22466 || ! defined $checkButton4 || ! defined $checkButton5 || ! defined $checkButton6
22467 || ! defined $checkButton7 || ! defined $checkButton8 || defined $check
22468 ) {
22469 return $axmud::CLIENT->writeImproper(
22470 $self->_objClass . '->protocolsTab2_updateWidgets',
22471 @_,
22472 );
22473 }
22474  
22475 if ($self->session->msdpMode eq 'no_invite') {
22476 $entry->set_text('Server has not suggested MSDP yet');
22477 } elsif ($self->session->msdpMode eq 'client_agree') {
22478 $entry->set_text('Server has suggested MSDP and client has agreed');
22479 } elsif ($self->session->msdpMode eq 'client_refuse') {
22480 $entry->set_text('Server has suggested MSDP and client has refused');
22481 } elsif ($self->session->msdpMode eq 'client_ignore') {
22482 $entry->set_text('Server sent garbage MSDP, so client is ignoring it');
22483 }
22484  
22485 if ($self->session->msspMode eq 'no_invite') {
22486 $entry2->set_text('Server has not suggested MSSP yet');
22487 } elsif ($self->session->msspMode eq 'client_agree') {
22488 $entry2->set_text('Server has suggested MSSP and client has agreed');
22489 } elsif ($self->session->msspMode eq 'client_refuse') {
22490 $entry2->set_text('Server has suggested MSSP and client has refused');
22491 }
22492  
22493 if ($self->session->mccpMode eq 'no_invite') {
22494 $entry3->set_text('Server has not suggested MCCP yet');
22495 } elsif ($self->session->mccpMode eq 'client_agree') {
22496 $entry3->set_text('Server has suggested MCCP and client has agreed');
22497 } elsif ($self->session->mccpMode eq 'client_refuse') {
22498 $entry3->set_text('Server has suggested MCCP and client has refused');
22499 } elsif ($self->session->mccpMode eq 'compress_start') {
22500 $entry3->set_text('Server has signalled MCCP compression has begun');
22501 } elsif ($self->session->mccpMode eq 'compress_error') {
22502 $entry3->set_text('MCCP has stopped after a compression error');
22503 } elsif ($self->session->mccpMode eq 'compress_stop') {
22504 $entry3->set_text('Server has terminated MCCP compression');
22505 }
22506  
22507 if ($self->session->mspMode eq 'no_invite') {
22508 $entry4->set_text('Server has not suggested MSP yet');
22509 } elsif ($self->session->mspMode eq 'client_agree') {
22510 $entry4->set_text('Server has suggested MSP and client has agreed');
22511 } elsif ($self->session->mspMode eq 'client_refuse') {
22512 $entry4->set_text('Server has suggested MSP and client has refused');
22513 } elsif ($self->session->mspMode eq 'client_simulate') {
22514  
22515 $entry4->set_text(
22516 'Server did not suggest MSP, but ' . $axmud::SCRIPT
22517 . ' is responding to MSP sound/music triggers',
22518 );
22519 }
22520  
22521 if ($self->session->mxpMode eq 'no_invite') {
22522 $entry5->set_text('Server has not suggested MXP yet');
22523 } elsif ($self->session->mxpMode eq 'client_agree') {
22524 $entry5->set_text('Server has suggested MXP and client has agreed');
22525 } elsif ($self->session->mxpMode eq 'client_refuse') {
22526 $entry5->set_text('Server has suggested MXP and client has refused');
22527 }
22528  
22529 if ($self->session->puebloMode eq 'no_invite') {
22530 $entry6->set_text('Server has not suggested Pueblo yet');
22531 } elsif ($self->session->puebloMode eq 'client_agree') {
22532 $entry6->set_text('Server has suggested Pueblo and client has agreed');
22533 } elsif ($self->session->puebloMode eq 'client_refuse') {
22534 $entry6->set_text('Server has suggested Pueblo and client has refused');
22535 }
22536  
22537 if ($self->session->zmpMode eq 'no_invite') {
22538 $entry7->set_text('Server has not suggested ZMP yet');
22539 } elsif ($self->session->zmpMode eq 'client_agree') {
22540 $entry7->set_text('Server has suggested ZMP and client has agreed');
22541 } elsif ($self->session->zmpMode eq 'client_refuse') {
22542 $entry7->set_text('Server has suggested ZMP and client has refused');
22543 }
22544  
22545 if ($self->session->aard102Mode eq 'no_invite') {
22546 $entry8->set_text('Server has not suggested ZMP yet');
22547 } elsif ($self->session->aard102Mode eq 'client_agree') {
22548 $entry8->set_text('Server has suggested ZMP and client has agreed');
22549 } elsif ($self->session->aard102Mode eq 'client_refuse') {
22550 $entry8->set_text('Server has suggested ZMP and client has refused');
22551 }
22552  
22553 $checkButton->set_active($axmud::CLIENT->useMsdpFlag);
22554 $checkButton2->set_active($axmud::CLIENT->useMsspFlag);
22555 $checkButton3->set_active($axmud::CLIENT->useMccpFlag);
22556 $checkButton4->set_active($axmud::CLIENT->useMspFlag);
22557 $checkButton5->set_active($axmud::CLIENT->useMxpFlag);
22558 $checkButton6->set_active($axmud::CLIENT->usePuebloFlag);
22559 $checkButton7->set_active($axmud::CLIENT->useZmpFlag);
22560 $checkButton8->set_active($axmud::CLIENT->useAard102Flag);
22561  
22562 return 1;
22563 }
22564  
22565 sub protocols3Tab {
22566  
22567 # Protocols3 tab
22568 #
22569 # Expected arguments
22570 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22571 #
22572 # Return values
22573 # 'undef' on improper arguments
22574 # 1 otherwise
22575  
22576 my ($self, $innerNotebook, $check) = @_;
22577  
22578 # Check for improper arguments
22579 if (! defined $innerNotebook || defined $check) {
22580  
22581 return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols3Tab', @_);
22582 }
22583  
22584 # Tab setup
22585 my $grid = $self->addTab('Page _3', $innerNotebook);
22586  
22587 # MUD Protocol negotiations
22588 $self->addLabel($grid, '<b>MUD protocol negotiations (2/2)</b>',
22589 0, 12, 0, 1);
22590 $self->addLabel($grid, '<i>Current status of MUD protocols for this session</i>',
22591 1, 12, 1, 2);
22592  
22593 my $checkButton = $self->addCheckButton(
22594 $grid, 'ATCP (Achaea Telnet Client Protocol)', undef, FALSE,
22595 1, 3, 2, 3);
22596 my $entry = $self->addEntry($grid, undef, FALSE,
22597 3, 12, 2, 3);
22598  
22599 my $checkButton2 = $self->addCheckButton(
22600 $grid, 'GMCP (Generic MUD Communication Protocol)', undef, FALSE,
22601 1, 3, 3, 4);
22602 my $entry2 = $self->addEntry($grid, undef, FALSE,
22603 3, 12, 3, 4);
22604  
22605 my $checkButton3 = $self->addCheckButton(
22606 $grid, 'MTTS (Mud Terminal Type Standard)', undef, FALSE,
22607 1, 3, 4, 5);
22608 my $entry3 = $self->addEntry($grid, undef, FALSE,
22609 3, 12, 4, 5);
22610  
22611 my $checkButton4 = $self->addCheckButton(
22612 $grid, 'MNES (MUD NEW-ENVIRON Stanard)', undef, FALSE,
22613 1, 3, 5, 6);
22614 my $entry4 = $self->addEntry($grid, undef, FALSE,
22615 3, 12, 5, 6);
22616  
22617 my $checkButton5 = $self->addCheckButton(
22618 $grid, 'MCP (Mud Client Protocol)', undef, FALSE,
22619 1, 3, 6, 7);
22620 my $entry5 = $self->addEntry($grid, undef, FALSE,
22621 3, 12, 6, 7);
22622  
22623 $self->protocolsTab3_updateWidgets(
22624 $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2, $checkButton3,
22625 $checkButton4, $checkButton5,
22626 );
22627  
22628 my $button = $self->addButton($grid, 'Update', 'Update the MUD protocols shown', undef,
22629 10, 12, 7, 8);
22630 $button->signal_connect('clicked' => sub {
22631  
22632 $self->protocolsTab3_updateWidgets(
22633 $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2,
22634 $checkButton3, $checkButton4, $checkButton5,
22635 );
22636 });
22637  
22638 # Tab complete
22639 return 1;
22640 }
22641  
22642 sub protocolsTab3_updateWidgets {
22643  
22644 # Called by $self->protocolsTab3 to update the Gtk3::Entry boxes
22645 #
22646 # Expected arguments
22647 # $entry, $entry2, $entry3, $entry4, $entry5
22648 # - List of Gtk3::Entry boxes to update
22649 # $checkButton, $checkButton2, $checkButton3, $checkButton4, $heckButton5
22650 # - List of Gtk3::CheckButtons to update
22651 #
22652 # Return values
22653 # 'undef' on improper arguments
22654 # 1 otherwise
22655  
22656 my (
22657 $self, $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2,
22658 $checkButton3, $checkButton4, $checkButton5, $check,
22659 ) = @_;
22660  
22661 # Check for improper arguments
22662 if (
22663 ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4
22664 || ! defined $entry5 || ! defined $checkButton || ! defined $checkButton2
22665 || ! defined $checkButton3 || ! defined $checkButton4 || ! defined $checkButton5
22666 || defined $check
22667 ) {
22668 return $axmud::CLIENT->writeImproper(
22669 $self->_objClass . '->protocolsTab3_updateWidgets',
22670 @_,
22671 );
22672 }
22673  
22674 if ($self->session->atcpMode eq 'no_invite') {
22675 $entry->set_text('Server has not suggested ATCP yet');
22676 } elsif ($self->session->atcpMode eq 'client_agree') {
22677 $entry->set_text('Server has suggested ATCP and client has agreed');
22678 } elsif ($self->session->atcpMode eq 'client_refuse') {
22679 $entry->set_text('Server has suggested ATCP and client has refused');
22680 }
22681  
22682 if ($self->session->gmcpMode eq 'no_invite') {
22683 $entry2->set_text('Server has not suggested GMCP yet');
22684 } elsif ($self->session->gmcpMode eq 'client_agree') {
22685 $entry2->set_text('Server has suggested GMCP and client has agreed');
22686 } elsif ($self->session->gmcpMode eq 'client_refuse') {
22687 $entry2->set_text('Server has suggested GMCP and client has refused');
22688 }
22689  
22690 if ($self->session->specifiedTType) {
22691 $entry3->set_text('Preferred terminal: ' . $self->session->specifiedTType);
22692 } else {
22693 $entry3->set_text('Preferred terminal: (not sent)');
22694 }
22695  
22696 # Strictly speaking a client, not a session setting
22697 if ($axmud::CLIENT->allowMnesSendIPFlag) {
22698 $entry4->set_text('Sending IP address to server enabled');
22699 } else {
22700 $entry4->set_text('Sending IP address to server disabled');
22701 }
22702  
22703 if ($self->session->mcpMode eq 'no_invite') {
22704 $entry5->set_text('Server has not suggested MCP yet');
22705 } elsif ($self->session->mcpMode eq 'client_agree') {
22706 $entry5->set_text('Server has suggested MCP and client has agreed');
22707 } elsif ($self->session->mcpMode eq 'client_refuse') {
22708 $entry5->set_text('Server has suggested MCP and client has refused');
22709 }
22710  
22711 $checkButton->set_active($axmud::CLIENT->useAtcpFlag);
22712 $checkButton2->set_active($axmud::CLIENT->useGmcpFlag);
22713 $checkButton3->set_active($axmud::CLIENT->useMttsFlag);
22714 $checkButton4->set_active($axmud::CLIENT->useMnesFlag);
22715 $checkButton5->set_active($axmud::CLIENT->useMcpFlag);
22716  
22717 return 1;
22718 }
22719  
22720 sub msdpTab {
22721  
22722 # Msdp tab - called by $self->setupNotebook
22723 #
22724 # Expected arguments
22725 # (none besides $self)
22726 #
22727 # Return values
22728 # 'undef' on improper arguments
22729 # 1 otherwise
22730  
22731 my ($self, $check) = @_;
22732  
22733 # Check for improper arguments
22734 if (defined $check) {
22735  
22736 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdpTab', @_);
22737 }
22738  
22739 # Tab setup
22740 # Create a notebook within the main one, so that we have two rows of tabs
22741 my $innerNotebook = $self->addInnerNotebookTab('MS_DP', $self->notebook);
22742  
22743 # Add tabs to the inner notebook
22744 $self->msdp1Tab($innerNotebook);
22745 $self->msdp2Tab($innerNotebook);
22746 $self->msdp3Tab($innerNotebook);
22747 $self->msdp4Tab($innerNotebook);
22748 $self->msdp5Tab($innerNotebook);
22749 $self->msdp6Tab($innerNotebook);
22750 $self->msdp7Tab($innerNotebook);
22751 $self->msdp8Tab($innerNotebook);
22752  
22753 return 1;
22754 }
22755  
22756 sub msdp1Tab {
22757  
22758 # Msdp1 tab
22759 #
22760 # Expected arguments
22761 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22762 #
22763 # Return values
22764 # 'undef' on improper arguments
22765 # 1 otherwise
22766  
22767 my ($self, $innerNotebook, $check) = @_;
22768  
22769 # Local variables
22770 my @columnList;
22771  
22772 # Check for improper arguments
22773 if (! defined $innerNotebook || defined $check) {
22774  
22775 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp1Tab', @_);
22776 }
22777  
22778 # Tab setup
22779 my $grid = $self->addTab('Page _1', $innerNotebook);
22780  
22781 # MSDP generic commands
22782 $self->addLabel($grid, '<b>MSDP generic commands</b>',
22783 0, 12, 0, 1);
22784 $self->addLabel($grid,
22785 '<i>List of generic (official) commands supported by the server</i>',
22786 1, 12, 1, 2);
22787  
22788 # Add a simple list
22789 @columnList = (
22790 'Supported', 'bool',
22791 'Command', 'text',
22792 );
22793  
22794 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
22795 1, 12, 2, 10);
22796  
22797 # Initialise the list
22798 $self->msdp1Tab_refreshList(
22799 $slWidget,
22800 scalar (@columnList / 2),
22801 'msdpGenericCmdHash',
22802 );
22803  
22804 # Add a button
22805 my $button = $self->addButton($grid,
22806 'Refresh list', 'Refresh the list of commands', undef,
22807 9, 12, 10, 11);
22808 $button->signal_connect('clicked' => sub {
22809  
22810 $self->msdp1Tab_refreshList(
22811 $slWidget,
22812 scalar (@columnList / 2),
22813 'msdpGenericCmdHash',
22814 );
22815 });
22816  
22817 # Tab complete
22818 return 1;
22819 }
22820  
22821 sub msdp1Tab_refreshList {
22822  
22823 # Resets the simple list displayed by $self->msdp1Tab, etc
22824 #
22825 # Expected arguments
22826 # $slWidget - The GA::Obj::SimpleList
22827 # $columns - The number of columns
22828 # $iv - The hash IV whose key-value pairs should be displayed
22829 #
22830 # Return values
22831 # 'undef' on improper arguments
22832 # 1 otherwise
22833  
22834 my ($self, $slWidget, $columns, $iv, $check) = @_;
22835  
22836 # Local variables
22837 my (
22838 @dataList,
22839 %hash,
22840 );
22841  
22842 # Check for improper arguments
22843 if (! defined $slWidget || ! defined $columns || ! defined $iv || defined $check) {
22844  
22845 return $axmud::CLIENT->writeImproper(
22846 $self->_objClass . '->msdp1Tab_refreshList',
22847 @_,
22848 );
22849 }
22850  
22851 # Import the hash IV
22852 %hash = $self->session->$iv;
22853  
22854 # Compile the simple list data
22855 foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) {
22856  
22857 push (@dataList,
22858 $hash{$key},
22859 $key,
22860 );
22861 }
22862  
22863 # Reset the simple list
22864 $self->resetListData($slWidget, [@dataList], $columns);
22865  
22866 return 1;
22867 }
22868  
22869 sub msdp2Tab {
22870  
22871 # Msdp2 tab
22872 #
22873 # Expected arguments
22874 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22875 #
22876 # Return values
22877 # 'undef' on improper arguments
22878 # 1 otherwise
22879  
22880 my ($self, $innerNotebook, $check) = @_;
22881  
22882 # Local variables
22883 my @columnList;
22884  
22885 # Check for improper arguments
22886 if (! defined $innerNotebook || defined $check) {
22887  
22888 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp2Tab', @_);
22889 }
22890  
22891 # Tab setup
22892 my $grid = $self->addTab('Page _2', $innerNotebook);
22893  
22894 # MSDP custom commands
22895 $self->addLabel($grid, '<b>MSDP custom commands</b>',
22896 0, 12, 0, 1);
22897 $self->addLabel($grid,
22898 '<i>List of custom (unofficial) commands supported by the server</i>',
22899 1, 12, 1, 2);
22900  
22901 # Add a simple list
22902 @columnList = (
22903 'Supported', 'bool',
22904 'Command', 'text',
22905 );
22906  
22907 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
22908 1, 12, 2, 10);
22909  
22910 # Initialise the list
22911 $self->msdp1Tab_refreshList(
22912 $slWidget,
22913 scalar (@columnList / 2),
22914 'msdpCustomCmdHash',
22915 );
22916  
22917 # Add a button
22918 my $button = $self->addButton($grid,
22919 'Refresh list', 'Refresh the list of commands', undef,
22920 9, 12, 10, 11);
22921 $button->signal_connect('clicked' => sub {
22922  
22923 $self->msdp1Tab_refreshList(
22924 $slWidget,
22925 scalar (@columnList / 2),
22926 'msdpCustomCmdHash',
22927 );
22928 });
22929  
22930 # Tab complete
22931 return 1;
22932 }
22933  
22934 sub msdp3Tab {
22935  
22936 # Msdp3 tab
22937 #
22938 # Expected arguments
22939 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
22940 #
22941 # Return values
22942 # 'undef' on improper arguments
22943 # 1 otherwise
22944  
22945 my ($self, $innerNotebook, $check) = @_;
22946  
22947 # Local variables
22948 my @columnList;
22949  
22950 # Check for improper arguments
22951 if (! defined $innerNotebook || defined $check) {
22952  
22953 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp3Tab', @_);
22954 }
22955  
22956 # Tab setup
22957 my $grid = $self->addTab('Page _3', $innerNotebook);
22958  
22959 # MSDP generic lists
22960 $self->addLabel($grid, '<b>MSDP generic lists</b>',
22961 0, 12, 0, 1);
22962 $self->addLabel($grid,
22963 '<i>List of generic (official) lists supported by the server</i>',
22964 1, 12, 1, 2);
22965  
22966 # Add a simple list
22967 @columnList = (
22968 'Supported', 'bool',
22969 'List', 'text',
22970 );
22971  
22972 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
22973 1, 12, 2, 10);
22974  
22975 # Initialise the list
22976 $self->msdp1Tab_refreshList(
22977 $slWidget,
22978 scalar (@columnList / 2),
22979 'msdpGenericListHash',
22980 );
22981  
22982 # Add a button
22983 my $button = $self->addButton($grid,
22984 'Refresh list', 'Refresh the list of lists', undef,
22985 9, 12, 10, 11);
22986 $button->signal_connect('clicked' => sub {
22987  
22988 $self->msdp1Tab_refreshList(
22989 $slWidget,
22990 scalar (@columnList / 2),
22991 'msdpGenericListHash',
22992 );
22993 });
22994  
22995 # Tab complete
22996 return 1;
22997 }
22998  
22999 sub msdp4Tab {
23000  
23001 # Msdp4 tab
23002 #
23003 # Expected arguments
23004 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23005 #
23006 # Return values
23007 # 'undef' on improper arguments
23008 # 1 otherwise
23009  
23010 my ($self, $innerNotebook, $check) = @_;
23011  
23012 # Local variables
23013 my @columnList;
23014  
23015 # Check for improper arguments
23016 if (! defined $innerNotebook || defined $check) {
23017  
23018 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp4Tab', @_);
23019 }
23020  
23021 # Tab setup
23022 my $grid = $self->addTab('Page _4', $innerNotebook);
23023  
23024 # MSDP custom lists
23025 $self->addLabel($grid, '<b>MSDP custom lists</b>',
23026 0, 12, 0, 1);
23027 $self->addLabel($grid,
23028 '<i>List of custom (unofficial) lists supported by the server</i>',
23029 1, 12, 1, 2);
23030  
23031 # Add a simple list
23032 @columnList = (
23033 'Supported', 'bool',
23034 'List', 'text',
23035 );
23036  
23037 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23038 1, 12, 2, 10);
23039  
23040 # Initialise the list
23041 $self->msdp1Tab_refreshList(
23042 $slWidget,
23043 scalar (@columnList / 2),
23044 'msdpCustomListHash',
23045 );
23046  
23047 # Add a button
23048 my $button = $self->addButton($grid,
23049 'Refresh list', 'Refresh the list of lists', undef,
23050 9, 12, 10, 11);
23051 $button->signal_connect('clicked' => sub {
23052  
23053 $self->msdp1Tab_refreshList(
23054 $slWidget,
23055 scalar (@columnList / 2),
23056 'msdpCustomListHash',
23057 );
23058 });
23059  
23060 # Tab complete
23061 return 1;
23062 }
23063  
23064 sub msdp5Tab {
23065  
23066 # Msdp5 tab
23067 #
23068 # Expected arguments
23069 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23070 #
23071 # Return values
23072 # 'undef' on improper arguments
23073 # 1 otherwise
23074  
23075 my ($self, $innerNotebook, $check) = @_;
23076  
23077 # Local variables
23078 my @columnList;
23079  
23080 # Check for improper arguments
23081 if (! defined $innerNotebook || defined $check) {
23082  
23083 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp5Tab', @_);
23084 }
23085  
23086 # Tab setup
23087 my $grid = $self->addTab('Page _5', $innerNotebook);
23088  
23089 # MSDP generic configurable variables
23090 $self->addLabel($grid, '<b>MSDP generic configurable variables</b>',
23091 0, 12, 0, 1);
23092 $self->addLabel($grid,
23093 '<i>List of generic (official) configurable variables supported by the server</i>',
23094 1, 12, 1, 2);
23095  
23096 # Add a simple list
23097 @columnList = (
23098 'Supported', 'bool',
23099 'Variable', 'text',
23100 'Value', 'text',
23101 );
23102  
23103 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23104 1, 12, 2, 10);
23105  
23106 # Initialise the list
23107 $self->msdp5Tab_refreshList(
23108 $slWidget,
23109 scalar (@columnList / 2),
23110 'msdpGenericConfigFlagHash',
23111 'msdpGenericConfigValHash',
23112 );
23113  
23114 # Add a button
23115 my $button = $self->addButton($grid,
23116 'Refresh list', 'Refresh the list of configurable variables', undef,
23117 9, 12, 10, 11);
23118 $button->signal_connect('clicked' => sub {
23119  
23120 $self->msdp5Tab_refreshList(
23121 $slWidget,
23122 scalar (@columnList / 2),
23123 'msdpGenericConfigFlagHash',
23124 'msdpGenericConfigValHash',
23125 );
23126 });
23127  
23128 # Tab complete
23129 return 1;
23130 }
23131  
23132 sub msdp5Tab_refreshList {
23133  
23134 # Resets the simple list displayed by $self->msdp5Tab, etc
23135 #
23136 # Expected arguments
23137 # $slWidget - The GA::Obj::SimpleList
23138 # $columns - The number of columns
23139 # $iv, $iv2 - The hash IVs whose key-value pairs should be displayed
23140 #
23141 # Return values
23142 # 'undef' on improper arguments
23143 # 1 otherwise
23144  
23145 my ($self, $slWidget, $columns, $iv, $iv2, $check) = @_;
23146  
23147 # Local variables
23148 my (
23149 @dataList,
23150 %hash, %hash2,
23151 );
23152  
23153 # Check for improper arguments
23154 if (
23155 ! defined $slWidget || ! defined $columns || ! defined $iv || ! defined $iv2
23156 || defined $check
23157 ) {
23158 return $axmud::CLIENT->writeImproper(
23159 $self->_objClass . '->msdp5Tab_refreshList',
23160 @_,
23161 );
23162 }
23163  
23164 # Import the hash IVs
23165 %hash = $self->session->$iv;
23166 %hash2 = $self->session->$iv2;
23167  
23168 # Compile the simple list data
23169 foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) {
23170  
23171 push (@dataList,
23172 $hash{$key}, # Flag
23173 $key,
23174 $hash2{$key}, # Value
23175 );
23176 }
23177  
23178 # Reset the simple list
23179 $self->resetListData($slWidget, [@dataList], $columns);
23180  
23181 return 1;
23182 }
23183  
23184 sub msdp6Tab {
23185  
23186 # Msdp6 tab
23187 #
23188 # Expected arguments
23189 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23190 #
23191 # Return values
23192 # 'undef' on improper arguments
23193 # 1 otherwise
23194  
23195 my ($self, $innerNotebook, $check) = @_;
23196  
23197 # Local variables
23198 my @columnList;
23199  
23200 # Check for improper arguments
23201 if (! defined $innerNotebook || defined $check) {
23202  
23203 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp6Tab', @_);
23204 }
23205  
23206 # Tab setup
23207 my $grid = $self->addTab('Page _6', $innerNotebook);
23208  
23209 # MSDP generic configurable variables
23210 $self->addLabel($grid, '<b>MSDP custom configurable variables</b>',
23211 0, 12, 0, 1);
23212 $self->addLabel($grid,
23213 '<i>List of custom (unofficial) configurable variables supported by the server</i>',
23214 1, 12, 1, 2);
23215  
23216 # Add a simple list
23217 @columnList = (
23218 'Supported', 'bool',
23219 'Variable', 'text',
23220 'Value', 'text',
23221 );
23222  
23223 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23224 1, 12, 2, 10);
23225  
23226 # Initialise the list
23227 $self->msdp5Tab_refreshList(
23228 $slWidget,
23229 scalar (@columnList / 2),
23230 'msdpCustomConfigFlagHash',
23231 'msdpCustomConfigValHash',
23232 );
23233  
23234 # Add a button
23235 my $button = $self->addButton($grid,
23236 'Refresh list', 'Refresh the list of configurable variables', undef,
23237 9, 12, 10, 11);
23238 $button->signal_connect('clicked' => sub {
23239  
23240 $self->msdp5Tab_refreshList(
23241 $slWidget,
23242 scalar (@columnList / 2),
23243 'msdpCustomConfigFlagHash',
23244 'msdpCustomConfigValHash',
23245 );
23246 });
23247  
23248 # Tab complete
23249 return 1;
23250 }
23251  
23252 sub msdp7Tab {
23253  
23254 # Msdp7 tab
23255 #
23256 # Expected arguments
23257 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23258 #
23259 # Return values
23260 # 'undef' on improper arguments
23261 # 1 otherwise
23262  
23263 my ($self, $innerNotebook, $check) = @_;
23264  
23265 # Local variables
23266 my @columnList;
23267  
23268 # Check for improper arguments
23269 if (! defined $innerNotebook || defined $check) {
23270  
23271 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp7Tab', @_);
23272 }
23273  
23274 # Tab setup
23275 my $grid = $self->addTab('Page _7', $innerNotebook);
23276  
23277 # MSDP generic configurable variables
23278 $self->addLabel($grid, '<b>MSDP generic reportable variables</b>',
23279 0, 12, 0, 1);
23280 $self->addLabel($grid,
23281 '<i>List of generic (official) reportable variables supported by the server</i>',
23282 1, 12, 1, 2);
23283  
23284 # Add a simple list
23285 @columnList = (
23286 'Reportable', 'bool',
23287 'Reported', 'bool',
23288 'Sendable', 'bool',
23289 'Variable', 'text',
23290 'Value', 'text',
23291 );
23292  
23293 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23294 1, 12, 2, 10);
23295  
23296 # Initialise the list
23297 $self->msdp7Tab_refreshList(
23298 $slWidget,
23299 scalar (@columnList / 2),
23300 'msdpGenericReportableFlagHash',
23301 'msdpGenericReportedFlagHash',
23302 'msdpGenericSendableFlagHash',
23303 'msdpGenericValueHash',
23304 );
23305  
23306 # Add a button
23307 my $button = $self->addButton($grid,
23308 'Refresh list', 'Refresh the list of reportable variables', undef,
23309 9, 12, 10, 11);
23310 $button->signal_connect('clicked' => sub {
23311  
23312 $self->msdp7Tab_refreshList(
23313 $slWidget,
23314 scalar (@columnList / 2),
23315 'msdpGenericReportableFlagHash',
23316 'msdpGenericReportedFlagHash',
23317 'msdpGenericSendableFlagHash',
23318 'msdpGenericValueHash',
23319 );
23320 });
23321  
23322 # Tab complete
23323 return 1;
23324 }
23325  
23326 sub msdp7Tab_refreshList {
23327  
23328 # Resets the simple list displayed by $self->msdp7Tab, etc
23329 #
23330 # Expected arguments
23331 # $slWidget - The GA::Obj::SimpleList
23332 # $columns - The number of columns
23333 # $iv, $iv2, $iv3, $iv4
23334 # - The hash IVs whose key-value pairs should be displayed
23335 #
23336 # Return values
23337 # 'undef' on improper arguments
23338 # 1 otherwise
23339  
23340 my ($self, $slWidget, $columns, $iv, $iv2, $iv3, $iv4, $check) = @_;
23341  
23342 # Local variables
23343 my (
23344 @dataList,
23345 %hash, %hash2, %hash3, %hash4, %combHash,
23346 );
23347  
23348 # Check for improper arguments
23349 if (
23350 ! defined $slWidget || ! defined $columns || ! defined $iv || ! defined $iv2
23351 || ! defined $iv3 || ! defined $iv4 || defined $check
23352 ) {
23353 return $axmud::CLIENT->writeImproper(
23354 $self->_objClass . '->msdp7Tab_refreshList',
23355 @_,
23356 );
23357 }
23358  
23359 # Import the hash IVs
23360 %hash = $self->session->$iv; # Flag
23361 %hash2 = $self->session->$iv2; # Flag
23362 %hash3 = $self->session->$iv3; # Flag
23363 %hash4 = $self->session->$iv4; # Value
23364  
23365 # (Compile a single hash of keys which exist in all three flag hashes)
23366 foreach my $key (keys %hash) {
23367  
23368 $combHash{$key} = undef;
23369 }
23370  
23371 foreach my $key (keys %hash2) {
23372  
23373 $combHash{$key} = undef;
23374 }
23375  
23376 foreach my $key (keys %hash3) {
23377  
23378 $combHash{$key} = undef;
23379 }
23380  
23381 # Compile the simple list data
23382 foreach my $key (sort {lc($a) cmp lc($b)} (keys %combHash)) {
23383  
23384 my $value = $hash4{$key};
23385 if (defined $value) {
23386  
23387 # $value can be a scalar or a list/hash reference, representing an MSDP embedded
23388 # array/table. Reduce this to a single string
23389 $value = $self->msdp7Tab_parseScalar($value);
23390 }
23391  
23392 push (@dataList,
23393 $hash{$key}, # Flag
23394 $hash2{$key}, # Flag
23395 $hash3{$key}, # Flag
23396 $key,
23397 $value,
23398 );
23399 }
23400  
23401 # Reset the simple list
23402 $self->resetListData($slWidget, [@dataList], $columns);
23403  
23404 return 1;
23405 }
23406  
23407 sub msdp7Tab_parseScalar {
23408  
23409 # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar,
23410 # ->msdp7Tab_parseArray and msdp7Tab_parseTable
23411 # The value of an MSDP variable can be a scalar, or a list/hash reference representing an
23412 # embedded array/table. Call these functions recursively to reduce them all to a single
23413 # string we can display in the simple list.
23414 #
23415 # Expected arguments
23416 # $arg - A scalar, or a list/hash reference
23417 #
23418 # Return values
23419 # 'undef' on improper arguments
23420 # Otherwise returns the modified string
23421  
23422 my ($self, $arg, $check) = @_;
23423  
23424 # Check for improper arguments
23425 if (! defined $arg || defined $check) {
23426  
23427 return $axmud::CLIENT->writeImproper(
23428 $self->_objClass . '->msdp7Tab_parseScalar',
23429 @_,
23430 );
23431 }
23432  
23433 if (ref $arg eq 'HASH') {
23434 return ' { ' . $self->msdp7Tab_parseTable($arg) . ' }';
23435 } elsif (ref $arg eq 'ARRAY') {
23436 return ' ( ' . $self->msdp7Tab_parseArray($arg) . ' )';
23437 } else {
23438 return ' ' . $arg;
23439 }
23440 }
23441  
23442 sub msdp7Tab_parseArray {
23443  
23444 # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar,
23445 # ->msdp7Tab_parseArray and msdp7Tab_parseTable
23446 # The value of an MSDP variable can be a scalar, or a list/hash reference representing an
23447 # embedded array/table. Call these functions recursively to reduce them all to a single
23448 # string we can display in the simple list.
23449 #
23450 # Expected arguments
23451 # $arg - A list reference
23452 #
23453 # Return values
23454 # 'undef' on improper arguments
23455 # Otherwise returns the modified string
23456  
23457 my ($self, $arg, $check) = @_;
23458  
23459 # Local variables
23460 my $string;
23461  
23462 # Check for improper arguments
23463 if (! defined $arg || defined $check) {
23464  
23465 return $axmud::CLIENT->writeImproper(
23466 $self->_objClass . '->msdp7Tab_parseScalar',
23467 @_,
23468 );
23469 }
23470  
23471 $string = '';
23472 foreach my $item (@$arg) {
23473  
23474 if (ref $item eq 'HASH') {
23475 $string .= ' { ' . $self->msdp7Tab_parseTable($item) . ' }';
23476 } elsif (ref $item eq 'ARRAY') {
23477 $string .= ' ( ' . $self->msdp7Tab_parseArray($item) . ' )';
23478 } else {
23479 $string .= ' ' . $item;
23480 }
23481 }
23482  
23483 return $string;
23484 }
23485  
23486 sub msdp7Tab_parseTable {
23487  
23488 # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar,
23489 # ->msdp7Tab_parseArray and msdp7Tab_parseTable
23490 # The value of an MSDP variable can be a scalar, or a list/hash reference representing an
23491 # embedded array/table. Call these functions recursively to reduce them all to a single
23492 # string we can display in the simple list.
23493 #
23494 # Expected arguments
23495 # $arg - A hash reference
23496 #
23497 # Return values
23498 # 'undef' on improper arguments
23499 # Otherwise returns the modified string
23500  
23501 my ($self, $arg, $check) = @_;
23502  
23503 # Local variables
23504 my $string;
23505  
23506 # Check for improper arguments
23507 if (! defined $arg || defined $check) {
23508  
23509 return $axmud::CLIENT->writeImproper(
23510 $self->_objClass . '->msdp7Tab_parseScalar',
23511 @_,
23512 );
23513 }
23514  
23515 $string = '';
23516 foreach my $key (sort {lc($a) cmp lc($b)} (keys %$arg)) {
23517  
23518 my $value = $$arg{$key};
23519  
23520 if (ref $value eq 'HASH') {
23521 $string .= ' ' . $key . ': { ' . $self->msdp7Tab_parseTable($value) . ' }';
23522 } elsif (ref $value eq 'ARRAY') {
23523 $string .= ' ' . $key . ': ( ' . $self->msdp7Tab_parseArray($value) . ' )';
23524 } else {
23525 $string .= ' ' . $key . ': ' . $value;
23526 }
23527 }
23528  
23529 return $string;
23530 }
23531  
23532 sub msdp8Tab {
23533  
23534 # Msdp8 tab
23535 #
23536 # Expected arguments
23537 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23538 #
23539 # Return values
23540 # 'undef' on improper arguments
23541 # 1 otherwise
23542  
23543 my ($self, $innerNotebook, $check) = @_;
23544  
23545 # Local variables
23546 my @columnList;
23547  
23548 # Check for improper arguments
23549 if (! defined $innerNotebook || defined $check) {
23550  
23551 return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp8Tab', @_);
23552 }
23553  
23554 # Tab setup
23555 my $grid = $self->addTab('Page _8', $innerNotebook);
23556  
23557 # MSDP generic configurable variables
23558 $self->addLabel($grid, '<b>MSDP custom reportable variables</b>',
23559 0, 12, 0, 1);
23560 $self->addLabel($grid,
23561 '<i>List of custom (unofficial) reportable variables supported by the server</i>',
23562 1, 12, 1, 2);
23563  
23564 # Add a simple list
23565 @columnList = (
23566 'Reportable', 'bool',
23567 'Reported', 'bool',
23568 'Sendable', 'bool',
23569 'Variable', 'text',
23570 'Value', 'text',
23571 );
23572  
23573 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23574 1, 12, 2, 10);
23575  
23576 # Initialise the list
23577 $self->msdp7Tab_refreshList(
23578 $slWidget,
23579 scalar (@columnList / 2),
23580 'msdpCustomReportableFlagHash',
23581 'msdpCustomReportedFlagHash',
23582 'msdpCustomSendableFlagHash',
23583 'msdpCustomValueHash',
23584 );
23585  
23586 # Add a button
23587 my $button = $self->addButton($grid,
23588 'Refresh list', 'Refresh the list of reportable variables', undef,
23589 9, 12, 10, 11);
23590 $button->signal_connect('clicked' => sub {
23591  
23592 $self->msdp7Tab_refreshList(
23593 $slWidget,
23594 scalar (@columnList / 2),
23595 'msdpCustomReportableFlagHash',
23596 'msdpCustomReportedFlagHash',
23597 'msdpCustomSendableFlagHash',
23598 'msdpCustomValueHash',
23599 );
23600 });
23601  
23602 # Tab complete
23603 return 1;
23604 }
23605  
23606 sub msspTab {
23607  
23608 # Mssp tab - called by $self->setupNotebook
23609 #
23610 # Expected arguments
23611 # (none besides $self)
23612 #
23613 # Return values
23614 # 'undef' on improper arguments
23615 # 1 otherwise
23616  
23617 my ($self, $check) = @_;
23618  
23619 # Check for improper arguments
23620 if (defined $check) {
23621  
23622 return $axmud::CLIENT->writeImproper($self->_objClass . '->msspTab', @_);
23623 }
23624  
23625 # Tab setup
23626 # Create a notebook within the main one, so that we have two rows of tabs
23627 my $innerNotebook = $self->addInnerNotebookTab('_MSSP', $self->notebook);
23628  
23629 # Add tabs to the inner notebook
23630 $self->mssp1Tab($innerNotebook);
23631 $self->mssp2Tab($innerNotebook);
23632  
23633 return 1;
23634 }
23635  
23636 sub mssp1Tab {
23637  
23638 # Mssp1 tab
23639 #
23640 # Expected arguments
23641 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23642 #
23643 # Return values
23644 # 'undef' on improper arguments
23645 # 1 otherwise
23646  
23647 my ($self, $innerNotebook, $check) = @_;
23648  
23649 # Local variables
23650 my @columnList;
23651  
23652 # Check for improper arguments
23653 if (! defined $innerNotebook || defined $check) {
23654  
23655 return $axmud::CLIENT->writeImproper($self->_objClass . '->mssp1Tab', @_);
23656 }
23657  
23658 # Tab setup
23659 my $grid = $self->addTab('Page _1', $innerNotebook);
23660  
23661 # MSSP data
23662 $self->addLabel($grid, '<b>MSSP generic data</b>',
23663 0, 12, 0, 1);
23664 $self->addLabel($grid,
23665 '<i>List of generic (official) MSSP variables for the current connection\'s world</i>',
23666 1, 12, 1, 2);
23667  
23668 # Add a simple list
23669 @columnList = (
23670 'Variable', 'text',
23671 'Value', 'text',
23672 );
23673  
23674 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23675 1, 12, 2, 10);
23676  
23677 # Initialise the list
23678 $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'official');
23679  
23680 # Add a button
23681 my $button = $self->addButton($grid,
23682 'Refresh list', 'Refresh the list of MSSP variables', undef,
23683 9, 12, 10, 11);
23684 $button->signal_connect('clicked' => sub {
23685  
23686 # Refresh the simple list
23687 $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'official');
23688 });
23689  
23690 # Tab complete
23691 return 1;
23692 }
23693  
23694 sub mssp1Tab_refreshList {
23695  
23696 # Resets the simple list displayed by $self->mssp1Tab and ->mssp2Tab
23697 #
23698 # Expected arguments
23699 # $slWidget - The GA::Obj::SimpleList
23700 # $columns - The number of columns
23701 # $type - 'official' or 'custom'
23702 #
23703 # Return values
23704 # 'undef' on improper arguments
23705 # 1 otherwise
23706  
23707 my ($self, $slWidget, $columns, $type, $check) = @_;
23708  
23709 # Local variables
23710 my (
23711 @dataList,
23712 %ivHash,
23713 );
23714  
23715 # Check for improper arguments
23716 if (! defined $slWidget || ! defined $columns || defined $check) {
23717  
23718 return $axmud::CLIENT->writeImproper(
23719 $self->_objClass . '->mssp1Tab_refreshList',
23720 @_,
23721 );
23722 }
23723  
23724 # Import the IV from the current world profile
23725 if ($type eq 'official') {
23726 %ivHash = $self->session->currentWorld->msspGenericValueHash;
23727 } else {
23728 %ivHash = $self->session->currentWorld->msspCustomValueHash;
23729 }
23730  
23731 # Compile the simple list data
23732 foreach my $key (sort {lc($a) cmp lc($b)} (keys %ivHash)) {
23733  
23734 push (@dataList, $key, $ivHash{$key});
23735 }
23736  
23737 # Reset the simple list
23738 $self->resetListData($slWidget, [@dataList], $columns);
23739  
23740 return 1;
23741 }
23742  
23743 sub mssp2Tab {
23744  
23745 # Mssp2 tab
23746 #
23747 # Expected arguments
23748 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
23749 #
23750 # Return values
23751 # 'undef' on improper arguments
23752 # 1 otherwise
23753  
23754 my ($self, $innerNotebook, $check) = @_;
23755  
23756 # Local variables
23757 my @columnList;
23758  
23759 # Check for improper arguments
23760 if (! defined $innerNotebook || defined $check) {
23761  
23762 return $axmud::CLIENT->writeImproper($self->_objClass . '->mssp2Tab', @_);
23763 }
23764  
23765 # Tab setup
23766 my $grid = $self->addTab('Page _2', $innerNotebook);
23767  
23768 # MSSP data
23769 $self->addLabel($grid, '<b>MSSP custom data</b>',
23770 0, 12, 0, 1);
23771 $self->addLabel($grid,
23772 '<i>List of custom (unofficial) MSSP variables for the current connection\'s world</i>',
23773 1, 12, 1, 2);
23774  
23775 # Add a simple list
23776 @columnList = (
23777 'Variable', 'text',
23778 'Value', 'text',
23779 );
23780  
23781 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23782 1, 12, 2, 10);
23783  
23784 # Initialise the list
23785 $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'custom');
23786  
23787 # Add a button
23788 my $button = $self->addButton($grid,
23789 'Refresh list', 'Refresh the list of MSSP variables', undef,
23790 9, 12, 10, 11);
23791 $button->signal_connect('clicked' => sub {
23792  
23793 # Refresh the simple list
23794 $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'custom');
23795 });
23796  
23797 # Tab complete
23798 return 1;
23799 }
23800  
23801 sub mxpTab {
23802  
23803 # Mxp tab
23804 #
23805 # Expected arguments
23806 # (none besides $self)
23807 #
23808 # Return values
23809 # 'undef' on improper arguments
23810 # 1 otherwise
23811  
23812 my ($self, $check) = @_;
23813  
23814 # Local variables
23815 my @columnList;
23816  
23817 # Check for improper arguments
23818 if (defined $check) {
23819  
23820 return $axmud::CLIENT->writeImproper($self->_objClass . '->mxpTab', @_);
23821 }
23822  
23823 # Tab setup
23824 my $grid = $self->addTab('M_XP', $self->notebook);
23825  
23826 # MXP entities
23827 $self->addLabel($grid, '<b>MXP entities</b>',
23828 0, 12, 0, 1);
23829 $self->addLabel($grid,
23830 '<i>List of values stored in MXP entities (some of which may be private)</i>',
23831 1, 12, 1, 2);
23832  
23833 # Add a simple list
23834 @columnList = (
23835 'Entity name', 'text',
23836 'Value', 'text',
23837 'Description', 'text',
23838 );
23839  
23840 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23841 1, 12, 2, 10);
23842  
23843 # Initialise the list
23844 $self->mxpTab_refreshList($slWidget, scalar (@columnList / 2));
23845  
23846 # Add a button
23847 my $button = $self->addButton($grid,
23848 'Refresh list', 'Refresh the list of MXP entities', undef,
23849 9, 12, 10, 11);
23850 $button->signal_connect('clicked' => sub {
23851  
23852 $self->atcpTab_refreshList($slWidget, scalar (@columnList / 2));
23853 });
23854  
23855 # Tab complete
23856 return 1;
23857 }
23858  
23859 sub mxpTab_refreshList {
23860  
23861 # Resets the simple list displayed by $self->mxpTab
23862 #
23863 # Expected arguments
23864 # $slWidget - The GA::Obj::SimpleList
23865 # $columns - The number of columns
23866 #
23867 # Return values
23868 # 'undef' on improper arguments
23869 # 1 otherwise
23870  
23871 my ($self, $slWidget, $columns, $check) = @_;
23872  
23873 # Local variables
23874 my (
23875 @dataList,
23876 %hash,
23877 );
23878  
23879 # Check for improper arguments
23880 if (! defined $slWidget || ! defined $columns || defined $check) {
23881  
23882 return $axmud::CLIENT->writeImproper($self->_objClass . '->mxpTab_refreshList', @_);
23883 }
23884  
23885 # Import the hash IV
23886 %hash = $self->session->mxpEntityHash;
23887  
23888 # Compile the simple list data
23889 foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) {
23890  
23891 my ($entityObj, $value, $descrip);
23892  
23893 $entityObj = $hash{$key};
23894 if ($entityObj->privateFlag) {
23895 $value = '<private>';
23896 } else {
23897 $value = $entityObj->value;
23898 }
23899  
23900 if (! defined $entityObj->privateFlag) {
23901 $descrip = '<not set>';
23902 } else {
23903 $descrip = $entityObj->descArg;
23904 }
23905  
23906 push (@dataList, $entityObj->name, $value, $descrip);
23907 }
23908  
23909 # Reset the simple list
23910 $self->resetListData($slWidget, [@dataList], $columns);
23911  
23912 return 1;
23913 }
23914  
23915 sub zmpTab {
23916  
23917 # Zmp tab
23918 #
23919 # Expected arguments
23920 # (none besides $self)
23921 #
23922 # Return values
23923 # 'undef' on improper arguments
23924 # 1 otherwise
23925  
23926 my ($self, $check) = @_;
23927  
23928 # Local variables
23929 my @columnList;
23930  
23931 # Check for improper arguments
23932 if (defined $check) {
23933  
23934 return $axmud::CLIENT->writeImproper($self->_objClass . '->zmpTab', @_);
23935 }
23936  
23937 # Tab setup
23938 my $grid = $self->addTab('_ZMP', $self->notebook);
23939  
23940 # Supported ZMP packages
23941 $self->addLabel($grid, '<b>Supported ZMP pacakges</b>',
23942 0, 12, 0, 1);
23943 $self->addLabel($grid,
23944 '<i>List of supported ZMP packages/commands (ZMP packages are created by plugins)</i>',
23945 1, 12, 1, 2);
23946  
23947 # Add a simple list
23948 @columnList = (
23949 'Package', 'text',
23950 'World', 'text',
23951 'Commands', 'text',
23952 );
23953  
23954 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
23955 1, 12, 2, 10);
23956  
23957 # Initialise the list
23958 $self->zmpTab_refreshList($slWidget, scalar (@columnList / 2));
23959  
23960 # Add a button
23961 my $button = $self->addButton($grid,
23962 'Refresh list', 'Refresh the list of GMCP data', undef,
23963 9, 12, 10, 11);
23964 $button->signal_connect('clicked' => sub {
23965  
23966 $self->zmpTab_refreshList($slWidget, scalar (@columnList / 2));
23967 });
23968  
23969 # Tab complete
23970 return 1;
23971 }
23972  
23973 sub zmpTab_refreshList {
23974  
23975 # Resets the simple list displayed by $self->zmpTab
23976 #
23977 # Expected arguments
23978 # $slWidget - The GA::Obj::SimpleList
23979 # $columns - The number of columns
23980 #
23981 # Return values
23982 # 'undef' on improper arguments
23983 # 1 otherwise
23984  
23985 my ($self, $slWidget, $columns, $check) = @_;
23986  
23987 # Local variables
23988 my (
23989 @dataList,
23990 %hash,
23991 );
23992  
23993 # Check for improper arguments
23994 if (! defined $slWidget || ! defined $columns || defined $check) {
23995  
23996 return $axmud::CLIENT->writeImproper($self->_objClass . '->zmpTab_refreshList', @_);
23997 }
23998  
23999 # Actually display ZMP packages for all sessions (they're stored in a GA::Client IV, but
24000 # this is the most logical place to display them)
24001  
24002 # Import the IV
24003 %hash = $axmud::CLIENT->zmpPackageHash;
24004  
24005 # Compile the simple list data
24006 foreach my $obj (sort {lc($a->packageName) cmp lc($b->packageName)} (values %hash)) {
24007  
24008 my $world;
24009  
24010 if (! $obj->world) {
24011 $world = '<all worlds>';
24012 } else {
24013 $world = $world;
24014 }
24015  
24016 push (
24017 @dataList,
24018 $obj->packageName,
24019 $world,
24020 join(' / ', sort {lc($a) cmp lc($b)} ($obj->ivKeys('cmdHash'))),
24021 );
24022 }
24023  
24024 # Reset the simple list
24025 $self->resetListData($slWidget, [@dataList], $columns);
24026  
24027 return 1;
24028 }
24029  
24030 sub aard102Tab {
24031  
24032 # Aard102 tab
24033 #
24034 # Expected arguments
24035 # (none besides $self)
24036 #
24037 # Return values
24038 # 'undef' on improper arguments
24039 # 1 otherwise
24040  
24041 my ($self, $check) = @_;
24042  
24043 # Local variables
24044 my @columnList;
24045  
24046 # Check for improper arguments
24047 if (defined $check) {
24048  
24049 return $axmud::CLIENT->writeImproper($self->_objClass . '->aard102Tab', @_);
24050 }
24051  
24052 # Tab setup
24053 my $grid = $self->addTab('AARD_102', $self->notebook);
24054  
24055 # AARD102 (Aardolf 102 channel)
24056 $self->addLabel($grid, '<b>AARD102 (Aardolf 102 channel)</b>',
24057 0, 12, 0, 2);
24058  
24059 $self->addLabel($grid,
24060 'AARD102 status, as reported by the world',
24061 1, 6, 2, 4);
24062 my $entry = $self->addEntry($grid, undef, FALSE,
24063 6, 12, 2, 4);
24064 if (defined $self->session->aard102Status) {
24065 $entry->set_text($self->session->aard102Status);
24066 } else {
24067 $entry->set_text('<not received>');
24068 }
24069  
24070 $self->addLabel($grid,
24071 'Tick time',
24072 1, 6, 4, 6);
24073 my $entry2 = $self->addEntry($grid, undef, FALSE,
24074 6, 12, 4, 6);
24075 if (defined $self->session->aard102TickTime) {
24076 $entry2->set_text($self->session->aard102TickTime);
24077 } else {
24078 $entry2->set_text('<not received>');
24079 }
24080  
24081 $self->addLabel($grid,
24082 '(Compare the session time)',
24083 1, 6, 6, 8);
24084 my $entry3 = $self->addEntry($grid, undef, FALSE,
24085 6, 12, 6, 8);
24086 if (defined $self->session->sessionTime) {
24087  
24088 $entry3->set_text($self->session->sessionTime);
24089 }
24090  
24091 my $button = $self->addButton($grid,
24092 'Refresh list', 'Refresh the data displayed', undef,
24093 10, 12, 8, 10);
24094 $button->signal_connect('clicked' => sub {
24095  
24096 if (defined $self->session->aard102Status) {
24097  
24098 $entry->set_text($self->session->aard102Status);
24099 }
24100  
24101 if (defined $self->session->aard102TickTime) {
24102  
24103 $entry2->set_text($self->session->aard102TickTime);
24104 }
24105  
24106 if (defined $self->session->sessionTime) {
24107  
24108 $entry3->set_text($self->session->sessionTime);
24109 }
24110 });
24111  
24112 # Tab complete
24113 return 1;
24114 }
24115  
24116 sub atcpTab {
24117  
24118 # Atcp tab
24119 #
24120 # Expected arguments
24121 # (none besides $self)
24122 #
24123 # Return values
24124 # 'undef' on improper arguments
24125 # 1 otherwise
24126  
24127 my ($self, $check) = @_;
24128  
24129 # Local variables
24130 my @columnList;
24131  
24132 # Check for improper arguments
24133 if (defined $check) {
24134  
24135 return $axmud::CLIENT->writeImproper($self->_objClass . '->atcpTab', @_);
24136 }
24137  
24138 # Tab setup
24139 my $grid = $self->addTab('_ATCP', $self->notebook);
24140  
24141 # ATCP data
24142 $self->addLabel($grid, '<b>ATCP data</b>',
24143 0, 12, 0, 1);
24144 $self->addLabel($grid,
24145 '<i>List of data supplied by the current world using the ATCP protocol</i>',
24146 1, 12, 1, 2);
24147  
24148 # Add a simple list
24149 @columnList = (
24150 'Package', 'text',
24151 'Data', 'text',
24152 );
24153  
24154 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
24155 1, 12, 2, 10);
24156  
24157 # Initialise the list
24158 $self->atcpTab_refreshList($slWidget, scalar (@columnList / 2));
24159  
24160 # Add a button
24161 my $button = $self->addButton($grid,
24162 'Refresh list', 'Refresh the list of ATCP data', undef,
24163 9, 12, 10, 11);
24164 $button->signal_connect('clicked' => sub {
24165  
24166 $self->atcpTab_refreshList($slWidget, scalar (@columnList / 2));
24167 });
24168  
24169 # Tab complete
24170 return 1;
24171 }
24172  
24173 sub atcpTab_refreshList {
24174  
24175 # Resets the simple list displayed by $self->atcpTab
24176 #
24177 # Expected arguments
24178 # $slWidget - The GA::Obj::SimpleList
24179 # $columns - The number of columns
24180 #
24181 # Return values
24182 # 'undef' on improper arguments
24183 # 1 otherwise
24184  
24185 my ($self, $slWidget, $columns, $check) = @_;
24186  
24187 # Local variables
24188 my (
24189 @dataList,
24190 %hash,
24191 );
24192  
24193 # Check for improper arguments
24194 if (! defined $slWidget || ! defined $columns || defined $check) {
24195  
24196 return $axmud::CLIENT->writeImproper($self->_objClass . '->atcpTab_refreshList', @_);
24197 }
24198  
24199 # Import the hash IV
24200 %hash = $self->session->atcpDataHash;
24201  
24202 # Compile the simple list data
24203 foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) {
24204  
24205 my $dataObj = $hash{$key};
24206  
24207 push (@dataList, $key, $axmud::CLIENT->encodeJson($dataObj->data));
24208 }
24209  
24210 # Reset the simple list
24211 $self->resetListData($slWidget, [@dataList], $columns);
24212  
24213 return 1;
24214 }
24215  
24216 sub gmcpTab {
24217  
24218 # Gmcp tab
24219 #
24220 # Expected arguments
24221 # (none besides $self)
24222 #
24223 # Return values
24224 # 'undef' on improper arguments
24225 # 1 otherwise
24226  
24227 my ($self, $check) = @_;
24228  
24229 # Local variables
24230 my @columnList;
24231  
24232 # Check for improper arguments
24233 if (defined $check) {
24234  
24235 return $axmud::CLIENT->writeImproper($self->_objClass . '->gmcpTab', @_);
24236 }
24237  
24238 # Tab setup
24239 my $grid = $self->addTab('_GMCP', $self->notebook);
24240  
24241 # GMCP data
24242 $self->addLabel($grid, '<b>GMCP data</b>',
24243 0, 12, 0, 1);
24244 $self->addLabel($grid,
24245 '<i>List of data supplied by the current world using the GMCP protocol</i>',
24246 1, 12, 1, 2);
24247  
24248 # Add a simple list
24249 @columnList = (
24250 'Package', 'text',
24251 'Data', 'text',
24252 );
24253  
24254 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
24255 1, 12, 2, 10);
24256  
24257 # Initialise the list
24258 $self->gmcpTab_refreshList($slWidget, scalar (@columnList / 2));
24259  
24260 # Add a button
24261 my $button = $self->addButton($grid,
24262 'Refresh list', 'Refresh the list of GMCP data', undef,
24263 9, 12, 10, 11);
24264 $button->signal_connect('clicked' => sub {
24265  
24266 $self->gmcpTab_refreshList($slWidget, scalar (@columnList / 2));
24267 });
24268  
24269 # Tab complete
24270 return 1;
24271 }
24272  
24273 sub gmcpTab_refreshList {
24274  
24275 # Resets the simple list displayed by $self->gmcpTab
24276 #
24277 # Expected arguments
24278 # $slWidget - The GA::Obj::SimpleList
24279 # $columns - The number of columns
24280 #
24281 # Return values
24282 # 'undef' on improper arguments
24283 # 1 otherwise
24284  
24285 my ($self, $slWidget, $columns, $check) = @_;
24286  
24287 # Local variables
24288 my (
24289 @dataList,
24290 %hash,
24291 );
24292  
24293 # Check for improper arguments
24294 if (! defined $slWidget || ! defined $columns || defined $check) {
24295  
24296 return $axmud::CLIENT->writeImproper($self->_objClass . '->gmcpTab_refreshList', @_);
24297 }
24298  
24299 # Import the hash IV
24300 %hash = $self->session->gmcpDataHash;
24301  
24302 # Compile the simple list data
24303 foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) {
24304  
24305 my $dataObj = $hash{$key};
24306  
24307 push (@dataList, $key, $axmud::CLIENT->encodeJson($dataObj->data));
24308 }
24309  
24310 # Reset the simple list
24311 $self->resetListData($slWidget, [@dataList], $columns);
24312  
24313 return 1;
24314 }
24315  
24316 sub mcpTab {
24317  
24318 # Mcp tab - called by $self->setupNotebook
24319 #
24320 # Expected arguments
24321 # (none besides $self)
24322 #
24323 # Return values
24324 # 'undef' on improper arguments
24325 # 1 otherwise
24326  
24327 my ($self, $check) = @_;
24328  
24329 # Check for improper arguments
24330 if (defined $check) {
24331  
24332 return $axmud::CLIENT->writeImproper($self->_objClass . '->mcpTab', @_);
24333 }
24334  
24335 # Tab setup
24336 # Create a notebook within the main one, so that we have two rows of tabs
24337 my $innerNotebook = $self->addInnerNotebookTab('M_CP', $self->notebook);
24338  
24339 # Add tabs to the inner notebook
24340 $self->mcp1Tab($innerNotebook);
24341 $self->mcp2Tab($innerNotebook);
24342  
24343 return 1;
24344 }
24345  
24346 sub mcp1Tab {
24347  
24348 # Mcp1 tab
24349 #
24350 # Expected arguments
24351 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
24352 #
24353 # Return values
24354 # 'undef' on improper arguments
24355 # 1 otherwise
24356  
24357 my ($self, $innerNotebook, $check) = @_;
24358  
24359 # Local variables
24360 my @columnList;
24361  
24362 # Check for improper arguments
24363 if (! defined $innerNotebook || defined $check) {
24364  
24365 return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp1Tab', @_);
24366 }
24367  
24368 # Tab setup
24369 my $grid = $self->addTab('Page _1', $innerNotebook);
24370  
24371 # MCP supported packages
24372 $self->addLabel($grid, '<b>MCP supported packages</b>',
24373 0, 12, 0, 1);
24374 $self->addLabel($grid,
24375 '<i>List of MCP packages supported by ' . $axmud::SCRIPT
24376 . ', or defined by a plugin</i>',
24377 1, 12, 1, 2);
24378  
24379 # Add a simple list
24380 @columnList = (
24381 'Package', 'text',
24382 'Plugin', 'text',
24383 'Min version', 'text',
24384 'Max version', 'text',
24385 'Other packages supplanted', 'text',
24386 );
24387  
24388 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
24389 1, 12, 2, 10);
24390  
24391 # Initialise the list
24392 $self->mcp1Tab_refreshList($slWidget, scalar (@columnList / 2));
24393  
24394 # Add a button
24395 my $button = $self->addButton($grid,
24396 'Refresh list', 'Refresh the list of packages', undef,
24397 9, 12, 10, 11);
24398 $button->signal_connect('clicked' => sub {
24399  
24400 $self->mcp1Tab_refreshList($slWidget, scalar (@columnList / 2));
24401 });
24402  
24403 # Tab complete
24404 return 1;
24405 }
24406  
24407 sub mcp1Tab_refreshList {
24408  
24409 # Resets the simple list displayed by $self->mcp1Tab
24410 #
24411 # Expected arguments
24412 # $slWidget - The GA::Obj::SimpleList
24413 # $columns - The number of columns
24414 #
24415 # Return values
24416 # 'undef' on improper arguments
24417 # 1 otherwise
24418  
24419 my ($self, $slWidget, $columns, $check) = @_;
24420  
24421 # Local variables
24422 my (
24423 @dataList,
24424 %hash,
24425 );
24426  
24427 # Check for improper arguments
24428 if (! defined $slWidget || ! defined $columns || defined $check) {
24429  
24430 return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp1Tab_refreshList', @_);
24431 }
24432  
24433 # Import the hash IV
24434 %hash = $axmud::CLIENT->mcpPackageHash;
24435  
24436 # Compile the simple list data
24437 foreach my $obj (sort {lc($a->name) cmp lc($b->name)} (values %hash)) {
24438  
24439 my $plugin;
24440  
24441 if (defined $obj->plugin) {
24442 $plugin = $obj->plugin;
24443 } else {
24444 $plugin = 'n/a';
24445 }
24446  
24447 push (@dataList,
24448 $obj->name,
24449 $plugin,
24450 $obj->minVersion,
24451 $obj->maxVersion,
24452 join(' ', $obj->supplantList),
24453 );
24454 }
24455  
24456 # Reset the simple list
24457 $self->resetListData($slWidget, [@dataList], $columns);
24458  
24459 return 1;
24460 }
24461  
24462 sub mcp2Tab {
24463  
24464 # Mcp2 tab
24465 #
24466 # Expected arguments
24467 # $innerNotebook - The Gtk3::Notebook object inside $self->notebook
24468 #
24469 # Return values
24470 # 'undef' on improper arguments
24471 # 1 otherwise
24472  
24473 my ($self, $innerNotebook, $check) = @_;
24474  
24475 # Local variables
24476 my @columnList;
24477  
24478 # Check for improper arguments
24479 if (! defined $innerNotebook || defined $check) {
24480  
24481 return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp2Tab', @_);
24482 }
24483  
24484 # Tab setup
24485 my $grid = $self->addTab('Page _2', $innerNotebook);
24486  
24487 # MCP packages in use
24488 $self->addLabel($grid, '<b>MCP packages in use</b>',
24489 0, 12, 0, 1);
24490 $self->addLabel($grid,
24491 '<i>List of MCP packages in use by this session (supported by both the world and '
24492 . $axmud::SCRIPT . ')</i>',
24493 1, 12, 1, 2);
24494  
24495 # Add a simple list
24496 @columnList = (
24497 'Package', 'text',
24498 'Plugin', 'text',
24499 'Used version', 'text',
24500 );
24501  
24502 my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
24503 1, 12, 2, 10);
24504  
24505 # Initialise the list
24506 $self->mcp2Tab_refreshList($slWidget, scalar (@columnList / 2));
24507  
24508 # Add a button
24509 my $button = $self->addButton($grid,
24510 'Refresh list', 'Refresh the list of packages', undef,
24511 9, 12, 10, 11);
24512 $button->signal_connect('clicked' => sub {
24513  
24514 $self->list($slWidget, scalar (@columnList / 2));
24515 });
24516  
24517 # Tab complete
24518 return 1;
24519 }
24520  
24521 sub mcp2Tab_refreshList {
24522  
24523 # Resets the simple list displayed by $self->mcp2Tab
24524 #
24525 # Expected arguments
24526 # $slWidget - The GA::Obj::SimpleList
24527 # $columns - The number of columns
24528 #
24529 # Return values
24530 # 'undef' on improper arguments
24531 # 1 otherwise
24532  
24533 my ($self, $slWidget, $columns, $check) = @_;
24534  
24535 # Local variables
24536 my (
24537 @dataList,
24538 %hash,
24539 );
24540  
24541 # Check for improper arguments
24542 if (! defined $slWidget || ! defined $columns || defined $check) {
24543  
24544 return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp2Tab_refreshList', @_);
24545 }
24546  
24547 # Import the hash IV
24548 %hash = $self->session->mcpPackageHash;
24549  
24550 # Compile the simple list data
24551 foreach my $obj (sort {lc($a->name) cmp lc($b->name)} (values %hash)) {
24552  
24553 my $plugin;
24554  
24555 if (defined $obj->plugin) {
24556 $plugin = $obj->plugin;
24557 } else {
24558 $plugin = 'n/a';
24559 }
24560  
24561 push (@dataList,
24562 $obj->name,
24563 $plugin,
24564 $obj->useVersion,
24565 );
24566 }
24567  
24568 # Reset the simple list
24569 $self->resetListData($slWidget, [@dataList], $columns);
24570  
24571 return 1;
24572 }
24573  
24574 ##################
24575 # Accessors - set
24576  
24577 ##################
24578 # Accessors - get
24579 }
24580  
24581 { package Games::Axmud::PrefWin::TaskStart;
24582  
24583 use strict;
24584 use warnings;
24585 use diagnostics;
24586  
24587 use Glib qw(TRUE FALSE);
24588  
24589 our @ISA = qw(
24590 Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
24591 Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
24592 );
24593  
24594 ##################
24595 # Constructors
24596  
24597 # Contents of $self->editConfigHash after $self->new has been called:
24598 # 'type' => The task type: 'current', 'global_initial', 'profile_initial' or 'custom'
24599 # 'task_name' => The task's standard ->name, e.g. 'status_task', 'locator_task'
24600 # 'prof_name' => Name of the task's parent profile ('undef' if no parent profile)
24601  
24602 # sub new {} # Inherited from GA::Generic::ConfigWin
24603  
24604 ##################
24605 # Methods
24606  
24607 # Standard window object functions
24608  
24609 # sub winSetup {} # Inherited from GA::Generic::ConfigWin
24610  
24611 # sub winEnable {} # Inherited from GA::Generic::ConfigWin
24612  
24613 # sub winDesengage {} # Inherited from GA::Generic::FreeWin
24614  
24615 # sub winDestroy {} # Inherited from GA::Generic::FreeWin
24616  
24617 # sub winShowAll {} # Inherited from GA::Generic::Win
24618  
24619 # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin
24620  
24621 # sub redrawWidgets {} # Inherited from GA::Generic::Win
24622  
24623 # ->signal_connects
24624  
24625 # Other functions
24626  
24627 # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin
24628  
24629 sub enableButtons {
24630  
24631 # Called by $self->drawWidgets
24632 # Creates the Start task/Cancel buttons at the bottom of the window
24633 #
24634 # Expected arguments
24635 # $hBox - The horizontal packing box in which the buttons live
24636 #
24637 # Return values
24638 # An empty list on improper arguments
24639 # Otherwise, a list containing the two Gtk::Button objects created
24640  
24641 my ($self, $hBox, $check) = @_;
24642  
24643 # Local variables
24644 my (
24645 $type, $taskName, $profName, $radioChoice, $radioChoice2,
24646 @emptyList,
24647 );
24648  
24649 # Check for improper arguments
24650 if (! defined $hBox || defined $check) {
24651  
24652 $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_);
24653 return @emptyList;
24654 }
24655  
24656 # Extract keys from $self->editConfigHash
24657 $type = $self->ivShow('editConfigHash', 'type');
24658 $taskName = $self->ivShow('editConfigHash', 'task_name');
24659 $profName = $self->ivShow('editConfigHash', 'prof_name');
24660  
24661 # Create the 'Start task' / 'Add task' button in place of the OK button. For custom tasks,
24662 # the button starts desensitised
24663 my $okButton;
24664 if ($type eq 'current') {
24665  
24666 # Tasks in the current tasklist
24667 $okButton = Gtk3::Button->new('Start task');
24668 $okButton->set_tooltip_text('Start task with these options');
24669  
24670 } else {
24671  
24672 # Tasks not in the current tasklist
24673 $okButton = Gtk3::Button->new('Add task');
24674 $okButton->set_tooltip_text('Add task with these options');
24675  
24676 if ($type eq 'custom') {
24677  
24678 $okButton->set_sensitive(FALSE);
24679 }
24680 }
24681  
24682 $okButton->signal_connect('clicked' => sub {
24683  
24684 my $cmd;
24685  
24686 # Prepare the client command to execute, e.g. ';starttask -e status_task -f 2000 -w'
24687 if ($type eq 'current') {
24688  
24689 $cmd = 'starttask ' . $taskName;
24690  
24691 } elsif ($type eq 'global_initial') {
24692  
24693 $cmd = 'addinitialtask ' . $taskName;
24694  
24695 } elsif ($type eq 'profile_initial') {
24696  
24697 $cmd = 'addinitialtask ' . $taskName . ' ' . $profName;
24698  
24699 } elsif ($type eq 'custom') {
24700  
24701 $cmd = 'addcustomtask ' . $taskName . ' ' . $self->ivShow('editHash', 'entry');
24702  
24703 } else {
24704  
24705 return $self->writeError(
24706 'Unrecognised task type \'' . $type . '\'',
24707 $self->_objClass . '->setupNotebook',
24708 );
24709 }
24710  
24711 if ($self->ivExists('editHash', 'radio_choice')) {
24712  
24713 $radioChoice = $self->ivShow('editHash', 'radio_choice');
24714  
24715 if ($radioChoice == 1 && $self->ivExists('editHash', 'combo')) {
24716 $cmd .= ' -e ' . $self->ivShow('editHash', 'combo');
24717 } elsif ($radioChoice == 2 && $self->ivExists('editHash', 'combo_2')) {
24718 $cmd .= ' -n ' . $self->ivShow('editHash', 'combo_2');
24719 } elsif ($radioChoice == 3 && $self->ivExists('editHash', 'combo_3')) {
24720 $cmd .= ' -s ' . $self->ivShow('editHash', 'combo_3');
24721 } elsif ($radioChoice == 4 && $self->ivExists('editHash', 'entry_2')) {
24722 $cmd .= ' -t ' . $self->ivShow('editHash', 'entry_2');
24723 }
24724 }
24725  
24726 if ($self->ivExists('editHash', 'radio_choice_2')) {
24727  
24728 $radioChoice2 = $self->ivShow('editHash', 'radio_choice_2');
24729  
24730 if ($radioChoice2 == 1 && $self->ivExists('editHash', 'entry_3')) {
24731 $cmd .= ' -f ' . $self->ivShow('editHash', 'entry_3');
24732 } elsif ($radioChoice2 == 2 && $self->ivExists('editHash', 'entry_4')) {
24733 $cmd .= ' -u ' . $self->ivShow('editHash', 'entry_4');
24734 }
24735 }
24736  
24737 if ($self->ivExists('editHash', 'check_button')) {
24738  
24739 $cmd .= ' -w';
24740 }
24741  
24742 # Execute the client command
24743 $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
24744  
24745 # Close the 'pref' window
24746 $self->winDestroy();
24747 });
24748  
24749 $hBox->pack_end($okButton, FALSE, FALSE, $self->borderPixels);
24750  
24751 # Create the cancel button
24752 my $cancelButton = Gtk3::Button->new('Cancel');
24753 $cancelButton->signal_connect('clicked' => sub {
24754  
24755 $self->buttonCancel();
24756 });
24757 $cancelButton->set_tooltip_text('Cancel');
24758 $hBox->pack_end($cancelButton, FALSE, FALSE, $self->spacingPixels);
24759  
24760 return ($okButton, $cancelButton);
24761 }
24762  
24763 # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin
24764  
24765 sub setupNotebook {
24766  
24767 # Called by $self->winEnable
24768 # Creates the first tab for the notebook. The remaining tabs are created by
24769 # $self->expandNotebook
24770 #
24771 # Expected arguments
24772 # (none besides $self)
24773 #
24774 # Return values
24775 # 'undef' on improper arguments
24776 # 1 otherwise
24777  
24778 my ($self, $check) = @_;
24779  
24780 # Local variables
24781 my $type;
24782  
24783 # Check for improper arguments
24784 if (defined $check) {
24785  
24786 return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_);
24787 }
24788  
24789 # Extract data from $self->editConfigHash
24790 $type = $self->ivShow('editConfigHash', 'type');
24791  
24792 # Tab setup, using the standard grid size
24793 my $grid;
24794  
24795 if ($type eq 'current') {
24796  
24797 # Current tasklist tasks
24798 $grid = $self->addTab('_Current task', $self->notebook);
24799  
24800 } elsif (
24801 $type eq 'global_initial'
24802 || $type eq 'profile_initial'
24803 ) {
24804 # Initial tasklist tasks
24805 $grid = $self->addTab('_Initial task', $self->notebook);
24806  
24807 } else {
24808  
24809 # Custom tasklist tasks
24810 $grid = $self->addTab('Custo_m task', $self->notebook);
24811 }
24812  
24813 # Set up the rest of the tab
24814 $self->taskTab($grid);
24815  
24816 # Set up the remaining tabs
24817 $self->expandNotebook();
24818  
24819 # Tab complete
24820 return 1;
24821 }
24822  
24823 # sub expandNotebook {} # Inherited from GA::Generic::ConfigWin
24824  
24825 # sub saveChanges {} # Inherited from GA::Generic::ConfigWin
24826  
24827 # Notebook tabs
24828  
24829 sub taskTab {
24830  
24831 # Task tab - called by $self->setupNotebook
24832 #
24833 # Expected arguments
24834 # $grid - The Gtk3::Grid for this tab
24835 #
24836 # Return values
24837 # 'undef' on improper arguments
24838 # 1 otherwise
24839  
24840 my ($self, $grid, $check) = @_;
24841  
24842 # Local variables
24843 my (
24844 $type,
24845 @taskList,
24846 );
24847  
24848 # Check for improper arguments
24849 if (defined $check) {
24850  
24851 return $axmud::CLIENT->writeImproper($self->_objClass . '->taskTab', @_);
24852 }
24853  
24854 # # Tab setup (already created by the calling function)
24855 # my $grid = $self->addTab('_Task', $self->notebook);
24856  
24857 # Get a list of available tasks (actually, the list of task standard names)
24858 @taskList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('taskPackageHash'));
24859 # Extract data from $self->editConfigHash
24860 $type = $self->ivShow('editConfigHash', 'type');
24861  
24862 # Start options
24863 my $entry;
24864 if ($type eq 'custom') {
24865  
24866 # Custom tasklist tasks
24867 $self->addLabel($grid, '<b>Start options</b> - Custom task name (3-32 chars):',
24868 0, 8, 0, 1);
24869 $entry = $self->addEntryWithIcon($grid, undef, 'string', 3, 32,
24870 8, 12, 0, 1);
24871 $entry->signal_connect('changed' => sub {
24872  
24873 my $text = $entry->get_text();
24874  
24875 if ($self->checkEntryIcon($entry)) {
24876  
24877 $self->ivAdd('editHash', 'entry', $text);
24878 $self->okButton->set_sensitive(TRUE);
24879  
24880 } else {
24881  
24882 $self->ivDelete('editHash', 'entry');
24883 $self->okButton->set_sensitive(FALSE);
24884 }
24885 });
24886  
24887 } else {
24888  
24889 # Current tasklist / initial tasklist tasks
24890 $self->addLabel($grid, '<b>Start options</b>',
24891 0, 12, 0, 1);
24892 }
24893  
24894 my ($group, $radioButton) = $self->addRadioButton(
24895 $grid, undef,
24896 'Start the task immediately',
24897 undef, undef, TRUE,
24898 1, 12, 1, 2);
24899 $radioButton->signal_connect('toggled' => sub {
24900  
24901 $self->ivAdd('editHash', 'radio_choice', 0);
24902 });
24903  
24904 ($group, $radioButton) = $self->addRadioButton(
24905 $grid, $group,
24906 'Wait for another task to exist, before starting:',
24907 undef, undef, TRUE,
24908 1, 8, 2, 3);
24909 $radioButton->signal_connect('toggled' => sub {
24910  
24911 $self->ivAdd('editHash', 'radio_choice', 1);
24912 });
24913 my $comboBox = $self->addComboBox($grid, undef, \@taskList, 'Select task',
24914 FALSE, # 'undef' value allowed
24915 8, 12, 2, 3);
24916 $comboBox->signal_connect('changed' => sub {
24917  
24918 my $text = $comboBox->get_active_text();
24919  
24920 if ($text ne 'Select task') {
24921 $self->ivAdd('editHash', 'combo', $text);
24922 } else {
24923 $self->ivDelete('editHash', 'combo');
24924 }
24925 });
24926  
24927 ($group, $radioButton) = $self->addRadioButton(
24928 $grid, $group,
24929 'Wait for another task to not exist, before starting:',
24930 undef, undef, TRUE,
24931 1, 8, 3, 4);
24932 $radioButton->signal_connect('toggled' => sub {
24933  
24934 $self->ivAdd('editHash', 'radio_choice', 2);
24935 });
24936  
24937 my $comboBox2 = $self->addComboBox($grid, undef, \@taskList, 'Select task',
24938 FALSE, # 'undef' value allowed
24939 8, 12, 3, 4);
24940 $comboBox2->signal_connect('changed' => sub {
24941  
24942 my $text = $comboBox2->get_active_text();
24943  
24944 if ($text ne 'Select task') {
24945 $self->ivAdd('editHash', 'combo_2', $text);
24946 } else {
24947 $self->ivDelete('editHash', 'combo_2');
24948 }
24949 });
24950  
24951 ($group, $radioButton) = $self->addRadioButton(
24952 $grid, $group,
24953 'Wait for another task to start/stop, before starting:',
24954 undef, undef, TRUE,
24955 1, 8, 4, 5);
24956 $radioButton->signal_connect('toggled' => sub {
24957  
24958 $self->ivAdd('editHash', 'radio_choice', 3);
24959 });
24960 my $comboBox3 = $self->addComboBox($grid, undef, \@taskList, 'Select task',
24961 FALSE, # 'undef' value allowed
24962 8, 12, 4, 5);
24963 $comboBox3->signal_connect('changed' => sub {
24964  
24965 my $text = $comboBox3->get_active_text();
24966  
24967 if ($text ne 'Select task') {
24968 $self->ivAdd('editHash', 'combo_3', $text);
24969 } else {
24970 $self->ivDelete('editHash', 'combo_3');
24971 }
24972 });
24973  
24974 ($group, $radioButton) = $self->addRadioButton(
24975 $grid, $group,
24976 'Start the task after this many minutes:',
24977 undef, undef, TRUE,
24978 1, 8, 5, 6);
24979 $radioButton->signal_connect('toggled' => sub {
24980  
24981 $self->ivAdd('editHash', 'radio_choice', 4);
24982 });
24983 my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 10080, # 7 days
24984 8, 12, 5, 6);
24985 $entry2->signal_connect('changed' => sub {
24986  
24987 my $text = $entry2->get_text();
24988  
24989 if ($self->checkEntryIcon($entry2)) {
24990 $self->ivAdd('editHash', 'entry_2', $text);
24991 } else {
24992 $self->ivDelete('editHash', 'entry_2');
24993 }
24994 });
24995  
24996 # Group 2 switches
24997 $self->addLabel($grid, '<b>Stop options</b>',
24998 0, 12, 6, 7);
24999  
25000 ($group, $radioButton) = $self->addRadioButton(
25001 $grid, undef,
25002 'Run the task for an unlimited amount of time',
25003 undef, undef, TRUE,
25004 1, 8, 7, 8);
25005 $radioButton->signal_connect('toggled' => sub {
25006  
25007 $self->ivAdd('editHash', 'radio_choice_2', 0);
25008 });
25009  
25010 ($group, $radioButton) = $self->addRadioButton(
25011 $grid, $group,
25012 'Run the task for this many minutes:',
25013 undef, undef, TRUE,
25014 1, 8, 8, 9);
25015 $radioButton->signal_connect('toggled' => sub {
25016  
25017 $self->ivAdd('editHash', 'radio_choice_2', 1);
25018 });
25019 my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, 10080, # 7 days
25020 8, 12, 8, 9);
25021 $entry3->signal_connect('changed' => sub {
25022  
25023 my $text = $entry3->get_text();
25024  
25025 if ($self->checkEntryIcon($entry3)) {
25026 $self->ivAdd('editHash', 'entry_3', $text);
25027 } else {
25028 $self->ivDelete('editHash', 'entry_3');
25029 }
25030 });
25031  
25032 ($group, $radioButton) = $self->addRadioButton(
25033 $grid, $group,
25034 'Run the task until the task loop time reaches:',
25035 undef, undef, TRUE,
25036 1, 8, 9, 10);
25037 $radioButton->signal_connect('toggled' => sub {
25038  
25039 $self->ivAdd('editHash', 'radio_choice_2', 2);
25040 });
25041 my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, 604800, # 7 days
25042 8, 12, 9, 10);
25043 $entry4->signal_connect('changed' => sub {
25044  
25045 my $text = $entry4->get_text();
25046  
25047 if ($self->checkEntryIcon($entry4)) {
25048 $self->ivAdd('editHash', 'entry_4', $text);
25049 } else {
25050 $self->ivDelete('editHash', 'entry_4');
25051 }
25052 });
25053  
25054 # Group 3 switches
25055 $self->addLabel($grid, '<b>Task window options</b>',
25056 0, 12, 10, 11);
25057  
25058 my $checkButton = $self->addCheckButton(
25059 $grid,
25060 'Task runs without opening a task window (if it normally uses one)',
25061 undef,
25062 TRUE,
25063 1, 12, 11, 12);
25064 $checkButton->signal_connect('toggled' => sub {
25065  
25066 if ($checkButton->get_active()) {
25067 $self->ivAdd('editHash', 'check_button', TRUE);
25068 } else {
25069 $self->ivDelete('editHash', 'check_button');
25070 }
25071 });
25072  
25073 # Tab complete
25074 return 1;
25075 }
25076  
25077 ##################
25078 # Accessors - set
25079  
25080 ##################
25081 # Accessors - get
25082 }
25083  
25084 # Package must return a true value
25085 1