| 1 | # Copyright (C) 2011-2024 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 (already created by the calling function) | ||
| 117 | |||
| 118 | # Set up the rest of the first tab (all of it, in this case) | ||
| 119 | $self->clientTab(); | ||
| 120 | |||
| 121 | # Set up the remaining tabs | ||
| 122 | $self->expandNotebook(); | ||
| 123 | |||
| 124 | # Tab complete | ||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | sub expandNotebook { | ||
| 129 | |||
| 130 | # Called by $self->setupNotebook | ||
| 131 | # Set up additional tabs for the notebook | ||
| 132 | # | ||
| 133 | # Expected arguments | ||
| 134 | # (none besides $self) | ||
| 135 | # | ||
| 136 | # Return values | ||
| 137 | # 'undef' on improper arguments | ||
| 138 | # 1 otherwise | ||
| 139 | |||
| 140 | my ($self, $check) = @_; | ||
| 141 | |||
| 142 | # Check for improper arguments | ||
| 143 | if (defined $check) { | ||
| 144 | |||
| 145 | return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_); | ||
| 146 | } | ||
| 147 | |||
| 148 | $self->settingsTab(); | ||
| 149 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 150 | |||
| 151 | $self->pluginsTab(); | ||
| 152 | } | ||
| 153 | $self->commandsTab(); | ||
| 154 | $self->logsTab(); | ||
| 155 | $self->coloursTab(); | ||
| 156 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 157 | |||
| 158 | $self->workspacesTab(); | ||
| 159 | } | ||
| 160 | $self->windowsTab(); | ||
| 161 | $self->soundTab(); | ||
| 162 | $self->tasksTab(); | ||
| 163 | $self->scriptsTab(); | ||
| 164 | $self->chatTab(); | ||
| 165 | |||
| 166 | return 1; | ||
| 167 | } | ||
| 168 | |||
| 169 | # sub saveChanges {} # Inherited from GA::Generic::ConfigWin | ||
| 170 | |||
| 171 | # Notebook tabs | ||
| 172 | |||
| 173 | sub clientTab { | ||
| 174 | |||
| 175 | # Client tab - called by $self->setupNotebook | ||
| 176 | # | ||
| 177 | # Expected arguments | ||
| 178 | # (none besides $self) | ||
| 179 | # | ||
| 180 | # Return values | ||
| 181 | # 'undef' on improper arguments | ||
| 182 | # 1 otherwise | ||
| 183 | |||
| 184 | my ($self, $check) = @_; | ||
| 185 | |||
| 186 | # Check for improper arguments | ||
| 187 | if (defined $check) { | ||
| 188 | |||
| 189 | return $axmud::CLIENT->writeImproper($self->_objClass . '->clientTab', @_); | ||
| 190 | } | ||
| 191 | |||
| 192 | # Tab setup | ||
| 193 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 194 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Client'); | ||
| 195 | |||
| 196 | # Add tabs to the inner notebook | ||
| 197 | $self->client1Tab($innerNotebook); | ||
| 198 | $self->client2Tab($innerNotebook); | ||
| 199 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 200 | |||
| 201 | $self->client3Tab($innerNotebook); | ||
| 202 | } | ||
| 203 | $self->client4Tab($innerNotebook); | ||
| 204 | $self->client5Tab($innerNotebook); | ||
| 205 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 206 | |||
| 207 | $self->client6Tab($innerNotebook); | ||
| 208 | $self->client7Tab($innerNotebook); | ||
| 209 | $self->client8Tab($innerNotebook); | ||
| 210 | } | ||
| 211 | |||
| 212 | return 1; | ||
| 213 | } | ||
| 214 | |||
| 215 | sub ODDclient1Tab { | ||
| 216 | |||
| 217 | # Client1 tab | ||
| 218 | # | ||
| 219 | # Expected arguments | ||
| 220 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 221 | # | ||
| 222 | # Return values | ||
| 223 | # 'undef' on improper arguments | ||
| 224 | # 1 otherwise | ||
| 225 | |||
| 226 | my ($self, $innerNotebook, $check) = @_; | ||
| 227 | |||
| 228 | # Local variables | ||
| 229 | my ($offset, $path); | ||
| 230 | |||
| 231 | # Check for improper arguments | ||
| 232 | if (! defined $innerNotebook || defined $check) { | ||
| 233 | |||
| 234 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client1Tab', @_); | ||
| 235 | } | ||
| 236 | |||
| 237 | # Tab setup | ||
| 238 | my $grid = $self->addTab( | ||
| 239 | $innerNotebook, | ||
| 240 | 'Page _1', | ||
| 241 | ['Client settings'], | ||
| 242 | ); | ||
| 243 | |||
| 244 | # Optional header | ||
| 245 | if ($axmud::CLIENT->configWinSimplifyFlag) { | ||
| 246 | |||
| 247 | $offset = 1; | ||
| 248 | if ($^O eq 'MSWin32') { | ||
| 249 | $path = $axmud::SHARE_DIR . '\\icons\\replace\\dialogue_replace_warning.png'; | ||
| 250 | } else { | ||
| 251 | $path = $axmud::SHARE_DIR . '/icons/replace/dialogue_replace_warning.png'; | ||
| 252 | } | ||
| 253 | |||
| 254 | my ($image, $frame, $viewPort) = $self->addImage($grid, $path, undef, | ||
| 255 | FALSE, # Don't use a scrolled window | ||
| 256 | -1, 50, | ||
| 257 | 1, 3, 0, 1); | ||
| 258 | |||
| 259 | $self->addLabel($grid, | ||
| 260 | "<b>Some tabs are hidden. You can reveal them in the \'Windows\'" | ||
| 261 | . "\ntab, or type this command:</b> ;setwindowsize -s", | ||
| 262 | 3, 12, 0, 1); | ||
| 263 | |||
| 264 | } else { | ||
| 265 | |||
| 266 | $offset = 0; | ||
| 267 | } | ||
| 268 | |||
| 269 | # Left column | ||
| 270 | $self->addLabel($grid, '<b>Client settings</b>', | ||
| 271 | 0, 12, (0 + $offset), (1 + $offset)); | ||
| 272 | |||
| 273 | $self->addLabel($grid, 'Script name', | ||
| 274 | 1, 3, (1 + $offset), (2 + $offset)); | ||
| 275 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 276 | 3, 6, (1 + $offset), (2 + $offset)); | ||
| 277 | $entry->set_text($axmud::SCRIPT); | ||
| 278 | |||
| 279 | $self->addLabel($grid, 'Script version', | ||
| 280 | 1, 3, (2 + $offset), (3 + $offset)); | ||
| 281 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 282 | 3, 6, (2 + $offset), (3 + $offset)); | ||
| 283 | $entry2->set_text($axmud::VERSION); | ||
| 284 | |||
| 285 | $self->addLabel($grid, 'Authors', | ||
| 286 | 1, 3, (3 + $offset), (4 + $offset)); | ||
| 287 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 288 | 3, 12, (3 + $offset), (4 + $offset)); | ||
| 289 | $entry4->set_text($axmud::AUTHORS); | ||
| 290 | |||
| 291 | $self->addLabel($grid, 'Copyright', | ||
| 292 | 1, 3, (4 + $offset), (5 + $offset)); | ||
| 293 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 294 | 3, 12, (4 + $offset), (5 + $offset)); | ||
| 295 | $entry5->set_text($axmud::COPYRIGHT); | ||
| 296 | |||
| 297 | $self->addLabel($grid, 'Website', | ||
| 298 | 1, 3, (5 + $offset), (6 + $offset)); | ||
| 299 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 300 | 3, 10, (5 + $offset), (6 + $offset)); | ||
| 301 | $entry6->set_text($axmud::URL); | ||
| 302 | |||
| 303 | my $button = $self->addButton($grid, 'Open', 'Open this website in a web browser', undef, | ||
| 304 | 10, 12, (5 + $offset), (6 + $offset)); | ||
| 305 | if (! $axmud::URL) { | ||
| 306 | |||
| 307 | $button->set_sensitive(FALSE); | ||
| 308 | } | ||
| 309 | $button->signal_connect('clicked' => sub { | ||
| 310 | |||
| 311 | if ($axmud::URL) { | ||
| 312 | |||
| 313 | $axmud::CLIENT->openURL($axmud::URL); | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | |||
| 317 | $self->addLabel($grid, 'Description', | ||
| 318 | 1, 3, (6 + $offset), (7 + $offset)); | ||
| 319 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 320 | 3, 12, (6 + $offset), (7 + $offset)); | ||
| 321 | $entry7->set_text($axmud::DESCRIP); | ||
| 322 | |||
| 323 | my $button2 = $self->addButton($grid, 'About...', 'About ' . $axmud::SCRIPT, undef, | ||
| 324 | 1, 4, (7 + $offset), (8 + $offset)); | ||
| 325 | $button2->signal_connect('clicked' => sub { | ||
| 326 | |||
| 327 | # Only one About window can be open at a time | ||
| 328 | if (! $axmud::CLIENT->aboutWin) { | ||
| 329 | |||
| 330 | $self->quickFreeWin( | ||
| 331 | 'Games::Axmud::OtherWin::About', | ||
| 332 | $self->session, | ||
| 333 | # config | ||
| 334 | 'first_tab' => 'about', | ||
| 335 | ) | ||
| 336 | |||
| 337 | } else { | ||
| 338 | |||
| 339 | # Only one About window can be open at a time | ||
| 340 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 341 | # Open it at the right page | ||
| 342 | $axmud::CLIENT->aboutWin->notebook->set_current_page(0); | ||
| 343 | } | ||
| 344 | }); | ||
| 345 | |||
| 346 | my $button3 = $self->addButton( | ||
| 347 | $grid, 'Credits...', 'Show information about credits', undef, | ||
| 348 | 4, 6, (7 + $offset), (8 + $offset)); | ||
| 349 | $button3->signal_connect('clicked' => sub { | ||
| 350 | |||
| 351 | # Only one About window can be open at a time | ||
| 352 | if (! $axmud::CLIENT->aboutWin) { | ||
| 353 | |||
| 354 | $self->quickFreeWin( | ||
| 355 | 'Games::Axmud::OtherWin::About', | ||
| 356 | $self->session, | ||
| 357 | # config | ||
| 358 | 'first_tab' => 'credits', | ||
| 359 | ) | ||
| 360 | |||
| 361 | } else { | ||
| 362 | |||
| 363 | # Only one About window can be open at a time | ||
| 364 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 365 | # Open it at the right page | ||
| 366 | $axmud::CLIENT->aboutWin->notebook->set_current_page(1); | ||
| 367 | } | ||
| 368 | }); | ||
| 369 | |||
| 370 | my $button4 = $self->addButton($grid, 'Quick help...', 'Show quick help', undef, | ||
| 371 | 6, 9, (7 + $offset), (8 + $offset)); | ||
| 372 | $button4->signal_connect('clicked' => sub { | ||
| 373 | |||
| 374 | # Only one About window can be open at a time | ||
| 375 | if (! $axmud::CLIENT->aboutWin) { | ||
| 376 | |||
| 377 | $self->quickFreeWin( | ||
| 378 | 'Games::Axmud::OtherWin::About', | ||
| 379 | $self->session, | ||
| 380 | # config | ||
| 381 | 'first_tab' => 'help', | ||
| 382 | ) | ||
| 383 | |||
| 384 | } else { | ||
| 385 | |||
| 386 | # Only one About window can be open at a time | ||
| 387 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 388 | # Open it at the right page | ||
| 389 | $axmud::CLIENT->aboutWin->notebook->set_current_page(2); | ||
| 390 | } | ||
| 391 | }); | ||
| 392 | |||
| 393 | my $button5 = $self->addButton($grid, | ||
| 394 | 'Peek/Poke list...', | ||
| 395 | 'Show strings for Peek/Poke operations', | ||
| 396 | undef, | ||
| 397 | 9, 12, (7 + $offset), (8 + $offset)); | ||
| 398 | $button5->signal_connect('clicked' => sub { | ||
| 399 | |||
| 400 | # Only one About window can be open at a time | ||
| 401 | if (! $axmud::CLIENT->aboutWin) { | ||
| 402 | |||
| 403 | $self->quickFreeWin( | ||
| 404 | 'Games::Axmud::OtherWin::About', | ||
| 405 | $self->session, | ||
| 406 | # config | ||
| 407 | 'first_tab' => 'peek', | ||
| 408 | ) | ||
| 409 | |||
| 410 | } else { | ||
| 411 | |||
| 412 | # Only one About window can be open at a time | ||
| 413 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 414 | # Open it at the right page | ||
| 415 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 416 | } | ||
| 417 | }); | ||
| 418 | |||
| 419 | my $button6 = $self->addButton($grid, 'Changes...', 'Show list of changes', undef, | ||
| 420 | 1, 4, (8 + $offset), (9 + $offset)); | ||
| 421 | $button6->signal_connect('clicked' => sub { | ||
| 422 | |||
| 423 | # Only one About window can be open at a time | ||
| 424 | if (! $axmud::CLIENT->aboutWin) { | ||
| 425 | |||
| 426 | $self->quickFreeWin( | ||
| 427 | 'Games::Axmud::OtherWin::About', | ||
| 428 | $self->session, | ||
| 429 | # config | ||
| 430 | 'first_tab' => 'changes', | ||
| 431 | ) | ||
| 432 | |||
| 433 | } else { | ||
| 434 | |||
| 435 | # Only one About window can be open at a time | ||
| 436 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 437 | # Open it at the right page | ||
| 438 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 439 | } | ||
| 440 | }); | ||
| 441 | |||
| 442 | my $button7 = $self->addButton($grid, 'Installation...', 'Show installation guide', undef, | ||
| 443 | 4, 6, (8 + $offset), (9 + $offset)); | ||
| 444 | $button7->signal_connect('clicked' => sub { | ||
| 445 | |||
| 446 | # Only one About window can be open at a time | ||
| 447 | if (! $axmud::CLIENT->aboutWin) { | ||
| 448 | |||
| 449 | $self->quickFreeWin( | ||
| 450 | 'Games::Axmud::OtherWin::About', | ||
| 451 | $self->session, | ||
| 452 | # config | ||
| 453 | 'first_tab' => 'install', | ||
| 454 | ) | ||
| 455 | |||
| 456 | } else { | ||
| 457 | |||
| 458 | # Only one About window can be open at a time | ||
| 459 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 460 | # Open it at the right page | ||
| 461 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 462 | } | ||
| 463 | }); | ||
| 464 | |||
| 465 | my $button8 = $self->addButton($grid, 'GPL License...', 'Show text of GPL License', undef, | ||
| 466 | 6, 9, (8 + $offset), (9 + $offset)); | ||
| 467 | $button8->signal_connect('clicked' => sub { | ||
| 468 | |||
| 469 | # Only one About window can be open at a time | ||
| 470 | if (! $axmud::CLIENT->aboutWin) { | ||
| 471 | |||
| 472 | $self->quickFreeWin( | ||
| 473 | 'Games::Axmud::OtherWin::About', | ||
| 474 | $self->session, | ||
| 475 | # config | ||
| 476 | 'first_tab' => 'license', | ||
| 477 | ) | ||
| 478 | |||
| 479 | } else { | ||
| 480 | |||
| 481 | # Only one About window can be open at a time | ||
| 482 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 483 | # Open it at the right page | ||
| 484 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 485 | } | ||
| 486 | }); | ||
| 487 | |||
| 488 | my $button9 = $self->addButton($grid, | ||
| 489 | 'LGPL License...', | ||
| 490 | 'Show text of LGPL License', | ||
| 491 | undef, | ||
| 492 | 9, 12, (8 + $offset), (9 + $offset)); | ||
| 493 | $button9->signal_connect('clicked' => sub { | ||
| 494 | |||
| 495 | # Only one About window can be open at a time | ||
| 496 | if (! $axmud::CLIENT->aboutWin) { | ||
| 497 | |||
| 498 | $self->quickFreeWin( | ||
| 499 | 'Games::Axmud::OtherWin::About', | ||
| 500 | $self->session, | ||
| 501 | # config | ||
| 502 | 'first_tab' => 'license_2', | ||
| 503 | ) | ||
| 504 | |||
| 505 | } else { | ||
| 506 | |||
| 507 | # Only one About window can be open at a time | ||
| 508 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 509 | # Open it at the right page | ||
| 510 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 511 | } | ||
| 512 | }); | ||
| 513 | |||
| 514 | # Right column | ||
| 515 | $self->addLabel($grid, 'Name in data files', | ||
| 516 | 7, 9, (1 + $offset), (2 + $offset)); | ||
| 517 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 518 | 9, 12, (1 + $offset), (2 + $offset)); | ||
| 519 | $entry8->set_text($axmud::NAME_FILE); | ||
| 520 | |||
| 521 | $self->addLabel($grid, 'Script date', | ||
| 522 | 7, 9, (2 + $offset), (3 + $offset)); | ||
| 523 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 524 | 9, 12, (2 + $offset), (3 + $offset)); | ||
| 525 | $entry3->set_text($axmud::DATE); | ||
| 526 | |||
| 527 | # Tab complete | ||
| 528 | return 1; | ||
| 529 | } | ||
| 530 | |||
| 531 | sub client1Tab { | ||
| 532 | |||
| 533 | # Client1 tab | ||
| 534 | # | ||
| 535 | # Expected arguments | ||
| 536 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 537 | # | ||
| 538 | # Return values | ||
| 539 | # 'undef' on improper arguments | ||
| 540 | # 1 otherwise | ||
| 541 | |||
| 542 | my ($self, $innerNotebook, $check) = @_; | ||
| 543 | |||
| 544 | # Local variables | ||
| 545 | my ($offset, $path); | ||
| 546 | |||
| 547 | # Check for improper arguments | ||
| 548 | if (! defined $innerNotebook || defined $check) { | ||
| 549 | |||
| 550 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client1Tab', @_); | ||
| 551 | } | ||
| 552 | |||
| 553 | # Tab setup | ||
| 554 | my $grid = $self->addTab( | ||
| 555 | $innerNotebook, | ||
| 556 | 'Page _1', | ||
| 557 | ['Client settings'], | ||
| 558 | ); | ||
| 559 | |||
| 560 | # Optional header | ||
| 561 | if ($axmud::CLIENT->configWinSimplifyFlag) { | ||
| 562 | |||
| 563 | $offset = 1; | ||
| 564 | if ($^O eq 'MSWin32') { | ||
| 565 | $path = $axmud::SHARE_DIR . '\\icons\\replace\\dialogue_replace_warning.png'; | ||
| 566 | } else { | ||
| 567 | $path = $axmud::SHARE_DIR . '/icons/replace/dialogue_replace_warning.png'; | ||
| 568 | } | ||
| 569 | |||
| 570 | my ($image, $frame, $viewPort) = $self->addImage($grid, $path, undef, | ||
| 571 | FALSE, # Don't use a scrolled window | ||
| 572 | -1, 50, | ||
| 573 | 1, 2, 0, 1); | ||
| 574 | |||
| 575 | $self->addLabel($grid, | ||
| 576 | "<b>Some tabs are hidden. Click the button to reveal them," | ||
| 577 | . "\nor type this command:</b> ;setwindowsize -s", | ||
| 578 | 2, 10, 0, 1); | ||
| 579 | |||
| 580 | my $button = $self->addButton($grid, 'Reveal tabs', 'Reveal hidden tabs', undef, | ||
| 581 | 10, 12, 0, 1); | ||
| 582 | $button->signal_connect('clicked' => sub { | ||
| 583 | |||
| 584 | # Reveal tabs | ||
| 585 | $self->session->pseudoCmd('setwindowsize -s', $self->pseudoCmdMode); | ||
| 586 | |||
| 587 | $self->showMsgDialogue( | ||
| 588 | 'Reveal tabs', | ||
| 589 | 'info', | ||
| 590 | 'The new setting will be applied when you re-open the window', | ||
| 591 | 'ok', | ||
| 592 | ); | ||
| 593 | }); | ||
| 594 | |||
| 595 | } else { | ||
| 596 | |||
| 597 | $offset = 0; | ||
| 598 | } | ||
| 599 | |||
| 600 | # Left column | ||
| 601 | $self->addLabel($grid, '<b>Client settings</b>', | ||
| 602 | 0, 12, (0 + $offset), (1 + $offset)); | ||
| 603 | |||
| 604 | $self->addLabel($grid, 'Script name', | ||
| 605 | 1, 3, (1 + $offset), (2 + $offset)); | ||
| 606 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 607 | 3, 6, (1 + $offset), (2 + $offset)); | ||
| 608 | $entry->set_text($axmud::SCRIPT); | ||
| 609 | |||
| 610 | $self->addLabel($grid, 'Script version', | ||
| 611 | 1, 3, (2 + $offset), (3 + $offset)); | ||
| 612 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 613 | 3, 6, (2 + $offset), (3 + $offset)); | ||
| 614 | $entry2->set_text($axmud::VERSION); | ||
| 615 | |||
| 616 | $self->addLabel($grid, 'Authors', | ||
| 617 | 1, 3, (3 + $offset), (4 + $offset)); | ||
| 618 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 619 | 3, 12, (3 + $offset), (4 + $offset)); | ||
| 620 | $entry4->set_text($axmud::AUTHORS); | ||
| 621 | |||
| 622 | $self->addLabel($grid, 'Copyright', | ||
| 623 | 1, 3, (4 + $offset), (5 + $offset)); | ||
| 624 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 625 | 3, 12, (4 + $offset), (5 + $offset)); | ||
| 626 | $entry5->set_text($axmud::COPYRIGHT); | ||
| 627 | |||
| 628 | $self->addLabel($grid, 'Website', | ||
| 629 | 1, 3, (5 + $offset), (6 + $offset)); | ||
| 630 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 631 | 3, 10, (5 + $offset), (6 + $offset)); | ||
| 632 | $entry6->set_text($axmud::URL); | ||
| 633 | |||
| 634 | my $button2 = $self->addButton($grid, 'Open', 'Open this website in a web browser', undef, | ||
| 635 | 10, 12, (5 + $offset), (6 + $offset)); | ||
| 636 | if (! $axmud::URL) { | ||
| 637 | |||
| 638 | $button2->set_sensitive(FALSE); | ||
| 639 | } | ||
| 640 | $button2->signal_connect('clicked' => sub { | ||
| 641 | |||
| 642 | if ($axmud::URL) { | ||
| 643 | |||
| 644 | $axmud::CLIENT->openURL($axmud::URL); | ||
| 645 | } | ||
| 646 | }); | ||
| 647 | |||
| 648 | $self->addLabel($grid, 'Description', | ||
| 649 | 1, 3, (6 + $offset), (7 + $offset)); | ||
| 650 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 651 | 3, 12, (6 + $offset), (7 + $offset)); | ||
| 652 | $entry7->set_text($axmud::DESCRIP); | ||
| 653 | |||
| 654 | my $button3 = $self->addButton($grid, 'About...', 'About ' . $axmud::SCRIPT, undef, | ||
| 655 | 1, 4, (7 + $offset), (8 + $offset)); | ||
| 656 | $button3->signal_connect('clicked' => sub { | ||
| 657 | |||
| 658 | # Only one About window can be open at a time | ||
| 659 | if (! $axmud::CLIENT->aboutWin) { | ||
| 660 | |||
| 661 | $self->quickFreeWin( | ||
| 662 | 'Games::Axmud::OtherWin::About', | ||
| 663 | $self->session, | ||
| 664 | # config | ||
| 665 | 'first_tab' => 'about', | ||
| 666 | ) | ||
| 667 | |||
| 668 | } else { | ||
| 669 | |||
| 670 | # Only one About window can be open at a time | ||
| 671 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 672 | # Open it at the right page | ||
| 673 | $axmud::CLIENT->aboutWin->notebook->set_current_page(0); | ||
| 674 | } | ||
| 675 | }); | ||
| 676 | |||
| 677 | my $button4 = $self->addButton( | ||
| 678 | $grid, 'Credits...', 'Show information about credits', undef, | ||
| 679 | 4, 6, (7 + $offset), (8 + $offset)); | ||
| 680 | $button4->signal_connect('clicked' => sub { | ||
| 681 | |||
| 682 | # Only one About window can be open at a time | ||
| 683 | if (! $axmud::CLIENT->aboutWin) { | ||
| 684 | |||
| 685 | $self->quickFreeWin( | ||
| 686 | 'Games::Axmud::OtherWin::About', | ||
| 687 | $self->session, | ||
| 688 | # config | ||
| 689 | 'first_tab' => 'credits', | ||
| 690 | ) | ||
| 691 | |||
| 692 | } else { | ||
| 693 | |||
| 694 | # Only one About window can be open at a time | ||
| 695 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 696 | # Open it at the right page | ||
| 697 | $axmud::CLIENT->aboutWin->notebook->set_current_page(1); | ||
| 698 | } | ||
| 699 | }); | ||
| 700 | |||
| 701 | my $button5 = $self->addButton($grid, 'Quick help...', 'Show quick help', undef, | ||
| 702 | 6, 9, (7 + $offset), (8 + $offset)); | ||
| 703 | $button5->signal_connect('clicked' => sub { | ||
| 704 | |||
| 705 | # Only one About window can be open at a time | ||
| 706 | if (! $axmud::CLIENT->aboutWin) { | ||
| 707 | |||
| 708 | $self->quickFreeWin( | ||
| 709 | 'Games::Axmud::OtherWin::About', | ||
| 710 | $self->session, | ||
| 711 | # config | ||
| 712 | 'first_tab' => 'help', | ||
| 713 | ) | ||
| 714 | |||
| 715 | } else { | ||
| 716 | |||
| 717 | # Only one About window can be open at a time | ||
| 718 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 719 | # Open it at the right page | ||
| 720 | $axmud::CLIENT->aboutWin->notebook->set_current_page(2); | ||
| 721 | } | ||
| 722 | }); | ||
| 723 | |||
| 724 | my $button6 = $self->addButton($grid, | ||
| 725 | 'Peek/Poke list...', | ||
| 726 | 'Show strings for Peek/Poke operations', | ||
| 727 | undef, | ||
| 728 | 9, 12, (7 + $offset), (8 + $offset)); | ||
| 729 | $button6->signal_connect('clicked' => sub { | ||
| 730 | |||
| 731 | # Only one About window can be open at a time | ||
| 732 | if (! $axmud::CLIENT->aboutWin) { | ||
| 733 | |||
| 734 | $self->quickFreeWin( | ||
| 735 | 'Games::Axmud::OtherWin::About', | ||
| 736 | $self->session, | ||
| 737 | # config | ||
| 738 | 'first_tab' => 'peek', | ||
| 739 | ) | ||
| 740 | |||
| 741 | } else { | ||
| 742 | |||
| 743 | # Only one About window can be open at a time | ||
| 744 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 745 | # Open it at the right page | ||
| 746 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 747 | } | ||
| 748 | }); | ||
| 749 | |||
| 750 | my $button7 = $self->addButton($grid, 'Changes...', 'Show list of changes', undef, | ||
| 751 | 1, 4, (8 + $offset), (9 + $offset)); | ||
| 752 | $button7->signal_connect('clicked' => sub { | ||
| 753 | |||
| 754 | # Only one About window can be open at a time | ||
| 755 | if (! $axmud::CLIENT->aboutWin) { | ||
| 756 | |||
| 757 | $self->quickFreeWin( | ||
| 758 | 'Games::Axmud::OtherWin::About', | ||
| 759 | $self->session, | ||
| 760 | # config | ||
| 761 | 'first_tab' => 'changes', | ||
| 762 | ) | ||
| 763 | |||
| 764 | } else { | ||
| 765 | |||
| 766 | # Only one About window can be open at a time | ||
| 767 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 768 | # Open it at the right page | ||
| 769 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 770 | } | ||
| 771 | }); | ||
| 772 | |||
| 773 | my $button8 = $self->addButton($grid, 'Installation...', 'Show installation guide', undef, | ||
| 774 | 4, 6, (8 + $offset), (9 + $offset)); | ||
| 775 | $button8->signal_connect('clicked' => sub { | ||
| 776 | |||
| 777 | # Only one About window can be open at a time | ||
| 778 | if (! $axmud::CLIENT->aboutWin) { | ||
| 779 | |||
| 780 | $self->quickFreeWin( | ||
| 781 | 'Games::Axmud::OtherWin::About', | ||
| 782 | $self->session, | ||
| 783 | # config | ||
| 784 | 'first_tab' => 'install', | ||
| 785 | ) | ||
| 786 | |||
| 787 | } else { | ||
| 788 | |||
| 789 | # Only one About window can be open at a time | ||
| 790 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 791 | # Open it at the right page | ||
| 792 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 793 | } | ||
| 794 | }); | ||
| 795 | |||
| 796 | my $button9 = $self->addButton($grid, 'GPL License...', 'Show text of GPL License', undef, | ||
| 797 | 6, 9, (8 + $offset), (9 + $offset)); | ||
| 798 | $button9->signal_connect('clicked' => sub { | ||
| 799 | |||
| 800 | # Only one About window can be open at a time | ||
| 801 | if (! $axmud::CLIENT->aboutWin) { | ||
| 802 | |||
| 803 | $self->quickFreeWin( | ||
| 804 | 'Games::Axmud::OtherWin::About', | ||
| 805 | $self->session, | ||
| 806 | # config | ||
| 807 | 'first_tab' => 'license', | ||
| 808 | ) | ||
| 809 | |||
| 810 | } else { | ||
| 811 | |||
| 812 | # Only one About window can be open at a time | ||
| 813 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 814 | # Open it at the right page | ||
| 815 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 816 | } | ||
| 817 | }); | ||
| 818 | |||
| 819 | my $button10 = $self->addButton($grid, | ||
| 820 | 'LGPL License...', | ||
| 821 | 'Show text of LGPL License', | ||
| 822 | undef, | ||
| 823 | 9, 12, (8 + $offset), (9 + $offset)); | ||
| 824 | $button10->signal_connect('clicked' => sub { | ||
| 825 | |||
| 826 | # Only one About window can be open at a time | ||
| 827 | if (! $axmud::CLIENT->aboutWin) { | ||
| 828 | |||
| 829 | $self->quickFreeWin( | ||
| 830 | 'Games::Axmud::OtherWin::About', | ||
| 831 | $self->session, | ||
| 832 | # config | ||
| 833 | 'first_tab' => 'license_2', | ||
| 834 | ) | ||
| 835 | |||
| 836 | } else { | ||
| 837 | |||
| 838 | # Only one About window can be open at a time | ||
| 839 | $axmud::CLIENT->aboutWin->restoreFocus(); | ||
| 840 | # Open it at the right page | ||
| 841 | $axmud::CLIENT->aboutWin->notebook->set_current_page(3); | ||
| 842 | } | ||
| 843 | }); | ||
| 844 | |||
| 845 | # Right column | ||
| 846 | $self->addLabel($grid, 'Name in data files', | ||
| 847 | 7, 9, (1 + $offset), (2 + $offset)); | ||
| 848 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 849 | 9, 12, (1 + $offset), (2 + $offset)); | ||
| 850 | $entry8->set_text($axmud::NAME_FILE); | ||
| 851 | |||
| 852 | $self->addLabel($grid, 'Script date', | ||
| 853 | 7, 9, (2 + $offset), (3 + $offset)); | ||
| 854 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 855 | 9, 12, (2 + $offset), (3 + $offset)); | ||
| 856 | $entry3->set_text($axmud::DATE); | ||
| 857 | |||
| 858 | # Tab complete | ||
| 859 | return 1; | ||
| 860 | } | ||
| 861 | |||
| 862 | sub client2Tab { | ||
| 863 | |||
| 864 | # Client2 tab | ||
| 865 | # | ||
| 866 | # Expected arguments | ||
| 867 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 868 | # | ||
| 869 | # Return values | ||
| 870 | # 'undef' on improper arguments | ||
| 871 | # 1 otherwise | ||
| 872 | |||
| 873 | my ($self, $innerNotebook, $check) = @_; | ||
| 874 | |||
| 875 | # Local variables | ||
| 876 | my @columnList; | ||
| 877 | |||
| 878 | # Check for improper arguments | ||
| 879 | if (! defined $innerNotebook || defined $check) { | ||
| 880 | |||
| 881 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client2Tab', @_); | ||
| 882 | } | ||
| 883 | |||
| 884 | # Tab setup | ||
| 885 | my $grid = $self->addTab( | ||
| 886 | $innerNotebook, | ||
| 887 | 'Page _2', | ||
| 888 | ['Session list'], | ||
| 889 | ); | ||
| 890 | |||
| 891 | # Session list | ||
| 892 | $self->addLabel($grid, '<b>Session list</b>', | ||
| 893 | 0, 12, 0, 1); | ||
| 894 | $self->addLabel($grid, | ||
| 895 | '<i>List of sessions (each corresponding to a single connection to a world)</i>', | ||
| 896 | 1, 12, 1, 2); | ||
| 897 | |||
| 898 | # Add a simple list | ||
| 899 | @columnList = ( | ||
| 900 | 'Num', 'text', | ||
| 901 | 'Current', 'bool', | ||
| 902 | 'Visible', 'bool', | ||
| 903 | 'Logged in', 'bool', | ||
| 904 | 'Status', 'text', | ||
| 905 | 'World', 'text', | ||
| 906 | 'Character', 'text', | ||
| 907 | ); | ||
| 908 | |||
| 909 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 910 | 1, 12, 2, 8); | ||
| 911 | |||
| 912 | # Initialise the simple list | ||
| 913 | $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 914 | |||
| 915 | # Add buttons | ||
| 916 | my $button = $self->addButton($grid, | ||
| 917 | 'Edit...', 'Edit the selected session', undef, | ||
| 918 | 1, 3, 8, 9); | ||
| 919 | $button->signal_connect('clicked' => sub { | ||
| 920 | |||
| 921 | my ($number, $session); | ||
| 922 | |||
| 923 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 924 | if (defined $number) { | ||
| 925 | |||
| 926 | $session = $axmud::CLIENT->ivShow('sessionHash', $number); | ||
| 927 | if ($session) { | ||
| 928 | |||
| 929 | # Open an 'pref' window for the selected session | ||
| 930 | $self->createFreeWin( | ||
| 931 | 'Games::Axmud::PrefWin::Session', | ||
| 932 | $self, | ||
| 933 | $session, | ||
| 934 | 'Session preferences', | ||
| 935 | ); | ||
| 936 | } | ||
| 937 | } | ||
| 938 | }); | ||
| 939 | |||
| 940 | my $button2 = $self->addButton($grid, | ||
| 941 | 'Switch to session', 'Make the selected session the current (visible) one', undef, | ||
| 942 | 3, 6, 8, 9); | ||
| 943 | $button2->signal_connect('clicked' => sub { | ||
| 944 | |||
| 945 | my ($number, $session); | ||
| 946 | |||
| 947 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 948 | if (defined $number) { | ||
| 949 | |||
| 950 | $session = $axmud::CLIENT->ivShow('sessionHash', $number); | ||
| 951 | if ($session && $session->defaultTabObj) { | ||
| 952 | |||
| 953 | $session->defaultTabObj->paneObj->setVisibleTab($session->defaultTabObj); | ||
| 954 | } | ||
| 955 | |||
| 956 | # Refresh the simple list | ||
| 957 | $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 958 | } | ||
| 959 | }); | ||
| 960 | |||
| 961 | my $button3 = $self->addButton($grid, | ||
| 962 | 'Refresh list', 'Refresh the list of sessions', undef, | ||
| 963 | 9, 12, 8, 9); | ||
| 964 | $button3->signal_connect('clicked' => sub { | ||
| 965 | |||
| 966 | # Refresh the simple list | ||
| 967 | $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 968 | }); | ||
| 969 | |||
| 970 | # Tab complete | ||
| 971 | return 1; | ||
| 972 | } | ||
| 973 | |||
| 974 | sub client2Tab_refreshList { | ||
| 975 | |||
| 976 | # Resets the simple list displayed by $self->client2Tab | ||
| 977 | # | ||
| 978 | # Expected arguments | ||
| 979 | # $slWidget - The GA::Obj::SimpleList | ||
| 980 | # $columns - The number of columns | ||
| 981 | # | ||
| 982 | # Return values | ||
| 983 | # 'undef' on improper arguments | ||
| 984 | # 1 otherwise | ||
| 985 | |||
| 986 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 987 | |||
| 988 | # Local variables | ||
| 989 | my (@winList, @dataList); | ||
| 990 | |||
| 991 | # Check for improper arguments | ||
| 992 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 993 | |||
| 994 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client2Tab_refreshList', @_); | ||
| 995 | } | ||
| 996 | |||
| 997 | # Get a list of 'main' windows, so we can mark visible windows | ||
| 998 | @winList = $axmud::CLIENT->desktopObj->listGridWins('main'); | ||
| 999 | |||
| 1000 | # Compile the simple list data | ||
| 1001 | OUTER: foreach my $session ($axmud::CLIENT->listSessions()) { | ||
| 1002 | |||
| 1003 | my ($currentFlag, $visibleFlag, $world, $char); | ||
| 1004 | |||
| 1005 | if ($session eq $axmud::CLIENT->currentSession) { | ||
| 1006 | $currentFlag = TRUE; | ||
| 1007 | } else { | ||
| 1008 | $currentFlag = FALSE; | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | $visibleFlag = FALSE; | ||
| 1012 | INNER: foreach my $winObj (@winList) { | ||
| 1013 | |||
| 1014 | if ($winObj->visibleSession && $winObj->visibleSession eq $session) { | ||
| 1015 | |||
| 1016 | $visibleFlag = TRUE; | ||
| 1017 | last INNER; | ||
| 1018 | } | ||
| 1019 | } | ||
| 1020 | |||
| 1021 | $world = $session->currentWorld->name; | ||
| 1022 | if ($session->currentChar) { | ||
| 1023 | |||
| 1024 | $char = $session->currentChar->name; | ||
| 1025 | } | ||
| 1026 | |||
| 1027 | push (@dataList, | ||
| 1028 | $session->number, | ||
| 1029 | $currentFlag, | ||
| 1030 | $visibleFlag, | ||
| 1031 | $session->loginFlag, | ||
| 1032 | $session->status, | ||
| 1033 | $world, | ||
| 1034 | $char, | ||
| 1035 | ); | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | # Reset the simple list | ||
| 1039 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 1040 | |||
| 1041 | return 1; | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | sub client3Tab { | ||
| 1045 | |||
| 1046 | # Client3 tab | ||
| 1047 | # | ||
| 1048 | # Expected arguments | ||
| 1049 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1050 | # | ||
| 1051 | # Return values | ||
| 1052 | # 'undef' on improper arguments | ||
| 1053 | # 1 otherwise | ||
| 1054 | |||
| 1055 | my ($self, $innerNotebook, $check) = @_; | ||
| 1056 | |||
| 1057 | # Check for improper arguments | ||
| 1058 | if (! defined $innerNotebook || defined $check) { | ||
| 1059 | |||
| 1060 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client3Tab', @_); | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | # Tab setup | ||
| 1064 | my $grid = $self->addTab( | ||
| 1065 | $innerNotebook, | ||
| 1066 | 'Page _3', | ||
| 1067 | ['File permissions'], | ||
| 1068 | ); | ||
| 1069 | |||
| 1070 | # File permissions | ||
| 1071 | $self->addLabel($grid, '<b>File permissions</b>', | ||
| 1072 | 0, 12, 0, 1); | ||
| 1073 | |||
| 1074 | my $checkButton = $self->addCheckButton($grid, 'Load config file', undef, FALSE, | ||
| 1075 | 1, 6, 1, 2); | ||
| 1076 | $checkButton->set_active($axmud::CLIENT->loadConfigFlag); | ||
| 1077 | |||
| 1078 | my $checkButton2 = $self->addCheckButton($grid, 'Save config file', undef, FALSE, | ||
| 1079 | 1, 6, 2, 3); | ||
| 1080 | $checkButton2->set_active($axmud::CLIENT->saveConfigFlag); | ||
| 1081 | |||
| 1082 | my $checkButton3 = $self->addCheckButton($grid, 'Load other files', undef, FALSE, | ||
| 1083 | 1, 6, 3, 4); | ||
| 1084 | $checkButton3->set_active($axmud::CLIENT->loadDataFlag); | ||
| 1085 | |||
| 1086 | my $checkButton4 = $self->addCheckButton($grid, 'Save other files', undef, FALSE, | ||
| 1087 | 7, 12, 1, 2); | ||
| 1088 | $checkButton4->set_active($axmud::CLIENT->saveDataFlag); | ||
| 1089 | |||
| 1090 | my $checkButton5 = $self->addCheckButton( | ||
| 1091 | $grid, 'All files deleted at startup', undef, FALSE, | ||
| 1092 | 7, 12, 2, 3); | ||
| 1093 | $checkButton5->set_active($axmud::CLIENT->deleteFilesAtStartFlag); | ||
| 1094 | |||
| 1095 | my $checkButton6 = $self->addCheckButton($grid, 'File operation has failed', undef, FALSE, | ||
| 1096 | 7, 12, 3, 4); | ||
| 1097 | $checkButton6->set_active($axmud::CLIENT->fileFailFlag); | ||
| 1098 | |||
| 1099 | # Tab complete | ||
| 1100 | return 1; | ||
| 1101 | } | ||
| 1102 | |||
| 1103 | sub client4Tab { | ||
| 1104 | |||
| 1105 | # Client4 tab | ||
| 1106 | # | ||
| 1107 | # Expected arguments | ||
| 1108 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1109 | # | ||
| 1110 | # Return values | ||
| 1111 | # 'undef' on improper arguments | ||
| 1112 | # 1 otherwise | ||
| 1113 | |||
| 1114 | my ($self, $innerNotebook, $check) = @_; | ||
| 1115 | |||
| 1116 | # Check for improper arguments | ||
| 1117 | if (! defined $innerNotebook || defined $check) { | ||
| 1118 | |||
| 1119 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client4Tab', @_); | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | # Tab setup | ||
| 1123 | my $grid = $self->addTab( | ||
| 1124 | $innerNotebook, | ||
| 1125 | 'Page _4', | ||
| 1126 | ['Directories (folders)', 'File save preferences'], | ||
| 1127 | ); | ||
| 1128 | |||
| 1129 | # Directories (folders) | ||
| 1130 | $self->addLabel($grid, '<b>Directories (folders)</b>', | ||
| 1131 | 0, 12, 0, 1); | ||
| 1132 | |||
| 1133 | $self->addLabel($grid, 'Installation (base) directory', | ||
| 1134 | 1, 3, 1, 2); | ||
| 1135 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 1136 | 3, 12, 1, 2); | ||
| 1137 | $entry->set_text($axmud::TOP_DIR); | ||
| 1138 | |||
| 1139 | $self->addLabel($grid, 'Shared install file directory', | ||
| 1140 | 1, 3, 2, 3); | ||
| 1141 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 1142 | 3, 12, 2, 3); | ||
| 1143 | $entry2->set_text($axmud::SHARE_DIR); | ||
| 1144 | |||
| 1145 | $self->addLabel($grid, 'Current data directory', | ||
| 1146 | 1, 3, 3, 4); | ||
| 1147 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 1148 | 3, 12, 3, 4); | ||
| 1149 | $entry3->set_text($axmud::DATA_DIR); | ||
| 1150 | |||
| 1151 | my $button = $self->addButton($grid, | ||
| 1152 | 'Set', 'Sets the location of ' . $axmud::SCRIPT . '\'s data directory', undef, | ||
| 1153 | 7, 9, 4, 5); | ||
| 1154 | $button->signal_connect('clicked' => sub { | ||
| 1155 | |||
| 1156 | # Set the directory | ||
| 1157 | $self->session->pseudoCmd('setdatadirectory', $self->pseudoCmdMode); | ||
| 1158 | }); | ||
| 1159 | |||
| 1160 | my $button2 = $self->addButton($grid, | ||
| 1161 | 'Reset', 'Resets the location of ' . $axmud::SCRIPT . '\'s data directory', undef, | ||
| 1162 | 9, 12, 4, 5); | ||
| 1163 | $button2->signal_connect('clicked' => sub { | ||
| 1164 | |||
| 1165 | # Reset the directory | ||
| 1166 | $self->session->pseudoCmd('setdatadirectory -r', $self->pseudoCmdMode); | ||
| 1167 | }); | ||
| 1168 | |||
| 1169 | $self->addLabel($grid, 'Default data directory', | ||
| 1170 | 1, 3, 5, 6); | ||
| 1171 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 1172 | 3, 12, 5, 6); | ||
| 1173 | $entry4->set_text($axmud::DEFAULT_DATA_DIR); | ||
| 1174 | |||
| 1175 | # File save preferences | ||
| 1176 | $self->addLabel($grid, '<b>File save preferences</b>', | ||
| 1177 | 0, 12, 6, 7); | ||
| 1178 | |||
| 1179 | my $checkButton7 = $self->addCheckButton( | ||
| 1180 | $grid, 'Retain backup copies after saving', undef, FALSE, | ||
| 1181 | 1, 6, 7, 8); | ||
| 1182 | $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag); | ||
| 1183 | |||
| 1184 | my $button3 = $self->addButton($grid, | ||
| 1185 | 'Turn on', 'Retain backup copies after saving files', undef, | ||
| 1186 | 7, 9, 7, 8); | ||
| 1187 | $button3->signal_connect('clicked' => sub { | ||
| 1188 | |||
| 1189 | # Retain backups on | ||
| 1190 | $self->session->pseudoCmd('retainfilecopy on', $self->pseudoCmdMode); | ||
| 1191 | |||
| 1192 | # Update the checkbutton | ||
| 1193 | $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag); | ||
| 1194 | }); | ||
| 1195 | |||
| 1196 | my $button4 = $self->addButton($grid, | ||
| 1197 | 'Turn off', 'Don\'t retain backup copies after saving files', undef, | ||
| 1198 | 9, 12, 7, 8); | ||
| 1199 | $button4->signal_connect('clicked' => sub { | ||
| 1200 | |||
| 1201 | # Retain backups off | ||
| 1202 | $self->session->pseudoCmd('retainfilecopy off', $self->pseudoCmdMode); | ||
| 1203 | |||
| 1204 | # Update the checkbutton | ||
| 1205 | $checkButton7->set_active($axmud::CLIENT->autoRetainFileFlag); | ||
| 1206 | }); | ||
| 1207 | |||
| 1208 | my $checkButton8 = $self->addCheckButton($grid, 'Enable auto-saves', undef, FALSE, | ||
| 1209 | 1, 6, 8, 9); | ||
| 1210 | $checkButton8->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 1211 | |||
| 1212 | my $button5 = $self->addButton($grid, | ||
| 1213 | 'Turn on', 'Turns autosaves on', undef, | ||
| 1214 | 7, 9, 8, 9); | ||
| 1215 | $button5->signal_connect('clicked' => sub { | ||
| 1216 | |||
| 1217 | # Turn autosave on | ||
| 1218 | $self->session->pseudoCmd('autosave on', $self->pseudoCmdMode); | ||
| 1219 | |||
| 1220 | # Update the checkbutton | ||
| 1221 | $checkButton8->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 1222 | }); | ||
| 1223 | |||
| 1224 | my $button6 = $self->addButton($grid, | ||
| 1225 | 'Turn off', 'Turns autosaves off', undef, | ||
| 1226 | 9, 12, 8, 9); | ||
| 1227 | $button6->signal_connect('clicked' => sub { | ||
| 1228 | |||
| 1229 | # Turn autosave off | ||
| 1230 | $self->session->pseudoCmd('autosave off', $self->pseudoCmdMode); | ||
| 1231 | |||
| 1232 | # Update the checkbutton | ||
| 1233 | $checkButton8->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 1234 | }); | ||
| 1235 | |||
| 1236 | $self->addLabel($grid, 'Time interval (minutes)', | ||
| 1237 | 1, 3, 9, 10); | ||
| 1238 | my $entry5 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef, | ||
| 1239 | 3, 6, 9, 10); | ||
| 1240 | $entry5->set_text($axmud::CLIENT->autoSaveWaitTime); | ||
| 1241 | |||
| 1242 | my $button7 = $self->addButton($grid, | ||
| 1243 | 'Set interval', 'Set the time between successive auto-saves', undef, | ||
| 1244 | 7, 9, 9, 10); | ||
| 1245 | $button7->signal_connect('clicked' => sub { | ||
| 1246 | |||
| 1247 | if ($self->checkEntryIcon($entry5)) { | ||
| 1248 | |||
| 1249 | # Set autosave time | ||
| 1250 | $self->session->pseudoCmd('autosave ' . $entry5->get_text(), $self->pseudoCmdMode); | ||
| 1251 | |||
| 1252 | # Update the checkbutton | ||
| 1253 | $checkButton8->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 1254 | } | ||
| 1255 | }); | ||
| 1256 | |||
| 1257 | my $checkButton9 = $self->addCheckButton($grid, | ||
| 1258 | 'Split world model file (may prevent memory errors)', | ||
| 1259 | undef, FALSE, | ||
| 1260 | 1, 6, 10, 11); | ||
| 1261 | $checkButton9->set_active($axmud::CLIENT->allowModelSplitFlag); | ||
| 1262 | |||
| 1263 | my $button8 = $self->addButton($grid, | ||
| 1264 | 'Turn on', 'Turns on splitting world model file', undef, | ||
| 1265 | 7, 9, 10, 11); | ||
| 1266 | $button8->signal_connect('clicked' => sub { | ||
| 1267 | |||
| 1268 | # Turn splitting on | ||
| 1269 | $self->session->pseudoCmd('splitmodel on', $self->pseudoCmdMode); | ||
| 1270 | |||
| 1271 | # Update the checkbutton | ||
| 1272 | $checkButton9->set_active($axmud::CLIENT->allowModelSplitFlag); | ||
| 1273 | }); | ||
| 1274 | |||
| 1275 | my $button9 = $self->addButton($grid, | ||
| 1276 | 'Turn off', 'Turns off splitting world model file', undef, | ||
| 1277 | 9, 12, 10, 11); | ||
| 1278 | $button9->signal_connect('clicked' => sub { | ||
| 1279 | |||
| 1280 | # Turn splitting off | ||
| 1281 | $self->session->pseudoCmd('splitmodel off', $self->pseudoCmdMode); | ||
| 1282 | |||
| 1283 | # Update the checkbutton | ||
| 1284 | $checkButton9->set_active($axmud::CLIENT->allowModelSplitFlag); | ||
| 1285 | }); | ||
| 1286 | |||
| 1287 | $self->addLabel($grid, 'Split file size (rooms)', | ||
| 1288 | 1, 3, 11, 12); | ||
| 1289 | my $entry6 = $self->addEntryWithIcon($grid, undef, 'int', 1000, undef, | ||
| 1290 | 3, 6, 11, 12); | ||
| 1291 | $entry6->set_text($axmud::CLIENT->modelSplitSize); | ||
| 1292 | |||
| 1293 | my $button10 = $self->addButton($grid, | ||
| 1294 | 'Set size', 'Set the size of split world model files', undef, | ||
| 1295 | 7, 9, 11, 12); | ||
| 1296 | $button10->signal_connect('clicked' => sub { | ||
| 1297 | |||
| 1298 | if ($self->checkEntryIcon($entry6)) { | ||
| 1299 | |||
| 1300 | # Set split size | ||
| 1301 | $self->session->pseudoCmd( | ||
| 1302 | 'splitmodel ' . $entry6->get_text(), | ||
| 1303 | $self->pseudoCmdMode, | ||
| 1304 | ); | ||
| 1305 | |||
| 1306 | # Update the checkbutton | ||
| 1307 | $checkButton9->set_active($axmud::CLIENT->allowModelSplitFlag); | ||
| 1308 | } | ||
| 1309 | }); | ||
| 1310 | |||
| 1311 | my $button11 = $self->addButton($grid, | ||
| 1312 | 'Reset size', 'Resets the size of split world model files', undef, | ||
| 1313 | 9, 12, 11, 12); | ||
| 1314 | $button11->signal_connect('clicked' => sub { | ||
| 1315 | |||
| 1316 | if ($self->checkEntryIcon($entry6)) { | ||
| 1317 | |||
| 1318 | # Set split size | ||
| 1319 | $self->session->pseudoCmd( | ||
| 1320 | 'splitmodel -d', | ||
| 1321 | $self->pseudoCmdMode, | ||
| 1322 | ); | ||
| 1323 | |||
| 1324 | # Update the checkbutton/entry | ||
| 1325 | $entry6->set_text($axmud::CLIENT->modelSplitSize); | ||
| 1326 | $checkButton9->set_active($axmud::CLIENT->allowModelSplitFlag); | ||
| 1327 | } | ||
| 1328 | }); | ||
| 1329 | |||
| 1330 | # Tab complete | ||
| 1331 | return 1; | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | sub client5Tab { | ||
| 1335 | |||
| 1336 | # Client5 tab | ||
| 1337 | # | ||
| 1338 | # Expected arguments | ||
| 1339 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1340 | # | ||
| 1341 | # Return values | ||
| 1342 | # 'undef' on improper arguments | ||
| 1343 | # 1 otherwise | ||
| 1344 | |||
| 1345 | my ($self, $innerNotebook, $check) = @_; | ||
| 1346 | |||
| 1347 | # Local variables | ||
| 1348 | my ( | ||
| 1349 | @initList, @initList2, @comboList, @comboList2, | ||
| 1350 | %comboHash, %comboHash2, | ||
| 1351 | ); | ||
| 1352 | |||
| 1353 | # Check for improper arguments | ||
| 1354 | if (! defined $innerNotebook || defined $check) { | ||
| 1355 | |||
| 1356 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client5Tab', @_); | ||
| 1357 | } | ||
| 1358 | |||
| 1359 | # Tab setup | ||
| 1360 | my $grid = $self->addTab( | ||
| 1361 | $innerNotebook, | ||
| 1362 | 'Page _5', | ||
| 1363 | ['Auto-backup operations', 'Manual backup operations'], | ||
| 1364 | ); | ||
| 1365 | |||
| 1366 | # Auto-backup operations | ||
| 1367 | $self->addLabel($grid, '<b>Auto-backup operations</b>', | ||
| 1368 | 0, 12, 0, 1); | ||
| 1369 | $self->addLabel( | ||
| 1370 | $grid, | ||
| 1371 | '<i>Automatically create a backup of the entire ' . $axmud::SCRIPT | ||
| 1372 | . ' data directory</i>', | ||
| 1373 | 1, 12, 1, 2); | ||
| 1374 | |||
| 1375 | $self->addLabel($grid, 'Perform auto-backup', | ||
| 1376 | 1, 3, 2, 3); | ||
| 1377 | |||
| 1378 | @initList = ( | ||
| 1379 | '-n' => 'Never', | ||
| 1380 | '-a' => 'Whenever ' . $axmud::SCRIPT . ' starts', | ||
| 1381 | '-p' => 'Whenever ' . $axmud::SCRIPT . ' shuts down', | ||
| 1382 | '-x' => 'At regular intervals, when ' . $axmud::SCRIPT . ' starts', | ||
| 1383 | '-y' => 'At regular intervals, when ' . $axmud::SCRIPT . ' shuts down', | ||
| 1384 | ); | ||
| 1385 | |||
| 1386 | do { | ||
| 1387 | |||
| 1388 | my $switch = shift @initList; | ||
| 1389 | my $descrip = shift @initList; | ||
| 1390 | |||
| 1391 | $comboHash{$descrip} = $switch; | ||
| 1392 | push (@comboList, $descrip); | ||
| 1393 | |||
| 1394 | } until (! @initList); | ||
| 1395 | |||
| 1396 | my $comboBox = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 1397 | TRUE, # No 'undef' value used | ||
| 1398 | 3, 9, 2, 3); | ||
| 1399 | |||
| 1400 | my $button = $self->addButton($grid, | ||
| 1401 | 'Set method', 'Set when auto-backups are performed', undef, | ||
| 1402 | 9, 12, 2, 3); | ||
| 1403 | $button->signal_connect('clicked' => sub { | ||
| 1404 | |||
| 1405 | my $choice = $comboBox->get_active_text(); | ||
| 1406 | if ($choice && exists $comboHash{$choice}) { | ||
| 1407 | |||
| 1408 | $self->session->pseudoCmd( | ||
| 1409 | 'autobackup ' . $comboHash{$choice}, | ||
| 1410 | $self->pseudoCmdMode, | ||
| 1411 | ); | ||
| 1412 | } | ||
| 1413 | }); | ||
| 1414 | |||
| 1415 | $self->addLabel($grid, 'Backup interval (in days, range 0-366)', | ||
| 1416 | 1, 6, 3, 4); | ||
| 1417 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, 366, | ||
| 1418 | 6, 9, 3, 4); | ||
| 1419 | $entry->set_text($axmud::CLIENT->autoSaveWaitTime); | ||
| 1420 | |||
| 1421 | my $button2 = $self->addButton($grid, | ||
| 1422 | 'Set interval', | ||
| 1423 | 'Set how often auto-backups are performed, when doing auto-backup at intervals', | ||
| 1424 | undef, | ||
| 1425 | 9, 12, 3, 4); | ||
| 1426 | $button2->signal_connect('clicked' => sub { | ||
| 1427 | |||
| 1428 | my $num = $entry->get_text(); | ||
| 1429 | |||
| 1430 | if ($self->checkEntryIcon($entry)) { | ||
| 1431 | |||
| 1432 | $self->session->pseudoCmd('autobackup -i ' . $num); | ||
| 1433 | } | ||
| 1434 | }); | ||
| 1435 | |||
| 1436 | |||
| 1437 | $self->addLabel($grid, 'Use directory (folder)', | ||
| 1438 | 1, 3, 4, 5); | ||
| 1439 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 1440 | 3, 12, 4, 5); | ||
| 1441 | if (defined $axmud::CLIENT->autoBackupDir) { | ||
| 1442 | |||
| 1443 | $entry2->set_text($axmud::CLIENT->autoBackupDir); | ||
| 1444 | } | ||
| 1445 | |||
| 1446 | my $button3 = $self->addButton($grid, | ||
| 1447 | 'Set this directory', 'Set the directory where backup files are created', undef, | ||
| 1448 | 6, 9, 5, 6); | ||
| 1449 | $button3->signal_connect('clicked' => sub { | ||
| 1450 | |||
| 1451 | # If entry icon is a cross, rather than a tick, reset the directory so the user must | ||
| 1452 | # choose it manually every time a backup is done | ||
| 1453 | |||
| 1454 | my $dir = $entry2->get_text(); | ||
| 1455 | |||
| 1456 | if ($self->checkEntryIcon($entry2)) { | ||
| 1457 | $self->session->pseudoCmd('autobackup -f ' . $dir); | ||
| 1458 | } else { | ||
| 1459 | $self->session->pseudoCmd('autobackup -o'); | ||
| 1460 | } | ||
| 1461 | }); | ||
| 1462 | |||
| 1463 | my $button4 = $self->addButton($grid, | ||
| 1464 | '(or) Choose directory', 'Select a directory where backup files are created', undef, | ||
| 1465 | 9, 12, 5, 6); | ||
| 1466 | $button4->signal_connect('clicked' => sub { | ||
| 1467 | |||
| 1468 | my $dir = $self->showFileChooser( | ||
| 1469 | 'Set backup directory', | ||
| 1470 | 'select-folder', | ||
| 1471 | ); | ||
| 1472 | |||
| 1473 | if ($dir) { | ||
| 1474 | |||
| 1475 | $entry2->set_text($dir); | ||
| 1476 | $self->session->pseudoCmd('autobackup -f ' . $dir); | ||
| 1477 | } | ||
| 1478 | }); | ||
| 1479 | |||
| 1480 | my $checkButton = $self->addCheckButton($grid, 'Append time to backup file', undef, FALSE, | ||
| 1481 | 1, 6, 6, 7); | ||
| 1482 | $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag); | ||
| 1483 | |||
| 1484 | my $button5 = $self->addButton($grid, | ||
| 1485 | 'Turn on', 'Turns on appending time to backup file', undef, | ||
| 1486 | 6, 9, 6, 7); | ||
| 1487 | $button5->signal_connect('clicked' => sub { | ||
| 1488 | |||
| 1489 | $self->session->pseudoCmd('autobackup -a', $self->pseudoCmdMode); | ||
| 1490 | |||
| 1491 | # Update the checkbutton | ||
| 1492 | $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag); | ||
| 1493 | }); | ||
| 1494 | |||
| 1495 | my $button6 = $self->addButton($grid, | ||
| 1496 | 'Turn off', 'Turns off appending time to backup file', undef, | ||
| 1497 | 9, 12, 6, 7); | ||
| 1498 | $button6->signal_connect('clicked' => sub { | ||
| 1499 | |||
| 1500 | $self->session->pseudoCmd('autobackup -e', $self->pseudoCmdMode); | ||
| 1501 | |||
| 1502 | # Update the checkbutton | ||
| 1503 | $checkButton->set_active($axmud::CLIENT->autoBackupAppendFlag); | ||
| 1504 | }); | ||
| 1505 | |||
| 1506 | $self->addLabel($grid, 'Backup file type', | ||
| 1507 | 1, 3, 7, 8); | ||
| 1508 | |||
| 1509 | @initList2 = ( | ||
| 1510 | '-d' => 'Use the default for the system', | ||
| 1511 | '-t' => 'Create .tgz files', | ||
| 1512 | '-p' => 'Create .zip files', | ||
| 1513 | ); | ||
| 1514 | |||
| 1515 | do { | ||
| 1516 | |||
| 1517 | my $switch = shift @initList2; | ||
| 1518 | my $descrip = shift @initList2; | ||
| 1519 | |||
| 1520 | $comboHash2{$descrip} = $switch; | ||
| 1521 | push (@comboList2, $descrip); | ||
| 1522 | |||
| 1523 | } until (! @initList2); | ||
| 1524 | |||
| 1525 | my $comboBox2 = $self->addComboBox($grid, undef, \@comboList2, '', | ||
| 1526 | TRUE, # No 'undef' value used | ||
| 1527 | 3, 9, 7, 8); | ||
| 1528 | |||
| 1529 | my $button7 = $self->addButton($grid, | ||
| 1530 | 'Set file type', 'Set the archive type for the backup file', undef, | ||
| 1531 | 9, 12, 7, 8); | ||
| 1532 | $button7->signal_connect('clicked' => sub { | ||
| 1533 | |||
| 1534 | my $choice = $comboBox2->get_active_text(); | ||
| 1535 | if ($choice && exists $comboHash2{$choice}) { | ||
| 1536 | |||
| 1537 | $self->session->pseudoCmd( | ||
| 1538 | 'autobackup ' . $comboHash2{$choice}, | ||
| 1539 | $self->pseudoCmdMode, | ||
| 1540 | ); | ||
| 1541 | } | ||
| 1542 | }); | ||
| 1543 | |||
| 1544 | # Manual backup operations | ||
| 1545 | $self->addLabel($grid, '<b>Manual backup operations</b>', | ||
| 1546 | 0, 12, 8, 9); | ||
| 1547 | |||
| 1548 | my $button8 = $self->addButton( | ||
| 1549 | $grid, | ||
| 1550 | 'Create a backup file now', | ||
| 1551 | 'Manually create a backup file now', | ||
| 1552 | undef, | ||
| 1553 | 1, 6, 9, 10); | ||
| 1554 | $button8->signal_connect('clicked' => sub { | ||
| 1555 | |||
| 1556 | $self->session->pseudoCmd('backupdata', $self->pseudoCmdMode); | ||
| 1557 | }); | ||
| 1558 | |||
| 1559 | my $button9 = $self->addButton($grid, | ||
| 1560 | 'Restore data from a backup up file now', | ||
| 1561 | 'Manually restore data from a backup file', undef, | ||
| 1562 | 6, 12, 9, 10); | ||
| 1563 | $button9->signal_connect('clicked' => sub { | ||
| 1564 | |||
| 1565 | $self->session->pseudoCmd('restoredata', $self->pseudoCmdMode); | ||
| 1566 | }); | ||
| 1567 | |||
| 1568 | # Tab complete | ||
| 1569 | return 1; | ||
| 1570 | } | ||
| 1571 | |||
| 1572 | sub client6Tab { | ||
| 1573 | |||
| 1574 | # Client6 tab | ||
| 1575 | # | ||
| 1576 | # Expected arguments | ||
| 1577 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1578 | # | ||
| 1579 | # Return values | ||
| 1580 | # 'undef' on improper arguments | ||
| 1581 | # 1 otherwise | ||
| 1582 | |||
| 1583 | my ($self, $innerNotebook, $check) = @_; | ||
| 1584 | |||
| 1585 | # Local variables | ||
| 1586 | my @columnList; | ||
| 1587 | |||
| 1588 | # Check for improper arguments | ||
| 1589 | if (! defined $innerNotebook || defined $check) { | ||
| 1590 | |||
| 1591 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client6Tab', @_); | ||
| 1592 | } | ||
| 1593 | |||
| 1594 | # Tab setup | ||
| 1595 | my $grid = $self->addTab( | ||
| 1596 | $innerNotebook, | ||
| 1597 | 'Page _6', | ||
| 1598 | ['Client file objects'], | ||
| 1599 | ); | ||
| 1600 | |||
| 1601 | # Client file objects | ||
| 1602 | $self->addLabel($grid, '<b>Client file objects</b>', | ||
| 1603 | 0, 12, 0, 1); | ||
| 1604 | $self->addLabel($grid, | ||
| 1605 | '<i>List of data files currently in use by the client (session-independent)</i>', | ||
| 1606 | 1, 12, 1, 2); | ||
| 1607 | |||
| 1608 | # Add a simple list | ||
| 1609 | @columnList = ( | ||
| 1610 | 'Not saved', 'bool', | ||
| 1611 | 'File type', 'text', | ||
| 1612 | 'File name', 'text', | ||
| 1613 | 'Path', 'text', | ||
| 1614 | ); | ||
| 1615 | |||
| 1616 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 1617 | 1, 12, 2, 10); | ||
| 1618 | |||
| 1619 | # Initialise the simple list | ||
| 1620 | $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 1621 | |||
| 1622 | # Add buttons | ||
| 1623 | my $button = $self->addButton($grid, | ||
| 1624 | 'Save', 'Save all files whose data has been modified', undef, | ||
| 1625 | 1, 3, 10, 11); | ||
| 1626 | $button->signal_connect('clicked' => sub { | ||
| 1627 | |||
| 1628 | # Save files | ||
| 1629 | $self->session->pseudoCmd('save', $self->pseudoCmdMode); | ||
| 1630 | |||
| 1631 | # Refresh the simple list | ||
| 1632 | $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 1633 | }); | ||
| 1634 | |||
| 1635 | my $button2 = $self->addButton($grid, | ||
| 1636 | 'Force save', 'Save all files, even if their data has not been modified', undef, | ||
| 1637 | 3, 6, 10, 11); | ||
| 1638 | $button2->signal_connect('clicked' => sub { | ||
| 1639 | |||
| 1640 | # Save files | ||
| 1641 | $self->session->pseudoCmd('save -f', $self->pseudoCmdMode); | ||
| 1642 | |||
| 1643 | # Refresh the simple list | ||
| 1644 | $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 1645 | }); | ||
| 1646 | |||
| 1647 | my $button3 = $self->addButton($grid, | ||
| 1648 | 'Refresh list', 'Refresh the list of file objects', undef, | ||
| 1649 | 10, 12, 10, 11); | ||
| 1650 | $button3->signal_connect('clicked' => sub { | ||
| 1651 | |||
| 1652 | # Refresh the simple list | ||
| 1653 | $self->client6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 1654 | }); | ||
| 1655 | |||
| 1656 | # Tab complete | ||
| 1657 | return 1; | ||
| 1658 | } | ||
| 1659 | |||
| 1660 | sub client6Tab_refreshList { | ||
| 1661 | |||
| 1662 | # Resets the simple list displayed by $self->client6Tab | ||
| 1663 | # | ||
| 1664 | # Expected arguments | ||
| 1665 | # $slWidget - The GA::Obj::SimpleList | ||
| 1666 | # $columns - The number of columns | ||
| 1667 | # | ||
| 1668 | # Return values | ||
| 1669 | # 'undef' on improper arguments | ||
| 1670 | # 1 otherwise | ||
| 1671 | |||
| 1672 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 1673 | |||
| 1674 | # Local variables | ||
| 1675 | my (@fileList, @dataList); | ||
| 1676 | |||
| 1677 | # Check for improper arguments | ||
| 1678 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 1679 | |||
| 1680 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client6Tab_refreshList', @_); | ||
| 1681 | } | ||
| 1682 | |||
| 1683 | # Import the list of file objects | ||
| 1684 | @fileList = sort { | ||
| 1685 | if (lc($a->fileType) ne lc($b->fileType)) { | ||
| 1686 | lc($a->fileType) cmp lc($b->fileType); | ||
| 1687 | } else { | ||
| 1688 | lc($a->name) cmp lc($b->name); | ||
| 1689 | } | ||
| 1690 | |||
| 1691 | } ($axmud::CLIENT->ivValues('fileObjHash')); | ||
| 1692 | |||
| 1693 | # Compile the simple list data | ||
| 1694 | foreach my $obj (@fileList) { | ||
| 1695 | |||
| 1696 | push (@dataList, | ||
| 1697 | $obj->modifyFlag, | ||
| 1698 | $obj->fileType, | ||
| 1699 | $obj->name, | ||
| 1700 | $obj->actualPath, | ||
| 1701 | ); | ||
| 1702 | } | ||
| 1703 | |||
| 1704 | # Reset the simple list | ||
| 1705 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 1706 | |||
| 1707 | return 1; | ||
| 1708 | } | ||
| 1709 | |||
| 1710 | sub client7Tab { | ||
| 1711 | |||
| 1712 | # Client7 tab | ||
| 1713 | # | ||
| 1714 | # Expected arguments | ||
| 1715 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1716 | # | ||
| 1717 | # Return values | ||
| 1718 | # 'undef' on improper arguments | ||
| 1719 | # 1 otherwise | ||
| 1720 | |||
| 1721 | my ($self, $innerNotebook, $check) = @_; | ||
| 1722 | |||
| 1723 | # Local variables | ||
| 1724 | my @columnList; | ||
| 1725 | |||
| 1726 | # Check for improper arguments | ||
| 1727 | if (! defined $innerNotebook || defined $check) { | ||
| 1728 | |||
| 1729 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client7Tab', @_); | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | # Tab setup | ||
| 1733 | my $grid = $self->addTab( | ||
| 1734 | $innerNotebook, | ||
| 1735 | 'Page _7', | ||
| 1736 | ['IP lookup services'], | ||
| 1737 | ); | ||
| 1738 | |||
| 1739 | # IP lookup services | ||
| 1740 | $self->addLabel($grid, '<b>IP lookup services</b>', | ||
| 1741 | 0, 12, 0, 1); | ||
| 1742 | $self->addLabel($grid, | ||
| 1743 | '<i>List of URLs that return your IP address (one URL perl line, or use an empty' | ||
| 1744 | . ' list to disable lookup)</i>', | ||
| 1745 | 1, 12, 1, 2); | ||
| 1746 | |||
| 1747 | my $textView = $self->addTextView($grid, undef, TRUE, | ||
| 1748 | 1, 12, 2, 10); | ||
| 1749 | my $buffer = $textView->get_buffer(); | ||
| 1750 | $buffer->set_text(join("\n", $axmud::CLIENT->ipLookupList)); | ||
| 1751 | |||
| 1752 | my $button = $self->addButton( | ||
| 1753 | $grid, 'Set list', 'Set the list of IP lookup services', undef, | ||
| 1754 | 1, 3, 10, 11); | ||
| 1755 | # (->signal_connect appears below) | ||
| 1756 | |||
| 1757 | my $button2 = $self->addButton( | ||
| 1758 | $grid, 'Use default list', 'Uses the default list of IP lookup services', undef, | ||
| 1759 | 3, 6, 10, 11); | ||
| 1760 | # (->signal_connect appears below) | ||
| 1761 | |||
| 1762 | my $button3 = $self->addButton( | ||
| 1763 | $grid, 'Update list', 'Updates the list of IP lookup services', undef, | ||
| 1764 | 9, 12, 10, 11); | ||
| 1765 | # (->signal_connect appears below) | ||
| 1766 | |||
| 1767 | $self->addLabel($grid, '<u>Your IP address:</u>', | ||
| 1768 | 1, 3, 11, 12); | ||
| 1769 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 1770 | 3, 9, 11, 12); | ||
| 1771 | if (! defined $axmud::CLIENT->currentIP) { | ||
| 1772 | $entry->set_text('<unknown>'); | ||
| 1773 | } else { | ||
| 1774 | $entry->set_text($axmud::CLIENT->currentIP); | ||
| 1775 | } | ||
| 1776 | |||
| 1777 | my $button4 = $self->addButton( | ||
| 1778 | $grid, 'Fetch', 'Fetch your current IP address', undef, | ||
| 1779 | 9, 12, 11, 12); | ||
| 1780 | # (->signal_connect appears below) | ||
| 1781 | |||
| 1782 | # Set values for the textview and the entry | ||
| 1783 | $self->client7Tab_updateWidgets($buffer, $entry); | ||
| 1784 | |||
| 1785 | # (->signal_connects from above) | ||
| 1786 | $button->signal_connect('clicked' => sub { | ||
| 1787 | |||
| 1788 | my ( | ||
| 1789 | $text, | ||
| 1790 | @list, | ||
| 1791 | ); | ||
| 1792 | |||
| 1793 | $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer); | ||
| 1794 | if ($text =~ m/\S/) { | ||
| 1795 | |||
| 1796 | # Split the contents of the textview into a list | ||
| 1797 | @list = split("\n", $text); | ||
| 1798 | |||
| 1799 | # Set the list of IP lookup services. By using a join so soon after a split, we | ||
| 1800 | # safely eliminate newline chars | ||
| 1801 | $self->session->pseudoCmd( | ||
| 1802 | 'setlookup ' . join(' ', @list), | ||
| 1803 | $self->pseudoCmdMode, | ||
| 1804 | ); | ||
| 1805 | |||
| 1806 | } else { | ||
| 1807 | |||
| 1808 | # Empty the list of IP lookup services | ||
| 1809 | $self->session->pseudoCmd('setlookup', $self->pseudoCmdMode); | ||
| 1810 | } | ||
| 1811 | |||
| 1812 | # Update the textview and the entry | ||
| 1813 | $self->client7Tab_updateWidgets($buffer, $entry); | ||
| 1814 | }); | ||
| 1815 | |||
| 1816 | $button2->signal_connect('clicked' => sub { | ||
| 1817 | |||
| 1818 | # Reset the list of IP lookup services to the default list | ||
| 1819 | $self->session->pseudoCmd('resetlookup', $self->pseudoCmdMode); | ||
| 1820 | |||
| 1821 | # Update the textview and the entry | ||
| 1822 | $self->client7Tab_updateWidgets($buffer, $entry); | ||
| 1823 | }); | ||
| 1824 | |||
| 1825 | $button3->signal_connect('clicked' => sub { | ||
| 1826 | |||
| 1827 | # Update the textview and the entry | ||
| 1828 | $self->client7Tab_updateWidgets($buffer, $entry); | ||
| 1829 | }); | ||
| 1830 | |||
| 1831 | $button4->signal_connect('clicked' => sub { | ||
| 1832 | |||
| 1833 | # Force the client to re-fetch the user's IP address | ||
| 1834 | $self->session->pseudoCmd('forcelookup', $self->pseudoCmdMode); | ||
| 1835 | |||
| 1836 | # Update the textview and the entry | ||
| 1837 | $self->client7Tab_updateWidgets($buffer, $entry); | ||
| 1838 | }); | ||
| 1839 | |||
| 1840 | # Tab complete | ||
| 1841 | return 1; | ||
| 1842 | } | ||
| 1843 | |||
| 1844 | sub client7Tab_updateWidgets { | ||
| 1845 | |||
| 1846 | # Resets the textview and entry displayed by $self->client7Tab | ||
| 1847 | # | ||
| 1848 | # Expected arguments | ||
| 1849 | # $buffer - The Gtk3::TextBuffer | ||
| 1850 | # $entry - The Gtk3::Entry | ||
| 1851 | # | ||
| 1852 | # Return values | ||
| 1853 | # 'undef' on improper arguments | ||
| 1854 | # 1 otherwise | ||
| 1855 | |||
| 1856 | my ($self, $buffer, $entry, $check) = @_; | ||
| 1857 | |||
| 1858 | # Check for improper arguments | ||
| 1859 | if (! defined $buffer || ! defined $entry || defined $check) { | ||
| 1860 | |||
| 1861 | return $axmud::CLIENT->writeImproper( | ||
| 1862 | $self->_objClass . '->client7Tab_updateWidgets', | ||
| 1863 | @_ | ||
| 1864 | ); | ||
| 1865 | } | ||
| 1866 | |||
| 1867 | $buffer->set_text(join("\n", $axmud::CLIENT->ipLookupList)); | ||
| 1868 | if (! defined $axmud::CLIENT->currentIP) { | ||
| 1869 | $entry->set_text('<unknown>'); | ||
| 1870 | } else { | ||
| 1871 | $entry->set_text($axmud::CLIENT->currentIP); | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | return 1; | ||
| 1875 | } | ||
| 1876 | |||
| 1877 | sub client8Tab { | ||
| 1878 | |||
| 1879 | # Client8 tab | ||
| 1880 | # | ||
| 1881 | # Expected arguments | ||
| 1882 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1883 | # | ||
| 1884 | # Return values | ||
| 1885 | # 'undef' on improper arguments | ||
| 1886 | # 1 otherwise | ||
| 1887 | |||
| 1888 | my ($self, $innerNotebook, $check) = @_; | ||
| 1889 | |||
| 1890 | # Local variables | ||
| 1891 | my @columnList; | ||
| 1892 | |||
| 1893 | # Check for improper arguments | ||
| 1894 | if (! defined $innerNotebook || defined $check) { | ||
| 1895 | |||
| 1896 | return $axmud::CLIENT->writeImproper($self->_objClass . '->client8Tab', @_); | ||
| 1897 | } | ||
| 1898 | |||
| 1899 | # Tab setup | ||
| 1900 | my $grid = $self->addTab( | ||
| 1901 | $innerNotebook, | ||
| 1902 | 'Page _8', | ||
| 1903 | ['Reserved names'], | ||
| 1904 | ); | ||
| 1905 | |||
| 1906 | # Reserved names | ||
| 1907 | $self->addLabel($grid, '<b>Reserved names</b>', | ||
| 1908 | 0, 12, 0, 1); | ||
| 1909 | $self->addLabel($grid, | ||
| 1910 | '<i>List of names that can\'t be used as object names</i>', | ||
| 1911 | 1, 12, 1, 2); | ||
| 1912 | |||
| 1913 | # Add a simple list | ||
| 1914 | @columnList = ( | ||
| 1915 | 'Reserved name', 'text', | ||
| 1916 | ); | ||
| 1917 | |||
| 1918 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 1919 | 1, 12, 2, 12); | ||
| 1920 | |||
| 1921 | # Initialise the list | ||
| 1922 | @{$slWidget->{data}} | ||
| 1923 | = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('constReservedHash')); | ||
| 1924 | |||
| 1925 | # Tab complete | ||
| 1926 | return 1; | ||
| 1927 | } | ||
| 1928 | |||
| 1929 | sub settingsTab { | ||
| 1930 | |||
| 1931 | # Settings tab - called by $self->setupNotebook | ||
| 1932 | # | ||
| 1933 | # Expected arguments | ||
| 1934 | # (none besides $self) | ||
| 1935 | # | ||
| 1936 | # Return values | ||
| 1937 | # 'undef' on improper arguments | ||
| 1938 | # 1 otherwise | ||
| 1939 | |||
| 1940 | my ($self, $check) = @_; | ||
| 1941 | |||
| 1942 | # Check for improper arguments | ||
| 1943 | if (defined $check) { | ||
| 1944 | |||
| 1945 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settingsTab', @_); | ||
| 1946 | } | ||
| 1947 | |||
| 1948 | # Tab setup | ||
| 1949 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 1950 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Settings'); | ||
| 1951 | |||
| 1952 | # Add tabs to the inner notebook | ||
| 1953 | $self->settings1Tab($innerNotebook); | ||
| 1954 | $self->settings2Tab($innerNotebook); | ||
| 1955 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 1956 | |||
| 1957 | $self->settings3Tab($innerNotebook); | ||
| 1958 | $self->settings4Tab($innerNotebook); | ||
| 1959 | } | ||
| 1960 | $self->settings5Tab($innerNotebook); | ||
| 1961 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 1962 | |||
| 1963 | $self->settings6Tab($innerNotebook); | ||
| 1964 | } | ||
| 1965 | $self->settings7Tab($innerNotebook); | ||
| 1966 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 1967 | |||
| 1968 | $self->settings8Tab($innerNotebook); | ||
| 1969 | $self->settings9Tab($innerNotebook); | ||
| 1970 | $self->settings10Tab($innerNotebook); | ||
| 1971 | $self->settings11Tab($innerNotebook); | ||
| 1972 | } | ||
| 1973 | $self->settings12Tab($innerNotebook); | ||
| 1974 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 1975 | |||
| 1976 | $self->settings13Tab($innerNotebook); | ||
| 1977 | } | ||
| 1978 | |||
| 1979 | return 1; | ||
| 1980 | } | ||
| 1981 | |||
| 1982 | sub settings1Tab { | ||
| 1983 | |||
| 1984 | # Settings1 tab | ||
| 1985 | # | ||
| 1986 | # Expected arguments | ||
| 1987 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 1988 | # | ||
| 1989 | # Return values | ||
| 1990 | # 'undef' on improper arguments | ||
| 1991 | # 1 otherwise | ||
| 1992 | |||
| 1993 | my ($self, $innerNotebook, $check) = @_; | ||
| 1994 | |||
| 1995 | # Local variables | ||
| 1996 | my ( | ||
| 1997 | @initList, @comboList, @setList, @comboList2, | ||
| 1998 | %comboHash, | ||
| 1999 | ); | ||
| 2000 | |||
| 2001 | # Check for improper arguments | ||
| 2002 | if (! defined $innerNotebook || defined $check) { | ||
| 2003 | |||
| 2004 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings1Tab', @_); | ||
| 2005 | } | ||
| 2006 | |||
| 2007 | # Tab setup | ||
| 2008 | my $grid = $self->addTab( | ||
| 2009 | $innerNotebook, | ||
| 2010 | 'Page _1', | ||
| 2011 | ['Session settings'], | ||
| 2012 | ); | ||
| 2013 | |||
| 2014 | # Left column | ||
| 2015 | $self->addLabel($grid, '<b>Session settings</b>', | ||
| 2016 | 0, 12, 0, 1); | ||
| 2017 | |||
| 2018 | $self->addLabel($grid, 'Maximum sessions', | ||
| 2019 | 1, 3, 1, 2); | ||
| 2020 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 2021 | 3, 6, 1, 2, | ||
| 2022 | 4, 4); | ||
| 2023 | $entry->set_text($axmud::CLIENT->sessionMax); | ||
| 2024 | |||
| 2025 | my $entry2 = $self->addEntryWithIcon( | ||
| 2026 | $grid, | ||
| 2027 | undef, | ||
| 2028 | 'int', | ||
| 2029 | 1, | ||
| 2030 | $axmud::CLIENT->constSessionMax, | ||
| 2031 | 3, 5, 2, 3, | ||
| 2032 | 4, 4); | ||
| 2033 | my $button = $self->addButton( | ||
| 2034 | $grid, 'Set', 'Set the maximum number of concurrent sessions', undef, | ||
| 2035 | 5, 6, 2, 3); | ||
| 2036 | # (Need this line to prevent horizontal stretching of the grid) | ||
| 2037 | $button->set_hexpand(FALSE); | ||
| 2038 | $button->signal_connect('clicked' => sub { | ||
| 2039 | |||
| 2040 | my $num = $entry2->get_text(); | ||
| 2041 | |||
| 2042 | if ($self->checkEntryIcon($entry2)) { | ||
| 2043 | |||
| 2044 | $self->session->pseudoCmd('maxsession ' . $num); | ||
| 2045 | |||
| 2046 | $entry2->set_text(''); | ||
| 2047 | $entry->set_text($axmud::CLIENT->sessionMax); | ||
| 2048 | } | ||
| 2049 | }); | ||
| 2050 | |||
| 2051 | $self->addLabel($grid, 'Default character set', | ||
| 2052 | 1, 3, 3, 4); | ||
| 2053 | |||
| 2054 | @setList = $axmud::CLIENT->charSetList; | ||
| 2055 | # (Find the current character set, and put it at the top of the list) | ||
| 2056 | foreach my $item (@setList) { | ||
| 2057 | |||
| 2058 | if ($item ne $axmud::CLIENT->charSet) { | ||
| 2059 | |||
| 2060 | push (@comboList2, $item); | ||
| 2061 | } | ||
| 2062 | } | ||
| 2063 | |||
| 2064 | unshift(@comboList2, $axmud::CLIENT->charSet); | ||
| 2065 | |||
| 2066 | my $comboBox2 = $self->addComboBox($grid, undef, \@comboList2, '', | ||
| 2067 | TRUE, # No 'undef' value used | ||
| 2068 | 3, 6, 3, 4); | ||
| 2069 | $comboBox2->signal_connect('changed' => sub { | ||
| 2070 | |||
| 2071 | my ($choice, $index); | ||
| 2072 | |||
| 2073 | $choice = $comboBox2->get_active_text(); | ||
| 2074 | if ($choice) { | ||
| 2075 | |||
| 2076 | $self->session->pseudoCmd( | ||
| 2077 | 'setcharset -d ' . $choice, | ||
| 2078 | $self->pseudoCmdMode, | ||
| 2079 | ); | ||
| 2080 | } | ||
| 2081 | }); | ||
| 2082 | |||
| 2083 | my $checkButton = $self->addCheckButton( | ||
| 2084 | $grid, 'Switch to \'connect offline\' mode on disconnection', undef, TRUE, | ||
| 2085 | 1, 6, 4, 5); | ||
| 2086 | $checkButton->set_active($axmud::CLIENT->offlineOnDisconnectFlag); | ||
| 2087 | $checkButton->signal_connect('toggled' => sub { | ||
| 2088 | |||
| 2089 | $self->session->pseudoCmd('setsession -o', $self->pseudoCmdMode); | ||
| 2090 | $checkButton->set_active($axmud::CLIENT->offlineOnDisconnectFlag); | ||
| 2091 | }); | ||
| 2092 | |||
| 2093 | my $checkButton2 = $self->addCheckButton( | ||
| 2094 | $grid, 'Make short weblinks like \'deathmud.com\' clickable', undef, TRUE, | ||
| 2095 | 1, 6, 5, 6); | ||
| 2096 | $checkButton2->set_active($axmud::CLIENT->shortUrlFlag); | ||
| 2097 | $checkButton2->signal_connect('toggled' => sub { | ||
| 2098 | |||
| 2099 | $self->session->pseudoCmd('toggleshortlink', $self->pseudoCmdMode); | ||
| 2100 | $checkButton2->set_active($axmud::CLIENT->shortUrlFlag); | ||
| 2101 | }); | ||
| 2102 | |||
| 2103 | # Right column | ||
| 2104 | $self->addLabel($grid, 'Tab format', | ||
| 2105 | 7, 9, 1, 2); | ||
| 2106 | |||
| 2107 | @initList = ( | ||
| 2108 | 'b' => 'World (Character)', | ||
| 2109 | 'h' => 'World - Character', | ||
| 2110 | 'w' => 'World', | ||
| 2111 | 'c' => 'Character', | ||
| 2112 | ); | ||
| 2113 | |||
| 2114 | do { | ||
| 2115 | |||
| 2116 | my ($value, $descrip); | ||
| 2117 | |||
| 2118 | $value = shift @initList; | ||
| 2119 | $descrip = shift @initList; | ||
| 2120 | |||
| 2121 | push (@comboList, $descrip); | ||
| 2122 | $comboHash{$descrip} = $value; | ||
| 2123 | |||
| 2124 | } until (! @initList); | ||
| 2125 | |||
| 2126 | my $comboBox = $self->addComboBox($grid, undef, \@comboList, 'Select format:', | ||
| 2127 | TRUE, # No 'undef' value used | ||
| 2128 | 9, 12, 1, 2); | ||
| 2129 | $comboBox->signal_connect('changed' => sub { | ||
| 2130 | |||
| 2131 | my $choice = $comboBox->get_active_text(); | ||
| 2132 | |||
| 2133 | $self->session->pseudoCmd('setsession -' . $comboHash{$choice}, $self->pseudoCmdMode); | ||
| 2134 | }); | ||
| 2135 | |||
| 2136 | my $checkButton3 = $self->addCheckButton( | ||
| 2137 | $grid, 'Use xterm title in tab instead (if available)', undef, TRUE, | ||
| 2138 | 7, 12, 2, 3); | ||
| 2139 | $checkButton3->set_active($axmud::CLIENT->xTermTitleFlag); | ||
| 2140 | $checkButton3->signal_connect('toggled' => sub { | ||
| 2141 | |||
| 2142 | $self->session->pseudoCmd('setsession -x', $self->pseudoCmdMode); | ||
| 2143 | $checkButton3->set_active($axmud::CLIENT->xTermTitleFlag); | ||
| 2144 | }); | ||
| 2145 | |||
| 2146 | my $checkButton4 = $self->addCheckButton( | ||
| 2147 | $grid, 'Use world\'s long name in tab (if available)', undef, TRUE, | ||
| 2148 | 7, 12, 3, 4); | ||
| 2149 | $checkButton4->set_active($axmud::CLIENT->longTabLabelFlag); | ||
| 2150 | $checkButton4->signal_connect('toggled' => sub { | ||
| 2151 | |||
| 2152 | $self->session->pseudoCmd('setsession -l', $self->pseudoCmdMode); | ||
| 2153 | $checkButton4->set_active($axmud::CLIENT->longTabLabelFlag); | ||
| 2154 | }); | ||
| 2155 | |||
| 2156 | my $checkButton5 = $self->addCheckButton( | ||
| 2157 | $grid, 'Don\'t use tabs for a single session', undef, TRUE, | ||
| 2158 | |||
| 2159 | 7, 12, 4, 5); | ||
| 2160 | $checkButton5->set_active($axmud::CLIENT->simpleTabFlag); | ||
| 2161 | $checkButton5->signal_connect('toggled' => sub { | ||
| 2162 | |||
| 2163 | $self->session->pseudoCmd('setsession -s', $self->pseudoCmdMode); | ||
| 2164 | $checkButton5->set_active($axmud::CLIENT->simpleTabFlag); | ||
| 2165 | }); | ||
| 2166 | |||
| 2167 | my $checkButton6 = $self->addCheckButton( | ||
| 2168 | $grid, 'Sessions share a single \'main\' window', undef, FALSE, | ||
| 2169 | 7, 12, 5, 6); | ||
| 2170 | $checkButton6->set_active($axmud::CLIENT->shareMainWinFlag); | ||
| 2171 | |||
| 2172 | my $button2 = $self->addButton( | ||
| 2173 | $grid, | ||
| 2174 | 'Toggle setting for restart', | ||
| 2175 | 'Changes to this setting are applied when ' . $axmud::SCRIPT . ' restarts', | ||
| 2176 | undef, | ||
| 2177 | 7, 10, 6, 7); | ||
| 2178 | # ->signal connect appears below | ||
| 2179 | |||
| 2180 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 2181 | 10, 12, 6, 7, | ||
| 2182 | 12, 12); | ||
| 2183 | # (The entry remains empty when the IV value is 'default') | ||
| 2184 | if ($axmud::CLIENT->restartShareMainWinMode eq 'on') { | ||
| 2185 | $entry3->set_text('share'); | ||
| 2186 | } elsif ($axmud::CLIENT->restartShareMainWinMode eq 'off') { | ||
| 2187 | $entry3->set_text('don\'t share'); | ||
| 2188 | } | ||
| 2189 | |||
| 2190 | # ->signal_connect from above | ||
| 2191 | $button2->signal_connect('clicked' => sub { | ||
| 2192 | |||
| 2193 | $self->session->pseudoCmd('toggleshare', $self->pseudoCmdMode); | ||
| 2194 | if ($axmud::CLIENT->restartShareMainWinMode eq 'default') { | ||
| 2195 | $entry3->set_text(''); | ||
| 2196 | } elsif ($axmud::CLIENT->restartShareMainWinMode eq 'on') { | ||
| 2197 | $entry3->set_text('share'); | ||
| 2198 | } else { | ||
| 2199 | $entry3->set_text('don\'t share'); | ||
| 2200 | } | ||
| 2201 | }); | ||
| 2202 | |||
| 2203 | my $checkButton7 = $self->addCheckButton( | ||
| 2204 | $grid, 'Confirm before click-closing \'main\' window', undef, TRUE, | ||
| 2205 | 7, 12, 7, 8); | ||
| 2206 | $checkButton7->set_active($axmud::CLIENT->confirmCloseMainWinFlag); | ||
| 2207 | $checkButton7->signal_connect('toggled' => sub { | ||
| 2208 | |||
| 2209 | $self->session->pseudoCmd('setsession -m', $self->pseudoCmdMode); | ||
| 2210 | $checkButton7->set_active($axmud::CLIENT->confirmCloseMainWinFlag); | ||
| 2211 | }); | ||
| 2212 | |||
| 2213 | my $checkButton8 = $self->addCheckButton( | ||
| 2214 | $grid, 'Confirm before click-closing tab', undef, TRUE, | ||
| 2215 | 7, 12, 8, 9); | ||
| 2216 | $checkButton8->set_active($axmud::CLIENT->confirmCloseTabFlag); | ||
| 2217 | $checkButton8->signal_connect('toggled' => sub { | ||
| 2218 | |||
| 2219 | $self->session->pseudoCmd('setsession -t', $self->pseudoCmdMode); | ||
| 2220 | $checkButton8->set_active($axmud::CLIENT->confirmCloseTabFlag); | ||
| 2221 | }); | ||
| 2222 | |||
| 2223 | my $checkButton9 = $self->addCheckButton( | ||
| 2224 | $grid, 'Confirm before closing from menu', undef, TRUE, | ||
| 2225 | 7, 12, 9, 10); | ||
| 2226 | $checkButton9->set_active($axmud::CLIENT->confirmCloseMenuFlag); | ||
| 2227 | $checkButton9->signal_connect('toggled' => sub { | ||
| 2228 | |||
| 2229 | $self->session->pseudoCmd('setsession -e', $self->pseudoCmdMode); | ||
| 2230 | $checkButton9->set_active($axmud::CLIENT->confirmCloseMenuFlag); | ||
| 2231 | }); | ||
| 2232 | |||
| 2233 | my $checkButton10 = $self->addCheckButton( | ||
| 2234 | $grid, 'Confirm before closing from toolbar', undef, TRUE, | ||
| 2235 | 7, 12, 10, 11); | ||
| 2236 | $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag); | ||
| 2237 | $checkButton10->signal_connect('toggled' => sub { | ||
| 2238 | |||
| 2239 | $self->session->pseudoCmd('setsession -r', $self->pseudoCmdMode); | ||
| 2240 | $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag); | ||
| 2241 | }); | ||
| 2242 | |||
| 2243 | # Tab complete | ||
| 2244 | return 1; | ||
| 2245 | } | ||
| 2246 | |||
| 2247 | sub settings2Tab { | ||
| 2248 | |||
| 2249 | # Settings2 tab | ||
| 2250 | # | ||
| 2251 | # Expected arguments | ||
| 2252 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 2253 | # | ||
| 2254 | # Return values | ||
| 2255 | # 'undef' on improper arguments | ||
| 2256 | # 1 otherwise | ||
| 2257 | |||
| 2258 | my ($self, $innerNotebook, $check) = @_; | ||
| 2259 | |||
| 2260 | # Check for improper arguments | ||
| 2261 | if (! defined $innerNotebook || defined $check) { | ||
| 2262 | |||
| 2263 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings2Tab', @_); | ||
| 2264 | } | ||
| 2265 | |||
| 2266 | # Tab setup | ||
| 2267 | my $grid = $self->addTab( | ||
| 2268 | $innerNotebook, | ||
| 2269 | 'Page _2', | ||
| 2270 | ['Favourite world list', 'Auto-connect world list'], | ||
| 2271 | ); | ||
| 2272 | |||
| 2273 | # Favourite world list | ||
| 2274 | $self->addLabel($grid, '<b>Favourite world list</b>', | ||
| 2275 | 0, 12, 0, 1); | ||
| 2276 | $self->addLabel( | ||
| 2277 | $grid, '<i>Worlds displayed at the top of the list in the Connections window</i>', | ||
| 2278 | 1, 12, 1, 2); | ||
| 2279 | |||
| 2280 | my $textView = $self->addTextView($grid, undef, TRUE, | ||
| 2281 | 1, 12, 2, 5); | ||
| 2282 | my $buffer = $textView->get_buffer(); | ||
| 2283 | $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList)); | ||
| 2284 | |||
| 2285 | my $button = $self->addButton( | ||
| 2286 | $grid, 'Set list', 'Set the list of favourite worlds', undef, | ||
| 2287 | 1, 4, 5, 6); | ||
| 2288 | $button->signal_connect('clicked' => sub { | ||
| 2289 | |||
| 2290 | my ( | ||
| 2291 | $text, | ||
| 2292 | @list, | ||
| 2293 | ); | ||
| 2294 | |||
| 2295 | $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer); | ||
| 2296 | if ($text =~ m/\S/) { | ||
| 2297 | |||
| 2298 | # Split the contents of the textview into a list | ||
| 2299 | @list = split("\n", $text); | ||
| 2300 | |||
| 2301 | # Set the favourite world list. By using a join so soon after a split, we safely | ||
| 2302 | # eliminate newline chars | ||
| 2303 | $self->session->pseudoCmd( | ||
| 2304 | 'setfavouriteworld ' . join(' ', @list), | ||
| 2305 | $self->pseudoCmdMode, | ||
| 2306 | ); | ||
| 2307 | |||
| 2308 | } else { | ||
| 2309 | |||
| 2310 | # Reset the favourite world list | ||
| 2311 | $self->session->pseudoCmd('setfavouriteworld', $self->pseudoCmdMode); | ||
| 2312 | } | ||
| 2313 | |||
| 2314 | # Update the textview | ||
| 2315 | $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList)); | ||
| 2316 | }); | ||
| 2317 | |||
| 2318 | my $button2 = $self->addButton( | ||
| 2319 | $grid, 'Update list', 'Updates the list of favourite worlds', undef, | ||
| 2320 | 9, 12, 5, 6); | ||
| 2321 | $button2->signal_connect('clicked' => sub { | ||
| 2322 | |||
| 2323 | # Update the textview | ||
| 2324 | $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList)); | ||
| 2325 | }); | ||
| 2326 | |||
| 2327 | # Auto-connect world list | ||
| 2328 | $self->addLabel($grid, '<b>Auto-connect world list</b>', | ||
| 2329 | 0, 12, 6, 7); | ||
| 2330 | $self->addLabel( | ||
| 2331 | $grid, "<i>Worlds to which " . $axmud::SCRIPT . " auto-connects when it starts. Each" | ||
| 2332 | . " world profile name can be followed by\none or more character profile names, e.g." | ||
| 2333 | . " <b>deathmud bilbo gandalf</b></i>", | ||
| 2334 | 1, 12, 7, 8); | ||
| 2335 | my $textView2 = $self->addTextView($grid, undef, TRUE, | ||
| 2336 | 1, 12, 8, 11); | ||
| 2337 | my $buffer2 = $textView2->get_buffer(); | ||
| 2338 | $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList)); | ||
| 2339 | |||
| 2340 | my $button3 = $self->addButton( | ||
| 2341 | $grid, 'Set list', 'Set the list of auto-connecting worlds', undef, | ||
| 2342 | 1, 4, 11, 12); | ||
| 2343 | $button3->signal_connect('clicked' => sub { | ||
| 2344 | |||
| 2345 | my $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer2); | ||
| 2346 | if ($text =~ m/\S/) { | ||
| 2347 | |||
| 2348 | foreach my $item (split("\n", $text)) { | ||
| 2349 | |||
| 2350 | # (Ignore empty lines) | ||
| 2351 | if ($item =~ m/\S/) { | ||
| 2352 | |||
| 2353 | $self->session->pseudoCmd('setautoworld ' . $item, $self->pseudoCmdMode); | ||
| 2354 | } | ||
| 2355 | } | ||
| 2356 | |||
| 2357 | } else { | ||
| 2358 | |||
| 2359 | # Reset the list | ||
| 2360 | $self->session->pseudoCmd('setautoworld', $self->pseudoCmdMode); | ||
| 2361 | } | ||
| 2362 | |||
| 2363 | # Update the textview | ||
| 2364 | $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList)); | ||
| 2365 | }); | ||
| 2366 | |||
| 2367 | my $button4 = $self->addButton( | ||
| 2368 | $grid, 'Update list', 'Updates the list of auto-connecting worlds', undef, | ||
| 2369 | 9, 12, 11, 12); | ||
| 2370 | $button4->signal_connect('clicked' => sub { | ||
| 2371 | |||
| 2372 | # Update the textview | ||
| 2373 | $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList)); | ||
| 2374 | }); | ||
| 2375 | |||
| 2376 | # Tab complete | ||
| 2377 | return 1; | ||
| 2378 | } | ||
| 2379 | |||
| 2380 | sub settings3Tab { | ||
| 2381 | |||
| 2382 | # Settings3 tab | ||
| 2383 | # | ||
| 2384 | # Expected arguments | ||
| 2385 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 2386 | # | ||
| 2387 | # Return values | ||
| 2388 | # 'undef' on improper arguments | ||
| 2389 | # 1 otherwise | ||
| 2390 | |||
| 2391 | my ($self, $innerNotebook, $check) = @_; | ||
| 2392 | |||
| 2393 | # Check for improper arguments | ||
| 2394 | if (! defined $innerNotebook || defined $check) { | ||
| 2395 | |||
| 2396 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings3Tab', @_); | ||
| 2397 | } | ||
| 2398 | |||
| 2399 | # Tab setup | ||
| 2400 | my $grid = $self->addTab( | ||
| 2401 | $innerNotebook, | ||
| 2402 | 'Page _3', | ||
| 2403 | ['Pre-configured world list'], | ||
| 2404 | ); | ||
| 2405 | |||
| 2406 | # Pre-configured world list | ||
| 2407 | $self->addLabel($grid, '<b>Pre-configured world list</b>', | ||
| 2408 | 0, 12, 0, 1); | ||
| 2409 | $self->addLabel( | ||
| 2410 | $grid, | ||
| 2411 | '<i>List of pre-configured world profiles supplied with ' . $axmud::SCRIPT . '</i>', | ||
| 2412 | 1, 12, 1, 2); | ||
| 2413 | |||
| 2414 | my $textView = $self->addTextView($grid, undef, FALSE, | ||
| 2415 | 1, 12, 2, 10); | ||
| 2416 | my $buffer = $textView->get_buffer(); | ||
| 2417 | $buffer->set_text(join("\n", sort {lc($a) cmp lc($b)} ($axmud::CLIENT->constWorldList))); | ||
| 2418 | |||
| 2419 | $self->addLabel( | ||
| 2420 | $grid, | ||
| 2421 | "If you want to restore one of the pre-configured worlds - replacing any existing" | ||
| 2422 | . " world with\nthe same name - you can use the <i>\';restoreworld\'</i> command. Read" | ||
| 2423 | . " the help for <i>\';restoreworld\'</i>\n<b>carefully</b> before you attempt that" | ||
| 2424 | . " operation.", | ||
| 2425 | 1, 12, 10, 12); | ||
| 2426 | |||
| 2427 | # Tab complete | ||
| 2428 | return 1; | ||
| 2429 | } | ||
| 2430 | |||
| 2431 | sub settings4Tab { | ||
| 2432 | |||
| 2433 | # Settings4 tab | ||
| 2434 | # | ||
| 2435 | # Expected arguments | ||
| 2436 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 2437 | # | ||
| 2438 | # Return values | ||
| 2439 | # 'undef' on improper arguments | ||
| 2440 | # 1 otherwise | ||
| 2441 | |||
| 2442 | my ($self, $innerNotebook, $check) = @_; | ||
| 2443 | |||
| 2444 | # Local variables | ||
| 2445 | my @columnList; | ||
| 2446 | |||
| 2447 | # Check for improper arguments | ||
| 2448 | if (! defined $innerNotebook || defined $check) { | ||
| 2449 | |||
| 2450 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings4Tab', @_); | ||
| 2451 | } | ||
| 2452 | |||
| 2453 | # Tab setup | ||
| 2454 | my $grid = $self->addTab( | ||
| 2455 | $innerNotebook, | ||
| 2456 | 'Page _4', | ||
| 2457 | ['Other world list'], | ||
| 2458 | ); | ||
| 2459 | |||
| 2460 | # Other world list | ||
| 2461 | $self->addLabel($grid, '<b>Other world list</b>', | ||
| 2462 | 0, 12, 0, 1); | ||
| 2463 | $self->addLabel($grid, | ||
| 2464 | '<i>List of worlds which did not originally have pre-configured world profiles</i>', | ||
| 2465 | 1, 12, 1, 2); | ||
| 2466 | |||
| 2467 | # Add a simple list | ||
| 2468 | @columnList = ( | ||
| 2469 | 'Adult', 'bool', | ||
| 2470 | 'Short', 'text', | ||
| 2471 | 'Long', 'text', | ||
| 2472 | 'Host/Port', 'text', | ||
| 2473 | 'Language', 'text', | ||
| 2474 | ); | ||
| 2475 | |||
| 2476 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 2477 | 1, 12, 2, 10); | ||
| 2478 | |||
| 2479 | # Initialise the simple list | ||
| 2480 | $self->settings4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 2481 | |||
| 2482 | # Tab complete | ||
| 2483 | return 1; | ||
| 2484 | } | ||
| 2485 | |||
| 2486 | sub settings4Tab_refreshList { | ||
| 2487 | |||
| 2488 | # Resets the simple list displayed by $self->settings4Tab | ||
| 2489 | # | ||
| 2490 | # Expected arguments | ||
| 2491 | # $slWidget - The GA::Obj::SimpleList | ||
| 2492 | # $columns - The number of columns | ||
| 2493 | # | ||
| 2494 | # Return values | ||
| 2495 | # 'undef' on improper arguments | ||
| 2496 | # 1 otherwise | ||
| 2497 | |||
| 2498 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 2499 | |||
| 2500 | # Local variables | ||
| 2501 | my @dataList; | ||
| 2502 | |||
| 2503 | # Check for improper arguments | ||
| 2504 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 2505 | |||
| 2506 | return $axmud::CLIENT->writeImproper( | ||
| 2507 | $self->_objClass . '->settings4Tab_refreshList', | ||
| 2508 | @_, | ||
| 2509 | ); | ||
| 2510 | } | ||
| 2511 | |||
| 2512 | # Compile the simple list data | ||
| 2513 | OUTER: foreach my $obj ( | ||
| 2514 | sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('constBasicWorldHash')) | ||
| 2515 | ) { | ||
| 2516 | push (@dataList, | ||
| 2517 | $obj->adultFlag, | ||
| 2518 | $obj->name, | ||
| 2519 | $obj->longName, | ||
| 2520 | $obj->host . ' ' . $obj->port, | ||
| 2521 | $obj->language, | ||
| 2522 | ); | ||
| 2523 | } | ||
| 2524 | |||
| 2525 | # Reset the simple list | ||
| 2526 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 2527 | |||
| 2528 | return 1; | ||
| 2529 | } | ||
| 2530 | |||
| 2531 | sub settings5Tab { | ||
| 2532 | |||
| 2533 | # Settings5 tab | ||
| 2534 | # | ||
| 2535 | # Expected arguments | ||
| 2536 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 2537 | # | ||
| 2538 | # Return values | ||
| 2539 | # 'undef' on improper arguments | ||
| 2540 | # 1 otherwise | ||
| 2541 | |||
| 2542 | my ($self, $innerNotebook, $check) = @_; | ||
| 2543 | |||
| 2544 | # Check for improper arguments | ||
| 2545 | if (! defined $innerNotebook || defined $check) { | ||
| 2546 | |||
| 2547 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings5Tab', @_); | ||
| 2548 | } | ||
| 2549 | |||
| 2550 | # Tab setup | ||
| 2551 | my $grid = $self->addTab( | ||
| 2552 | $innerNotebook, | ||
| 2553 | 'Page _5', | ||
| 2554 | ['External applications'], | ||
| 2555 | ); | ||
| 2556 | |||
| 2557 | # External applications | ||
| 2558 | $self->addLabel($grid, '<b>External applications</b>', | ||
| 2559 | 0, 12, 0, 1); | ||
| 2560 | |||
| 2561 | $self->addLabel( | ||
| 2562 | $grid, | ||
| 2563 | '<i>System command to open a link in a web browser (%s is substituted for the URL)</i>', | ||
| 2564 | 1, 12, 1, 2); | ||
| 2565 | |||
| 2566 | my $entry = $self->addEntry($grid, undef, TRUE, | ||
| 2567 | 1, 10, 2, 3); | ||
| 2568 | $entry->set_text($axmud::CLIENT->browserCmd); | ||
| 2569 | |||
| 2570 | my $button = $self->addButton($grid, | ||
| 2571 | 'Set', 'Set the system command to run a web browser', undef, | ||
| 2572 | 10, 12, 2, 3); | ||
| 2573 | $button->signal_connect('clicked' => sub { | ||
| 2574 | |||
| 2575 | my $cmd = $entry->get_text(); | ||
| 2576 | |||
| 2577 | # Set the system command | ||
| 2578 | if ($cmd) { | ||
| 2579 | $self->session->pseudoCmd('setapplication -b <' . $cmd . '>', $self->pseudoCmdMode); | ||
| 2580 | } else { | ||
| 2581 | $self->session->pseudoCmd('setapplication -b', $self->pseudoCmdMode); | ||
| 2582 | } | ||
| 2583 | |||
| 2584 | # Update the entry box | ||
| 2585 | $entry->set_text($axmud::CLIENT->browserCmd); | ||
| 2586 | }); | ||
| 2587 | |||
| 2588 | $self->addLabel( | ||
| 2589 | $grid, | ||
| 2590 | '<i>System command to contact someone with an email application (%s is the email' | ||
| 2591 | . ' address to use)</i>', | ||
| 2592 | 1, 12, 3, 4); | ||
| 2593 | |||
| 2594 | my $entry2 = $self->addEntry($grid, undef, TRUE, | ||
| 2595 | 1, 10, 4, 5); | ||
| 2596 | $entry2->set_text($axmud::CLIENT->emailCmd); | ||
| 2597 | |||
| 2598 | my $button2 = $self->addButton($grid, | ||
| 2599 | 'Set', 'Set the system command to run an email application', undef, | ||
| 2600 | 10, 12, 4, 5); | ||
| 2601 | $button2->signal_connect('clicked' => sub { | ||
| 2602 | |||
| 2603 | my $cmd = $entry2->get_text(); | ||
| 2604 | |||
| 2605 | # Set the system command | ||
| 2606 | if ($cmd) { | ||
| 2607 | $self->session->pseudoCmd('setapplication -e <' . $cmd . '>', $self->pseudoCmdMode); | ||
| 2608 | } else { | ||
| 2609 | $self->session->pseudoCmd('setapplication -e', $self->pseudoCmdMode); | ||
| 2610 | } | ||
| 2611 | |||
| 2612 | # Update the entry box | ||
| 2613 | $entry2->set_text($axmud::CLIENT->audioCmd); | ||
| 2614 | }); | ||
| 2615 | |||
| 2616 | $self->addLabel( | ||
| 2617 | $grid, | ||
| 2618 | '<i>System command to open a file in an audio player (%s is the full file path)</i>', | ||
| 2619 | 1, 12, 5, 6); | ||
| 2620 | |||
| 2621 | my $entry3 = $self->addEntry($grid, undef, TRUE, | ||
| 2622 | 1, 10, 6, 7); | ||
| 2623 | $entry3->set_text($axmud::CLIENT->audioCmd); | ||
| 2624 | |||
| 2625 | my $button3 = $self->addButton($grid, | ||
| 2626 | 'Set', 'Set the system command to run an audio player', undef, | ||
| 2627 | 10, 12, 6, 7); | ||
| 2628 | $button3->signal_connect('clicked' => sub { | ||
| 2629 | |||
| 2630 | my $cmd = $entry3->get_text(); | ||
| 2631 | |||
| 2632 | # Set the system command | ||
| 2633 | if ($cmd) { | ||
| 2634 | $self->session->pseudoCmd('setapplication -a <' . $cmd . '>', $self->pseudoCmdMode); | ||
| 2635 | } else { | ||
| 2636 | $self->session->pseudoCmd('setapplication -a', $self->pseudoCmdMode); | ||
| 2637 | } | ||
| 2638 | |||
| 2639 | # Update the entry box | ||
| 2640 | $entry3->set_text($axmud::CLIENT->audioCmd); | ||
| 2641 | }); | ||
| 2642 | |||
| 2643 | $self->addLabel( | ||
| 2644 | $grid, | ||
| 2645 | '<i>System command to open a file in a text editor (%s is the full file path)</i>', | ||
| 2646 | 1, 12, 7, 8); | ||
| 2647 | |||
| 2648 | my $entry4 = $self->addEntry($grid, undef, TRUE, | ||
| 2649 | 1, 10, 8, 9); | ||
| 2650 | $entry4->set_text($axmud::CLIENT->textEditCmd); | ||
| 2651 | |||
| 2652 | my $button4 = $self->addButton($grid, | ||
| 2653 | 'Set', 'Set the system command to open a text editor', undef, | ||
| 2654 | 10, 12, 8, 9); | ||
| 2655 | $button4->signal_connect('clicked' => sub { | ||
| 2656 | |||
| 2657 | my $cmd = $entry4->get_text(); | ||
| 2658 | |||
| 2659 | # Set the system command | ||
| 2660 | if ($cmd) { | ||
| 2661 | $self->session->pseudoCmd('setapplication -t <' . $cmd . '>', $self->pseudoCmdMode); | ||
| 2662 | } else { | ||
| 2663 | $self->session->pseudoCmd('setapplication -t', $self->pseudoCmdMode); | ||
| 2664 | } | ||
| 2665 | |||
| 2666 | # Update the entry box | ||
| 2667 | $entry4->set_text($axmud::CLIENT->textEditCmd); | ||
| 2668 | }); | ||
| 2669 | |||
| 2670 | my $button5 = $self->addButton($grid, | ||
| 2671 | 'Use default Linux commands', | ||
| 2672 | 'Set system commands commonly used on Linux installations', | ||
| 2673 | undef, | ||
| 2674 | 1, 4, 9, 10); | ||
| 2675 | $button5->signal_connect('clicked' => sub { | ||
| 2676 | |||
| 2677 | # Update external application commands | ||
| 2678 | $self->session->pseudoCmd('resetapplication -l', $self->pseudoCmdMode); | ||
| 2679 | # Update widgets | ||
| 2680 | $entry->set_text($axmud::CLIENT->browserCmd); | ||
| 2681 | $entry2->set_text($axmud::CLIENT->emailCmd); | ||
| 2682 | $entry3->set_text($axmud::CLIENT->audioCmd); | ||
| 2683 | $entry4->set_text($axmud::CLIENT->textEditCmd); | ||
| 2684 | }); | ||
| 2685 | |||
| 2686 | my $button6 = $self->addButton($grid, | ||
| 2687 | 'Use default MS Windows commands', | ||
| 2688 | 'Set system commands commonly used on MS Windows installations', | ||
| 2689 | undef, | ||
| 2690 | 4, 8, 9, 10); | ||
| 2691 | $button6->signal_connect('clicked' => sub { | ||
| 2692 | |||
| 2693 | # Update external application commands | ||
| 2694 | $self->session->pseudoCmd('resetapplication -w', $self->pseudoCmdMode); | ||
| 2695 | # Update widgets | ||
| 2696 | $entry->set_text($axmud::CLIENT->browserCmd); | ||
| 2697 | $entry2->set_text($axmud::CLIENT->emailCmd); | ||
| 2698 | $entry3->set_text($axmud::CLIENT->audioCmd); | ||
| 2699 | $entry4->set_text($axmud::CLIENT->textEditCmd); | ||
| 2700 | }); | ||
| 2701 | |||
| 2702 | my $button7 = $self->addButton($grid, | ||
| 2703 | 'Detect default commands', | ||
| 2704 | 'Set system commands commonly used on the current operation system', | ||
| 2705 | undef, | ||
| 2706 | 8, 12, 9, 10); | ||
| 2707 | $button7->signal_connect('clicked' => sub { | ||
| 2708 | |||
| 2709 | # Update external application commands | ||
| 2710 | $self->session->pseudoCmd('resetapplication', $self->pseudoCmdMode); | ||
| 2711 | # Update widgets | ||
| 2712 | $entry->set_text($axmud::CLIENT->browserCmd); | ||
| 2713 | $entry2->set_text($axmud::CLIENT->emailCmd); | ||
| 2714 | $entry3->set_text($axmud::CLIENT->audioCmd); | ||
| 2715 | $entry4->set_text($axmud::CLIENT->textEditCmd); | ||
| 2716 | }); | ||
| 2717 | |||
| 2718 | # Tab complete | ||
| 2719 | return 1; | ||
| 2720 | } | ||
| 2721 | |||
| 2722 | sub settings6Tab { | ||
| 2723 | |||
| 2724 | # Settings6 tab | ||
| 2725 | # | ||
| 2726 | # Expected arguments | ||
| 2727 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 2728 | # | ||
| 2729 | # Return values | ||
| 2730 | # 'undef' on improper arguments | ||
| 2731 | # 1 otherwise | ||
| 2732 | |||
| 2733 | my ($self, $innerNotebook, $check) = @_; | ||
| 2734 | |||
| 2735 | # Local variables | ||
| 2736 | my ($min, $max, $string); | ||
| 2737 | |||
| 2738 | # Check for improper arguments | ||
| 2739 | if (! defined $innerNotebook || defined $check) { | ||
| 2740 | |||
| 2741 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings6Tab', @_); | ||
| 2742 | } | ||
| 2743 | |||
| 2744 | # Tab setup | ||
| 2745 | my $grid = $self->addTab( | ||
| 2746 | $innerNotebook, | ||
| 2747 | 'Page _6', | ||
| 2748 | ['Buffer/textview sizes', 'System delays'], | ||
| 2749 | ); | ||
| 2750 | |||
| 2751 | # Buffer/textview sizes and system delays | ||
| 2752 | $self->addLabel($grid, '<b>Buffer/textview sizes and system delays</b>', | ||
| 2753 | 0, 12, 0, 1); | ||
| 2754 | |||
| 2755 | $min = $axmud::CLIENT->constMinBufferSize; | ||
| 2756 | $max = $axmud::CLIENT->constMaxBufferSize; | ||
| 2757 | $string = 'range ' . $min . '-' . $max; | ||
| 2758 | |||
| 2759 | $self->addLabel( | ||
| 2760 | $grid, | ||
| 2761 | '<i>Size of display buffers (stores text received from the world, ' . $string | ||
| 2762 | . ', recommended size ' . $axmud::CLIENT->constDisplayBufferSize . ')</i>', | ||
| 2763 | 1, 12, 1, 2); | ||
| 2764 | |||
| 2765 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', $min, $max, | ||
| 2766 | 1, 8, 2, 3); | ||
| 2767 | $entry->set_text($axmud::CLIENT->customDisplayBufferSize); | ||
| 2768 | |||
| 2769 | my $button = $self->addButton($grid, | ||
| 2770 | 'Set', 'Set the size of display buffers', undef, | ||
| 2771 | 8, 10, 2, 3); | ||
| 2772 | $button->signal_connect('clicked' => sub { | ||
| 2773 | |||
| 2774 | my $size = $entry->get_text(); | ||
| 2775 | |||
| 2776 | if ($self->checkEntryIcon($entry)) { | ||
| 2777 | |||
| 2778 | # Set the buffer size | ||
| 2779 | $self->session->pseudoCmd('setdisplaybuffer ' . $size, $self->pseudoCmdMode); | ||
| 2780 | } | ||
| 2781 | |||
| 2782 | # Update the entry box | ||
| 2783 | $entry->set_text($axmud::CLIENT->customDisplayBufferSize); | ||
| 2784 | }); | ||
| 2785 | |||
| 2786 | my $button2 = $self->addButton($grid, | ||
| 2787 | 'Reset', 'Reset the size of display buffers', undef, | ||
| 2788 | 10, 12, 2, 3); | ||
| 2789 | $button2->signal_connect('clicked' => sub { | ||
| 2790 | |||
| 2791 | # Reset the buffer size | ||
| 2792 | $self->session->pseudoCmd('setdisplaybuffer', $self->pseudoCmdMode); | ||
| 2793 | |||
| 2794 | # Update the entry box | ||
| 2795 | $entry->set_text($axmud::CLIENT->customDisplayBufferSize); | ||
| 2796 | }); | ||
| 2797 | |||
| 2798 | $self->addLabel( | ||
| 2799 | $grid, | ||
| 2800 | '<i>Size of instruction buffers (stores processed instructions, ' . $string | ||
| 2801 | . ', recommended size ' . $axmud::CLIENT->constInstructBufferSize . ')</i>', | ||
| 2802 | 1, 12, 3, 4); | ||
| 2803 | |||
| 2804 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', $min, $max, | ||
| 2805 | 1, 8, 4, 5); | ||
| 2806 | $entry2->set_text($axmud::CLIENT->customInstructBufferSize); | ||
| 2807 | |||
| 2808 | my $button3 = $self->addButton($grid, | ||
| 2809 | 'Set', 'Set the size of instruction buffers', undef, | ||
| 2810 | 8, 10, 4, 5); | ||
| 2811 | $button3->signal_connect('clicked' => sub { | ||
| 2812 | |||
| 2813 | my $size = $entry2->get_text(); | ||
| 2814 | |||
| 2815 | if ($self->checkEntryIcon($entry)) { | ||
| 2816 | |||
| 2817 | # Set the buffer size | ||
| 2818 | $self->session->pseudoCmd('setinstructionbuffer ' . $size, $self->pseudoCmdMode); | ||
| 2819 | } | ||
| 2820 | |||
| 2821 | # Update the entry box | ||
| 2822 | $entry2->set_text($axmud::CLIENT->customInstructBufferSize); | ||
| 2823 | }); | ||
| 2824 | |||
| 2825 | my $button4 = $self->addButton($grid, | ||
| 2826 | 'Reset', 'Reset the size of instruction buffers', undef, | ||
| 2827 | 10, 12, 4, 5); | ||
| 2828 | $button4->signal_connect('clicked' => sub { | ||
| 2829 | |||
| 2830 | # Reset the buffer size | ||
| 2831 | $self->session->pseudoCmd('setinstructionbuffer', $self->pseudoCmdMode); | ||
| 2832 | |||
| 2833 | # Update the entry box | ||
| 2834 | $entry2->set_text($axmud::CLIENT->customInstructBufferSize); | ||
| 2835 | }); | ||
| 2836 | |||
| 2837 | $self->addLabel( | ||
| 2838 | $grid, | ||
| 2839 | '<i>Size of world command buffers (stores commands sent to the world, ' . $string | ||
| 2840 | . ', recommended size ' . $axmud::CLIENT->constCmdBufferSize . ')</i>', | ||
| 2841 | 1, 12, 5, 6); | ||
| 2842 | |||
| 2843 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', $min, $max, | ||
| 2844 | 1, 8, 6, 7); | ||
| 2845 | $entry3->set_text($axmud::CLIENT->customCmdBufferSize); | ||
| 2846 | |||
| 2847 | my $button5 = $self->addButton($grid, | ||
| 2848 | 'Set', 'Set the size of world command buffers', undef, | ||
| 2849 | 8, 10, 6, 7); | ||
| 2850 | $button5->signal_connect('clicked' => sub { | ||
| 2851 | |||
| 2852 | my $size = $entry3->get_text(); | ||
| 2853 | |||
| 2854 | if ($self->checkEntryIcon($entry)) { | ||
| 2855 | |||
| 2856 | # Set the buffer size | ||
| 2857 | $self->session->pseudoCmd('setcommandbuffer ' . $size, $self->pseudoCmdMode); | ||
| 2858 | } | ||
| 2859 | |||
| 2860 | # Update the entry box | ||
| 2861 | $entry3->set_text($axmud::CLIENT->customCmdBufferSize); | ||
| 2862 | }); | ||
| 2863 | |||
| 2864 | my $button6 = $self->addButton($grid, | ||
| 2865 | 'Reset', 'Reset the size of world command buffers', undef, | ||
| 2866 | 10, 12, 6, 7); | ||
| 2867 | $button6->signal_connect('clicked' => sub { | ||
| 2868 | |||
| 2869 | # Reset the buffer size | ||
| 2870 | $self->session->pseudoCmd('setcommandbuffer', $self->pseudoCmdMode); | ||
| 2871 | |||
| 2872 | # Update the entry box | ||
| 2873 | $entry3->set_text($axmud::CLIENT->customCmdBufferSize); | ||
| 2874 | }); | ||
| 2875 | |||
| 2876 | $self->addLabel( | ||
| 2877 | $grid, | ||
| 2878 | '<i>Size of textviews (used only when a maximum size is required, recommended size' | ||
| 2879 | . ' 10000, use 0 for no maximum)</i>', | ||
| 2880 | 1, 12, 8, 9); | ||
| 2881 | |||
| 2882 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, $max, | ||
| 2883 | 1, 8, 9, 10); | ||
| 2884 | $entry4->set_text($axmud::CLIENT->customTextBufferSize); | ||
| 2885 | |||
| 2886 | my $button7 = $self->addButton($grid, | ||
| 2887 | 'Set', 'Set the textview size', undef, | ||
| 2888 | 8, 10, 9, 10); | ||
| 2889 | $button7->signal_connect('clicked' => sub { | ||
| 2890 | |||
| 2891 | my $size = $entry4->get_text(); | ||
| 2892 | |||
| 2893 | if ($self->checkEntryIcon($entry)) { | ||
| 2894 | |||
| 2895 | # Set the textview size | ||
| 2896 | $self->session->pseudoCmd('settextview ' . $size, $self->pseudoCmdMode); | ||
| 2897 | } | ||
| 2898 | |||
| 2899 | # Update the entry box | ||
| 2900 | $entry4->set_text($axmud::CLIENT->customTextBufferSize); | ||
| 2901 | }); | ||
| 2902 | |||
| 2903 | my $button8 = $self->addButton($grid, | ||
| 2904 | 'Reset', 'Reset the textview size', undef, | ||
| 2905 | 10, 12, 9, 10); | ||
| 2906 | $button8->signal_connect('clicked' => sub { | ||
| 2907 | |||
| 2908 | # Reset the textview size | ||
| 2909 | $self->session->pseudoCmd('settextview', $self->pseudoCmdMode); | ||
| 2910 | |||
| 2911 | # Update the entry box | ||
| 2912 | $entry4->set_text($axmud::CLIENT->customTextBufferSize); | ||
| 2913 | }); | ||
| 2914 | |||
| 2915 | $self->addLabel( | ||
| 2916 | $grid, | ||
| 2917 | '<i>Time to wait (in seconds) before treating received text as a prompt (range 0.1 - 5,' | ||
| 2918 | . ' recommended delay 0.5)</i>', | ||
| 2919 | 1, 12, 10, 11); | ||
| 2920 | |||
| 2921 | my $entry5 = $self->addEntryWithIcon($grid, undef, 'float', 0.1, 5, | ||
| 2922 | 1, 8, 11, 12); | ||
| 2923 | $entry5->set_text($axmud::CLIENT->promptWaitTime); | ||
| 2924 | |||
| 2925 | my $button9 = $self->addButton($grid, | ||
| 2926 | 'Set', 'Set the system prompt delay', undef, | ||
| 2927 | 8, 10, 11, 12); | ||
| 2928 | $button9->signal_connect('clicked' => sub { | ||
| 2929 | |||
| 2930 | my $interval = $entry5->get_text(); | ||
| 2931 | |||
| 2932 | if ($self->checkEntryIcon($entry5)) { | ||
| 2933 | |||
| 2934 | # Set the system prompt delay | ||
| 2935 | $self->session->pseudoCmd('setdelay -p ' . $interval, $self->pseudoCmdMode); | ||
| 2936 | |||
| 2937 | # Update the entry box | ||
| 2938 | $entry5->set_text($axmud::CLIENT->promptWaitTime); | ||
| 2939 | } | ||
| 2940 | }); | ||
| 2941 | |||
| 2942 | my $button10 = $self->addButton($grid, | ||
| 2943 | 'Reset', 'Reset the system prompt delay', undef, | ||
| 2944 | 10, 12, 11, 12); | ||
| 2945 | $button10->signal_connect('clicked' => sub { | ||
| 2946 | |||
| 2947 | # Set the system prompt delay | ||
| 2948 | $self->session->pseudoCmd('setdelay -p', $self->pseudoCmdMode); | ||
| 2949 | |||
| 2950 | # Update the entry box | ||
| 2951 | $entry5->set_text($axmud::CLIENT->promptWaitTime); | ||
| 2952 | }); | ||
| 2953 | |||
| 2954 | $self->addLabel( | ||
| 2955 | $grid, | ||
| 2956 | '<i>Time to wait for a login (in seconds) before displaying a warning (recommended' | ||
| 2957 | . ' delay 60, use 0 to show immediately)</i>', | ||
| 2958 | 1, 12, 12, 13); | ||
| 2959 | |||
| 2960 | my $entry6 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 2961 | 1, 8, 13, 14); | ||
| 2962 | $entry6->set_text($axmud::CLIENT->loginWarningTime); | ||
| 2963 | |||
| 2964 | my $button11 = $self->addButton($grid, | ||
| 2965 | 'Set', 'Set the system login warning delay', undef, | ||
| 2966 | 8, 10, 13, 14); | ||
| 2967 | $button11->signal_connect('clicked' => sub { | ||
| 2968 | |||
| 2969 | my $interval = $entry6->get_text(); | ||
| 2970 | |||
| 2971 | if ($self->checkEntryIcon($entry6)) { | ||
| 2972 | |||
| 2973 | # Set the system login warning delay | ||
| 2974 | $self->session->pseudoCmd('setdelay -l ' . $interval, $self->pseudoCmdMode); | ||
| 2975 | |||
| 2976 | # Update the entry box | ||
| 2977 | $entry6->set_text($axmud::CLIENT->loginWarningTime); | ||
| 2978 | } | ||
| 2979 | }); | ||
| 2980 | |||
| 2981 | my $button12 = $self->addButton($grid, | ||
| 2982 | 'Reset', 'Reset the system login warning delay', undef, | ||
| 2983 | 10, 12, 13, 14); | ||
| 2984 | $button12->signal_connect('clicked' => sub { | ||
| 2985 | |||
| 2986 | # Set the system prompt delay | ||
| 2987 | $self->session->pseudoCmd('setdelay -l', $self->pseudoCmdMode); | ||
| 2988 | |||
| 2989 | # Update the entry box | ||
| 2990 | $entry6->set_text($axmud::CLIENT->loginWarningTime); | ||
| 2991 | }); | ||
| 2992 | |||
| 2993 | # Tab complete | ||
| 2994 | return 1; | ||
| 2995 | } | ||
| 2996 | |||
| 2997 | sub settings7Tab { | ||
| 2998 | |||
| 2999 | # Settings7 tab | ||
| 3000 | # | ||
| 3001 | # Expected arguments | ||
| 3002 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 3003 | # | ||
| 3004 | # Return values | ||
| 3005 | # 'undef' on improper arguments | ||
| 3006 | # 1 otherwise | ||
| 3007 | |||
| 3008 | my ($self, $innerNotebook, $check) = @_; | ||
| 3009 | |||
| 3010 | # Check for improper arguments | ||
| 3011 | if (! defined $innerNotebook || defined $check) { | ||
| 3012 | |||
| 3013 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings7Tab', @_); | ||
| 3014 | } | ||
| 3015 | |||
| 3016 | # Tab setup | ||
| 3017 | my $grid = $self->addTab( | ||
| 3018 | $innerNotebook, | ||
| 3019 | 'Page _7', | ||
| 3020 | ['Telnet option negotiations', 'MUD protocols'], | ||
| 3021 | ); | ||
| 3022 | |||
| 3023 | # Telnet option negotiations | ||
| 3024 | $self->addLabel($grid, '<b>Telnet option negotiations</b>', | ||
| 3025 | 0, 6, 0, 1); | ||
| 3026 | |||
| 3027 | my $checkButton = $self->addCheckButton( | ||
| 3028 | $grid, 'Allow ECHO (hide passwords, etc)', undef, TRUE, | ||
| 3029 | 1, 6, 1, 2); | ||
| 3030 | $checkButton->set_active($axmud::CLIENT->useEchoFlag); | ||
| 3031 | $checkButton->signal_connect('toggled' => sub { | ||
| 3032 | |||
| 3033 | $axmud::CLIENT->toggle_telnetOption('echo', $checkButton->get_active()); | ||
| 3034 | }); | ||
| 3035 | |||
| 3036 | my $checkButton2 = $self->addCheckButton( | ||
| 3037 | $grid, 'Allow SGA (Suppress Go Ahead)', undef, TRUE, | ||
| 3038 | 1, 6, 2, 3); | ||
| 3039 | $checkButton2->set_active($axmud::CLIENT->useSgaFlag); | ||
| 3040 | $checkButton2->signal_connect('toggled' => sub { | ||
| 3041 | |||
| 3042 | $axmud::CLIENT->toggle_telnetOption('sga', $checkButton2->get_active()); | ||
| 3043 | }); | ||
| 3044 | |||
| 3045 | my $checkButton3 = $self->addCheckButton( | ||
| 3046 | $grid, 'Allow TTYPE (detect Terminal Type)', undef, TRUE, | ||
| 3047 | 1, 6, 3, 4); | ||
| 3048 | $checkButton3->set_active($axmud::CLIENT->useTTypeFlag); | ||
| 3049 | $checkButton3->signal_connect('toggled' => sub { | ||
| 3050 | |||
| 3051 | $axmud::CLIENT->toggle_telnetOption('ttype', $checkButton3->get_active()); | ||
| 3052 | }); | ||
| 3053 | |||
| 3054 | my $checkButton4 = $self->addCheckButton( | ||
| 3055 | $grid, 'Allow EOR (negotiate End Of Record)', undef, TRUE, | ||
| 3056 | 1, 6, 4, 5); | ||
| 3057 | $checkButton4->set_active($axmud::CLIENT->useEorFlag); | ||
| 3058 | $checkButton4->signal_connect('toggled' => sub { | ||
| 3059 | |||
| 3060 | $axmud::CLIENT->toggle_telnetOption('eor', $checkButton4->get_active()); | ||
| 3061 | }); | ||
| 3062 | |||
| 3063 | my $checkButton5 = $self->addCheckButton( | ||
| 3064 | $grid, 'Allow NAWS (Negotiate About Window Size)', undef, TRUE, | ||
| 3065 | 1, 6, 5, 6); | ||
| 3066 | $checkButton5->set_active($axmud::CLIENT->useNawsFlag); | ||
| 3067 | $checkButton5->signal_connect('toggled' => sub { | ||
| 3068 | |||
| 3069 | $axmud::CLIENT->toggle_telnetOption('naws', $checkButton5->get_active()); | ||
| 3070 | }); | ||
| 3071 | |||
| 3072 | my $checkButton6 = $self->addCheckButton( | ||
| 3073 | $grid, 'Allow NEW-ENVIRON (New Environment option)', undef, TRUE, | ||
| 3074 | 1, 6, 6, 7); | ||
| 3075 | $checkButton6->set_active($axmud::CLIENT->useNewEnvironFlag); | ||
| 3076 | $checkButton6->signal_connect('toggled' => sub { | ||
| 3077 | |||
| 3078 | $axmud::CLIENT->toggle_telnetOption('new_environ', $checkButton6->get_active()); | ||
| 3079 | }); | ||
| 3080 | |||
| 3081 | my $checkButton7 = $self->addCheckButton( | ||
| 3082 | $grid, 'Allow CHARSET (Character Set and translation)', undef, TRUE, | ||
| 3083 | 1, 6, 7, 8); | ||
| 3084 | $checkButton7->set_active($axmud::CLIENT->useCharSetFlag); | ||
| 3085 | $checkButton7->signal_connect('toggled' => sub { | ||
| 3086 | |||
| 3087 | $axmud::CLIENT->toggle_telnetOption('charset', $checkButton7->get_active()); | ||
| 3088 | }); | ||
| 3089 | |||
| 3090 | # MUD protocols | ||
| 3091 | $self->addLabel($grid, '<b>MUD protocols</b>', | ||
| 3092 | 7, 12, 0, 1); | ||
| 3093 | my $checkButton8 = $self->addCheckButton( | ||
| 3094 | $grid, 'Allow MSDP (Mud Server Data Protocol)', undef, TRUE, | ||
| 3095 | 7, 12, 1, 2); | ||
| 3096 | $checkButton8->set_active($axmud::CLIENT->useMsdpFlag); | ||
| 3097 | $checkButton8->signal_connect('toggled' => sub { | ||
| 3098 | |||
| 3099 | $axmud::CLIENT->toggle_mudProtocol('msdp', $checkButton8->get_active()); | ||
| 3100 | }); | ||
| 3101 | |||
| 3102 | my $checkButton9 = $self->addCheckButton( | ||
| 3103 | $grid, 'Allow MSSP (Mud Server Status Protocol)', undef, TRUE, | ||
| 3104 | 7, 12, 2, 3); | ||
| 3105 | $checkButton9->set_active($axmud::CLIENT->useMsspFlag); | ||
| 3106 | $checkButton9->signal_connect('toggled' => sub { | ||
| 3107 | |||
| 3108 | $axmud::CLIENT->toggle_mudProtocol('mssp', $checkButton9->get_active()); | ||
| 3109 | }); | ||
| 3110 | |||
| 3111 | my $checkButton10 = $self->addCheckButton( | ||
| 3112 | $grid, 'Allow MCCP (Mud Client Compression Protocol)', undef, TRUE, | ||
| 3113 | 7, 12, 3, 4); | ||
| 3114 | $checkButton10->set_active($axmud::CLIENT->useMccpFlag); | ||
| 3115 | $checkButton10->signal_connect('toggled' => sub { | ||
| 3116 | |||
| 3117 | $axmud::CLIENT->toggle_mudProtocol('mccp', $checkButton10->get_active()); | ||
| 3118 | }); | ||
| 3119 | |||
| 3120 | my $checkButton11 = $self->addCheckButton( | ||
| 3121 | $grid, 'Allow ZMP (Zenith Mud Protocol)', undef, TRUE, | ||
| 3122 | 7, 12, 4, 5); | ||
| 3123 | $checkButton11->set_active($axmud::CLIENT->useZmpFlag); | ||
| 3124 | $checkButton11->signal_connect('toggled' => sub { | ||
| 3125 | |||
| 3126 | $axmud::CLIENT->toggle_mudProtocol('zmp', $checkButton11->get_active()); | ||
| 3127 | }); | ||
| 3128 | |||
| 3129 | my $checkButton12 = $self->addCheckButton( | ||
| 3130 | $grid, 'Allow AARD102 (Aardwolf 102 channel)', undef, TRUE, | ||
| 3131 | 7, 12, 5, 6); | ||
| 3132 | $checkButton12->set_active($axmud::CLIENT->useAard102Flag); | ||
| 3133 | $checkButton12->signal_connect('toggled' => sub { | ||
| 3134 | |||
| 3135 | $axmud::CLIENT->toggle_mudProtocol('aard102', $checkButton12->get_active()); | ||
| 3136 | }); | ||
| 3137 | |||
| 3138 | my $checkButton13 = $self->addCheckButton( | ||
| 3139 | $grid, 'Allow ATCP (Achaea Telnet Client Protocol)', undef, TRUE, | ||
| 3140 | 7, 12, 6, 7); | ||
| 3141 | $checkButton13->set_active($axmud::CLIENT->useAtcpFlag); | ||
| 3142 | $checkButton13->signal_connect('toggled' => sub { | ||
| 3143 | |||
| 3144 | $axmud::CLIENT->toggle_mudProtocol('atcp', $checkButton13->get_active()); | ||
| 3145 | }); | ||
| 3146 | |||
| 3147 | my $checkButton14 = $self->addCheckButton( | ||
| 3148 | $grid, 'Allow GMCP (Generic MUD Communication Protocol)', undef, TRUE, | ||
| 3149 | 7, 12, 7, 8); | ||
| 3150 | $checkButton14->set_active($axmud::CLIENT->useGmcpFlag); | ||
| 3151 | $checkButton14->signal_connect('toggled' => sub { | ||
| 3152 | |||
| 3153 | $axmud::CLIENT->toggle_mudProtocol('gmcp', $checkButton14->get_active()); | ||
| 3154 | }); | ||
| 3155 | |||
| 3156 | my $checkButton15 = $self->addCheckButton( | ||
| 3157 | $grid, 'Allow MTTS (Mud Terminal Type Standard)', undef, TRUE, | ||
| 3158 | 7, 12, 8, 9); | ||
| 3159 | $checkButton15->set_active($axmud::CLIENT->useMttsFlag); | ||
| 3160 | $checkButton15->signal_connect('toggled' => sub { | ||
| 3161 | |||
| 3162 | $axmud::CLIENT->toggle_mudProtocol('mtts', $checkButton15->get_active()); | ||
| 3163 | }); | ||
| 3164 | |||
| 3165 | my $checkButton16 = $self->addCheckButton( | ||
| 3166 | $grid, 'Allow MNES (MUD NEW-ENVIRON Standard)', undef, TRUE, | ||
| 3167 | 7, 12, 9, 10); | ||
| 3168 | $checkButton16->set_active($axmud::CLIENT->useMnesFlag); | ||
| 3169 | # (->signal_connect appears below) | ||
| 3170 | |||
| 3171 | my $checkButton17 = $self->addCheckButton( | ||
| 3172 | $grid, 'Allow MNES to send user\'s real IP address', undef, TRUE, | ||
| 3173 | 8, 12, 10, 11); | ||
| 3174 | $checkButton17->set_active($axmud::CLIENT->allowMnesSendIPFlag); | ||
| 3175 | $checkButton17->signal_connect('toggled' => sub { | ||
| 3176 | |||
| 3177 | $axmud::CLIENT->toggle_mnesFlag('send_ip', $checkButton17->get_active()); | ||
| 3178 | }); | ||
| 3179 | |||
| 3180 | my $checkButton18 = $self->addCheckButton( | ||
| 3181 | $grid, 'Allow MCP (Mud Client Protocol)', undef, TRUE, | ||
| 3182 | 7, 12, 11, 12); | ||
| 3183 | $checkButton18->set_active($axmud::CLIENT->useMcpFlag); | ||
| 3184 | $checkButton18->signal_connect('toggled' => sub { | ||
| 3185 | |||
| 3186 | $axmud::CLIENT->toggle_mudProtocol('mcp', $checkButton18->get_active()); | ||
| 3187 | }); | ||
| 3188 | |||
| 3189 | # (->signal_connect from above) | ||
| 3190 | $checkButton16->signal_connect('toggled' => sub { | ||
| 3191 | |||
| 3192 | $axmud::CLIENT->toggle_mudProtocol('mnes', $checkButton16->get_active()); | ||
| 3193 | |||
| 3194 | if ($axmud::CLIENT->useMnesFlag) { | ||
| 3195 | $checkButton17->set_sensitive(TRUE); | ||
| 3196 | } else { | ||
| 3197 | $checkButton17->set_sensitive(FALSE); | ||
| 3198 | } | ||
| 3199 | }); | ||
| 3200 | |||
| 3201 | my $checkButton19 = $self->addCheckButton( | ||
| 3202 | $grid, 'Allow Pueblo (partial support)', undef, TRUE, | ||
| 3203 | 7, 12, 12, 13); | ||
| 3204 | $checkButton19->set_active($axmud::CLIENT->usePuebloFlag); | ||
| 3205 | $checkButton19->signal_connect('toggled' => sub { | ||
| 3206 | |||
| 3207 | $axmud::CLIENT->toggle_mudProtocol('pueblo', $checkButton19->get_active()); | ||
| 3208 | }); | ||
| 3209 | |||
| 3210 | |||
| 3211 | # Tab complete | ||
| 3212 | return 1; | ||
| 3213 | } | ||
| 3214 | |||
| 3215 | sub settings8Tab { | ||
| 3216 | |||
| 3217 | # Settings8 tab | ||
| 3218 | # | ||
| 3219 | # Expected arguments | ||
| 3220 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 3221 | # | ||
| 3222 | # Return values | ||
| 3223 | # 'undef' on improper arguments | ||
| 3224 | # 1 otherwise | ||
| 3225 | |||
| 3226 | my ($self, $innerNotebook, $check) = @_; | ||
| 3227 | |||
| 3228 | # Check for improper arguments | ||
| 3229 | if (! defined $innerNotebook || defined $check) { | ||
| 3230 | |||
| 3231 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings8Tab', @_); | ||
| 3232 | } | ||
| 3233 | |||
| 3234 | # Tab setup | ||
| 3235 | my $grid = $self->addTab( | ||
| 3236 | $innerNotebook, | ||
| 3237 | 'Page _8', | ||
| 3238 | ['MXP', 'MSP'], | ||
| 3239 | ); | ||
| 3240 | |||
| 3241 | # MXP | ||
| 3242 | $self->addLabel($grid, '<b>MXP</b>', | ||
| 3243 | 0, 6, 0, 1); | ||
| 3244 | |||
| 3245 | my $checkButton = $self->addCheckButton( | ||
| 3246 | $grid, 'Allow MXP (MUD eXtension Protocol)', undef, TRUE, | ||
| 3247 | 1, 6, 1, 2); | ||
| 3248 | $checkButton->set_active($axmud::CLIENT->useMxpFlag); | ||
| 3249 | # (->signal_connect appears below) | ||
| 3250 | |||
| 3251 | my $checkButton2 = $self->addCheckButton( | ||
| 3252 | $grid, 'Allow MXP to change fonts', undef, TRUE, | ||
| 3253 | 2, 6, 2, 3); | ||
| 3254 | $checkButton2->set_active($axmud::CLIENT->allowMxpFontFlag); | ||
| 3255 | $checkButton2->signal_connect('toggled' => sub { | ||
| 3256 | |||
| 3257 | $axmud::CLIENT->set_allowMxpFlag('font', $checkButton2->get_active()); | ||
| 3258 | }); | ||
| 3259 | |||
| 3260 | my $checkButton3 = $self->addCheckButton( | ||
| 3261 | $grid, 'Allow MXP to display images', undef, TRUE, | ||
| 3262 | 2, 6, 3, 4); | ||
| 3263 | $checkButton3->set_active($axmud::CLIENT->allowMxpImageFlag); | ||
| 3264 | # (->signal_connect appears below) | ||
| 3265 | |||
| 3266 | my $checkButton4 = $self->addCheckButton( | ||
| 3267 | $grid, 'Allow MXP to download image files', undef, TRUE, | ||
| 3268 | 2, 6, 4, 5); | ||
| 3269 | $checkButton4->set_active($axmud::CLIENT->allowMxpLoadImageFlag); | ||
| 3270 | $checkButton4->signal_connect('toggled' => sub { | ||
| 3271 | |||
| 3272 | $axmud::CLIENT->set_allowMxpFlag('load_image', $checkButton4->get_active()); | ||
| 3273 | }); | ||
| 3274 | |||
| 3275 | my $checkButton5 = $self->addCheckButton( | ||
| 3276 | $grid, 'Allow MXP to use world\'s own graphics formats', undef, TRUE, | ||
| 3277 | 2, 6, 5, 6); | ||
| 3278 | $checkButton5->set_active($axmud::CLIENT->allowMxpFilterImageFlag); | ||
| 3279 | $checkButton5->signal_connect('toggled' => sub { | ||
| 3280 | |||
| 3281 | $axmud::CLIENT->set_allowMxpFlag('filter_image', $checkButton5->get_active()); | ||
| 3282 | }); | ||
| 3283 | |||
| 3284 | my $checkButton6 = $self->addCheckButton( | ||
| 3285 | $grid, 'Allow MXP to play sound/music files', undef, TRUE, | ||
| 3286 | 2, 6, 6, 7); | ||
| 3287 | $checkButton6->set_active($axmud::CLIENT->allowMxpSoundFlag); | ||
| 3288 | # (->signal_connect appears below) | ||
| 3289 | |||
| 3290 | my $checkButton7 = $self->addCheckButton( | ||
| 3291 | $grid, 'Allow MXP to download sound/music files', undef, TRUE, | ||
| 3292 | 2, 6, 7, 8); | ||
| 3293 | $checkButton7->set_active($axmud::CLIENT->allowMxpLoadSoundFlag); | ||
| 3294 | $checkButton7->signal_connect('toggled' => sub { | ||
| 3295 | |||
| 3296 | $axmud::CLIENT->set_allowMxpFlag('load_sound', $checkButton7->get_active()); | ||
| 3297 | }); | ||
| 3298 | |||
| 3299 | my $checkButton8 = $self->addCheckButton( | ||
| 3300 | $grid, 'Allow MXP to display gauges/status bars', undef, TRUE, | ||
| 3301 | 2, 6, 8, 9); | ||
| 3302 | $checkButton8->set_active($axmud::CLIENT->allowMxpGaugeFlag); | ||
| 3303 | $checkButton8->signal_connect('toggled' => sub { | ||
| 3304 | |||
| 3305 | $axmud::CLIENT->set_allowMxpFlag('gauge', $checkButton8->get_active()); | ||
| 3306 | }); | ||
| 3307 | |||
| 3308 | # (right column) | ||
| 3309 | |||
| 3310 | my $checkButton9 = $self->addCheckButton( | ||
| 3311 | $grid, 'Allow MXP to use frames', undef, TRUE, | ||
| 3312 | 7, 12, 2, 3); | ||
| 3313 | $checkButton9->set_active($axmud::CLIENT->allowMxpFrameFlag); | ||
| 3314 | $checkButton9->signal_connect('toggled' => sub { | ||
| 3315 | |||
| 3316 | $axmud::CLIENT->set_allowMxpFlag('frame', $checkButton9->get_active()); | ||
| 3317 | }); | ||
| 3318 | |||
| 3319 | my $checkButton10 = $self->addCheckButton( | ||
| 3320 | $grid, 'Allow MXP to use frames inside \'main\' windows', undef, TRUE, | ||
| 3321 | 7, 12, 3, 4); | ||
| 3322 | $checkButton10->set_active($axmud::CLIENT->allowMxpInteriorFlag); | ||
| 3323 | $checkButton10->signal_connect('toggled' => sub { | ||
| 3324 | |||
| 3325 | $axmud::CLIENT->set_allowMxpFlag('interior', $checkButton10->get_active()); | ||
| 3326 | }); | ||
| 3327 | |||
| 3328 | my $checkButton11 = $self->addCheckButton( | ||
| 3329 | $grid, 'Allow MXP to crosslink to new servers', undef, TRUE, | ||
| 3330 | 7, 12, 4, 5); | ||
| 3331 | $checkButton11->set_active($axmud::CLIENT->allowMxpCrosslinkFlag); | ||
| 3332 | $checkButton11->signal_connect('toggled' => sub { | ||
| 3333 | |||
| 3334 | $axmud::CLIENT->set_allowMxpFlag('crosslink', $checkButton11->get_active()); | ||
| 3335 | }); | ||
| 3336 | |||
| 3337 | my $checkButton12 = $self->addCheckButton( | ||
| 3338 | $grid, 'Allow Locator task to rely on MXP room data', undef, TRUE, | ||
| 3339 | 7, 12, 5, 6); | ||
| 3340 | $checkButton12->set_active($axmud::CLIENT->allowMxpRoomFlag); | ||
| 3341 | $checkButton12->signal_connect('toggled' => sub { | ||
| 3342 | |||
| 3343 | $axmud::CLIENT->set_allowMxpFlag('room', $checkButton12->get_active()); | ||
| 3344 | }); | ||
| 3345 | |||
| 3346 | my $checkButton13 = $self->addCheckButton( | ||
| 3347 | $grid, 'Allow some illegal keywords (not recommended)', undef, TRUE, | ||
| 3348 | 7, 12, 6, 7); | ||
| 3349 | $checkButton13->set_active($axmud::CLIENT->allowMxpFlexibleFlag); | ||
| 3350 | $checkButton13->signal_connect('toggled' => sub { | ||
| 3351 | |||
| 3352 | $axmud::CLIENT->set_allowMxpFlag('flexible', $checkButton13->get_active()); | ||
| 3353 | }); | ||
| 3354 | |||
| 3355 | my $checkButton14 = $self->addCheckButton( | ||
| 3356 | $grid, 'Assume world has enabled MXP (for IRE MUDs)', undef, TRUE, | ||
| 3357 | 7, 12, 7, 8); | ||
| 3358 | $checkButton14->set_active($axmud::CLIENT->allowMxpPermFlag); | ||
| 3359 | $checkButton14->signal_connect('toggled' => sub { | ||
| 3360 | |||
| 3361 | $axmud::CLIENT->set_allowMxpFlag('perm', $checkButton14->get_active()); | ||
| 3362 | }); | ||
| 3363 | |||
| 3364 | # (bottom left columN) | ||
| 3365 | |||
| 3366 | # MSP | ||
| 3367 | $self->addLabel($grid, '<b>MSP</b>', | ||
| 3368 | 0, 6, 9, 10); | ||
| 3369 | |||
| 3370 | my $checkButton16 = $self->addCheckButton( | ||
| 3371 | $grid, 'Allow MSP (Mud Sound Protocol)', undef, TRUE, | ||
| 3372 | 1, 6, 10, 11); | ||
| 3373 | $checkButton16->set_active($axmud::CLIENT->useMspFlag); | ||
| 3374 | # (->signal_connect appears below) | ||
| 3375 | |||
| 3376 | my $checkButton17 = $self->addCheckButton( | ||
| 3377 | $grid, 'Allow MSP sounds to play concurrently', undef, TRUE, | ||
| 3378 | 2, 6, 11, 12); | ||
| 3379 | $checkButton17->set_active($axmud::CLIENT->allowMspMultipleFlag); | ||
| 3380 | $checkButton17->signal_connect('toggled' => sub { | ||
| 3381 | |||
| 3382 | $axmud::CLIENT->toggle_mspFlag('multiple', $checkButton17->get_active()); | ||
| 3383 | }); | ||
| 3384 | |||
| 3385 | my $checkButton18 = $self->addCheckButton( | ||
| 3386 | $grid, 'Automatically download MSP sound files', undef, TRUE, | ||
| 3387 | 2, 6, 12, 13); | ||
| 3388 | $checkButton18->set_active($axmud::CLIENT->allowMspLoadSoundFlag); | ||
| 3389 | $checkButton18->signal_connect('toggled' => sub { | ||
| 3390 | |||
| 3391 | $axmud::CLIENT->toggle_mspFlag('load', $checkButton18->get_active()); | ||
| 3392 | }); | ||
| 3393 | |||
| 3394 | my $checkButton19 = $self->addCheckButton( | ||
| 3395 | $grid, 'Allow flexible tag placement (not recommended)', undef, TRUE, | ||
| 3396 | 2, 6, 13, 14); | ||
| 3397 | $checkButton19->set_active($axmud::CLIENT->allowMspFlexibleFlag); | ||
| 3398 | $checkButton19->signal_connect('toggled' => sub { | ||
| 3399 | |||
| 3400 | $axmud::CLIENT->toggle_mspFlag('flexible', $checkButton19->get_active()); | ||
| 3401 | }); | ||
| 3402 | |||
| 3403 | # Sensitise/desensitise buttons | ||
| 3404 | $self->settings8Tab_sensitiseButtons( | ||
| 3405 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3406 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3407 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3408 | $checkButton17, $checkButton18, $checkButton19, | ||
| 3409 | ); | ||
| 3410 | |||
| 3411 | # (->signal_connects from above) | ||
| 3412 | |||
| 3413 | # Allow MXP (MUD eXtension Protocol) | ||
| 3414 | $checkButton->signal_connect('toggled' => sub { | ||
| 3415 | |||
| 3416 | # Sensitise/desensitise buttons | ||
| 3417 | $self->settings8Tab_sensitiseButtons( | ||
| 3418 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3419 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3420 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3421 | $checkButton17, $checkButton18, $checkButton19, | ||
| 3422 | ); | ||
| 3423 | |||
| 3424 | $axmud::CLIENT->toggle_mudProtocol('mxp', $checkButton->get_active()); | ||
| 3425 | }); | ||
| 3426 | |||
| 3427 | # Allow MXP to display images | ||
| 3428 | $checkButton3->signal_connect('toggled' => sub { | ||
| 3429 | |||
| 3430 | if (! $checkButton3->get_active()) { | ||
| 3431 | |||
| 3432 | # (Only send an unsoliciated <SUPPORTS> tag once) | ||
| 3433 | $axmud::CLIENT->set_mxpPreventSupportFlag(TRUE); | ||
| 3434 | $checkButton4->set_active(FALSE); | ||
| 3435 | $checkButton5->set_active(FALSE); | ||
| 3436 | $axmud::CLIENT->set_mxpPreventSupportFlag(FALSE); | ||
| 3437 | $axmud::CLIENT->set_allowMxpFlag('image', FALSE); | ||
| 3438 | |||
| 3439 | } else { | ||
| 3440 | |||
| 3441 | $checkButton4->set_sensitive(TRUE); | ||
| 3442 | $checkButton5->set_sensitive(TRUE); | ||
| 3443 | $axmud::CLIENT->set_allowMxpFlag('image', TRUE); | ||
| 3444 | } | ||
| 3445 | |||
| 3446 | # Sensitise/desensitise buttons | ||
| 3447 | $self->settings8Tab_sensitiseButtons( | ||
| 3448 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3449 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3450 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3451 | $checkButton17, $checkButton18, $checkButton19, | ||
| 3452 | |||
| 3453 | ); | ||
| 3454 | }); | ||
| 3455 | |||
| 3456 | # Allow MXP to play sound/music files | ||
| 3457 | $checkButton6->signal_connect('toggled' => sub { | ||
| 3458 | |||
| 3459 | if (! $checkButton6->get_active()) { | ||
| 3460 | |||
| 3461 | # (Only send an unsoliciated <SUPPORTS> tag once) | ||
| 3462 | $axmud::CLIENT->set_mxpPreventSupportFlag(TRUE); | ||
| 3463 | $checkButton7->set_active(FALSE); | ||
| 3464 | $axmud::CLIENT->set_mxpPreventSupportFlag(FALSE); | ||
| 3465 | $axmud::CLIENT->set_allowMxpFlag('sound', FALSE); | ||
| 3466 | |||
| 3467 | } else { | ||
| 3468 | |||
| 3469 | $checkButton7->set_sensitive(TRUE); | ||
| 3470 | $axmud::CLIENT->set_allowMxpFlag('sound', TRUE); | ||
| 3471 | } | ||
| 3472 | |||
| 3473 | # Sensitise/desensitise buttons | ||
| 3474 | $self->settings8Tab_sensitiseButtons( | ||
| 3475 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3476 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3477 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3478 | $checkButton17, $checkButton18, $checkButton19, | ||
| 3479 | ); | ||
| 3480 | }); | ||
| 3481 | |||
| 3482 | # Allow MSP (Mud Sound Protocol) | ||
| 3483 | $checkButton16->signal_connect('toggled' => sub { | ||
| 3484 | |||
| 3485 | # Sensitise/desensitise buttons | ||
| 3486 | $self->settings8Tab_sensitiseButtons( | ||
| 3487 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3488 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3489 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3490 | $checkButton17, $checkButton18, $checkButton19, | ||
| 3491 | ); | ||
| 3492 | |||
| 3493 | $axmud::CLIENT->toggle_mudProtocol('msp', $checkButton16->get_active()); | ||
| 3494 | }); | ||
| 3495 | |||
| 3496 | # Tab complete | ||
| 3497 | return 1; | ||
| 3498 | } | ||
| 3499 | |||
| 3500 | sub settings8Tab_sensitiseButtons { | ||
| 3501 | |||
| 3502 | # Sensitises/desensitises various buttons in $self->settings8Tab, depending on current | ||
| 3503 | # conditions | ||
| 3504 | # | ||
| 3505 | # Expected arguments | ||
| 3506 | # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3507 | # $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3508 | # $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3509 | # $checkButton17, $checkButton18, $checkButton19 | ||
| 3510 | # - The affected buttons | ||
| 3511 | # | ||
| 3512 | # Return values | ||
| 3513 | # 'undef' on improper arguments | ||
| 3514 | # 1 otherwise | ||
| 3515 | |||
| 3516 | my ( | ||
| 3517 | $self, $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 3518 | $checkButton6, $checkButton7, $checkButton8, $checkButton9, $checkButton10, | ||
| 3519 | $checkButton11, $checkButton12, $checkButton13, $checkButton14, $checkButton16, | ||
| 3520 | $checkButton17, $checkButton18, $checkButton19, $check | ||
| 3521 | ) = @_; | ||
| 3522 | |||
| 3523 | # Local variables | ||
| 3524 | my @dataList; | ||
| 3525 | |||
| 3526 | # Check for improper arguments | ||
| 3527 | if ( | ||
| 3528 | ! defined $checkButton || ! defined $checkButton2 || ! defined $checkButton3 | ||
| 3529 | || ! defined $checkButton4 || ! defined $checkButton5 || ! defined $checkButton6 | ||
| 3530 | || ! defined $checkButton7 || ! defined $checkButton8 || ! defined $checkButton9 | ||
| 3531 | || ! defined $checkButton10 || ! defined $checkButton11 || ! defined $checkButton12 | ||
| 3532 | || ! defined $checkButton13 || ! defined $checkButton14 || ! defined $checkButton16 | ||
| 3533 | || ! defined $checkButton17 || ! defined $checkButton18 || ! defined $checkButton19 | ||
| 3534 | || defined $check | ||
| 3535 | ) { | ||
| 3536 | return $axmud::CLIENT->writeImproper( | ||
| 3537 | $self->_objClass . '->settings8Tab_sensitiseButtons', | ||
| 3538 | @_, | ||
| 3539 | ); | ||
| 3540 | } | ||
| 3541 | |||
| 3542 | if (! $checkButton->get_active()) { | ||
| 3543 | |||
| 3544 | $checkButton2->set_sensitive(FALSE); | ||
| 3545 | $checkButton3->set_sensitive(FALSE); | ||
| 3546 | $checkButton4->set_sensitive(FALSE); | ||
| 3547 | $checkButton5->set_sensitive(FALSE); | ||
| 3548 | $checkButton6->set_sensitive(FALSE); | ||
| 3549 | $checkButton7->set_sensitive(FALSE); | ||
| 3550 | $checkButton8->set_sensitive(FALSE); | ||
| 3551 | $checkButton9->set_sensitive(FALSE); | ||
| 3552 | $checkButton10->set_sensitive(FALSE); | ||
| 3553 | $checkButton11->set_sensitive(FALSE); | ||
| 3554 | $checkButton12->set_sensitive(FALSE); | ||
| 3555 | $checkButton13->set_sensitive(FALSE); | ||
| 3556 | $checkButton14->set_sensitive(FALSE); | ||
| 3557 | |||
| 3558 | } else { | ||
| 3559 | |||
| 3560 | $checkButton2->set_sensitive(TRUE); | ||
| 3561 | $checkButton3->set_sensitive(TRUE); | ||
| 3562 | |||
| 3563 | if (! $checkButton3->get_active()) { | ||
| 3564 | $checkButton4->set_sensitive(FALSE); | ||
| 3565 | $checkButton5->set_sensitive(FALSE); | ||
| 3566 | } else { | ||
| 3567 | $checkButton4->set_sensitive(TRUE); | ||
| 3568 | $checkButton5->set_sensitive(TRUE); | ||
| 3569 | } | ||
| 3570 | |||
| 3571 | $checkButton6->set_sensitive(TRUE); | ||
| 3572 | |||
| 3573 | if (! $checkButton6->get_active()) { | ||
| 3574 | $checkButton7->set_sensitive(FALSE); | ||
| 3575 | } else { | ||
| 3576 | $checkButton7->set_sensitive(TRUE); | ||
| 3577 | } | ||
| 3578 | |||
| 3579 | $checkButton8->set_sensitive(TRUE); | ||
| 3580 | $checkButton9->set_sensitive(TRUE); | ||
| 3581 | $checkButton10->set_sensitive(TRUE); | ||
| 3582 | $checkButton11->set_sensitive(TRUE); | ||
| 3583 | $checkButton12->set_sensitive(TRUE); | ||
| 3584 | $checkButton13->set_sensitive(TRUE); | ||
| 3585 | $checkButton14->set_sensitive(TRUE); | ||
| 3586 | } | ||
| 3587 | |||
| 3588 | |||
| 3589 | if (! $checkButton16->get_active()) { | ||
| 3590 | |||
| 3591 | $checkButton17->set_sensitive(FALSE); | ||
| 3592 | $checkButton18->set_sensitive(FALSE); | ||
| 3593 | $checkButton19->set_sensitive(FALSE); | ||
| 3594 | |||
| 3595 | } else { | ||
| 3596 | |||
| 3597 | $checkButton17->set_sensitive(TRUE); | ||
| 3598 | $checkButton18->set_sensitive(TRUE); | ||
| 3599 | $checkButton19->set_sensitive(TRUE); | ||
| 3600 | } | ||
| 3601 | |||
| 3602 | return 1; | ||
| 3603 | } | ||
| 3604 | |||
| 3605 | sub settings9Tab { | ||
| 3606 | |||
| 3607 | # Settings9 tab | ||
| 3608 | # | ||
| 3609 | # Expected arguments | ||
| 3610 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 3611 | # | ||
| 3612 | # Return values | ||
| 3613 | # 'undef' on improper arguments | ||
| 3614 | # 1 otherwise | ||
| 3615 | |||
| 3616 | my ($self, $innerNotebook, $check) = @_; | ||
| 3617 | |||
| 3618 | # Check for improper arguments | ||
| 3619 | if (! defined $innerNotebook || defined $check) { | ||
| 3620 | |||
| 3621 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings9Tab', @_); | ||
| 3622 | } | ||
| 3623 | |||
| 3624 | # Tab setup | ||
| 3625 | my $grid = $self->addTab( | ||
| 3626 | $innerNotebook, | ||
| 3627 | 'Page _9', | ||
| 3628 | ['Terminal emulation', 'OSC colour palette', 'Terminal type negotiations'], | ||
| 3629 | ); | ||
| 3630 | |||
| 3631 | # Terminal emulation | ||
| 3632 | $self->addLabel($grid, '<b>Terminal emulation</b>', | ||
| 3633 | 0, 6, 0, 1); | ||
| 3634 | |||
| 3635 | my $checkButton8 = $self->addCheckButton($grid, 'Use VT100 control sequences', undef, TRUE, | ||
| 3636 | 1, 6, 1, 2); | ||
| 3637 | $checkButton8->set_active($axmud::CLIENT->useCtrlSeqFlag); | ||
| 3638 | $checkButton8->signal_connect('toggled' => sub { | ||
| 3639 | |||
| 3640 | $axmud::CLIENT->toggle_termSetting('use_ctrl_seq', $checkButton8->get_active()); | ||
| 3641 | }); | ||
| 3642 | |||
| 3643 | my $checkButton9 = $self->addCheckButton( | ||
| 3644 | $grid, 'Show visible cursor in default textview', undef, TRUE, | ||
| 3645 | 1, 6, 2, 3); | ||
| 3646 | $checkButton9->set_active($axmud::CLIENT->useVisibleCursorFlag); | ||
| 3647 | # ->signal_connect is below | ||
| 3648 | |||
| 3649 | my $checkButton10 = $self->addCheckButton( | ||
| 3650 | $grid, 'Use a rapidly-blinking cursor', undef, TRUE, | ||
| 3651 | 1, 6, 3, 4); | ||
| 3652 | $checkButton10->set_active($axmud::CLIENT->useFastCursorFlag); | ||
| 3653 | # ->signal_connect is below | ||
| 3654 | if (! $axmud::CLIENT->useVisibleCursorFlag) { | ||
| 3655 | |||
| 3656 | $checkButton10->set_sensitive(FALSE); | ||
| 3657 | } | ||
| 3658 | |||
| 3659 | # ->signal_connects from above | ||
| 3660 | $checkButton9->signal_connect('toggled' => sub { | ||
| 3661 | |||
| 3662 | $axmud::CLIENT->toggle_termSetting('show_cursor', $checkButton9->get_active()); | ||
| 3663 | if ($axmud::CLIENT->useVisibleCursorFlag) { | ||
| 3664 | |||
| 3665 | $checkButton10->set_sensitive(TRUE); | ||
| 3666 | |||
| 3667 | } else { | ||
| 3668 | |||
| 3669 | $checkButton10->set_active(FALSE); | ||
| 3670 | $checkButton10->set_sensitive(FALSE); | ||
| 3671 | } | ||
| 3672 | }); | ||
| 3673 | |||
| 3674 | $checkButton10->signal_connect('toggled' => sub { | ||
| 3675 | |||
| 3676 | $axmud::CLIENT->toggle_termSetting('fast_cursor', $checkButton10->get_active()); | ||
| 3677 | |||
| 3678 | }); | ||
| 3679 | |||
| 3680 | my $checkButton11 = $self->addCheckButton( | ||
| 3681 | $grid, 'Use direct keyboard input in terminal', undef, TRUE, | ||
| 3682 | 1, 6, 4, 5); | ||
| 3683 | $checkButton11->set_active($axmud::CLIENT->useDirectKeysFlag); | ||
| 3684 | $checkButton11->signal_connect('toggled' => sub { | ||
| 3685 | |||
| 3686 | $axmud::CLIENT->toggle_termSetting('direct_keys', $checkButton11->get_active()); | ||
| 3687 | }); | ||
| 3688 | |||
| 3689 | # OSC colour palette | ||
| 3690 | $self->addLabel($grid, '<b>OSC colour palette</b>', | ||
| 3691 | 0, 6, 5, 6); | ||
| 3692 | |||
| 3693 | my $checkButton12 = $self->addCheckButton( | ||
| 3694 | $grid, 'Allow use of OSC colour palette sequences', undef, TRUE, | ||
| 3695 | 1, 6, 6, 7); | ||
| 3696 | $checkButton12->set_active($axmud::CLIENT->oscPaletteFlag); | ||
| 3697 | $checkButton12->signal_connect('toggled' => sub { | ||
| 3698 | |||
| 3699 | if ( | ||
| 3700 | ($checkButton12->get_active && ! $axmud::CLIENT->oscPaletteFlag) | ||
| 3701 | || (! $checkButton12->get_active && $axmud::CLIENT->oscPaletteFlag) | ||
| 3702 | ) { | ||
| 3703 | $self->session->pseudoCmd('togglepalette', $self->pseudoCmdMode); | ||
| 3704 | } | ||
| 3705 | }); | ||
| 3706 | |||
| 3707 | # Terminal type negotiations | ||
| 3708 | $self->addLabel($grid, '<b>Terminal type negotiations</b>', | ||
| 3709 | 7, 13, 0, 1); | ||
| 3710 | |||
| 3711 | $self->addLabel( | ||
| 3712 | $grid, | ||
| 3713 | '<i>Custom client name (if not set, TTYPE/MTTS etc use \'' . $axmud::NAME_SHORT | ||
| 3714 | . '\')</i>', | ||
| 3715 | 8, 13, 1, 2); | ||
| 3716 | my $entry = $self->addEntry($grid, undef, TRUE, | ||
| 3717 | 8, 13, 2, 3); | ||
| 3718 | $entry->set_text($axmud::CLIENT->customClientName); | ||
| 3719 | $entry->signal_connect('changed' => sub { | ||
| 3720 | |||
| 3721 | my $name = $entry->get_text(); | ||
| 3722 | |||
| 3723 | # (Default value is an empty string) | ||
| 3724 | if (! $name) { | ||
| 3725 | |||
| 3726 | $name = ''; | ||
| 3727 | } | ||
| 3728 | |||
| 3729 | $axmud::CLIENT->set_customClientName($name); | ||
| 3730 | }); | ||
| 3731 | |||
| 3732 | $self->addLabel( | ||
| 3733 | $grid, | ||
| 3734 | '<i>Custom client version (if not set, not used by TTYPE/MTTS etc)</i>', | ||
| 3735 | 8, 13, 3, 4); | ||
| 3736 | my $entry2 = $self->addEntry($grid, undef, TRUE, | ||
| 3737 | 8, 13, 4, 5); | ||
| 3738 | $entry2->set_text($axmud::CLIENT->customClientVersion); | ||
| 3739 | $entry2->signal_connect('changed' => sub { | ||
| 3740 | |||
| 3741 | my $version = $entry2->get_text(); | ||
| 3742 | |||
| 3743 | # (Default value is an empty string) | ||
| 3744 | if (! $version) { | ||
| 3745 | |||
| 3746 | $version = ''; | ||
| 3747 | } | ||
| 3748 | |||
| 3749 | $axmud::CLIENT->set_customClientVersion($version); | ||
| 3750 | }); | ||
| 3751 | |||
| 3752 | # TTYPE (not MTTS) negotiations | ||
| 3753 | $self->addLabel($grid, '<i>TTYPE (not MTTS) negotiations (*also used by MXP/ZMP/MNES)</i>', | ||
| 3754 | 8, 13, 5, 6); | ||
| 3755 | |||
| 3756 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 3757 | $grid, undef, '*Send nothing', undef, | ||
| 3758 | undef, # IV set to this value when toggled | ||
| 3759 | TRUE, # Sensitive widget | ||
| 3760 | 8, 13, 6, 7); | ||
| 3761 | if ($axmud::CLIENT->termTypeMode eq 'send_nothing') { | ||
| 3762 | |||
| 3763 | $radioButton->set_active(TRUE); | ||
| 3764 | } | ||
| 3765 | $radioButton->signal_connect('toggled' => sub { | ||
| 3766 | |||
| 3767 | if ($radioButton->get_active()) { | ||
| 3768 | |||
| 3769 | $axmud::CLIENT->set_termTypeMode('send_nothing'); | ||
| 3770 | } | ||
| 3771 | }); | ||
| 3772 | |||
| 3773 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 3774 | $grid, $group, '*Sent client name, then usual list', undef, undef, TRUE, | ||
| 3775 | 8, 13, 7, 8); | ||
| 3776 | if ($axmud::CLIENT->termTypeMode eq 'send_client') { | ||
| 3777 | |||
| 3778 | $radioButton2->set_active(TRUE); | ||
| 3779 | } | ||
| 3780 | $radioButton2->signal_connect('toggled' => sub { | ||
| 3781 | |||
| 3782 | if ($radioButton2->get_active()) { | ||
| 3783 | |||
| 3784 | $axmud::CLIENT->set_termTypeMode('send_client'); | ||
| 3785 | } | ||
| 3786 | }); | ||
| 3787 | |||
| 3788 | my ($group3, $radioButton3) = $self->addRadioButton( | ||
| 3789 | $grid, $group2, '*Send client/name version, then usual list', undef, undef, TRUE, | ||
| 3790 | 8, 13, 8, 9); | ||
| 3791 | if ($axmud::CLIENT->termTypeMode eq 'send_client_version') { | ||
| 3792 | |||
| 3793 | $radioButton3->set_active(TRUE); | ||
| 3794 | } | ||
| 3795 | $radioButton3->signal_connect('toggled' => sub { | ||
| 3796 | |||
| 3797 | if ($radioButton3->get_active()) { | ||
| 3798 | |||
| 3799 | $axmud::CLIENT->set_termTypeMode('send_client_version'); | ||
| 3800 | } | ||
| 3801 | }); | ||
| 3802 | |||
| 3803 | my ($group4, $radioButton4) = $self->addRadioButton( | ||
| 3804 | $grid, $group3, '*Send custom client name/version, then usual list', | ||
| 3805 | undef, undef, TRUE, | ||
| 3806 | 8, 13, 9, 10); | ||
| 3807 | if ($axmud::CLIENT->termTypeMode eq 'send_custom_client') { | ||
| 3808 | |||
| 3809 | $radioButton4->set_active(TRUE); | ||
| 3810 | } | ||
| 3811 | $radioButton4->signal_connect('toggled' => sub { | ||
| 3812 | |||
| 3813 | if ($radioButton4->get_active()) { | ||
| 3814 | |||
| 3815 | $axmud::CLIENT->set_termTypeMode('send_custom_client'); | ||
| 3816 | } | ||
| 3817 | }); | ||
| 3818 | |||
| 3819 | my ($group5, $radioButton5) = $self->addRadioButton( | ||
| 3820 | $grid, $group4, 'Send usual terminal type list', undef, undef, TRUE, | ||
| 3821 | 8, 13, 10, 11); | ||
| 3822 | if ($axmud::CLIENT->termTypeMode eq 'send_default') { | ||
| 3823 | |||
| 3824 | $radioButton5->set_active(TRUE); | ||
| 3825 | } | ||
| 3826 | $radioButton5->signal_connect('toggled' => sub { | ||
| 3827 | |||
| 3828 | if ($radioButton5->get_active()) { | ||
| 3829 | |||
| 3830 | $axmud::CLIENT->set_termTypeMode('send_default'); | ||
| 3831 | } | ||
| 3832 | }); | ||
| 3833 | |||
| 3834 | my ($group6, $radioButton6) = $self->addRadioButton( | ||
| 3835 | $grid, $group5, 'Send \'unknown\'', undef, undef, TRUE, | ||
| 3836 | 8, 13, 11, 12); | ||
| 3837 | if ($axmud::CLIENT->termTypeMode eq 'send_unknown') { | ||
| 3838 | |||
| 3839 | $radioButton6->set_active(TRUE); | ||
| 3840 | } | ||
| 3841 | $radioButton6->signal_connect('toggled' => sub { | ||
| 3842 | |||
| 3843 | if ($radioButton6->get_active()) { | ||
| 3844 | |||
| 3845 | $axmud::CLIENT->set_termTypeMode('send_unknown'); | ||
| 3846 | } | ||
| 3847 | }); | ||
| 3848 | |||
| 3849 | # Tab complete | ||
| 3850 | return 1; | ||
| 3851 | } | ||
| 3852 | |||
| 3853 | sub settings10Tab { | ||
| 3854 | |||
| 3855 | # Settings10 tab | ||
| 3856 | # | ||
| 3857 | # Expected arguments | ||
| 3858 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 3859 | # | ||
| 3860 | # Return values | ||
| 3861 | # 'undef' on improper arguments | ||
| 3862 | # 1 otherwise | ||
| 3863 | |||
| 3864 | my ($self, $innerNotebook, $check) = @_; | ||
| 3865 | |||
| 3866 | # Check for improper arguments | ||
| 3867 | if (! defined $innerNotebook || defined $check) { | ||
| 3868 | |||
| 3869 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings10Tab', @_); | ||
| 3870 | } | ||
| 3871 | |||
| 3872 | # Tab setup | ||
| 3873 | my $grid = $self->addTab( | ||
| 3874 | $innerNotebook, | ||
| 3875 | 'Page 1_0', | ||
| 3876 | ['Debugging flags (telnet options/negotiations)'], | ||
| 3877 | ); | ||
| 3878 | |||
| 3879 | # Debugging flags (telnet options/negotiations) | ||
| 3880 | $self->addLabel($grid, '<b>Debugging flags (telnet options/negotiations)</b>', | ||
| 3881 | 0, 12, 0, 1); | ||
| 3882 | |||
| 3883 | my $checkButton = $self->addCheckButton( | ||
| 3884 | $grid, 'Show debug messages for invalid escape sequences', undef, TRUE, | ||
| 3885 | 1, 12, 1, 2); | ||
| 3886 | $checkButton->set_active($axmud::CLIENT->debugEscSequenceFlag); | ||
| 3887 | $checkButton->signal_connect('toggled' => sub { | ||
| 3888 | |||
| 3889 | $axmud::CLIENT->set_debugFlag('debugEscSequenceFlag', $checkButton->get_active()); | ||
| 3890 | }); | ||
| 3891 | |||
| 3892 | my $checkButton2 = $self->addCheckButton( | ||
| 3893 | $grid, | ||
| 3894 | 'Show debug messages while negotiating telnet options/MUD protocols', | ||
| 3895 | undef, | ||
| 3896 | TRUE, | ||
| 3897 | 1, 12, 2, 3); | ||
| 3898 | $checkButton2->set_active($axmud::CLIENT->debugTelnetFlag); | ||
| 3899 | $checkButton2->signal_connect('toggled' => sub { | ||
| 3900 | |||
| 3901 | $axmud::CLIENT->set_debugFlag('debugTelnetFlag', $checkButton2->get_active()); | ||
| 3902 | }); | ||
| 3903 | |||
| 3904 | my $checkButton3 = $self->addCheckButton( | ||
| 3905 | $grid, | ||
| 3906 | 'Show short debug messages while negotiating telnet options/MUD protocols', | ||
| 3907 | undef, | ||
| 3908 | TRUE, | ||
| 3909 | 1, 12, 3, 4); | ||
| 3910 | $checkButton3->set_active($axmud::CLIENT->debugTelnetMiniFlag); | ||
| 3911 | $checkButton3->signal_connect('toggled' => sub { | ||
| 3912 | |||
| 3913 | $axmud::CLIENT->set_debugFlag('debugTelnetMiniFlag', $checkButton3->get_active()); | ||
| 3914 | }); | ||
| 3915 | |||
| 3916 | my $checkButton4 = $self->addCheckButton( | ||
| 3917 | $grid, | ||
| 3918 | 'Tell telnet library to write its own negotiation logfile in ' . $axmud::SCRIPT | ||
| 3919 | . ' base directory', | ||
| 3920 | undef, | ||
| 3921 | TRUE, | ||
| 3922 | 1, 12, 4, 5); | ||
| 3923 | $checkButton4->set_active($axmud::CLIENT->debugTelnetLogFlag); | ||
| 3924 | $checkButton4->signal_connect('toggled' => sub { | ||
| 3925 | |||
| 3926 | $axmud::CLIENT->set_debugFlag('debugTelnetLogFlag', $checkButton4->get_active()); | ||
| 3927 | }); | ||
| 3928 | |||
| 3929 | my $checkButton5 = $self->addCheckButton( | ||
| 3930 | $grid, | ||
| 3931 | 'Show debug messages when MSDP data is sent to Status/Locator tasks', | ||
| 3932 | undef, | ||
| 3933 | TRUE, | ||
| 3934 | 1, 12, 5, 6); | ||
| 3935 | $checkButton5->set_active($axmud::CLIENT->debugMsdpFlag); | ||
| 3936 | $checkButton5->signal_connect('toggled' => sub { | ||
| 3937 | |||
| 3938 | $axmud::CLIENT->set_debugFlag('debugMsdpFlag', $checkButton5->get_active()); | ||
| 3939 | }); | ||
| 3940 | |||
| 3941 | my $checkButton6 = $self->addCheckButton( | ||
| 3942 | $grid, 'Show debug messages when invalid MXP tags are received', undef, TRUE, | ||
| 3943 | 1, 12, 6, 7); | ||
| 3944 | $checkButton6->set_active($axmud::CLIENT->debugMxpFlag); | ||
| 3945 | $checkButton6->signal_connect('toggled' => sub { | ||
| 3946 | |||
| 3947 | $axmud::CLIENT->set_debugFlag('debugMxpFlag', $checkButton6->get_active()); | ||
| 3948 | }); | ||
| 3949 | |||
| 3950 | my $checkButton7 = $self->addCheckButton( | ||
| 3951 | $grid, 'Show debug messages when MXP comments are received', undef, TRUE, | ||
| 3952 | 1, 12, 7, 8); | ||
| 3953 | $checkButton7->set_active($axmud::CLIENT->debugMxpCommentFlag); | ||
| 3954 | $checkButton7->signal_connect('toggled' => sub { | ||
| 3955 | |||
| 3956 | $axmud::CLIENT->set_debugFlag('debugMxpCommentFlag', $checkButton7->get_active()); | ||
| 3957 | }); | ||
| 3958 | |||
| 3959 | my $checkButton8 = $self->addCheckButton( | ||
| 3960 | $grid, 'Show debug messages when invalid Pueblo tags are received', undef, TRUE, | ||
| 3961 | 1, 12, 8, 9); | ||
| 3962 | $checkButton8->set_active($axmud::CLIENT->debugPuebloFlag); | ||
| 3963 | $checkButton8->signal_connect('toggled' => sub { | ||
| 3964 | |||
| 3965 | $axmud::CLIENT->set_debugFlag('debugPuebloFlag', $checkButton8->get_active()); | ||
| 3966 | }); | ||
| 3967 | |||
| 3968 | my $checkButton9 = $self->addCheckButton( | ||
| 3969 | $grid, 'Show debug messages when Pueblo comments are received', undef, TRUE, | ||
| 3970 | 1, 12, 9, 10); | ||
| 3971 | $checkButton9->set_active($axmud::CLIENT->debugPuebloCommentFlag); | ||
| 3972 | $checkButton9->signal_connect('toggled' => sub { | ||
| 3973 | |||
| 3974 | $axmud::CLIENT->set_debugFlag('debugPuebloCommentFlag', $checkButton9->get_active()); | ||
| 3975 | }); | ||
| 3976 | |||
| 3977 | my $checkButton10 = $self->addCheckButton( | ||
| 3978 | $grid, 'Show debug messages for incoming ZMP data', undef, TRUE, | ||
| 3979 | 1, 12, 10, 11); | ||
| 3980 | $checkButton10->set_active($axmud::CLIENT->debugZmpFlag); | ||
| 3981 | $checkButton10->signal_connect('toggled' => sub { | ||
| 3982 | |||
| 3983 | $axmud::CLIENT->set_debugFlag('debugZmpFlag', $checkButton10->get_active()); | ||
| 3984 | }); | ||
| 3985 | |||
| 3986 | my $checkButton11 = $self->addCheckButton( | ||
| 3987 | $grid, 'Show debug messages for incoming ATCP data', undef, TRUE, | ||
| 3988 | 1, 12, 11, 12); | ||
| 3989 | $checkButton11->set_active($axmud::CLIENT->debugAtcpFlag); | ||
| 3990 | $checkButton11->signal_connect('toggled' => sub { | ||
| 3991 | |||
| 3992 | $axmud::CLIENT->set_debugFlag('debugAtcpFlag', $checkButton11->get_active()); | ||
| 3993 | }); | ||
| 3994 | |||
| 3995 | my $checkButton12 = $self->addCheckButton( | ||
| 3996 | $grid, 'Show debug messages for incoming GMCP data', undef, TRUE, | ||
| 3997 | 1, 12, 12, 13); | ||
| 3998 | $checkButton12->set_active($axmud::CLIENT->debugGmcpFlag); | ||
| 3999 | $checkButton12->signal_connect('toggled' => sub { | ||
| 4000 | |||
| 4001 | $axmud::CLIENT->set_debugFlag('debugGmcpFlag', $checkButton12->get_active()); | ||
| 4002 | }); | ||
| 4003 | |||
| 4004 | my $checkButton13 = $self->addCheckButton( | ||
| 4005 | $grid, 'Show debug messages when invalid MCP messages are received/sent', undef, TRUE, | ||
| 4006 | 1, 12, 13, 14); | ||
| 4007 | $checkButton13->set_active($axmud::CLIENT->debugMcpFlag); | ||
| 4008 | $checkButton13->signal_connect('toggled' => sub { | ||
| 4009 | |||
| 4010 | $axmud::CLIENT->set_debugFlag('debugMcpFlag', $checkButton13->get_active()); | ||
| 4011 | }); | ||
| 4012 | |||
| 4013 | # Tab complete | ||
| 4014 | return 1; | ||
| 4015 | } | ||
| 4016 | |||
| 4017 | sub settings11Tab { | ||
| 4018 | |||
| 4019 | # Settings11 tab | ||
| 4020 | # | ||
| 4021 | # Expected arguments | ||
| 4022 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 4023 | # | ||
| 4024 | # Return values | ||
| 4025 | # 'undef' on improper arguments | ||
| 4026 | # 1 otherwise | ||
| 4027 | |||
| 4028 | my ($self, $innerNotebook, $check) = @_; | ||
| 4029 | |||
| 4030 | # Check for improper arguments | ||
| 4031 | if (! defined $innerNotebook || defined $check) { | ||
| 4032 | |||
| 4033 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings11Tab', @_); | ||
| 4034 | } | ||
| 4035 | |||
| 4036 | # Tab setup | ||
| 4037 | my $grid = $self->addTab( | ||
| 4038 | $innerNotebook, | ||
| 4039 | 'Page 11', | ||
| 4040 | ['Debugging flags (other)'], | ||
| 4041 | ); | ||
| 4042 | |||
| 4043 | # Debugging flags (other) | ||
| 4044 | $self->addLabel($grid, '<b>Debugging flags (other)</b>', | ||
| 4045 | 0, 12, 0, 1); | ||
| 4046 | |||
| 4047 | my $checkButton = $self->addCheckButton( | ||
| 4048 | $grid, '\'Main\' window shows explicit display buffer line numbers', undef, TRUE, | ||
| 4049 | 1, 12, 1, 2); | ||
| 4050 | $checkButton->set_active($axmud::CLIENT->debugLineNumsFlag); | ||
| 4051 | $checkButton->signal_connect('toggled' => sub { | ||
| 4052 | |||
| 4053 | $axmud::CLIENT->set_debugFlag('debugLineNumsFlag', $checkButton->get_active()); | ||
| 4054 | }); | ||
| 4055 | |||
| 4056 | my $checkButton2 = $self->addCheckButton( | ||
| 4057 | $grid, | ||
| 4058 | '\'Main\' window shows explicit ' . $axmud::SCRIPT . ' colour/style tags', | ||
| 4059 | undef, | ||
| 4060 | TRUE, | ||
| 4061 | 1, 12, 2, 3); | ||
| 4062 | $checkButton2->set_active($axmud::CLIENT->debugLineTagsFlag); | ||
| 4063 | $checkButton2->signal_connect('toggled' => sub { | ||
| 4064 | |||
| 4065 | $axmud::CLIENT->set_debugFlag('debugLineTagsFlag', $checkButton2->get_active()); | ||
| 4066 | }); | ||
| 4067 | |||
| 4068 | my $checkButton3 = $self->addCheckButton( | ||
| 4069 | $grid, | ||
| 4070 | 'Locator task shows debug messages when it interprets room statements', | ||
| 4071 | undef, | ||
| 4072 | TRUE, | ||
| 4073 | 1, 2, 3, 4); | ||
| 4074 | $checkButton3->set_active($axmud::CLIENT->debugLocatorFlag); | ||
| 4075 | # ( ->signal_connect appears below) | ||
| 4076 | |||
| 4077 | my $checkButton4 = $self->addCheckButton( | ||
| 4078 | $grid, | ||
| 4079 | 'Locator task shows extensive debug messages when it interprets room statements', | ||
| 4080 | undef, | ||
| 4081 | TRUE, | ||
| 4082 | 1, 12, 4, 5); | ||
| 4083 | $checkButton4->set_active($axmud::CLIENT->debugMaxLocatorFlag); | ||
| 4084 | |||
| 4085 | # (->signal_connects etc for the buttons above) | ||
| 4086 | if (! $axmud::CLIENT->debugLocatorFlag) { | ||
| 4087 | |||
| 4088 | $checkButton4->set_sensitive(FALSE); | ||
| 4089 | } | ||
| 4090 | |||
| 4091 | $checkButton3->signal_connect('toggled' => sub { | ||
| 4092 | |||
| 4093 | $axmud::CLIENT->set_debugFlag('debugLocatorFlag', $checkButton3->get_active()); | ||
| 4094 | |||
| 4095 | if (! $axmud::CLIENT->debugLocatorFlag) { | ||
| 4096 | |||
| 4097 | # Turning off this button, also turns off the one immediately below (and | ||
| 4098 | # desensitises it) | ||
| 4099 | $checkButton4->set_active(FALSE); | ||
| 4100 | $checkButton4->set_sensitive(FALSE); | ||
| 4101 | |||
| 4102 | } else { | ||
| 4103 | |||
| 4104 | # Re-sensitise the button below | ||
| 4105 | $checkButton4->set_sensitive(TRUE); | ||
| 4106 | } | ||
| 4107 | }); | ||
| 4108 | |||
| 4109 | $checkButton4->signal_connect('toggled' => sub { | ||
| 4110 | |||
| 4111 | $axmud::CLIENT->set_debugFlag('debugMaxLocatorFlag', $checkButton4->get_active()); | ||
| 4112 | }); | ||
| 4113 | |||
| 4114 | my $checkButton5 = $self->addCheckButton( | ||
| 4115 | $grid, | ||
| 4116 | 'Illegal exit directions (e.g. longer than 64 characters) show debug messages', | ||
| 4117 | undef, | ||
| 4118 | TRUE, | ||
| 4119 | 1, 12, 5, 6); | ||
| 4120 | $checkButton5->set_active($axmud::CLIENT->debugExitFlag); | ||
| 4121 | $checkButton5->signal_connect('toggled' => sub { | ||
| 4122 | |||
| 4123 | $axmud::CLIENT->set_debugFlag('debugExitFlag', $checkButton5->get_active()); | ||
| 4124 | }); | ||
| 4125 | |||
| 4126 | my $checkButton6 = $self->addCheckButton( | ||
| 4127 | $grid, | ||
| 4128 | 'Locator task shows a summary of the number of room statements it\'s expecting', | ||
| 4129 | undef, | ||
| 4130 | TRUE, | ||
| 4131 | 1, 12, 6, 7); | ||
| 4132 | $checkButton6->set_active($axmud::CLIENT->debugMoveListFlag); | ||
| 4133 | $checkButton6->signal_connect('toggled' => sub { | ||
| 4134 | |||
| 4135 | $axmud::CLIENT->set_debugFlag('debugMoveListFlag', $checkButton6->get_active()); | ||
| 4136 | }); | ||
| 4137 | |||
| 4138 | my $checkButton7 = $self->addCheckButton( | ||
| 4139 | $grid, 'Object parsing routines shows debug messages when parsing text', undef, TRUE, | ||
| 4140 | 1, 12, 7, 8); | ||
| 4141 | $checkButton7->set_active($axmud::CLIENT->debugParseObjFlag); | ||
| 4142 | $checkButton7->signal_connect('toggled' => sub { | ||
| 4143 | |||
| 4144 | $axmud::CLIENT->set_debugFlag('debugParseObjFlag', $checkButton7->get_active()); | ||
| 4145 | }); | ||
| 4146 | |||
| 4147 | my $checkButton8 = $self->addCheckButton( | ||
| 4148 | $grid, | ||
| 4149 | 'Object comparison routines shows debug messages when comparing objects', | ||
| 4150 | undef, | ||
| 4151 | TRUE, | ||
| 4152 | 1, 12, 8, 9); | ||
| 4153 | $checkButton8->set_active($axmud::CLIENT->debugCompareObjFlag); | ||
| 4154 | $checkButton8->signal_connect('toggled' => sub { | ||
| 4155 | |||
| 4156 | $axmud::CLIENT->set_debugFlag('debugCompareObjFlag', $checkButton8->get_active()); | ||
| 4157 | }); | ||
| 4158 | |||
| 4159 | my $checkButton9 = $self->addCheckButton( | ||
| 4160 | $grid, | ||
| 4161 | 'Show debug messages when a plugin fails to load, explaining the reason why', | ||
| 4162 | undef, | ||
| 4163 | TRUE, | ||
| 4164 | 1, 12, 9, 10); | ||
| 4165 | $checkButton9->set_active($axmud::CLIENT->debugExplainPluginFlag); | ||
| 4166 | $checkButton9->signal_connect('toggled' => sub { | ||
| 4167 | |||
| 4168 | $axmud::CLIENT->set_debugFlag('debugExplainPluginFlag', $checkButton9->get_active()); | ||
| 4169 | }); | ||
| 4170 | |||
| 4171 | my $checkButton10 = $self->addCheckButton( | ||
| 4172 | $grid, | ||
| 4173 | 'Show debug messages when any code accesses a non-existent property (IV)', | ||
| 4174 | undef, | ||
| 4175 | TRUE, | ||
| 4176 | 1, 12, 10, 11); | ||
| 4177 | $checkButton10->set_active($axmud::CLIENT->debugCheckIVFlag); | ||
| 4178 | $checkButton10->signal_connect('toggled' => sub { | ||
| 4179 | |||
| 4180 | $axmud::CLIENT->set_debugFlag('debugCheckIVFlag', $checkButton10->get_active()); | ||
| 4181 | }); | ||
| 4182 | |||
| 4183 | my $checkButton11 = $self->addCheckButton( | ||
| 4184 | $grid, | ||
| 4185 | 'Show error messages when table objects can\'t be added/resized in their windows', | ||
| 4186 | undef, | ||
| 4187 | TRUE, | ||
| 4188 | 1, 12, 11, 12); | ||
| 4189 | $checkButton11->set_active($axmud::CLIENT->debugTableFitFlag); | ||
| 4190 | $checkButton11->signal_connect('toggled' => sub { | ||
| 4191 | |||
| 4192 | $axmud::CLIENT->set_debugFlag('debugTableFitFlag', $checkButton11->get_active()); | ||
| 4193 | }); | ||
| 4194 | |||
| 4195 | my $checkButton12 = $self->addCheckButton( | ||
| 4196 | $grid, | ||
| 4197 | 'Trap Perl errors/warnings and display them in the \'main\' window', | ||
| 4198 | undef, | ||
| 4199 | TRUE, | ||
| 4200 | 1, 12, 12, 13); | ||
| 4201 | $checkButton12->set_active($axmud::CLIENT->debugTrapErrorFlag); | ||
| 4202 | $checkButton12->signal_connect('toggled' => sub { | ||
| 4203 | |||
| 4204 | $axmud::CLIENT->set_debugFlag('debugTrapErrorFlag', $checkButton12->get_active()); | ||
| 4205 | }); | ||
| 4206 | |||
| 4207 | # Tab complete | ||
| 4208 | return 1; | ||
| 4209 | } | ||
| 4210 | |||
| 4211 | sub settings12Tab { | ||
| 4212 | |||
| 4213 | # Settings12 tab | ||
| 4214 | # | ||
| 4215 | # Expected arguments | ||
| 4216 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 4217 | # | ||
| 4218 | # Return values | ||
| 4219 | # 'undef' on improper arguments | ||
| 4220 | # 1 otherwise | ||
| 4221 | |||
| 4222 | my ($self, $innerNotebook, $check) = @_; | ||
| 4223 | |||
| 4224 | # Check for improper arguments | ||
| 4225 | if (! defined $innerNotebook || defined $check) { | ||
| 4226 | |||
| 4227 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings12Tab', @_); | ||
| 4228 | } | ||
| 4229 | |||
| 4230 | # Tab setup | ||
| 4231 | my $grid = $self->addTab( | ||
| 4232 | $innerNotebook, | ||
| 4233 | 'Page 12', | ||
| 4234 | ['Other flags'], | ||
| 4235 | ); | ||
| 4236 | |||
| 4237 | # Other flags | ||
| 4238 | $self->addLabel($grid, '<b>Other flags</b>', | ||
| 4239 | 0, 12, 0, 1); | ||
| 4240 | |||
| 4241 | my $checkButton = $self->addCheckButton( | ||
| 4242 | $grid, | ||
| 4243 | 'Use \'page up\' / \'page down\' / \'home\' / \'end\' keys to scroll textviews', | ||
| 4244 | undef, | ||
| 4245 | TRUE, | ||
| 4246 | 1, 12, 1, 2); | ||
| 4247 | $checkButton->set_active($axmud::CLIENT->useScrollKeysFlag); | ||
| 4248 | $checkButton->signal_connect('toggled' => sub { | ||
| 4249 | |||
| 4250 | if ( | ||
| 4251 | ($checkButton->get_active && ! $axmud::CLIENT->useScrollKeysFlag) | ||
| 4252 | || (! $checkButton->get_active && $axmud::CLIENT->useScrollKeysFlag) | ||
| 4253 | ) { | ||
| 4254 | $self->session->pseudoCmd('togglewindowkey -s', $self->pseudoCmdMode); | ||
| 4255 | } | ||
| 4256 | }); | ||
| 4257 | |||
| 4258 | my $checkButton2 = $self->addCheckButton( | ||
| 4259 | $grid, | ||
| 4260 | 'When using those keys, don\'t scroll the entire height of the page (smooth scrolling)', | ||
| 4261 | undef, | ||
| 4262 | TRUE, | ||
| 4263 | 1, 12, 2, 3); | ||
| 4264 | $checkButton2->set_active($axmud::CLIENT->smoothScrollKeysFlag); | ||
| 4265 | $checkButton2->signal_connect('toggled' => sub { | ||
| 4266 | |||
| 4267 | if ( | ||
| 4268 | ($checkButton2->get_active && ! $axmud::CLIENT->smoothScrollKeysFlag) | ||
| 4269 | || (! $checkButton2->get_active && $axmud::CLIENT->smoothScrollKeysFlag) | ||
| 4270 | ) { | ||
| 4271 | $self->session->pseudoCmd('togglewindowkey -m', $self->pseudoCmdMode); | ||
| 4272 | } | ||
| 4273 | }); | ||
| 4274 | |||
| 4275 | my $checkButton3 = $self->addCheckButton( | ||
| 4276 | $grid, 'Using those keys auto-engages split screen mode', undef, TRUE, | ||
| 4277 | 1, 12, 3, 4); | ||
| 4278 | $checkButton3->set_active($axmud::CLIENT->autoSplitKeysFlag); | ||
| 4279 | $checkButton3->signal_connect('toggled' => sub { | ||
| 4280 | |||
| 4281 | if ( | ||
| 4282 | ($checkButton3->get_active && ! $axmud::CLIENT->autoSplitKeysFlag) | ||
| 4283 | || (! $checkButton3->get_active && $axmud::CLIENT->autoSplitKeysFlag) | ||
| 4284 | ) { | ||
| 4285 | $self->session->pseudoCmd('togglewindowkey -p', $self->pseudoCmdMode); | ||
| 4286 | } | ||
| 4287 | }); | ||
| 4288 | |||
| 4289 | my $checkButton4 = $self->addCheckButton( | ||
| 4290 | $grid, | ||
| 4291 | 'Use \'tab\' / \'cursor up\' / \'cursor down\' keys to auto-complete commands', | ||
| 4292 | undef, | ||
| 4293 | TRUE, | ||
| 4294 | 1, 12, 4, 5); | ||
| 4295 | $checkButton4->set_active($axmud::CLIENT->useCompleteKeysFlag); | ||
| 4296 | $checkButton4->signal_connect('toggled' => sub { | ||
| 4297 | |||
| 4298 | if ( | ||
| 4299 | ($checkButton4->get_active && ! $axmud::CLIENT->useCompleteKeysFlag) | ||
| 4300 | || (! $checkButton4->get_active && $axmud::CLIENT->useCompleteKeysFlag) | ||
| 4301 | ) { | ||
| 4302 | $self->session->pseudoCmd('togglewindowkey -t', $self->pseudoCmdMode); | ||
| 4303 | } | ||
| 4304 | }); | ||
| 4305 | my $checkButton5 = $self->addCheckButton( | ||
| 4306 | $grid, | ||
| 4307 | 'Use CTRL+TAB keys to switch between tabs in a window pane (or just TAB if there is' | ||
| 4308 | . ' no command entry box)', | ||
| 4309 | undef, | ||
| 4310 | TRUE, | ||
| 4311 | 1, 12, 5, 6); | ||
| 4312 | $checkButton5->set_active($axmud::CLIENT->useSwitchKeysFlag); | ||
| 4313 | $checkButton5->signal_connect('toggled' => sub { | ||
| 4314 | |||
| 4315 | if ( | ||
| 4316 | ($checkButton5->get_active && ! $axmud::CLIENT->useSwitchKeysFlag) | ||
| 4317 | || (! $checkButton5->get_active && $axmud::CLIENT->useSwitchKeysFlag) | ||
| 4318 | ) { | ||
| 4319 | $self->session->pseudoCmd('togglewindowkey -c', $self->pseudoCmdMode); | ||
| 4320 | } | ||
| 4321 | }); | ||
| 4322 | |||
| 4323 | my $checkButton6 = $self->addCheckButton( | ||
| 4324 | $grid, 'Allow system messages to be displayed in \'main\' windows', undef, TRUE, | ||
| 4325 | 1, 12, 6, 7); | ||
| 4326 | $checkButton6->set_active($axmud::CLIENT->mainWinSystemMsgFlag); | ||
| 4327 | $checkButton6->signal_connect('toggled' => sub { | ||
| 4328 | |||
| 4329 | if ( | ||
| 4330 | ($checkButton6->get_active && ! $axmud::CLIENT->mainWinSystemMsgFlag) | ||
| 4331 | || (! $checkButton6->get_active && $axmud::CLIENT->mainWinSystemMsgFlag) | ||
| 4332 | ) { | ||
| 4333 | $self->session->pseudoCmd('togglemainwindow -s', $self->pseudoCmdMode); | ||
| 4334 | } | ||
| 4335 | }); | ||
| 4336 | |||
| 4337 | my $checkButton7 = $self->addCheckButton( | ||
| 4338 | $grid, | ||
| 4339 | 'Set the \'main\' window\'s urgency hint when text is received from the world', | ||
| 4340 | undef, | ||
| 4341 | TRUE, | ||
| 4342 | 1, 12, 7, 8); | ||
| 4343 | $checkButton7->set_active($axmud::CLIENT->mainWinUrgencyFlag); | ||
| 4344 | $checkButton7->signal_connect('toggled' => sub { | ||
| 4345 | |||
| 4346 | if ( | ||
| 4347 | ($checkButton7->get_active && ! $axmud::CLIENT->mainWinUrgencyFlag) | ||
| 4348 | || (! $checkButton7->get_active && $axmud::CLIENT->mainWinUrgencyFlag) | ||
| 4349 | ) { | ||
| 4350 | $self->session->pseudoCmd('togglemainwindow -u', $self->pseudoCmdMode); | ||
| 4351 | } | ||
| 4352 | }); | ||
| 4353 | |||
| 4354 | my $checkButton8 = $self->addCheckButton( | ||
| 4355 | $grid, 'Show tooltips in a session\'s default tab', undef, TRUE, | ||
| 4356 | 1, 12, 8, 9); | ||
| 4357 | $checkButton8->set_active($axmud::CLIENT->mainWinTooltipFlag); | ||
| 4358 | $checkButton8->signal_connect('toggled' => sub { | ||
| 4359 | |||
| 4360 | if ( | ||
| 4361 | ($checkButton8->get_active && ! $axmud::CLIENT->mainWinTooltipFlag) | ||
| 4362 | || (! $checkButton8->get_active && $axmud::CLIENT->mainWinTooltipFlag) | ||
| 4363 | ) { | ||
| 4364 | $self->session->pseudoCmd('togglemainwindow -t', $self->pseudoCmdMode); | ||
| 4365 | } | ||
| 4366 | }); | ||
| 4367 | |||
| 4368 | my $checkButton9 = $self->addCheckButton( | ||
| 4369 | $grid, 'Show toolbar labels in the \'main\'/automapper windows', undef, TRUE, | ||
| 4370 | 1, 12, 9, 10); | ||
| 4371 | $checkButton9->set_active($axmud::CLIENT->toolbarLabelFlag); | ||
| 4372 | $checkButton9->signal_connect('toggled' => sub { | ||
| 4373 | |||
| 4374 | if ( | ||
| 4375 | ($checkButton9->get_active && ! $axmud::CLIENT->toolbarLabelFlag) | ||
| 4376 | || (! $checkButton9->get_active && $axmud::CLIENT->toolbarLabelFlag) | ||
| 4377 | ) { | ||
| 4378 | $self->session->pseudoCmd('togglelabel', $self->pseudoCmdMode); | ||
| 4379 | } | ||
| 4380 | }); | ||
| 4381 | |||
| 4382 | my $checkButton10 = $self->addCheckButton( | ||
| 4383 | $grid, | ||
| 4384 | 'Show irreversible icon in \'edit\' windows for actions that take place immediately', | ||
| 4385 | undef, | ||
| 4386 | TRUE, | ||
| 4387 | 1, 10, 10, 11); | ||
| 4388 | $checkButton10->set_active($axmud::CLIENT->irreversibleIconFlag); | ||
| 4389 | $checkButton10->signal_connect('toggled' => sub { | ||
| 4390 | |||
| 4391 | if ( | ||
| 4392 | ($checkButton10->get_active && ! $axmud::CLIENT->irreversibleIconFlag) | ||
| 4393 | || (! $checkButton10->get_active && $axmud::CLIENT->irreversibleIconFlag) | ||
| 4394 | ) { | ||
| 4395 | $self->session->pseudoCmd('toggleirreversible', $self->pseudoCmdMode); | ||
| 4396 | } | ||
| 4397 | }); | ||
| 4398 | |||
| 4399 | my $button = $self->addButton($grid, | ||
| 4400 | 'Test icons', 'Test irreversible icons', undef, | ||
| 4401 | 10, 12, 10, 11); | ||
| 4402 | $button->signal_connect('clicked' => sub { | ||
| 4403 | |||
| 4404 | $self->session->pseudoCmd('toggleirreversible -t', $self->pseudoCmdMode); | ||
| 4405 | }); | ||
| 4406 | |||
| 4407 | my $checkButton11 = $self->addCheckButton( | ||
| 4408 | $grid, | ||
| 4409 | 'Show popup windows during long operations (loading large files, drawing large maps' | ||
| 4410 | . ' etc)', | ||
| 4411 | undef, | ||
| 4412 | TRUE, | ||
| 4413 | 1, 12, 11, 12); | ||
| 4414 | $checkButton11->set_active($axmud::CLIENT->allowBusyWinFlag); | ||
| 4415 | $checkButton11->signal_connect('toggled' => sub { | ||
| 4416 | |||
| 4417 | if ( | ||
| 4418 | ($checkButton11->get_active && ! $axmud::CLIENT->allowBusyWinFlag) | ||
| 4419 | || (! $checkButton11->get_active && $axmud::CLIENT->allowBusyWinFlag) | ||
| 4420 | ) { | ||
| 4421 | $self->session->pseudoCmd('togglepopup', $self->pseudoCmdMode); | ||
| 4422 | } | ||
| 4423 | }); | ||
| 4424 | |||
| 4425 | my $checkButton12 = $self->addCheckButton( | ||
| 4426 | $grid, 'Collect connection histories for each world', undef, TRUE, | ||
| 4427 | 1, 12, 12, 13); | ||
| 4428 | $checkButton12->set_active($axmud::CLIENT->connectHistoryFlag); | ||
| 4429 | $checkButton12->signal_connect('toggled' => sub { | ||
| 4430 | |||
| 4431 | if ( | ||
| 4432 | ($checkButton12->get_active && ! $axmud::CLIENT->connectHistoryFlag) | ||
| 4433 | || (! $checkButton12->get_active && $axmud::CLIENT->connectHistoryFlag) | ||
| 4434 | ) { | ||
| 4435 | $self->session->pseudoCmd('togglehistory', $self->pseudoCmdMode); | ||
| 4436 | } | ||
| 4437 | }); | ||
| 4438 | |||
| 4439 | # Tab complete | ||
| 4440 | return 1; | ||
| 4441 | } | ||
| 4442 | |||
| 4443 | sub settings13Tab { | ||
| 4444 | |||
| 4445 | # Settings13 tab | ||
| 4446 | # | ||
| 4447 | # Expected arguments | ||
| 4448 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 4449 | # | ||
| 4450 | # Return values | ||
| 4451 | # 'undef' on improper arguments | ||
| 4452 | # 1 otherwise | ||
| 4453 | |||
| 4454 | my ($self, $innerNotebook, $check) = @_; | ||
| 4455 | |||
| 4456 | # Local variables | ||
| 4457 | my (@columnList, @columnList2); | ||
| 4458 | |||
| 4459 | # Check for improper arguments | ||
| 4460 | if (! defined $innerNotebook || defined $check) { | ||
| 4461 | |||
| 4462 | return $axmud::CLIENT->writeImproper($self->_objClass . '->settings13Tab', @_); | ||
| 4463 | } | ||
| 4464 | |||
| 4465 | # Tab setup | ||
| 4466 | my $grid = $self->addTab( | ||
| 4467 | $innerNotebook, | ||
| 4468 | 'Page 13', | ||
| 4469 | ['Custom months/days'], | ||
| 4470 | ); | ||
| 4471 | |||
| 4472 | # Custom months/days | ||
| 4473 | $self->addLabel($grid, '<b>Custom months/days</b>', | ||
| 4474 | 0, 12, 0, 1); | ||
| 4475 | $self->addLabel($grid, | ||
| 4476 | '<i>List of months of the year and days of the week</i>', | ||
| 4477 | 1, 12, 1, 2); | ||
| 4478 | |||
| 4479 | # Add simple lists | ||
| 4480 | @columnList = ( | ||
| 4481 | 'Month', 'text', | ||
| 4482 | ); | ||
| 4483 | |||
| 4484 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 4485 | 1, 6, 2, 8); | ||
| 4486 | |||
| 4487 | @columnList2 = ( | ||
| 4488 | 'Day', 'text', | ||
| 4489 | ); | ||
| 4490 | |||
| 4491 | my $slWidget2 = $self->addSimpleList($grid, undef, \@columnList, | ||
| 4492 | 7, 12, 2, 8); | ||
| 4493 | |||
| 4494 | # Initialise the lists | ||
| 4495 | $self->settings13Tab_refreshList($slWidget, $slWidget2); | ||
| 4496 | |||
| 4497 | # Add editing widgets | ||
| 4498 | $self->addLabel($grid, 'New list of custom months <i>e.g. Gen Feb Mar...</i>', | ||
| 4499 | 1, 6, 8, 9); | ||
| 4500 | my $entry = $self->addEntry($grid, undef, TRUE, | ||
| 4501 | 1, 6, 9, 10); | ||
| 4502 | my $button = $self->addButton($grid, | ||
| 4503 | 'Set', 'Set the list of custom months', undef, | ||
| 4504 | 1, 3, 10, 11); | ||
| 4505 | my $button2 = $self->addButton($grid, | ||
| 4506 | 'Reset', 'Reset the list of custom months', undef, | ||
| 4507 | 3, 6, 10, 11); | ||
| 4508 | |||
| 4509 | $self->addLabel($grid, 'New list of custom days <i>e.g. Lun Mar Mer...</i>', | ||
| 4510 | 7, 12, 8, 9); | ||
| 4511 | my $entry2 = $self->addEntry($grid, undef, TRUE, | ||
| 4512 | 7, 12, 9, 10); | ||
| 4513 | my $button3 = $self->addButton($grid, | ||
| 4514 | 'Set', 'Set the list of custom days', undef, | ||
| 4515 | 7, 9, 10, 11); | ||
| 4516 | my $button4 = $self->addButton($grid, | ||
| 4517 | 'Reset', 'Reset the list of custom days', undef, | ||
| 4518 | 9, 12, 10, 11); | ||
| 4519 | |||
| 4520 | # (->signal_connects from above) | ||
| 4521 | $button->signal_connect('clicked' => sub { | ||
| 4522 | |||
| 4523 | my $string = $entry->get_text(); | ||
| 4524 | |||
| 4525 | if ($string ne '') { | ||
| 4526 | |||
| 4527 | $self->session->pseudoCmd('setcustommonth ' . $string, $self->pseudoCmdMode); | ||
| 4528 | |||
| 4529 | # Refresh the lists and reset the entries | ||
| 4530 | $self->settings13Tab_refreshList($slWidget, $slWidget2); | ||
| 4531 | $self->resetEntryBoxes($entry, $entry2); | ||
| 4532 | } | ||
| 4533 | }); | ||
| 4534 | $button2->signal_connect('clicked' => sub { | ||
| 4535 | |||
| 4536 | $self->session->pseudoCmd('setcustommonth -r', $self->pseudoCmdMode); | ||
| 4537 | |||
| 4538 | # Refresh the lists and reset the entries | ||
| 4539 | $self->settings13Tab_refreshList($slWidget, $slWidget2); | ||
| 4540 | $self->resetEntryBoxes($entry, $entry2); | ||
| 4541 | }); | ||
| 4542 | $button3->signal_connect('clicked' => sub { | ||
| 4543 | |||
| 4544 | my $string = $entry2->get_text(); | ||
| 4545 | |||
| 4546 | if ($string ne '') { | ||
| 4547 | |||
| 4548 | $self->session->pseudoCmd('setcustomday ' . $string, $self->pseudoCmdMode); | ||
| 4549 | |||
| 4550 | # Refresh the lists and reset the entries | ||
| 4551 | $self->settings13Tab_refreshList($slWidget, $slWidget2); | ||
| 4552 | $self->resetEntryBoxes($entry, $entry2); | ||
| 4553 | } | ||
| 4554 | }); | ||
| 4555 | $button4->signal_connect('clicked' => sub { | ||
| 4556 | |||
| 4557 | $self->session->pseudoCmd('setcustomday -r', $self->pseudoCmdMode); | ||
| 4558 | |||
| 4559 | # Refresh the lists and reset the entries | ||
| 4560 | $self->settings13Tab_refreshList($slWidget, $slWidget2); | ||
| 4561 | $self->resetEntryBoxes($entry, $entry2); | ||
| 4562 | }); | ||
| 4563 | |||
| 4564 | # Tab complete | ||
| 4565 | return 1; | ||
| 4566 | } | ||
| 4567 | |||
| 4568 | sub settings13Tab_refreshList { | ||
| 4569 | |||
| 4570 | # Resets the simple lists displayed by $self->settings13Tab | ||
| 4571 | # | ||
| 4572 | # Expected arguments | ||
| 4573 | # $slWidget, $slWidget2 | ||
| 4574 | # - The GA::Obj::SimpleLists to reset | ||
| 4575 | # | ||
| 4576 | # Return values | ||
| 4577 | # 'undef' on improper arguments | ||
| 4578 | # 1 otherwise | ||
| 4579 | |||
| 4580 | my ($self, $slWidget, $slWidget2, $check) = @_; | ||
| 4581 | |||
| 4582 | # Check for improper arguments | ||
| 4583 | if (! defined $slWidget || ! defined $slWidget2 || defined $check) { | ||
| 4584 | |||
| 4585 | return $axmud::CLIENT->writeImproper( | ||
| 4586 | $self->_objClass . '->settings13Tab_refreshList', | ||
| 4587 | @_, | ||
| 4588 | ); | ||
| 4589 | } | ||
| 4590 | |||
| 4591 | # Reset the simple list | ||
| 4592 | $self->resetListData($slWidget, [$axmud::CLIENT->customMonthList], 1); | ||
| 4593 | $self->resetListData($slWidget2, [$axmud::CLIENT->customDayList], 1); | ||
| 4594 | |||
| 4595 | return 1; | ||
| 4596 | } | ||
| 4597 | |||
| 4598 | sub pluginsTab { | ||
| 4599 | |||
| 4600 | # Plugins tab - called by $self->setupNotebook | ||
| 4601 | # | ||
| 4602 | # Expected arguments | ||
| 4603 | # (none besides $self) | ||
| 4604 | # | ||
| 4605 | # Return values | ||
| 4606 | # 'undef' on improper arguments | ||
| 4607 | # 1 otherwise | ||
| 4608 | |||
| 4609 | my ($self, $check) = @_; | ||
| 4610 | |||
| 4611 | # Check for improper arguments | ||
| 4612 | if (defined $check) { | ||
| 4613 | |||
| 4614 | return $axmud::CLIENT->writeImproper($self->_objClass . '->pluginsTab', @_); | ||
| 4615 | } | ||
| 4616 | |||
| 4617 | # Tab setup | ||
| 4618 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 4619 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Plugins'); | ||
| 4620 | |||
| 4621 | # Add tabs to the inner notebook | ||
| 4622 | $self->plugins1Tab($innerNotebook); | ||
| 4623 | $self->plugins2Tab($innerNotebook); | ||
| 4624 | $self->plugins3Tab($innerNotebook); | ||
| 4625 | $self->plugins4Tab($innerNotebook); | ||
| 4626 | $self->plugins5Tab($innerNotebook); | ||
| 4627 | $self->plugins6Tab($innerNotebook); | ||
| 4628 | $self->plugins7Tab($innerNotebook); | ||
| 4629 | $self->plugins8Tab($innerNotebook); | ||
| 4630 | $self->plugins9Tab($innerNotebook); | ||
| 4631 | |||
| 4632 | return 1; | ||
| 4633 | } | ||
| 4634 | |||
| 4635 | sub plugins1Tab { | ||
| 4636 | |||
| 4637 | # Plugins1 tab | ||
| 4638 | # | ||
| 4639 | # Expected arguments | ||
| 4640 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 4641 | # | ||
| 4642 | # Return values | ||
| 4643 | # 'undef' on improper arguments | ||
| 4644 | # 1 otherwise | ||
| 4645 | |||
| 4646 | my ($self, $innerNotebook, $check) = @_; | ||
| 4647 | |||
| 4648 | # Local variables | ||
| 4649 | my @columnList; | ||
| 4650 | |||
| 4651 | # Check for improper arguments | ||
| 4652 | if (! defined $innerNotebook || defined $check) { | ||
| 4653 | |||
| 4654 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins1Tab', @_); | ||
| 4655 | } | ||
| 4656 | |||
| 4657 | # Tab setup | ||
| 4658 | my $grid = $self->addTab( | ||
| 4659 | $innerNotebook, | ||
| 4660 | 'Page _1', | ||
| 4661 | ['Loaded plugins'], | ||
| 4662 | ); | ||
| 4663 | |||
| 4664 | # Loaded plugins | ||
| 4665 | $self->addLabel($grid, '<b>Loaded plugins</b>', | ||
| 4666 | 0, 12, 0, 1); | ||
| 4667 | $self->addLabel($grid, | ||
| 4668 | '<i>List of ' . $axmud::SCRIPT . ' plugins currently loaded (session-independent)</i>', | ||
| 4669 | 1, 12, 1, 2); | ||
| 4670 | |||
| 4671 | # Add a simple list | ||
| 4672 | @columnList = ( | ||
| 4673 | 'Plugin', 'text', | ||
| 4674 | 'Enabled', 'bool_editable', | ||
| 4675 | 'File path', 'text', | ||
| 4676 | 'Version', 'text', | ||
| 4677 | 'Requires', 'text', | ||
| 4678 | 'Description', 'text', | ||
| 4679 | 'Author', 'text', | ||
| 4680 | 'Copyright', 'text', | ||
| 4681 | 'Initial status', 'text', | ||
| 4682 | ); | ||
| 4683 | |||
| 4684 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 4685 | 1, 12, 2, 11, | ||
| 4686 | -1, -1, | ||
| 4687 | $self->getMethodRef('plugins1Tab_buttonToggled'), | ||
| 4688 | ); | ||
| 4689 | |||
| 4690 | # Initialise the simple list | ||
| 4691 | $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4692 | |||
| 4693 | # Add buttons | ||
| 4694 | my $button = $self->addButton($grid, | ||
| 4695 | 'Test', 'Test a ' . $axmud::SCRIPT . ' plugin that hasn\'t been loaded', undef, | ||
| 4696 | 1, 3, 11, 12); | ||
| 4697 | $button->signal_connect('clicked' => sub { | ||
| 4698 | |||
| 4699 | my ($plugin, $pluginObj); | ||
| 4700 | |||
| 4701 | ($plugin) = $self->getSimpleListData($slWidget, 0); | ||
| 4702 | if (defined $plugin) { | ||
| 4703 | |||
| 4704 | # Test this plugin | ||
| 4705 | $pluginObj = $axmud::CLIENT->ivShow('pluginHash', $plugin); | ||
| 4706 | $self->session->pseudoCmd( | ||
| 4707 | 'testplugin ' . $pluginObj->filePath, | ||
| 4708 | $self->pseudoCmdMode, | ||
| 4709 | ); | ||
| 4710 | |||
| 4711 | } else { | ||
| 4712 | |||
| 4713 | # Prompt the user for a plugin to test | ||
| 4714 | $self->session->pseudoCmd('testplugin', $self->pseudoCmdMode); | ||
| 4715 | } | ||
| 4716 | |||
| 4717 | # Refresh the simple list | ||
| 4718 | $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4719 | }); | ||
| 4720 | |||
| 4721 | my $button2 = $self->addButton($grid, | ||
| 4722 | 'Load standard plugin', 'Load a new ' . $axmud::SCRIPT . ' standard plugin', undef, | ||
| 4723 | 3, 6, 11, 12); | ||
| 4724 | $button2->signal_connect('clicked' => sub { | ||
| 4725 | |||
| 4726 | # Disable this plugin | ||
| 4727 | $self->session->pseudoCmd('loadplugin -s', $self->pseudoCmdMode); | ||
| 4728 | |||
| 4729 | # Refresh the simple list | ||
| 4730 | $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4731 | }); | ||
| 4732 | |||
| 4733 | my $button3 = $self->addButton($grid, | ||
| 4734 | 'Load custom plugin', 'Load a new ' . $axmud::SCRIPT . ' custom plugin', undef, | ||
| 4735 | 6, 9, 11, 12); | ||
| 4736 | $button3->signal_connect('clicked' => sub { | ||
| 4737 | |||
| 4738 | # Disable this plugin | ||
| 4739 | $self->session->pseudoCmd('loadplugin', $self->pseudoCmdMode); | ||
| 4740 | |||
| 4741 | # Refresh the simple list | ||
| 4742 | $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4743 | }); | ||
| 4744 | |||
| 4745 | my $button4 = $self->addButton($grid, | ||
| 4746 | 'Refresh list', 'Refresh the list of loaded plugins', undef, | ||
| 4747 | 9, 12, 11, 12); | ||
| 4748 | $button4->signal_connect('clicked' => sub { | ||
| 4749 | |||
| 4750 | # Refresh the simple list | ||
| 4751 | $self->plugins1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4752 | }); | ||
| 4753 | |||
| 4754 | # Tab complete | ||
| 4755 | return 1; | ||
| 4756 | } | ||
| 4757 | |||
| 4758 | sub plugins1Tab_refreshList { | ||
| 4759 | |||
| 4760 | # Resets the simple list displayed by $self->plugins1Tab | ||
| 4761 | # | ||
| 4762 | # Expected arguments | ||
| 4763 | # $slWidget - The GA::Obj::SimpleList | ||
| 4764 | # $columns - The number of columns | ||
| 4765 | # | ||
| 4766 | # Return values | ||
| 4767 | # 'undef' on improper arguments | ||
| 4768 | # 1 otherwise | ||
| 4769 | |||
| 4770 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 4771 | |||
| 4772 | # Local variables | ||
| 4773 | my (@pluginList, @dataList); | ||
| 4774 | |||
| 4775 | # Check for improper arguments | ||
| 4776 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 4777 | |||
| 4778 | return $axmud::CLIENT->writeImproper( | ||
| 4779 | $self->_objClass . '->plugins1Tab_refreshList', | ||
| 4780 | @_, | ||
| 4781 | ); | ||
| 4782 | } | ||
| 4783 | |||
| 4784 | # Import the list of plugins | ||
| 4785 | @pluginList = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('pluginHash')); | ||
| 4786 | |||
| 4787 | # Compile the simple list data | ||
| 4788 | foreach my $obj (@pluginList) { | ||
| 4789 | |||
| 4790 | my ($descrip, $author, $copyright); | ||
| 4791 | |||
| 4792 | if ($obj->descrip) { | ||
| 4793 | |||
| 4794 | # (Can't do a substr() operation on an 'undef' value) | ||
| 4795 | if (length ($obj->descrip) > 64) { | ||
| 4796 | $descrip = substr($obj->descrip, 0, 64) . '...'; | ||
| 4797 | } else { | ||
| 4798 | $descrip = $obj->descrip; | ||
| 4799 | } | ||
| 4800 | } | ||
| 4801 | |||
| 4802 | if ($obj->author) { | ||
| 4803 | |||
| 4804 | if (length ($obj->author) > 64) { | ||
| 4805 | $author = substr($obj->author, 0, 64) . '...'; | ||
| 4806 | } else { | ||
| 4807 | $author = $obj->author; | ||
| 4808 | } | ||
| 4809 | } | ||
| 4810 | |||
| 4811 | if ($obj->copyright) { | ||
| 4812 | |||
| 4813 | if (length ($obj->copyright) > 64) { | ||
| 4814 | $copyright = substr($obj->copyright, 0, 64) . '...'; | ||
| 4815 | } else { | ||
| 4816 | $copyright = $obj->copyright; | ||
| 4817 | } | ||
| 4818 | } | ||
| 4819 | |||
| 4820 | push (@dataList, | ||
| 4821 | $obj->name, | ||
| 4822 | $obj->enabledFlag, | ||
| 4823 | $obj->filePath, | ||
| 4824 | $obj->version, | ||
| 4825 | $obj->require, | ||
| 4826 | $descrip, | ||
| 4827 | $author, | ||
| 4828 | $copyright, | ||
| 4829 | $obj->init, | ||
| 4830 | ); | ||
| 4831 | } | ||
| 4832 | |||
| 4833 | # Reset the simple list | ||
| 4834 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 4835 | |||
| 4836 | return 1; | ||
| 4837 | } | ||
| 4838 | |||
| 4839 | sub plugins1Tab_buttonToggled { | ||
| 4840 | |||
| 4841 | # Callback from GA::Generic::EditWin->addSimpleList | ||
| 4842 | # | ||
| 4843 | # Expected arguments | ||
| 4844 | # $slWidget - The GA::Obj::SimpleList | ||
| 4845 | # $model - The Gtk3::ListStore | ||
| 4846 | # $iter - The Gtk3::TreeIter of the line clicked | ||
| 4847 | # @data - Data for all the cells on that line | ||
| 4848 | # | ||
| 4849 | # Return values | ||
| 4850 | # 'undef' on improper arguments | ||
| 4851 | # 1 otherwise | ||
| 4852 | |||
| 4853 | my ($self, $slWidget, $model, $iter, @dataList) = @_; | ||
| 4854 | |||
| 4855 | # Local variables | ||
| 4856 | my ($pluginName, $flag, $pluginObj); | ||
| 4857 | |||
| 4858 | # Check for improper arguments | ||
| 4859 | if (! defined $slWidget || ! defined $model || ! defined $iter) { | ||
| 4860 | |||
| 4861 | return $axmud::CLIENT->writeImproper( | ||
| 4862 | $self->_objClass . '->plugins1Tab_buttonToggled', | ||
| 4863 | @_, | ||
| 4864 | ); | ||
| 4865 | } | ||
| 4866 | |||
| 4867 | # Update IVs | ||
| 4868 | $pluginName = $dataList[0]; | ||
| 4869 | $flag = $dataList[1]; | ||
| 4870 | |||
| 4871 | $pluginObj = $axmud::CLIENT->ivShow('pluginHash', $pluginName); | ||
| 4872 | if (! $pluginObj) { | ||
| 4873 | |||
| 4874 | # Failsafe | ||
| 4875 | return undef; | ||
| 4876 | } | ||
| 4877 | |||
| 4878 | if (! $pluginObj->enabledFlag && $flag) { | ||
| 4879 | $self->session->pseudoCmd('enableplugin ' . $pluginName, $self->pseudoCmdMode); | ||
| 4880 | } elsif ($pluginObj->enabledFlag && ! $flag) { | ||
| 4881 | $self->session->pseudoCmd('disableplugin ' . $pluginName, $self->pseudoCmdMode); | ||
| 4882 | } | ||
| 4883 | |||
| 4884 | return 1; | ||
| 4885 | } | ||
| 4886 | |||
| 4887 | sub plugins2Tab { | ||
| 4888 | |||
| 4889 | # Plugins2 tab | ||
| 4890 | # | ||
| 4891 | # Expected arguments | ||
| 4892 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 4893 | # | ||
| 4894 | # Return values | ||
| 4895 | # 'undef' on improper arguments | ||
| 4896 | # 1 otherwise | ||
| 4897 | |||
| 4898 | my ($self, $innerNotebook, $check) = @_; | ||
| 4899 | |||
| 4900 | # Local variables | ||
| 4901 | my @columnList; | ||
| 4902 | |||
| 4903 | # Check for improper arguments | ||
| 4904 | if (! defined $innerNotebook || defined $check) { | ||
| 4905 | |||
| 4906 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins2Tab', @_); | ||
| 4907 | } | ||
| 4908 | |||
| 4909 | # Tab setup | ||
| 4910 | my $grid = $self->addTab( | ||
| 4911 | $innerNotebook, | ||
| 4912 | 'Page _2', | ||
| 4913 | ['Initial plugins'], | ||
| 4914 | ); | ||
| 4915 | |||
| 4916 | # Initial plugins | ||
| 4917 | $self->addLabel($grid, '<b>Initial plugins</b>', | ||
| 4918 | 0, 12, 0, 1); | ||
| 4919 | $self->addLabel($grid, | ||
| 4920 | '<i>List of ' . $axmud::SCRIPT . ' plugins loaded at startup (session-independent)</i>', | ||
| 4921 | 1, 12, 1, 2); | ||
| 4922 | |||
| 4923 | # Add a simple list | ||
| 4924 | @columnList = ( | ||
| 4925 | '#', 'int', | ||
| 4926 | 'Plugin file', 'text', | ||
| 4927 | ); | ||
| 4928 | |||
| 4929 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 4930 | 1, 12, 2, 10); | ||
| 4931 | |||
| 4932 | # Initialise the simple list | ||
| 4933 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4934 | |||
| 4935 | # Add buttons | ||
| 4936 | my $button = $self->addButton($grid, | ||
| 4937 | 'Add standard', 'Add a new standard initial plugin', undef, | ||
| 4938 | 1, 3, 10, 11); | ||
| 4939 | $button->signal_connect('clicked' => sub { | ||
| 4940 | |||
| 4941 | # Add a new initial plugin | ||
| 4942 | $self->session->pseudoCmd('addinitialplugin -s', $self->pseudoCmdMode); | ||
| 4943 | |||
| 4944 | # Refresh the simple list | ||
| 4945 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4946 | }); | ||
| 4947 | |||
| 4948 | my $button2 = $self->addButton($grid, | ||
| 4949 | 'Add custom', 'Add a new custom initial plugin', undef, | ||
| 4950 | 3, 5, 10, 11); | ||
| 4951 | $button2->signal_connect('clicked' => sub { | ||
| 4952 | |||
| 4953 | # Add a new initial plugin | ||
| 4954 | $self->session->pseudoCmd('addinitialplugin', $self->pseudoCmdMode); | ||
| 4955 | |||
| 4956 | # Refresh the simple list | ||
| 4957 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4958 | }); | ||
| 4959 | |||
| 4960 | my $button3 = $self->addButton($grid, | ||
| 4961 | 'Delete', 'Delete the selected initial plugin', undef, | ||
| 4962 | 5, 7, 10, 11); | ||
| 4963 | $button3->signal_connect('clicked' => sub { | ||
| 4964 | |||
| 4965 | my ($plugin) = $self->getSimpleListData($slWidget, 1); | ||
| 4966 | if (defined $plugin) { | ||
| 4967 | |||
| 4968 | # Delete the initial plugin | ||
| 4969 | $self->session->pseudoCmd('deleteinitialplugin ' . $plugin, $self->pseudoCmdMode); | ||
| 4970 | |||
| 4971 | # Refresh the simple list | ||
| 4972 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4973 | } | ||
| 4974 | }); | ||
| 4975 | |||
| 4976 | my $button4 = $self->addButton($grid, | ||
| 4977 | 'Test', 'Test the selected initial plugin', undef, | ||
| 4978 | 7, 9, 10, 11); | ||
| 4979 | $button4->signal_connect('clicked' => sub { | ||
| 4980 | |||
| 4981 | my ($plugin) = $self->getSimpleListData($slWidget, 1); | ||
| 4982 | if (defined $plugin) { | ||
| 4983 | |||
| 4984 | # Delete the initial plugin | ||
| 4985 | $self->session->pseudoCmd('testplugin ' . $plugin, $self->pseudoCmdMode); | ||
| 4986 | |||
| 4987 | # Refresh the simple list | ||
| 4988 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4989 | } | ||
| 4990 | }); | ||
| 4991 | |||
| 4992 | my $button5 = $self->addButton($grid, | ||
| 4993 | 'Refresh list', 'Refresh the list of initial plugins', undef, | ||
| 4994 | 10, 12, 10, 11); | ||
| 4995 | $button5->signal_connect('clicked' => sub { | ||
| 4996 | |||
| 4997 | # Refresh the simple list | ||
| 4998 | $self->plugins2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 4999 | }); | ||
| 5000 | |||
| 5001 | # Tab complete | ||
| 5002 | return 1; | ||
| 5003 | } | ||
| 5004 | |||
| 5005 | sub plugins2Tab_refreshList { | ||
| 5006 | |||
| 5007 | # Resets the simple list displayed by $self->plugins2Tab | ||
| 5008 | # | ||
| 5009 | # Expected arguments | ||
| 5010 | # $slWidget - The GA::Obj::SimpleList | ||
| 5011 | # $columns - The number of columns | ||
| 5012 | # | ||
| 5013 | # Return values | ||
| 5014 | # 'undef' on improper arguments | ||
| 5015 | # 1 otherwise | ||
| 5016 | |||
| 5017 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5018 | |||
| 5019 | # Local variables | ||
| 5020 | my ( | ||
| 5021 | $count, | ||
| 5022 | @dataList, | ||
| 5023 | ); | ||
| 5024 | |||
| 5025 | # Check for improper arguments | ||
| 5026 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5027 | |||
| 5028 | return $axmud::CLIENT->writeImproper( | ||
| 5029 | $self->_objClass . '->plugins2Tab_refreshList', | ||
| 5030 | @_, | ||
| 5031 | ); | ||
| 5032 | } | ||
| 5033 | |||
| 5034 | # Compile the simple list data | ||
| 5035 | $count = 0; | ||
| 5036 | foreach my $path ($axmud::CLIENT->initPluginList) { | ||
| 5037 | |||
| 5038 | $count++; | ||
| 5039 | |||
| 5040 | push (@dataList, $count, $path); | ||
| 5041 | } | ||
| 5042 | |||
| 5043 | # Reset the simple list | ||
| 5044 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5045 | |||
| 5046 | return 1; | ||
| 5047 | } | ||
| 5048 | |||
| 5049 | sub plugins3Tab { | ||
| 5050 | |||
| 5051 | # Plugins3 tab | ||
| 5052 | # | ||
| 5053 | # Expected arguments | ||
| 5054 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5055 | # | ||
| 5056 | # Return values | ||
| 5057 | # 'undef' on improper arguments | ||
| 5058 | # 1 otherwise | ||
| 5059 | |||
| 5060 | my ($self, $innerNotebook, $check) = @_; | ||
| 5061 | |||
| 5062 | # Local variables | ||
| 5063 | my @columnList; | ||
| 5064 | |||
| 5065 | # Check for improper arguments | ||
| 5066 | if (! defined $innerNotebook || defined $check) { | ||
| 5067 | |||
| 5068 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins3Tab', @_); | ||
| 5069 | } | ||
| 5070 | |||
| 5071 | # Tab setup | ||
| 5072 | my $grid = $self->addTab( | ||
| 5073 | $innerNotebook, | ||
| 5074 | 'Page _3', | ||
| 5075 | ['Plugin client commands'], | ||
| 5076 | ); | ||
| 5077 | |||
| 5078 | # Plugin client commands | ||
| 5079 | $self->addLabel($grid, '<b>Plugin client commands</b>', | ||
| 5080 | 0, 12, 0, 1); | ||
| 5081 | $self->addLabel($grid, | ||
| 5082 | '<i>List of client commands added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5083 | 1, 12, 1, 2); | ||
| 5084 | |||
| 5085 | # Add a simple list | ||
| 5086 | @columnList = ( | ||
| 5087 | 'Command', 'text', | ||
| 5088 | 'Plugin', 'text', | ||
| 5089 | ); | ||
| 5090 | |||
| 5091 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5092 | 1, 12, 2, 10); | ||
| 5093 | |||
| 5094 | # Initialise the simple list | ||
| 5095 | $self->plugins3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5096 | |||
| 5097 | # Add buttons | ||
| 5098 | my $button = $self->addButton($grid, | ||
| 5099 | 'Refresh list', 'Refresh the list of client commands', undef, | ||
| 5100 | 10, 12, 10, 11); | ||
| 5101 | $button->signal_connect('clicked' => sub { | ||
| 5102 | |||
| 5103 | # Refresh the simple list | ||
| 5104 | $self->plugins3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5105 | }); | ||
| 5106 | |||
| 5107 | # Tab complete | ||
| 5108 | return 1; | ||
| 5109 | } | ||
| 5110 | |||
| 5111 | sub plugins3Tab_refreshList { | ||
| 5112 | |||
| 5113 | # Resets the simple list displayed by $self->plugins3Tab | ||
| 5114 | # | ||
| 5115 | # Expected arguments | ||
| 5116 | # $slWidget - The GA::Obj::SimpleList | ||
| 5117 | # $columns - The number of columns | ||
| 5118 | # | ||
| 5119 | # Return values | ||
| 5120 | # 'undef' on improper arguments | ||
| 5121 | # 1 otherwise | ||
| 5122 | |||
| 5123 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5124 | |||
| 5125 | # Local variables | ||
| 5126 | my ( | ||
| 5127 | @cmdList, @dataList, | ||
| 5128 | %cmdHash, | ||
| 5129 | ); | ||
| 5130 | |||
| 5131 | # Check for improper arguments | ||
| 5132 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5133 | |||
| 5134 | return $axmud::CLIENT->writeImproper( | ||
| 5135 | $self->_objClass . '->plugins3Tab_refreshList', | ||
| 5136 | @_, | ||
| 5137 | ); | ||
| 5138 | } | ||
| 5139 | |||
| 5140 | # Import the list of commands | ||
| 5141 | %cmdHash = $axmud::CLIENT->pluginCmdHash; | ||
| 5142 | @cmdList = sort {lc($a) cmp lc($b)} (keys %cmdHash); | ||
| 5143 | |||
| 5144 | # Compile the simple list data | ||
| 5145 | foreach my $cmd (@cmdList) { | ||
| 5146 | |||
| 5147 | push (@dataList, $cmd, $cmdHash{$cmd}); | ||
| 5148 | } | ||
| 5149 | |||
| 5150 | # Reset the simple list | ||
| 5151 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5152 | |||
| 5153 | return 1; | ||
| 5154 | } | ||
| 5155 | |||
| 5156 | sub plugins4Tab { | ||
| 5157 | |||
| 5158 | # Plugins4 tab | ||
| 5159 | # | ||
| 5160 | # Expected arguments | ||
| 5161 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5162 | # | ||
| 5163 | # Return values | ||
| 5164 | # 'undef' on improper arguments | ||
| 5165 | # 1 otherwise | ||
| 5166 | |||
| 5167 | my ($self, $innerNotebook, $check) = @_; | ||
| 5168 | |||
| 5169 | # Local variables | ||
| 5170 | my @columnList; | ||
| 5171 | |||
| 5172 | # Check for improper arguments | ||
| 5173 | if (! defined $innerNotebook || defined $check) { | ||
| 5174 | |||
| 5175 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins4Tab', @_); | ||
| 5176 | } | ||
| 5177 | |||
| 5178 | # Tab setup | ||
| 5179 | my $grid = $self->addTab( | ||
| 5180 | $innerNotebook, | ||
| 5181 | 'Page _4', | ||
| 5182 | ['Plugin tasks'], | ||
| 5183 | ); | ||
| 5184 | |||
| 5185 | # Plugin tasks | ||
| 5186 | $self->addLabel($grid, '<b>Plugin tasks</b>', | ||
| 5187 | 0, 12, 0, 1); | ||
| 5188 | $self->addLabel($grid, | ||
| 5189 | '<i>List of client tasks added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5190 | 1, 12, 1, 2); | ||
| 5191 | |||
| 5192 | # Add a simple list | ||
| 5193 | @columnList = ( | ||
| 5194 | 'Task', 'text', | ||
| 5195 | 'Plugin', 'text', | ||
| 5196 | ); | ||
| 5197 | |||
| 5198 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5199 | 1, 12, 2, 10); | ||
| 5200 | |||
| 5201 | # Initialise the simple list | ||
| 5202 | $self->plugins4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5203 | |||
| 5204 | # Add buttons | ||
| 5205 | my $button = $self->addButton($grid, | ||
| 5206 | 'Refresh list', 'Refresh the list of tasks', undef, | ||
| 5207 | 10, 12, 10, 11); | ||
| 5208 | $button->signal_connect('clicked' => sub { | ||
| 5209 | |||
| 5210 | # Refresh the simple list | ||
| 5211 | $self->plugins4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5212 | }); | ||
| 5213 | |||
| 5214 | # Tab complete | ||
| 5215 | return 1; | ||
| 5216 | } | ||
| 5217 | |||
| 5218 | sub plugins4Tab_refreshList { | ||
| 5219 | |||
| 5220 | # Resets the simple list displayed by $self->plugins4Tab | ||
| 5221 | # | ||
| 5222 | # Expected arguments | ||
| 5223 | # $slWidget - The GA::Obj::SimpleList | ||
| 5224 | # $columns - The number of columns | ||
| 5225 | # | ||
| 5226 | # Return values | ||
| 5227 | # 'undef' on improper arguments | ||
| 5228 | # 1 otherwise | ||
| 5229 | |||
| 5230 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5231 | |||
| 5232 | # Local variables | ||
| 5233 | my ( | ||
| 5234 | @taskList, @dataList, | ||
| 5235 | %taskHash, | ||
| 5236 | ); | ||
| 5237 | |||
| 5238 | # Check for improper arguments | ||
| 5239 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5240 | |||
| 5241 | return $axmud::CLIENT->writeImproper( | ||
| 5242 | $self->_objClass . '->plugins4Tab_refreshList', | ||
| 5243 | @_, | ||
| 5244 | ); | ||
| 5245 | } | ||
| 5246 | |||
| 5247 | # Import the list of tasks | ||
| 5248 | %taskHash = $axmud::CLIENT->pluginTaskHash; | ||
| 5249 | @taskList = sort {lc($a) cmp lc($b)} (keys %taskHash); | ||
| 5250 | |||
| 5251 | # Compile the simple list data | ||
| 5252 | foreach my $task (@taskList) { | ||
| 5253 | |||
| 5254 | push (@dataList, $task, $taskHash{$task}); | ||
| 5255 | } | ||
| 5256 | |||
| 5257 | # Reset the simple list | ||
| 5258 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5259 | |||
| 5260 | return 1; | ||
| 5261 | } | ||
| 5262 | |||
| 5263 | sub plugins5Tab { | ||
| 5264 | |||
| 5265 | # Plugins5 tab | ||
| 5266 | # | ||
| 5267 | # Expected arguments | ||
| 5268 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5269 | # | ||
| 5270 | # Return values | ||
| 5271 | # 'undef' on improper arguments | ||
| 5272 | # 1 otherwise | ||
| 5273 | |||
| 5274 | my ($self, $innerNotebook, $check) = @_; | ||
| 5275 | |||
| 5276 | # Local variables | ||
| 5277 | my @columnList; | ||
| 5278 | |||
| 5279 | # Check for improper arguments | ||
| 5280 | if (! defined $innerNotebook || defined $check) { | ||
| 5281 | |||
| 5282 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins5Tab', @_); | ||
| 5283 | } | ||
| 5284 | |||
| 5285 | # Tab setup | ||
| 5286 | my $grid = $self->addTab( | ||
| 5287 | $innerNotebook, | ||
| 5288 | 'Page _5', | ||
| 5289 | ['Plugin cages'], | ||
| 5290 | ); | ||
| 5291 | |||
| 5292 | # Plugin cages | ||
| 5293 | $self->addLabel($grid, '<b>Plugin cages</b>', | ||
| 5294 | 0, 12, 0, 1); | ||
| 5295 | $self->addLabel($grid, | ||
| 5296 | '<i>List of cages added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5297 | 1, 12, 1, 2); | ||
| 5298 | |||
| 5299 | # Add a simple list | ||
| 5300 | @columnList = ( | ||
| 5301 | 'Cage type', 'text', | ||
| 5302 | 'Plugin', 'text', | ||
| 5303 | 'Package name', 'text', | ||
| 5304 | '\'Edit\' window package name', 'text', | ||
| 5305 | ); | ||
| 5306 | |||
| 5307 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5308 | 1, 12, 2, 10); | ||
| 5309 | |||
| 5310 | # Initialise the simple list | ||
| 5311 | $self->plugins5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5312 | |||
| 5313 | # Add buttons | ||
| 5314 | my $button = $self->addButton($grid, | ||
| 5315 | 'Refresh list', 'Refresh the list of cages', undef, | ||
| 5316 | 10, 12, 10, 11); | ||
| 5317 | $button->signal_connect('clicked' => sub { | ||
| 5318 | |||
| 5319 | # Refresh the simple list | ||
| 5320 | $self->plugins5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5321 | }); | ||
| 5322 | |||
| 5323 | # Tab complete | ||
| 5324 | return 1; | ||
| 5325 | } | ||
| 5326 | |||
| 5327 | sub plugins5Tab_refreshList { | ||
| 5328 | |||
| 5329 | # Resets the simple list displayed by $self->plugins5Tab | ||
| 5330 | # | ||
| 5331 | # Expected arguments | ||
| 5332 | # $slWidget - The GA::Obj::SimpleList | ||
| 5333 | # $columns - The number of columns | ||
| 5334 | # | ||
| 5335 | # Return values | ||
| 5336 | # 'undef' on improper arguments | ||
| 5337 | # 1 otherwise | ||
| 5338 | |||
| 5339 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5340 | |||
| 5341 | # Local variables | ||
| 5342 | my ( | ||
| 5343 | @cageList, @dataList, | ||
| 5344 | %cageHash, %packageHash, %editWinHash, | ||
| 5345 | ); | ||
| 5346 | |||
| 5347 | # Check for improper arguments | ||
| 5348 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5349 | |||
| 5350 | return $axmud::CLIENT->writeImproper( | ||
| 5351 | $self->_objClass . '->plugins5Tab_refreshList', | ||
| 5352 | @_, | ||
| 5353 | ); | ||
| 5354 | } | ||
| 5355 | |||
| 5356 | # Import the list of cages | ||
| 5357 | %cageHash = $axmud::CLIENT->pluginCageHash; | ||
| 5358 | %packageHash = $axmud::CLIENT->pluginCagePackageHash; | ||
| 5359 | %editWinHash = $axmud::CLIENT->pluginCageEditWinHash; | ||
| 5360 | @cageList = sort {lc($a) cmp lc($b)} (keys %cageHash); | ||
| 5361 | |||
| 5362 | # Compile the simple list data | ||
| 5363 | foreach my $cage (@cageList) { | ||
| 5364 | |||
| 5365 | push (@dataList, | ||
| 5366 | $cage, | ||
| 5367 | $cageHash{$cage}, | ||
| 5368 | $packageHash{$cage}, | ||
| 5369 | $editWinHash{$cage}, | ||
| 5370 | ); | ||
| 5371 | } | ||
| 5372 | |||
| 5373 | # Reset the simple list | ||
| 5374 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5375 | |||
| 5376 | return 1; | ||
| 5377 | } | ||
| 5378 | |||
| 5379 | sub plugins6Tab { | ||
| 5380 | |||
| 5381 | # Plugins6 tab | ||
| 5382 | # | ||
| 5383 | # Expected arguments | ||
| 5384 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5385 | # | ||
| 5386 | # Return values | ||
| 5387 | # 'undef' on improper arguments | ||
| 5388 | # 1 otherwise | ||
| 5389 | |||
| 5390 | my ($self, $innerNotebook, $check) = @_; | ||
| 5391 | |||
| 5392 | # Local variables | ||
| 5393 | my @columnList; | ||
| 5394 | |||
| 5395 | # Check for improper arguments | ||
| 5396 | if (! defined $innerNotebook || defined $check) { | ||
| 5397 | |||
| 5398 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins6Tab', @_); | ||
| 5399 | } | ||
| 5400 | |||
| 5401 | # Tab setup | ||
| 5402 | my $grid = $self->addTab( | ||
| 5403 | $innerNotebook, | ||
| 5404 | 'Page _6', | ||
| 5405 | ['Plugin \'grid\' windows'], | ||
| 5406 | ); | ||
| 5407 | |||
| 5408 | # Plugin 'grid' windows | ||
| 5409 | $self->addLabel($grid, '<b>Plugin \'grid\' windows</b>', | ||
| 5410 | 0, 12, 0, 1); | ||
| 5411 | $self->addLabel($grid, | ||
| 5412 | '<i>List of \'grid\' window packages added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5413 | 1, 12, 1, 2); | ||
| 5414 | |||
| 5415 | # Add a simple list | ||
| 5416 | @columnList = ( | ||
| 5417 | 'Package', 'text', | ||
| 5418 | 'Plugin', 'text', | ||
| 5419 | ); | ||
| 5420 | |||
| 5421 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5422 | 1, 12, 2, 10); | ||
| 5423 | |||
| 5424 | # Initialise the simple list | ||
| 5425 | $self->plugins6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5426 | |||
| 5427 | # Add buttons | ||
| 5428 | my $button = $self->addButton($grid, | ||
| 5429 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 5430 | 10, 12, 10, 11); | ||
| 5431 | $button->signal_connect('clicked' => sub { | ||
| 5432 | |||
| 5433 | # Refresh the simple list | ||
| 5434 | $self->plugins6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5435 | }); | ||
| 5436 | |||
| 5437 | # Tab complete | ||
| 5438 | return 1; | ||
| 5439 | } | ||
| 5440 | |||
| 5441 | sub plugins6Tab_refreshList { | ||
| 5442 | |||
| 5443 | # Resets the simple list displayed by $self->plugins6Tab | ||
| 5444 | # | ||
| 5445 | # Expected arguments | ||
| 5446 | # $slWidget - The GA::Obj::SimpleList | ||
| 5447 | # $columns - The number of columns | ||
| 5448 | # | ||
| 5449 | # Return values | ||
| 5450 | # 'undef' on improper arguments | ||
| 5451 | # 1 otherwise | ||
| 5452 | |||
| 5453 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5454 | |||
| 5455 | # Local variables | ||
| 5456 | my ( | ||
| 5457 | @winList, @dataList, | ||
| 5458 | %winHash, | ||
| 5459 | ); | ||
| 5460 | |||
| 5461 | # Check for improper arguments | ||
| 5462 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5463 | |||
| 5464 | return $axmud::CLIENT->writeImproper( | ||
| 5465 | $self->_objClass . '->plugins6Tab_refreshList', | ||
| 5466 | @_, | ||
| 5467 | ); | ||
| 5468 | } | ||
| 5469 | |||
| 5470 | # Import the list of packages | ||
| 5471 | %winHash = $axmud::CLIENT->pluginGridWinHash; | ||
| 5472 | @winList = sort {lc($a) cmp lc($b)} (keys %winHash); | ||
| 5473 | |||
| 5474 | # Compile the simple list data | ||
| 5475 | foreach my $win (@winList) { | ||
| 5476 | |||
| 5477 | push (@dataList, $win, $winHash{$win}); | ||
| 5478 | } | ||
| 5479 | |||
| 5480 | # Reset the simple list | ||
| 5481 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5482 | |||
| 5483 | return 1; | ||
| 5484 | } | ||
| 5485 | |||
| 5486 | sub plugins7Tab { | ||
| 5487 | |||
| 5488 | # Plugins7 tab | ||
| 5489 | # | ||
| 5490 | # Expected arguments | ||
| 5491 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5492 | # | ||
| 5493 | # Return values | ||
| 5494 | # 'undef' on improper arguments | ||
| 5495 | # 1 otherwise | ||
| 5496 | |||
| 5497 | my ($self, $innerNotebook, $check) = @_; | ||
| 5498 | |||
| 5499 | # Local variables | ||
| 5500 | my @columnList; | ||
| 5501 | |||
| 5502 | # Check for improper arguments | ||
| 5503 | if (! defined $innerNotebook || defined $check) { | ||
| 5504 | |||
| 5505 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins7Tab', @_); | ||
| 5506 | } | ||
| 5507 | |||
| 5508 | # Tab setup | ||
| 5509 | my $grid = $self->addTab( | ||
| 5510 | $innerNotebook, | ||
| 5511 | 'Page _7', | ||
| 5512 | ['Plugin \'free\' windows'], | ||
| 5513 | ); | ||
| 5514 | |||
| 5515 | # Plugin 'free' windows | ||
| 5516 | $self->addLabel($grid, '<b>Plugin \'free\' windows</b>', | ||
| 5517 | 0, 12, 0, 1); | ||
| 5518 | $self->addLabel($grid, | ||
| 5519 | '<i>List of \'free\' window packages added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5520 | 1, 12, 1, 2); | ||
| 5521 | |||
| 5522 | # Add a simple list | ||
| 5523 | @columnList = ( | ||
| 5524 | 'Package', 'text', | ||
| 5525 | 'Plugin', 'text', | ||
| 5526 | ); | ||
| 5527 | |||
| 5528 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5529 | 1, 12, 2, 10); | ||
| 5530 | |||
| 5531 | # Initialise the simple list | ||
| 5532 | $self->plugins7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5533 | |||
| 5534 | # Add buttons | ||
| 5535 | my $button = $self->addButton($grid, | ||
| 5536 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 5537 | 10, 12, 10, 11); | ||
| 5538 | $button->signal_connect('clicked' => sub { | ||
| 5539 | |||
| 5540 | # Refresh the simple list | ||
| 5541 | $self->plugins7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5542 | }); | ||
| 5543 | |||
| 5544 | # Tab complete | ||
| 5545 | return 1; | ||
| 5546 | } | ||
| 5547 | |||
| 5548 | sub plugins7Tab_refreshList { | ||
| 5549 | |||
| 5550 | # Resets the simple list displayed by $self->plugins7Tab | ||
| 5551 | # | ||
| 5552 | # Expected arguments | ||
| 5553 | # $slWidget - The GA::Obj::SimpleList | ||
| 5554 | # $columns - The number of columns | ||
| 5555 | # | ||
| 5556 | # Return values | ||
| 5557 | # 'undef' on improper arguments | ||
| 5558 | # 1 otherwise | ||
| 5559 | |||
| 5560 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5561 | |||
| 5562 | # Local variables | ||
| 5563 | my ( | ||
| 5564 | @winList, @dataList, | ||
| 5565 | %winHash, | ||
| 5566 | ); | ||
| 5567 | |||
| 5568 | # Check for improper arguments | ||
| 5569 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5570 | |||
| 5571 | return $axmud::CLIENT->writeImproper( | ||
| 5572 | $self->_objClass . '->plugins7Tab_refreshList', | ||
| 5573 | @_, | ||
| 5574 | ); | ||
| 5575 | } | ||
| 5576 | |||
| 5577 | # Import the list of packages | ||
| 5578 | %winHash = $axmud::CLIENT->pluginFreeWinHash; | ||
| 5579 | @winList = sort {lc($a) cmp lc($b)} (keys %winHash); | ||
| 5580 | |||
| 5581 | # Compile the simple list data | ||
| 5582 | foreach my $win (@winList) { | ||
| 5583 | |||
| 5584 | push (@dataList, $win, $winHash{$win}); | ||
| 5585 | } | ||
| 5586 | |||
| 5587 | # Reset the simple list | ||
| 5588 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5589 | |||
| 5590 | return 1; | ||
| 5591 | } | ||
| 5592 | |||
| 5593 | sub plugins8Tab { | ||
| 5594 | |||
| 5595 | # Plugins8 tab | ||
| 5596 | # | ||
| 5597 | # Expected arguments | ||
| 5598 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5599 | # | ||
| 5600 | # Return values | ||
| 5601 | # 'undef' on improper arguments | ||
| 5602 | # 1 otherwise | ||
| 5603 | |||
| 5604 | my ($self, $innerNotebook, $check) = @_; | ||
| 5605 | |||
| 5606 | # Local variables | ||
| 5607 | my @columnList; | ||
| 5608 | |||
| 5609 | # Check for improper arguments | ||
| 5610 | if (! defined $innerNotebook || defined $check) { | ||
| 5611 | |||
| 5612 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins8Tab', @_); | ||
| 5613 | } | ||
| 5614 | |||
| 5615 | # Tab setup | ||
| 5616 | my $grid = $self->addTab( | ||
| 5617 | $innerNotebook, | ||
| 5618 | 'Page _8', | ||
| 5619 | ['Plugin strip objects'], | ||
| 5620 | ); | ||
| 5621 | |||
| 5622 | # Plugin strip objects | ||
| 5623 | $self->addLabel($grid, '<b>Plugin strip objects</b>', | ||
| 5624 | 0, 12, 0, 1); | ||
| 5625 | $self->addLabel($grid, | ||
| 5626 | '<i>List of strip object packages added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5627 | 1, 12, 1, 2); | ||
| 5628 | |||
| 5629 | # Add a simple list | ||
| 5630 | @columnList = ( | ||
| 5631 | 'Package', 'text', | ||
| 5632 | 'Plugin', 'text', | ||
| 5633 | ); | ||
| 5634 | |||
| 5635 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5636 | 1, 12, 2, 10); | ||
| 5637 | |||
| 5638 | # Initialise the simple list | ||
| 5639 | $self->plugins8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5640 | |||
| 5641 | # Add buttons | ||
| 5642 | my $button = $self->addButton($grid, | ||
| 5643 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 5644 | 10, 12, 10, 11); | ||
| 5645 | $button->signal_connect('clicked' => sub { | ||
| 5646 | |||
| 5647 | # Refresh the simple list | ||
| 5648 | $self->plugins8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5649 | }); | ||
| 5650 | |||
| 5651 | # Tab complete | ||
| 5652 | return 1; | ||
| 5653 | } | ||
| 5654 | |||
| 5655 | sub plugins8Tab_refreshList { | ||
| 5656 | |||
| 5657 | # Resets the simple list displayed by $self->plugins8Tab | ||
| 5658 | # | ||
| 5659 | # Expected arguments | ||
| 5660 | # $slWidget - The GA::Obj::SimpleList | ||
| 5661 | # $columns - The number of columns | ||
| 5662 | # | ||
| 5663 | # Return values | ||
| 5664 | # 'undef' on improper arguments | ||
| 5665 | # 1 otherwise | ||
| 5666 | |||
| 5667 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5668 | |||
| 5669 | # Local variables | ||
| 5670 | my ( | ||
| 5671 | @objList, @dataList, | ||
| 5672 | %objHash, | ||
| 5673 | ); | ||
| 5674 | |||
| 5675 | # Check for improper arguments | ||
| 5676 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5677 | |||
| 5678 | return $axmud::CLIENT->writeImproper( | ||
| 5679 | $self->_objClass . '->plugins8Tab_refreshList', | ||
| 5680 | @_, | ||
| 5681 | ); | ||
| 5682 | } | ||
| 5683 | |||
| 5684 | # Import the list of packages | ||
| 5685 | %objHash = $axmud::CLIENT->pluginStripObjHash; | ||
| 5686 | @objList = sort {lc($a) cmp lc($b)} (keys %objHash); | ||
| 5687 | |||
| 5688 | # Compile the simple list data | ||
| 5689 | foreach my $win (@objList) { | ||
| 5690 | |||
| 5691 | push (@dataList, $win, $objHash{$win}); | ||
| 5692 | } | ||
| 5693 | |||
| 5694 | # Reset the simple list | ||
| 5695 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5696 | |||
| 5697 | return 1; | ||
| 5698 | } | ||
| 5699 | |||
| 5700 | sub plugins9Tab { | ||
| 5701 | |||
| 5702 | # Plugins9 tab | ||
| 5703 | # | ||
| 5704 | # Expected arguments | ||
| 5705 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5706 | # | ||
| 5707 | # Return values | ||
| 5708 | # 'undef' on improper arguments | ||
| 5709 | # 1 otherwise | ||
| 5710 | |||
| 5711 | my ($self, $innerNotebook, $check) = @_; | ||
| 5712 | |||
| 5713 | # Local variables | ||
| 5714 | my @columnList; | ||
| 5715 | |||
| 5716 | # Check for improper arguments | ||
| 5717 | if (! defined $innerNotebook || defined $check) { | ||
| 5718 | |||
| 5719 | return $axmud::CLIENT->writeImproper($self->_objClass . '->plugins9Tab', @_); | ||
| 5720 | } | ||
| 5721 | |||
| 5722 | # Tab setup | ||
| 5723 | my $grid = $self->addTab( | ||
| 5724 | $innerNotebook, | ||
| 5725 | 'Page _9', | ||
| 5726 | ['Plugin table objects'], | ||
| 5727 | ); | ||
| 5728 | |||
| 5729 | # Plugin table objects | ||
| 5730 | $self->addLabel($grid, '<b>Plugin table objects</b>', | ||
| 5731 | 0, 12, 0, 1); | ||
| 5732 | $self->addLabel($grid, | ||
| 5733 | '<i>List of table object packages added by ' . $axmud::SCRIPT . ' plugins</i>', | ||
| 5734 | 1, 12, 1, 2); | ||
| 5735 | |||
| 5736 | # Add a simple list | ||
| 5737 | @columnList = ( | ||
| 5738 | 'Package', 'text', | ||
| 5739 | 'Plugin', 'text', | ||
| 5740 | ); | ||
| 5741 | |||
| 5742 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 5743 | 1, 12, 2, 10); | ||
| 5744 | |||
| 5745 | # Initialise the simple list | ||
| 5746 | $self->plugins9Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5747 | |||
| 5748 | # Add buttons | ||
| 5749 | my $button = $self->addButton($grid, | ||
| 5750 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 5751 | 10, 12, 10, 11); | ||
| 5752 | $button->signal_connect('clicked' => sub { | ||
| 5753 | |||
| 5754 | # Refresh the simple list | ||
| 5755 | $self->plugins9Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 5756 | }); | ||
| 5757 | |||
| 5758 | # Tab complete | ||
| 5759 | return 1; | ||
| 5760 | } | ||
| 5761 | |||
| 5762 | sub plugins9Tab_refreshList { | ||
| 5763 | |||
| 5764 | # Resets the simple list displayed by $self->plugins9Tab | ||
| 5765 | # | ||
| 5766 | # Expected arguments | ||
| 5767 | # $slWidget - The GA::Obj::SimpleList | ||
| 5768 | # $columns - The number of columns | ||
| 5769 | # | ||
| 5770 | # Return values | ||
| 5771 | # 'undef' on improper arguments | ||
| 5772 | # 1 otherwise | ||
| 5773 | |||
| 5774 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 5775 | |||
| 5776 | # Local variables | ||
| 5777 | my ( | ||
| 5778 | @objList, @dataList, | ||
| 5779 | %objHash, | ||
| 5780 | ); | ||
| 5781 | |||
| 5782 | # Check for improper arguments | ||
| 5783 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 5784 | |||
| 5785 | return $axmud::CLIENT->writeImproper( | ||
| 5786 | $self->_objClass . '->plugins9Tab_refreshList', | ||
| 5787 | @_, | ||
| 5788 | ); | ||
| 5789 | } | ||
| 5790 | |||
| 5791 | # Import the list of packages | ||
| 5792 | %objHash = $axmud::CLIENT->pluginTableObjHash; | ||
| 5793 | @objList = sort {lc($a) cmp lc($b)} (keys %objHash); | ||
| 5794 | |||
| 5795 | # Compile the simple list data | ||
| 5796 | foreach my $win (@objList) { | ||
| 5797 | |||
| 5798 | push (@dataList, $win, $objHash{$win}); | ||
| 5799 | } | ||
| 5800 | |||
| 5801 | # Reset the simple list | ||
| 5802 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 5803 | |||
| 5804 | return 1; | ||
| 5805 | } | ||
| 5806 | |||
| 5807 | sub commandsTab { | ||
| 5808 | |||
| 5809 | # Commands tab - called by $self->setupNotebook | ||
| 5810 | # | ||
| 5811 | # Expected arguments | ||
| 5812 | # (none besides $self) | ||
| 5813 | # | ||
| 5814 | # Return values | ||
| 5815 | # 'undef' on improper arguments | ||
| 5816 | # 1 otherwise | ||
| 5817 | |||
| 5818 | my ($self, $check) = @_; | ||
| 5819 | |||
| 5820 | # Check for improper arguments | ||
| 5821 | if (defined $check) { | ||
| 5822 | |||
| 5823 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commandsTab', @_); | ||
| 5824 | } | ||
| 5825 | |||
| 5826 | # Tab setup | ||
| 5827 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 5828 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'Co_mmands'); | ||
| 5829 | |||
| 5830 | # Add tabs to the inner notebook | ||
| 5831 | $self->commands1Tab($innerNotebook); | ||
| 5832 | $self->commands2Tab($innerNotebook); | ||
| 5833 | $self->commands3Tab($innerNotebook); | ||
| 5834 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 5835 | |||
| 5836 | $self->commands4Tab($innerNotebook); | ||
| 5837 | $self->commands5Tab($innerNotebook); | ||
| 5838 | $self->commands6Tab($innerNotebook); | ||
| 5839 | } | ||
| 5840 | |||
| 5841 | return 1; | ||
| 5842 | } | ||
| 5843 | |||
| 5844 | sub commands1Tab { | ||
| 5845 | |||
| 5846 | # Commands1 tab | ||
| 5847 | # | ||
| 5848 | # Expected arguments | ||
| 5849 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 5850 | # | ||
| 5851 | # Return values | ||
| 5852 | # 'undef' on improper arguments | ||
| 5853 | # 1 otherwise | ||
| 5854 | |||
| 5855 | my ($self, $innerNotebook, $check) = @_; | ||
| 5856 | |||
| 5857 | # Check for improper arguments | ||
| 5858 | if (! defined $innerNotebook || defined $check) { | ||
| 5859 | |||
| 5860 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands1Tab', @_); | ||
| 5861 | } | ||
| 5862 | |||
| 5863 | # Tab setup | ||
| 5864 | my $grid = $self->addTab( | ||
| 5865 | $innerNotebook, | ||
| 5866 | 'Page _1', | ||
| 5867 | ['Instruction sigils', 'World command separator'], | ||
| 5868 | ); | ||
| 5869 | |||
| 5870 | # Instruction sigils | ||
| 5871 | $self->addLabel($grid, '<b>Instruction sigils</b>', | ||
| 5872 | 0, 12, 0, 1); | ||
| 5873 | |||
| 5874 | $self->addLabel($grid, 'Client command sigil', | ||
| 5875 | 1, 4, 1, 2); | ||
| 5876 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 5877 | 4, 6, 1, 2); | ||
| 5878 | $entry->set_text($axmud::CLIENT->constClientSigil); | ||
| 5879 | |||
| 5880 | my $checkButton = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5881 | 6, 8, 1, 2); | ||
| 5882 | $checkButton->set_active(TRUE); | ||
| 5883 | |||
| 5884 | $self->addLabel($grid, 'Forced world command sigil', | ||
| 5885 | 1, 4, 2, 3); | ||
| 5886 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 5887 | 4, 6, 2, 3); | ||
| 5888 | $entry2->set_text($axmud::CLIENT->constForcedSigil); | ||
| 5889 | |||
| 5890 | my $checkButton2 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5891 | 6, 8, 2, 3); | ||
| 5892 | $checkButton2->set_active(TRUE); | ||
| 5893 | |||
| 5894 | $self->addLabel($grid, 'Echo command sigil', | ||
| 5895 | 1, 4, 3, 4); | ||
| 5896 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 5897 | 4, 6, 3, 4); | ||
| 5898 | $entry3->set_text($axmud::CLIENT->constEchoSigil); | ||
| 5899 | |||
| 5900 | my $checkButton3 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5901 | 6, 8, 3, 4); | ||
| 5902 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 5903 | |||
| 5904 | my $button = $self->addButton($grid, 'Enable', 'Enable echo commands', undef, | ||
| 5905 | 8, 10, 3, 4); | ||
| 5906 | $button->signal_connect('clicked' => sub { | ||
| 5907 | |||
| 5908 | if (! $axmud::CLIENT->echoSigilFlag) { | ||
| 5909 | |||
| 5910 | $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode); | ||
| 5911 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 5912 | } | ||
| 5913 | }); | ||
| 5914 | my $button2 = $self->addButton($grid, 'Disable', 'Disable echo commands', undef, | ||
| 5915 | 10, 12, 3, 4); | ||
| 5916 | $button2->signal_connect('clicked' => sub { | ||
| 5917 | |||
| 5918 | if ($axmud::CLIENT->echoSigilFlag) { | ||
| 5919 | |||
| 5920 | $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode); | ||
| 5921 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 5922 | } | ||
| 5923 | }); | ||
| 5924 | |||
| 5925 | $self->addLabel($grid, 'Perl command sigil', | ||
| 5926 | 1, 4, 4, 5); | ||
| 5927 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 5928 | 4, 6, 4, 5); | ||
| 5929 | $entry4->set_text($axmud::CLIENT->constPerlSigil); | ||
| 5930 | |||
| 5931 | my $checkButton4 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5932 | 6, 8, 4, 5); | ||
| 5933 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 5934 | |||
| 5935 | my $button3 = $self->addButton($grid, 'Enable', 'Enable Perl commands', undef, | ||
| 5936 | 8, 10, 4, 5); | ||
| 5937 | $button3->signal_connect('clicked' => sub { | ||
| 5938 | |||
| 5939 | if (! $axmud::CLIENT->perlSigilFlag) { | ||
| 5940 | |||
| 5941 | $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode); | ||
| 5942 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 5943 | } | ||
| 5944 | }); | ||
| 5945 | my $button4 = $self->addButton($grid, 'Disable', 'Disable Perl commands', undef, | ||
| 5946 | 10, 12, 4, 5); | ||
| 5947 | $button4->signal_connect('clicked' => sub { | ||
| 5948 | |||
| 5949 | if ($axmud::CLIENT->perlSigilFlag) { | ||
| 5950 | |||
| 5951 | $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode); | ||
| 5952 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 5953 | } | ||
| 5954 | }); | ||
| 5955 | |||
| 5956 | $self->addLabel($grid, 'Script command sigil', | ||
| 5957 | 1, 4, 5, 6); | ||
| 5958 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 5959 | 4, 6, 5, 6); | ||
| 5960 | $entry5->set_text($axmud::CLIENT->constScriptSigil); | ||
| 5961 | |||
| 5962 | my $checkButton5 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5963 | 6, 8, 5, 6); | ||
| 5964 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 5965 | |||
| 5966 | my $button5 = $self->addButton($grid, 'Enable', 'Enable script commands', undef, | ||
| 5967 | 8, 10, 5, 6); | ||
| 5968 | $button5->signal_connect('clicked' => sub { | ||
| 5969 | |||
| 5970 | if (! $axmud::CLIENT->scriptSigilFlag) { | ||
| 5971 | |||
| 5972 | $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode); | ||
| 5973 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 5974 | } | ||
| 5975 | }); | ||
| 5976 | my $button6 = $self->addButton($grid, 'Disable', 'Disable script commands', undef, | ||
| 5977 | 10, 12, 5, 6); | ||
| 5978 | $button6->signal_connect('clicked' => sub { | ||
| 5979 | |||
| 5980 | if ($axmud::CLIENT->scriptSigilFlag) { | ||
| 5981 | |||
| 5982 | $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode); | ||
| 5983 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 5984 | } | ||
| 5985 | }); | ||
| 5986 | |||
| 5987 | $self->addLabel($grid, 'Multi command sigil', | ||
| 5988 | 1, 4, 6, 7); | ||
| 5989 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 5990 | 4, 6, 6, 7); | ||
| 5991 | $entry6->set_text($axmud::CLIENT->constMultiSigil); | ||
| 5992 | |||
| 5993 | my $checkButton6 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 5994 | 6, 8, 6, 7); | ||
| 5995 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 5996 | |||
| 5997 | my $button7 = $self->addButton($grid, 'Enable', 'Enable multi commands', undef, | ||
| 5998 | 8, 10, 6, 7); | ||
| 5999 | $button7->signal_connect('clicked' => sub { | ||
| 6000 | |||
| 6001 | if (! $axmud::CLIENT->multiSigilFlag) { | ||
| 6002 | |||
| 6003 | $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode); | ||
| 6004 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 6005 | } | ||
| 6006 | }); | ||
| 6007 | my $button8 = $self->addButton($grid, 'Disable', 'Disable multi commands', undef, | ||
| 6008 | 10, 12, 6, 7); | ||
| 6009 | $button8->signal_connect('clicked' => sub { | ||
| 6010 | |||
| 6011 | if ($axmud::CLIENT->multiSigilFlag) { | ||
| 6012 | |||
| 6013 | $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode); | ||
| 6014 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 6015 | } | ||
| 6016 | }); | ||
| 6017 | |||
| 6018 | $self->addLabel($grid, 'Speedwalk command sigil', | ||
| 6019 | 1, 4, 7, 8); | ||
| 6020 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 6021 | 4, 6, 7, 8); | ||
| 6022 | $entry7->set_text($axmud::CLIENT->constSpeedSigil); | ||
| 6023 | |||
| 6024 | my $checkButton7 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 6025 | 6, 8, 7, 8); | ||
| 6026 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 6027 | |||
| 6028 | my $button9 = $self->addButton($grid, 'Enable', 'Enable speedwalk commands', undef, | ||
| 6029 | 8, 10, 7, 8); | ||
| 6030 | $button9->signal_connect('clicked' => sub { | ||
| 6031 | |||
| 6032 | if (! $axmud::CLIENT->speedSigilFlag) { | ||
| 6033 | |||
| 6034 | $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode); | ||
| 6035 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 6036 | } | ||
| 6037 | }); | ||
| 6038 | my $button10 = $self->addButton($grid, 'Disable', 'Disable speedwalk commands', undef, | ||
| 6039 | 10, 12, 7, 8); | ||
| 6040 | $button10->signal_connect('clicked' => sub { | ||
| 6041 | |||
| 6042 | if ($axmud::CLIENT->speedSigilFlag) { | ||
| 6043 | |||
| 6044 | $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode); | ||
| 6045 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 6046 | } | ||
| 6047 | }); | ||
| 6048 | |||
| 6049 | $self->addLabel($grid, 'Bypass command sigil', | ||
| 6050 | 1, 4, 8, 9); | ||
| 6051 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 6052 | 4, 6, 8, 9); | ||
| 6053 | $entry8->set_text($axmud::CLIENT->constBypassSigil); | ||
| 6054 | |||
| 6055 | my $checkButton8 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 6056 | 6, 8, 8, 9); | ||
| 6057 | $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag); | ||
| 6058 | |||
| 6059 | my $button11 = $self->addButton($grid, 'Enable', 'Enable bypass commands', undef, | ||
| 6060 | 8, 10, 8, 9); | ||
| 6061 | $button11->signal_connect('clicked' => sub { | ||
| 6062 | |||
| 6063 | if (! $axmud::CLIENT->bypassSigilFlag) { | ||
| 6064 | |||
| 6065 | $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode); | ||
| 6066 | $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag); | ||
| 6067 | } | ||
| 6068 | }); | ||
| 6069 | my $button12 = $self->addButton($grid, 'Disable', 'Disable bypass commands', undef, | ||
| 6070 | 10, 12, 8, 9); | ||
| 6071 | $button12->signal_connect('clicked' => sub { | ||
| 6072 | |||
| 6073 | if ($axmud::CLIENT->bypassSigilFlag) { | ||
| 6074 | |||
| 6075 | $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode); | ||
| 6076 | $checkButton8->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 6077 | } | ||
| 6078 | }); | ||
| 6079 | |||
| 6080 | # World command separator | ||
| 6081 | $self->addLabel($grid, '<b>World command separator</b>', | ||
| 6082 | 0, 12, 9, 10); | ||
| 6083 | |||
| 6084 | $self->addLabel($grid, 'Separator', | ||
| 6085 | 1, 4, 10, 11); | ||
| 6086 | my $entry9 = $self->addEntry($grid, undef, TRUE, | ||
| 6087 | 4, 6, 10, 11, | ||
| 6088 | 16, 16); | ||
| 6089 | $entry9->set_text($axmud::CLIENT->cmdSep); | ||
| 6090 | $entry9->set_icon_from_stock('secondary', 'gtk-yes'); | ||
| 6091 | $entry9->signal_connect('changed' => sub { | ||
| 6092 | |||
| 6093 | # (Borrowed from GA::Generic::EditWin->addEntryWithIcon and ->checkEntry. The value | ||
| 6094 | # must not contain any spaces) | ||
| 6095 | |||
| 6096 | my $value = $entry9->get_text(); | ||
| 6097 | # Check whether $text is a valid value, or not | ||
| 6098 | |||
| 6099 | if (! $value || length ($value) > 4 || $value =~ m/\s/) { | ||
| 6100 | $entry9->set_icon_from_stock('secondary', 'gtk-no'); | ||
| 6101 | } else { | ||
| 6102 | $entry9->set_icon_from_stock('secondary', 'gtk-yes'); | ||
| 6103 | } | ||
| 6104 | }); | ||
| 6105 | |||
| 6106 | my $button13 = $self->addButton( | ||
| 6107 | $grid, 'Set', 'Sets the command separator (max 4 characters, no spaces)', undef, | ||
| 6108 | 8, 10, 10, 11); | ||
| 6109 | $button13->signal_connect('clicked' => sub { | ||
| 6110 | |||
| 6111 | my $separator = $entry9->get_text(); | ||
| 6112 | |||
| 6113 | if ($self->checkEntryIcon($entry9)) { | ||
| 6114 | |||
| 6115 | # Set the command separator | ||
| 6116 | $self->session->pseudoCmd('commandseparator ' . $separator, $self->pseudoCmdMode); | ||
| 6117 | |||
| 6118 | # Update the entry box | ||
| 6119 | $entry9->set_text($axmud::CLIENT->cmdSep); | ||
| 6120 | } | ||
| 6121 | }); | ||
| 6122 | |||
| 6123 | my $button14 = $self->addButton( | ||
| 6124 | $grid, 'Reset', 'Resets the command separator to its default value', undef, | ||
| 6125 | 10, 12, 10, 11); | ||
| 6126 | $button14->signal_connect('clicked' => sub { | ||
| 6127 | |||
| 6128 | # Set the command separator | ||
| 6129 | $self->session->pseudoCmd('commandseparator', $self->pseudoCmdMode); | ||
| 6130 | |||
| 6131 | # Update the entry box | ||
| 6132 | $entry9->set_text($axmud::CLIENT->cmdSep); | ||
| 6133 | }); | ||
| 6134 | |||
| 6135 | # Tab complete | ||
| 6136 | return 1; | ||
| 6137 | } | ||
| 6138 | |||
| 6139 | sub commands2Tab { | ||
| 6140 | |||
| 6141 | # Commands2 tab | ||
| 6142 | # | ||
| 6143 | # Expected arguments | ||
| 6144 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 6145 | # | ||
| 6146 | # Return values | ||
| 6147 | # 'undef' on improper arguments | ||
| 6148 | # 1 otherwise | ||
| 6149 | |||
| 6150 | my ($self, $innerNotebook, $check) = @_; | ||
| 6151 | |||
| 6152 | # Check for improper arguments | ||
| 6153 | if (! defined $innerNotebook || defined $check) { | ||
| 6154 | |||
| 6155 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands3Tab', @_); | ||
| 6156 | } | ||
| 6157 | |||
| 6158 | # Tab setup | ||
| 6159 | my $grid = $self->addTab( | ||
| 6160 | $innerNotebook, | ||
| 6161 | 'Page _2', | ||
| 6162 | ['Instruction settings'], | ||
| 6163 | ); | ||
| 6164 | |||
| 6165 | # Left column | ||
| 6166 | $self->addLabel($grid, '<b>Instruction settings</b>', | ||
| 6167 | 0, 6, 0, 1); | ||
| 6168 | $self->addLabel($grid, '<i>Multi commands</i>', | ||
| 6169 | 1, 6, 1, 2); | ||
| 6170 | |||
| 6171 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 6172 | $grid, undef, 'Send to sessions with same world profile', undef, | ||
| 6173 | undef, # IV set to this value when toggled | ||
| 6174 | TRUE, # Sensitive widget | ||
| 6175 | 1, 6, 2, 3); | ||
| 6176 | $radioButton->signal_connect('toggled' => sub { | ||
| 6177 | |||
| 6178 | if ($radioButton->get_active() && $axmud::CLIENT->maxMultiCmdFlag) { | ||
| 6179 | |||
| 6180 | $self->session->pseudoCmd('toggleinstruct -m', $self->pseudoCmdMode); | ||
| 6181 | } | ||
| 6182 | }); | ||
| 6183 | |||
| 6184 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 6185 | $grid, $group, 'Send to all sessions', undef, undef, TRUE, | ||
| 6186 | 1, 6, 3, 4); | ||
| 6187 | if ($axmud::CLIENT->maxMultiCmdFlag) { | ||
| 6188 | |||
| 6189 | $radioButton2->set_active(TRUE); | ||
| 6190 | } | ||
| 6191 | $radioButton2->signal_connect('toggled' => sub { | ||
| 6192 | |||
| 6193 | |||
| 6194 | if ($radioButton2->get_active() && ! $axmud::CLIENT->maxMultiCmdFlag) { | ||
| 6195 | |||
| 6196 | $self->session->pseudoCmd('toggleinstruct -m', $self->pseudoCmdMode); | ||
| 6197 | } | ||
| 6198 | }); | ||
| 6199 | |||
| 6200 | $self->addLabel($grid, '<i>World / speedwalk / multi / bypass commands</i>', | ||
| 6201 | 1, 6, 4, 5); | ||
| 6202 | |||
| 6203 | my ($group11, $radioButton11) = $self->addRadioButton( | ||
| 6204 | $grid, undef, 'After processing, remove from command entry box', undef, | ||
| 6205 | undef, # IV set to this value when toggled | ||
| 6206 | TRUE, # Sensitive widget | ||
| 6207 | 1, 6, 5, 6); | ||
| 6208 | $radioButton11->signal_connect('toggled' => sub { | ||
| 6209 | |||
| 6210 | if ($radioButton11->get_active() && $axmud::CLIENT->preserveWorldCmdFlag) { | ||
| 6211 | |||
| 6212 | $self->session->pseudoCmd('toggleinstruct -w', $self->pseudoCmdMode); | ||
| 6213 | } | ||
| 6214 | }); | ||
| 6215 | |||
| 6216 | my ($group12, $radioButton12) = $self->addRadioButton( | ||
| 6217 | $grid, $group11, 'After processing, retain in command entry box', undef, undef, TRUE, | ||
| 6218 | 1, 6, 6, 7); | ||
| 6219 | if ($axmud::CLIENT->preserveWorldCmdFlag) { | ||
| 6220 | |||
| 6221 | $radioButton12->set_active(TRUE); | ||
| 6222 | } | ||
| 6223 | $radioButton12->signal_connect('toggled' => sub { | ||
| 6224 | |||
| 6225 | if ($radioButton12->get_active() && ! $axmud::CLIENT->preserveWorldCmdFlag) { | ||
| 6226 | |||
| 6227 | $self->session->pseudoCmd('toggleinstruct -w', $self->pseudoCmdMode); | ||
| 6228 | } | ||
| 6229 | }); | ||
| 6230 | |||
| 6231 | $self->addLabel($grid, '<i>Client / echo / Perl / script commands</i>', | ||
| 6232 | 1, 6, 7, 8); | ||
| 6233 | |||
| 6234 | my ($group21, $radioButton21) = $self->addRadioButton( | ||
| 6235 | $grid, undef, 'After processing, remove from command entry box', undef, | ||
| 6236 | undef, # IV set to this value when toggled | ||
| 6237 | TRUE, # Sensitive widget | ||
| 6238 | 1, 6, 8, 9); | ||
| 6239 | $radioButton21->signal_connect('toggled' => sub { | ||
| 6240 | |||
| 6241 | if ($radioButton21->get_active() && $axmud::CLIENT->preserveOtherCmdFlag) { | ||
| 6242 | |||
| 6243 | $self->session->pseudoCmd('toggleinstruct -o', $self->pseudoCmdMode); | ||
| 6244 | } | ||
| 6245 | }); | ||
| 6246 | |||
| 6247 | my ($group22, $radioButton22) = $self->addRadioButton( | ||
| 6248 | $grid, | ||
| 6249 | $group21, | ||
| 6250 | 'After processing, retain in command entry box', | ||
| 6251 | undef, | ||
| 6252 | undef, | ||
| 6253 | TRUE, | ||
| 6254 | 1, 6, 9, 10); | ||
| 6255 | if ($axmud::CLIENT->preserveOtherCmdFlag) { | ||
| 6256 | |||
| 6257 | $radioButton22->set_active(TRUE); | ||
| 6258 | } | ||
| 6259 | $radioButton22->signal_connect('toggled' => sub { | ||
| 6260 | |||
| 6261 | if ($radioButton22->get_active() && ! $axmud::CLIENT->preserveOtherCmdFlag) { | ||
| 6262 | |||
| 6263 | $self->session->pseudoCmd('toggleinstruct -o', $self->pseudoCmdMode); | ||
| 6264 | } | ||
| 6265 | }); | ||
| 6266 | |||
| 6267 | # Right column | ||
| 6268 | $self->addLabel($grid, '<i>Other settings</i>', | ||
| 6269 | 7, 12, 1, 2); | ||
| 6270 | |||
| 6271 | my $checkButton = $self->addCheckButton( | ||
| 6272 | $grid, 'World commands also shown in \'main\' window', undef, TRUE, | ||
| 6273 | 7, 12, 2, 3); | ||
| 6274 | $checkButton->set_active($axmud::CLIENT->confirmWorldCmdFlag); | ||
| 6275 | $checkButton->signal_connect('toggled' => sub { | ||
| 6276 | |||
| 6277 | if ( | ||
| 6278 | ($checkButton->get_active() && ! $axmud::CLIENT->confirmWorldCmdFlag) | ||
| 6279 | || (! $checkButton->get_active() && $axmud::CLIENT->confirmWorldCmdFlag) | ||
| 6280 | ) { | ||
| 6281 | $self->session->pseudoCmd('toggleinstruct -c', $self->pseudoCmdMode); | ||
| 6282 | } | ||
| 6283 | }); | ||
| 6284 | |||
| 6285 | my $checkButton2 = $self->addCheckButton( | ||
| 6286 | $grid, 'Send short world commands in lower-case letters', undef, TRUE, | ||
| 6287 | 7, 12, 3, 4); | ||
| 6288 | $checkButton2->set_active($axmud::CLIENT->convertWorldCmdFlag); | ||
| 6289 | $checkButton2->signal_connect('toggled' => sub { | ||
| 6290 | |||
| 6291 | if ( | ||
| 6292 | ($checkButton2->get_active() && ! $axmud::CLIENT->convertWorldCmdFlag) | ||
| 6293 | || (! $checkButton2->get_active() && $axmud::CLIENT->convertWorldCmdFlag) | ||
| 6294 | ) { | ||
| 6295 | $self->session->pseudoCmd('toggleinstruct -v', $self->pseudoCmdMode); | ||
| 6296 | } | ||
| 6297 | }); | ||
| 6298 | |||
| 6299 | # Tab complete | ||
| 6300 | return 1; | ||
| 6301 | } | ||
| 6302 | |||
| 6303 | sub commands3Tab { | ||
| 6304 | |||
| 6305 | # Commands3 tab | ||
| 6306 | # | ||
| 6307 | # Expected arguments | ||
| 6308 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 6309 | # | ||
| 6310 | # Return values | ||
| 6311 | # 'undef' on improper arguments | ||
| 6312 | # 1 otherwise | ||
| 6313 | |||
| 6314 | my ($self, $innerNotebook, $check) = @_; | ||
| 6315 | |||
| 6316 | # Check for improper arguments | ||
| 6317 | if (! defined $innerNotebook || defined $check) { | ||
| 6318 | |||
| 6319 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands3Tab', @_); | ||
| 6320 | } | ||
| 6321 | |||
| 6322 | # Tab setup | ||
| 6323 | my $grid = $self->addTab( | ||
| 6324 | $innerNotebook, | ||
| 6325 | 'Page _3', | ||
| 6326 | ['Redirect mode', 'Auto-complete mode'], | ||
| 6327 | ); | ||
| 6328 | |||
| 6329 | # Left column | ||
| 6330 | $self->addLabel($grid, '<b>Redirect mode</b>', | ||
| 6331 | 0, 6, 0, 1); | ||
| 6332 | my $entry6 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 6333 | 1, 6, 1, 2); | ||
| 6334 | $self->addLabel($grid, '<i>The \'@\' symbol is replaced by a direction</i>', | ||
| 6335 | 1, 6, 2, 3); | ||
| 6336 | |||
| 6337 | my $button4 = $self->addButton( | ||
| 6338 | $grid, | ||
| 6339 | 'Redirect mode on', | ||
| 6340 | 'Redirects direction commands, replacing the @ symbol with the direction', | ||
| 6341 | undef, | ||
| 6342 | 1, 3, 3, 4); | ||
| 6343 | $button4->signal_connect('clicked' => sub { | ||
| 6344 | |||
| 6345 | my $string = $entry6->get_text(); | ||
| 6346 | |||
| 6347 | if ($self->checkEntryIcon($entry6)) { | ||
| 6348 | |||
| 6349 | # Turn redirect mode on | ||
| 6350 | $self->session->pseudoCmd('redirectmode <' . $string . '>', $self->pseudoCmdMode); | ||
| 6351 | |||
| 6352 | # Reset the entry box | ||
| 6353 | $self->resetEntryBoxes($entry6); | ||
| 6354 | } | ||
| 6355 | }); | ||
| 6356 | |||
| 6357 | my $button5 = $self->addButton( | ||
| 6358 | $grid, | ||
| 6359 | 'Redirect mode off', | ||
| 6360 | 'Turns off redirect mode', | ||
| 6361 | undef, | ||
| 6362 | 3, 5, 3, 4); | ||
| 6363 | $button5->signal_connect('clicked' => sub { | ||
| 6364 | |||
| 6365 | # Turn redirect mode on | ||
| 6366 | $self->session->pseudoCmd('redirectmode', $self->pseudoCmdMode); | ||
| 6367 | |||
| 6368 | # Reset the entry box | ||
| 6369 | $self->resetEntryBoxes($entry6); | ||
| 6370 | }); | ||
| 6371 | |||
| 6372 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 6373 | $grid, undef, 'Redirect primary directions only', undef, | ||
| 6374 | undef, # IV set to this value when toggled | ||
| 6375 | TRUE, # Sensitive widget | ||
| 6376 | 1, 6, 4, 5); | ||
| 6377 | if ($self->session->redirectMode eq 'primary_only') { | ||
| 6378 | |||
| 6379 | $radioButton->set_active(TRUE); | ||
| 6380 | } | ||
| 6381 | $radioButton->signal_connect('toggled' => sub { | ||
| 6382 | |||
| 6383 | if ($radioButton->get_active()) { | ||
| 6384 | |||
| 6385 | $self->session->pseudoCmd('setredirectmode -p', $self->pseudoCmdMode); | ||
| 6386 | } | ||
| 6387 | }); | ||
| 6388 | |||
| 6389 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 6390 | $grid, $group, 'Redirect primary & secondary directions', undef, undef, TRUE, | ||
| 6391 | 1, 6, 5, 6); | ||
| 6392 | if ($self->session->redirectMode eq 'primary_secondary') { | ||
| 6393 | |||
| 6394 | $radioButton2->set_active(TRUE); | ||
| 6395 | } | ||
| 6396 | $radioButton2->signal_connect('toggled' => sub { | ||
| 6397 | |||
| 6398 | if ($radioButton2->get_active()) { | ||
| 6399 | |||
| 6400 | $self->session->pseudoCmd('setredirectmode -b', $self->pseudoCmdMode); | ||
| 6401 | } | ||
| 6402 | }); | ||
| 6403 | |||
| 6404 | my ($group3, $radioButton3) = $self->addRadioButton( | ||
| 6405 | $grid, $group2, 'Redirect all direction commands', undef, undef, TRUE, | ||
| 6406 | 1, 6, 6, 7); | ||
| 6407 | if ($self->session->redirectMode eq 'all_exits') { | ||
| 6408 | |||
| 6409 | $radioButton3->set_active(TRUE); | ||
| 6410 | } | ||
| 6411 | $radioButton3->signal_connect('toggled' => sub { | ||
| 6412 | |||
| 6413 | if ($radioButton3->get_active()) { | ||
| 6414 | |||
| 6415 | $self->session->pseudoCmd('setredirectmode -a', $self->pseudoCmdMode); | ||
| 6416 | } | ||
| 6417 | }); | ||
| 6418 | |||
| 6419 | # Right column | ||
| 6420 | $self->addLabel($grid, '<b>Auto-complete mode</b>', | ||
| 6421 | 7, 13, 0, 1); | ||
| 6422 | |||
| 6423 | my ($group11, $radioButton11) = $self->addRadioButton( | ||
| 6424 | $grid, undef, 'Don\'t auto-complete instructions/world commands', undef, | ||
| 6425 | undef, # IV set to this value when toggled | ||
| 6426 | TRUE, # Sensitive widget | ||
| 6427 | 8, 13, 1, 2); | ||
| 6428 | if ($axmud::CLIENT->autoCompleteMode eq 'none') { | ||
| 6429 | |||
| 6430 | $radioButton11->set_active(TRUE); | ||
| 6431 | } | ||
| 6432 | $radioButton11->signal_connect('toggled' => sub { | ||
| 6433 | |||
| 6434 | if ($radioButton11->get_active()) { | ||
| 6435 | |||
| 6436 | $axmud::CLIENT->set_autoCompleteMode('none'); | ||
| 6437 | } | ||
| 6438 | }); | ||
| 6439 | |||
| 6440 | my ($group12, $radioButton12) = $self->addRadioButton( | ||
| 6441 | $grid, $group11, 'Auto-complete instructions/world commands', undef, undef, TRUE, | ||
| 6442 | 8, 13, 2, 3); | ||
| 6443 | if ($axmud::CLIENT->autoCompleteMode eq 'auto') { | ||
| 6444 | |||
| 6445 | $radioButton12->set_active(TRUE); | ||
| 6446 | } | ||
| 6447 | $radioButton12->signal_connect('toggled' => sub { | ||
| 6448 | |||
| 6449 | if ($radioButton12->get_active()) { | ||
| 6450 | |||
| 6451 | $axmud::CLIENT->set_autoCompleteMode('auto'); | ||
| 6452 | } | ||
| 6453 | }); | ||
| 6454 | |||
| 6455 | $self->addLabel($grid, '<i>Auto-complete type</i>', | ||
| 6456 | 8, 13, 3, 4); | ||
| 6457 | |||
| 6458 | my ($group21, $radioButton21) = $self->addRadioButton( | ||
| 6459 | $grid, undef, 'Navigate through an instruction buffer', undef, | ||
| 6460 | undef, # IV set to this value when toggled | ||
| 6461 | TRUE, # Sensitive widget | ||
| 6462 | 8, 13, 4, 5); | ||
| 6463 | if ($axmud::CLIENT->autoCompleteType eq 'instruct') { | ||
| 6464 | |||
| 6465 | $radioButton21->set_active(TRUE); | ||
| 6466 | } | ||
| 6467 | $radioButton21->signal_connect('toggled' => sub { | ||
| 6468 | |||
| 6469 | if ($radioButton21->get_active()) { | ||
| 6470 | |||
| 6471 | $axmud::CLIENT->set_autoCompleteType('instruct'); | ||
| 6472 | } | ||
| 6473 | }); | ||
| 6474 | |||
| 6475 | my ($group22, $radioButton22) = $self->addRadioButton( | ||
| 6476 | $grid, $group21, 'Navigate through a world command buffer', undef, undef, TRUE, | ||
| 6477 | 8, 13, 5, 6); | ||
| 6478 | if ($axmud::CLIENT->autoCompleteType eq 'cmd') { | ||
| 6479 | |||
| 6480 | $radioButton22->set_active(TRUE); | ||
| 6481 | } | ||
| 6482 | $radioButton22->signal_connect('toggled' => sub { | ||
| 6483 | |||
| 6484 | if ($radioButton22->get_active()) { | ||
| 6485 | |||
| 6486 | $axmud::CLIENT->set_autoCompleteType('cmd'); | ||
| 6487 | } | ||
| 6488 | }); | ||
| 6489 | |||
| 6490 | $self->addLabel($grid, '<i>Buffer location</i>', | ||
| 6491 | 8, 13, 6, 7); | ||
| 6492 | |||
| 6493 | my ($group31, $radioButton31) = $self->addRadioButton( | ||
| 6494 | $grid, undef, 'Use combined buffers', undef, | ||
| 6495 | undef, # IV set to this value when toggled | ||
| 6496 | TRUE, # Sensitive widget | ||
| 6497 | 8, 13, 7, 8); | ||
| 6498 | if ($axmud::CLIENT->autoCompleteParent eq 'combined') { | ||
| 6499 | |||
| 6500 | $radioButton31->set_active(TRUE); | ||
| 6501 | } | ||
| 6502 | $radioButton31->signal_connect('toggled' => sub { | ||
| 6503 | |||
| 6504 | if ($radioButton31->get_active()) { | ||
| 6505 | |||
| 6506 | $axmud::CLIENT->set_autoCompleteParent('combined'); | ||
| 6507 | } | ||
| 6508 | }); | ||
| 6509 | |||
| 6510 | my ($group32, $radioButton32) = $self->addRadioButton( | ||
| 6511 | $grid, $group31, 'Use session buffers', undef, undef, TRUE, | ||
| 6512 | 8, 13, 8, 9); | ||
| 6513 | if ($axmud::CLIENT->autoCompleteParent eq 'session') { | ||
| 6514 | |||
| 6515 | $radioButton32->set_active(TRUE); | ||
| 6516 | } | ||
| 6517 | $radioButton32->signal_connect('toggled' => sub { | ||
| 6518 | |||
| 6519 | if ($radioButton32->get_active()) { | ||
| 6520 | |||
| 6521 | $axmud::CLIENT->set_autoCompleteParent('session'); | ||
| 6522 | } | ||
| 6523 | }); | ||
| 6524 | |||
| 6525 | # Tab complete | ||
| 6526 | return 1; | ||
| 6527 | } | ||
| 6528 | |||
| 6529 | sub commands4Tab { | ||
| 6530 | |||
| 6531 | # Commands4 tab | ||
| 6532 | # | ||
| 6533 | # Expected arguments | ||
| 6534 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 6535 | # | ||
| 6536 | # Return values | ||
| 6537 | # 'undef' on improper arguments | ||
| 6538 | # 1 otherwise | ||
| 6539 | |||
| 6540 | my ($self, $innerNotebook, $check) = @_; | ||
| 6541 | |||
| 6542 | # Local variables | ||
| 6543 | my (@columnList, @comboList); | ||
| 6544 | |||
| 6545 | # Check for improper arguments | ||
| 6546 | if (! defined $innerNotebook || defined $check) { | ||
| 6547 | |||
| 6548 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands4Tab', @_); | ||
| 6549 | } | ||
| 6550 | |||
| 6551 | # Tab setup | ||
| 6552 | my $grid = $self->addTab( | ||
| 6553 | $innerNotebook, | ||
| 6554 | 'Page _4', | ||
| 6555 | ['Custom user commands'], | ||
| 6556 | ); | ||
| 6557 | |||
| 6558 | # Custom user commands | ||
| 6559 | $self->addLabel($grid, '<b>Custom user commands</b>', | ||
| 6560 | 0, 12, 0, 1); | ||
| 6561 | $self->addLabel($grid, | ||
| 6562 | '<i>Customisable list of alternate forms for standard client commands</i>', | ||
| 6563 | 1, 12, 1, 2); | ||
| 6564 | |||
| 6565 | # Add a simple list | ||
| 6566 | @columnList = ( | ||
| 6567 | 'User command', 'text', | ||
| 6568 | 'Standard client command', 'text', | ||
| 6569 | ); | ||
| 6570 | |||
| 6571 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 6572 | 1, 12, 2, 10); | ||
| 6573 | |||
| 6574 | # Initialise the list | ||
| 6575 | $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 6576 | |||
| 6577 | # Add entry boxes and editing buttons | ||
| 6578 | $self->addLabel($grid, 'User command', | ||
| 6579 | 1, 3, 10, 11); | ||
| 6580 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 32, | ||
| 6581 | 3, 6, 10, 11); | ||
| 6582 | |||
| 6583 | $self->addLabel($grid, 'Standard command', | ||
| 6584 | 7, 9, 10, 11); | ||
| 6585 | @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('clientCmdHash')); | ||
| 6586 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 6587 | TRUE, # No 'undef' value used | ||
| 6588 | 9, 12, 10, 11); | ||
| 6589 | |||
| 6590 | my $button = $self->addButton($grid, 'Add', 'Add or replace a user command', undef, | ||
| 6591 | 1, 3, 11, 12); | ||
| 6592 | $button->signal_connect('clicked' => sub { | ||
| 6593 | |||
| 6594 | my ($user, $standard); | ||
| 6595 | |||
| 6596 | $user = $entry->get_text(); | ||
| 6597 | $standard = $combo->get_active_text(); | ||
| 6598 | |||
| 6599 | if ($self->checkEntryIcon($entry)) { | ||
| 6600 | |||
| 6601 | # Add this user command | ||
| 6602 | $self->session->pseudoCmd( | ||
| 6603 | 'addusercommand ' . $standard . ' ' . $user, | ||
| 6604 | $self->pseudoCmdMode, | ||
| 6605 | ); | ||
| 6606 | |||
| 6607 | # Refresh the simple list and entry boxes | ||
| 6608 | $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 6609 | $self->resetEntryBoxes($entry); | ||
| 6610 | } | ||
| 6611 | }); | ||
| 6612 | |||
| 6613 | my $button2 = $self->addButton($grid, 'Delete', 'Delete the selected user command', undef, | ||
| 6614 | 3, 5, 11, 12); | ||
| 6615 | $button2->signal_connect('clicked' => sub { | ||
| 6616 | |||
| 6617 | my ($user) = $self->getSimpleListData($slWidget, 0); | ||
| 6618 | if (defined $user) { | ||
| 6619 | |||
| 6620 | # Remove this user command | ||
| 6621 | $self->session->pseudoCmd( | ||
| 6622 | 'deleteusercommand ' . $user, | ||
| 6623 | $self->pseudoCmdMode, | ||
| 6624 | ); | ||
| 6625 | |||
| 6626 | # Refresh the simple list | ||
| 6627 | $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 6628 | $self->resetEntryBoxes($entry); | ||
| 6629 | } | ||
| 6630 | }); | ||
| 6631 | |||
| 6632 | my $button3 = $self->addButton( | ||
| 6633 | $grid, | ||
| 6634 | 'Reset user commands', | ||
| 6635 | 'Reset the list of user commands to the default list', | ||
| 6636 | undef, | ||
| 6637 | 7, 10, 11, 12); | ||
| 6638 | $button3->signal_connect('clicked' => sub { | ||
| 6639 | |||
| 6640 | $self->session->pseudoCmd('resetusercommand', $self->pseudoCmdMode); | ||
| 6641 | |||
| 6642 | # Refresh the simple list | ||
| 6643 | $self->commands4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 6644 | }); | ||
| 6645 | |||
| 6646 | my $button4 = $self->addButton($grid, | ||
| 6647 | 'Dump', 'Display the list of user commands in the \'main\' window', undef, | ||
| 6648 | 10, 12, 11, 12); | ||
| 6649 | $button4->signal_connect('clicked' => sub { | ||
| 6650 | |||
| 6651 | $self->session->pseudoCmd('listusercommand', $self->pseudoCmdMode); | ||
| 6652 | }); | ||
| 6653 | |||
| 6654 | # Tab complete | ||
| 6655 | return 1; | ||
| 6656 | } | ||
| 6657 | |||
| 6658 | sub commands4Tab_refreshList { | ||
| 6659 | |||
| 6660 | # Called by $self->commands4Tab to refresh the GA::Obj::SimpleList | ||
| 6661 | # | ||
| 6662 | # Expected arguments | ||
| 6663 | # $slWidget - The GA::Obj::SimpleList | ||
| 6664 | # $columns - The number of columns in the list | ||
| 6665 | # | ||
| 6666 | # Return values | ||
| 6667 | # 'undef' on improper arguments | ||
| 6668 | # 1 otherwise | ||
| 6669 | |||
| 6670 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 6671 | |||
| 6672 | # Local variables | ||
| 6673 | my ( | ||
| 6674 | @sortedList, @dataList, | ||
| 6675 | %hash, | ||
| 6676 | ); | ||
| 6677 | |||
| 6678 | # Check for improper arguments | ||
| 6679 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 6680 | |||
| 6681 | return $axmud::CLIENT->writeImproper( | ||
| 6682 | $self->_objClass . '->commands4Tab_refreshList', | ||
| 6683 | @_, | ||
| 6684 | ); | ||
| 6685 | } | ||
| 6686 | |||
| 6687 | # Import the hash of user commands (for quick lookup) | ||
| 6688 | %hash = $axmud::CLIENT->userCmdHash; | ||
| 6689 | @sortedList = sort {lc($a) cmp lc($b)} (keys %hash); | ||
| 6690 | |||
| 6691 | # Compile the simple list data | ||
| 6692 | foreach my $cmd (@sortedList) { | ||
| 6693 | |||
| 6694 | push (@dataList, $cmd, $hash{$cmd}); | ||
| 6695 | } | ||
| 6696 | |||
| 6697 | # Reset the simple list | ||
| 6698 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 6699 | |||
| 6700 | return 1; | ||
| 6701 | } | ||
| 6702 | |||
| 6703 | sub commands5Tab { | ||
| 6704 | |||
| 6705 | # Commands5 tab | ||
| 6706 | # | ||
| 6707 | # Expected arguments | ||
| 6708 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 6709 | # | ||
| 6710 | # Return values | ||
| 6711 | # 'undef' on improper arguments | ||
| 6712 | # 1 otherwise | ||
| 6713 | |||
| 6714 | my ($self, $innerNotebook, $check) = @_; | ||
| 6715 | |||
| 6716 | # Local variables | ||
| 6717 | my ( | ||
| 6718 | @columnList, @sortedList, @dataList, | ||
| 6719 | %hash, | ||
| 6720 | ); | ||
| 6721 | |||
| 6722 | # Check for improper arguments | ||
| 6723 | if (! defined $innerNotebook || defined $check) { | ||
| 6724 | |||
| 6725 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands5Tab', @_); | ||
| 6726 | } | ||
| 6727 | |||
| 6728 | # Tab setup | ||
| 6729 | my $grid = $self->addTab( | ||
| 6730 | $innerNotebook, | ||
| 6731 | 'Page _5', | ||
| 6732 | ['Default user commands'], | ||
| 6733 | ); | ||
| 6734 | |||
| 6735 | # Default user commands | ||
| 6736 | $self->addLabel($grid, '<b>Default user commands</b>', | ||
| 6737 | 0, 12, 0, 1); | ||
| 6738 | $self->addLabel($grid, | ||
| 6739 | '<i>Default list of alternate forms for standard client commands</i>', | ||
| 6740 | 1, 12, 1, 2); | ||
| 6741 | |||
| 6742 | # Add a simple list | ||
| 6743 | @columnList = ( | ||
| 6744 | 'User command', 'text', | ||
| 6745 | 'Standard client command', 'text', | ||
| 6746 | ); | ||
| 6747 | |||
| 6748 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 6749 | 1, 12, 2, 10); | ||
| 6750 | |||
| 6751 | # Initialise the list | ||
| 6752 | %hash = $axmud::CLIENT->constUserCmdHash; | ||
| 6753 | @sortedList = sort {$a cmp $b} (keys %hash); | ||
| 6754 | foreach my $cmd (@sortedList) { | ||
| 6755 | |||
| 6756 | push (@dataList, $cmd, $hash{$cmd}); | ||
| 6757 | } | ||
| 6758 | |||
| 6759 | $self->resetListData($slWidget, [@dataList], scalar (@columnList / 2)); | ||
| 6760 | |||
| 6761 | # Add a button | ||
| 6762 | my $button = $self->addButton($grid, | ||
| 6763 | 'Dump', 'Display the default list of user commands in the \'main\' window', undef, | ||
| 6764 | 10, 12, 11, 12); | ||
| 6765 | $button->signal_connect('clicked' => sub { | ||
| 6766 | |||
| 6767 | $self->session->pseudoCmd('listusercommand -d', $self->pseudoCmdMode); | ||
| 6768 | }); | ||
| 6769 | |||
| 6770 | # Tab complete | ||
| 6771 | return 1; | ||
| 6772 | } | ||
| 6773 | |||
| 6774 | sub commands6Tab { | ||
| 6775 | |||
| 6776 | # Commands6 tab | ||
| 6777 | # | ||
| 6778 | # Expected arguments | ||
| 6779 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 6780 | # | ||
| 6781 | # Return values | ||
| 6782 | # 'undef' on improper arguments | ||
| 6783 | # 1 otherwise | ||
| 6784 | |||
| 6785 | my ($self, $innerNotebook, $check) = @_; | ||
| 6786 | |||
| 6787 | |||
| 6788 | # Check for improper arguments | ||
| 6789 | if (! defined $innerNotebook || defined $check) { | ||
| 6790 | |||
| 6791 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commands6Tab', @_); | ||
| 6792 | } | ||
| 6793 | |||
| 6794 | # Tab setup | ||
| 6795 | my $grid = $self->addTab( | ||
| 6796 | $innerNotebook, | ||
| 6797 | 'Page _6', | ||
| 6798 | ['Client buffer settings'], | ||
| 6799 | ); | ||
| 6800 | |||
| 6801 | # Client buffer settings | ||
| 6802 | $self->addLabel($grid, '<b>Client buffer settings</b>', | ||
| 6803 | 0, 12, 0, 1); | ||
| 6804 | |||
| 6805 | # Left column - instruction buffer | ||
| 6806 | $self->addLabel($grid, '<i>Instruction buffer</i>', | ||
| 6807 | 1, 12, 1, 2); | ||
| 6808 | |||
| 6809 | $self->addLabel($grid, 'Max size', | ||
| 6810 | 1, 3, 2, 3); | ||
| 6811 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 6812 | 3, 6, 2, 3); | ||
| 6813 | |||
| 6814 | $self->addLabel($grid, 'Current size', | ||
| 6815 | 1, 3, 3, 4); | ||
| 6816 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 6817 | 3, 6, 3, 4); | ||
| 6818 | |||
| 6819 | $self->addLabel($grid, 'Total items processed', | ||
| 6820 | 1, 3, 4, 5); | ||
| 6821 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 6822 | 3, 6, 4, 5); | ||
| 6823 | |||
| 6824 | $self->addLabel($grid, 'Item number', | ||
| 6825 | 1, 3, 5, 6); | ||
| 6826 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 6827 | 3, 6, 5, 6); | ||
| 6828 | |||
| 6829 | # Right column - instruction buffer | ||
| 6830 | my $button = $self->addButton($grid, | ||
| 6831 | 'Update', 'Update the displayed data', undef, | ||
| 6832 | 9, 12, 0, 1); | ||
| 6833 | |||
| 6834 | $self->addLabel($grid, 'First item #', | ||
| 6835 | 7, 9, 2, 3); | ||
| 6836 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 6837 | 9, 12, 2, 3); | ||
| 6838 | |||
| 6839 | $self->addLabel($grid, 'Last item #', | ||
| 6840 | 7, 9, 3, 4); | ||
| 6841 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 6842 | 9, 12, 3, 4); | ||
| 6843 | |||
| 6844 | my $button2 = $self->addButton($grid, | ||
| 6845 | 'View', 'View the specified buffer item', undef, | ||
| 6846 | 7, 8, 5, 6); | ||
| 6847 | |||
| 6848 | my $button3 = $self->addButton($grid, | ||
| 6849 | 'Dump', 'Display the specified buffer item in the \'main\' window', undef, | ||
| 6850 | 8, 9, 5, 6); | ||
| 6851 | |||
| 6852 | my $button4 = $self->addButton($grid, | ||
| 6853 | 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef, | ||
| 6854 | 9, 11, 5, 6); | ||
| 6855 | |||
| 6856 | my $button5 = $self->addButton($grid, | ||
| 6857 | 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef, | ||
| 6858 | 11, 12, 5, 6); | ||
| 6859 | |||
| 6860 | # Left column - world command buffer | ||
| 6861 | $self->addLabel($grid, '<i>World command buffer</i>', | ||
| 6862 | 1, 12, 6, 7); | ||
| 6863 | |||
| 6864 | $self->addLabel($grid, 'Max size', | ||
| 6865 | 1, 3, 7, 8); | ||
| 6866 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 6867 | 3, 6, 7, 8); | ||
| 6868 | |||
| 6869 | $self->addLabel($grid, 'Current size', | ||
| 6870 | 1, 3, 8, 9); | ||
| 6871 | my $entry9 = $self->addEntry($grid, undef, FALSE, | ||
| 6872 | 3, 6, 8, 9); | ||
| 6873 | |||
| 6874 | $self->addLabel($grid, 'Total items processed', | ||
| 6875 | 1, 3, 9, 10); | ||
| 6876 | my $entry10 = $self->addEntry($grid, undef, FALSE, | ||
| 6877 | 3, 6, 9, 10); | ||
| 6878 | |||
| 6879 | $self->addLabel($grid, 'Item number', | ||
| 6880 | 1, 3, 10, 11); | ||
| 6881 | my $entry11 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 6882 | 3, 6, 10, 11); | ||
| 6883 | |||
| 6884 | # Right column - world command buffer | ||
| 6885 | $self->addLabel($grid, 'First item #', | ||
| 6886 | 7, 9, 7, 8); | ||
| 6887 | my $entry12 = $self->addEntry($grid, undef, FALSE, | ||
| 6888 | 9, 12, 7, 8); | ||
| 6889 | |||
| 6890 | $self->addLabel($grid, 'Last item #', | ||
| 6891 | 7, 9, 8, 9); | ||
| 6892 | my $entry13 = $self->addEntry($grid, undef, FALSE, | ||
| 6893 | 9, 12, 8, 9); | ||
| 6894 | |||
| 6895 | my $button6 = $self->addButton($grid, | ||
| 6896 | 'View', 'View the specified buffer item', undef, | ||
| 6897 | 7, 8, 10, 11); | ||
| 6898 | |||
| 6899 | my $button7 = $self->addButton($grid, | ||
| 6900 | 'Dump', 'Display the specified buffer item in the \'main\' window', undef, | ||
| 6901 | 8, 9, 10, 11); | ||
| 6902 | |||
| 6903 | my $button8 = $self->addButton($grid, | ||
| 6904 | 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef, | ||
| 6905 | 9, 11, 10, 11); | ||
| 6906 | |||
| 6907 | my $button9 = $self->addButton($grid, | ||
| 6908 | 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef, | ||
| 6909 | 11, 12, 10, 11); | ||
| 6910 | |||
| 6911 | # ->signal_connects | ||
| 6912 | |||
| 6913 | # 'Update' | ||
| 6914 | $button->signal_connect('clicked' => sub { | ||
| 6915 | |||
| 6916 | # Instruction buffer | ||
| 6917 | $entry->set_text($axmud::CLIENT->customInstructBufferSize); | ||
| 6918 | $entry2->set_text($axmud::CLIENT->ivPairs('instructBufferHash')); | ||
| 6919 | $entry3->set_text($axmud::CLIENT->instructBufferCount); | ||
| 6920 | |||
| 6921 | if (defined $axmud::CLIENT->instructBufferFirst) { | ||
| 6922 | |||
| 6923 | $entry5->set_text($axmud::CLIENT->instructBufferFirst); | ||
| 6924 | } | ||
| 6925 | |||
| 6926 | if (defined $axmud::CLIENT->instructBufferLast) { | ||
| 6927 | |||
| 6928 | $entry6->set_text($axmud::CLIENT->instructBufferLast); | ||
| 6929 | } | ||
| 6930 | |||
| 6931 | # World command buffer | ||
| 6932 | $entry8->set_text($axmud::CLIENT->customCmdBufferSize); | ||
| 6933 | $entry9->set_text($axmud::CLIENT->ivPairs('cmdBufferHash')); | ||
| 6934 | $entry10->set_text($axmud::CLIENT->cmdBufferCount); | ||
| 6935 | |||
| 6936 | if (defined $axmud::CLIENT->cmdBufferFirst) { | ||
| 6937 | |||
| 6938 | $entry12->set_text($axmud::CLIENT->cmdBufferFirst); | ||
| 6939 | } | ||
| 6940 | |||
| 6941 | if (defined $axmud::CLIENT->cmdBufferLast) { | ||
| 6942 | |||
| 6943 | $entry13->set_text($axmud::CLIENT->cmdBufferLast); | ||
| 6944 | } | ||
| 6945 | }); | ||
| 6946 | |||
| 6947 | # 'View' | ||
| 6948 | $button2->signal_connect('clicked' => sub { | ||
| 6949 | |||
| 6950 | my $number = $entry4->get_text(); | ||
| 6951 | |||
| 6952 | if ($self->checkEntryIcon($entry4)) { | ||
| 6953 | |||
| 6954 | # Open an 'edit' window for the specified buffer item | ||
| 6955 | $self->session->pseudoCmd( | ||
| 6956 | 'editinstructionbuffer -c ' . $number, | ||
| 6957 | $self->pseudoCmdMode, | ||
| 6958 | ); | ||
| 6959 | } | ||
| 6960 | }); | ||
| 6961 | |||
| 6962 | # 'Dump' | ||
| 6963 | $button3->signal_connect('clicked' => sub { | ||
| 6964 | |||
| 6965 | my $number = $entry4->get_text(); | ||
| 6966 | |||
| 6967 | if ($self->checkEntryIcon($entry4)) { | ||
| 6968 | |||
| 6969 | # Display the specified buffer item | ||
| 6970 | $self->session->pseudoCmd( | ||
| 6971 | 'dumpinstructionbuffer -c ' . $number, | ||
| 6972 | $self->pseudoCmdMode, | ||
| 6973 | ); | ||
| 6974 | } | ||
| 6975 | }); | ||
| 6976 | |||
| 6977 | # 'Dump last' | ||
| 6978 | $button4->signal_connect('clicked' => sub { | ||
| 6979 | |||
| 6980 | # Display most recent buffer item | ||
| 6981 | $self->session->pseudoCmd('dumpinstructionbuffer -c', $self->pseudoCmdMode); | ||
| 6982 | # Show the number of the most recent buffer item | ||
| 6983 | if (defined $axmud::CLIENT->instructBufferLast) { | ||
| 6984 | |||
| 6985 | $entry4->set_text($axmud::CLIENT->instructBufferLast); | ||
| 6986 | } | ||
| 6987 | }); | ||
| 6988 | |||
| 6989 | # 'Dump 20' | ||
| 6990 | $button5->signal_connect('clicked' => sub { | ||
| 6991 | |||
| 6992 | my ($start, $stop); | ||
| 6993 | |||
| 6994 | $stop = $axmud::CLIENT->instructBufferLast; | ||
| 6995 | $start = $stop - 19; | ||
| 6996 | if ($start < 0) { | ||
| 6997 | |||
| 6998 | $start = 0; | ||
| 6999 | } | ||
| 7000 | |||
| 7001 | # Display most recent buffer items | ||
| 7002 | $self->session->pseudoCmd( | ||
| 7003 | 'dumpinstructionbuffer -c ' . $start . ' ' . $stop, | ||
| 7004 | $self->pseudoCmdMode, | ||
| 7005 | ); | ||
| 7006 | }); | ||
| 7007 | |||
| 7008 | # 'View' | ||
| 7009 | $button6->signal_connect('clicked' => sub { | ||
| 7010 | |||
| 7011 | my $number = $entry11->get_text(); | ||
| 7012 | |||
| 7013 | if ($self->checkEntryIcon($entry11)) { | ||
| 7014 | |||
| 7015 | # Open an 'edit' window for the specified buffer item | ||
| 7016 | $self->session->pseudoCmd('editcommandbuffer -c ' . $number, $self->pseudoCmdMode); | ||
| 7017 | } | ||
| 7018 | }); | ||
| 7019 | |||
| 7020 | # 'Dump' | ||
| 7021 | $button7->signal_connect('clicked' => sub { | ||
| 7022 | |||
| 7023 | my $number = $entry11->get_text(); | ||
| 7024 | |||
| 7025 | if ($self->checkEntryIcon($entry11)) { | ||
| 7026 | |||
| 7027 | # Display the specified buffer item | ||
| 7028 | $self->session->pseudoCmd('dumpcommandbuffer -c ' . $number, $self->pseudoCmdMode); | ||
| 7029 | } | ||
| 7030 | }); | ||
| 7031 | |||
| 7032 | # 'Dump last' | ||
| 7033 | $button8->signal_connect('clicked' => sub { | ||
| 7034 | |||
| 7035 | # Display most recent buffer item | ||
| 7036 | $self->session->pseudoCmd('dumpcommandbuffer -c', $self->pseudoCmdMode); | ||
| 7037 | # Show the number of the most recent buffer item | ||
| 7038 | if (defined $axmud::CLIENT->cmdBufferLast) { | ||
| 7039 | |||
| 7040 | $entry11->set_text($axmud::CLIENT->cmdBufferLast); | ||
| 7041 | } | ||
| 7042 | }); | ||
| 7043 | |||
| 7044 | # 'Dump 20' | ||
| 7045 | $button9->signal_connect('clicked' => sub { | ||
| 7046 | |||
| 7047 | my ($start, $stop); | ||
| 7048 | |||
| 7049 | $stop = $axmud::CLIENT->cmdBufferLast; | ||
| 7050 | $start = $stop - 19; | ||
| 7051 | if ($start < 0) { | ||
| 7052 | |||
| 7053 | $start = 0; | ||
| 7054 | } | ||
| 7055 | |||
| 7056 | # Display most recent buffer items | ||
| 7057 | $self->session->pseudoCmd( | ||
| 7058 | 'dumpcommandbuffer ' . $start . ' ' . $stop, | ||
| 7059 | $self->pseudoCmdMode, | ||
| 7060 | ); | ||
| 7061 | }); | ||
| 7062 | |||
| 7063 | # Pseudo-click the button to set all the widgets | ||
| 7064 | $button->clicked(); | ||
| 7065 | |||
| 7066 | # Tab complete | ||
| 7067 | return 1; | ||
| 7068 | } | ||
| 7069 | |||
| 7070 | sub logsTab { | ||
| 7071 | |||
| 7072 | # Logs tab - called by $self->setupNotebook | ||
| 7073 | # | ||
| 7074 | # Expected arguments | ||
| 7075 | # (none besides $self) | ||
| 7076 | # | ||
| 7077 | # Return values | ||
| 7078 | # 'undef' on improper arguments | ||
| 7079 | # 1 otherwise | ||
| 7080 | |||
| 7081 | my ($self, $check) = @_; | ||
| 7082 | |||
| 7083 | # Check for improper arguments | ||
| 7084 | if (defined $check) { | ||
| 7085 | |||
| 7086 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logsTab', @_); | ||
| 7087 | } | ||
| 7088 | |||
| 7089 | # Tab setup | ||
| 7090 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 7091 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Logs'); | ||
| 7092 | |||
| 7093 | # Add tabs to the inner notebook | ||
| 7094 | $self->logs1Tab($innerNotebook); | ||
| 7095 | $self->logs2Tab($innerNotebook); | ||
| 7096 | $self->logs3Tab($innerNotebook); | ||
| 7097 | $self->logs4Tab($innerNotebook); | ||
| 7098 | |||
| 7099 | return 1; | ||
| 7100 | } | ||
| 7101 | |||
| 7102 | sub logs1Tab { | ||
| 7103 | |||
| 7104 | # Logs1 tab | ||
| 7105 | # | ||
| 7106 | # Expected arguments | ||
| 7107 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7108 | # | ||
| 7109 | # Return values | ||
| 7110 | # 'undef' on improper arguments | ||
| 7111 | # 1 otherwise | ||
| 7112 | |||
| 7113 | my ($self, $innerNotebook, $check) = @_; | ||
| 7114 | |||
| 7115 | # Check for improper arguments | ||
| 7116 | if (! defined $innerNotebook || defined $check) { | ||
| 7117 | |||
| 7118 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs1Tab', @_); | ||
| 7119 | } | ||
| 7120 | |||
| 7121 | # Tab setup | ||
| 7122 | my $grid = $self->addTab( | ||
| 7123 | $innerNotebook, | ||
| 7124 | 'Page _1', | ||
| 7125 | ['Log settings'], | ||
| 7126 | ); | ||
| 7127 | |||
| 7128 | # Log settings | ||
| 7129 | $self->addLabel($grid, '<b>Log settings</b>', | ||
| 7130 | 0, 12, 0, 1); | ||
| 7131 | |||
| 7132 | my $checkButton = $self->addCheckButton($grid,'Enable logging in general', undef, TRUE, | ||
| 7133 | 1, 12, 1, 2); | ||
| 7134 | $checkButton->set_active($axmud::CLIENT->allowLogsFlag); | ||
| 7135 | $checkButton->signal_connect('toggled' => sub { | ||
| 7136 | |||
| 7137 | $self->session->pseudoCmd('log -l', $self->pseudoCmdMode); | ||
| 7138 | $checkButton->set_active($axmud::CLIENT->allowLogsFlag); | ||
| 7139 | }); | ||
| 7140 | |||
| 7141 | my $checkButton2 = $self->addCheckButton( | ||
| 7142 | $grid, | ||
| 7143 | 'Enable deletion of standard logfiles (written by every session) when the' | ||
| 7144 | . ' client starts', | ||
| 7145 | undef, | ||
| 7146 | TRUE, | ||
| 7147 | 1, 12, 2, 3); | ||
| 7148 | $checkButton2->set_active($axmud::CLIENT->deleteStandardLogsFlag); | ||
| 7149 | $checkButton2->signal_connect('toggled' => sub { | ||
| 7150 | |||
| 7151 | $self->session->pseudoCmd('log -d', $self->pseudoCmdMode); | ||
| 7152 | $checkButton2->set_active($axmud::CLIENT->deleteStandardLogsFlag); | ||
| 7153 | }); | ||
| 7154 | |||
| 7155 | my $checkButton3 = $self->addCheckButton( | ||
| 7156 | $grid, | ||
| 7157 | 'Enable deletion of world logfiles (written by every session) when a session' | ||
| 7158 | . ' starts', | ||
| 7159 | undef, | ||
| 7160 | TRUE, | ||
| 7161 | 1, 12, 3, 4); | ||
| 7162 | $checkButton3->set_active($axmud::CLIENT->deleteWorldLogsFlag); | ||
| 7163 | $checkButton3->signal_connect('toggled' => sub { | ||
| 7164 | |||
| 7165 | $self->session->pseudoCmd('log -w', $self->pseudoCmdMode); | ||
| 7166 | $checkButton3->set_active($axmud::CLIENT->deleteWorldLogsFlag); | ||
| 7167 | }); | ||
| 7168 | |||
| 7169 | my $checkButton4 = $self->addCheckButton( | ||
| 7170 | $grid, 'Enable creation of new logfiles when the client starts', undef, TRUE, | ||
| 7171 | 1, 12, 4, 5); | ||
| 7172 | $checkButton4->set_active($axmud::CLIENT->logClientFlag); | ||
| 7173 | $checkButton4->signal_connect('toggled' => sub { | ||
| 7174 | |||
| 7175 | $self->session->pseudoCmd('log -s', $self->pseudoCmdMode); | ||
| 7176 | $checkButton4->set_active($axmud::CLIENT->logClientFlag); | ||
| 7177 | }); | ||
| 7178 | |||
| 7179 | my $checkButton5 = $self->addCheckButton( | ||
| 7180 | $grid, 'Enable creation of new logfiles at the start of every day', undef, TRUE, | ||
| 7181 | 1, 12, 5, 6); | ||
| 7182 | $checkButton5->set_active($axmud::CLIENT->logDayFlag); | ||
| 7183 | $checkButton5->signal_connect('toggled' => sub { | ||
| 7184 | |||
| 7185 | $self->session->pseudoCmd('log -y', $self->pseudoCmdMode); | ||
| 7186 | $checkButton5->set_active($axmud::CLIENT->logDayFlag); | ||
| 7187 | }); | ||
| 7188 | |||
| 7189 | my $checkButton6 = $self->addCheckButton( | ||
| 7190 | $grid, 'Lines in logfiles are prefixed by the current date', undef, TRUE, | ||
| 7191 | 1, 12, 6, 7); | ||
| 7192 | $checkButton6->set_active($axmud::CLIENT->logPrefixDateFlag); | ||
| 7193 | $checkButton6->signal_connect('toggled' => sub { | ||
| 7194 | |||
| 7195 | $self->session->pseudoCmd('log -a', $self->pseudoCmdMode); | ||
| 7196 | $checkButton6->set_active($axmud::CLIENT->logPrefixDateFlag); | ||
| 7197 | }); | ||
| 7198 | |||
| 7199 | my $checkButton7 = $self->addCheckButton( | ||
| 7200 | $grid, 'Lines in logfiles are prefixed by the current time', undef, TRUE, | ||
| 7201 | 1, 12, 7, 8); | ||
| 7202 | $checkButton7->set_active($axmud::CLIENT->logPrefixTimeFlag); | ||
| 7203 | $checkButton7->signal_connect('toggled' => sub { | ||
| 7204 | |||
| 7205 | $self->session->pseudoCmd('log -t', $self->pseudoCmdMode); | ||
| 7206 | $checkButton7->set_active($axmud::CLIENT->logPrefixTimeFlag); | ||
| 7207 | }); | ||
| 7208 | |||
| 7209 | my $checkButton8 = $self->addCheckButton( | ||
| 7210 | $grid, 'Logfiles record image filenames', undef, TRUE, | ||
| 7211 | 1, 12, 8, 9); | ||
| 7212 | $checkButton8->set_active($axmud::CLIENT->logImageFlag); | ||
| 7213 | $checkButton8->signal_connect('toggled' => sub { | ||
| 7214 | |||
| 7215 | $self->session->pseudoCmd('log -i', $self->pseudoCmdMode); | ||
| 7216 | $checkButton8->set_active($axmud::CLIENT->logImageFlag); | ||
| 7217 | }); | ||
| 7218 | |||
| 7219 | # Tab complete | ||
| 7220 | return 1; | ||
| 7221 | } | ||
| 7222 | |||
| 7223 | sub logs2Tab { | ||
| 7224 | |||
| 7225 | # Logs2 tab | ||
| 7226 | # | ||
| 7227 | # Expected arguments | ||
| 7228 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7229 | # | ||
| 7230 | # Return values | ||
| 7231 | # 'undef' on improper arguments | ||
| 7232 | # 1 otherwise | ||
| 7233 | |||
| 7234 | my ($self, $innerNotebook, $check) = @_; | ||
| 7235 | |||
| 7236 | # Check for improper arguments | ||
| 7237 | if (! defined $innerNotebook || defined $check) { | ||
| 7238 | |||
| 7239 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs2Tab', @_); | ||
| 7240 | } | ||
| 7241 | |||
| 7242 | # Tab setup | ||
| 7243 | my $grid = $self->addTab( | ||
| 7244 | $innerNotebook, | ||
| 7245 | 'Page _2', | ||
| 7246 | ['Logfile preamble'], | ||
| 7247 | ); | ||
| 7248 | |||
| 7249 | # Logfile preamble | ||
| 7250 | $self->addLabel($grid, '<b>Logfile preamble</b>', | ||
| 7251 | 0, 12, 0, 1); | ||
| 7252 | $self->addLabel($grid, '<i>Text to add to the beginning of every logfile</i>', | ||
| 7253 | 1, 12, 1, 2); | ||
| 7254 | |||
| 7255 | my $textView = $self->addTextView($grid, undef, TRUE, | ||
| 7256 | 1, 12, 2, 10); | ||
| 7257 | my $buffer = $textView->get_buffer(); | ||
| 7258 | $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList)); | ||
| 7259 | |||
| 7260 | my $button = $self->addButton( | ||
| 7261 | $grid, 'Set list', 'Set the logfile preamble', undef, | ||
| 7262 | 1, 4, 10, 11); | ||
| 7263 | $button->signal_connect('clicked' => sub { | ||
| 7264 | |||
| 7265 | my ( | ||
| 7266 | $text, | ||
| 7267 | @list, | ||
| 7268 | ); | ||
| 7269 | |||
| 7270 | $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer); | ||
| 7271 | |||
| 7272 | # Split the contents of the textview into a list, and set the IV | ||
| 7273 | $axmud::CLIENT->set_logPreamble(split("\n", $text)); | ||
| 7274 | |||
| 7275 | # Update the textview | ||
| 7276 | $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList)); | ||
| 7277 | }); | ||
| 7278 | |||
| 7279 | my $button2 = $self->addButton( | ||
| 7280 | $grid, 'Reset list', 'Resets the logfile preamble', undef, | ||
| 7281 | 9, 12, 10, 11); | ||
| 7282 | $button2->signal_connect('clicked' => sub { | ||
| 7283 | |||
| 7284 | # Update the textview | ||
| 7285 | $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList)); | ||
| 7286 | }); | ||
| 7287 | |||
| 7288 | # Tab complete | ||
| 7289 | return 1; | ||
| 7290 | } | ||
| 7291 | |||
| 7292 | sub logs3Tab { | ||
| 7293 | |||
| 7294 | # Logs3 tab | ||
| 7295 | # | ||
| 7296 | # Expected arguments | ||
| 7297 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7298 | # | ||
| 7299 | # Return values | ||
| 7300 | # 'undef' on improper arguments | ||
| 7301 | # 1 otherwise | ||
| 7302 | |||
| 7303 | my ($self, $innerNotebook, $check) = @_; | ||
| 7304 | |||
| 7305 | # Check for improper arguments | ||
| 7306 | if (! defined $innerNotebook || defined $check) { | ||
| 7307 | |||
| 7308 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs3Tab', @_); | ||
| 7309 | } | ||
| 7310 | |||
| 7311 | # Tab setup | ||
| 7312 | my $grid = $self->addTab( | ||
| 7313 | $innerNotebook, | ||
| 7314 | 'Page _3', | ||
| 7315 | ['Status task events'], | ||
| 7316 | ); | ||
| 7317 | |||
| 7318 | # Status task events | ||
| 7319 | $self->addLabel($grid, '<b>Status task events</b>', | ||
| 7320 | 0, 12, 0, 1); | ||
| 7321 | $self->addLabel( | ||
| 7322 | $grid, | ||
| 7323 | '<i>Number of logfile lines to write before/after a change in the character\'s life' | ||
| 7324 | . ' status</i>', | ||
| 7325 | 1, 12, 1, 2); | ||
| 7326 | |||
| 7327 | $self->addLabel($grid, 'Lines to write before an event (0-999)', | ||
| 7328 | 1, 6, 2, 3); | ||
| 7329 | |||
| 7330 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, 999, | ||
| 7331 | 6, 10, 2, 3); | ||
| 7332 | $entry->set_text($axmud::CLIENT->statusEventBeforeCount); | ||
| 7333 | |||
| 7334 | my $button = $self->addButton( | ||
| 7335 | $grid, | ||
| 7336 | 'Set', | ||
| 7337 | 'Set the number of lines to write before a change in life status', | ||
| 7338 | undef, | ||
| 7339 | 10, 12, 2, 3); | ||
| 7340 | $button->signal_connect('clicked' => sub { | ||
| 7341 | |||
| 7342 | my $number = $entry->get_text(); | ||
| 7343 | |||
| 7344 | if ($self->checkEntryIcon($entry)) { | ||
| 7345 | |||
| 7346 | $self->session->pseudoCmd('setstatusevent -b ' . $number, $self->pseudoCmdMode); | ||
| 7347 | } | ||
| 7348 | }); | ||
| 7349 | |||
| 7350 | $self->addLabel($grid, 'Lines to write after an event (0-999)', | ||
| 7351 | 1, 6, 3, 4); | ||
| 7352 | |||
| 7353 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 999, | ||
| 7354 | 6, 10, 3, 4); | ||
| 7355 | $entry2->set_text($axmud::CLIENT->statusEventAfterCount); | ||
| 7356 | |||
| 7357 | my $button2 = $self->addButton( | ||
| 7358 | $grid, | ||
| 7359 | 'Set', | ||
| 7360 | 'Set the number of lines to write after a change in life status', | ||
| 7361 | undef, | ||
| 7362 | 10, 12, 3, 4); | ||
| 7363 | $button2->signal_connect('clicked' => sub { | ||
| 7364 | |||
| 7365 | my $number = $entry2->get_text(); | ||
| 7366 | |||
| 7367 | if ($self->checkEntryIcon($entry2)) { | ||
| 7368 | |||
| 7369 | $self->session->pseudoCmd('setstatusevent -a ' . $number, $self->pseudoCmdMode); | ||
| 7370 | } | ||
| 7371 | }); | ||
| 7372 | |||
| 7373 | # Tab complete | ||
| 7374 | return 1; | ||
| 7375 | } | ||
| 7376 | |||
| 7377 | sub logs4Tab { | ||
| 7378 | |||
| 7379 | # Logs4 tab | ||
| 7380 | # | ||
| 7381 | # Expected arguments | ||
| 7382 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7383 | # | ||
| 7384 | # Return values | ||
| 7385 | # 'undef' on improper arguments | ||
| 7386 | # 1 otherwise | ||
| 7387 | |||
| 7388 | my ($self, $innerNotebook, $check) = @_; | ||
| 7389 | |||
| 7390 | # Local variables | ||
| 7391 | my (@columnList, @comboList); | ||
| 7392 | |||
| 7393 | # Check for improper arguments | ||
| 7394 | if (! defined $innerNotebook || defined $check) { | ||
| 7395 | |||
| 7396 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs4Tab', @_); | ||
| 7397 | } | ||
| 7398 | |||
| 7399 | # Tab setup | ||
| 7400 | my $grid = $self->addTab( | ||
| 7401 | $innerNotebook, | ||
| 7402 | 'Page _4', | ||
| 7403 | ['Client logging settings'], | ||
| 7404 | ); | ||
| 7405 | |||
| 7406 | # Client logging settings | ||
| 7407 | $self->addLabel($grid, '<b>Client logging settings</b>', | ||
| 7408 | 0, 12, 0, 1); | ||
| 7409 | $self->addLabel($grid, | ||
| 7410 | '<i>List of logfiles written by every session</i>', | ||
| 7411 | 1, 12, 1, 2); | ||
| 7412 | |||
| 7413 | # Add a simple list | ||
| 7414 | @columnList = ( | ||
| 7415 | 'Logfile', 'text', | ||
| 7416 | 'Write?', 'bool_editable', | ||
| 7417 | 'Description', 'text', | ||
| 7418 | ); | ||
| 7419 | |||
| 7420 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 7421 | 1, 12, 2, 12, | ||
| 7422 | -1, -1, | ||
| 7423 | $self->getMethodRef('logs4Tab_buttonToggled'), | ||
| 7424 | ); | ||
| 7425 | |||
| 7426 | # Initialise the list | ||
| 7427 | $self->logs4Tab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 7428 | |||
| 7429 | # Tab complete | ||
| 7430 | return 1; | ||
| 7431 | } | ||
| 7432 | |||
| 7433 | sub logs4Tab_refreshList { | ||
| 7434 | |||
| 7435 | # Resets the simple list displayed by $self->logs4Tab | ||
| 7436 | # | ||
| 7437 | # Expected arguments | ||
| 7438 | # $slWidget - The GA::Obj::SimpleList | ||
| 7439 | # $columns - The number of columns | ||
| 7440 | # | ||
| 7441 | # Return values | ||
| 7442 | # 'undef' on improper arguments | ||
| 7443 | # 1 otherwise | ||
| 7444 | |||
| 7445 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 7446 | |||
| 7447 | # Local variables | ||
| 7448 | my ( | ||
| 7449 | $hashRef, | ||
| 7450 | @dataList, | ||
| 7451 | %hash, | ||
| 7452 | ); | ||
| 7453 | |||
| 7454 | # Check for improper arguments | ||
| 7455 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 7456 | |||
| 7457 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs4Tab_refreshList', @_); | ||
| 7458 | } | ||
| 7459 | |||
| 7460 | # Compile the simple list data | ||
| 7461 | foreach my $logfile ($axmud::CLIENT->constLogOrderList) { | ||
| 7462 | |||
| 7463 | push (@dataList, | ||
| 7464 | $logfile, | ||
| 7465 | $axmud::CLIENT->ivShow('logPrefHash', $logfile), | ||
| 7466 | $axmud::CLIENT->ivShow('constLogDescripHash', $logfile), | ||
| 7467 | ); | ||
| 7468 | } | ||
| 7469 | |||
| 7470 | # Reset the simple list | ||
| 7471 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 7472 | |||
| 7473 | return 1; | ||
| 7474 | } | ||
| 7475 | |||
| 7476 | sub logs4Tab_buttonToggled { | ||
| 7477 | |||
| 7478 | # Callback from GA::Generic::EditWin->addSimpleList | ||
| 7479 | # | ||
| 7480 | # Expected arguments | ||
| 7481 | # $slWidget - The GA::Obj::SimpleList | ||
| 7482 | # $model - The Gtk3::ListStore | ||
| 7483 | # $iter - The Gtk3::TreeIter of the line clicked | ||
| 7484 | # @data - Data for all the cells on that line | ||
| 7485 | # | ||
| 7486 | # Return values | ||
| 7487 | # 'undef' on improper arguments | ||
| 7488 | # 1 otherwise | ||
| 7489 | |||
| 7490 | my ($self, $slWidget, $model, $iter, @dataList) = @_; | ||
| 7491 | |||
| 7492 | # Local variables | ||
| 7493 | my ($logfile, $flag); | ||
| 7494 | |||
| 7495 | # Check for improper arguments | ||
| 7496 | if (! defined $slWidget || ! defined $model || ! defined $iter) { | ||
| 7497 | |||
| 7498 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logs4Tab_buttonToggled', @_); | ||
| 7499 | } | ||
| 7500 | |||
| 7501 | # Update IVs | ||
| 7502 | $logfile = $dataList[0]; | ||
| 7503 | $flag = $dataList[1]; | ||
| 7504 | |||
| 7505 | if (! $axmud::CLIENT->ivExists('logPrefHash', $logfile)) { | ||
| 7506 | |||
| 7507 | # Failsafe | ||
| 7508 | return undef; | ||
| 7509 | } | ||
| 7510 | |||
| 7511 | if ( | ||
| 7512 | ($axmud::CLIENT->ivShow('logPrefHash', $logfile) && ! $flag) | ||
| 7513 | || (! $axmud::CLIENT->ivShow('logPrefHash', $logfile) && $flag) | ||
| 7514 | ) { | ||
| 7515 | $self->session->pseudoCmd('log ' . $logfile, $self->pseudoCmdMode); | ||
| 7516 | } | ||
| 7517 | |||
| 7518 | return 1; | ||
| 7519 | } | ||
| 7520 | |||
| 7521 | sub coloursTab { | ||
| 7522 | |||
| 7523 | # Colours tab - called by $self->setupNotebook | ||
| 7524 | # | ||
| 7525 | # Expected arguments | ||
| 7526 | # (none besides $self) | ||
| 7527 | # | ||
| 7528 | # Return values | ||
| 7529 | # 'undef' on improper arguments | ||
| 7530 | # 1 otherwise | ||
| 7531 | |||
| 7532 | my ($self, $check) = @_; | ||
| 7533 | |||
| 7534 | # Check for improper arguments | ||
| 7535 | if (defined $check) { | ||
| 7536 | |||
| 7537 | return $axmud::CLIENT->writeImproper($self->_objClass . '->coloursTab', @_); | ||
| 7538 | } | ||
| 7539 | |||
| 7540 | # Tab setup | ||
| 7541 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 7542 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'C_olours'); | ||
| 7543 | |||
| 7544 | # Add tabs to the inner notebook | ||
| 7545 | $self->colours1Tab($innerNotebook); | ||
| 7546 | $self->colours2Tab($innerNotebook); | ||
| 7547 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 7548 | |||
| 7549 | $self->colours3Tab($innerNotebook); | ||
| 7550 | } | ||
| 7551 | $self->colours4Tab($innerNotebook); | ||
| 7552 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 7553 | |||
| 7554 | $self->colours5Tab($innerNotebook); | ||
| 7555 | } | ||
| 7556 | |||
| 7557 | return 1; | ||
| 7558 | } | ||
| 7559 | |||
| 7560 | sub colours1Tab { | ||
| 7561 | |||
| 7562 | # Colours1 tab | ||
| 7563 | # | ||
| 7564 | # Expected arguments | ||
| 7565 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7566 | # | ||
| 7567 | # Return values | ||
| 7568 | # 'undef' on improper arguments | ||
| 7569 | # 1 otherwise | ||
| 7570 | |||
| 7571 | my ($self, $innerNotebook, $check) = @_; | ||
| 7572 | |||
| 7573 | # Local variables | ||
| 7574 | my @tagList; | ||
| 7575 | |||
| 7576 | # Check for improper arguments | ||
| 7577 | if (! defined $innerNotebook || defined $check) { | ||
| 7578 | |||
| 7579 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab', @_); | ||
| 7580 | } | ||
| 7581 | |||
| 7582 | # Tab setup | ||
| 7583 | my $grid = $self->addTab( | ||
| 7584 | $innerNotebook, | ||
| 7585 | 'Page _1', | ||
| 7586 | [$axmud::SCRIPT . ' standard (normal) colour tags'], | ||
| 7587 | ); | ||
| 7588 | |||
| 7589 | # Axmud standard (normal) colour tags | ||
| 7590 | $self->addLabel($grid, '<b>' . $axmud::SCRIPT . ' standard (normal) colour tags</b>', | ||
| 7591 | 0, 8, 0, 1); | ||
| 7592 | |||
| 7593 | # Import IV from the GA::Client | ||
| 7594 | @tagList = $axmud::CLIENT->constColourTagList; | ||
| 7595 | |||
| 7596 | for (my $row = 1; $row <= 8; $row++) { | ||
| 7597 | |||
| 7598 | $self->colours1Tab_addRow( | ||
| 7599 | $grid, | ||
| 7600 | $row, | ||
| 7601 | 'colourTagHash', | ||
| 7602 | 'constColourTagHash', | ||
| 7603 | shift @tagList, | ||
| 7604 | ); | ||
| 7605 | } | ||
| 7606 | |||
| 7607 | # Tab complete | ||
| 7608 | return 1; | ||
| 7609 | } | ||
| 7610 | |||
| 7611 | sub colours1Tab_addRow { | ||
| 7612 | |||
| 7613 | # Called by $self->colours1Tab and ->colours2Tab | ||
| 7614 | # Adds a single row of labels, entry boxes and buttons to allow configuration of a single | ||
| 7615 | # colour tag | ||
| 7616 | # | ||
| 7617 | # Expected arguments | ||
| 7618 | # $grid - The Gtk3::Grid for this tab | ||
| 7619 | # $row - The number of the row in the Gtk3::Grid displayed in this tab | ||
| 7620 | # $iv - The IV used, e.g. 'colourTagHash' | ||
| 7621 | # $defaultIV - The default colour used to set this IV, e.g. 'constColourTagHash' | ||
| 7622 | # $tag - The Axmud colour tag to edit, e.g. 'red' | ||
| 7623 | # | ||
| 7624 | # Return values | ||
| 7625 | # 'undef' on improper arguments | ||
| 7626 | # 1 otherwise | ||
| 7627 | |||
| 7628 | my ($self, $grid, $row, $iv, $defaultIV, $tag, $check) = @_; | ||
| 7629 | |||
| 7630 | # Local variables | ||
| 7631 | my ($rgbColour, $rgbDefault); | ||
| 7632 | |||
| 7633 | # Check for improper arguments | ||
| 7634 | if ( | ||
| 7635 | ! defined $grid || ! defined $row || ! defined $iv || ! defined $defaultIV | ||
| 7636 | || ! defined $tag || defined $check | ||
| 7637 | ) { | ||
| 7638 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab_addRow', @_); | ||
| 7639 | } | ||
| 7640 | |||
| 7641 | # Initialise vars | ||
| 7642 | $rgbColour = $axmud::CLIENT->ivShow($iv, $tag); | ||
| 7643 | $rgbDefault = $axmud::CLIENT->ivShow($defaultIV, $tag); | ||
| 7644 | |||
| 7645 | # Colour | ||
| 7646 | $self->addLabel($grid, $tag, | ||
| 7647 | 1, 3, $row, ($row + 1)); | ||
| 7648 | |||
| 7649 | my ($frame, $canvas, $canvasObj) = $self->addSimpleCanvas($grid, $rgbColour, undef, | ||
| 7650 | 3, 4, $row, ($row + 1)); | ||
| 7651 | |||
| 7652 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 7653 | 4, 6, $row, ($row + 1), 7, 7); | ||
| 7654 | $entry->set_text($axmud::CLIENT->ivShow($iv, $tag)); | ||
| 7655 | |||
| 7656 | my $button = $self->addButton($grid, 'Change', 'Change this colour', undef, | ||
| 7657 | 6, 7, $row, ($row + 1)); | ||
| 7658 | $button->signal_connect('clicked' => sub { | ||
| 7659 | |||
| 7660 | # Prompt the user to select a new colour, using the existing colour as an initial value | ||
| 7661 | my $rgbModify = $self->showColourSelectionDialogue( | ||
| 7662 | 'Set \'' . $tag . '\' tag', | ||
| 7663 | $rgbColour, | ||
| 7664 | ); | ||
| 7665 | |||
| 7666 | if ($rgbModify) { | ||
| 7667 | |||
| 7668 | $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $rgbModify); | ||
| 7669 | $entry->set_text($rgbModify); | ||
| 7670 | $rgbColour = $rgbModify; | ||
| 7671 | |||
| 7672 | # Modify the stored colour tag immediately | ||
| 7673 | $self->session->pseudoCmd( | ||
| 7674 | 'setcolour ' . $tag . ' ' . $rgbModify, | ||
| 7675 | $self->pseudoCmdMode, | ||
| 7676 | ); | ||
| 7677 | } | ||
| 7678 | }); | ||
| 7679 | |||
| 7680 | # Default colour | ||
| 7681 | my $button2 = $self->addButton($grid, 'Use default:', 'Use the default colour', undef, | ||
| 7682 | 8, 9, $row, ($row + 1)); | ||
| 7683 | $button2->signal_connect('clicked' => sub { | ||
| 7684 | |||
| 7685 | $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $rgbDefault); | ||
| 7686 | $entry->set_text($rgbDefault); | ||
| 7687 | |||
| 7688 | # Modify the stored colour tag immediately | ||
| 7689 | $self->session->pseudoCmd( | ||
| 7690 | 'setcolour ' . $tag . ' ' . $rgbDefault, | ||
| 7691 | $self->pseudoCmdMode, | ||
| 7692 | ); | ||
| 7693 | }); | ||
| 7694 | |||
| 7695 | $self->addSimpleCanvas($grid, $rgbDefault, undef, | ||
| 7696 | 9, 10, $row, ($row + 1)); | ||
| 7697 | |||
| 7698 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 7699 | 10, 12, $row, ($row + 1), 7, 7); | ||
| 7700 | $entry2->set_text($axmud::CLIENT->ivShow($defaultIV, $tag)); | ||
| 7701 | |||
| 7702 | return 1; | ||
| 7703 | } | ||
| 7704 | |||
| 7705 | sub colours1Tab_applyAll { | ||
| 7706 | |||
| 7707 | # Called by $self->colours1Tab and ->colours2Tab | ||
| 7708 | # Re-applies any colour scheme that uses a standard colour tag (e.g. 'red' instead of | ||
| 7709 | # '#FF0000') | ||
| 7710 | # | ||
| 7711 | # Expected arguments | ||
| 7712 | # (none besides $self) | ||
| 7713 | # | ||
| 7714 | # Return values | ||
| 7715 | # 'undef' on improper arguments | ||
| 7716 | # 1 otherwise | ||
| 7717 | |||
| 7718 | my ($self, $check) = @_; | ||
| 7719 | |||
| 7720 | # Local variables | ||
| 7721 | my %hash; | ||
| 7722 | |||
| 7723 | # Check for improper arguments | ||
| 7724 | if (defined $check) { | ||
| 7725 | |||
| 7726 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab_applyAll', @_); | ||
| 7727 | } | ||
| 7728 | |||
| 7729 | # Compile a hash of colour scheme objects that use Axmud standard colour tags | ||
| 7730 | foreach my $obj ( | ||
| 7731 | sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('colourSchemeHash')) | ||
| 7732 | ) { | ||
| 7733 | my ($type, $textFlag, $underlayFlag, $backgroundFlag); | ||
| 7734 | |||
| 7735 | # (The flags are set to TRUE if the argument is an underlay tag, FALSE if not) | ||
| 7736 | ($type, $textFlag) = $axmud::CLIENT->checkColourTags($obj->textColour); | ||
| 7737 | ($type, $underlayFlag) = $axmud::CLIENT->checkColourTags($obj->textColour); | ||
| 7738 | ($type, $backgroundFlag) = $axmud::CLIENT->checkColourTags($obj->textColour); | ||
| 7739 | |||
| 7740 | if (! $textFlag || $underlayFlag || ! $backgroundFlag) { | ||
| 7741 | |||
| 7742 | $hash{$obj->name} = undef; | ||
| 7743 | } | ||
| 7744 | } | ||
| 7745 | |||
| 7746 | if (%hash) { | ||
| 7747 | |||
| 7748 | # Update every 'internal' window | ||
| 7749 | foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) { | ||
| 7750 | |||
| 7751 | foreach my $name (keys %hash) { | ||
| 7752 | |||
| 7753 | $winObj->updateColourScheme($name); | ||
| 7754 | } | ||
| 7755 | } | ||
| 7756 | } | ||
| 7757 | |||
| 7758 | return 1; | ||
| 7759 | } | ||
| 7760 | |||
| 7761 | sub colours2Tab { | ||
| 7762 | |||
| 7763 | # Colours2 tab | ||
| 7764 | # | ||
| 7765 | # Expected arguments | ||
| 7766 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7767 | # | ||
| 7768 | # Return values | ||
| 7769 | # 'undef' on improper arguments | ||
| 7770 | # 1 otherwise | ||
| 7771 | |||
| 7772 | my ($self, $innerNotebook, $check) = @_; | ||
| 7773 | |||
| 7774 | # Local variables | ||
| 7775 | my @tagList; | ||
| 7776 | |||
| 7777 | # Check for improper arguments | ||
| 7778 | if (! defined $innerNotebook || defined $check) { | ||
| 7779 | |||
| 7780 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours2Tab', @_); | ||
| 7781 | } | ||
| 7782 | |||
| 7783 | # Tab setup | ||
| 7784 | my $grid = $self->addTab( | ||
| 7785 | $innerNotebook, | ||
| 7786 | 'Page _2', | ||
| 7787 | [$axmud::SCRIPT . ' standard (bold) colour tags'], | ||
| 7788 | ); | ||
| 7789 | |||
| 7790 | # Axmud standard (bold) colour tags | ||
| 7791 | $self->addLabel($grid, '<b>' . $axmud::SCRIPT . ' standard (bold) colour tags</b>', | ||
| 7792 | 0, 8, 0, 1); | ||
| 7793 | |||
| 7794 | # Import IV from the GA::Client | ||
| 7795 | @tagList = $axmud::CLIENT->constBoldColourTagList; | ||
| 7796 | |||
| 7797 | for (my $row = 1; $row <= 8; $row++) { | ||
| 7798 | |||
| 7799 | $self->colours1Tab_addRow( | ||
| 7800 | $grid, | ||
| 7801 | $row, | ||
| 7802 | 'boldColourTagHash', | ||
| 7803 | 'constBoldColourTagHash', | ||
| 7804 | shift @tagList, | ||
| 7805 | ); | ||
| 7806 | } | ||
| 7807 | |||
| 7808 | # Tab complete | ||
| 7809 | return 1; | ||
| 7810 | } | ||
| 7811 | |||
| 7812 | sub colours3Tab { | ||
| 7813 | |||
| 7814 | # Colours3 tab | ||
| 7815 | # | ||
| 7816 | # Expected arguments | ||
| 7817 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7818 | # | ||
| 7819 | # Return values | ||
| 7820 | # 'undef' on improper arguments | ||
| 7821 | # 1 otherwise | ||
| 7822 | |||
| 7823 | my ($self, $innerNotebook, $check) = @_; | ||
| 7824 | |||
| 7825 | # Local variables | ||
| 7826 | my @columnList; | ||
| 7827 | |||
| 7828 | # Check for improper arguments | ||
| 7829 | if (! defined $innerNotebook || defined $check) { | ||
| 7830 | |||
| 7831 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours3Tab', @_); | ||
| 7832 | } | ||
| 7833 | |||
| 7834 | # Tab setup | ||
| 7835 | my $grid = $self->addTab( | ||
| 7836 | $innerNotebook, | ||
| 7837 | 'Page _3', | ||
| 7838 | ['xterm-256 colours'], | ||
| 7839 | ); | ||
| 7840 | |||
| 7841 | # xterm-256 colours | ||
| 7842 | $self->addLabel($grid, '<b>xterm-256 colours</b>', | ||
| 7843 | 0, 12, 0, 1); | ||
| 7844 | $self->addLabel($grid, 'Current colour cube:', | ||
| 7845 | 1, 4, 1, 2); | ||
| 7846 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 7847 | 4, 8, 1, 2); | ||
| 7848 | $entry->set_text($axmud::CLIENT->currentColourCube); | ||
| 7849 | |||
| 7850 | my $button = $self->addButton( | ||
| 7851 | $grid, | ||
| 7852 | 'Switch cube', | ||
| 7853 | 'Switch between xterm and netscape colour cubes', undef, | ||
| 7854 | 8, 12, 1, 2); | ||
| 7855 | # ->signal_connect appears below | ||
| 7856 | |||
| 7857 | # Add a simple list | ||
| 7858 | @columnList = ( | ||
| 7859 | 'xterm tag', 'text', | ||
| 7860 | 'colour', 'text', | ||
| 7861 | ); | ||
| 7862 | |||
| 7863 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 7864 | 1, 12, 2, 12); | ||
| 7865 | |||
| 7866 | # Initialise the list | ||
| 7867 | $self->colours3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 7868 | |||
| 7869 | # ->signal_connect from above | ||
| 7870 | $button->signal_connect('clicked' => sub { | ||
| 7871 | |||
| 7872 | if ($axmud::CLIENT->currentColourCube eq 'xterm') { | ||
| 7873 | $self->session->pseudoCmd('setxterm -n', $self->pseudoCmdMode); | ||
| 7874 | } elsif ($axmud::CLIENT->currentColourCube eq 'netscape') { | ||
| 7875 | $self->session->pseudoCmd('setxterm -x', $self->pseudoCmdMode); | ||
| 7876 | } | ||
| 7877 | |||
| 7878 | # Update widgets | ||
| 7879 | $entry->set_text($axmud::CLIENT->currentColourCube); | ||
| 7880 | $self->colours3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 7881 | }); | ||
| 7882 | |||
| 7883 | # Tab complete | ||
| 7884 | return 1; | ||
| 7885 | } | ||
| 7886 | |||
| 7887 | sub colours3Tab_refreshList { | ||
| 7888 | |||
| 7889 | # Called by $self->colours3Tab to refresh the GA::Obj::SimpleList | ||
| 7890 | # | ||
| 7891 | # Expected arguments | ||
| 7892 | # $slWidget - The GA::Obj::SimpleList | ||
| 7893 | # $columns - The number of columns in the list | ||
| 7894 | # | ||
| 7895 | # Return values | ||
| 7896 | # 'undef' on improper arguments | ||
| 7897 | # 1 otherwise | ||
| 7898 | |||
| 7899 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 7900 | |||
| 7901 | # Local variables | ||
| 7902 | my ( | ||
| 7903 | @dataList, | ||
| 7904 | %hash, | ||
| 7905 | ); | ||
| 7906 | |||
| 7907 | # Check for improper arguments | ||
| 7908 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 7909 | |||
| 7910 | return $axmud::CLIENT->writeImproper( | ||
| 7911 | $self->_objClass . '->colours3Tab_refreshList', | ||
| 7912 | @_, | ||
| 7913 | ); | ||
| 7914 | } | ||
| 7915 | |||
| 7916 | # Import the IV (for speed) | ||
| 7917 | %hash = $axmud::CLIENT->xTermColourHash; | ||
| 7918 | |||
| 7919 | # Compile the simple list data | ||
| 7920 | for (my $count = 0; $count < 256; $count++) { | ||
| 7921 | |||
| 7922 | my $tag = 'x' . $count; | ||
| 7923 | |||
| 7924 | push (@dataList, | ||
| 7925 | $tag, | ||
| 7926 | $hash{$tag}, | ||
| 7927 | ); | ||
| 7928 | } | ||
| 7929 | |||
| 7930 | # Reset the simple list | ||
| 7931 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 7932 | |||
| 7933 | return 1; | ||
| 7934 | } | ||
| 7935 | |||
| 7936 | sub colours4Tab { | ||
| 7937 | |||
| 7938 | # Colours4 tab | ||
| 7939 | # | ||
| 7940 | # Expected arguments | ||
| 7941 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 7942 | # | ||
| 7943 | # Return values | ||
| 7944 | # 'undef' on improper arguments | ||
| 7945 | # 1 otherwise | ||
| 7946 | |||
| 7947 | my ($self, $innerNotebook, $check) = @_; | ||
| 7948 | |||
| 7949 | # Local variables | ||
| 7950 | my @comboList; | ||
| 7951 | |||
| 7952 | # Check for improper arguments | ||
| 7953 | if (! defined $innerNotebook || defined $check) { | ||
| 7954 | |||
| 7955 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours4Tab', @_); | ||
| 7956 | } | ||
| 7957 | |||
| 7958 | # Tab setup | ||
| 7959 | my $grid = $self->addTab( | ||
| 7960 | $innerNotebook, | ||
| 7961 | 'Page _4', | ||
| 7962 | ['System message colours'], | ||
| 7963 | ); | ||
| 7964 | |||
| 7965 | # Import a list of standard colour tags | ||
| 7966 | @comboList = ($axmud::CLIENT->constColourTagList, $axmud::CLIENT->constBoldColourTagList); | ||
| 7967 | |||
| 7968 | # System message colours | ||
| 7969 | $self->addLabel($grid, '<b>System message colours</b>', | ||
| 7970 | 0, 12, 0, 1); | ||
| 7971 | |||
| 7972 | $self->colours4Tab_addRow( | ||
| 7973 | $grid, | ||
| 7974 | 1, | ||
| 7975 | 'customInsertCmdColour', | ||
| 7976 | 'constInsertCmdColour', | ||
| 7977 | '-c', | ||
| 7978 | 'World command colour', | ||
| 7979 | \@comboList, | ||
| 7980 | ); | ||
| 7981 | |||
| 7982 | $self->colours4Tab_addRow( | ||
| 7983 | $grid, | ||
| 7984 | 2, | ||
| 7985 | 'customShowSystemTextColour', | ||
| 7986 | 'constShowSystemTextColour', | ||
| 7987 | '-m', | ||
| 7988 | 'System message colour', | ||
| 7989 | \@comboList, | ||
| 7990 | ); | ||
| 7991 | |||
| 7992 | $self->colours4Tab_addRow( | ||
| 7993 | $grid, | ||
| 7994 | 3, | ||
| 7995 | 'customShowErrorColour', | ||
| 7996 | 'constShowErrorColour', | ||
| 7997 | '-e', | ||
| 7998 | 'System error colour', | ||
| 7999 | \@comboList, | ||
| 8000 | ); | ||
| 8001 | |||
| 8002 | $self->colours4Tab_addRow( | ||
| 8003 | $grid, | ||
| 8004 | 4, | ||
| 8005 | 'customShowWarningColour', | ||
| 8006 | 'constShowWarningColour', | ||
| 8007 | '-w', | ||
| 8008 | 'System warning colour', | ||
| 8009 | \@comboList, | ||
| 8010 | ); | ||
| 8011 | |||
| 8012 | $self->colours4Tab_addRow( | ||
| 8013 | $grid, | ||
| 8014 | 5, | ||
| 8015 | 'customShowDebugColour', | ||
| 8016 | 'constShowDebugColour', | ||
| 8017 | '-d', | ||
| 8018 | 'System debug colour', | ||
| 8019 | \@comboList, | ||
| 8020 | ); | ||
| 8021 | |||
| 8022 | $self->colours4Tab_addRow( | ||
| 8023 | $grid, | ||
| 8024 | 6, | ||
| 8025 | 'customShowImproperColour', | ||
| 8026 | 'constShowImproperColour', | ||
| 8027 | '-i', | ||
| 8028 | 'System improper arguments colour', | ||
| 8029 | \@comboList, | ||
| 8030 | ); | ||
| 8031 | |||
| 8032 | # Tab complete | ||
| 8033 | return 1; | ||
| 8034 | } | ||
| 8035 | |||
| 8036 | sub colours4Tab_addRow { | ||
| 8037 | |||
| 8038 | # Called by $self->colours4Tab | ||
| 8039 | # Adds a single row of labels, entry boxes and buttons to allow configuration of a single | ||
| 8040 | # system colour | ||
| 8041 | # | ||
| 8042 | # Expected arguments | ||
| 8043 | # $grid - The Gtk3::Grid for this tab | ||
| 8044 | # $row - The number of the row in the Gtk3::Grid displayed in this tab | ||
| 8045 | # $iv - The IV used, e.g. 'customShowSystemTextColour' | ||
| 8046 | # $defaultIV - The default colour used to set this IV, e.g. 'constShowSystemTextColour' | ||
| 8047 | # $switch - Switch used in ';setsystemcolour' for this IV | ||
| 8048 | # $descrip - A short description, e.g. 'System message colour' | ||
| 8049 | # $listRef - Reference to a list of standard colour tags to display in a combo | ||
| 8050 | # | ||
| 8051 | # Return values | ||
| 8052 | # 'undef' on improper arguments | ||
| 8053 | # 1 otherwise | ||
| 8054 | |||
| 8055 | my ($self, $grid, $row, $iv, $defaultIV, $switch, $descrip, $listRef, $check) = @_; | ||
| 8056 | |||
| 8057 | # Local variables | ||
| 8058 | my ($colour, $default); | ||
| 8059 | |||
| 8060 | # Check for improper arguments | ||
| 8061 | if ( | ||
| 8062 | ! defined $grid || ! defined $row || ! defined $iv || ! defined $defaultIV | ||
| 8063 | || ! defined $switch || ! defined $descrip || ! defined $listRef || defined $check | ||
| 8064 | ) { | ||
| 8065 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours4Tab_addRow', @_); | ||
| 8066 | } | ||
| 8067 | |||
| 8068 | # Initialise vars | ||
| 8069 | $colour = $axmud::CLIENT->$iv; | ||
| 8070 | $default = $axmud::CLIENT->$defaultIV; | ||
| 8071 | |||
| 8072 | # Colour | ||
| 8073 | $self->addLabel($grid, $descrip, | ||
| 8074 | 1, 3, $row, ($row + 1)); | ||
| 8075 | |||
| 8076 | my ($frame, $canvas, $canvasObj) = $self->addSimpleCanvas($grid, $colour, undef, | ||
| 8077 | 3, 4, $row, ($row + 1)); | ||
| 8078 | |||
| 8079 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 8080 | 4, 6, $row, ($row + 1), | ||
| 8081 | 10, 10); | ||
| 8082 | $entry->set_text($colour); | ||
| 8083 | |||
| 8084 | my $comboBox = $self->addComboBox($grid, undef, $listRef, 'Change:', | ||
| 8085 | TRUE, # No 'undef' value used | ||
| 8086 | 6, 8, $row, ($row + 1)); | ||
| 8087 | $comboBox->signal_connect('changed' => sub { | ||
| 8088 | |||
| 8089 | my $modColour = $comboBox->get_active_text(); | ||
| 8090 | |||
| 8091 | if ($modColour ne 'Change') { | ||
| 8092 | |||
| 8093 | $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $modColour); | ||
| 8094 | $entry->set_text($modColour); | ||
| 8095 | $colour = $modColour; | ||
| 8096 | |||
| 8097 | # Update IVs immediately | ||
| 8098 | $self->session->pseudoCmd( | ||
| 8099 | 'setsystemcolour ' . $switch . ' ' . $modColour, | ||
| 8100 | $self->pseudoCmdMode, | ||
| 8101 | ); | ||
| 8102 | |||
| 8103 | # Need to reset the combo, too | ||
| 8104 | $comboBox->set_active(0); | ||
| 8105 | } | ||
| 8106 | }); | ||
| 8107 | |||
| 8108 | # Default colour | ||
| 8109 | my $button = $self->addButton($grid, 'Use default:', 'Use the default colour', undef, | ||
| 8110 | 8, 10, $row, ($row + 1)); | ||
| 8111 | $button->signal_connect('clicked' => sub { | ||
| 8112 | |||
| 8113 | $canvasObj = $self->fillSimpleCanvas($canvas, $canvasObj, $default); | ||
| 8114 | $entry->set_text($default); | ||
| 8115 | |||
| 8116 | # Update IVs immediately | ||
| 8117 | $self->session->pseudoCmd( | ||
| 8118 | 'setsystemcolour ' . $switch, | ||
| 8119 | $self->pseudoCmdMode, | ||
| 8120 | ); | ||
| 8121 | }); | ||
| 8122 | |||
| 8123 | $self->addSimpleCanvas($grid, $default, undef, | ||
| 8124 | 10, 11, $row, ($row + 1)); | ||
| 8125 | |||
| 8126 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 8127 | 11, 13, $row, ($row + 1), | ||
| 8128 | 10, 10); | ||
| 8129 | $entry2->set_text($default); | ||
| 8130 | |||
| 8131 | return 1; | ||
| 8132 | } | ||
| 8133 | |||
| 8134 | sub colours5Tab { | ||
| 8135 | |||
| 8136 | # Colours5 tab | ||
| 8137 | # | ||
| 8138 | # Expected arguments | ||
| 8139 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 8140 | # | ||
| 8141 | # Return values | ||
| 8142 | # 'undef' on improper arguments | ||
| 8143 | # 1 otherwise | ||
| 8144 | |||
| 8145 | my ($self, $innerNotebook, $check) = @_; | ||
| 8146 | |||
| 8147 | # Local variables | ||
| 8148 | my ( | ||
| 8149 | @columnList, @list, @comboList, | ||
| 8150 | %comboHash, | ||
| 8151 | ); | ||
| 8152 | |||
| 8153 | # Check for improper arguments | ||
| 8154 | if (! defined $innerNotebook || defined $check) { | ||
| 8155 | |||
| 8156 | return $axmud::CLIENT->writeImproper($self->_objClass . '->colours5Tab', @_); | ||
| 8157 | } | ||
| 8158 | |||
| 8159 | # Tab setup | ||
| 8160 | my $grid = $self->addTab( | ||
| 8161 | $innerNotebook, | ||
| 8162 | 'Page _5', | ||
| 8163 | ['Colour schemes'], | ||
| 8164 | ); | ||
| 8165 | |||
| 8166 | # Colour schemes | ||
| 8167 | $self->addLabel($grid, '<b>Colour schemes</b>', | ||
| 8168 | 0, 12, 0, 1); | ||
| 8169 | $self->addLabel($grid, '<i>List of colour schemes used by various windows</i>', | ||
| 8170 | 1, 6, 1, 2); | ||
| 8171 | |||
| 8172 | my $checkButton = $self->addCheckButton( | ||
| 8173 | $grid, 'Convert invisible text received from the world', undef, TRUE, | ||
| 8174 | 6, 12, 1, 2); | ||
| 8175 | $checkButton->set_active($axmud::CLIENT->convertInvisibleFlag); | ||
| 8176 | $checkButton->signal_connect('toggled' => sub { | ||
| 8177 | |||
| 8178 | my $flag = $checkButton->get_active(); | ||
| 8179 | |||
| 8180 | if ( | ||
| 8181 | (! $flag && ! $axmud::CLIENT->convertInvisibleFlag) | ||
| 8182 | || ($flag && $axmud::CLIENT->convertInvisibleFlag) | ||
| 8183 | ) { | ||
| 8184 | $self->session->pseudoCmd('convertText'); | ||
| 8185 | } | ||
| 8186 | }); | ||
| 8187 | |||
| 8188 | # Add a simple list | ||
| 8189 | @columnList = ( | ||
| 8190 | 'Standard', 'bool', | ||
| 8191 | 'Name', 'text', | ||
| 8192 | 'Text', 'text', | ||
| 8193 | 'Underlay', 'text', | ||
| 8194 | 'Background', 'text', | ||
| 8195 | 'Font', 'text', | ||
| 8196 | 'Font size', 'text', | ||
| 8197 | ); | ||
| 8198 | |||
| 8199 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 8200 | 1, 12, 2, 10); | ||
| 8201 | |||
| 8202 | # Initialise the list | ||
| 8203 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8204 | |||
| 8205 | # Add entry boxes and editing buttons | ||
| 8206 | $self->addLabel($grid, 'Name', | ||
| 8207 | 1, 3, 10, 11); | ||
| 8208 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 8209 | 3, 6, 10, 11); | ||
| 8210 | |||
| 8211 | my $button = $self->addButton($grid, 'Add', 'Add the specified colour scheme', undef, | ||
| 8212 | 6, 8, 10, 11); | ||
| 8213 | $button->signal_connect('clicked' => sub { | ||
| 8214 | |||
| 8215 | my $name = $entry->get_text(); | ||
| 8216 | |||
| 8217 | if ($self->checkEntryIcon($entry)) { | ||
| 8218 | |||
| 8219 | # Add this colour scheme | ||
| 8220 | $self->session->pseudoCmd('addcolourscheme ' . $name, $self->pseudoCmdMode); | ||
| 8221 | |||
| 8222 | # Refresh the simple list and entry boxes | ||
| 8223 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8224 | $self->resetEntryBoxes($entry); | ||
| 8225 | } | ||
| 8226 | }); | ||
| 8227 | |||
| 8228 | my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected colour scheme', undef, | ||
| 8229 | 8, 10, 10, 11); | ||
| 8230 | $button2->signal_connect('clicked' => sub { | ||
| 8231 | |||
| 8232 | my ($name, $obj, $childWinObj); | ||
| 8233 | |||
| 8234 | ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 8235 | if (defined $name) { | ||
| 8236 | |||
| 8237 | $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name); | ||
| 8238 | if ($obj) { | ||
| 8239 | |||
| 8240 | # Open an 'edit' window for the user to customise the colour scheme | ||
| 8241 | $childWinObj = $self->createFreeWin( | ||
| 8242 | 'Games::Axmud::EditWin::ColourScheme', | ||
| 8243 | $self, | ||
| 8244 | $self->session, | ||
| 8245 | 'Edit colour scheme \'' . $name . '\'', | ||
| 8246 | $obj, | ||
| 8247 | FALSE, # Not temporary | ||
| 8248 | ); | ||
| 8249 | |||
| 8250 | if ($childWinObj) { | ||
| 8251 | |||
| 8252 | # When the 'edit' window closes, update widgets and/or IVs | ||
| 8253 | $self->add_childDestroy( | ||
| 8254 | $childWinObj, | ||
| 8255 | 'colours5Tab_refreshList', | ||
| 8256 | [$slWidget, (scalar @columnList / 2)], | ||
| 8257 | ); | ||
| 8258 | } | ||
| 8259 | |||
| 8260 | # Refresh the simple list and entry boxes | ||
| 8261 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8262 | $self->resetEntryBoxes($entry); | ||
| 8263 | } | ||
| 8264 | } | ||
| 8265 | }); | ||
| 8266 | |||
| 8267 | my $button3 = $self->addButton($grid, 'Delete', 'Delete the selected colour scheme', undef, | ||
| 8268 | 10, 12, 10, 11); | ||
| 8269 | $button3->signal_connect('clicked' => sub { | ||
| 8270 | |||
| 8271 | my ($name, $obj); | ||
| 8272 | |||
| 8273 | ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 8274 | if (defined $name) { | ||
| 8275 | |||
| 8276 | $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name); | ||
| 8277 | if ($obj) { | ||
| 8278 | |||
| 8279 | # Delete this colour scheme | ||
| 8280 | $self->session->pseudoCmd('deletecolourscheme ' . $name, $self->pseudoCmdMode); | ||
| 8281 | |||
| 8282 | # Refresh the simple list and entry boxes | ||
| 8283 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8284 | $self->resetEntryBoxes($entry); | ||
| 8285 | } | ||
| 8286 | } | ||
| 8287 | }); | ||
| 8288 | |||
| 8289 | my $button4 = $self->addButton( | ||
| 8290 | $grid, | ||
| 8291 | 'Update windows', | ||
| 8292 | 'Update \'internal\' windows which use the selected colour scheme', | ||
| 8293 | undef, | ||
| 8294 | 1, 4, 11, 12); | ||
| 8295 | $button4->signal_connect('clicked' => sub { | ||
| 8296 | |||
| 8297 | my ($name, $obj); | ||
| 8298 | |||
| 8299 | ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 8300 | if (defined $name) { | ||
| 8301 | |||
| 8302 | $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name); | ||
| 8303 | if ($obj) { | ||
| 8304 | |||
| 8305 | # Update 'internal' windows | ||
| 8306 | $self->session->pseudoCmd('updatecolourscheme ' . $name, $self->pseudoCmdMode); | ||
| 8307 | |||
| 8308 | # Refresh the simple list and entry boxes | ||
| 8309 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8310 | $self->resetEntryBoxes($entry); | ||
| 8311 | } | ||
| 8312 | } | ||
| 8313 | }); | ||
| 8314 | |||
| 8315 | @list = ( | ||
| 8316 | 'Apply to \'main\' windows' => ' -m', | ||
| 8317 | 'Apply to \'protocol\' windows' => ' -p', | ||
| 8318 | 'Apply to \'custom\' windows' => ' -c', | ||
| 8319 | 'Apply to this session\'s \'internal\' windows' => ' -s', | ||
| 8320 | 'Apply to all \'internal\' windows' => '', # Empty switch | ||
| 8321 | ); | ||
| 8322 | |||
| 8323 | do { | ||
| 8324 | my ($descrip, $switch); | ||
| 8325 | |||
| 8326 | $descrip = shift @list; | ||
| 8327 | $switch = shift @list; | ||
| 8328 | |||
| 8329 | push (@comboList, $descrip); | ||
| 8330 | $comboHash{$descrip} = $switch; | ||
| 8331 | |||
| 8332 | } until (! @list); | ||
| 8333 | |||
| 8334 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 8335 | TRUE, # No 'undef' value used | ||
| 8336 | 4, 8, 11, 12); | ||
| 8337 | |||
| 8338 | my $button5 = $self->addButton( | ||
| 8339 | $grid, | ||
| 8340 | 'Apply', | ||
| 8341 | 'Apply the selected colour scheme', | ||
| 8342 | undef, | ||
| 8343 | 8, 10, 11, 12); | ||
| 8344 | $button5->signal_connect('clicked' => sub { | ||
| 8345 | |||
| 8346 | my ($name, $obj, $descrip, $switch); | ||
| 8347 | |||
| 8348 | ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 8349 | if (defined $name) { | ||
| 8350 | |||
| 8351 | $obj = $axmud::CLIENT->ivShow('colourSchemeHash', $name); | ||
| 8352 | } | ||
| 8353 | |||
| 8354 | $descrip = $combo->get_active_text(); | ||
| 8355 | if ($descrip) { | ||
| 8356 | |||
| 8357 | $switch = $comboHash{$descrip}; | ||
| 8358 | } | ||
| 8359 | |||
| 8360 | if ($obj && defined $switch) { | ||
| 8361 | |||
| 8362 | $self->session->pseudoCmd( | ||
| 8363 | 'applycolourscheme ' . $name . $switch, | ||
| 8364 | $self->pseudoCmdMode, | ||
| 8365 | ); | ||
| 8366 | } | ||
| 8367 | }); | ||
| 8368 | |||
| 8369 | my $button6 = $self->addButton( | ||
| 8370 | $grid, | ||
| 8371 | 'Reset list', | ||
| 8372 | 'Reset the list of colour schemes', | ||
| 8373 | undef, | ||
| 8374 | 10, 12, 11, 12); | ||
| 8375 | $button6->signal_connect('clicked' => sub { | ||
| 8376 | |||
| 8377 | # Refresh the simple list and entry boxes | ||
| 8378 | $self->colours5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8379 | $self->resetEntryBoxes($entry); | ||
| 8380 | }); | ||
| 8381 | |||
| 8382 | # Tab complete | ||
| 8383 | return 1; | ||
| 8384 | } | ||
| 8385 | |||
| 8386 | sub colours5Tab_refreshList { | ||
| 8387 | |||
| 8388 | # Called by $self->colours5Tab to refresh the GA::Obj::SimpleList | ||
| 8389 | # | ||
| 8390 | # Expected arguments | ||
| 8391 | # $slWidget - The GA::Obj::SimpleList | ||
| 8392 | # $columns - The number of columns in the list | ||
| 8393 | # | ||
| 8394 | # Return values | ||
| 8395 | # 'undef' on improper arguments | ||
| 8396 | # 1 otherwise | ||
| 8397 | |||
| 8398 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 8399 | |||
| 8400 | # Local variables | ||
| 8401 | my (@sortedList, @dataList); | ||
| 8402 | |||
| 8403 | # Check for improper arguments | ||
| 8404 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 8405 | |||
| 8406 | return $axmud::CLIENT->writeImproper( | ||
| 8407 | $self->_objClass . '->colours5Tab_refreshList', | ||
| 8408 | @_, | ||
| 8409 | ); | ||
| 8410 | } | ||
| 8411 | |||
| 8412 | # Get a sorted list of colour schemes | ||
| 8413 | @sortedList | ||
| 8414 | = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('colourSchemeHash')); | ||
| 8415 | |||
| 8416 | # Compile the simple list data | ||
| 8417 | foreach my $obj (@sortedList) { | ||
| 8418 | |||
| 8419 | my $flag; | ||
| 8420 | |||
| 8421 | if ( | ||
| 8422 | $axmud::CLIENT->ivExists('constGridWinTypeHash', $obj->name) | ||
| 8423 | || $axmud::CLIENT->ivExists('constFreeWinTypeHash', $obj->name) | ||
| 8424 | ) { | ||
| 8425 | $flag = TRUE; | ||
| 8426 | } else { | ||
| 8427 | $flag = FALSE; | ||
| 8428 | } | ||
| 8429 | |||
| 8430 | push (@dataList, | ||
| 8431 | $flag, | ||
| 8432 | $obj->name, | ||
| 8433 | $obj->textColour, | ||
| 8434 | $obj->underlayColour, | ||
| 8435 | $obj->backgroundColour, | ||
| 8436 | $obj->font, | ||
| 8437 | $obj->fontSize, | ||
| 8438 | ); | ||
| 8439 | } | ||
| 8440 | |||
| 8441 | # Reset the simple list | ||
| 8442 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 8443 | |||
| 8444 | return 1; | ||
| 8445 | } | ||
| 8446 | |||
| 8447 | sub workspacesTab { | ||
| 8448 | |||
| 8449 | # Workspaces tab - called by $self->setupNotebook | ||
| 8450 | # | ||
| 8451 | # Expected arguments | ||
| 8452 | # (none besides $self) | ||
| 8453 | # | ||
| 8454 | # Return values | ||
| 8455 | # 'undef' on improper arguments | ||
| 8456 | # 1 otherwise | ||
| 8457 | |||
| 8458 | my ($self, $check) = @_; | ||
| 8459 | |||
| 8460 | # Check for improper arguments | ||
| 8461 | if (defined $check) { | ||
| 8462 | |||
| 8463 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspacesTab', @_); | ||
| 8464 | } | ||
| 8465 | |||
| 8466 | # Tab setup | ||
| 8467 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 8468 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Workspaces'); | ||
| 8469 | |||
| 8470 | # Add tabs to the inner notebook | ||
| 8471 | $self->workspaces1Tab($innerNotebook); | ||
| 8472 | $self->workspaces2Tab($innerNotebook); | ||
| 8473 | $self->workspaces3Tab($innerNotebook); | ||
| 8474 | $self->workspaces4Tab($innerNotebook); | ||
| 8475 | $self->workspaces5Tab($innerNotebook); | ||
| 8476 | $self->workspaces6Tab($innerNotebook); | ||
| 8477 | $self->workspaces7Tab($innerNotebook); | ||
| 8478 | $self->workspaces8Tab($innerNotebook); | ||
| 8479 | |||
| 8480 | return 1; | ||
| 8481 | } | ||
| 8482 | |||
| 8483 | sub workspaces1Tab { | ||
| 8484 | |||
| 8485 | # Workspaces1 tab | ||
| 8486 | # | ||
| 8487 | # Expected arguments | ||
| 8488 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 8489 | # | ||
| 8490 | # Return values | ||
| 8491 | # 'undef' on improper arguments | ||
| 8492 | # 1 otherwise | ||
| 8493 | |||
| 8494 | my ($self, $innerNotebook, $check) = @_; | ||
| 8495 | |||
| 8496 | # Local variables | ||
| 8497 | my ( | ||
| 8498 | @list, @comboList, | ||
| 8499 | %comboHash, | ||
| 8500 | ); | ||
| 8501 | |||
| 8502 | # Check for improper arguments | ||
| 8503 | if (! defined $innerNotebook || defined $check) { | ||
| 8504 | |||
| 8505 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces1Tab', @_); | ||
| 8506 | } | ||
| 8507 | |||
| 8508 | # Tab setup | ||
| 8509 | my $grid = $self->addTab( | ||
| 8510 | $innerNotebook, | ||
| 8511 | 'Page _1', | ||
| 8512 | ['Workspace (desktop) settings', 'Workspace debug settings'], | ||
| 8513 | ); | ||
| 8514 | |||
| 8515 | # Left column | ||
| 8516 | $self->addLabel($grid, '<b>Workspace (desktop) settings</b>', | ||
| 8517 | 0, 12, 0, 1); | ||
| 8518 | |||
| 8519 | $self->addLabel($grid, 'Maximum workspace width', | ||
| 8520 | 1, 3, 1, 2); | ||
| 8521 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 8522 | 3, 6, 1, 2, 8, 8); | ||
| 8523 | $entry->set_text($axmud::CLIENT->constWorkspaceMaxWidth); | ||
| 8524 | |||
| 8525 | $self->addLabel($grid, 'Maximum workspace height', | ||
| 8526 | 1, 3, 2, 3); | ||
| 8527 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 8528 | 3, 6, 2, 3, 8, 8); | ||
| 8529 | $entry2->set_text($axmud::CLIENT->constWorkspaceMaxHeight); | ||
| 8530 | |||
| 8531 | # Right column | ||
| 8532 | $self->addLabel($grid, 'Minimum workspace width', | ||
| 8533 | 6, 8, 1, 2); | ||
| 8534 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 8535 | 8, 12, 1, 2, 8, 8); | ||
| 8536 | $entry3->set_text($axmud::CLIENT->constWorkspaceMinWidth); | ||
| 8537 | |||
| 8538 | $self->addLabel($grid, 'Minimum workspace height', | ||
| 8539 | 6, 8, 2, 3); | ||
| 8540 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 8541 | 8, 12, 2, 3, 8, 8); | ||
| 8542 | $entry4->set_text($axmud::CLIENT->constWorkspaceMinHeight); | ||
| 8543 | |||
| 8544 | # Bottom section | ||
| 8545 | $self->addLabel($grid, 'When adding workspaces,', | ||
| 8546 | 1, 3, 3, 4); | ||
| 8547 | |||
| 8548 | @list = ( | ||
| 8549 | 'move left from default workspace' => '-l', | ||
| 8550 | 'move right from default workspace' => '-r', | ||
| 8551 | 'after default workspace, start from left' => '-b', | ||
| 8552 | 'ffter default workspace, start from right' => '-e', | ||
| 8553 | ); | ||
| 8554 | |||
| 8555 | do { | ||
| 8556 | my ($string, $switch); | ||
| 8557 | |||
| 8558 | $string = shift @list; | ||
| 8559 | $switch = shift @list; | ||
| 8560 | |||
| 8561 | $comboHash{$string} = $switch; | ||
| 8562 | push (@comboList, $string); | ||
| 8563 | |||
| 8564 | } until (! @list); | ||
| 8565 | |||
| 8566 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 8567 | TRUE, # No 'undef' value used | ||
| 8568 | 3, 10, 3, 4); | ||
| 8569 | |||
| 8570 | my $button = $self->addButton($grid, | ||
| 8571 | 'Set', 'Set the default width/height', undef, | ||
| 8572 | 10, 12, 3, 4); | ||
| 8573 | $button->signal_connect('clicked' => sub { | ||
| 8574 | |||
| 8575 | my ($string, $switch); | ||
| 8576 | |||
| 8577 | $string = $combo->get_active_text(); | ||
| 8578 | $switch = $comboHash{$string}; | ||
| 8579 | if ($switch) { | ||
| 8580 | |||
| 8581 | $self->session->pseudoCmd('setworkspacedirection ' . $switch, $self->pseudoCmdMode); | ||
| 8582 | } | ||
| 8583 | }); | ||
| 8584 | |||
| 8585 | $self->addLabel($grid, '<b>Workspace debug settings</b> <i>(MS Windows only)</i>', | ||
| 8586 | 0, 12, 4, 5); | ||
| 8587 | my $checkButton = $self->addCheckButton( | ||
| 8588 | $grid, | ||
| 8589 | 'Tweak the size/position of grid windows to compensate for unresolved issues', | ||
| 8590 | undef, | ||
| 8591 | TRUE, | ||
| 8592 | 1, 12, 5, 6); | ||
| 8593 | $checkButton->set_active($axmud::CLIENT->mswinWinPosnTweakFlag); | ||
| 8594 | $checkButton->signal_connect('toggled' => sub { | ||
| 8595 | |||
| 8596 | $axmud::CLIENT->set_mswinWinPosnTweakFlag($checkButton->get_active()); | ||
| 8597 | }); | ||
| 8598 | |||
| 8599 | # Tab complete | ||
| 8600 | return 1; | ||
| 8601 | } | ||
| 8602 | |||
| 8603 | sub workspaces2Tab { | ||
| 8604 | |||
| 8605 | # Workspaces2 tab | ||
| 8606 | # | ||
| 8607 | # Expected arguments | ||
| 8608 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 8609 | # | ||
| 8610 | # Return values | ||
| 8611 | # 'undef' on improper arguments | ||
| 8612 | # 1 otherwise | ||
| 8613 | |||
| 8614 | my ($self, $innerNotebook, $check) = @_; | ||
| 8615 | |||
| 8616 | # Check for improper arguments | ||
| 8617 | if (! defined $innerNotebook || defined $check) { | ||
| 8618 | |||
| 8619 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces2Tab', @_); | ||
| 8620 | } | ||
| 8621 | |||
| 8622 | # Tab setup | ||
| 8623 | my $grid = $self->addTab( | ||
| 8624 | $innerNotebook, | ||
| 8625 | 'Page _2', | ||
| 8626 | ['Workspace panel/window controls sizes'], | ||
| 8627 | ); | ||
| 8628 | |||
| 8629 | # Workspace panel/window controls sizes | ||
| 8630 | $self->addLabel($grid, '<b>Workspace panel/window controls sizes</b>', | ||
| 8631 | 0, 12, 0, 1); | ||
| 8632 | $self->addLabel( | ||
| 8633 | $grid, | ||
| 8634 | '<i>Custom panel sizes. If set, used for all workspaces. If not set, sizes are' | ||
| 8635 | . ' detected in all workspaces</i>', | ||
| 8636 | 1, 12, 1, 2); | ||
| 8637 | |||
| 8638 | $self->workspaces2Tab_panelRow($grid, 'Left panel', 'customPanelLeftSize', '-l', 2); | ||
| 8639 | $self->workspaces2Tab_panelRow($grid, 'Right panel', 'customPanelRightSize', '-r', 3); | ||
| 8640 | $self->workspaces2Tab_panelRow($grid, 'Top panel', 'customPanelTopSize', '-t', 4); | ||
| 8641 | $self->workspaces2Tab_panelRow($grid, 'Bottom panel', 'customPanelBottomSize', '-b', 5); | ||
| 8642 | |||
| 8643 | # Window controls sizes | ||
| 8644 | $self->addLabel( | ||
| 8645 | $grid, | ||
| 8646 | '<i>Window controls sizes. If all are set, used for all workspaces. If any are not set,' | ||
| 8647 | . ' sizes are detected in all workspaces</i>', | ||
| 8648 | 1, 12, 6, 7); | ||
| 8649 | |||
| 8650 | $self->workspaces2Tab_controlsRow($grid, 'Left edge', 'customControlsLeftSize', '-l', 7); | ||
| 8651 | $self->workspaces2Tab_controlsRow($grid, 'Right edge', 'customControlsRightSize', '-r', 8); | ||
| 8652 | $self->workspaces2Tab_controlsRow($grid, 'Top edge', 'customControlsTopSize', '-t', 9); | ||
| 8653 | $self->workspaces2Tab_controlsRow( | ||
| 8654 | $grid, | ||
| 8655 | 'Bottom edge', | ||
| 8656 | 'customControlsBottomSize', | ||
| 8657 | '-b', | ||
| 8658 | 10, | ||
| 8659 | ); | ||
| 8660 | |||
| 8661 | # Tab complete | ||
| 8662 | return 1; | ||
| 8663 | } | ||
| 8664 | |||
| 8665 | sub workspaces2Tab_panelRow { | ||
| 8666 | |||
| 8667 | # Called by $self->workspaces2Tab; adds a row of widgets for a single GA::Client IV | ||
| 8668 | # | ||
| 8669 | # Expected arguments | ||
| 8670 | # $grid - The Gtk3::Grid for this tab | ||
| 8671 | # $text - The label text to use, e.g. 'Left panel' | ||
| 8672 | # $iv - The IV set by these widgets, e.g. ->customPanelLeftSize | ||
| 8673 | # $switch - The switch to use in a ';setpanel' command, e.g. '-l' | ||
| 8674 | # $row - The row number on the Gtk3::Grid | ||
| 8675 | # | ||
| 8676 | # Return values | ||
| 8677 | # 'undef' on improper arguments or if the check fails | ||
| 8678 | # 1 otherwise | ||
| 8679 | |||
| 8680 | my ($self, $grid, $text, $iv, $switch, $row, $check) = @_; | ||
| 8681 | |||
| 8682 | # Check for improper arguments | ||
| 8683 | if ( | ||
| 8684 | ! defined $grid || ! defined $text || ! defined $iv || ! defined $switch | ||
| 8685 | || ! defined $row || defined $check | ||
| 8686 | ) { | ||
| 8687 | return $axmud::CLIENT->writeImproper( | ||
| 8688 | $self->_objClass . '->workspaces2Tab_panelRow', | ||
| 8689 | @_ | ||
| 8690 | ); | ||
| 8691 | } | ||
| 8692 | |||
| 8693 | $self->addLabel($grid, $text, | ||
| 8694 | 1, 3, $row, ($row + 1)); | ||
| 8695 | |||
| 8696 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 8697 | 3, 6, $row, ($row + 1), 16, 16); | ||
| 8698 | if (! defined ($axmud::CLIENT->$iv)) { | ||
| 8699 | $entry->set_text('(not set)'); | ||
| 8700 | } else { | ||
| 8701 | $entry->set_text($axmud::CLIENT->$iv); | ||
| 8702 | } | ||
| 8703 | |||
| 8704 | my $entry2 = $self->addEntryWithIcon( | ||
| 8705 | $grid, undef, 'int', 0, undef, | ||
| 8706 | 6, 8, $row, ($row + 1), 8, 8); | ||
| 8707 | |||
| 8708 | my $button = $self->addButton($grid, | ||
| 8709 | 'Set', 'Set the panel size', undef, | ||
| 8710 | 8, 10, $row, ($row + 1)); | ||
| 8711 | $button->signal_connect('clicked' => sub { | ||
| 8712 | |||
| 8713 | my $size = $entry2->get_text(); | ||
| 8714 | if ($self->checkEntryIcon($entry2)) { | ||
| 8715 | |||
| 8716 | $self->session->pseudoCmd( | ||
| 8717 | 'setpanel ' . $switch . ' ' . $size, | ||
| 8718 | $self->pseudoCmdMode, | ||
| 8719 | ); | ||
| 8720 | } | ||
| 8721 | |||
| 8722 | if (! defined ($axmud::CLIENT->$iv)) { | ||
| 8723 | $entry->set_text('(not set)'); | ||
| 8724 | } else { | ||
| 8725 | $entry->set_text($axmud::CLIENT->$iv); | ||
| 8726 | } | ||
| 8727 | |||
| 8728 | $entry2->set_text(''); | ||
| 8729 | }); | ||
| 8730 | |||
| 8731 | my $button2 = $self->addButton($grid, | ||
| 8732 | 'Don\'t use', 'Detect this panel size on every workspace', undef, | ||
| 8733 | 10, 12, $row, ($row + 1)); | ||
| 8734 | $button2->signal_connect('clicked' => sub { | ||
| 8735 | |||
| 8736 | $self->session->pseudoCmd('setpanel ' . $switch, $self->pseudoCmdMode); | ||
| 8737 | |||
| 8738 | $entry->set_text('(not set)'); | ||
| 8739 | $entry2->set_text(''); | ||
| 8740 | }); | ||
| 8741 | |||
| 8742 | return 1; | ||
| 8743 | } | ||
| 8744 | |||
| 8745 | sub workspaces2Tab_controlsRow { | ||
| 8746 | |||
| 8747 | # Called by $self->workspaces2Tab; adds a row of widgets for a single GA::Client IV | ||
| 8748 | # | ||
| 8749 | # Expected arguments | ||
| 8750 | # $grid - The Gtk3::Grid for this tab | ||
| 8751 | # $text - The label text to use, e.g. 'Left side' | ||
| 8752 | # $iv - The IV set by these widgets, e.g. ->customControlsLeftSize | ||
| 8753 | # $switch - The switch to use in a ';setwindowcontrols' command, e.g. '-l' | ||
| 8754 | # $row - The row number on the Gtk3::Grid | ||
| 8755 | # | ||
| 8756 | # Return values | ||
| 8757 | # 'undef' on improper arguments or if the check fails | ||
| 8758 | # 1 otherwise | ||
| 8759 | |||
| 8760 | my ($self, $grid, $text, $iv, $switch, $row, $check) = @_; | ||
| 8761 | |||
| 8762 | # Check for improper arguments | ||
| 8763 | if ( | ||
| 8764 | ! defined $grid || ! defined $text || ! defined $iv || ! defined $switch | ||
| 8765 | || ! defined $row || defined $check | ||
| 8766 | ) { | ||
| 8767 | return $axmud::CLIENT->writeImproper( | ||
| 8768 | $self->_objClass . '->workspaces2Tab_controlsRow', | ||
| 8769 | @_, | ||
| 8770 | ); | ||
| 8771 | } | ||
| 8772 | |||
| 8773 | $self->addLabel($grid, $text, | ||
| 8774 | 1, 3, $row, ($row + 1)); | ||
| 8775 | |||
| 8776 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 8777 | 3, 6, $row, ($row + 1), 16, 16); | ||
| 8778 | if (! defined ($axmud::CLIENT->$iv)) { | ||
| 8779 | $entry->set_text('(not set)'); | ||
| 8780 | } else { | ||
| 8781 | $entry->set_text($axmud::CLIENT->$iv); | ||
| 8782 | } | ||
| 8783 | |||
| 8784 | my $entry2 = $self->addEntryWithIcon( | ||
| 8785 | $grid, undef, 'int', 0, undef, | ||
| 8786 | 6, 8, $row, ($row + 1), 8, 8); | ||
| 8787 | |||
| 8788 | my $button = $self->addButton($grid, | ||
| 8789 | 'Set', 'Set the window controls size', undef, | ||
| 8790 | 8, 10, $row, ($row + 1)); | ||
| 8791 | $button->signal_connect('clicked' => sub { | ||
| 8792 | |||
| 8793 | my $size = $entry2->get_text(); | ||
| 8794 | if ($self->checkEntryIcon($entry2)) { | ||
| 8795 | |||
| 8796 | $self->session->pseudoCmd( | ||
| 8797 | 'setwindowcontrols ' . $switch . ' ' . $size, | ||
| 8798 | $self->pseudoCmdMode, | ||
| 8799 | ); | ||
| 8800 | } | ||
| 8801 | |||
| 8802 | if (! defined ($axmud::CLIENT->$iv)) { | ||
| 8803 | $entry->set_text('(not set)'); | ||
| 8804 | } else { | ||
| 8805 | $entry->set_text($axmud::CLIENT->$iv); | ||
| 8806 | } | ||
| 8807 | |||
| 8808 | $entry2->set_text(''); | ||
| 8809 | }); | ||
| 8810 | |||
| 8811 | my $button2 = $self->addButton($grid, | ||
| 8812 | 'Don\'t use', 'Detect this window controls size on every workspace', undef, | ||
| 8813 | 10, 12, $row, ($row + 1)); | ||
| 8814 | $button2->signal_connect('clicked' => sub { | ||
| 8815 | |||
| 8816 | $self->session->pseudoCmd('setwindowcontrols ' . $switch, $self->pseudoCmdMode); | ||
| 8817 | |||
| 8818 | $entry->set_text('(not set)'); | ||
| 8819 | $entry2->set_text(''); | ||
| 8820 | }); | ||
| 8821 | |||
| 8822 | return 1; | ||
| 8823 | } | ||
| 8824 | |||
| 8825 | sub workspaces3Tab { | ||
| 8826 | |||
| 8827 | # Workspaces3 tab | ||
| 8828 | # | ||
| 8829 | # Expected arguments | ||
| 8830 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 8831 | # | ||
| 8832 | # Return values | ||
| 8833 | # 'undef' on improper arguments | ||
| 8834 | # 1 otherwise | ||
| 8835 | |||
| 8836 | my ($self, $innerNotebook, $check) = @_; | ||
| 8837 | |||
| 8838 | # Local variables | ||
| 8839 | my ( | ||
| 8840 | $title, | ||
| 8841 | @columnList, @columnList2, @comboList, | ||
| 8842 | ); | ||
| 8843 | |||
| 8844 | # Check for improper arguments | ||
| 8845 | if (! defined $innerNotebook || defined $check) { | ||
| 8846 | |||
| 8847 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces3Tab', @_); | ||
| 8848 | } | ||
| 8849 | |||
| 8850 | # Tab setup | ||
| 8851 | my $grid = $self->addTab( | ||
| 8852 | $innerNotebook, | ||
| 8853 | 'Page _3', | ||
| 8854 | ['Workspaces'], | ||
| 8855 | ); | ||
| 8856 | |||
| 8857 | # Workspaces | ||
| 8858 | $self->addLabel($grid, '<b>Workspaces</b>', | ||
| 8859 | 0, 12, 0, 1); | ||
| 8860 | $self->addLabel($grid, | ||
| 8861 | '<i>List of workspace objects (one for each workspace in use by ' . $axmud::SCRIPT | ||
| 8862 | . ')</i>', | ||
| 8863 | 1, 12, 1, 2); | ||
| 8864 | |||
| 8865 | # Add a simple list | ||
| 8866 | @columnList = ( | ||
| 8867 | 'Object num', 'int', | ||
| 8868 | 'Default', 'bool', | ||
| 8869 | 'System num', 'text', | ||
| 8870 | 'System name', 'text', | ||
| 8871 | 'Width', 'int', | ||
| 8872 | 'Height', 'int', | ||
| 8873 | 'Default zonemap', 'text', | ||
| 8874 | ); | ||
| 8875 | |||
| 8876 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 8877 | 1, 12, 2, 6); | ||
| 8878 | |||
| 8879 | # Initialise the list | ||
| 8880 | $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8881 | |||
| 8882 | # Add another simple list | ||
| 8883 | $self->addLabel($grid, | ||
| 8884 | '<i>List of available (but unused) workspaces</i>', | ||
| 8885 | 1, 12, 7, 8); | ||
| 8886 | |||
| 8887 | @columnList2 = ( | ||
| 8888 | 'System num', 'int', | ||
| 8889 | ); | ||
| 8890 | |||
| 8891 | my $slWidget2 = $self->addSimpleList($grid, undef, \@columnList2, | ||
| 8892 | 1, 12, 8, 12); | ||
| 8893 | |||
| 8894 | # Initialise the list | ||
| 8895 | $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2)); | ||
| 8896 | |||
| 8897 | # Add editing widgets for both simple lists | ||
| 8898 | my $button = $self->addButton($grid, 'View...', 'View this workspace\'s settings', undef, | ||
| 8899 | 1, 3, 6, 7); | ||
| 8900 | $button->signal_connect('clicked' => sub { | ||
| 8901 | |||
| 8902 | my ($number, $obj); | ||
| 8903 | |||
| 8904 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 8905 | if (defined $number) { | ||
| 8906 | |||
| 8907 | $obj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $number); | ||
| 8908 | if ($obj) { | ||
| 8909 | |||
| 8910 | # Open an 'edit' window for the selected workspace object | ||
| 8911 | $self->createFreeWin( | ||
| 8912 | 'Games::Axmud::EditWin::Workspace', | ||
| 8913 | $self, | ||
| 8914 | $self->session,, | ||
| 8915 | 'Edit workspace object #' . $obj->number, | ||
| 8916 | $obj, | ||
| 8917 | FALSE, # Not temporary | ||
| 8918 | ); | ||
| 8919 | } | ||
| 8920 | } | ||
| 8921 | }); | ||
| 8922 | |||
| 8923 | my $button2 = $self->addButton( | ||
| 8924 | $grid, | ||
| 8925 | 'Remove', | ||
| 8926 | 'Stop using this workspace for ' . $axmud::SCRIPT . ' windows', | ||
| 8927 | undef, | ||
| 8928 | 3, 5, 6, 7); | ||
| 8929 | $button2->signal_connect('clicked' => sub { | ||
| 8930 | |||
| 8931 | my ($num) = $self->getSimpleListData($slWidget, 0); | ||
| 8932 | if (defined $num) { | ||
| 8933 | |||
| 8934 | $self->session->pseudoCmd( | ||
| 8935 | 'removeworkspace ' . $num, | ||
| 8936 | $self->pseudoCmdMode, | ||
| 8937 | ); | ||
| 8938 | } | ||
| 8939 | |||
| 8940 | # Update simple lists | ||
| 8941 | $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8942 | $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2)); | ||
| 8943 | }); | ||
| 8944 | |||
| 8945 | $title = '(Optional) default zonemap'; | ||
| 8946 | @comboList = (sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'))); | ||
| 8947 | |||
| 8948 | my $combo = $self->addComboBox($grid, undef, \@comboList, $title, | ||
| 8949 | TRUE, # No 'undef' value used | ||
| 8950 | 1, 5, 12, 13); | ||
| 8951 | |||
| 8952 | my $button3 = $self->addButton($grid, 'Use', 'Use the selected workspace', undef, | ||
| 8953 | 5, 7, 12, 13); | ||
| 8954 | $button3->signal_connect('clicked' => sub { | ||
| 8955 | |||
| 8956 | my ($num, $name, $zonemap, $string); | ||
| 8957 | |||
| 8958 | ($num) = $self->getSimpleListData($slWidget2, 0); | ||
| 8959 | ($name) = $self->getSimpleListData($slWidget2, 1); | ||
| 8960 | $zonemap = $combo->get_active_text(); | ||
| 8961 | if ($zonemap && $zonemap eq $title) { | ||
| 8962 | |||
| 8963 | $zonemap = undef; | ||
| 8964 | } | ||
| 8965 | |||
| 8966 | if ($zonemap) { | ||
| 8967 | $string = ' -z ' . $zonemap; | ||
| 8968 | } else { | ||
| 8969 | $string = ''; | ||
| 8970 | } | ||
| 8971 | |||
| 8972 | # Use either system number or name, depending on which is available (probably, both of | ||
| 8973 | # them are) | ||
| 8974 | if (defined $num) { | ||
| 8975 | |||
| 8976 | $self->session->pseudoCmd( | ||
| 8977 | 'useworkspace ' . $num . $string, | ||
| 8978 | $self->pseudoCmdMode, | ||
| 8979 | ); | ||
| 8980 | |||
| 8981 | } elsif (defined $name) { | ||
| 8982 | |||
| 8983 | $self->session->pseudoCmd( | ||
| 8984 | 'useworkspace ' . $name . $string, | ||
| 8985 | $self->pseudoCmdMode, | ||
| 8986 | ); | ||
| 8987 | } | ||
| 8988 | |||
| 8989 | # Update simple lists | ||
| 8990 | $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 8991 | $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2)); | ||
| 8992 | }); | ||
| 8993 | |||
| 8994 | my $button4 = $self->addButton( | ||
| 8995 | $grid, | ||
| 8996 | 'Refresh lists', | ||
| 8997 | 'Refresh the lists of workspaces', | ||
| 8998 | undef, | ||
| 8999 | 10, 12, 12, 13); | ||
| 9000 | $button4->signal_connect('clicked' => sub { | ||
| 9001 | |||
| 9002 | # Update simple lists | ||
| 9003 | $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9004 | $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2)); | ||
| 9005 | }); | ||
| 9006 | |||
| 9007 | # Tab complete | ||
| 9008 | return 1; | ||
| 9009 | } | ||
| 9010 | |||
| 9011 | sub workspaces3Tab_refreshList { | ||
| 9012 | |||
| 9013 | # Called by $self->workspaces3Tab to refresh the first GA::Obj::SimpleList | ||
| 9014 | # | ||
| 9015 | # Expected arguments | ||
| 9016 | # $slWidget - The GA::Obj::SimpleList | ||
| 9017 | # $columns - The number of columns in the list | ||
| 9018 | # | ||
| 9019 | # Return values | ||
| 9020 | # 'undef' on improper arguments | ||
| 9021 | # 1 otherwise | ||
| 9022 | |||
| 9023 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 9024 | |||
| 9025 | # Local variables | ||
| 9026 | my @dataList; | ||
| 9027 | |||
| 9028 | # Check for improper arguments | ||
| 9029 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 9030 | |||
| 9031 | return $axmud::CLIENT->writeImproper( | ||
| 9032 | $self->_objClass . '->workspaces3Tab_refreshList', | ||
| 9033 | @_, | ||
| 9034 | ); | ||
| 9035 | } | ||
| 9036 | |||
| 9037 | # Compile the simple list data | ||
| 9038 | foreach my $obj ( | ||
| 9039 | sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash')) | ||
| 9040 | ) { | ||
| 9041 | my ($flag, $name); | ||
| 9042 | |||
| 9043 | if (! $obj->number) { | ||
| 9044 | $flag = TRUE; | ||
| 9045 | } else { | ||
| 9046 | $flag = FALSE; | ||
| 9047 | } | ||
| 9048 | |||
| 9049 | push (@dataList, | ||
| 9050 | $obj->number, | ||
| 9051 | $flag, | ||
| 9052 | $obj->systemNum, | ||
| 9053 | $name, | ||
| 9054 | $obj->currentWidth, | ||
| 9055 | $obj->currentHeight, | ||
| 9056 | $obj->defaultZonemap, | ||
| 9057 | ); | ||
| 9058 | } | ||
| 9059 | |||
| 9060 | # Reset the simple list | ||
| 9061 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 9062 | |||
| 9063 | return 1; | ||
| 9064 | } | ||
| 9065 | |||
| 9066 | sub workspaces3Tab_refreshList2 { | ||
| 9067 | |||
| 9068 | # Called by $self->workspaces3Tab to refresh the second GA::Obj::SimpleList | ||
| 9069 | # | ||
| 9070 | # Expected arguments | ||
| 9071 | # $slWidget - The GA::Obj::SimpleList | ||
| 9072 | # $columns - The number of columns in the list | ||
| 9073 | # | ||
| 9074 | # Return values | ||
| 9075 | # 'undef' on improper arguments | ||
| 9076 | # 1 otherwise | ||
| 9077 | |||
| 9078 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 9079 | |||
| 9080 | # Local variables | ||
| 9081 | my (@workspaceList, @dataList); | ||
| 9082 | |||
| 9083 | # Check for improper arguments | ||
| 9084 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 9085 | |||
| 9086 | return $axmud::CLIENT->writeImproper( | ||
| 9087 | $self->_objClass . '->workspaces3Tab_refreshList2', | ||
| 9088 | @_, | ||
| 9089 | ); | ||
| 9090 | } | ||
| 9091 | |||
| 9092 | # Get an ordered list of unused workspaces | ||
| 9093 | @dataList = $axmud::CLIENT->desktopObj->detectUnusedWorkspaces(); | ||
| 9094 | |||
| 9095 | # Reset the simple list | ||
| 9096 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 9097 | |||
| 9098 | return 1; | ||
| 9099 | } | ||
| 9100 | |||
| 9101 | sub workspaces4Tab { | ||
| 9102 | |||
| 9103 | # Workspaces4 tab | ||
| 9104 | # | ||
| 9105 | # Expected arguments | ||
| 9106 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 9107 | # | ||
| 9108 | # Return values | ||
| 9109 | # 'undef' on improper arguments | ||
| 9110 | # 1 otherwise | ||
| 9111 | |||
| 9112 | my ($self, $innerNotebook, $check) = @_; | ||
| 9113 | |||
| 9114 | # Local variables | ||
| 9115 | my ( | ||
| 9116 | $defaultString, | ||
| 9117 | @columnList, @comboList, | ||
| 9118 | ); | ||
| 9119 | |||
| 9120 | # Check for improper arguments | ||
| 9121 | if (! defined $innerNotebook || defined $check) { | ||
| 9122 | |||
| 9123 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces4Tab', @_); | ||
| 9124 | } | ||
| 9125 | |||
| 9126 | # Tab setup | ||
| 9127 | my $grid = $self->addTab( | ||
| 9128 | $innerNotebook, | ||
| 9129 | 'Page _4', | ||
| 9130 | ['Initial workspaces'], | ||
| 9131 | ); | ||
| 9132 | |||
| 9133 | # Initial workspaces | ||
| 9134 | $self->addLabel($grid, '<b>Initial workspaces</b>', | ||
| 9135 | 0, 12, 0, 1); | ||
| 9136 | $self->addLabel($grid, | ||
| 9137 | '<i>List of workspaces to use when ' . $axmud::SCRIPT . ' starts</i>', | ||
| 9138 | 1, 12, 1, 2); | ||
| 9139 | |||
| 9140 | # Add a simple list | ||
| 9141 | @columnList = ( | ||
| 9142 | 'Number', 'int', | ||
| 9143 | 'Default zonemap', 'text', | ||
| 9144 | ); | ||
| 9145 | |||
| 9146 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 9147 | 1, 12, 2, 10); | ||
| 9148 | |||
| 9149 | # Initialise the list | ||
| 9150 | $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9151 | |||
| 9152 | # Add editing widgets | ||
| 9153 | $self->addLabel($grid, 'Zonemap', | ||
| 9154 | 1, 3, 10, 11); | ||
| 9155 | |||
| 9156 | @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash')); | ||
| 9157 | $defaultString = '(use default zonemap)'; | ||
| 9158 | unshift (@comboList, $defaultString); | ||
| 9159 | |||
| 9160 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 9161 | TRUE, # No 'undef' value used | ||
| 9162 | 3, 6, 10, 11); | ||
| 9163 | |||
| 9164 | my $button = $self->addButton( | ||
| 9165 | $grid, | ||
| 9166 | 'Add workspace', | ||
| 9167 | 'Add an initial workspace to those used when ' . $axmud::SCRIPT . ' starts', | ||
| 9168 | undef, | ||
| 9169 | 6, 9, 10, 11); | ||
| 9170 | $button->signal_connect('clicked' => sub { | ||
| 9171 | |||
| 9172 | my $zonemap = $combo->get_active_text(); | ||
| 9173 | if ($zonemap eq $defaultString) { | ||
| 9174 | $self->session->pseudoCmd('addinitialworkspace', $self->pseudoCmdMode); | ||
| 9175 | } else { | ||
| 9176 | $self->session->pseudoCmd('addinitialworkspace ' . $zonemap, $self->pseudoCmdMode); | ||
| 9177 | } | ||
| 9178 | |||
| 9179 | # Refresh the list | ||
| 9180 | $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9181 | $combo->set_active(0); | ||
| 9182 | }); | ||
| 9183 | |||
| 9184 | my $button2 = $self->addButton( | ||
| 9185 | $grid, | ||
| 9186 | 'Modify workspace', | ||
| 9187 | 'Modify the selected workspace to use this zonemap', | ||
| 9188 | undef, | ||
| 9189 | 9, 12, 10, 11); | ||
| 9190 | $button2->signal_connect('clicked' => sub { | ||
| 9191 | |||
| 9192 | my ($number, $zonemap); | ||
| 9193 | |||
| 9194 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 9195 | $zonemap = $combo->get_active_text(); | ||
| 9196 | |||
| 9197 | if (defined $number) { | ||
| 9198 | |||
| 9199 | if ($zonemap eq $defaultString) { | ||
| 9200 | |||
| 9201 | $self->session->pseudoCmd( | ||
| 9202 | 'modifyinitialworkspace ' . $number, | ||
| 9203 | $self->pseudoCmdMode, | ||
| 9204 | ); | ||
| 9205 | |||
| 9206 | } else { | ||
| 9207 | |||
| 9208 | $self->session->pseudoCmd( | ||
| 9209 | 'modifyinitialworkspace ' . $number . ' ' . $zonemap, | ||
| 9210 | $self->pseudoCmdMode, | ||
| 9211 | ); | ||
| 9212 | } | ||
| 9213 | } | ||
| 9214 | |||
| 9215 | # Refresh the list | ||
| 9216 | $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9217 | $combo->set_active(0); | ||
| 9218 | }); | ||
| 9219 | |||
| 9220 | my $button3 = $self->addButton( | ||
| 9221 | $grid, | ||
| 9222 | 'Delete workspace', | ||
| 9223 | 'Delete the selected initial workspace', | ||
| 9224 | undef, | ||
| 9225 | 6, 9, 11, 12); | ||
| 9226 | $button3->signal_connect('clicked' => sub { | ||
| 9227 | |||
| 9228 | my ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 9229 | |||
| 9230 | if (defined $number) { | ||
| 9231 | |||
| 9232 | $self->session->pseudoCmd( | ||
| 9233 | 'deleteinitialworkspace ' . $number, | ||
| 9234 | $self->pseudoCmdMode, | ||
| 9235 | ); | ||
| 9236 | } | ||
| 9237 | |||
| 9238 | # Refresh the list | ||
| 9239 | $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9240 | $combo->set_active(0); | ||
| 9241 | }); | ||
| 9242 | |||
| 9243 | my $button4 = $self->addButton( | ||
| 9244 | $grid, | ||
| 9245 | 'Refresh list', | ||
| 9246 | 'Refresh the list of initial workspaces', | ||
| 9247 | undef, | ||
| 9248 | 9, 12, 11, 12); | ||
| 9249 | $button3->signal_connect('clicked' => sub { | ||
| 9250 | |||
| 9251 | # Refresh the list | ||
| 9252 | $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9253 | }); | ||
| 9254 | |||
| 9255 | # Tab complete | ||
| 9256 | return 1; | ||
| 9257 | } | ||
| 9258 | |||
| 9259 | sub workspaces4Tab_refreshList { | ||
| 9260 | |||
| 9261 | # Called by $self->workspaces4Tab to refresh the first GA::Obj::SimpleList | ||
| 9262 | # | ||
| 9263 | # Expected arguments | ||
| 9264 | # $slWidget - The GA::Obj::SimpleList | ||
| 9265 | # $columns - The number of columns in the list | ||
| 9266 | # | ||
| 9267 | # Return values | ||
| 9268 | # 'undef' on improper arguments | ||
| 9269 | # 1 otherwise | ||
| 9270 | |||
| 9271 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 9272 | |||
| 9273 | # Local variables | ||
| 9274 | my @dataList; | ||
| 9275 | |||
| 9276 | # Check for improper arguments | ||
| 9277 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 9278 | |||
| 9279 | return $axmud::CLIENT->writeImproper( | ||
| 9280 | $self->_objClass . '->workspaces4Tab_refreshList', | ||
| 9281 | @_, | ||
| 9282 | ); | ||
| 9283 | } | ||
| 9284 | |||
| 9285 | # Compile the simple list data | ||
| 9286 | foreach my $number (sort {$a <=> $b} ($axmud::CLIENT->ivKeys('initWorkspaceHash'))) { | ||
| 9287 | |||
| 9288 | my $zonemap = $axmud::CLIENT->ivShow('initWorkspaceHash', $number); | ||
| 9289 | if (! defined $zonemap) { | ||
| 9290 | |||
| 9291 | $zonemap = '(default zonemap)'; | ||
| 9292 | } | ||
| 9293 | |||
| 9294 | push (@dataList, | ||
| 9295 | $number, | ||
| 9296 | $zonemap, | ||
| 9297 | ); | ||
| 9298 | } | ||
| 9299 | |||
| 9300 | # Reset the simple list | ||
| 9301 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 9302 | |||
| 9303 | return 1; | ||
| 9304 | } | ||
| 9305 | |||
| 9306 | sub workspaces5Tab { | ||
| 9307 | |||
| 9308 | # Workspaces5 tab | ||
| 9309 | # | ||
| 9310 | # Expected arguments | ||
| 9311 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 9312 | # | ||
| 9313 | # Return values | ||
| 9314 | # 'undef' on improper arguments | ||
| 9315 | # 1 otherwise | ||
| 9316 | |||
| 9317 | my ($self, $innerNotebook, $check) = @_; | ||
| 9318 | |||
| 9319 | # Check for improper arguments | ||
| 9320 | if (! defined $innerNotebook || defined $check) { | ||
| 9321 | |||
| 9322 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces5Tab', @_); | ||
| 9323 | } | ||
| 9324 | |||
| 9325 | # Tab setup | ||
| 9326 | my $grid = $self->addTab( | ||
| 9327 | $innerNotebook, | ||
| 9328 | 'Page _5', | ||
| 9329 | ['General workspace grid settings'], | ||
| 9330 | ); | ||
| 9331 | |||
| 9332 | # General workspace grid settings | ||
| 9333 | $self->addLabel($grid, '<b>General workspace grid settings</b>', | ||
| 9334 | 0, 12, 0, 1); | ||
| 9335 | |||
| 9336 | $self->addLabel($grid, 'Gridblock size (pixels)', | ||
| 9337 | 1, 3, 1, 2); | ||
| 9338 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 1, 100, | ||
| 9339 | 3, 6, 1, 2, 4, 4); | ||
| 9340 | $entry->set_text($axmud::CLIENT->gridBlockSize); | ||
| 9341 | |||
| 9342 | my $button = $self->addButton($grid, 'Set size', 'Set the standard gridblock size', undef, | ||
| 9343 | 6, 9, 1, 2); | ||
| 9344 | $button->signal_connect('clicked' => sub { | ||
| 9345 | |||
| 9346 | if ($self->checkEntryIcon($entry)) { | ||
| 9347 | |||
| 9348 | # Set gridblock size | ||
| 9349 | $self->session->pseudoCmd( | ||
| 9350 | 'setgrid -b ' . $entry->get_text(), | ||
| 9351 | $self->pseudoCmdMode, | ||
| 9352 | ); | ||
| 9353 | |||
| 9354 | # Update the entry box | ||
| 9355 | $entry->set_text($axmud::CLIENT->gridBlockSize); | ||
| 9356 | } | ||
| 9357 | }); | ||
| 9358 | |||
| 9359 | my $button2 = $self->addButton( | ||
| 9360 | $grid, 'Reset size', 'Reset the standard gridblock size', undef, | ||
| 9361 | 9, 12, 1, 2); | ||
| 9362 | $button2->signal_connect('clicked' => sub { | ||
| 9363 | |||
| 9364 | # Reset gridblock size | ||
| 9365 | $self->session->pseudoCmd('setgrid -b', $self->pseudoCmdMode); | ||
| 9366 | |||
| 9367 | # Update the entry box | ||
| 9368 | $entry->set_text($axmud::CLIENT->gridBlockSize); | ||
| 9369 | }); | ||
| 9370 | |||
| 9371 | $self->addLabel($grid, 'Max grid gap (gridblocks)', | ||
| 9372 | 1, 3, 2, 3); | ||
| 9373 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 100, | ||
| 9374 | 3, 6, 2, 3, 4, 4); | ||
| 9375 | $entry2->set_text($axmud::CLIENT->gridGapMaxSize); | ||
| 9376 | |||
| 9377 | my $button3 = $self->addButton($grid, | ||
| 9378 | 'Set size', | ||
| 9379 | 'Set the maximum size of the gap in the grid that is automatically filled in', | ||
| 9380 | undef, | ||
| 9381 | 6, 9, 2, 3); | ||
| 9382 | $button3->signal_connect('clicked' => sub { | ||
| 9383 | |||
| 9384 | if ($self->checkEntryIcon($entry2)) { | ||
| 9385 | |||
| 9386 | # Set the max grid gap size | ||
| 9387 | $self->session->pseudoCmd( | ||
| 9388 | 'setgrid -g ' . $entry2->get_text(), | ||
| 9389 | $self->pseudoCmdMode, | ||
| 9390 | ); | ||
| 9391 | |||
| 9392 | # Update the entry box | ||
| 9393 | $entry2->set_text($axmud::CLIENT->gridGapMaxSize); | ||
| 9394 | } | ||
| 9395 | }); | ||
| 9396 | |||
| 9397 | my $button4 = $self->addButton($grid, | ||
| 9398 | 'Reset size', | ||
| 9399 | 'Reset the maximum size of the gap in the grid that is automatically filled in', | ||
| 9400 | undef, | ||
| 9401 | 9, 12, 2, 3); | ||
| 9402 | $button4->signal_connect('clicked' => sub { | ||
| 9403 | |||
| 9404 | # Reset max grid gap size | ||
| 9405 | $self->session->pseudoCmd('setgrid -g', $self->pseudoCmdMode); | ||
| 9406 | |||
| 9407 | # Update the entry box | ||
| 9408 | $entry2->set_text($axmud::CLIENT->gridBlockSize); | ||
| 9409 | }); | ||
| 9410 | |||
| 9411 | my $checkButton = $self->addCheckButton( | ||
| 9412 | $grid, 'Workspace grids activated in general', undef, FALSE, | ||
| 9413 | 1, 6, 3, 4); | ||
| 9414 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9415 | |||
| 9416 | my $button5 = $self->addButton( | ||
| 9417 | $grid, | ||
| 9418 | 'Activate grids', | ||
| 9419 | 'Actcvate workspace grids in general', | ||
| 9420 | undef, | ||
| 9421 | 6, 9, 3, 4); | ||
| 9422 | $button5->signal_connect('clicked' => sub { | ||
| 9423 | |||
| 9424 | $self->session->pseudoCmd('activategrid', $self->pseudoCmdMode); | ||
| 9425 | |||
| 9426 | # Update widgets | ||
| 9427 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9428 | }); | ||
| 9429 | |||
| 9430 | my $button6 = $self->addButton( | ||
| 9431 | $grid, | ||
| 9432 | 'Disactivate grids', | ||
| 9433 | 'Disactivate workspace grids in general', | ||
| 9434 | undef, | ||
| 9435 | 9, 12, 3, 4); | ||
| 9436 | $button6->signal_connect('clicked' => sub { | ||
| 9437 | |||
| 9438 | $self->session->pseudoCmd('disactivategrid', $self->pseudoCmdMode); | ||
| 9439 | |||
| 9440 | # Update widgets | ||
| 9441 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9442 | }); | ||
| 9443 | |||
| 9444 | my $checkButton2 = $self->addCheckButton( | ||
| 9445 | $grid, 'Enable grid adjustment (fill small gaps)', undef, TRUE, | ||
| 9446 | 1, 6, 5, 6); | ||
| 9447 | $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag); | ||
| 9448 | $checkButton2->signal_connect('toggled' => sub { | ||
| 9449 | |||
| 9450 | my $flag = $checkButton2->get_active(); | ||
| 9451 | if (! $flag) { | ||
| 9452 | $flag = 0; | ||
| 9453 | } else { | ||
| 9454 | $flag = 1; | ||
| 9455 | } | ||
| 9456 | |||
| 9457 | # Toggle grid adjustment | ||
| 9458 | $self->session->pseudoCmd('setgrid -a ' . $flag); | ||
| 9459 | |||
| 9460 | # Update the checkbutton | ||
| 9461 | $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag); | ||
| 9462 | }); | ||
| 9463 | |||
| 9464 | my $checkButton3 = $self->addCheckButton( | ||
| 9465 | $grid, 'Enable edge correction (edge of desktop)', undef, TRUE, | ||
| 9466 | 1, 6, 6, 7); | ||
| 9467 | $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag); | ||
| 9468 | $checkButton3->signal_connect('toggled' => sub { | ||
| 9469 | |||
| 9470 | my $flag = $checkButton3->get_active(); | ||
| 9471 | if (! $flag) { | ||
| 9472 | $flag = 0; | ||
| 9473 | } else { | ||
| 9474 | $flag = 1; | ||
| 9475 | } | ||
| 9476 | |||
| 9477 | # Toggle edge correction | ||
| 9478 | $self->session->pseudoCmd('setgrid -e ' . $flag); | ||
| 9479 | |||
| 9480 | # Update the checkbutton | ||
| 9481 | $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag); | ||
| 9482 | }); | ||
| 9483 | |||
| 9484 | my $checkButton4 = $self->addCheckButton( | ||
| 9485 | $grid, 'Enable window reshuffling', undef, TRUE, | ||
| 9486 | 1, 6, 7, 8); | ||
| 9487 | $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag); | ||
| 9488 | $checkButton4->signal_connect('toggled' => sub { | ||
| 9489 | |||
| 9490 | my $flag = $checkButton4->get_active(); | ||
| 9491 | if (! $flag) { | ||
| 9492 | $flag = 0; | ||
| 9493 | } else { | ||
| 9494 | $flag = 1; | ||
| 9495 | } | ||
| 9496 | |||
| 9497 | # Toggle window reshuffling | ||
| 9498 | $self->session->pseudoCmd('setgrid -r ' . $flag); | ||
| 9499 | |||
| 9500 | # Update the checkbutton | ||
| 9501 | $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag); | ||
| 9502 | }); | ||
| 9503 | |||
| 9504 | my $checkButton5 = $self->addCheckButton( | ||
| 9505 | $grid, 'Enable hiding of other session\'s windows', undef, TRUE, | ||
| 9506 | 1, 6, 8, 9); | ||
| 9507 | $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag); | ||
| 9508 | $checkButton5->signal_connect('toggled' => sub { | ||
| 9509 | |||
| 9510 | my $flag = $checkButton5->get_active(); | ||
| 9511 | if (! $flag) { | ||
| 9512 | $flag = 0; | ||
| 9513 | } else { | ||
| 9514 | $flag = 1; | ||
| 9515 | } | ||
| 9516 | |||
| 9517 | # Toggle window reshuffling | ||
| 9518 | $self->session->pseudoCmd('setgrid -i ' . $flag); | ||
| 9519 | |||
| 9520 | # Update the checkbutton | ||
| 9521 | $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag); | ||
| 9522 | }); | ||
| 9523 | |||
| 9524 | # Tab complete | ||
| 9525 | return 1; | ||
| 9526 | } | ||
| 9527 | |||
| 9528 | sub workspaces6Tab { | ||
| 9529 | |||
| 9530 | # workspaces6 tab | ||
| 9531 | # | ||
| 9532 | # Expected arguments | ||
| 9533 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 9534 | # | ||
| 9535 | # Return values | ||
| 9536 | # 'undef' on improper arguments | ||
| 9537 | # 1 otherwise | ||
| 9538 | |||
| 9539 | my ($self, $innerNotebook, $check) = @_; | ||
| 9540 | |||
| 9541 | # Local variables | ||
| 9542 | my ( | ||
| 9543 | $allString, $defaultString, | ||
| 9544 | @columnList, @emptyList, | ||
| 9545 | ); | ||
| 9546 | |||
| 9547 | # Check for improper arguments | ||
| 9548 | if (! defined $innerNotebook || defined $check) { | ||
| 9549 | |||
| 9550 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces6Tab', @_); | ||
| 9551 | } | ||
| 9552 | |||
| 9553 | # Tab setup | ||
| 9554 | my $grid = $self->addTab( | ||
| 9555 | $innerNotebook, | ||
| 9556 | 'Page _6', | ||
| 9557 | ['Workspace grids'], | ||
| 9558 | ); | ||
| 9559 | |||
| 9560 | # Workspace grids | ||
| 9561 | $self->addLabel($grid, '<b>Workspace grids</b>', | ||
| 9562 | 0, 12, 0, 1); | ||
| 9563 | $self->addLabel($grid, | ||
| 9564 | '<i>List of workspace grids on which \'grid\' windows are arranged</i>', | ||
| 9565 | 1, 6, 1, 2); | ||
| 9566 | my $checkButton = $self->addCheckButton( | ||
| 9567 | $grid, 'Grids are activated in general', undef, FALSE, | ||
| 9568 | 8, 12, 1, 2); | ||
| 9569 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9570 | |||
| 9571 | # Add a simple list | ||
| 9572 | @columnList = ( | ||
| 9573 | 'Workspace', 'int', | ||
| 9574 | 'Grid num', 'int', | ||
| 9575 | 'Session', 'text', | ||
| 9576 | 'Zonemap', 'text', | ||
| 9577 | 'Layers', 'int', | ||
| 9578 | 'Max', 'int', | ||
| 9579 | 'No. zones', 'int', | ||
| 9580 | 'No. windows', 'int', | ||
| 9581 | ); | ||
| 9582 | |||
| 9583 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 9584 | 1, 12, 2, 9); | ||
| 9585 | |||
| 9586 | # Initialise the list | ||
| 9587 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9588 | |||
| 9589 | # Add editing widgets | ||
| 9590 | $self->addLabel($grid, 'Workspace:', | ||
| 9591 | 1, 3, 9, 10); | ||
| 9592 | my $combo = $self->addComboBox($grid, undef, \@emptyList, '', | ||
| 9593 | TRUE, # No 'undef' value used | ||
| 9594 | 3, 6, 9, 10); | ||
| 9595 | $allString = '(all workspaces)'; | ||
| 9596 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9597 | |||
| 9598 | $self->addLabel($grid, 'Default zonemap:', | ||
| 9599 | 6, 9, 9, 10); | ||
| 9600 | my $combo2 = $self->addComboBox($grid, undef, \@emptyList, '', | ||
| 9601 | TRUE, # No 'undef' value used | ||
| 9602 | 9, 12, 9, 10); | ||
| 9603 | $defaultString = '(' . $axmud::SCRIPT . ' chooses a zonemap)'; | ||
| 9604 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9605 | |||
| 9606 | my $button = $self->addButton( | ||
| 9607 | $grid, | ||
| 9608 | 'Activate grids', | ||
| 9609 | 'Activate workspace grid(s) on the specified workspace using the specified default' | ||
| 9610 | . ' zonemap', | ||
| 9611 | undef, | ||
| 9612 | 1, 3, 10, 11); | ||
| 9613 | $button->signal_connect('clicked' => sub { | ||
| 9614 | |||
| 9615 | my ($cmd, $number, $zonemap); | ||
| 9616 | |||
| 9617 | $cmd = 'activategrid'; | ||
| 9618 | |||
| 9619 | $number = $combo->get_active_text(); | ||
| 9620 | if ($number ne $allString) { | ||
| 9621 | |||
| 9622 | $cmd .= ' ' . $number; | ||
| 9623 | } | ||
| 9624 | |||
| 9625 | $zonemap = $combo2->get_active_text(); | ||
| 9626 | if ($zonemap ne $defaultString) { | ||
| 9627 | |||
| 9628 | $cmd .= ' -z ' . $zonemap; | ||
| 9629 | } | ||
| 9630 | |||
| 9631 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 9632 | |||
| 9633 | # Refresh the list | ||
| 9634 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9635 | # Update widgets | ||
| 9636 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9637 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9638 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9639 | }); | ||
| 9640 | |||
| 9641 | my $button2 = $self->addButton( | ||
| 9642 | $grid, | ||
| 9643 | 'Disactivate grids', | ||
| 9644 | 'Disactivate workspace grid(s) on the specified workspace', | ||
| 9645 | undef, | ||
| 9646 | 3, 6, 10, 11); | ||
| 9647 | $button2->signal_connect('clicked' => sub { | ||
| 9648 | |||
| 9649 | my ($cmd, $number); | ||
| 9650 | |||
| 9651 | $cmd = 'disactivategrid'; | ||
| 9652 | |||
| 9653 | $number = $combo->get_active_text(); | ||
| 9654 | if ($number ne $allString) { | ||
| 9655 | |||
| 9656 | $cmd .= ' ' . $number; | ||
| 9657 | } | ||
| 9658 | |||
| 9659 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 9660 | |||
| 9661 | # Refresh the list | ||
| 9662 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9663 | # Update widgets | ||
| 9664 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9665 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9666 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9667 | }); | ||
| 9668 | |||
| 9669 | my $button3 = $self->addButton( | ||
| 9670 | $grid, | ||
| 9671 | 'Reset selected grids', | ||
| 9672 | 'Reset selected workspace grid using the specified default zonemap', | ||
| 9673 | undef, | ||
| 9674 | 6, 10, 10, 11); | ||
| 9675 | $button3->signal_connect('clicked' => sub { | ||
| 9676 | |||
| 9677 | my ($number, $cmd, $zonemap); | ||
| 9678 | |||
| 9679 | ($number) = $self->getSimpleListData($slWidget, 1); | ||
| 9680 | if (defined $number) { | ||
| 9681 | |||
| 9682 | $cmd = 'resetgrid ' . $number; | ||
| 9683 | |||
| 9684 | $zonemap = $combo2->get_active_text(); | ||
| 9685 | if ($zonemap ne $defaultString) { | ||
| 9686 | |||
| 9687 | $cmd .= ' ' . $zonemap; | ||
| 9688 | } | ||
| 9689 | |||
| 9690 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 9691 | } | ||
| 9692 | |||
| 9693 | # Refresh the list | ||
| 9694 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9695 | # Update widgets | ||
| 9696 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9697 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9698 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9699 | }); | ||
| 9700 | |||
| 9701 | my $button4 = $self->addButton( | ||
| 9702 | $grid, | ||
| 9703 | 'Reset grids', | ||
| 9704 | 'Reset workspace grid(s) on the specified workspace using the specified default' | ||
| 9705 | . ' zonemap', | ||
| 9706 | undef, | ||
| 9707 | 10, 12, 10, 11); | ||
| 9708 | $button4->signal_connect('clicked' => sub { | ||
| 9709 | |||
| 9710 | my ($cmd, $number, $zonemap); | ||
| 9711 | |||
| 9712 | $cmd = 'resetgrid'; | ||
| 9713 | |||
| 9714 | $number = $combo->get_active_text(); | ||
| 9715 | if (defined $number) { | ||
| 9716 | |||
| 9717 | if ($number eq $allString) { | ||
| 9718 | $cmd .= ' -s'; | ||
| 9719 | } else { | ||
| 9720 | $cmd .= ' -w ' . $number; | ||
| 9721 | } | ||
| 9722 | |||
| 9723 | $zonemap = $combo2->get_active_text(); | ||
| 9724 | if ($zonemap ne $defaultString) { | ||
| 9725 | |||
| 9726 | $cmd .= ' ' . $zonemap; | ||
| 9727 | } | ||
| 9728 | |||
| 9729 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 9730 | } | ||
| 9731 | |||
| 9732 | # Refresh the list | ||
| 9733 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9734 | # Update widgets | ||
| 9735 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9736 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9737 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9738 | }); | ||
| 9739 | |||
| 9740 | my $button5 = $self->addButton( | ||
| 9741 | $grid, | ||
| 9742 | 'View selected grid...', | ||
| 9743 | 'View settings for the selected workspace grid', | ||
| 9744 | undef, | ||
| 9745 | 6, 10, 11, 12); | ||
| 9746 | $button5->signal_connect('clicked' => sub { | ||
| 9747 | |||
| 9748 | my ($number, $obj); | ||
| 9749 | |||
| 9750 | ($number) = $self->getSimpleListData($slWidget, 1); | ||
| 9751 | if (defined $number) { | ||
| 9752 | |||
| 9753 | $obj = $axmud::CLIENT->desktopObj->ivShow('gridHash', $number); | ||
| 9754 | if ($obj) { | ||
| 9755 | |||
| 9756 | # Open an 'edit' window to edit the workspace grid | ||
| 9757 | $self->createFreeWin( | ||
| 9758 | 'Games::Axmud::EditWin::WorkspaceGrid', | ||
| 9759 | $self, | ||
| 9760 | $self->session, | ||
| 9761 | 'Edit workspace grid #' . $number, | ||
| 9762 | $obj, | ||
| 9763 | FALSE, # Not temporary | ||
| 9764 | ); | ||
| 9765 | } | ||
| 9766 | } | ||
| 9767 | }); | ||
| 9768 | |||
| 9769 | my $button6 = $self->addButton( | ||
| 9770 | $grid, | ||
| 9771 | 'Refresh list', | ||
| 9772 | 'Refresh the list of workspace grids', | ||
| 9773 | undef, | ||
| 9774 | 10, 12, 11, 12); | ||
| 9775 | $button6->signal_connect('clicked' => sub { | ||
| 9776 | |||
| 9777 | # Refresh the list | ||
| 9778 | $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9779 | # Update widgets | ||
| 9780 | $self->workspaces6Tab_resetCombo($combo, $allString); | ||
| 9781 | $self->workspaces6Tab_resetCombo2($combo2, $defaultString); | ||
| 9782 | $checkButton->set_active($axmud::CLIENT->activateGridFlag); | ||
| 9783 | }); | ||
| 9784 | |||
| 9785 | # Tab complete | ||
| 9786 | return 1; | ||
| 9787 | } | ||
| 9788 | |||
| 9789 | sub workspaces6Tab_refreshList { | ||
| 9790 | |||
| 9791 | # Called by $self->workspaces6Tab to refresh the first GA::Obj::SimpleList | ||
| 9792 | # | ||
| 9793 | # Expected arguments | ||
| 9794 | # $slWidget - The GA::Obj::SimpleList | ||
| 9795 | # $columns - The number of columns in the list | ||
| 9796 | # | ||
| 9797 | # Return values | ||
| 9798 | # 'undef' on improper arguments | ||
| 9799 | # 1 otherwise | ||
| 9800 | |||
| 9801 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 9802 | |||
| 9803 | # Local variables | ||
| 9804 | my @dataList; | ||
| 9805 | |||
| 9806 | # Check for improper arguments | ||
| 9807 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 9808 | |||
| 9809 | return $axmud::CLIENT->writeImproper( | ||
| 9810 | $self->_objClass . '->workspaces6Tab_refreshList', | ||
| 9811 | @_, | ||
| 9812 | ); | ||
| 9813 | } | ||
| 9814 | |||
| 9815 | # Compile the simple list data | ||
| 9816 | foreach my $obj ( | ||
| 9817 | sort { | ||
| 9818 | if ($a->workspaceObj->number != $b->workspaceObj->number) { | ||
| 9819 | return $a->workspaceObj->number <=> $b->workspaceObj->number; | ||
| 9820 | } else { | ||
| 9821 | return $a->number <=> $b->number; | ||
| 9822 | } | ||
| 9823 | } | ||
| 9824 | ($axmud::CLIENT->desktopObj->ivValues('gridHash')) | ||
| 9825 | ) { | ||
| 9826 | my $string; | ||
| 9827 | |||
| 9828 | if ($obj->owner) { | ||
| 9829 | $string = $obj->owner->number; | ||
| 9830 | } else { | ||
| 9831 | $string = '(shared)'; | ||
| 9832 | } | ||
| 9833 | |||
| 9834 | push (@dataList, | ||
| 9835 | $obj->workspaceObj->number, | ||
| 9836 | $obj->number, | ||
| 9837 | $string, | ||
| 9838 | $obj->zonemap, | ||
| 9839 | $obj->currentLayer, | ||
| 9840 | $obj->maxLayers, | ||
| 9841 | $obj->ivPairs('zoneHash'), | ||
| 9842 | $obj->ivPairs('gridWinHash'), | ||
| 9843 | ); | ||
| 9844 | } | ||
| 9845 | |||
| 9846 | # Reset the simple list | ||
| 9847 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 9848 | |||
| 9849 | return 1; | ||
| 9850 | } | ||
| 9851 | |||
| 9852 | sub workspaces6Tab_resetCombo { | ||
| 9853 | |||
| 9854 | # Called by $self->workspaces6Tab to reset the contents of the first combobox | ||
| 9855 | # | ||
| 9856 | # Expected arguments | ||
| 9857 | # $combo - The combobox whose contents should be reset | ||
| 9858 | # $title - The title used in the combobox | ||
| 9859 | # | ||
| 9860 | # Return values | ||
| 9861 | # 'undef' on improper arguments | ||
| 9862 | # 1 otherwise | ||
| 9863 | |||
| 9864 | my ($self, $combo, $title, $check) = @_; | ||
| 9865 | |||
| 9866 | # Local variables | ||
| 9867 | my @comboList; | ||
| 9868 | |||
| 9869 | # Check for improper arguments | ||
| 9870 | if (! defined $combo || ! defined $title || defined $check) { | ||
| 9871 | |||
| 9872 | return $axmud::CLIENT->writeImproper( | ||
| 9873 | $self->_objClass . '->workspaces6Tab_resetCombo', | ||
| 9874 | @_, | ||
| 9875 | ); | ||
| 9876 | } | ||
| 9877 | |||
| 9878 | # Compile a list of combobox items | ||
| 9879 | @comboList = sort {$a <=> $b} ($axmud::CLIENT->desktopObj->ivKeys('workspaceHash')); | ||
| 9880 | unshift (@comboList, $title); | ||
| 9881 | |||
| 9882 | # Reset the combobox | ||
| 9883 | $self->resetComboBox($combo, @comboList); | ||
| 9884 | |||
| 9885 | return 1; | ||
| 9886 | } | ||
| 9887 | |||
| 9888 | sub workspaces6Tab_resetCombo2 { | ||
| 9889 | |||
| 9890 | # Called by $self->workspaces6Tab to reset the contents of the second combobox | ||
| 9891 | # | ||
| 9892 | # Expected arguments | ||
| 9893 | # $combo - The combobox whose contents should be reset | ||
| 9894 | # $title - The title used in the combobox | ||
| 9895 | # | ||
| 9896 | # Return values | ||
| 9897 | # 'undef' on improper arguments | ||
| 9898 | # 1 otherwise | ||
| 9899 | |||
| 9900 | my ($self, $combo, $title, $check) = @_; | ||
| 9901 | |||
| 9902 | # Local variables | ||
| 9903 | my @comboList; | ||
| 9904 | |||
| 9905 | # Check for improper arguments | ||
| 9906 | if (! defined $combo || ! defined $title || defined $check) { | ||
| 9907 | |||
| 9908 | return $axmud::CLIENT->writeImproper( | ||
| 9909 | $self->_objClass . '->workspaces6Tab_resetCombo2', | ||
| 9910 | @_, | ||
| 9911 | ); | ||
| 9912 | } | ||
| 9913 | |||
| 9914 | # Compile a list of combobox items | ||
| 9915 | @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash')); | ||
| 9916 | unshift (@comboList, $title); | ||
| 9917 | |||
| 9918 | # Reset the combobox | ||
| 9919 | $self->resetComboBox($combo, @comboList); | ||
| 9920 | |||
| 9921 | return 1; | ||
| 9922 | } | ||
| 9923 | |||
| 9924 | sub workspaces7Tab { | ||
| 9925 | |||
| 9926 | # Workspaces7 tab | ||
| 9927 | # | ||
| 9928 | # Expected arguments | ||
| 9929 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 9930 | # | ||
| 9931 | # Return values | ||
| 9932 | # 'undef' on improper arguments | ||
| 9933 | # 1 otherwise | ||
| 9934 | |||
| 9935 | my ($self, $innerNotebook, $check) = @_; | ||
| 9936 | |||
| 9937 | # Local variables | ||
| 9938 | my @columnList; | ||
| 9939 | |||
| 9940 | # Check for improper arguments | ||
| 9941 | if (! defined $innerNotebook || defined $check) { | ||
| 9942 | |||
| 9943 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces7Tab', @_); | ||
| 9944 | } | ||
| 9945 | |||
| 9946 | # Tab setup | ||
| 9947 | my $grid = $self->addTab( | ||
| 9948 | $innerNotebook, | ||
| 9949 | 'Page _7', | ||
| 9950 | ['Zonemaps'], | ||
| 9951 | ); | ||
| 9952 | |||
| 9953 | # Zonemaps | ||
| 9954 | $self->addLabel($grid, '<b>Zonemaps</b>', | ||
| 9955 | 0, 12, 0, 1); | ||
| 9956 | $self->addLabel($grid, | ||
| 9957 | '<i>List of zonemaps, which divide a workspace grid into distinct zones</i>', | ||
| 9958 | 1, 12, 1, 2); | ||
| 9959 | |||
| 9960 | # Add a simple list | ||
| 9961 | @columnList = ( | ||
| 9962 | 'Name', 'text', | ||
| 9963 | 'Standard', 'bool', | ||
| 9964 | 'Full', 'bool', | ||
| 9965 | 'Temporary', 'bool', | ||
| 9966 | 'Number of zone models', 'int', | ||
| 9967 | ); | ||
| 9968 | |||
| 9969 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 9970 | 1, 12, 2, 9); | ||
| 9971 | |||
| 9972 | # Initialise the list | ||
| 9973 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9974 | |||
| 9975 | # Add entry boxes and editing buttons | ||
| 9976 | $self->addLabel($grid, 'Name', | ||
| 9977 | 1, 2, 9, 10); | ||
| 9978 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 9979 | 2, 5, 9, 10, 16, 16); | ||
| 9980 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 9981 | 7, 10, 9, 10, 16, 16); | ||
| 9982 | |||
| 9983 | my $button = $self->addButton($grid, 'Add', 'Add the specified zonemap', undef, | ||
| 9984 | 5, 7, 9, 10); | ||
| 9985 | $button->signal_connect('clicked' => sub { | ||
| 9986 | |||
| 9987 | my $name = $entry->get_text(); | ||
| 9988 | |||
| 9989 | if ($self->checkEntryIcon($entry)) { | ||
| 9990 | |||
| 9991 | # Add this zonemap | ||
| 9992 | $self->session->pseudoCmd('addzonemap ' . $name, $self->pseudoCmdMode); | ||
| 9993 | |||
| 9994 | # Refresh the simple list and entry boxes | ||
| 9995 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 9996 | $self->resetEntryBoxes($entry, $entry2); | ||
| 9997 | } | ||
| 9998 | }); | ||
| 9999 | |||
| 10000 | my $button2 = $self->addButton($grid, | ||
| 10001 | 'Clone', 'Clone the selected zonemap as a copy with this name', undef, | ||
| 10002 | 10, 12, 9, 10); | ||
| 10003 | $button2->signal_connect('clicked' => sub { | ||
| 10004 | |||
| 10005 | my ($zonemap, $clone); | ||
| 10006 | |||
| 10007 | ($zonemap) = $self->getSimpleListData($slWidget, 0); | ||
| 10008 | $clone = $entry2->get_text(); | ||
| 10009 | |||
| 10010 | if (defined $zonemap && $self->checkEntryIcon($entry2)) { | ||
| 10011 | |||
| 10012 | # Clone the zonemap | ||
| 10013 | $self->session->pseudoCmd( | ||
| 10014 | 'clonezonemap ' . $zonemap . ' ' . $clone, | ||
| 10015 | $self->pseudoCmdMode, | ||
| 10016 | ); | ||
| 10017 | |||
| 10018 | # Refresh the simple list and reset entry boxes | ||
| 10019 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10020 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10021 | } | ||
| 10022 | }); | ||
| 10023 | |||
| 10024 | my $button3 = $self->addButton($grid, 'Edit...', 'Edit the selected zonemap', undef, | ||
| 10025 | 3, 5, 10, 11); | ||
| 10026 | $button3->signal_connect('clicked' => sub { | ||
| 10027 | |||
| 10028 | my ($zonemap, $obj, $childWinObj); | ||
| 10029 | |||
| 10030 | ($zonemap) = $self->getSimpleListData($slWidget, 0); | ||
| 10031 | if (defined $zonemap) { | ||
| 10032 | |||
| 10033 | $obj = $axmud::CLIENT->ivShow('zonemapHash', $zonemap); | ||
| 10034 | if ($obj) { | ||
| 10035 | |||
| 10036 | # Open an 'edit' window to edit the zonemap | ||
| 10037 | $childWinObj = $self->createFreeWin( | ||
| 10038 | 'Games::Axmud::EditWin::Zonemap', | ||
| 10039 | $self, | ||
| 10040 | $self->session, | ||
| 10041 | 'Edit zonemap \'' . $zonemap . '\'', | ||
| 10042 | $obj, | ||
| 10043 | FALSE, # Not temporary | ||
| 10044 | ); | ||
| 10045 | |||
| 10046 | if ($childWinObj) { | ||
| 10047 | |||
| 10048 | # When the 'edit' window closes, update widgets and/or IVs | ||
| 10049 | $self->add_childDestroy( | ||
| 10050 | $childWinObj, | ||
| 10051 | 'workspaces7Tab_refreshList', | ||
| 10052 | [$slWidget, (scalar @columnList / 2)], | ||
| 10053 | ); | ||
| 10054 | } | ||
| 10055 | } | ||
| 10056 | } | ||
| 10057 | }); | ||
| 10058 | |||
| 10059 | my $button4 = $self->addButton($grid, 'Delete', 'Delete the selected zonemap', undef, | ||
| 10060 | 5, 7, 10, 11); | ||
| 10061 | $button4->signal_connect('clicked' => sub { | ||
| 10062 | |||
| 10063 | my ($zonemap) = $self->getSimpleListData($slWidget, 0); | ||
| 10064 | if (defined $zonemap) { | ||
| 10065 | |||
| 10066 | # Delete the zonemap | ||
| 10067 | $self->session->pseudoCmd('deletezonemap ' . $zonemap, $self->pseudoCmdMode); | ||
| 10068 | |||
| 10069 | # Refresh the simple list and reset entry boxes | ||
| 10070 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10071 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10072 | } | ||
| 10073 | }); | ||
| 10074 | |||
| 10075 | my $button5 = $self->addButton($grid, | ||
| 10076 | 'Reset zonemap', 'Reset the selected zonemap, emptying its list of zone models', undef, | ||
| 10077 | 7, 10, 10, 11); | ||
| 10078 | $button5->signal_connect('clicked' => sub { | ||
| 10079 | |||
| 10080 | my ($zonemap) = $self->getSimpleListData($slWidget, 0); | ||
| 10081 | if (defined $zonemap) { | ||
| 10082 | |||
| 10083 | # Reset the zonemap | ||
| 10084 | $self->session->pseudoCmd('resetzonemap ' . $zonemap, $self->pseudoCmdMode); | ||
| 10085 | |||
| 10086 | # Refresh the simple list and reset entry boxes | ||
| 10087 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10088 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10089 | } | ||
| 10090 | }); | ||
| 10091 | |||
| 10092 | my $button6 = $self->addButton($grid, | ||
| 10093 | 'Reset list', 'Reset the list of zonemaps', undef, | ||
| 10094 | 10, 12, 10, 11); | ||
| 10095 | $button6->signal_connect('clicked' => sub { | ||
| 10096 | |||
| 10097 | # Refresh the simple list and reset entry boxes | ||
| 10098 | $self->workspaces7Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10099 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10100 | }); | ||
| 10101 | |||
| 10102 | # Tab complete | ||
| 10103 | return 1; | ||
| 10104 | } | ||
| 10105 | |||
| 10106 | sub workspaces7Tab_refreshList { | ||
| 10107 | |||
| 10108 | # Called by $self->workspaces7Tab to refresh the GA::Obj::SimpleList | ||
| 10109 | # | ||
| 10110 | # Expected arguments | ||
| 10111 | # $slWidget - The GA::Obj::SimpleList | ||
| 10112 | # $columns - The number of columns in the list | ||
| 10113 | # | ||
| 10114 | # Return values | ||
| 10115 | # 'undef' on improper arguments | ||
| 10116 | # 1 otherwise | ||
| 10117 | |||
| 10118 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 10119 | |||
| 10120 | # Local variables | ||
| 10121 | my (@sortedList, @dataList); | ||
| 10122 | |||
| 10123 | # Check for improper arguments | ||
| 10124 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 10125 | |||
| 10126 | return $axmud::CLIENT->writeImproper( | ||
| 10127 | $self->_objClass . '->workspaces7Tab_refreshList', | ||
| 10128 | @_, | ||
| 10129 | ); | ||
| 10130 | } | ||
| 10131 | |||
| 10132 | # Get a sorted list of zonemaps | ||
| 10133 | @sortedList | ||
| 10134 | = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('zonemapHash')); | ||
| 10135 | |||
| 10136 | # Compile the simple list data | ||
| 10137 | foreach my $zonemapObj (@sortedList) { | ||
| 10138 | |||
| 10139 | my ($standardFlag, $count); | ||
| 10140 | |||
| 10141 | if ($axmud::CLIENT->ivExists('standardZonemapHash', $zonemapObj->name)) { | ||
| 10142 | |||
| 10143 | $standardFlag = TRUE; | ||
| 10144 | } | ||
| 10145 | |||
| 10146 | push (@dataList, | ||
| 10147 | $zonemapObj->name, | ||
| 10148 | $standardFlag, | ||
| 10149 | $zonemapObj->fullFlag, | ||
| 10150 | $zonemapObj->tempFlag, | ||
| 10151 | $zonemapObj->ivPairs('modelHash'), | ||
| 10152 | ); | ||
| 10153 | } | ||
| 10154 | |||
| 10155 | # Reset the simple list | ||
| 10156 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 10157 | |||
| 10158 | return 1; | ||
| 10159 | } | ||
| 10160 | |||
| 10161 | sub workspaces8Tab { | ||
| 10162 | |||
| 10163 | # Workspaces8 tab | ||
| 10164 | # | ||
| 10165 | # Expected arguments | ||
| 10166 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 10167 | # | ||
| 10168 | # Return values | ||
| 10169 | # 'undef' on improper arguments | ||
| 10170 | # 1 otherwise | ||
| 10171 | |||
| 10172 | my ($self, $innerNotebook, $check) = @_; | ||
| 10173 | |||
| 10174 | # Local variables | ||
| 10175 | my @columnList; | ||
| 10176 | |||
| 10177 | # Check for improper arguments | ||
| 10178 | if (! defined $innerNotebook || defined $check) { | ||
| 10179 | |||
| 10180 | return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces8Tab', @_); | ||
| 10181 | } | ||
| 10182 | |||
| 10183 | # Tab setup | ||
| 10184 | my $grid = $self->addTab( | ||
| 10185 | $innerNotebook, | ||
| 10186 | 'Page _8', | ||
| 10187 | ['Window size/position storage'], | ||
| 10188 | ); | ||
| 10189 | |||
| 10190 | # Window size/position storage | ||
| 10191 | $self->addLabel($grid, '<b>Window size/position storage</b>', | ||
| 10192 | 0, 6, 0, 1); | ||
| 10193 | |||
| 10194 | my $checkButton = $self->addCheckButton( | ||
| 10195 | $grid, 'Automatically store size/position of all \'grid\' windows', undef, TRUE, | ||
| 10196 | 6, 12, 0, 1); | ||
| 10197 | $checkButton->set_active($axmud::CLIENT->storeGridPosnFlag); | ||
| 10198 | $checkButton->signal_connect('toggled' => sub { | ||
| 10199 | |||
| 10200 | if ( | ||
| 10201 | ($checkButton->get_active() && ! $axmud::CLIENT->storeGridPosnFlag) | ||
| 10202 | || (! $checkButton->get_active() && $axmud::CLIENT->storeGridPosnFlag) | ||
| 10203 | ) { | ||
| 10204 | $self->session->pseudoCmd('togglewindowstorage', $self->pseudoCmdMode); | ||
| 10205 | } | ||
| 10206 | }); | ||
| 10207 | |||
| 10208 | $self->addLabel($grid, | ||
| 10209 | '<i>List of stored \'grid\' window size/positions (used when workspace grids are' | ||
| 10210 | . ' disactivated)</i>', | ||
| 10211 | 1, 12, 1, 2); | ||
| 10212 | |||
| 10213 | # Add a simple list | ||
| 10214 | @columnList = ( | ||
| 10215 | 'Window name', 'text', | ||
| 10216 | 'X', 'int', | ||
| 10217 | 'Y', 'int', | ||
| 10218 | 'Width', 'int', | ||
| 10219 | 'Height', 'int', | ||
| 10220 | ); | ||
| 10221 | |||
| 10222 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 10223 | 1, 12, 2, 10); | ||
| 10224 | |||
| 10225 | # Initialise the list | ||
| 10226 | $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10227 | |||
| 10228 | # Add editing widgets | ||
| 10229 | my $button = $self->addButton($grid, | ||
| 10230 | 'Store current sizes/positions', | ||
| 10231 | 'Store the sizes of this session\'s \'grid\' windows', | ||
| 10232 | undef, | ||
| 10233 | 1, 4, 10, 11); | ||
| 10234 | $button->signal_connect('clicked' => sub { | ||
| 10235 | |||
| 10236 | $axmud::CLIENT->desktopObj->storeGridWinPosn($self->session); | ||
| 10237 | |||
| 10238 | # Refresh the simple list | ||
| 10239 | $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10240 | }); | ||
| 10241 | |||
| 10242 | my $button2 = $self->addButton($grid, | ||
| 10243 | 'Clear selected', 'Clear the selected stored size/position', undef, | ||
| 10244 | 4, 6, 10, 11); | ||
| 10245 | $button2->signal_connect('clicked' => sub { | ||
| 10246 | |||
| 10247 | my ($winName) = $self->getSimpleListData($slWidget, 0); | ||
| 10248 | if (defined $winName) { | ||
| 10249 | |||
| 10250 | $self->session->pseudoCmd( | ||
| 10251 | 'clearwindowstorage <' . $winName . '>', | ||
| 10252 | $self->pseudoCmdMode, | ||
| 10253 | ); | ||
| 10254 | |||
| 10255 | # Refresh the simple list | ||
| 10256 | $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10257 | } | ||
| 10258 | }); | ||
| 10259 | |||
| 10260 | my $button3 = $self->addButton($grid, | ||
| 10261 | 'Clear all', 'Clear all stored sizes/positions', undef, | ||
| 10262 | 6, 8, 10, 11); | ||
| 10263 | $button3->signal_connect('clicked' => sub { | ||
| 10264 | |||
| 10265 | $self->session->pseudoCmd('clearwindowstorage', $self->pseudoCmdMode); | ||
| 10266 | |||
| 10267 | # Refresh the simple list | ||
| 10268 | $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10269 | }); | ||
| 10270 | |||
| 10271 | my $button4 = $self->addButton($grid, | ||
| 10272 | 'Refresh list', 'Refresh the list of stored sizes/positions', undef, | ||
| 10273 | 10, 12, 10, 11); | ||
| 10274 | $button4->signal_connect('clicked' => sub { | ||
| 10275 | |||
| 10276 | # Refresh the simple list | ||
| 10277 | $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10278 | }); | ||
| 10279 | |||
| 10280 | # Tab complete | ||
| 10281 | return 1; | ||
| 10282 | } | ||
| 10283 | |||
| 10284 | sub workspaces8Tab_refreshList { | ||
| 10285 | |||
| 10286 | # Called by $self->workspaces8Tab to refresh the GA::Obj::SimpleList | ||
| 10287 | # | ||
| 10288 | # Expected arguments | ||
| 10289 | # $slWidget - The GA::Obj::SimpleList | ||
| 10290 | # $columns - The number of columns in the list | ||
| 10291 | # | ||
| 10292 | # Return values | ||
| 10293 | # 'undef' on improper arguments | ||
| 10294 | # 1 otherwise | ||
| 10295 | |||
| 10296 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 10297 | |||
| 10298 | # Local variables | ||
| 10299 | my ( | ||
| 10300 | @dataList, | ||
| 10301 | %ivHash, | ||
| 10302 | ); | ||
| 10303 | |||
| 10304 | # Check for improper arguments | ||
| 10305 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 10306 | |||
| 10307 | return $axmud::CLIENT->writeImproper( | ||
| 10308 | $self->_objClass . '->workspaces8Tab_refreshList', | ||
| 10309 | @_, | ||
| 10310 | ); | ||
| 10311 | } | ||
| 10312 | |||
| 10313 | # Import the hash of stored sizes/positions | ||
| 10314 | %ivHash = $axmud::CLIENT->storeGridPosnHash; | ||
| 10315 | |||
| 10316 | # Compile the simple list data | ||
| 10317 | foreach my $winName (sort {lc($a) cmp lc($b)} (keys %ivHash)) { | ||
| 10318 | |||
| 10319 | my $listRef = $ivHash{$winName}; | ||
| 10320 | |||
| 10321 | push (@dataList, | ||
| 10322 | $winName, | ||
| 10323 | $$listRef[0], | ||
| 10324 | $$listRef[1], | ||
| 10325 | $$listRef[2], | ||
| 10326 | $$listRef[3], | ||
| 10327 | ); | ||
| 10328 | } | ||
| 10329 | |||
| 10330 | # Reset the simple list | ||
| 10331 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 10332 | |||
| 10333 | return 1; | ||
| 10334 | } | ||
| 10335 | |||
| 10336 | sub windowsTab { | ||
| 10337 | |||
| 10338 | # Workspaces tab - called by $self->setupNotebook | ||
| 10339 | # | ||
| 10340 | # Expected arguments | ||
| 10341 | # (none besides $self) | ||
| 10342 | # | ||
| 10343 | # Return values | ||
| 10344 | # 'undef' on improper arguments | ||
| 10345 | # 1 otherwise | ||
| 10346 | |||
| 10347 | my ($self, $check) = @_; | ||
| 10348 | |||
| 10349 | # Check for improper arguments | ||
| 10350 | if (defined $check) { | ||
| 10351 | |||
| 10352 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windowsTab', @_); | ||
| 10353 | } | ||
| 10354 | |||
| 10355 | # Tab setup | ||
| 10356 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 10357 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'W_indows'); | ||
| 10358 | |||
| 10359 | # Add tabs to the inner notebook | ||
| 10360 | $self->windows1Tab($innerNotebook); | ||
| 10361 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 10362 | |||
| 10363 | $self->windows2Tab($innerNotebook); | ||
| 10364 | $self->windows3Tab($innerNotebook); | ||
| 10365 | $self->windows4Tab($innerNotebook); | ||
| 10366 | $self->windows5Tab($innerNotebook); | ||
| 10367 | $self->windows6Tab($innerNotebook); | ||
| 10368 | } | ||
| 10369 | |||
| 10370 | return 1; | ||
| 10371 | } | ||
| 10372 | |||
| 10373 | sub windows1Tab { | ||
| 10374 | |||
| 10375 | # Windows1 tab | ||
| 10376 | # | ||
| 10377 | # Expected arguments | ||
| 10378 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 10379 | # | ||
| 10380 | # Return values | ||
| 10381 | # 'undef' on improper arguments | ||
| 10382 | # 1 otherwise | ||
| 10383 | |||
| 10384 | my ($self, $innerNotebook, $check) = @_; | ||
| 10385 | |||
| 10386 | # Local variables | ||
| 10387 | my ($maxWidth, $maxHeight); | ||
| 10388 | |||
| 10389 | # Check for improper arguments | ||
| 10390 | if (! defined $innerNotebook || defined $check) { | ||
| 10391 | |||
| 10392 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows1Tab', @_); | ||
| 10393 | } | ||
| 10394 | |||
| 10395 | # Tab setup | ||
| 10396 | my $grid = $self->addTab( | ||
| 10397 | $innerNotebook, | ||
| 10398 | 'Page _1', | ||
| 10399 | ['Window size settings', 'Edit/preference window settings'], | ||
| 10400 | ); | ||
| 10401 | |||
| 10402 | # Window size settings | ||
| 10403 | $self->addLabel($grid, '<b>Window size settings</b>', | ||
| 10404 | 0, 12, 0, 1); | ||
| 10405 | |||
| 10406 | $maxWidth = $axmud::CLIENT->constWorkspaceMaxWidth; | ||
| 10407 | $maxHeight = $axmud::CLIENT->constWorkspaceMaxHeight; | ||
| 10408 | |||
| 10409 | $self->addLabel($grid, 'Default width for \'main\' windows (range 100-' . $maxWidth . ')', | ||
| 10410 | 1, 6, 1, 2); | ||
| 10411 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth, | ||
| 10412 | 6, 8, 1, 2, 8, 8); | ||
| 10413 | $entry->set_text($axmud::CLIENT->customMainWinWidth); | ||
| 10414 | |||
| 10415 | $self->addLabel( | ||
| 10416 | $grid, | ||
| 10417 | 'Default height for \'main\' windows (range 100-' . $maxHeight . ')', | ||
| 10418 | 1, 6, 2, 3); | ||
| 10419 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight, | ||
| 10420 | 6, 8, 2, 3, 8, 8); | ||
| 10421 | $entry2->set_text($axmud::CLIENT->customMainWinHeight); | ||
| 10422 | |||
| 10423 | my $button = $self->addButton($grid, | ||
| 10424 | 'Set', 'Set the default width/height', undef, | ||
| 10425 | 8, 10, 2, 3); | ||
| 10426 | $button->signal_connect('clicked' => sub { | ||
| 10427 | |||
| 10428 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 10429 | |||
| 10430 | $self->session->pseudoCmd( | ||
| 10431 | 'setwindowsize -m ' . $entry->get_text() . ' ' . $entry2->get_text(), | ||
| 10432 | $self->pseudoCmdMode, | ||
| 10433 | ); | ||
| 10434 | |||
| 10435 | $entry->set_text($axmud::CLIENT->customMainWinWidth); | ||
| 10436 | $entry2->set_text($axmud::CLIENT->customMainWinHeight); | ||
| 10437 | } | ||
| 10438 | }); | ||
| 10439 | |||
| 10440 | my $button2 = $self->addButton($grid, | ||
| 10441 | 'Reset', 'Reset the default width/height', undef, | ||
| 10442 | 10, 12, 2, 3); | ||
| 10443 | $button2->signal_connect('clicked' => sub { | ||
| 10444 | |||
| 10445 | $self->session->pseudoCmd( | ||
| 10446 | 'setwindowsize -m', | ||
| 10447 | $self->pseudoCmdMode, | ||
| 10448 | ); | ||
| 10449 | |||
| 10450 | $entry->set_text($axmud::CLIENT->customMainWinWidth); | ||
| 10451 | $entry2->set_text($axmud::CLIENT->customMainWinHeight); | ||
| 10452 | }); | ||
| 10453 | |||
| 10454 | $self->addLabel( | ||
| 10455 | $grid, | ||
| 10456 | 'Default width for other \'grid\' windows (range 100-' . $maxWidth . ')', | ||
| 10457 | 1, 6, 3, 4); | ||
| 10458 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth, | ||
| 10459 | 6, 8, 3, 4, 8, 8); | ||
| 10460 | $entry3->set_text($axmud::CLIENT->customGridWinWidth); | ||
| 10461 | |||
| 10462 | $self->addLabel( | ||
| 10463 | $grid, | ||
| 10464 | 'Default height for other \'grid\' windows (range 100-' . $maxHeight . ')', | ||
| 10465 | 1, 6, 4, 5); | ||
| 10466 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight, | ||
| 10467 | 6, 8, 4, 5, 8, 8); | ||
| 10468 | $entry4->set_text($axmud::CLIENT->customGridWinHeight); | ||
| 10469 | |||
| 10470 | my $button3 = $self->addButton($grid, | ||
| 10471 | 'Set', 'Set the default width/height', undef, | ||
| 10472 | 8, 10, 4, 5); | ||
| 10473 | $button3->signal_connect('clicked' => sub { | ||
| 10474 | |||
| 10475 | if ($self->checkEntryIcon($entry3, $entry4)) { | ||
| 10476 | |||
| 10477 | $self->session->pseudoCmd( | ||
| 10478 | 'setwindowsize -g ' . $entry3->get_text() . ' ' . $entry4->get_text(), | ||
| 10479 | $self->pseudoCmdMode, | ||
| 10480 | ); | ||
| 10481 | |||
| 10482 | $entry3->set_text($axmud::CLIENT->customGridWinWidth); | ||
| 10483 | $entry4->set_text($axmud::CLIENT->customGridWinHeight); | ||
| 10484 | } | ||
| 10485 | }); | ||
| 10486 | |||
| 10487 | my $button4 = $self->addButton($grid, | ||
| 10488 | 'Reset', 'Reset the default width/height', undef, | ||
| 10489 | 10, 12, 4, 5); | ||
| 10490 | $button4->signal_connect('clicked' => sub { | ||
| 10491 | |||
| 10492 | $self->session->pseudoCmd( | ||
| 10493 | 'setwindowsize -g', | ||
| 10494 | $self->pseudoCmdMode, | ||
| 10495 | ); | ||
| 10496 | |||
| 10497 | $entry3->set_text($axmud::CLIENT->customGridWinWidth); | ||
| 10498 | $entry4->set_text($axmud::CLIENT->customGridWinHeight); | ||
| 10499 | }); | ||
| 10500 | |||
| 10501 | $self->addLabel( | ||
| 10502 | $grid, | ||
| 10503 | '<i>Tip: Only increase the \'free\' window size if <u>this</u> window is too small for' | ||
| 10504 | . ' comfort</i>', | ||
| 10505 | 1, 12, 5, 6); | ||
| 10506 | |||
| 10507 | $self->addLabel( | ||
| 10508 | $grid, | ||
| 10509 | 'Default width for \'free\' windows (range 100-' . $maxWidth . ')', | ||
| 10510 | 1, 6, 6, 7); | ||
| 10511 | my $entry5 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxWidth, | ||
| 10512 | 6, 8, 6, 7, 8, 8); | ||
| 10513 | $entry5->set_text($axmud::CLIENT->customFreeWinWidth); | ||
| 10514 | |||
| 10515 | $self->addLabel( | ||
| 10516 | $grid, | ||
| 10517 | 'Default height for \'free\' windows (range 100-' . $maxHeight . ')', | ||
| 10518 | 1, 6, 7, 8); | ||
| 10519 | my $entry6 = $self->addEntryWithIcon($grid, undef, 'int', 100, $maxHeight, | ||
| 10520 | 6, 8, 7, 8, 8, 8); | ||
| 10521 | $entry6->set_text($axmud::CLIENT->customFreeWinHeight); | ||
| 10522 | |||
| 10523 | my $button5 = $self->addButton($grid, | ||
| 10524 | 'Set', 'Set the default width/height', undef, | ||
| 10525 | 8, 10, 7, 8); | ||
| 10526 | $button5->signal_connect('clicked' => sub { | ||
| 10527 | |||
| 10528 | if ($self->checkEntryIcon($entry5, $entry6)) { | ||
| 10529 | |||
| 10530 | $self->session->pseudoCmd( | ||
| 10531 | 'setwindowsize -f ' . $entry5->get_text() . ' ' . $entry6->get_text(), | ||
| 10532 | $self->pseudoCmdMode, | ||
| 10533 | ); | ||
| 10534 | |||
| 10535 | $entry5->set_text($axmud::CLIENT->customFreeWinWidth); | ||
| 10536 | $entry6->set_text($axmud::CLIENT->customFreeWinHeight); | ||
| 10537 | } | ||
| 10538 | }); | ||
| 10539 | |||
| 10540 | my $button6 = $self->addButton($grid, | ||
| 10541 | 'Reset', 'Reset the default width/height', undef, | ||
| 10542 | 10, 12, 7, 8); | ||
| 10543 | $button6->signal_connect('clicked' => sub { | ||
| 10544 | |||
| 10545 | $self->session->pseudoCmd( | ||
| 10546 | 'setwindowsize -f', | ||
| 10547 | $self->pseudoCmdMode, | ||
| 10548 | ); | ||
| 10549 | |||
| 10550 | $entry5->set_text($axmud::CLIENT->customFreeWinWidth); | ||
| 10551 | $entry6->set_text($axmud::CLIENT->customFreeWinHeight); | ||
| 10552 | }); | ||
| 10553 | |||
| 10554 | # Edit/preference window settings | ||
| 10555 | $self->addLabel($grid, '<b>Edit/preference window settings</b>', | ||
| 10556 | 0, 12, 8, 9); | ||
| 10557 | |||
| 10558 | my $checkButton = $self->addCheckButton( | ||
| 10559 | $grid, | ||
| 10560 | 'Show a topic index on the left-hand side (applied when the next window opens)', | ||
| 10561 | undef, TRUE, | ||
| 10562 | 0, 12, 9, 10); | ||
| 10563 | $checkButton->set_active($axmud::CLIENT->configWinIndexFlag); | ||
| 10564 | $checkButton->signal_connect('toggled' => sub { | ||
| 10565 | |||
| 10566 | if ( | ||
| 10567 | (! $axmud::CLIENT->configWinIndexFlag && $checkButton->get_active()) | ||
| 10568 | || ($axmud::CLIENT->configWinIndexFlag && ! $checkButton->get_active()) | ||
| 10569 | ) { | ||
| 10570 | $self->session->pseudoCmd( | ||
| 10571 | 'setwindowsize -i', | ||
| 10572 | $self->pseudoCmdMode, | ||
| 10573 | ); | ||
| 10574 | } | ||
| 10575 | }); | ||
| 10576 | |||
| 10577 | my $checkButton2 = $self->addCheckButton( | ||
| 10578 | $grid, | ||
| 10579 | 'Hide less useful tabs in preference windows (applied when the next window opens)', | ||
| 10580 | undef, TRUE, | ||
| 10581 | 0, 12, 10, 11); | ||
| 10582 | $checkButton2->set_active($axmud::CLIENT->configWinSimplifyFlag); | ||
| 10583 | $checkButton2->signal_connect('toggled' => sub { | ||
| 10584 | |||
| 10585 | if ( | ||
| 10586 | (! $axmud::CLIENT->configWinSimplifyFlag && $checkButton2->get_active()) | ||
| 10587 | || ($axmud::CLIENT->configWinSimplifyFlag && ! $checkButton2->get_active()) | ||
| 10588 | ) { | ||
| 10589 | $self->session->pseudoCmd( | ||
| 10590 | 'setwindowsize -s', | ||
| 10591 | $self->pseudoCmdMode, | ||
| 10592 | ); | ||
| 10593 | } | ||
| 10594 | }); | ||
| 10595 | |||
| 10596 | $self->addLabel( | ||
| 10597 | $grid, | ||
| 10598 | 'Default index width in edit/preference windows (range 0-' . $maxWidth . ')', | ||
| 10599 | 1, 6, 11, 12); | ||
| 10600 | my $entry7 = $self->addEntryWithIcon($grid, undef, 'int', 0, $maxWidth, | ||
| 10601 | 6, 8, 11, 12, 8, 8); | ||
| 10602 | $entry7->set_text($axmud::CLIENT->customConfigWinIndexWidth); | ||
| 10603 | |||
| 10604 | my $button7 = $self->addButton($grid, | ||
| 10605 | 'Set', 'Set the default width', undef, | ||
| 10606 | 8, 10, 11, 12); | ||
| 10607 | $button7->signal_connect('clicked' => sub { | ||
| 10608 | |||
| 10609 | if ($self->checkEntryIcon($entry7)) { | ||
| 10610 | |||
| 10611 | $self->session->pseudoCmd( | ||
| 10612 | 'setwindowsize -w ' . $entry7->get_text(), | ||
| 10613 | $self->pseudoCmdMode, | ||
| 10614 | ); | ||
| 10615 | |||
| 10616 | $entry7->set_text($axmud::CLIENT->customConfigWinIndexWidth); | ||
| 10617 | } | ||
| 10618 | }); | ||
| 10619 | |||
| 10620 | my $button8 = $self->addButton($grid, | ||
| 10621 | 'Reset', 'Reset the default width', undef, | ||
| 10622 | 10, 12, 11, 12); | ||
| 10623 | $button8->signal_connect('clicked' => sub { | ||
| 10624 | |||
| 10625 | $self->session->pseudoCmd( | ||
| 10626 | 'setwindowsize -w', | ||
| 10627 | $self->pseudoCmdMode, | ||
| 10628 | ); | ||
| 10629 | |||
| 10630 | $entry7->set_text($axmud::CLIENT->customConfigWinIndexWidth); | ||
| 10631 | }); | ||
| 10632 | |||
| 10633 | # Tab complete | ||
| 10634 | return 1; | ||
| 10635 | } | ||
| 10636 | |||
| 10637 | sub windows2Tab { | ||
| 10638 | |||
| 10639 | # Windows2 tab | ||
| 10640 | # | ||
| 10641 | # Expected arguments | ||
| 10642 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 10643 | # | ||
| 10644 | # Return values | ||
| 10645 | # 'undef' on improper arguments | ||
| 10646 | # 1 otherwise | ||
| 10647 | |||
| 10648 | my ($self, $innerNotebook, $check) = @_; | ||
| 10649 | |||
| 10650 | # Local variables | ||
| 10651 | my @columnList; | ||
| 10652 | |||
| 10653 | # Check for improper arguments | ||
| 10654 | if (! defined $innerNotebook || defined $check) { | ||
| 10655 | |||
| 10656 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows2Tab', @_); | ||
| 10657 | } | ||
| 10658 | |||
| 10659 | # Tab setup | ||
| 10660 | my $grid = $self->addTab( | ||
| 10661 | $innerNotebook, | ||
| 10662 | 'Page _2', | ||
| 10663 | ['\'Grid\' windows'], | ||
| 10664 | ); | ||
| 10665 | |||
| 10666 | # 'Grid' windows | ||
| 10667 | $self->addLabel($grid, '<b>\'Grid\' windows</b>', | ||
| 10668 | 0, 13, 0, 1); | ||
| 10669 | $self->addLabel($grid, '<i>List of windows that can be arranged on a workspace grid</i>', | ||
| 10670 | 1, 13, 1, 2); | ||
| 10671 | |||
| 10672 | # Add a simple list | ||
| 10673 | @columnList = ( | ||
| 10674 | '#', 'int', | ||
| 10675 | 'Type', 'text', | ||
| 10676 | 'Name', 'text', | ||
| 10677 | 'Enab', 'bool', | ||
| 10678 | 'Vis', 'bool', | ||
| 10679 | 'Gtk', 'bool', | ||
| 10680 | 'Wsp', 'int', | ||
| 10681 | 'WGrd', 'text', | ||
| 10682 | 'Sesn', 'text', | ||
| 10683 | 'Zone', 'int', | ||
| 10684 | 'Layer', 'int', | ||
| 10685 | 'X/Y', 'text', | ||
| 10686 | 'Wid/Hei', 'text', | ||
| 10687 | 'Zone X/Y', 'text', | ||
| 10688 | 'Wid/Hei', 'text', | ||
| 10689 | ); | ||
| 10690 | |||
| 10691 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 10692 | 1, 13, 2, 8); | ||
| 10693 | |||
| 10694 | # Refresh the list | ||
| 10695 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10696 | |||
| 10697 | # Add editing buttons | ||
| 10698 | my $button = $self->addButton($grid, | ||
| 10699 | 'View...', 'View the selected window\'s settings', undef, | ||
| 10700 | 1, 3, 8, 9); | ||
| 10701 | $button->signal_connect('clicked' => sub { | ||
| 10702 | |||
| 10703 | my ($number, $winObj); | ||
| 10704 | |||
| 10705 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10706 | if (defined $number) { | ||
| 10707 | |||
| 10708 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10709 | if ($winObj) { | ||
| 10710 | |||
| 10711 | # Open an 'edit' window for the selected 'grid' window | ||
| 10712 | $self->createFreeWin( | ||
| 10713 | 'Games::Axmud::EditWin::Window', | ||
| 10714 | $self, | ||
| 10715 | $self->session, | ||
| 10716 | 'Edit \'grid\' window #' . $number, | ||
| 10717 | $winObj, | ||
| 10718 | FALSE, # Not temporary | ||
| 10719 | ); | ||
| 10720 | } | ||
| 10721 | } | ||
| 10722 | |||
| 10723 | # Refresh the simple list | ||
| 10724 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10725 | }); | ||
| 10726 | |||
| 10727 | my $button2 = $self->addButton($grid, | ||
| 10728 | 'Restore', 'Restore the selected window to its allocated zone', undef, | ||
| 10729 | 3, 5, 8, 9); | ||
| 10730 | $button2->signal_connect('clicked' => sub { | ||
| 10731 | |||
| 10732 | my ($number, $winObj); | ||
| 10733 | |||
| 10734 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10735 | if (defined $number) { | ||
| 10736 | |||
| 10737 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10738 | if ($winObj) { | ||
| 10739 | |||
| 10740 | # Restore the window | ||
| 10741 | $self->session->pseudoCmd('restorewindow ' . $number, $self->pseudoCmdMode); | ||
| 10742 | } | ||
| 10743 | } | ||
| 10744 | |||
| 10745 | # Refresh the simple list | ||
| 10746 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10747 | }); | ||
| 10748 | |||
| 10749 | my $button3 = $self->addButton($grid, | ||
| 10750 | 'Restore all', 'Restore all windows to their allocated zones', undef, | ||
| 10751 | 5, 7, 8, 9); | ||
| 10752 | $button3->signal_connect('clicked' => sub { | ||
| 10753 | |||
| 10754 | # Restore all windows | ||
| 10755 | $self->session->pseudoCmd('restorewindow', $self->pseudoCmdMode); | ||
| 10756 | |||
| 10757 | # Refresh the simple list and entry boxes | ||
| 10758 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10759 | }); | ||
| 10760 | |||
| 10761 | my $button4 = $self->addButton($grid, 'Close', 'Close the selected window', undef, | ||
| 10762 | 7, 9, 8, 9); | ||
| 10763 | $button4->signal_connect('clicked' => sub { | ||
| 10764 | |||
| 10765 | my ($number, $winObj); | ||
| 10766 | |||
| 10767 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10768 | if (defined $number) { | ||
| 10769 | |||
| 10770 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10771 | if ($winObj) { | ||
| 10772 | |||
| 10773 | # Close the window | ||
| 10774 | $self->session->pseudoCmd('closewindow ' . $number, $self->pseudoCmdMode); | ||
| 10775 | } | ||
| 10776 | } | ||
| 10777 | |||
| 10778 | # Refresh the simple list | ||
| 10779 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10780 | }); | ||
| 10781 | |||
| 10782 | my $button5 = $self->addButton($grid, | ||
| 10783 | 'Fix', 'Fix the selected window in whichever zone it is currently located', undef, | ||
| 10784 | 9, 11, 8, 9); | ||
| 10785 | $button5->signal_connect('clicked' => sub { | ||
| 10786 | |||
| 10787 | my ($number, $winObj); | ||
| 10788 | |||
| 10789 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10790 | if (defined $number) { | ||
| 10791 | |||
| 10792 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10793 | if ($winObj) { | ||
| 10794 | |||
| 10795 | # Fix the window | ||
| 10796 | $self->session->pseudoCmd('fixwindow ' . $number, $self->pseudoCmdMode); | ||
| 10797 | } | ||
| 10798 | } | ||
| 10799 | |||
| 10800 | # Refresh the simple list | ||
| 10801 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10802 | }); | ||
| 10803 | |||
| 10804 | my $button6 = $self->addButton( | ||
| 10805 | $grid, | ||
| 10806 | 'Fix/Resize', | ||
| 10807 | 'Fix the selected window in whichever zone it is currently located, and resize to fit' | ||
| 10808 | . ' if possible', | ||
| 10809 | undef, | ||
| 10810 | 11, 13, 8, 9); | ||
| 10811 | $button6->signal_connect('clicked' => sub { | ||
| 10812 | |||
| 10813 | my ($number, $winObj); | ||
| 10814 | |||
| 10815 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10816 | if (defined $number) { | ||
| 10817 | |||
| 10818 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10819 | if ($winObj) { | ||
| 10820 | |||
| 10821 | # Fix/resize the window | ||
| 10822 | $self->session->pseudoCmd('fixwindow -r ' . $number, $self->pseudoCmdMode); | ||
| 10823 | } | ||
| 10824 | } | ||
| 10825 | |||
| 10826 | # Refresh the simple list | ||
| 10827 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10828 | }); | ||
| 10829 | |||
| 10830 | $self->addLabel($grid, 'Workspace', | ||
| 10831 | 1, 2, 9, 10); | ||
| 10832 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 10833 | 2, 5, 9, 10); | ||
| 10834 | $self->addLabel($grid, 'Zone', | ||
| 10835 | 5, 6, 9, 10); | ||
| 10836 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 10837 | 6, 9, 9, 10); | ||
| 10838 | |||
| 10839 | my $button7 = $self->addButton($grid, | ||
| 10840 | 'Move', | ||
| 10841 | 'Move the selected window to the specified workspace and/or zone', | ||
| 10842 | undef, | ||
| 10843 | 9, 11, 9, 10); | ||
| 10844 | $button7->signal_connect('clicked' => sub { | ||
| 10845 | |||
| 10846 | my ($number, $winObj, $cmd); | ||
| 10847 | |||
| 10848 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10849 | if (defined $number) { | ||
| 10850 | |||
| 10851 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10852 | if ($winObj) { | ||
| 10853 | |||
| 10854 | $cmd = 'movewindow ' . $number; | ||
| 10855 | |||
| 10856 | if ($self->checkEntryIcon($entry)) { | ||
| 10857 | |||
| 10858 | # Use specified workspace | ||
| 10859 | $cmd .= ' ' . $entry->get_text(); | ||
| 10860 | |||
| 10861 | } else { | ||
| 10862 | |||
| 10863 | # Use window's existing workspace | ||
| 10864 | $cmd .= ' ' . $winObj->workspaceObj->number; | ||
| 10865 | } | ||
| 10866 | |||
| 10867 | if ($self->checkEntryIcon($entry2)) { | ||
| 10868 | |||
| 10869 | $cmd .= ' ' . $entry2->get_text(); | ||
| 10870 | } | ||
| 10871 | |||
| 10872 | # Move the window and reset entry boxes | ||
| 10873 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 10874 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10875 | } | ||
| 10876 | } | ||
| 10877 | |||
| 10878 | # Refresh the simple list | ||
| 10879 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10880 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10881 | }); | ||
| 10882 | |||
| 10883 | my $button8 = $self->addButton( | ||
| 10884 | $grid, | ||
| 10885 | 'Move/Resize', | ||
| 10886 | 'Move the selected window to the specified workspace and/or zone, and resize' | ||
| 10887 | . ' if possible', | ||
| 10888 | undef, | ||
| 10889 | 11, 13, 9, 10); | ||
| 10890 | $button8->signal_connect('clicked' => sub { | ||
| 10891 | |||
| 10892 | my ($number, $winObj, $cmd); | ||
| 10893 | |||
| 10894 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10895 | if (defined $number) { | ||
| 10896 | |||
| 10897 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10898 | if ($winObj) { | ||
| 10899 | |||
| 10900 | $cmd = 'movewindow -r ' . $number; | ||
| 10901 | |||
| 10902 | if ($self->checkEntryIcon($entry)) { | ||
| 10903 | |||
| 10904 | # Use specified workspace | ||
| 10905 | $cmd .= ' ' . $entry->get_text(); | ||
| 10906 | |||
| 10907 | } else { | ||
| 10908 | |||
| 10909 | # Use window's existing workspace | ||
| 10910 | $cmd .= ' ' . $winObj->workspaceObj->number; | ||
| 10911 | } | ||
| 10912 | |||
| 10913 | if ($self->checkEntryIcon($entry2)) { | ||
| 10914 | |||
| 10915 | $cmd .= ' ' . $entry2->get_text(); | ||
| 10916 | } | ||
| 10917 | |||
| 10918 | # Move the window and reset entry boxes | ||
| 10919 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 10920 | $self->resetEntryBoxes($entry, $entry2); | ||
| 10921 | } | ||
| 10922 | } | ||
| 10923 | |||
| 10924 | # Refresh the simple list | ||
| 10925 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10926 | }); | ||
| 10927 | |||
| 10928 | $self->addLabel($grid, 'Pattern', | ||
| 10929 | 1, 2, 10, 11); | ||
| 10930 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 10931 | 2, 5, 10, 11); | ||
| 10932 | my $button9 = $self->addButton($grid, | ||
| 10933 | 'Grab', 'Incorporate the first window matching the specified pattern (regex)', undef, | ||
| 10934 | 5, 7, 10, 11); | ||
| 10935 | $button9->signal_connect('clicked' => sub { | ||
| 10936 | |||
| 10937 | my $regex; | ||
| 10938 | |||
| 10939 | if ($self->checkEntryIcon($entry3)) { | ||
| 10940 | |||
| 10941 | $regex = $entry3->get_text(); | ||
| 10942 | |||
| 10943 | # Grab the window matching the regex | ||
| 10944 | $self->session->pseudoCmd( | ||
| 10945 | 'grabwindow <' . $regex . '>', | ||
| 10946 | $self->pseudoCmdMode, | ||
| 10947 | ); | ||
| 10948 | |||
| 10949 | # Refresh the simple list and entry boxes | ||
| 10950 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10951 | $self->resetEntryBoxes($entry3); | ||
| 10952 | } | ||
| 10953 | }); | ||
| 10954 | |||
| 10955 | my $button10 = $self->addButton($grid, | ||
| 10956 | 'Grab All', 'Incorporate all windows matching the specified pattern (regex)', undef, | ||
| 10957 | 7, 9, 10, 11); | ||
| 10958 | $button10->signal_connect('clicked' => sub { | ||
| 10959 | |||
| 10960 | my $regex; | ||
| 10961 | |||
| 10962 | if ($self->checkEntryIcon($entry3)) { | ||
| 10963 | |||
| 10964 | $regex = $entry3->get_text(); | ||
| 10965 | |||
| 10966 | # Grab all windows matching the regex | ||
| 10967 | $self->session->pseudoCmd( | ||
| 10968 | 'grabwindow -a <' . $regex . '>', | ||
| 10969 | $self->pseudoCmdMode, | ||
| 10970 | ); | ||
| 10971 | |||
| 10972 | # Refresh the simple list and entry boxes | ||
| 10973 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 10974 | $self->resetEntryBoxes($entry3); | ||
| 10975 | } | ||
| 10976 | }); | ||
| 10977 | |||
| 10978 | my $button11 = $self->addButton($grid, | ||
| 10979 | 'Banish', 'Remove the selected external window from its workspace grid', undef, | ||
| 10980 | 9, 11, 10, 11); | ||
| 10981 | $button11->signal_connect('clicked' => sub { | ||
| 10982 | |||
| 10983 | my ($number, $winObj); | ||
| 10984 | |||
| 10985 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 10986 | if (defined $number) { | ||
| 10987 | |||
| 10988 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 10989 | if ($winObj) { | ||
| 10990 | |||
| 10991 | |||
| 10992 | # Banish the external window | ||
| 10993 | $self->session->pseudoCmd('banishwindow ' . $number, $self->pseudoCmdMode); | ||
| 10994 | } | ||
| 10995 | } | ||
| 10996 | |||
| 10997 | # Refresh the simple list | ||
| 10998 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 10999 | }); | ||
| 11000 | |||
| 11001 | my $button12 = $self->addButton($grid, | ||
| 11002 | 'Banish all', 'Remove all external windows from their workspace grids', undef, | ||
| 11003 | 11, 13, 10, 11); | ||
| 11004 | $button12->signal_connect('clicked' => sub { | ||
| 11005 | |||
| 11006 | # Banish all external windows | ||
| 11007 | $self->session->pseudoCmd('banishwindow', $self->pseudoCmdMode); | ||
| 11008 | |||
| 11009 | # Refresh the simple list | ||
| 11010 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11011 | }); | ||
| 11012 | |||
| 11013 | $self->addLabel($grid, 'Window', | ||
| 11014 | 1, 2, 11, 12); | ||
| 11015 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 11016 | 2, 5, 11, 12); | ||
| 11017 | my $button13 = $self->addButton($grid, | ||
| 11018 | 'Swap', 'Swap the selected window with the specified window', undef, | ||
| 11019 | 5, 7, 11, 12); | ||
| 11020 | $button13->signal_connect('clicked' => sub { | ||
| 11021 | |||
| 11022 | my ($number, $winObj, $swapNumber, $swapWinObj); | ||
| 11023 | |||
| 11024 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 11025 | if (defined $number) { | ||
| 11026 | |||
| 11027 | $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number); | ||
| 11028 | if ($self->checkEntryIcon($entry4)) { | ||
| 11029 | |||
| 11030 | $swapNumber = $entry4->get_text(); | ||
| 11031 | $swapWinObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $swapNumber); | ||
| 11032 | } | ||
| 11033 | |||
| 11034 | if ($winObj && $swapWinObj) { | ||
| 11035 | |||
| 11036 | # Swap the two windows | ||
| 11037 | $self->session->pseudoCmd( | ||
| 11038 | 'swapwindow ' . $number . ' ' . $swapNumber, | ||
| 11039 | $self->pseudoCmdMode, | ||
| 11040 | ); | ||
| 11041 | } | ||
| 11042 | } | ||
| 11043 | |||
| 11044 | # Refresh the simple list | ||
| 11045 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number); | ||
| 11046 | }); | ||
| 11047 | |||
| 11048 | my $button14 = $self->addButton($grid, | ||
| 11049 | 'Dump', 'Display this list of windows in the \'main\' window', undef, | ||
| 11050 | 9, 11, 11, 12); | ||
| 11051 | $button14->signal_connect('clicked' => sub { | ||
| 11052 | |||
| 11053 | # List windows | ||
| 11054 | $self->session->pseudoCmd('listwindow', $self->pseudoCmdMode); | ||
| 11055 | |||
| 11056 | # Refresh the simple list | ||
| 11057 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11058 | }); | ||
| 11059 | |||
| 11060 | my $button15 = $self->addButton($grid, | ||
| 11061 | 'Refresh list', 'Refresh the list of windows', undef, | ||
| 11062 | 11, 13, 11, 12); | ||
| 11063 | $button15->signal_connect('clicked' => sub { | ||
| 11064 | |||
| 11065 | # Refresh the simple list and entry boxes | ||
| 11066 | $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11067 | }); | ||
| 11068 | |||
| 11069 | # Tab complete | ||
| 11070 | return 1; | ||
| 11071 | } | ||
| 11072 | |||
| 11073 | sub windows2Tab_refreshList { | ||
| 11074 | |||
| 11075 | # Called by $self->windows1Tab to refresh the GA::Obj::SimpleList | ||
| 11076 | # | ||
| 11077 | # Expected arguments | ||
| 11078 | # $slWidget - The GA::Obj::SimpleList | ||
| 11079 | # $columns - The number of columns in the list | ||
| 11080 | # | ||
| 11081 | # Optional arguments | ||
| 11082 | # $number - A 'grid' window number which should be selected in the list (if specified) | ||
| 11083 | # | ||
| 11084 | # Return values | ||
| 11085 | # 'undef' on improper arguments | ||
| 11086 | # 1 otherwise | ||
| 11087 | |||
| 11088 | my ($self, $slWidget, $columns, $number, $check) = @_; | ||
| 11089 | |||
| 11090 | # Local variables | ||
| 11091 | my ( | ||
| 11092 | $count, $selectRow, | ||
| 11093 | @dataList, | ||
| 11094 | ); | ||
| 11095 | |||
| 11096 | # Check for improper arguments | ||
| 11097 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 11098 | |||
| 11099 | return $axmud::CLIENT->writeImproper( | ||
| 11100 | $self->_objClass . '->windows2Tab_refreshList', | ||
| 11101 | @_, | ||
| 11102 | ); | ||
| 11103 | } | ||
| 11104 | |||
| 11105 | # Compile the simple list data | ||
| 11106 | $count = 0; | ||
| 11107 | foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins()) { | ||
| 11108 | |||
| 11109 | my ($gtkFlag, $gridString, $sessionString, $areaObj); | ||
| 11110 | |||
| 11111 | if ($winObj->winWidget) { | ||
| 11112 | |||
| 11113 | $gtkFlag = TRUE; | ||
| 11114 | } | ||
| 11115 | |||
| 11116 | if (! $winObj->workspaceGridObj) { | ||
| 11117 | $gridString = ('n/a'); | ||
| 11118 | } else { | ||
| 11119 | $gridString = $winObj->workspaceGridObj->number; | ||
| 11120 | } | ||
| 11121 | |||
| 11122 | if (! $winObj->session) { | ||
| 11123 | $sessionString = ('n/a'); | ||
| 11124 | } else { | ||
| 11125 | $sessionString = $winObj->session->number; | ||
| 11126 | } | ||
| 11127 | |||
| 11128 | push (@dataList, | ||
| 11129 | $winObj->number, | ||
| 11130 | $winObj->winType, | ||
| 11131 | $winObj->winName, | ||
| 11132 | $winObj->enabledFlag, | ||
| 11133 | $winObj->visibleFlag, | ||
| 11134 | $gtkFlag, | ||
| 11135 | $winObj->workspaceObj->number, | ||
| 11136 | $gridString, | ||
| 11137 | $sessionString, | ||
| 11138 | ); | ||
| 11139 | |||
| 11140 | $areaObj = $winObj->areaObj; | ||
| 11141 | if (! $areaObj) { | ||
| 11142 | |||
| 11143 | push (@dataList, undef, undef, undef, undef, undef, undef); | ||
| 11144 | |||
| 11145 | } else { | ||
| 11146 | |||
| 11147 | push (@dataList, | ||
| 11148 | $areaObj->zoneObj->number, | ||
| 11149 | $areaObj->layer, | ||
| 11150 | $areaObj->xPosPixels . '/' . $areaObj->yPosPixels, | ||
| 11151 | $areaObj->widthPixels . '/' . $areaObj->heightPixels, | ||
| 11152 | $areaObj->leftBlocks . '/' . $areaObj->topBlocks, | ||
| 11153 | $areaObj->widthBlocks . '/' . $areaObj->heightBlocks, | ||
| 11154 | ); | ||
| 11155 | } | ||
| 11156 | |||
| 11157 | if (defined $number && $winObj->number eq $number) { | ||
| 11158 | |||
| 11159 | $selectRow = $count; | ||
| 11160 | } | ||
| 11161 | |||
| 11162 | $count++; | ||
| 11163 | } | ||
| 11164 | |||
| 11165 | # Reset the simple list | ||
| 11166 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 11167 | |||
| 11168 | # Select a row, if required | ||
| 11169 | if (defined $selectRow) { | ||
| 11170 | |||
| 11171 | $slWidget->select($selectRow); | ||
| 11172 | } | ||
| 11173 | |||
| 11174 | return 1; | ||
| 11175 | } | ||
| 11176 | |||
| 11177 | sub windows3Tab { | ||
| 11178 | |||
| 11179 | # Windows3 tab | ||
| 11180 | # | ||
| 11181 | # Expected arguments | ||
| 11182 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 11183 | # | ||
| 11184 | # Return values | ||
| 11185 | # 'undef' on improper arguments | ||
| 11186 | # 1 otherwise | ||
| 11187 | |||
| 11188 | my ($self, $innerNotebook, $check) = @_; | ||
| 11189 | |||
| 11190 | # Local variables | ||
| 11191 | my @columnList; | ||
| 11192 | |||
| 11193 | # Check for improper arguments | ||
| 11194 | if (! defined $innerNotebook || defined $check) { | ||
| 11195 | |||
| 11196 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows3Tab', @_); | ||
| 11197 | } | ||
| 11198 | |||
| 11199 | # Tab setup | ||
| 11200 | my $grid = $self->addTab( | ||
| 11201 | $innerNotebook, | ||
| 11202 | 'Page _3', | ||
| 11203 | ['\'Free\' windows'], | ||
| 11204 | ); | ||
| 11205 | |||
| 11206 | # 'Free' windows | ||
| 11207 | $self->addLabel($grid, '<b>\'Free\' windows</b>', | ||
| 11208 | 0, 12, 0, 1); | ||
| 11209 | $self->addLabel( | ||
| 11210 | $grid, | ||
| 11211 | '<i>List of windows that can\'t be arranged on a workspace grid (doesn\'t include' | ||
| 11212 | . ' \'dialogue\' windows)</i>', | ||
| 11213 | 1, 12, 1, 2); | ||
| 11214 | |||
| 11215 | # Add a simple list | ||
| 11216 | @columnList = ( | ||
| 11217 | '#', 'int', | ||
| 11218 | 'Type', 'text', | ||
| 11219 | 'Name', 'text', | ||
| 11220 | 'Enab', 'bool', | ||
| 11221 | 'Vis', 'bool', | ||
| 11222 | 'Gtk', 'bool', | ||
| 11223 | 'Wsp', 'int', | ||
| 11224 | 'Sesn', 'int', | ||
| 11225 | ); | ||
| 11226 | |||
| 11227 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 11228 | 1, 12, 2, 10); | ||
| 11229 | |||
| 11230 | # Refresh the list | ||
| 11231 | $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11232 | |||
| 11233 | # Add editing buttons | ||
| 11234 | my $button = $self->addButton($grid, | ||
| 11235 | 'View...', 'View the selected window\'s settings', undef, | ||
| 11236 | 1, 3, 10, 11); | ||
| 11237 | $button->signal_connect('clicked' => sub { | ||
| 11238 | |||
| 11239 | my ($number, $winObj); | ||
| 11240 | |||
| 11241 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 11242 | if (defined $number) { | ||
| 11243 | |||
| 11244 | $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number); | ||
| 11245 | if ($winObj) { | ||
| 11246 | |||
| 11247 | # Open an 'edit' window for the selected 'free' window | ||
| 11248 | $self->createFreeWin( | ||
| 11249 | 'Games::Axmud::EditWin::Window', | ||
| 11250 | $self, | ||
| 11251 | $self->session, | ||
| 11252 | 'Edit \'free\' window #' . $number, | ||
| 11253 | $winObj, | ||
| 11254 | FALSE, # Not temporary | ||
| 11255 | ); | ||
| 11256 | } | ||
| 11257 | } | ||
| 11258 | |||
| 11259 | # Refresh the simple list | ||
| 11260 | $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11261 | }); | ||
| 11262 | |||
| 11263 | my $button2 = $self->addButton($grid, 'Close', 'Close the selected window', undef, | ||
| 11264 | 3, 5, 10, 11); | ||
| 11265 | $button2->signal_connect('clicked' => sub { | ||
| 11266 | |||
| 11267 | my ($number, $winObj); | ||
| 11268 | |||
| 11269 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 11270 | if (defined $number) { | ||
| 11271 | |||
| 11272 | $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number); | ||
| 11273 | if ($winObj) { | ||
| 11274 | |||
| 11275 | # Close the window | ||
| 11276 | $self->session->pseudoCmd('closefreewindow ' . $number, $self->pseudoCmdMode); | ||
| 11277 | |||
| 11278 | if ($winObj ne $self) { | ||
| 11279 | |||
| 11280 | # Refresh the simple list | ||
| 11281 | $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11282 | } | ||
| 11283 | } | ||
| 11284 | } | ||
| 11285 | }); | ||
| 11286 | |||
| 11287 | my $button14 = $self->addButton($grid, | ||
| 11288 | 'Dump', 'Display this list of windows in the \'main\' window', undef, | ||
| 11289 | 8, 10, 10, 11); | ||
| 11290 | $button14->signal_connect('clicked' => sub { | ||
| 11291 | |||
| 11292 | # List windows | ||
| 11293 | $self->session->pseudoCmd('listfreewindow', $self->pseudoCmdMode); | ||
| 11294 | |||
| 11295 | # Refresh the simple list | ||
| 11296 | $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11297 | }); | ||
| 11298 | |||
| 11299 | my $button15 = $self->addButton($grid, | ||
| 11300 | 'Refresh list', 'Refresh the list of windows', undef, | ||
| 11301 | 10, 12, 10, 11); | ||
| 11302 | $button15->signal_connect('clicked' => sub { | ||
| 11303 | |||
| 11304 | # Refresh the simple list and entry boxes | ||
| 11305 | $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11306 | }); | ||
| 11307 | |||
| 11308 | # Tab complete | ||
| 11309 | return 1; | ||
| 11310 | } | ||
| 11311 | |||
| 11312 | sub windows3Tab_refreshList { | ||
| 11313 | |||
| 11314 | # Called by $self->windows2Tab to refresh the GA::Obj::SimpleList | ||
| 11315 | # | ||
| 11316 | # Expected arguments | ||
| 11317 | # $slWidget - The GA::Obj::SimpleList | ||
| 11318 | # $columns - The number of columns in the list | ||
| 11319 | # | ||
| 11320 | # Return values | ||
| 11321 | # 'undef' on improper arguments | ||
| 11322 | # 1 otherwise | ||
| 11323 | |||
| 11324 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 11325 | |||
| 11326 | # Local variables | ||
| 11327 | my @dataList; | ||
| 11328 | |||
| 11329 | # Check for improper arguments | ||
| 11330 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 11331 | |||
| 11332 | return $axmud::CLIENT->writeImproper( | ||
| 11333 | $self->_objClass . '->windows3Tab_refreshList', | ||
| 11334 | @_, | ||
| 11335 | ); | ||
| 11336 | } | ||
| 11337 | |||
| 11338 | # Compile the simple list data | ||
| 11339 | foreach my $winObj ($axmud::CLIENT->desktopObj->listFreeWins()) { | ||
| 11340 | |||
| 11341 | my ($gktFlag, $sessionString); | ||
| 11342 | |||
| 11343 | if ($winObj->winWidget) { | ||
| 11344 | |||
| 11345 | $gktFlag = TRUE; | ||
| 11346 | } | ||
| 11347 | |||
| 11348 | if (! $winObj->session) { | ||
| 11349 | $sessionString = ('n/a'); | ||
| 11350 | } else { | ||
| 11351 | $sessionString = $winObj->session->number; | ||
| 11352 | } | ||
| 11353 | |||
| 11354 | push (@dataList, | ||
| 11355 | $winObj->number, | ||
| 11356 | $winObj->winType, | ||
| 11357 | $winObj->winName, | ||
| 11358 | $winObj->enabledFlag, | ||
| 11359 | $winObj->visibleFlag, | ||
| 11360 | $gktFlag, | ||
| 11361 | $winObj->workspaceObj->number, | ||
| 11362 | $sessionString, | ||
| 11363 | ); | ||
| 11364 | } | ||
| 11365 | |||
| 11366 | # Reset the simple list | ||
| 11367 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 11368 | |||
| 11369 | return 1; | ||
| 11370 | } | ||
| 11371 | |||
| 11372 | sub windows4Tab { | ||
| 11373 | |||
| 11374 | # Windows4 tab | ||
| 11375 | # | ||
| 11376 | # Expected arguments | ||
| 11377 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 11378 | # | ||
| 11379 | # Return values | ||
| 11380 | # 'undef' on improper arguments | ||
| 11381 | # 1 otherwise | ||
| 11382 | |||
| 11383 | my ($self, $innerNotebook, $check) = @_; | ||
| 11384 | |||
| 11385 | # Local variables | ||
| 11386 | my @columnList; | ||
| 11387 | |||
| 11388 | # Check for improper arguments | ||
| 11389 | if (! defined $innerNotebook || defined $check) { | ||
| 11390 | |||
| 11391 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows4Tab', @_); | ||
| 11392 | } | ||
| 11393 | |||
| 11394 | # Tab setup | ||
| 11395 | my $grid = $self->addTab( | ||
| 11396 | $innerNotebook, | ||
| 11397 | 'Page _4', | ||
| 11398 | ['Winmaps'], | ||
| 11399 | ); | ||
| 11400 | |||
| 11401 | # Winmaps | ||
| 11402 | $self->addLabel($grid, '<b>Winmaps</b>', | ||
| 11403 | 0, 12, 0, 1); | ||
| 11404 | $self->addLabel($grid, | ||
| 11405 | '<i>List of winmaps, which determine the layout of \'internal\' windows when they are' | ||
| 11406 | . ' created</i>', | ||
| 11407 | 1, 12, 1, 2); | ||
| 11408 | |||
| 11409 | # Add a simple list | ||
| 11410 | @columnList = ( | ||
| 11411 | 'Name', 'text', | ||
| 11412 | 'Strips', 'int', | ||
| 11413 | 'Winzones', 'int', | ||
| 11414 | 'Table full', 'bool', | ||
| 11415 | 'Default \'main\'', 'bool', | ||
| 11416 | '\'main\', no grids', 'bool', | ||
| 11417 | 'Default \'internal\'', 'bool', | ||
| 11418 | 'Default for worlds', 'text', | ||
| 11419 | ); | ||
| 11420 | |||
| 11421 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 11422 | 1, 12, 2, 8); | ||
| 11423 | |||
| 11424 | # Initialise the list | ||
| 11425 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11426 | |||
| 11427 | # Add entry boxes and editing buttons | ||
| 11428 | $self->addLabel($grid, 'Name', | ||
| 11429 | 1, 3, 8, 9); | ||
| 11430 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 11431 | 3, 5, 8, 9, | ||
| 11432 | 16, 16); | ||
| 11433 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 11434 | 7, 10, 8, 9, | ||
| 11435 | 16, 16); | ||
| 11436 | |||
| 11437 | my $button = $self->addButton($grid, 'Add', 'Add the specified winmap', undef, | ||
| 11438 | 5, 7, 8, 9); | ||
| 11439 | $button->signal_connect('clicked' => sub { | ||
| 11440 | |||
| 11441 | my $name = $entry->get_text(); | ||
| 11442 | |||
| 11443 | if ($self->checkEntryIcon($entry)) { | ||
| 11444 | |||
| 11445 | # Add this zonemap | ||
| 11446 | $self->session->pseudoCmd('addwinmap ' . $name, $self->pseudoCmdMode); | ||
| 11447 | |||
| 11448 | # Refresh the simple list and entry boxes | ||
| 11449 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11450 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11451 | } | ||
| 11452 | }); | ||
| 11453 | |||
| 11454 | my $button2 = $self->addButton($grid, | ||
| 11455 | 'Clone', 'Clone the selected zonemap as a copy with this name', undef, | ||
| 11456 | 10, 12, 8, 9); | ||
| 11457 | $button2->signal_connect('clicked' => sub { | ||
| 11458 | |||
| 11459 | my ($winmap, $clone); | ||
| 11460 | |||
| 11461 | ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11462 | $clone = $entry2->get_text(); | ||
| 11463 | |||
| 11464 | if (defined $winmap && $self->checkEntryIcon($entry2)) { | ||
| 11465 | |||
| 11466 | # Clone the winmap | ||
| 11467 | $self->session->pseudoCmd( | ||
| 11468 | 'clonewinmap ' . $winmap . ' ' . $clone, | ||
| 11469 | $self->pseudoCmdMode, | ||
| 11470 | ); | ||
| 11471 | |||
| 11472 | # Refresh the simple list and reset entry boxes | ||
| 11473 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11474 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11475 | } | ||
| 11476 | }); | ||
| 11477 | |||
| 11478 | my $button3 = $self->addButton($grid, 'Edit...', 'Edit the selected winmap', undef, | ||
| 11479 | 1, 3, 9, 10); | ||
| 11480 | $button3->signal_connect('clicked' => sub { | ||
| 11481 | |||
| 11482 | my ($winmap, $obj, $childWinObj); | ||
| 11483 | |||
| 11484 | ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11485 | if (defined $winmap) { | ||
| 11486 | |||
| 11487 | $obj = $axmud::CLIENT->ivShow('winmapHash', $winmap); | ||
| 11488 | if ($obj) { | ||
| 11489 | |||
| 11490 | # Open an 'edit' window to edit the winmap | ||
| 11491 | $childWinObj = $self->createFreeWin( | ||
| 11492 | 'Games::Axmud::EditWin::Winmap', | ||
| 11493 | $self, | ||
| 11494 | $self->session, | ||
| 11495 | 'Edit winmap \'' . $winmap . '\'', | ||
| 11496 | $obj, | ||
| 11497 | FALSE, # Not temporary | ||
| 11498 | ); | ||
| 11499 | |||
| 11500 | if ($childWinObj) { | ||
| 11501 | |||
| 11502 | # When the 'edit' window closes, update widgets and/or IVs | ||
| 11503 | $self->add_childDestroy( | ||
| 11504 | $childWinObj, | ||
| 11505 | 'windows4Tab_refreshList', | ||
| 11506 | [$slWidget, (scalar @columnList / 2)], | ||
| 11507 | ); | ||
| 11508 | } | ||
| 11509 | } | ||
| 11510 | } | ||
| 11511 | }); | ||
| 11512 | |||
| 11513 | my $button4 = $self->addButton($grid, 'Delete', 'Delete the selected winmap', undef, | ||
| 11514 | 3, 5, 9, 10); | ||
| 11515 | $button4->signal_connect('clicked' => sub { | ||
| 11516 | |||
| 11517 | my ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11518 | if (defined $winmap) { | ||
| 11519 | |||
| 11520 | # Delete the winmap | ||
| 11521 | $self->session->pseudoCmd('deletewinmap ' . $winmap, $self->pseudoCmdMode); | ||
| 11522 | |||
| 11523 | # Refresh the simple list and reset entry boxes | ||
| 11524 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11525 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11526 | } | ||
| 11527 | }); | ||
| 11528 | |||
| 11529 | my $button5 = $self->addButton($grid, | ||
| 11530 | 'Reset winmap', 'Reset the selected winmap, emptying its list of winzones', undef, | ||
| 11531 | 8, 10, 9, 10); | ||
| 11532 | $button5->signal_connect('clicked' => sub { | ||
| 11533 | |||
| 11534 | my ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11535 | if (defined $winmap) { | ||
| 11536 | |||
| 11537 | # Reset the winmap | ||
| 11538 | $self->session->pseudoCmd('resetwinmap ' . $winmap, $self->pseudoCmdMode); | ||
| 11539 | |||
| 11540 | # Refresh the simple list and reset entry boxes | ||
| 11541 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11542 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11543 | } | ||
| 11544 | }); | ||
| 11545 | |||
| 11546 | my $button6 = $self->addButton($grid, | ||
| 11547 | 'Reset list', 'Reset the list of winmaps', undef, | ||
| 11548 | 10, 12, 9, 10); | ||
| 11549 | $button6->signal_connect('clicked' => sub { | ||
| 11550 | |||
| 11551 | # Refresh the simple list and reset entry boxes | ||
| 11552 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11553 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11554 | }); | ||
| 11555 | |||
| 11556 | my $button7 = $self->addButton($grid, | ||
| 11557 | 'Set default \'main\' winmap when workspace grids activated', | ||
| 11558 | 'Set the default winmap for \'main\' windows', | ||
| 11559 | undef, | ||
| 11560 | 1, 8, 10, 11); | ||
| 11561 | $button7->signal_connect('clicked' => sub { | ||
| 11562 | |||
| 11563 | my ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11564 | if (defined $winmap) { | ||
| 11565 | |||
| 11566 | # Reset the default winmap | ||
| 11567 | $self->session->pseudoCmd('setdefaultwinmap -a ' . $winmap, $self->pseudoCmdMode); | ||
| 11568 | } | ||
| 11569 | |||
| 11570 | # Refresh the simple list and reset entry boxes | ||
| 11571 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11572 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11573 | }); | ||
| 11574 | |||
| 11575 | my $button8 = $self->addButton($grid, | ||
| 11576 | '...when workspace grids disactivated', | ||
| 11577 | 'Set the default winmap for \'main\' windows', | ||
| 11578 | undef, | ||
| 11579 | 8, 12, 10, 11); | ||
| 11580 | $button8->signal_connect('clicked' => sub { | ||
| 11581 | |||
| 11582 | my ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11583 | if (defined $winmap) { | ||
| 11584 | |||
| 11585 | # Reset the default winmap | ||
| 11586 | $self->session->pseudoCmd('setdefaultwinmap -d ' . $winmap, $self->pseudoCmdMode); | ||
| 11587 | } | ||
| 11588 | |||
| 11589 | # Refresh the simple list and reset entry boxes | ||
| 11590 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11591 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11592 | }); | ||
| 11593 | |||
| 11594 | my $button9 = $self->addButton($grid, | ||
| 11595 | 'Set default \'internal\' winmap', | ||
| 11596 | 'Set the default winmap for other \'internal\' windows', | ||
| 11597 | undef, | ||
| 11598 | 1, 6, 11, 12); | ||
| 11599 | $button9->signal_connect('clicked' => sub { | ||
| 11600 | |||
| 11601 | my ($winmap) = $self->getSimpleListData($slWidget, 0); | ||
| 11602 | if (defined $winmap) { | ||
| 11603 | |||
| 11604 | # Reset the default winmap | ||
| 11605 | $self->session->pseudoCmd('setdefaultwinmap -g ' . $winmap, $self->pseudoCmdMode); | ||
| 11606 | } | ||
| 11607 | |||
| 11608 | # Refresh the simple list and reset entry boxes | ||
| 11609 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11610 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11611 | }); | ||
| 11612 | |||
| 11613 | my $button10 = $self->addButton( | ||
| 11614 | $grid, | ||
| 11615 | 'Reset default winmaps', | ||
| 11616 | 'Reset default winmaps for \'main\' and \'internal\' windows', | ||
| 11617 | undef, | ||
| 11618 | 6, 12, 11, 12); | ||
| 11619 | $button10->signal_connect('clicked' => sub { | ||
| 11620 | |||
| 11621 | # Reset default winmaps | ||
| 11622 | $self->session->pseudoCmd('setdefaultwinmap -r', $self->pseudoCmdMode); | ||
| 11623 | |||
| 11624 | # Refresh the simple list and reset entry boxes | ||
| 11625 | $self->windows4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 11626 | $self->resetEntryBoxes($entry, $entry2); | ||
| 11627 | }); | ||
| 11628 | |||
| 11629 | # Tab complete | ||
| 11630 | return 1; | ||
| 11631 | } | ||
| 11632 | |||
| 11633 | sub windows4Tab_refreshList { | ||
| 11634 | |||
| 11635 | # Called by $self->windows3Tab to refresh the GA::Obj::SimpleList | ||
| 11636 | # | ||
| 11637 | # Expected arguments | ||
| 11638 | # $slWidget - The GA::Obj::SimpleList | ||
| 11639 | # $columns - The number of columns in the list | ||
| 11640 | # | ||
| 11641 | # Return values | ||
| 11642 | # 'undef' on improper arguments | ||
| 11643 | # 1 otherwise | ||
| 11644 | |||
| 11645 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 11646 | |||
| 11647 | # Local variables | ||
| 11648 | my (@sortedList, @dataList); | ||
| 11649 | |||
| 11650 | # Check for improper arguments | ||
| 11651 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 11652 | |||
| 11653 | return $axmud::CLIENT->writeImproper( | ||
| 11654 | $self->_objClass . '->windows4Tab_refreshList', | ||
| 11655 | @_, | ||
| 11656 | ); | ||
| 11657 | } | ||
| 11658 | |||
| 11659 | # Get a sorted list of winmaps | ||
| 11660 | @sortedList = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('winmapHash')); | ||
| 11661 | |||
| 11662 | # Compile the simple list data | ||
| 11663 | foreach my $winmapObj (@sortedList) { | ||
| 11664 | |||
| 11665 | my ($string, $enabledFlag, $disabledFlag, $internalFlag); | ||
| 11666 | |||
| 11667 | if ($winmapObj->worldHash) { | ||
| 11668 | |||
| 11669 | $string = join(' ', sort {lc($a) cmp lc($b)} ($winmapObj->ivKeys('worldHash'))); | ||
| 11670 | } | ||
| 11671 | |||
| 11672 | if ($axmud::CLIENT->defaultEnabledWinmap eq $winmapObj->name) { | ||
| 11673 | $enabledFlag = TRUE; | ||
| 11674 | } else { | ||
| 11675 | $enabledFlag = FALSE; | ||
| 11676 | } | ||
| 11677 | |||
| 11678 | if ($axmud::CLIENT->defaultDisabledWinmap eq $winmapObj->name) { | ||
| 11679 | $disabledFlag = TRUE; | ||
| 11680 | } else { | ||
| 11681 | $disabledFlag = FALSE; | ||
| 11682 | } | ||
| 11683 | |||
| 11684 | if ($axmud::CLIENT->defaultInternalWinmap eq $winmapObj->name) { | ||
| 11685 | $internalFlag = TRUE; | ||
| 11686 | } else { | ||
| 11687 | $internalFlag = FALSE; | ||
| 11688 | } | ||
| 11689 | |||
| 11690 | push (@dataList, | ||
| 11691 | $winmapObj->name, | ||
| 11692 | ($winmapObj->ivNumber('stripInitList') / 2), | ||
| 11693 | $winmapObj->ivPairs('zoneHash'), | ||
| 11694 | $winmapObj->fullFlag, | ||
| 11695 | $enabledFlag, | ||
| 11696 | $disabledFlag, | ||
| 11697 | $internalFlag, | ||
| 11698 | $string, | ||
| 11699 | ); | ||
| 11700 | } | ||
| 11701 | |||
| 11702 | # Reset the simple list | ||
| 11703 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 11704 | |||
| 11705 | return 1; | ||
| 11706 | } | ||
| 11707 | |||
| 11708 | sub windows5Tab { | ||
| 11709 | |||
| 11710 | # Windows5 tab | ||
| 11711 | # | ||
| 11712 | # Expected arguments | ||
| 11713 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 11714 | # | ||
| 11715 | # Return values | ||
| 11716 | # 'undef' on improper arguments | ||
| 11717 | # 1 otherwise | ||
| 11718 | |||
| 11719 | my ($self, $innerNotebook, $check) = @_; | ||
| 11720 | |||
| 11721 | # Local variables | ||
| 11722 | my ( | ||
| 11723 | $scriptDir, $posn, $shortPath, | ||
| 11724 | @buttonList, @columnList, @fileList, | ||
| 11725 | %buttonHash, | ||
| 11726 | ); | ||
| 11727 | |||
| 11728 | # Check for improper arguments | ||
| 11729 | if (! defined $innerNotebook || defined $check) { | ||
| 11730 | |||
| 11731 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows5Tab', @_); | ||
| 11732 | } | ||
| 11733 | |||
| 11734 | # Tab setup | ||
| 11735 | my $grid = $self->addTab( | ||
| 11736 | $innerNotebook, | ||
| 11737 | 'Page _5', | ||
| 11738 | ['Toolbar buttons for \'internal\' windows'], | ||
| 11739 | ); | ||
| 11740 | |||
| 11741 | # Import the IVs, so that the user can edit the list freely, without the changes becoming | ||
| 11742 | # permanent (until they use the 'Apply changes' button, of course) | ||
| 11743 | @buttonList = $axmud::CLIENT->toolbarList; | ||
| 11744 | %buttonHash = $axmud::CLIENT->toolbarHash; | ||
| 11745 | |||
| 11746 | # Toolbar buttons for 'internal' windows | ||
| 11747 | $self->addLabel($grid, '<b>Toolbar buttons for \'internal\' windows</b>', | ||
| 11748 | 0, 12, 0, 1); | ||
| 11749 | |||
| 11750 | # Add a simple list | ||
| 11751 | @columnList = ( | ||
| 11752 | '#', 'int', | ||
| 11753 | 'Icon', 'pixbuf', | ||
| 11754 | 'Name', 'text', | ||
| 11755 | 'Custom', 'bool', | ||
| 11756 | 'Description', 'text', | ||
| 11757 | 'Instruction', 'text', | ||
| 11758 | ); | ||
| 11759 | |||
| 11760 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 11761 | 1, 12, 1, 8); | ||
| 11762 | |||
| 11763 | # Initialise the list | ||
| 11764 | $self->windows5Tab_refreshList( | ||
| 11765 | $slWidget, | ||
| 11766 | scalar (@columnList / 2), | ||
| 11767 | \@buttonList, | ||
| 11768 | \%buttonHash, | ||
| 11769 | ); | ||
| 11770 | |||
| 11771 | # Get a list of .png files in /icons/custom | ||
| 11772 | $scriptDir = $axmud::SHARE_DIR; | ||
| 11773 | if ($^O eq 'MSWin32') { | ||
| 11774 | @fileList = glob($scriptDir . '\\icons\\custom\\*.png'); | ||
| 11775 | } else { | ||
| 11776 | @fileList = glob($scriptDir . '/icons/custom/*.png'); | ||
| 11777 | } | ||
| 11778 | |||
| 11779 | $posn = 0; | ||
| 11780 | |||
| 11781 | # Add editing widgets | ||
| 11782 | my ($image, $frame, $viewPort) = $self->addImage($grid, $fileList[$posn], undef, | ||
| 11783 | FALSE, # Don't use a scrolled window | ||
| 11784 | 24, 24, | ||
| 11785 | 1, 3, 8, 10); | ||
| 11786 | |||
| 11787 | my $button = $self->addButton($grid, '<<', 'Switch to previous icon', undef, | ||
| 11788 | 3, 4, 8, 9); | ||
| 11789 | $button->set_hexpand(FALSE); | ||
| 11790 | $button->signal_connect('clicked' => sub { | ||
| 11791 | |||
| 11792 | $posn--; | ||
| 11793 | if ($posn < 0) { | ||
| 11794 | |||
| 11795 | $posn = (scalar @fileList) - 1; | ||
| 11796 | } | ||
| 11797 | |||
| 11798 | # Change the displayed image | ||
| 11799 | my $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 11800 | if ($newImage) { | ||
| 11801 | |||
| 11802 | $shortPath = $fileList[$posn]; | ||
| 11803 | if ($shortPath) { | ||
| 11804 | |||
| 11805 | $shortPath =~ s/$scriptDir//; | ||
| 11806 | $image = $newImage; | ||
| 11807 | } | ||
| 11808 | } | ||
| 11809 | }); | ||
| 11810 | |||
| 11811 | $self->addLabel($grid, 'Name', | ||
| 11812 | 4, 5, 8, 9); | ||
| 11813 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 11814 | 5, 8, 8, 9); | ||
| 11815 | $self->addLabel($grid, 'Description', | ||
| 11816 | 8, 9, 8, 9); | ||
| 11817 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, 32, | ||
| 11818 | 9, 12, 8, 9); | ||
| 11819 | |||
| 11820 | my $button2 = $self->addButton($grid, '>>', 'Switch to next icon', undef, | ||
| 11821 | 3, 4, 9, 10); | ||
| 11822 | $button2->set_hexpand(FALSE); | ||
| 11823 | $button2->signal_connect('clicked' => sub { | ||
| 11824 | |||
| 11825 | $posn++; | ||
| 11826 | if ($posn >= scalar @fileList) { | ||
| 11827 | |||
| 11828 | $posn = 0; | ||
| 11829 | } | ||
| 11830 | |||
| 11831 | # Change the displayed image, and store it as the current chat icon | ||
| 11832 | my $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 11833 | if ($newImage) { | ||
| 11834 | |||
| 11835 | $shortPath = $fileList[$posn]; | ||
| 11836 | if ($shortPath) { | ||
| 11837 | |||
| 11838 | $shortPath =~ s/$scriptDir//; | ||
| 11839 | $image = $newImage; | ||
| 11840 | } | ||
| 11841 | } | ||
| 11842 | }); | ||
| 11843 | |||
| 11844 | $self->addLabel($grid, 'Instruction', | ||
| 11845 | 4, 5, 9, 10); | ||
| 11846 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 11847 | 5, 8, 9, 10); | ||
| 11848 | |||
| 11849 | my $button3 = $self->addButton($grid, 'Add custom', 'Add a custom toolbar button', undef, | ||
| 11850 | 8, 10, 9, 10); | ||
| 11851 | $button3->signal_connect('clicked' => sub { | ||
| 11852 | |||
| 11853 | my ($name, $descrip, $instruct, $buttonObj); | ||
| 11854 | |||
| 11855 | $name = $entry->get_text(); | ||
| 11856 | $descrip = $entry2->get_text(); | ||
| 11857 | $instruct = $entry3->get_text(); | ||
| 11858 | |||
| 11859 | if ($self->checkEntryIcon($entry, $entry2, $entry3) && $shortPath) { | ||
| 11860 | |||
| 11861 | # Check a toolbar button with that name doesn't already exist | ||
| 11862 | if (exists $buttonHash{$name}) { | ||
| 11863 | |||
| 11864 | $self->showMsgDialogue( | ||
| 11865 | 'Add toolbar button', | ||
| 11866 | 'error', | ||
| 11867 | 'A toolbar button called \''. $name . '\' already exists', | ||
| 11868 | 'ok', | ||
| 11869 | ); | ||
| 11870 | |||
| 11871 | } elsif (! $axmud::CLIENT->nameCheck($name, 16)) { | ||
| 11872 | |||
| 11873 | $self->showMsgDialogue( | ||
| 11874 | 'Add toolbar button', | ||
| 11875 | 'error', | ||
| 11876 | 'Registry naming error: invalid name \'' . $name . '\'', | ||
| 11877 | 'ok', | ||
| 11878 | ); | ||
| 11879 | |||
| 11880 | } else { | ||
| 11881 | |||
| 11882 | # Create a new toolbar button | ||
| 11883 | $buttonObj = Games::Axmud::Obj::Toolbar->new( | ||
| 11884 | $name, | ||
| 11885 | $descrip, | ||
| 11886 | TRUE, # Custom toolbar button | ||
| 11887 | $scriptDir . $shortPath, | ||
| 11888 | $instruct, | ||
| 11889 | TRUE, # Require current session | ||
| 11890 | TRUE, # Require connection | ||
| 11891 | ); | ||
| 11892 | |||
| 11893 | # Add the new toolbar button at the end of the list | ||
| 11894 | if ($buttonObj) { | ||
| 11895 | |||
| 11896 | push (@buttonList, $name); | ||
| 11897 | $buttonHash{$name} = $buttonObj; | ||
| 11898 | |||
| 11899 | # Refresh the simple list | ||
| 11900 | $self->windows5Tab_refreshList( | ||
| 11901 | $slWidget, | ||
| 11902 | scalar (@columnList / 2), | ||
| 11903 | \@buttonList, | ||
| 11904 | \%buttonHash, | ||
| 11905 | ); | ||
| 11906 | |||
| 11907 | # Reset the entry boxes | ||
| 11908 | $self->resetEntryBoxes($entry, $entry2, $entry3); | ||
| 11909 | } | ||
| 11910 | } | ||
| 11911 | } | ||
| 11912 | }); | ||
| 11913 | |||
| 11914 | my $button4 = $self->addButton( | ||
| 11915 | $grid, | ||
| 11916 | 'Add separator', | ||
| 11917 | 'Add a separator between toolbar button', | ||
| 11918 | undef, | ||
| 11919 | 10, 12, 9, 10); | ||
| 11920 | $button4->signal_connect('clicked' => sub { | ||
| 11921 | |||
| 11922 | # Add a separator to the list of toolbar buttons | ||
| 11923 | push (@buttonList, 'separator'); | ||
| 11924 | |||
| 11925 | # Refresh the simple list | ||
| 11926 | $self->windows5Tab_refreshList( | ||
| 11927 | $slWidget, | ||
| 11928 | scalar (@columnList / 2), | ||
| 11929 | \@buttonList, | ||
| 11930 | \%buttonHash, | ||
| 11931 | ); | ||
| 11932 | }); | ||
| 11933 | |||
| 11934 | my $button5 = $self->addButton( | ||
| 11935 | $grid, | ||
| 11936 | 'View / edit...', | ||
| 11937 | 'View of edit the selected item', | ||
| 11938 | undef, | ||
| 11939 | 1, 3, 10, 11); | ||
| 11940 | $button5->signal_connect('clicked' => sub { | ||
| 11941 | |||
| 11942 | my ($posn, $name, $obj); | ||
| 11943 | |||
| 11944 | ($posn) = $self->getSimpleListData($slWidget, 0); | ||
| 11945 | if (defined $posn) { | ||
| 11946 | |||
| 11947 | # First item in list is numbered 1 | ||
| 11948 | $posn--; | ||
| 11949 | |||
| 11950 | $name = $buttonList[$posn]; | ||
| 11951 | if ($name ne 'separator') { | ||
| 11952 | |||
| 11953 | $obj = $buttonHash{$name}; | ||
| 11954 | |||
| 11955 | # Open an 'edit' window to edit the toolbar button | ||
| 11956 | $self->createFreeWin( | ||
| 11957 | 'Games::Axmud::EditWin::Toolbar', | ||
| 11958 | $self, | ||
| 11959 | $self->session, | ||
| 11960 | 'Edit toolbar button \'' . $name . '\'', | ||
| 11961 | $obj, | ||
| 11962 | FALSE, # Not temporary | ||
| 11963 | ); | ||
| 11964 | |||
| 11965 | # Refresh the simple list | ||
| 11966 | $self->windows5Tab_refreshList( | ||
| 11967 | $slWidget, | ||
| 11968 | scalar (@columnList / 2), | ||
| 11969 | \@buttonList, | ||
| 11970 | \%buttonHash, | ||
| 11971 | ); | ||
| 11972 | } | ||
| 11973 | } | ||
| 11974 | }); | ||
| 11975 | |||
| 11976 | my $button6 = $self->addButton($grid, 'Move up', 'Move the selected item up', undef, | ||
| 11977 | 3, 5, 10, 11); | ||
| 11978 | $button6->signal_connect('clicked' => sub { | ||
| 11979 | |||
| 11980 | my ($posn, $item); | ||
| 11981 | |||
| 11982 | ($posn) = $self->getSimpleListData($slWidget, 0); | ||
| 11983 | if (defined $posn && $posn > 1) { | ||
| 11984 | |||
| 11985 | # First item in list is numbered 1 | ||
| 11986 | $posn--; | ||
| 11987 | |||
| 11988 | # Remove the selected item from the list | ||
| 11989 | $item = splice (@buttonList, $posn, 1); | ||
| 11990 | # Move it one place higher | ||
| 11991 | splice (@buttonList, ($posn - 1), 0, $item); | ||
| 11992 | |||
| 11993 | # Refresh the simple list | ||
| 11994 | $self->windows5Tab_refreshList( | ||
| 11995 | $slWidget, | ||
| 11996 | scalar (@columnList / 2), | ||
| 11997 | \@buttonList, | ||
| 11998 | \%buttonHash, | ||
| 11999 | ); | ||
| 12000 | |||
| 12001 | # Re-select the item at its new position | ||
| 12002 | $slWidget->select($posn - 1); | ||
| 12003 | } | ||
| 12004 | }); | ||
| 12005 | |||
| 12006 | my $button7 = $self->addButton($grid, 'Move down', 'Move the selected item down', undef, | ||
| 12007 | 5, 7, 10, 11); | ||
| 12008 | $button7->signal_connect('clicked' => sub { | ||
| 12009 | |||
| 12010 | my ($posn, $item); | ||
| 12011 | |||
| 12012 | ($posn) = $self->getSimpleListData($slWidget, 0); | ||
| 12013 | if (defined $posn && $posn < ((scalar @buttonList) - 1)) { | ||
| 12014 | |||
| 12015 | # First item in list is numbered 1 | ||
| 12016 | $posn--; | ||
| 12017 | |||
| 12018 | # Remove the selected item from the list | ||
| 12019 | $item = splice (@buttonList, $posn, 1); | ||
| 12020 | # Move it one place lower | ||
| 12021 | splice (@buttonList, ($posn + 1), 0, $item); | ||
| 12022 | |||
| 12023 | # Refresh the simple list | ||
| 12024 | $self->windows5Tab_refreshList( | ||
| 12025 | $slWidget, | ||
| 12026 | scalar (@columnList / 2), | ||
| 12027 | \@buttonList, | ||
| 12028 | \%buttonHash, | ||
| 12029 | ); | ||
| 12030 | |||
| 12031 | # Re-select the item at its new position | ||
| 12032 | $slWidget->select($posn + 1); | ||
| 12033 | } | ||
| 12034 | }); | ||
| 12035 | |||
| 12036 | my $button8 = $self->addButton( | ||
| 12037 | $grid, 'Delete', 'Remove the selected item from the list', undef, | ||
| 12038 | 7, 8, 10, 11); | ||
| 12039 | $button8->signal_connect('clicked' => sub { | ||
| 12040 | |||
| 12041 | my ($posn) = $self->getSimpleListData($slWidget, 0); | ||
| 12042 | if (defined $posn) { | ||
| 12043 | |||
| 12044 | # First item in list is numbered 1 | ||
| 12045 | $posn--; | ||
| 12046 | |||
| 12047 | # Remove the selected item from the list | ||
| 12048 | splice (@buttonList, $posn, 1); | ||
| 12049 | |||
| 12050 | # Refresh the simple list | ||
| 12051 | $self->windows5Tab_refreshList( | ||
| 12052 | $slWidget, | ||
| 12053 | scalar (@columnList / 2), | ||
| 12054 | \@buttonList, | ||
| 12055 | \%buttonHash, | ||
| 12056 | ); | ||
| 12057 | } | ||
| 12058 | }); | ||
| 12059 | |||
| 12060 | my $button9 = $self->addButton( | ||
| 12061 | $grid, 'Reset buttons', 'Reset your changes to this list', undef, | ||
| 12062 | 8, 10, 10, 11); | ||
| 12063 | $button9->signal_connect('clicked' => sub { | ||
| 12064 | |||
| 12065 | # Re-import the IVs | ||
| 12066 | @buttonList = $axmud::CLIENT->toolbarList; | ||
| 12067 | %buttonHash = $axmud::CLIENT->toolbarHash; | ||
| 12068 | |||
| 12069 | # Refresh the simple list | ||
| 12070 | $self->windows5Tab_refreshList( | ||
| 12071 | $slWidget, | ||
| 12072 | scalar (@columnList / 2), | ||
| 12073 | \@buttonList, | ||
| 12074 | \%buttonHash, | ||
| 12075 | ); | ||
| 12076 | }); | ||
| 12077 | |||
| 12078 | my $button10 = $self->addButton( | ||
| 12079 | $grid, 'Refresh list', 'Refresh the list of toolbar buttons', undef, | ||
| 12080 | 10, 12, 10, 11); | ||
| 12081 | $button10->signal_connect('clicked' => sub { | ||
| 12082 | |||
| 12083 | # Refresh the simple list | ||
| 12084 | $self->windows5Tab_refreshList( | ||
| 12085 | $slWidget, | ||
| 12086 | scalar (@columnList / 2), | ||
| 12087 | \@buttonList, | ||
| 12088 | \%buttonHash, | ||
| 12089 | ); | ||
| 12090 | }); | ||
| 12091 | |||
| 12092 | my $button11 = $self->addButton( | ||
| 12093 | $grid, 'Apply changes now', 'Apply changes to \'internal\' windows now', undef, | ||
| 12094 | 7, 9, 11, 12); | ||
| 12095 | $button11->signal_connect('clicked' => sub { | ||
| 12096 | |||
| 12097 | my $choice = $self->showMsgDialogue( | ||
| 12098 | 'Apply changes', | ||
| 12099 | 'question', | ||
| 12100 | 'Are you sure you want to apply your changes now?', | ||
| 12101 | 'yes-no', | ||
| 12102 | ); | ||
| 12103 | |||
| 12104 | if ($choice && $choice eq 'yes') { | ||
| 12105 | |||
| 12106 | # Update the Client's IVs | ||
| 12107 | $axmud::CLIENT->set_toolbarHash(%buttonHash); | ||
| 12108 | $axmud::CLIENT->set_toolbarList(@buttonList); | ||
| 12109 | |||
| 12110 | # Tell all 'internal' windows to re-draw their toolbar strip objects | ||
| 12111 | foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) { | ||
| 12112 | |||
| 12113 | my $stripObj | ||
| 12114 | = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar'); | ||
| 12115 | |||
| 12116 | if ($stripObj) { | ||
| 12117 | |||
| 12118 | $stripObj->resetToolbar(); | ||
| 12119 | } | ||
| 12120 | } | ||
| 12121 | |||
| 12122 | # Refresh the simple list | ||
| 12123 | $self->windows5Tab_refreshList( | ||
| 12124 | $slWidget, | ||
| 12125 | scalar (@columnList / 2), | ||
| 12126 | \@buttonList, | ||
| 12127 | \%buttonHash, | ||
| 12128 | ); | ||
| 12129 | } | ||
| 12130 | }); | ||
| 12131 | |||
| 12132 | my $button12 = $self->addButton( | ||
| 12133 | $grid, 'Use default buttons', 'Use the default set of toolbar buttons', undef, | ||
| 12134 | 9, 12, 11, 12); | ||
| 12135 | $button12->signal_connect('clicked' => sub { | ||
| 12136 | |||
| 12137 | my $choice = $self->showMsgDialogue( | ||
| 12138 | 'Use default toolbar buttons', | ||
| 12139 | 'question', | ||
| 12140 | 'Are you sure you want to reset the toolbar? (Any custom buttons you\'ve created' | ||
| 12141 | . ' will be destroyed)', | ||
| 12142 | 'yes-no', | ||
| 12143 | ); | ||
| 12144 | |||
| 12145 | if ($choice && $choice eq 'yes') { | ||
| 12146 | |||
| 12147 | # Replace the contents of the client's IVs with the default values | ||
| 12148 | $axmud::CLIENT->initialiseToolbar(); | ||
| 12149 | # Re-import the IVs | ||
| 12150 | @buttonList = $axmud::CLIENT->toolbarList; | ||
| 12151 | %buttonHash = $axmud::CLIENT->toolbarHash; | ||
| 12152 | |||
| 12153 | # Tell all 'internal' windows to re-draw their toolbar strip objects | ||
| 12154 | foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) { | ||
| 12155 | |||
| 12156 | my $stripObj | ||
| 12157 | = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar'); | ||
| 12158 | |||
| 12159 | if ($stripObj) { | ||
| 12160 | |||
| 12161 | $stripObj->resetToolbar(); | ||
| 12162 | } | ||
| 12163 | } | ||
| 12164 | |||
| 12165 | # Refresh the simple list | ||
| 12166 | $self->windows5Tab_refreshList( | ||
| 12167 | $slWidget, | ||
| 12168 | scalar (@columnList / 2), | ||
| 12169 | \@buttonList, | ||
| 12170 | \%buttonHash, | ||
| 12171 | ); | ||
| 12172 | } | ||
| 12173 | }); | ||
| 12174 | |||
| 12175 | # Tab complete | ||
| 12176 | return 1; | ||
| 12177 | } | ||
| 12178 | |||
| 12179 | sub windows5Tab_refreshList { | ||
| 12180 | |||
| 12181 | # Called by $self->windows4Tab to refresh the GA::Obj::SimpleList | ||
| 12182 | # | ||
| 12183 | # Expected arguments | ||
| 12184 | # $slWidget - The GA::Obj::SimpleList | ||
| 12185 | # $columns - The number of columns in the list | ||
| 12186 | # $buttonListRef - Reference to a list containing a local copy of GA::Client->buttonList | ||
| 12187 | # $buttonHashRef - Reference to a hash containing a local copy of GA::Client->buttonHash | ||
| 12188 | # | ||
| 12189 | # Return values | ||
| 12190 | # 'undef' on improper arguments | ||
| 12191 | # 1 otherwise | ||
| 12192 | |||
| 12193 | my ($self, $slWidget, $columns, $buttonListRef, $buttonHashRef, $check) = @_; | ||
| 12194 | |||
| 12195 | # Local variables | ||
| 12196 | my ( | ||
| 12197 | $count, | ||
| 12198 | @dataList, | ||
| 12199 | ); | ||
| 12200 | |||
| 12201 | # Check for improper arguments | ||
| 12202 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 12203 | |||
| 12204 | return $axmud::CLIENT->writeImproper( | ||
| 12205 | $self->_objClass . '->windows5Tab_refreshList', | ||
| 12206 | @_, | ||
| 12207 | ); | ||
| 12208 | } | ||
| 12209 | |||
| 12210 | # Compile the simple list data | ||
| 12211 | $count = 0; | ||
| 12212 | foreach my $buttonName (@$buttonListRef) { | ||
| 12213 | |||
| 12214 | my ($buttonObj, $path, $pixBuffer); | ||
| 12215 | |||
| 12216 | $count++; | ||
| 12217 | |||
| 12218 | if ($buttonName eq 'separator') { | ||
| 12219 | |||
| 12220 | # Create a pixbuff for an icon which isn't used for built-in toolbar buttons | ||
| 12221 | $path = $axmud::SHARE_DIR . '/icons/main/separator.png'; | ||
| 12222 | $pixBuffer = Gtk3::Gdk::Pixbuf->new_from_file($path); | ||
| 12223 | push (@dataList, | ||
| 12224 | $count, | ||
| 12225 | $pixBuffer, | ||
| 12226 | $buttonName, | ||
| 12227 | FALSE, | ||
| 12228 | '(Separator between buttons)', | ||
| 12229 | undef, | ||
| 12230 | ); | ||
| 12231 | |||
| 12232 | } else { | ||
| 12233 | |||
| 12234 | # Get the GA::Obj::Toolbar | ||
| 12235 | $buttonObj = $$buttonHashRef{$buttonName}; | ||
| 12236 | |||
| 12237 | # Get the icon's file path | ||
| 12238 | if ($buttonObj->customFlag) { | ||
| 12239 | $path = $buttonObj->iconPath; | ||
| 12240 | } else { | ||
| 12241 | $path = $axmud::SHARE_DIR . '/icons/main/' . $buttonObj->iconPath; | ||
| 12242 | } | ||
| 12243 | |||
| 12244 | # Create a pixbuff for the icon (unless the file doesn't exist) | ||
| 12245 | if (-e $path) { | ||
| 12246 | |||
| 12247 | $pixBuffer = Gtk3::Gdk::Pixbuf->new_from_file($path); | ||
| 12248 | } | ||
| 12249 | |||
| 12250 | push (@dataList, | ||
| 12251 | $count, | ||
| 12252 | $pixBuffer, | ||
| 12253 | $buttonName, | ||
| 12254 | $buttonObj->customFlag, | ||
| 12255 | $buttonObj->descrip, | ||
| 12256 | $buttonObj->instruct, | ||
| 12257 | ); | ||
| 12258 | } | ||
| 12259 | } | ||
| 12260 | |||
| 12261 | # Reset the simple list | ||
| 12262 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 12263 | |||
| 12264 | return 1; | ||
| 12265 | } | ||
| 12266 | |||
| 12267 | sub windows6Tab { | ||
| 12268 | |||
| 12269 | # Windows6 tab | ||
| 12270 | # | ||
| 12271 | # Expected arguments | ||
| 12272 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 12273 | # | ||
| 12274 | # Return values | ||
| 12275 | # 'undef' on improper arguments | ||
| 12276 | # 1 otherwise | ||
| 12277 | |||
| 12278 | my ($self, $innerNotebook, $check) = @_; | ||
| 12279 | |||
| 12280 | # Local variables | ||
| 12281 | my @columnList; | ||
| 12282 | |||
| 12283 | # Check for improper arguments | ||
| 12284 | if (! defined $innerNotebook || defined $check) { | ||
| 12285 | |||
| 12286 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windows6Tab', @_); | ||
| 12287 | } | ||
| 12288 | |||
| 12289 | # Tab setup | ||
| 12290 | my $grid = $self->addTab( | ||
| 12291 | $innerNotebook, | ||
| 12292 | 'Page _6', | ||
| 12293 | ['Textview objects'], | ||
| 12294 | ); | ||
| 12295 | |||
| 12296 | # Textview objects | ||
| 12297 | $self->addLabel($grid, '<b>Textview objects</b>', | ||
| 12298 | 0, 12, 0, 1); | ||
| 12299 | $self->addLabel($grid, | ||
| 12300 | '<i>List of textview objects, handling areas of the window where text is displayed</i>', | ||
| 12301 | 1, 12, 1, 2); | ||
| 12302 | |||
| 12303 | # Add a simple list | ||
| 12304 | @columnList = ( | ||
| 12305 | 'Num', 'int', | ||
| 12306 | 'Ses', 'int', | ||
| 12307 | 'Win', 'int', | ||
| 12308 | 'Pane', 'int', | ||
| 12309 | 'Lock', 'bool', | ||
| 12310 | 'O/W', 'bool', | ||
| 12311 | 'Split', 'text', | ||
| 12312 | 'Wid', 'text', | ||
| 12313 | 'Hei', 'text', | ||
| 12314 | 'Scheme', 'text', | ||
| 12315 | 'Mono', 'bool', | ||
| 12316 | 'Text', 'text', | ||
| 12317 | 'Undly', 'text', | ||
| 12318 | 'Bckgrnd', 'text', | ||
| 12319 | 'Font', 'text', | ||
| 12320 | ); | ||
| 12321 | |||
| 12322 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 12323 | 1, 12, 2, 10); | ||
| 12324 | |||
| 12325 | # Initialise the list | ||
| 12326 | $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 12327 | |||
| 12328 | # Add editing widgets | ||
| 12329 | $self->addLabel($grid, 'Size', | ||
| 12330 | 1, 2, 10, 11); | ||
| 12331 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 12332 | 2, 4, 10, 11); | ||
| 12333 | my $button = $self->addButton( | ||
| 12334 | $grid, | ||
| 12335 | 'Set default size', 'Sets the default size for textview objects', undef, | ||
| 12336 | 4, 6, 10, 11); | ||
| 12337 | $button->signal_connect('clicked' => sub { | ||
| 12338 | |||
| 12339 | if ($self->checkEntryIcon($entry)) { | ||
| 12340 | |||
| 12341 | $self->session->pseudoCmd( | ||
| 12342 | 'settextview ' . $entry->get_text(), | ||
| 12343 | $self->pseudoCmdMode, | ||
| 12344 | ); | ||
| 12345 | } | ||
| 12346 | }); | ||
| 12347 | |||
| 12348 | my $button2 = $self->addButton( | ||
| 12349 | $grid, | ||
| 12350 | 'Reset default size', 'Resets the default size for textview objects', undef, | ||
| 12351 | 6, 9, 10, 11); | ||
| 12352 | $button2->signal_connect('clicked' => sub { | ||
| 12353 | |||
| 12354 | $self->session->pseudoCmd('settextview', $self->pseudoCmdMode); | ||
| 12355 | }); | ||
| 12356 | |||
| 12357 | my $button3 = $self->addButton( | ||
| 12358 | $grid, | ||
| 12359 | 'Clear textview', 'Removes all text from the selected textview object', undef, | ||
| 12360 | 9, 12, 10, 11); | ||
| 12361 | $button3->signal_connect('clicked' => sub { | ||
| 12362 | |||
| 12363 | my ($number, $textViewObj); | ||
| 12364 | |||
| 12365 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 12366 | if (defined $number) { | ||
| 12367 | |||
| 12368 | $textViewObj = $axmud::CLIENT->desktopObj->ivShow('textViewHash', $number); | ||
| 12369 | if ($textViewObj && $textViewObj->paneObj) { | ||
| 12370 | |||
| 12371 | # Clear the textview of text | ||
| 12372 | $self->session->pseudoCmd('cleartextview -t ' . $number, $self->pseudoCmdMode); | ||
| 12373 | } | ||
| 12374 | } | ||
| 12375 | |||
| 12376 | # Refresh the simple list and entry boxes | ||
| 12377 | $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 12378 | }); | ||
| 12379 | |||
| 12380 | my $button4 = $self->addButton( | ||
| 12381 | $grid, | ||
| 12382 | 'Dump', 'Display the list of textview objects in the \'main\' window', undef, | ||
| 12383 | 8, 10, 11, 12); | ||
| 12384 | $button4->signal_connect('clicked' => sub { | ||
| 12385 | |||
| 12386 | $self->session->pseudoCmd('listtextview', $self->pseudoCmdMode); | ||
| 12387 | |||
| 12388 | # Refresh the simple list and entry boxes | ||
| 12389 | $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 12390 | }); | ||
| 12391 | |||
| 12392 | my $button5 = $self->addButton( | ||
| 12393 | $grid, | ||
| 12394 | 'Refresh', 'Refresh the list of textview objects', undef, | ||
| 12395 | 10, 12, 11, 12); | ||
| 12396 | $button5->signal_connect('clicked' => sub { | ||
| 12397 | |||
| 12398 | # Refresh the simple list and entry boxes | ||
| 12399 | $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 12400 | }); | ||
| 12401 | |||
| 12402 | # Tab complete | ||
| 12403 | return 1; | ||
| 12404 | } | ||
| 12405 | |||
| 12406 | sub windows6Tab_refreshList { | ||
| 12407 | |||
| 12408 | # Called by $self->windows5Tab to refresh the GA::Obj::SimpleList | ||
| 12409 | # | ||
| 12410 | # Expected arguments | ||
| 12411 | # $slWidget - The GA::Obj::SimpleList | ||
| 12412 | # $columns - The number of columns in the list | ||
| 12413 | # | ||
| 12414 | # Return values | ||
| 12415 | # 'undef' on improper arguments | ||
| 12416 | # 1 otherwise | ||
| 12417 | |||
| 12418 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 12419 | |||
| 12420 | # Local variables | ||
| 12421 | my @dataList; | ||
| 12422 | |||
| 12423 | # Check for improper arguments | ||
| 12424 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 12425 | |||
| 12426 | return $axmud::CLIENT->writeImproper( | ||
| 12427 | $self->_objClass . '->windows6Tab_refreshList', | ||
| 12428 | @_, | ||
| 12429 | ); | ||
| 12430 | } | ||
| 12431 | |||
| 12432 | # Compile the simple list data | ||
| 12433 | foreach my $textViewObj ( | ||
| 12434 | sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) | ||
| 12435 | ) { | ||
| 12436 | my $paneString; | ||
| 12437 | |||
| 12438 | if ($textViewObj->paneObj) { | ||
| 12439 | |||
| 12440 | $paneString = $textViewObj->paneObj->number; | ||
| 12441 | } | ||
| 12442 | |||
| 12443 | push (@dataList, | ||
| 12444 | $textViewObj->number, | ||
| 12445 | $textViewObj->session->number, | ||
| 12446 | $textViewObj->winObj->number, | ||
| 12447 | $paneString, | ||
| 12448 | $textViewObj->scrollLockFlag, | ||
| 12449 | $textViewObj->overwriteFlag, | ||
| 12450 | $textViewObj->splitScreenMode, | ||
| 12451 | $textViewObj->textWidthChars, | ||
| 12452 | $textViewObj->textHeightChars, | ||
| 12453 | $textViewObj->colourScheme, | ||
| 12454 | $textViewObj->monochromeFlag, | ||
| 12455 | $textViewObj->textColour, | ||
| 12456 | $textViewObj->underlayColour, | ||
| 12457 | $textViewObj->backgroundColour, | ||
| 12458 | $textViewObj->font . ' ' . $textViewObj->fontSize, | ||
| 12459 | ); | ||
| 12460 | } | ||
| 12461 | |||
| 12462 | # Reset the simple list | ||
| 12463 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 12464 | |||
| 12465 | return 1; | ||
| 12466 | } | ||
| 12467 | |||
| 12468 | sub soundTab { | ||
| 12469 | |||
| 12470 | # Sound tab - called by $self->setupNotebook | ||
| 12471 | # | ||
| 12472 | # Expected arguments | ||
| 12473 | # (none besides $self) | ||
| 12474 | # | ||
| 12475 | # Return values | ||
| 12476 | # 'undef' on improper arguments | ||
| 12477 | # 1 otherwise | ||
| 12478 | |||
| 12479 | my ($self, $check) = @_; | ||
| 12480 | |||
| 12481 | # Check for improper arguments | ||
| 12482 | if (defined $check) { | ||
| 12483 | |||
| 12484 | return $axmud::CLIENT->writeImproper($self->_objClass . '->soundTab', @_); | ||
| 12485 | } | ||
| 12486 | |||
| 12487 | # Tab setup | ||
| 12488 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 12489 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'So_und'); | ||
| 12490 | |||
| 12491 | # Add tabs to the inner notebook | ||
| 12492 | $self->sound1Tab($innerNotebook); | ||
| 12493 | $self->sound2Tab($innerNotebook); | ||
| 12494 | $self->sound3Tab($innerNotebook); | ||
| 12495 | $self->sound4Tab($innerNotebook); | ||
| 12496 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 12497 | |||
| 12498 | $self->sound5Tab($innerNotebook); | ||
| 12499 | $self->sound6Tab($innerNotebook); | ||
| 12500 | $self->sound7Tab($innerNotebook); | ||
| 12501 | } | ||
| 12502 | |||
| 12503 | return 1; | ||
| 12504 | } | ||
| 12505 | |||
| 12506 | sub sound1Tab { | ||
| 12507 | |||
| 12508 | # Sound1 tab | ||
| 12509 | # | ||
| 12510 | # Expected arguments | ||
| 12511 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 12512 | # | ||
| 12513 | # Return values | ||
| 12514 | # 'undef' on improper arguments | ||
| 12515 | # 1 otherwise | ||
| 12516 | |||
| 12517 | my ($self, $innerNotebook, $check) = @_; | ||
| 12518 | |||
| 12519 | # Local variables | ||
| 12520 | my ( | ||
| 12521 | $standardFlag, | ||
| 12522 | @columnList, | ||
| 12523 | ); | ||
| 12524 | |||
| 12525 | # Check for improper arguments | ||
| 12526 | if (! defined $innerNotebook || defined $check) { | ||
| 12527 | |||
| 12528 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound1Tab', @_); | ||
| 12529 | } | ||
| 12530 | |||
| 12531 | # Tab setup | ||
| 12532 | my $grid = $self->addTab( | ||
| 12533 | $innerNotebook, | ||
| 12534 | 'Page _1', | ||
| 12535 | ['Sound effects'], | ||
| 12536 | ); | ||
| 12537 | |||
| 12538 | # Sound effects | ||
| 12539 | $self->addLabel($grid, '<b>Sound effects</b>', | ||
| 12540 | 0, 12, 0, 1); | ||
| 12541 | $self->addLabel($grid, '<i>List of shortcuts to available sound effects</i>', | ||
| 12542 | 1, 6, 1, 2); | ||
| 12543 | |||
| 12544 | $standardFlag = FALSE; | ||
| 12545 | my $checkButton = $self->addCheckButton( | ||
| 12546 | $grid, 'List only standard sound effects', undef, TRUE, | ||
| 12547 | 6, 12, 1, 2); | ||
| 12548 | # (->signal_connect appears below) | ||
| 12549 | |||
| 12550 | # Add a simple list | ||
| 12551 | @columnList = ( | ||
| 12552 | 'Standard', 'bool', | ||
| 12553 | 'Name', 'text', | ||
| 12554 | 'File', 'text', | ||
| 12555 | ); | ||
| 12556 | |||
| 12557 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 12558 | 1, 12, 2, 8); | ||
| 12559 | |||
| 12560 | # Initialise the list | ||
| 12561 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12562 | |||
| 12563 | # Add entry boxes and buttons | ||
| 12564 | $self->addLabel($grid, 'Name', | ||
| 12565 | 1, 3, 8, 9); | ||
| 12566 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 12567 | 3, 6, 8, 9); | ||
| 12568 | |||
| 12569 | my $button = $self->addButton($grid, | ||
| 12570 | 'Add...', 'Add or replace a sound effect with the specified name', undef, | ||
| 12571 | 6, 9, 8, 9); | ||
| 12572 | $button->signal_connect('clicked' => sub { | ||
| 12573 | |||
| 12574 | my $name = $entry->get_text(); | ||
| 12575 | |||
| 12576 | if ($self->checkEntryIcon($entry)) { | ||
| 12577 | |||
| 12578 | # Add the sound effect. A dialogue window is opened to choose a file | ||
| 12579 | $self->session->pseudoCmd('addsoundeffect <' . $name . '>', $self->pseudoCmdMode); | ||
| 12580 | |||
| 12581 | # Refresh the simple list and reset the entry box | ||
| 12582 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12583 | $self->resetEntryBoxes($entry); | ||
| 12584 | } | ||
| 12585 | }); | ||
| 12586 | |||
| 12587 | my $button2 = $self->addButton($grid, | ||
| 12588 | 'Add with no file', | ||
| 12589 | 'Add or replace a sound effect with the specified name, without a file', | ||
| 12590 | undef, | ||
| 12591 | 9, 12, 8, 9); | ||
| 12592 | $button2->signal_connect('clicked' => sub { | ||
| 12593 | |||
| 12594 | my $name = $entry->get_text(); | ||
| 12595 | |||
| 12596 | if ($self->checkEntryIcon($entry)) { | ||
| 12597 | |||
| 12598 | # Add the sound effect. A dialogue window is opened to choose a file | ||
| 12599 | $self->session->pseudoCmd( | ||
| 12600 | 'addsoundeffect -d <' . $name . '>', | ||
| 12601 | $self->pseudoCmdMode, | ||
| 12602 | ); | ||
| 12603 | |||
| 12604 | # Refresh the simple list and reset the entry box | ||
| 12605 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12606 | $self->resetEntryBoxes($entry); | ||
| 12607 | } | ||
| 12608 | }); | ||
| 12609 | |||
| 12610 | my $button3 = $self->addButton( | ||
| 12611 | $grid, | ||
| 12612 | 'Play selected', | ||
| 12613 | 'Play the selected sound effect', | ||
| 12614 | undef, | ||
| 12615 | 1, 3, 9, 10); | ||
| 12616 | $button3->signal_connect('clicked' => sub { | ||
| 12617 | |||
| 12618 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 12619 | if (defined $name) { | ||
| 12620 | |||
| 12621 | # Play the sound effect | ||
| 12622 | $self->session->pseudoCmd('playsoundeffect <' . $name . '>', $self->pseudoCmdMode); | ||
| 12623 | |||
| 12624 | # Refresh the simple list | ||
| 12625 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12626 | } | ||
| 12627 | }); | ||
| 12628 | |||
| 12629 | my $button4 = $self->addButton( | ||
| 12630 | $grid, | ||
| 12631 | 'Play random', | ||
| 12632 | 'Play a random sound effect sound effect', | ||
| 12633 | undef, | ||
| 12634 | 3, 6, 9, 10); | ||
| 12635 | $button4->signal_connect('clicked' => sub { | ||
| 12636 | |||
| 12637 | # Play the sound effect | ||
| 12638 | $self->session->pseudoCmd('playsoundeffect', $self->pseudoCmdMode); | ||
| 12639 | |||
| 12640 | # Refresh the simple list | ||
| 12641 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12642 | }); | ||
| 12643 | |||
| 12644 | my $button5 = $self->addButton( | ||
| 12645 | $grid, | ||
| 12646 | 'Change sound file', | ||
| 12647 | 'Change the file for the selected sound effect', | ||
| 12648 | undef, | ||
| 12649 | 6, 9, 9, 10); | ||
| 12650 | $button5->signal_connect('clicked' => sub { | ||
| 12651 | |||
| 12652 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 12653 | if (defined $name) { | ||
| 12654 | |||
| 12655 | # Edit the sound effect. A dialogue window is opened to choose a file | ||
| 12656 | $self->session->pseudoCmd('addsoundeffect <' . $name . '>', $self->pseudoCmdMode); | ||
| 12657 | |||
| 12658 | # Refresh the simple list and reset the entry box | ||
| 12659 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12660 | $self->resetEntryBoxes($entry); | ||
| 12661 | } | ||
| 12662 | }); | ||
| 12663 | |||
| 12664 | my $button6 = $self->addButton( | ||
| 12665 | $grid, | ||
| 12666 | 'Use no sound file', | ||
| 12667 | 'Use no file with the selected sound effect', | ||
| 12668 | undef, | ||
| 12669 | 9, 12, 9, 10); | ||
| 12670 | $button6->signal_connect('clicked' => sub { | ||
| 12671 | |||
| 12672 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 12673 | if (defined $name) { | ||
| 12674 | |||
| 12675 | # Edit the sound effect. A dialogue window is opened to choose a file | ||
| 12676 | $self->session->pseudoCmd( | ||
| 12677 | 'addsoundeffect <' . $name . '> -d', | ||
| 12678 | $self->pseudoCmdMode, | ||
| 12679 | ); | ||
| 12680 | |||
| 12681 | # Refresh the simple list and reset the entry box | ||
| 12682 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12683 | $self->resetEntryBoxes($entry); | ||
| 12684 | } | ||
| 12685 | }); | ||
| 12686 | |||
| 12687 | my $button7 = $self->addButton( | ||
| 12688 | $grid, 'Delete selected ', 'Delete the selected sound effect', undef, | ||
| 12689 | 1, 3, 10, 11); | ||
| 12690 | $button7->signal_connect('clicked' => sub { | ||
| 12691 | |||
| 12692 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 12693 | if (defined $name) { | ||
| 12694 | |||
| 12695 | # Delete the sound effect | ||
| 12696 | $self->session->pseudoCmd( | ||
| 12697 | 'deletesoundeffect <' . $name . '>', | ||
| 12698 | $self->pseudoCmdMode, | ||
| 12699 | ); | ||
| 12700 | |||
| 12701 | # Refresh the simple list and reset the entry box | ||
| 12702 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12703 | $self->resetEntryBoxes($entry); | ||
| 12704 | } | ||
| 12705 | }); | ||
| 12706 | |||
| 12707 | my $button8 = $self->addButton($grid, 'Delete all', 'Delete all sound effects', undef, | ||
| 12708 | 3, 6, 10, 11); | ||
| 12709 | $button8->signal_connect('clicked' => sub { | ||
| 12710 | |||
| 12711 | # Delete all sound effects | ||
| 12712 | $self->session->pseudoCmd('deletesoundeffect -a', $self->pseudoCmdMode); | ||
| 12713 | |||
| 12714 | # Refresh the simple list and reset the entry box | ||
| 12715 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12716 | $self->resetEntryBoxes($entry); | ||
| 12717 | }); | ||
| 12718 | |||
| 12719 | my $button9 = $self->addButton($grid, | ||
| 12720 | 'Reset all', 'Resets the list of sound effects to the default list', undef, | ||
| 12721 | 6, 9, 10, 11); | ||
| 12722 | $button9->signal_connect('clicked' => sub { | ||
| 12723 | |||
| 12724 | # Reset sound effects | ||
| 12725 | $self->session->pseudoCmd('resetsoundeffect', $self->pseudoCmdMode); | ||
| 12726 | |||
| 12727 | # Refresh the simple list and reset the entry box | ||
| 12728 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12729 | $self->resetEntryBoxes($entry); | ||
| 12730 | }); | ||
| 12731 | |||
| 12732 | my $button10 = $self->addButton($grid, | ||
| 12733 | 'Dump all', 'Display the list of sound effects in the \'main\' window', undef, | ||
| 12734 | 9, 12, 10, 11); | ||
| 12735 | $button10->signal_connect('clicked' => sub { | ||
| 12736 | |||
| 12737 | # List sound effects | ||
| 12738 | $self->session->pseudoCmd('listsoundeffect', $self->pseudoCmdMode); | ||
| 12739 | |||
| 12740 | # Refresh the simple list | ||
| 12741 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12742 | }); | ||
| 12743 | |||
| 12744 | # (->signal_connect from above) | ||
| 12745 | $checkButton->signal_connect('toggled' => sub { | ||
| 12746 | |||
| 12747 | $standardFlag = $checkButton->get_active(); | ||
| 12748 | |||
| 12749 | # Refresh the simple list | ||
| 12750 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12751 | }); | ||
| 12752 | |||
| 12753 | my $checkButton2 = $self->addCheckButton( | ||
| 12754 | $grid, 'Enable sound effects in general', undef, TRUE, | ||
| 12755 | 1, 4, 11, 12); | ||
| 12756 | $checkButton2->set_active($axmud::CLIENT->allowSoundFlag); | ||
| 12757 | $checkButton2->signal_connect('toggled' => sub { | ||
| 12758 | |||
| 12759 | if ($checkButton2->get_active()) { | ||
| 12760 | $self->session->pseudoCmd('sound on', $self->pseudoCmdMode); | ||
| 12761 | } else { | ||
| 12762 | $self->session->pseudoCmd('sound off', $self->pseudoCmdMode); | ||
| 12763 | } | ||
| 12764 | |||
| 12765 | # Refresh the simple list | ||
| 12766 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12767 | }); | ||
| 12768 | |||
| 12769 | my $checkButton3 = $self->addCheckButton( | ||
| 12770 | $grid, 'Enable beeps sent by the world (while sound effects are on)', undef, TRUE, | ||
| 12771 | 4, 12, 11, 12); | ||
| 12772 | $checkButton3->set_active($axmud::CLIENT->allowAsciiBellFlag); | ||
| 12773 | $checkButton3->signal_connect('toggled' => sub { | ||
| 12774 | |||
| 12775 | if ($checkButton3->get_active()) { | ||
| 12776 | $self->session->pseudoCmd('asciibell on', $self->pseudoCmdMode); | ||
| 12777 | } else { | ||
| 12778 | $self->session->pseudoCmd('asciibell off', $self->pseudoCmdMode); | ||
| 12779 | } | ||
| 12780 | # Refresh the simple list | ||
| 12781 | $self->sound1Tab_refreshList($slWidget, scalar (@columnList / 2), $standardFlag); | ||
| 12782 | }); | ||
| 12783 | |||
| 12784 | # Tab complete | ||
| 12785 | return 1; | ||
| 12786 | } | ||
| 12787 | |||
| 12788 | sub sound1Tab_refreshList { | ||
| 12789 | |||
| 12790 | # Called by $self->sound1Tab to refresh the GA::Obj::SimpleList | ||
| 12791 | # | ||
| 12792 | # Expected arguments | ||
| 12793 | # $slWidget - The GA::Obj::SimpleList | ||
| 12794 | # $columns - The number of columns in the list | ||
| 12795 | # $standardFlag - If TRUE, only standard sound effects in the sound effects bank are | ||
| 12796 | # shown. If FALSE, all sound effects in the sound effects bank are | ||
| 12797 | # shown | ||
| 12798 | # | ||
| 12799 | # | ||
| 12800 | # Return values | ||
| 12801 | # 'undef' on improper arguments | ||
| 12802 | # 1 otherwise | ||
| 12803 | |||
| 12804 | my ($self, $slWidget, $columns, $standardFlag, $check) = @_; | ||
| 12805 | |||
| 12806 | # Local variables | ||
| 12807 | my ( | ||
| 12808 | @sortedList, @dataList, | ||
| 12809 | %standardHash, %customHash, | ||
| 12810 | ); | ||
| 12811 | |||
| 12812 | # Check for improper arguments | ||
| 12813 | if ( | ||
| 12814 | ! defined $slWidget || ! defined $columns || ! defined $standardFlag | ||
| 12815 | || defined $check | ||
| 12816 | ) { | ||
| 12817 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound1Tab_refreshList', @_); | ||
| 12818 | } | ||
| 12819 | |||
| 12820 | # Import the hash of sound effects, and sort them | ||
| 12821 | %standardHash = $axmud::CLIENT->constStandardSoundHash; | ||
| 12822 | %customHash = $axmud::CLIENT->customSoundHash; | ||
| 12823 | @sortedList = sort {lc($a) cmp lc($b)} (keys %customHash); | ||
| 12824 | |||
| 12825 | # Compile the simple list data | ||
| 12826 | foreach my $effect (@sortedList) { | ||
| 12827 | |||
| 12828 | my $flag; | ||
| 12829 | |||
| 12830 | if (! exists $standardHash{$effect}) { | ||
| 12831 | $flag = FALSE; | ||
| 12832 | } else { | ||
| 12833 | $flag = TRUE; | ||
| 12834 | } | ||
| 12835 | |||
| 12836 | if ($flag || ! $standardFlag) { | ||
| 12837 | |||
| 12838 | push (@dataList, $flag, $effect, $customHash{$effect}); | ||
| 12839 | } | ||
| 12840 | } | ||
| 12841 | |||
| 12842 | # Reset the simple list | ||
| 12843 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 12844 | |||
| 12845 | return 1; | ||
| 12846 | } | ||
| 12847 | |||
| 12848 | sub sound2Tab { | ||
| 12849 | |||
| 12850 | # Sound2 tab | ||
| 12851 | # | ||
| 12852 | # Expected arguments | ||
| 12853 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 12854 | # | ||
| 12855 | # Return values | ||
| 12856 | # 'undef' on improper arguments | ||
| 12857 | # 1 otherwise | ||
| 12858 | |||
| 12859 | my ($self, $innerNotebook, $check) = @_; | ||
| 12860 | |||
| 12861 | # Local variables | ||
| 12862 | my @comboList; | ||
| 12863 | |||
| 12864 | # Check for improper arguments | ||
| 12865 | if (! defined $innerNotebook || defined $check) { | ||
| 12866 | |||
| 12867 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound2Tab', @_); | ||
| 12868 | } | ||
| 12869 | |||
| 12870 | # Tab setup | ||
| 12871 | my $grid = $self->addTab( | ||
| 12872 | $innerNotebook, | ||
| 12873 | 'Page _2', | ||
| 12874 | ['Text-to-speech (TTS) (1/2)'], | ||
| 12875 | ); | ||
| 12876 | |||
| 12877 | # Text-to-speech (TTS) (1/2) | ||
| 12878 | $self->addLabel($grid, '<b>Text-to-speech (TTS) (1/2)</b>', | ||
| 12879 | 0, 12, 0, 1); | ||
| 12880 | $self->addLabel( | ||
| 12881 | $grid, | ||
| 12882 | '<i>Convert text to audible speech, using any of the TTS engines that ' | ||
| 12883 | . $axmud::SCRIPT . ' supports</i>', | ||
| 12884 | 1, 12, 1, 2); | ||
| 12885 | |||
| 12886 | my $checkButton = $self->addCheckButton( | ||
| 12887 | $grid, 'Enable text-to-speech for all users', undef, TRUE, | ||
| 12888 | 1, 12, 2, 3); | ||
| 12889 | $checkButton->set_active($axmud::CLIENT->customAllowTTSFlag); | ||
| 12890 | # (->signal_connect appears below) | ||
| 12891 | |||
| 12892 | my $checkButton2 = $self->addCheckButton( | ||
| 12893 | $grid, | ||
| 12894 | 'Allow TTS smoothing (makes the voice sound more natural by guessing sentences)', | ||
| 12895 | undef, | ||
| 12896 | TRUE, | ||
| 12897 | 1, 12, 3, 4); | ||
| 12898 | $checkButton2->set_active($axmud::CLIENT->ttsSmoothFlag); | ||
| 12899 | $checkButton2->signal_connect('toggled' => sub { | ||
| 12900 | |||
| 12901 | if ($checkButton2->get_active()) { | ||
| 12902 | $axmud::CLIENT->set_ttsFlag('smooth', TRUE); | ||
| 12903 | } else { | ||
| 12904 | $axmud::CLIENT->set_ttsFlag('smooth', FALSE); | ||
| 12905 | } | ||
| 12906 | }); | ||
| 12907 | |||
| 12908 | my $checkButton3 = $self->addCheckButton( | ||
| 12909 | $grid, | ||
| 12910 | 'In blind mode, replay speech using the cursor/page up/page down/home/end/tab/escape' | ||
| 12911 | . ' keys', | ||
| 12912 | undef, | ||
| 12913 | TRUE, | ||
| 12914 | 1, 12, 4, 5); | ||
| 12915 | $checkButton3->set_active($axmud::CLIENT->ttsHijackFlag); | ||
| 12916 | $checkButton3->signal_connect('toggled' => sub { | ||
| 12917 | |||
| 12918 | if ($checkButton3->get_active()) { | ||
| 12919 | $axmud::CLIENT->set_ttsHijackFlag(TRUE); | ||
| 12920 | } else { | ||
| 12921 | $axmud::CLIENT->set_ttsHijackFlag(FALSE); | ||
| 12922 | } | ||
| 12923 | }); | ||
| 12924 | if (! $axmud::BLIND_MODE_FLAG) { | ||
| 12925 | |||
| 12926 | $checkButton3->set_sensitive(FALSE); | ||
| 12927 | } | ||
| 12928 | |||
| 12929 | my $checkButton4 = $self->addCheckButton( | ||
| 12930 | $grid, | ||
| 12931 | 'Hijack those keys when not in blind mode', | ||
| 12932 | undef, | ||
| 12933 | TRUE, | ||
| 12934 | 2, 12, 5, 6); | ||
| 12935 | $checkButton4->set_active($axmud::CLIENT->ttsForceHijackFlag); | ||
| 12936 | $checkButton4->signal_connect('toggled' => sub { | ||
| 12937 | |||
| 12938 | if ($checkButton4->get_active()) { | ||
| 12939 | $axmud::CLIENT->set_ttsForceHijackFlag(TRUE); | ||
| 12940 | } else { | ||
| 12941 | $axmud::CLIENT->set_ttsForceHijackFlag(FALSE); | ||
| 12942 | } | ||
| 12943 | }); | ||
| 12944 | if ($axmud::BLIND_MODE_FLAG || ! $axmud::CLIENT->customAllowTTSFlag) { | ||
| 12945 | |||
| 12946 | $checkButton4->set_sensitive(FALSE); | ||
| 12947 | } | ||
| 12948 | |||
| 12949 | # (->signal_connect from above) | ||
| 12950 | $checkButton->signal_connect('toggled' => sub { | ||
| 12951 | |||
| 12952 | if ($checkButton->get_active()) { | ||
| 12953 | $axmud::CLIENT->set_customAllowTTSFlag(TRUE); | ||
| 12954 | } else { | ||
| 12955 | $axmud::CLIENT->set_customAllowTTSFlag(FALSE); | ||
| 12956 | } | ||
| 12957 | |||
| 12958 | $checkButton4->set_active($axmud::CLIENT->ttsForceHijackFlag); | ||
| 12959 | if (! $axmud::CLIENT->customAllowTTSFlag) { | ||
| 12960 | $checkButton4->set_sensitive(FALSE); | ||
| 12961 | } else { | ||
| 12962 | $checkButton4->set_sensitive(TRUE); | ||
| 12963 | } | ||
| 12964 | }); | ||
| 12965 | |||
| 12966 | # Settings for text-to-speech conversion in specific contexts | ||
| 12967 | $self->addLabel( | ||
| 12968 | $grid, | ||
| 12969 | '<i>Settings for text-to-speech conversion in specific contexts</i>', | ||
| 12970 | 1, 12, 6, 7); | ||
| 12971 | |||
| 12972 | my $checkButton5 = $self->addCheckButton( | ||
| 12973 | $grid, | ||
| 12974 | 'Verbose output (precede with \'System message\' or \'Received text\', etc)', | ||
| 12975 | undef, | ||
| 12976 | TRUE, | ||
| 12977 | 1, 12, 7, 8); | ||
| 12978 | $checkButton5->set_active($axmud::CLIENT->ttsVerboseFlag); | ||
| 12979 | $checkButton5->signal_connect('toggled' => sub { | ||
| 12980 | |||
| 12981 | if ($checkButton5->get_active()) { | ||
| 12982 | $axmud::CLIENT->set_ttsFlag('verbose', TRUE); | ||
| 12983 | } else { | ||
| 12984 | $axmud::CLIENT->set_ttsFlag('verbose', FALSE); | ||
| 12985 | } | ||
| 12986 | }); | ||
| 12987 | |||
| 12988 | my $checkButton6 = $self->addCheckButton( | ||
| 12989 | $grid, 'Convert text received from the world', undef, TRUE, | ||
| 12990 | 1, 12, 8, 9); | ||
| 12991 | $checkButton6->set_active($axmud::CLIENT->ttsReceiveFlag); | ||
| 12992 | $checkButton6->signal_connect('toggled' => sub { | ||
| 12993 | |||
| 12994 | if ($checkButton6->get_active()) { | ||
| 12995 | $axmud::CLIENT->set_ttsFlag('receive', TRUE); | ||
| 12996 | } else { | ||
| 12997 | $axmud::CLIENT->set_ttsFlag('receive', FALSE); | ||
| 12998 | } | ||
| 12999 | }); | ||
| 13000 | |||
| 13001 | my $checkButton7 = $self->addCheckButton( | ||
| 13002 | $grid, | ||
| 13003 | 'Don\'t convert received text before an automatic login is processed (but do convert' | ||
| 13004 | . ' prompts)', | ||
| 13005 | undef, | ||
| 13006 | TRUE, | ||
| 13007 | 2, 12, 9, 10); | ||
| 13008 | $checkButton7->set_active($axmud::CLIENT->ttsLoginFlag); | ||
| 13009 | $checkButton7->signal_connect('toggled' => sub { | ||
| 13010 | |||
| 13011 | if ($checkButton7->get_active()) { | ||
| 13012 | $axmud::CLIENT->set_ttsFlag('login', TRUE); | ||
| 13013 | } else { | ||
| 13014 | $axmud::CLIENT->set_ttsFlag('login', FALSE); | ||
| 13015 | } | ||
| 13016 | }); | ||
| 13017 | |||
| 13018 | my $checkButton8 = $self->addCheckButton( | ||
| 13019 | $grid, | ||
| 13020 | 'Don\'t convert world profile\'s recognised prompts in received text after a login', | ||
| 13021 | undef, | ||
| 13022 | TRUE, | ||
| 13023 | 2, 12, 10, 11); | ||
| 13024 | $checkButton8->set_active($axmud::CLIENT->ttsPromptFlag); | ||
| 13025 | $checkButton8->signal_connect('toggled' => sub { | ||
| 13026 | |||
| 13027 | if ($checkButton8->get_active()) { | ||
| 13028 | $axmud::CLIENT->set_ttsFlag('prompt', TRUE); | ||
| 13029 | } else { | ||
| 13030 | $axmud::CLIENT->set_ttsFlag('prompt', FALSE); | ||
| 13031 | } | ||
| 13032 | }); | ||
| 13033 | |||
| 13034 | my $checkButton9 = $self->addCheckButton( | ||
| 13035 | $grid, 'Convert system messages', undef, TRUE, | ||
| 13036 | 1, 6, 11, 12); | ||
| 13037 | $checkButton9->set_active($axmud::CLIENT->ttsSystemFlag); | ||
| 13038 | $checkButton9->signal_connect('toggled' => sub { | ||
| 13039 | |||
| 13040 | if ($checkButton9->get_active()) { | ||
| 13041 | $axmud::CLIENT->set_ttsFlag('system', TRUE); | ||
| 13042 | } else { | ||
| 13043 | $axmud::CLIENT->set_ttsFlag('system', FALSE); | ||
| 13044 | } | ||
| 13045 | }); | ||
| 13046 | |||
| 13047 | my $checkButton10 = $self->addCheckButton( | ||
| 13048 | $grid,'Convert system error/warning messages', undef, TRUE, | ||
| 13049 | 1, 6, 12, 13); | ||
| 13050 | $checkButton10->set_active($axmud::CLIENT->ttsSystemErrorFlag); | ||
| 13051 | $checkButton10->signal_connect('toggled' => sub { | ||
| 13052 | |||
| 13053 | if ($checkButton10->get_active()) { | ||
| 13054 | $axmud::CLIENT->set_ttsFlag('error', TRUE); | ||
| 13055 | } else { | ||
| 13056 | $axmud::CLIENT->set_ttsFlag('error', FALSE); | ||
| 13057 | } | ||
| 13058 | }); | ||
| 13059 | |||
| 13060 | my $checkButton11 = $self->addCheckButton( | ||
| 13061 | $grid, 'Convert world commands', undef, TRUE, | ||
| 13062 | 7, 12, 11, 12); | ||
| 13063 | $checkButton11->set_active($axmud::CLIENT->ttsWorldCmdFlag); | ||
| 13064 | $checkButton11->signal_connect('toggled' => sub { | ||
| 13065 | |||
| 13066 | if ($checkButton11->get_active()) { | ||
| 13067 | $axmud::CLIENT->set_ttsFlag('command', TRUE); | ||
| 13068 | } else { | ||
| 13069 | $axmud::CLIENT->set_ttsFlag('command', FALSE); | ||
| 13070 | } | ||
| 13071 | }); | ||
| 13072 | |||
| 13073 | my $checkButton12 = $self->addCheckButton( | ||
| 13074 | $grid, 'Convert \'dialogue\' windows', undef, TRUE, | ||
| 13075 | 7, 12, 12, 13); | ||
| 13076 | $checkButton12->set_active($axmud::CLIENT->ttsDialogueFlag); | ||
| 13077 | $checkButton12->signal_connect('toggled' => sub { | ||
| 13078 | |||
| 13079 | if ($checkButton12->get_active()) { | ||
| 13080 | $axmud::CLIENT->set_ttsFlag('dialogue', TRUE); | ||
| 13081 | } else { | ||
| 13082 | $axmud::CLIENT->set_ttsFlag('dialogue', FALSE); | ||
| 13083 | } | ||
| 13084 | }); | ||
| 13085 | |||
| 13086 | my $checkButton13 = $self->addCheckButton( | ||
| 13087 | $grid, | ||
| 13088 | 'Allow some tasks (e.g. the Status and Locator tasks) to convert certain strings to' | ||
| 13089 | . ' speech', | ||
| 13090 | undef, | ||
| 13091 | TRUE, | ||
| 13092 | 1, 12, 13, 14); | ||
| 13093 | $checkButton13->set_active($axmud::CLIENT->ttsTaskFlag); | ||
| 13094 | $checkButton13->signal_connect('toggled' => sub { | ||
| 13095 | |||
| 13096 | if ($checkButton13->get_active()) { | ||
| 13097 | $axmud::CLIENT->set_ttsFlag('task', TRUE); | ||
| 13098 | } else { | ||
| 13099 | $axmud::CLIENT->set_ttsFlag('task', FALSE); | ||
| 13100 | } | ||
| 13101 | }); | ||
| 13102 | |||
| 13103 | # Tab complete | ||
| 13104 | return 1; | ||
| 13105 | } | ||
| 13106 | |||
| 13107 | sub sound3Tab { | ||
| 13108 | |||
| 13109 | # Sound3 tab | ||
| 13110 | # | ||
| 13111 | # Expected arguments | ||
| 13112 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13113 | # | ||
| 13114 | # Return values | ||
| 13115 | # 'undef' on improper arguments | ||
| 13116 | # 1 otherwise | ||
| 13117 | |||
| 13118 | my ($self, $innerNotebook, $check) = @_; | ||
| 13119 | |||
| 13120 | # Local variables | ||
| 13121 | my (@compatList, @comboList); | ||
| 13122 | |||
| 13123 | # Check for improper arguments | ||
| 13124 | if (! defined $innerNotebook || defined $check) { | ||
| 13125 | |||
| 13126 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound3Tab', @_); | ||
| 13127 | } | ||
| 13128 | |||
| 13129 | # Tab setup | ||
| 13130 | my $grid = $self->addTab( | ||
| 13131 | $innerNotebook, | ||
| 13132 | 'Page _3', | ||
| 13133 | ['Text-to-speech (TTS) (2/2)'], | ||
| 13134 | ); | ||
| 13135 | |||
| 13136 | # Text-to-speech (TTS) (2/2) | ||
| 13137 | $self->addLabel($grid, '<b>Text-to-speech (TTS) (2/2)</b>', | ||
| 13138 | 0, 12, 0, 1); | ||
| 13139 | |||
| 13140 | # Top-left | ||
| 13141 | $self->addLabel($grid, '<i>' . $axmud::SCRIPT . '-supported TTS engines</i>', | ||
| 13142 | 1, 6, 1, 2); | ||
| 13143 | my $textView = $self->addTextView($grid, undef, FALSE, | ||
| 13144 | 1, 6, 2, 7, | ||
| 13145 | FALSE, # Don't treat as a list | ||
| 13146 | FALSE, # Don't remove empty lines | ||
| 13147 | TRUE, # ...but do remove leading/trailing whitespace | ||
| 13148 | FALSE, # Allow horizontal scrolling | ||
| 13149 | ); | ||
| 13150 | my $buffer = $textView->get_buffer(); | ||
| 13151 | $buffer->set_text(join("\n", $axmud::CLIENT->constTTSList)); | ||
| 13152 | |||
| 13153 | # Bottom-left | ||
| 13154 | $self->addLabel($grid, '<i>Compatible TTS engines</i>', | ||
| 13155 | 1, 6, 7, 8); | ||
| 13156 | |||
| 13157 | foreach my $engine ($axmud::CLIENT->constTTSCompatList) { | ||
| 13158 | |||
| 13159 | if ( | ||
| 13160 | $^O eq 'MSWin32' | ||
| 13161 | && ( | ||
| 13162 | ( | ||
| 13163 | $engine eq 'espeak' | ||
| 13164 | && ( | ||
| 13165 | ( | ||
| 13166 | defined $axmud::CLIENT->msWinPathESpeak | ||
| 13167 | && -e $axmud::CLIENT->msWinPathESpeak | ||
| 13168 | ) || ( | ||
| 13169 | defined $axmud::CLIENT->msWinAltPathESpeak | ||
| 13170 | && -e $axmud::CLIENT->msWinAltPathESpeak | ||
| 13171 | ) | ||
| 13172 | ) | ||
| 13173 | ) || ( | ||
| 13174 | $engine eq 'esng' | ||
| 13175 | && defined $axmud::CLIENT->msWinPathESNG | ||
| 13176 | && -e $axmud::CLIENT->msWinPathESNG | ||
| 13177 | ) || ( | ||
| 13178 | $engine eq 'festival' | ||
| 13179 | && defined $axmud::CLIENT->msWinPathFestival | ||
| 13180 | && -e $axmud::CLIENT->msWinPathFestival | ||
| 13181 | ) || ( | ||
| 13182 | $engine eq 'swift' | ||
| 13183 | && defined $axmud::CLIENT->msWinPathSwift | ||
| 13184 | && -e $axmud::CLIENT->msWinPathSwift | ||
| 13185 | ) | ||
| 13186 | ) | ||
| 13187 | ) { | ||
| 13188 | push (@compatList, $engine . ' <detected>'); | ||
| 13189 | } else { | ||
| 13190 | push (@compatList, $engine); | ||
| 13191 | } | ||
| 13192 | } | ||
| 13193 | |||
| 13194 | my $textView2 = $self->addTextView($grid, undef, FALSE, | ||
| 13195 | 1, 6, 8, 13, | ||
| 13196 | FALSE, # Don't treat as a list | ||
| 13197 | FALSE, # Don't remove empty lines | ||
| 13198 | TRUE, # ...but do remove leading/trailing whitespace | ||
| 13199 | FALSE, # Allow horizontal scrolling | ||
| 13200 | ); | ||
| 13201 | my $buffer2 = $textView2->get_buffer(); | ||
| 13202 | $buffer2->set_text(join("\n", @compatList)); | ||
| 13203 | |||
| 13204 | # Top-right | ||
| 13205 | $self->addLabel($grid, '<i>Festival server settings</i>', | ||
| 13206 | 7, 12, 1, 2); | ||
| 13207 | |||
| 13208 | $self->addLabel( | ||
| 13209 | $grid, 'Festival server port (0-65535, or leave empty to use the command line engine)', | ||
| 13210 | 7, 12, 2, 3); | ||
| 13211 | my $entry = $self->addEntry($grid, undef, TRUE, | ||
| 13212 | 7, 8, 3, 4, | ||
| 13213 | 5, 5); | ||
| 13214 | if ( | ||
| 13215 | defined $axmud::CLIENT->ttsFestivalServerPort | ||
| 13216 | && $axmud::CLIENT->ttsFestivalServerPort ne '' | ||
| 13217 | ) { | ||
| 13218 | $entry->set_text($axmud::CLIENT->ttsFestivalServerPort); | ||
| 13219 | } | ||
| 13220 | my $button = $self->addButton( | ||
| 13221 | $grid, 'Use server with this port', 'Set the Festival server port', undef, | ||
| 13222 | 8, 10, 3, 4); | ||
| 13223 | $button->signal_connect('clicked' => sub { | ||
| 13224 | |||
| 13225 | my $port = $entry->get_text(); | ||
| 13226 | |||
| 13227 | if ($port eq '') { | ||
| 13228 | $self->session->pseudoCmd('speech port none', $self->pseudoCmdMode); | ||
| 13229 | } else { | ||
| 13230 | $self->session->pseudoCmd('speech port ' . $port, $self->pseudoCmdMode); | ||
| 13231 | } | ||
| 13232 | |||
| 13233 | if (defined $axmud::CLIENT->ttsFestivalServerPort) { | ||
| 13234 | $entry->set_text($axmud::CLIENT->ttsFestivalServerPort); | ||
| 13235 | } else { | ||
| 13236 | $entry->set_text(''); | ||
| 13237 | } | ||
| 13238 | }); | ||
| 13239 | my $button2 = $self->addButton( | ||
| 13240 | $grid, | ||
| 13241 | 'Use server with default port', | ||
| 13242 | 'Use the default Festival server port', | ||
| 13243 | undef, | ||
| 13244 | 10, 12, 3, 4); | ||
| 13245 | $button2->signal_connect('clicked' => sub { | ||
| 13246 | |||
| 13247 | $self->session->pseudoCmd('speech port default', $self->pseudoCmdMode); | ||
| 13248 | if (defined $axmud::CLIENT->ttsFestivalServerPort) { | ||
| 13249 | $entry->set_text($axmud::CLIENT->ttsFestivalServerPort); | ||
| 13250 | } else { | ||
| 13251 | $entry->set_text(''); | ||
| 13252 | } | ||
| 13253 | }); | ||
| 13254 | my $button3 = $self->addButton( | ||
| 13255 | $grid, | ||
| 13256 | 'Don\'t use server', | ||
| 13257 | 'Use the Festival command-line engine', | ||
| 13258 | undef, | ||
| 13259 | 10, 12, 4, 5); | ||
| 13260 | $button3->signal_connect('clicked' => sub { | ||
| 13261 | |||
| 13262 | $self->session->pseudoCmd('speech port none', $self->pseudoCmdMode); | ||
| 13263 | if (defined $axmud::CLIENT->ttsFestivalServerPort) { | ||
| 13264 | $entry->set_text($axmud::CLIENT->ttsFestivalServerPort); | ||
| 13265 | } else { | ||
| 13266 | $entry->set_text(''); | ||
| 13267 | } | ||
| 13268 | }); | ||
| 13269 | |||
| 13270 | # Axmud currently doesn't support the Festival server on MS Windows | ||
| 13271 | if ($^O eq 'MSWin32') { | ||
| 13272 | |||
| 13273 | $entry->set_sensitive(FALSE); | ||
| 13274 | $button->set_sensitive(FALSE); | ||
| 13275 | $button2->set_sensitive(FALSE); | ||
| 13276 | $button3->set_sensitive(FALSE); | ||
| 13277 | } | ||
| 13278 | |||
| 13279 | # (add more labels, to get the spacing right) | ||
| 13280 | $self->addLabel($grid, '', | ||
| 13281 | 7, 12, 5, 6); | ||
| 13282 | $self->addLabel($grid, '', | ||
| 13283 | 7, 12, 6, 7); | ||
| 13284 | |||
| 13285 | # Bottom-right | ||
| 13286 | $self->addLabel($grid, '<i>Text-to-speech engine test</i>', | ||
| 13287 | 7, 12, 7, 8); | ||
| 13288 | my $entry2 = $self->addEntry($grid, undef, TRUE, | ||
| 13289 | 7, 12, 8, 9); | ||
| 13290 | $entry2->set_text('Hello, my name is ' . $axmud::SCRIPT . ' and I am your mud client.'); | ||
| 13291 | |||
| 13292 | @comboList = $axmud::CLIENT->constTTSCompatList; | ||
| 13293 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 13294 | TRUE, # No 'undef' value used | ||
| 13295 | 8, 10, 9, 10); | ||
| 13296 | |||
| 13297 | my $button4 = $self->addButton( | ||
| 13298 | $grid, 'Test engine', 'Read aloud this text using the selected TTS engine', undef, | ||
| 13299 | 10, 12, 9, 10); | ||
| 13300 | $button4->signal_connect('clicked' => sub { | ||
| 13301 | |||
| 13302 | # (Actually, we use settings for the TTS configuration with the same name as the engine) | ||
| 13303 | |||
| 13304 | my ($text, $configuration); | ||
| 13305 | |||
| 13306 | $text = $entry2->get_text(); | ||
| 13307 | $configuration = $combo->get_active_text(); | ||
| 13308 | |||
| 13309 | if ($text) { | ||
| 13310 | |||
| 13311 | $self->session->pseudoCmd( | ||
| 13312 | 'speak -n ' . $configuration . ' <' . $text . '>', | ||
| 13313 | $self->pseudoCmdMode, | ||
| 13314 | ); | ||
| 13315 | } | ||
| 13316 | }); | ||
| 13317 | |||
| 13318 | # (add more labels, to get the spacing right) | ||
| 13319 | $self->addLabel($grid, '', | ||
| 13320 | 7, 12, 10, 11); | ||
| 13321 | $self->addLabel($grid, '', | ||
| 13322 | 7, 12, 11, 12); | ||
| 13323 | $self->addLabel($grid, '', | ||
| 13324 | 7, 12, 12, 13); | ||
| 13325 | |||
| 13326 | # Tab complete | ||
| 13327 | return 1; | ||
| 13328 | } | ||
| 13329 | |||
| 13330 | sub sound4Tab { | ||
| 13331 | |||
| 13332 | # Sound4 tab | ||
| 13333 | # | ||
| 13334 | # Expected arguments | ||
| 13335 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13336 | # | ||
| 13337 | # Return values | ||
| 13338 | # 'undef' on improper arguments | ||
| 13339 | # 1 otherwise | ||
| 13340 | |||
| 13341 | my ($self, $innerNotebook, $check) = @_; | ||
| 13342 | |||
| 13343 | # Local variables | ||
| 13344 | my (@columnList, @comboList); | ||
| 13345 | |||
| 13346 | # Check for improper arguments | ||
| 13347 | if (! defined $innerNotebook || defined $check) { | ||
| 13348 | |||
| 13349 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound4Tab', @_); | ||
| 13350 | } | ||
| 13351 | |||
| 13352 | # Tab setup | ||
| 13353 | my $grid = $self->addTab( | ||
| 13354 | $innerNotebook, | ||
| 13355 | 'Page _4', | ||
| 13356 | ['Text-to-speech configurations'], | ||
| 13357 | ); | ||
| 13358 | |||
| 13359 | # Text-to-speech configurations | ||
| 13360 | $self->addLabel($grid, '<b>Text-to-speech configurations</b>', | ||
| 13361 | 0, 13, 0, 1); | ||
| 13362 | $self->addLabel( | ||
| 13363 | $grid, | ||
| 13364 | '<i>Text-to-speech configurations store voice settings for use in all kinds of' | ||
| 13365 | . ' situations</i>', | ||
| 13366 | 1, 13, 1, 2); | ||
| 13367 | |||
| 13368 | # Add a simple list | ||
| 13369 | @columnList = ( | ||
| 13370 | 'Name', 'text', | ||
| 13371 | 'Engine', 'text', | ||
| 13372 | 'Modifiable', 'bool', | ||
| 13373 | 'Deletable', 'bool', | ||
| 13374 | 'Voice', 'text', | ||
| 13375 | 'Speed', 'text', | ||
| 13376 | 'Rate', 'text', | ||
| 13377 | 'Pitch', 'text', | ||
| 13378 | 'Volume', 'text', | ||
| 13379 | ); | ||
| 13380 | |||
| 13381 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 13382 | 1, 13, 2, 10); | ||
| 13383 | |||
| 13384 | # Initialise the list | ||
| 13385 | $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 13386 | |||
| 13387 | # Add entries and buttons | ||
| 13388 | $self->addLabel($grid, 'Configuration name', | ||
| 13389 | 1, 3, 10, 11); | ||
| 13390 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 13391 | 3, 5, 10, 11); | ||
| 13392 | |||
| 13393 | $self->addLabel($grid, 'Engine', | ||
| 13394 | 5, 7, 10, 11); | ||
| 13395 | @comboList = $axmud::CLIENT->constTTSList; | ||
| 13396 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 13397 | TRUE, # No 'undef' value used | ||
| 13398 | 7, 9, 10, 11); | ||
| 13399 | |||
| 13400 | my $button = $self->addButton( | ||
| 13401 | $grid, | ||
| 13402 | 'Add', | ||
| 13403 | 'Add a new text-to-speech configuration', | ||
| 13404 | undef, | ||
| 13405 | 9, 11, 10, 11); | ||
| 13406 | $button->signal_connect('clicked' => sub { | ||
| 13407 | |||
| 13408 | my ($configuration, $engine); | ||
| 13409 | |||
| 13410 | if ($self->checkEntryIcon($entry)) { | ||
| 13411 | |||
| 13412 | $configuration = $entry->get_text(); | ||
| 13413 | $engine = $combo->get_active_text(); | ||
| 13414 | |||
| 13415 | # Add the configuration | ||
| 13416 | $self->session->pseudoCmd( | ||
| 13417 | 'addconfig ' . $configuration . ' ' . $engine, | ||
| 13418 | $self->pseudoCmdMode, | ||
| 13419 | ); | ||
| 13420 | |||
| 13421 | # Refresh the simple list | ||
| 13422 | $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 13423 | } | ||
| 13424 | }); | ||
| 13425 | |||
| 13426 | my $button2 = $self->addButton( | ||
| 13427 | $grid, | ||
| 13428 | 'Clone', | ||
| 13429 | 'Clone the selected text-to-speech configuration', | ||
| 13430 | undef, | ||
| 13431 | 11, 13, 10, 11); | ||
| 13432 | $button2->signal_connect('clicked' => sub { | ||
| 13433 | |||
| 13434 | my ($original, $copy); | ||
| 13435 | |||
| 13436 | if ($self->checkEntryIcon($entry)) { | ||
| 13437 | |||
| 13438 | $copy = $entry->get_text(); | ||
| 13439 | ($original) = $self->getSimpleListData($slWidget, 0); | ||
| 13440 | if (defined $original) { | ||
| 13441 | |||
| 13442 | # Clone the configuration | ||
| 13443 | $self->session->pseudoCmd( | ||
| 13444 | 'cloneconfig ' . $original . ' ' . $copy, | ||
| 13445 | $self->pseudoCmdMode, | ||
| 13446 | ); | ||
| 13447 | |||
| 13448 | # Refresh the simple list | ||
| 13449 | $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 13450 | } | ||
| 13451 | } | ||
| 13452 | }); | ||
| 13453 | |||
| 13454 | my $button3 = $self->addButton( | ||
| 13455 | $grid, | ||
| 13456 | 'Edit...', | ||
| 13457 | 'Edit the selected text-to-speech configuration', | ||
| 13458 | undef, | ||
| 13459 | 7, 9, 11, 12); | ||
| 13460 | $button3->signal_connect('clicked' => sub { | ||
| 13461 | |||
| 13462 | my ($configuration, $ttsObj, $childWinObj); | ||
| 13463 | |||
| 13464 | ($configuration) = $self->getSimpleListData($slWidget, 0); | ||
| 13465 | if (defined $configuration) { | ||
| 13466 | |||
| 13467 | # Get the corresponding GA::Obj::Tts object | ||
| 13468 | $ttsObj = $axmud::CLIENT->ivShow('ttsObjHash', $configuration); | ||
| 13469 | if ($ttsObj) { | ||
| 13470 | |||
| 13471 | # Open an 'edit' window for the configuration object | ||
| 13472 | $self->createFreeWin( | ||
| 13473 | 'Games::Axmud::EditWin::TTS', | ||
| 13474 | $self, | ||
| 13475 | $self->session, | ||
| 13476 | 'Edit text-to-speech configuration \'' . $configuration . '\'', | ||
| 13477 | $ttsObj, | ||
| 13478 | FALSE, # Not temporary | ||
| 13479 | ); | ||
| 13480 | } | ||
| 13481 | |||
| 13482 | if ($childWinObj) { | ||
| 13483 | |||
| 13484 | # When the 'edit' window closes, update widgets and/or IVs | ||
| 13485 | $self->add_childDestroy( | ||
| 13486 | $childWinObj, | ||
| 13487 | 'sound4Tab_refreshList', | ||
| 13488 | [$slWidget, (scalar @columnList / 2)], | ||
| 13489 | ); | ||
| 13490 | } | ||
| 13491 | } | ||
| 13492 | }); | ||
| 13493 | |||
| 13494 | my $button4 = $self->addButton( | ||
| 13495 | $grid, | ||
| 13496 | 'Delete', | ||
| 13497 | 'Delete the selected text-to-speech configuration', | ||
| 13498 | undef, | ||
| 13499 | 9, 11, 11, 12); | ||
| 13500 | $button4->signal_connect('clicked' => sub { | ||
| 13501 | |||
| 13502 | my ($configuration) = $self->getSimpleListData($slWidget, 0); | ||
| 13503 | if (defined $configuration) { | ||
| 13504 | |||
| 13505 | # Delete the configuration | ||
| 13506 | $self->session->pseudoCmd( | ||
| 13507 | 'deleteconfig ' . $configuration, | ||
| 13508 | $self->pseudoCmdMode, | ||
| 13509 | ); | ||
| 13510 | |||
| 13511 | # Refresh the simple list | ||
| 13512 | $self->sound4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 13513 | } | ||
| 13514 | }); | ||
| 13515 | |||
| 13516 | my $button5 = $self->addButton($grid, 'Reset', 'Reset the list of configurations', undef, | ||
| 13517 | 11, 13, 11, 12); | ||
| 13518 | $button5->signal_connect('clicked' => sub { | ||
| 13519 | |||
| 13520 | my %ivHash; | ||
| 13521 | |||
| 13522 | # Refresh the simple list and reset entry boxes | ||
| 13523 | $self->sound4Tab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 13524 | $self->resetEntryBoxes($entry); | ||
| 13525 | $combo->set_active(0); | ||
| 13526 | }); | ||
| 13527 | |||
| 13528 | # Tab complete | ||
| 13529 | return 1; | ||
| 13530 | } | ||
| 13531 | |||
| 13532 | sub sound4Tab_refreshList { | ||
| 13533 | |||
| 13534 | # Called by $self->sound4Tab to refresh the GA::Obj::SimpleList | ||
| 13535 | # | ||
| 13536 | # Expected arguments | ||
| 13537 | # $slWidget - The GA::Obj::SimpleList | ||
| 13538 | # $columns - The number of columns in the list | ||
| 13539 | # | ||
| 13540 | # Return values | ||
| 13541 | # 'undef' on improper arguments | ||
| 13542 | # 1 otherwise | ||
| 13543 | |||
| 13544 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 13545 | |||
| 13546 | # Local variables | ||
| 13547 | my ( | ||
| 13548 | @sortedList, @dataList, | ||
| 13549 | %hash, | ||
| 13550 | ); | ||
| 13551 | |||
| 13552 | # Check for improper arguments | ||
| 13553 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 13554 | |||
| 13555 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound4Tab_refreshList', @_); | ||
| 13556 | } | ||
| 13557 | |||
| 13558 | # Import the hash of TTS configurations, and sort them | ||
| 13559 | %hash = $axmud::CLIENT->ttsObjHash; | ||
| 13560 | @sortedList = sort {lc($a->name) cmp lc($b->name)} (values %hash); | ||
| 13561 | |||
| 13562 | # Compile the simple list data | ||
| 13563 | foreach my $obj (@sortedList) { | ||
| 13564 | |||
| 13565 | push (@dataList, $obj->name, $obj->engine); | ||
| 13566 | |||
| 13567 | if ($axmud::CLIENT->ivExists('constTtsFixedObjHash', $obj->name)) { | ||
| 13568 | push (@dataList, FALSE, FALSE); # Not modifiable, not deletable | ||
| 13569 | } elsif ($axmud::CLIENT->ivExists('constTtsPermObjHash', $obj->name)) { | ||
| 13570 | push (@dataList, TRUE, FALSE); # Modifiable, not deletable | ||
| 13571 | } else { | ||
| 13572 | push (@dataList, TRUE, TRUE); # Modifiable, deletable | ||
| 13573 | } | ||
| 13574 | |||
| 13575 | push (@dataList, $obj->voice, $obj->speed, $obj->rate, $obj->pitch, $obj->volume); | ||
| 13576 | } | ||
| 13577 | |||
| 13578 | # Reset the simple list | ||
| 13579 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 13580 | |||
| 13581 | return 1; | ||
| 13582 | } | ||
| 13583 | |||
| 13584 | sub sound5Tab { | ||
| 13585 | |||
| 13586 | # Sound5 tab | ||
| 13587 | # | ||
| 13588 | # Expected arguments | ||
| 13589 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13590 | # | ||
| 13591 | # Return values | ||
| 13592 | # 'undef' on improper arguments | ||
| 13593 | # 1 otherwise | ||
| 13594 | |||
| 13595 | my ($self, $innerNotebook, $check) = @_; | ||
| 13596 | |||
| 13597 | # Local variables | ||
| 13598 | my @columnList; | ||
| 13599 | |||
| 13600 | # Check for improper arguments | ||
| 13601 | if (! defined $innerNotebook || defined $check) { | ||
| 13602 | |||
| 13603 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound5Tab', @_); | ||
| 13604 | } | ||
| 13605 | |||
| 13606 | # Tab setup | ||
| 13607 | my $grid = $self->addTab( | ||
| 13608 | $innerNotebook, | ||
| 13609 | 'Page _5', | ||
| 13610 | ['Text-to-speech attributes'], | ||
| 13611 | ); | ||
| 13612 | |||
| 13613 | # Text-to-speech attributes | ||
| 13614 | $self->addLabel($grid, '<b>Text-to-speech attributes</b>', | ||
| 13615 | 0, 12, 0, 1); | ||
| 13616 | $self->addLabel( | ||
| 13617 | $grid, | ||
| 13618 | '<i>Attributes used with the \';read\' and \';permread\' commands</i>', | ||
| 13619 | 1, 12, 1, 2); | ||
| 13620 | |||
| 13621 | # Add a simple list | ||
| 13622 | @columnList = ( | ||
| 13623 | 'Attribute', 'text', | ||
| 13624 | 'Assigned to task', 'text', | ||
| 13625 | 'Built-in task', 'bool', | ||
| 13626 | '', 'text', # Dummy to keep the to the left | ||
| 13627 | ); | ||
| 13628 | |||
| 13629 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 13630 | 1, 12, 2, 10); | ||
| 13631 | |||
| 13632 | # Initialise the list | ||
| 13633 | $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAttribHash'); | ||
| 13634 | |||
| 13635 | # Add buttons | ||
| 13636 | my $button = $self->addButton($grid, | ||
| 13637 | 'Refresh list', 'Refresh the list of assigned attributes', undef, | ||
| 13638 | 10, 12, 10, 11); | ||
| 13639 | $button->signal_connect('clicked' => sub { | ||
| 13640 | |||
| 13641 | # Refresh the simple list | ||
| 13642 | $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAttribHash'); | ||
| 13643 | }); | ||
| 13644 | |||
| 13645 | # Tab complete | ||
| 13646 | return 1; | ||
| 13647 | } | ||
| 13648 | |||
| 13649 | sub sound5Tab_refreshList { | ||
| 13650 | |||
| 13651 | # Called by $self->sound5Tab, ->sound6Tab and ->sound7Tab Tab to refresh the | ||
| 13652 | # GA::Obj::SimpleList | ||
| 13653 | # | ||
| 13654 | # Expected arguments | ||
| 13655 | # $slWidget - The GA::Obj::SimpleList | ||
| 13656 | # $columns - The number of columns in the list | ||
| 13657 | # $iv - 'ttsAttribHash', 'ttsFlagAttribHash' or 'ttsAlertAttribHash' | ||
| 13658 | # | ||
| 13659 | # Return values | ||
| 13660 | # 'undef' on improper arguments | ||
| 13661 | # 1 otherwise | ||
| 13662 | |||
| 13663 | my ($self, $slWidget, $columns, $iv, $check) = @_; | ||
| 13664 | |||
| 13665 | # Local variables | ||
| 13666 | my @dataList; | ||
| 13667 | |||
| 13668 | # Check for improper arguments | ||
| 13669 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 13670 | |||
| 13671 | return $axmud::CLIENT->writeImproper( | ||
| 13672 | $self->_objClass . '->sound5Tab_refreshList', | ||
| 13673 | @_, | ||
| 13674 | ); | ||
| 13675 | } | ||
| 13676 | |||
| 13677 | # Compile the simple list data | ||
| 13678 | foreach my $key (sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys($iv))) { | ||
| 13679 | |||
| 13680 | my ($taskName, $flag); | ||
| 13681 | |||
| 13682 | # A built-in task, or not? | ||
| 13683 | $taskName = $axmud::CLIENT->ivShow($iv, $key); | ||
| 13684 | if (! $axmud::CLIENT->ivExists('pluginTaskHash', $taskName)) { | ||
| 13685 | $flag = TRUE; | ||
| 13686 | } else { | ||
| 13687 | $flag = FALSE; | ||
| 13688 | } | ||
| 13689 | |||
| 13690 | push (@dataList, $key, $taskName, $flag, ''); | ||
| 13691 | } | ||
| 13692 | |||
| 13693 | # Reset the simple list | ||
| 13694 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 13695 | |||
| 13696 | return 1; | ||
| 13697 | } | ||
| 13698 | |||
| 13699 | sub sound6Tab { | ||
| 13700 | |||
| 13701 | # Sound6 tab | ||
| 13702 | # | ||
| 13703 | # Expected arguments | ||
| 13704 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13705 | # | ||
| 13706 | # Return values | ||
| 13707 | # 'undef' on improper arguments | ||
| 13708 | # 1 otherwise | ||
| 13709 | |||
| 13710 | my ($self, $innerNotebook, $check) = @_; | ||
| 13711 | |||
| 13712 | # Local variables | ||
| 13713 | my @columnList; | ||
| 13714 | |||
| 13715 | # Check for improper arguments | ||
| 13716 | if (! defined $innerNotebook || defined $check) { | ||
| 13717 | |||
| 13718 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound6Tab', @_); | ||
| 13719 | } | ||
| 13720 | |||
| 13721 | # Tab setup | ||
| 13722 | my $grid = $self->addTab( | ||
| 13723 | $innerNotebook, | ||
| 13724 | 'Page _6', | ||
| 13725 | ['Text-to-speech flag attributes'], | ||
| 13726 | ); | ||
| 13727 | |||
| 13728 | # Text-to-speech flag attributes | ||
| 13729 | $self->addLabel($grid, '<b>Text-to-speech flag attributes</b>', | ||
| 13730 | 0, 12, 0, 1); | ||
| 13731 | $self->addLabel( | ||
| 13732 | $grid, | ||
| 13733 | '<i>Attributes used with the \';switch\' and \';permswitch\' commands</i>', | ||
| 13734 | 1, 12, 1, 2); | ||
| 13735 | |||
| 13736 | # Add a simple list | ||
| 13737 | @columnList = ( | ||
| 13738 | 'Attribute', 'text', | ||
| 13739 | 'Assigned to task', 'text', | ||
| 13740 | 'Built-in task', 'bool', | ||
| 13741 | '', 'text', # Dummy to keep the to the left | ||
| 13742 | ); | ||
| 13743 | |||
| 13744 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 13745 | 1, 12, 2, 10); | ||
| 13746 | |||
| 13747 | # Initialise the list | ||
| 13748 | $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsFlagAttribHash'); | ||
| 13749 | |||
| 13750 | # Add buttons | ||
| 13751 | my $button = $self->addButton($grid, | ||
| 13752 | 'Refresh list', 'Refresh the list of assigned attributes', undef, | ||
| 13753 | 10, 12, 10, 11); | ||
| 13754 | $button->signal_connect('clicked' => sub { | ||
| 13755 | |||
| 13756 | # Refresh the simple list | ||
| 13757 | $self->sound5Tab_refreshList( | ||
| 13758 | $slWidget, | ||
| 13759 | scalar (@columnList / 2), | ||
| 13760 | 'ttsFlagAttribHash', | ||
| 13761 | ); | ||
| 13762 | }); | ||
| 13763 | |||
| 13764 | # Tab complete | ||
| 13765 | return 1; | ||
| 13766 | } | ||
| 13767 | |||
| 13768 | sub sound7Tab { | ||
| 13769 | |||
| 13770 | # Sound7 tab | ||
| 13771 | # | ||
| 13772 | # Expected arguments | ||
| 13773 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13774 | # | ||
| 13775 | # Return values | ||
| 13776 | # 'undef' on improper arguments | ||
| 13777 | # 1 otherwise | ||
| 13778 | |||
| 13779 | my ($self, $innerNotebook, $check) = @_; | ||
| 13780 | |||
| 13781 | # Local variables | ||
| 13782 | my @columnList; | ||
| 13783 | |||
| 13784 | # Check for improper arguments | ||
| 13785 | if (! defined $innerNotebook || defined $check) { | ||
| 13786 | |||
| 13787 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sound7Tab', @_); | ||
| 13788 | } | ||
| 13789 | |||
| 13790 | # Tab setup | ||
| 13791 | my $grid = $self->addTab( | ||
| 13792 | $innerNotebook, | ||
| 13793 | 'Page _7', | ||
| 13794 | ['Text-to-speech alert attributes'], | ||
| 13795 | ); | ||
| 13796 | |||
| 13797 | # Text-to-speech alert attributes | ||
| 13798 | $self->addLabel($grid, '<b>Text-to-speech alert attributes</b>', | ||
| 13799 | 0, 12, 0, 1); | ||
| 13800 | $self->addLabel( | ||
| 13801 | $grid, | ||
| 13802 | '<i>Attributes used with the \';alert\' and \';permalert\' commands</i>', | ||
| 13803 | 1, 12, 1, 2); | ||
| 13804 | |||
| 13805 | # Add a simple list | ||
| 13806 | @columnList = ( | ||
| 13807 | 'Attribute', 'text', | ||
| 13808 | 'Assigned to task', 'text', | ||
| 13809 | 'Built-in task', 'bool', | ||
| 13810 | '', 'text', # Dummy to keep the to the left | ||
| 13811 | ); | ||
| 13812 | |||
| 13813 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 13814 | 1, 12, 2, 10); | ||
| 13815 | |||
| 13816 | # Initialise the list | ||
| 13817 | $self->sound5Tab_refreshList($slWidget, scalar (@columnList / 2), 'ttsAlertAttribHash'); | ||
| 13818 | |||
| 13819 | # Add buttons | ||
| 13820 | my $button = $self->addButton($grid, | ||
| 13821 | 'Refresh list', 'Refresh the list of assigned attributes', undef, | ||
| 13822 | 10, 12, 10, 11); | ||
| 13823 | $button->signal_connect('clicked' => sub { | ||
| 13824 | |||
| 13825 | # Refresh the simple list | ||
| 13826 | $self->sound5Tab_refreshList( | ||
| 13827 | $slWidget, | ||
| 13828 | scalar (@columnList / 2), | ||
| 13829 | 'ttsAlertAttribHash', | ||
| 13830 | ); | ||
| 13831 | }); | ||
| 13832 | |||
| 13833 | # Tab complete | ||
| 13834 | return 1; | ||
| 13835 | } | ||
| 13836 | |||
| 13837 | sub tasksTab { | ||
| 13838 | |||
| 13839 | # Tasks tab - called by $self->setupNotebook | ||
| 13840 | # | ||
| 13841 | # Expected arguments | ||
| 13842 | # (none besides $self) | ||
| 13843 | # | ||
| 13844 | # Return values | ||
| 13845 | # 'undef' on improper arguments | ||
| 13846 | # 1 otherwise | ||
| 13847 | |||
| 13848 | my ($self, $check) = @_; | ||
| 13849 | |||
| 13850 | # Check for improper arguments | ||
| 13851 | if (defined $check) { | ||
| 13852 | |||
| 13853 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab', @_); | ||
| 13854 | } | ||
| 13855 | |||
| 13856 | # Tab setup | ||
| 13857 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 13858 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Tasks'); | ||
| 13859 | |||
| 13860 | # Add tabs to the inner notebook | ||
| 13861 | $self->tasks1Tab($innerNotebook, 'first'); | ||
| 13862 | $self->tasks1Tab($innerNotebook, 'last'); | ||
| 13863 | $self->tasks3Tab($innerNotebook); | ||
| 13864 | |||
| 13865 | return 1; | ||
| 13866 | } | ||
| 13867 | |||
| 13868 | sub tasks1Tab { | ||
| 13869 | |||
| 13870 | # Tasks1 tab | ||
| 13871 | # | ||
| 13872 | # Expected arguments | ||
| 13873 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 13874 | # $type - Which runlist is being edited - 'first' or 'last' | ||
| 13875 | # | ||
| 13876 | # Return values | ||
| 13877 | # 'undef' on improper arguments | ||
| 13878 | # 1 otherwise | ||
| 13879 | |||
| 13880 | my ($self, $innerNotebook, $type, $check) = @_; | ||
| 13881 | |||
| 13882 | # Local variables | ||
| 13883 | my (@columnList, @comboList); | ||
| 13884 | |||
| 13885 | # Check for improper arguments | ||
| 13886 | if (! defined $innerNotebook || ! defined $type || defined $check) { | ||
| 13887 | |||
| 13888 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks1Tab', @_); | ||
| 13889 | } | ||
| 13890 | |||
| 13891 | # Tab setup | ||
| 13892 | my $grid; | ||
| 13893 | |||
| 13894 | if ($type eq 'first') { | ||
| 13895 | |||
| 13896 | $grid = $self->addTab( | ||
| 13897 | $innerNotebook, | ||
| 13898 | 'Page _1', | ||
| 13899 | ['Task first runlist'], | ||
| 13900 | ); | ||
| 13901 | |||
| 13902 | } else { | ||
| 13903 | |||
| 13904 | $grid = $self->addTab( | ||
| 13905 | $innerNotebook, | ||
| 13906 | 'Page _2', | ||
| 13907 | ['Task last runlist'], | ||
| 13908 | ); | ||
| 13909 | } | ||
| 13910 | |||
| 13911 | # Task runlists | ||
| 13912 | if ($type eq 'first') { | ||
| 13913 | |||
| 13914 | $self->addLabel($grid, '<b>Task first runlist</b>', | ||
| 13915 | 0, 12, 0, 1); | ||
| 13916 | $self->addLabel($grid, | ||
| 13917 | '<i>List of tasks that are run first, before any others, in each task loop</i>', | ||
| 13918 | 1, 12, 1, 2); | ||
| 13919 | |||
| 13920 | } else { | ||
| 13921 | |||
| 13922 | $self->addLabel($grid, '<b>Task last runlist</b>', | ||
| 13923 | 0, 12, 0, 1); | ||
| 13924 | $self->addLabel($grid, | ||
| 13925 | '<i>List of tasks that are run last, after any others, in each task loop</i>', | ||
| 13926 | 1, 12, 1, 2); | ||
| 13927 | } | ||
| 13928 | |||
| 13929 | # Add a simple list | ||
| 13930 | @columnList = ( | ||
| 13931 | 'Task name', 'text', | ||
| 13932 | ); | ||
| 13933 | |||
| 13934 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 13935 | 1, 12, 2, 10); | ||
| 13936 | |||
| 13937 | # Unusual step - need to save the simple list, because $self->tasks1Tab_refreshList | ||
| 13938 | # updates both simple lists together. Because this is a 'pref' window, the lists are | ||
| 13939 | # stored in $self->editConfigHash | ||
| 13940 | if ($type eq 'first') { | ||
| 13941 | $self->ivAdd('editConfigHash', 'first_list', $slWidget); | ||
| 13942 | } else { | ||
| 13943 | $self->ivAdd('editConfigHash', 'last_list', $slWidget); | ||
| 13944 | } | ||
| 13945 | |||
| 13946 | # Initialise the simple list | ||
| 13947 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 13948 | |||
| 13949 | # Add buttons | ||
| 13950 | @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('taskPackageHash')); | ||
| 13951 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 13952 | TRUE, # No 'undef' value used | ||
| 13953 | 1, 3, 10, 11); | ||
| 13954 | |||
| 13955 | my $button = $self->addButton($grid, 'Add', 'Add the selected task to the runlist', undef, | ||
| 13956 | 3, 5, 10, 11); | ||
| 13957 | $button->signal_connect('clicked' => sub { | ||
| 13958 | |||
| 13959 | my ( | ||
| 13960 | $task, $match, | ||
| 13961 | @newList, | ||
| 13962 | ); | ||
| 13963 | |||
| 13964 | $task = $combo->get_active_text(); | ||
| 13965 | |||
| 13966 | # Import the existing runlist | ||
| 13967 | if ($type eq 'first') { | ||
| 13968 | @newList = $axmud::CLIENT->taskRunFirstList; | ||
| 13969 | } else { | ||
| 13970 | @newList = $axmud::CLIENT->taskRunLastList; | ||
| 13971 | } | ||
| 13972 | |||
| 13973 | # Check the task isn't already on the list | ||
| 13974 | OUTER: foreach my $item (@newList) { | ||
| 13975 | |||
| 13976 | if ($item eq $task) { | ||
| 13977 | |||
| 13978 | $match = $item; | ||
| 13979 | last OUTER; | ||
| 13980 | } | ||
| 13981 | } | ||
| 13982 | |||
| 13983 | if (! $match) { | ||
| 13984 | |||
| 13985 | # Task isn't already on the list, so put it there | ||
| 13986 | push (@newList, $task); | ||
| 13987 | } | ||
| 13988 | |||
| 13989 | # Update the runlist | ||
| 13990 | if ($type eq 'first') { | ||
| 13991 | |||
| 13992 | $self->session->pseudoCmd( | ||
| 13993 | 'setrunlist -f ' . join(' ', @newList), | ||
| 13994 | $self->pseudoCmdMode, | ||
| 13995 | ); | ||
| 13996 | |||
| 13997 | } else { | ||
| 13998 | |||
| 13999 | $self->session->pseudoCmd( | ||
| 14000 | 'setrunlist -l ' . join(' ', @newList), | ||
| 14001 | $self->pseudoCmdMode, | ||
| 14002 | ); | ||
| 14003 | } | ||
| 14004 | |||
| 14005 | # Refresh the simple list | ||
| 14006 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14007 | }); | ||
| 14008 | |||
| 14009 | my $button2 = $self->addButton($grid, | ||
| 14010 | 'Delete', 'Delete the selected task from the runlist', undef, | ||
| 14011 | 5, 7, 10, 11); | ||
| 14012 | $button2->signal_connect('clicked' => sub { | ||
| 14013 | |||
| 14014 | my ( | ||
| 14015 | $task, | ||
| 14016 | @newList, @reducedList, | ||
| 14017 | ); | ||
| 14018 | |||
| 14019 | ($task) = $self->getSimpleListData($slWidget, 0); | ||
| 14020 | |||
| 14021 | # Import the existing runlist | ||
| 14022 | if ($type eq 'first') { | ||
| 14023 | @newList = $axmud::CLIENT->taskRunFirstList; | ||
| 14024 | } else { | ||
| 14025 | @newList = $axmud::CLIENT->taskRunLastList; | ||
| 14026 | } | ||
| 14027 | |||
| 14028 | # Remove the selected task from the list (if it is present) | ||
| 14029 | foreach my $item (@newList) { | ||
| 14030 | |||
| 14031 | if ($item ne $task) { | ||
| 14032 | |||
| 14033 | push (@reducedList, $item); | ||
| 14034 | } | ||
| 14035 | } | ||
| 14036 | |||
| 14037 | # Update the runlist | ||
| 14038 | if ($type eq 'first') { | ||
| 14039 | |||
| 14040 | $self->session->pseudoCmd( | ||
| 14041 | 'setrunlist -f ' . join(' ', @reducedList), | ||
| 14042 | $self->pseudoCmdMode, | ||
| 14043 | ); | ||
| 14044 | |||
| 14045 | } else { | ||
| 14046 | |||
| 14047 | $self->session->pseudoCmd( | ||
| 14048 | 'setrunlist -l ' . join(' ', @reducedList), | ||
| 14049 | $self->pseudoCmdMode, | ||
| 14050 | ); | ||
| 14051 | } | ||
| 14052 | |||
| 14053 | # Refresh the simple list | ||
| 14054 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14055 | }); | ||
| 14056 | |||
| 14057 | my $button3 = $self->addButton($grid, | ||
| 14058 | 'Use default list', 'Use the default first and last runlists', undef, | ||
| 14059 | 7, 10, 10, 11); | ||
| 14060 | $button3->signal_connect('clicked' => sub { | ||
| 14061 | |||
| 14062 | # Set the default runlists | ||
| 14063 | $self->session->pseudoCmd('setrunlist -d', $self->pseudoCmdMode); | ||
| 14064 | |||
| 14065 | # Refresh the simple list | ||
| 14066 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14067 | }); | ||
| 14068 | |||
| 14069 | my $button4 = $self->addButton($grid, | ||
| 14070 | 'Dump', 'Display both runlists in the \'main\' window', undef, | ||
| 14071 | 10, 12, 10, 11); | ||
| 14072 | $button4->signal_connect('clicked' => sub { | ||
| 14073 | |||
| 14074 | # Display runlists | ||
| 14075 | $self->session->pseudoCmd('setrunlist', $self->pseudoCmdMode); | ||
| 14076 | |||
| 14077 | # Refresh the simple list | ||
| 14078 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14079 | }); | ||
| 14080 | |||
| 14081 | |||
| 14082 | my $button5 = $self->addButton($grid, | ||
| 14083 | 'Move up', 'Move the selected task up the runlist', undef, | ||
| 14084 | 1, 3, 11, 12); | ||
| 14085 | $button5->signal_connect('clicked' => sub { | ||
| 14086 | |||
| 14087 | my ( | ||
| 14088 | $task, $match, $count, | ||
| 14089 | @newList, @modList, | ||
| 14090 | ); | ||
| 14091 | |||
| 14092 | ($task) = $self->getSimpleListData($slWidget, 0); | ||
| 14093 | if ($task) { | ||
| 14094 | |||
| 14095 | # Import the existing runlist | ||
| 14096 | if ($type eq 'first') { | ||
| 14097 | @newList = $axmud::CLIENT->taskRunFirstList; | ||
| 14098 | } else { | ||
| 14099 | @newList = $axmud::CLIENT->taskRunLastList; | ||
| 14100 | } | ||
| 14101 | |||
| 14102 | # Remove the selected task from the list | ||
| 14103 | $count = -1; | ||
| 14104 | foreach my $item (@newList) { | ||
| 14105 | |||
| 14106 | $count++; | ||
| 14107 | |||
| 14108 | if ($item ne $task || $count == 0) { | ||
| 14109 | |||
| 14110 | push (@modList, $item); | ||
| 14111 | |||
| 14112 | } else { | ||
| 14113 | |||
| 14114 | $match = $count; | ||
| 14115 | } | ||
| 14116 | } | ||
| 14117 | |||
| 14118 | if (defined $match) { | ||
| 14119 | |||
| 14120 | # A task was removed. Replace it one place higher | ||
| 14121 | $match--; | ||
| 14122 | splice (@modList, $match, 0, $task); | ||
| 14123 | } | ||
| 14124 | |||
| 14125 | # Update the runlist | ||
| 14126 | if ($type eq 'first') { | ||
| 14127 | |||
| 14128 | $self->session->pseudoCmd( | ||
| 14129 | 'setrunlist -f ' . join(' ', @modList), | ||
| 14130 | $self->pseudoCmdMode, | ||
| 14131 | ); | ||
| 14132 | |||
| 14133 | } else { | ||
| 14134 | |||
| 14135 | $self->session->pseudoCmd( | ||
| 14136 | 'setrunlist -l ' . join(' ', @modList), | ||
| 14137 | $self->pseudoCmdMode, | ||
| 14138 | ); | ||
| 14139 | } | ||
| 14140 | } | ||
| 14141 | |||
| 14142 | # Refresh the simple list and select the same line | ||
| 14143 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14144 | if (defined $match) { | ||
| 14145 | |||
| 14146 | $slWidget->select($match); | ||
| 14147 | } | ||
| 14148 | }); | ||
| 14149 | |||
| 14150 | my $button6 = $self->addButton($grid, | ||
| 14151 | 'Move down', 'Move the selected task up the runlist', undef, | ||
| 14152 | 10, 12, 11, 12); | ||
| 14153 | $button6->signal_connect('clicked' => sub { | ||
| 14154 | |||
| 14155 | my ( | ||
| 14156 | $task, $match, $count, | ||
| 14157 | @newList, @modList, | ||
| 14158 | ); | ||
| 14159 | |||
| 14160 | ($task) = $self->getSimpleListData($slWidget, 0); | ||
| 14161 | if ($task) { | ||
| 14162 | |||
| 14163 | # Import the existing runlist | ||
| 14164 | if ($type eq 'first') { | ||
| 14165 | @newList = $axmud::CLIENT->taskRunFirstList; | ||
| 14166 | } else { | ||
| 14167 | @newList = $axmud::CLIENT->taskRunLastList; | ||
| 14168 | } | ||
| 14169 | |||
| 14170 | # Remove the selected task from the list | ||
| 14171 | $count = -1; | ||
| 14172 | foreach my $item (@newList) { | ||
| 14173 | |||
| 14174 | $count++; | ||
| 14175 | |||
| 14176 | if ($item ne $task || $count == (scalar (@newList) - 1)) { | ||
| 14177 | |||
| 14178 | push (@modList, $item); | ||
| 14179 | |||
| 14180 | } else { | ||
| 14181 | |||
| 14182 | $match = $count; | ||
| 14183 | } | ||
| 14184 | } | ||
| 14185 | |||
| 14186 | if (defined $match) { | ||
| 14187 | |||
| 14188 | # A task was removed. Replace it one place lower | ||
| 14189 | $match++; | ||
| 14190 | splice (@modList, $match, 0, $task); | ||
| 14191 | } | ||
| 14192 | |||
| 14193 | # Update the runlist | ||
| 14194 | if ($type eq 'first') { | ||
| 14195 | |||
| 14196 | $self->session->pseudoCmd( | ||
| 14197 | 'setrunlist -f ' . join(' ', @modList), | ||
| 14198 | $self->pseudoCmdMode, | ||
| 14199 | ); | ||
| 14200 | |||
| 14201 | } else { | ||
| 14202 | |||
| 14203 | $self->session->pseudoCmd( | ||
| 14204 | 'setrunlist -l ' . join(' ', @modList), | ||
| 14205 | $self->pseudoCmdMode, | ||
| 14206 | ); | ||
| 14207 | } | ||
| 14208 | } | ||
| 14209 | |||
| 14210 | # Refresh the simple list and select the same line | ||
| 14211 | $self->tasks1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14212 | if (defined $match) { | ||
| 14213 | |||
| 14214 | $slWidget->select($match); | ||
| 14215 | } | ||
| 14216 | }); | ||
| 14217 | |||
| 14218 | # Tab complete | ||
| 14219 | return 1; | ||
| 14220 | } | ||
| 14221 | |||
| 14222 | sub tasks1Tab_refreshList { | ||
| 14223 | |||
| 14224 | # Called by $self->tasks1Tab to refresh the GA::Obj::SimpleLists | ||
| 14225 | # | ||
| 14226 | # Expected arguments | ||
| 14227 | # $slWidget - The GA::Obj::SimpleList (not used here) | ||
| 14228 | # $columns - The number of columns in the list | ||
| 14229 | # | ||
| 14230 | # Return values | ||
| 14231 | # 'undef' on improper arguments | ||
| 14232 | # 1 otherwise | ||
| 14233 | |||
| 14234 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 14235 | |||
| 14236 | # Local variables | ||
| 14237 | my ( | ||
| 14238 | $thisSimpleList, | ||
| 14239 | @firstList, @lastList, | ||
| 14240 | ); | ||
| 14241 | |||
| 14242 | # Check for improper arguments | ||
| 14243 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 14244 | |||
| 14245 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks1Tab_refreshList', @_); | ||
| 14246 | } | ||
| 14247 | |||
| 14248 | # $self->tasks1Tab is used for two tabs; refresh the simple list in both | ||
| 14249 | $thisSimpleList = $self->ivShow('editConfigHash', 'first_list'); | ||
| 14250 | @firstList = $axmud::CLIENT->taskRunFirstList; | ||
| 14251 | |||
| 14252 | $self->resetListData($thisSimpleList, [@firstList], $columns); | ||
| 14253 | |||
| 14254 | # (The second simple list may not have been created yet) | ||
| 14255 | if ($self->ivExists('editConfigHash', 'last_list')) { | ||
| 14256 | |||
| 14257 | $thisSimpleList = $self->ivShow('editConfigHash', 'last_list'); | ||
| 14258 | @lastList = $axmud::CLIENT->taskRunLastList; | ||
| 14259 | |||
| 14260 | $self->resetListData($thisSimpleList, [@lastList], $columns); | ||
| 14261 | } | ||
| 14262 | |||
| 14263 | return 1; | ||
| 14264 | } | ||
| 14265 | |||
| 14266 | sub tasks3Tab { | ||
| 14267 | |||
| 14268 | # Tasks3 tab | ||
| 14269 | # | ||
| 14270 | # Expected arguments | ||
| 14271 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 14272 | # | ||
| 14273 | # Return values | ||
| 14274 | # 'undef' on improper arguments | ||
| 14275 | # 1 otherwise | ||
| 14276 | |||
| 14277 | my ($self, $innerNotebook, $check) = @_; | ||
| 14278 | |||
| 14279 | # Check for improper arguments | ||
| 14280 | if (! defined $innerNotebook || defined $check) { | ||
| 14281 | |||
| 14282 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasks3Tab', @_); | ||
| 14283 | } | ||
| 14284 | |||
| 14285 | # Tab setup | ||
| 14286 | my $grid = $self->addTab( | ||
| 14287 | $innerNotebook, | ||
| 14288 | 'Page _3', | ||
| 14289 | ['Commify mode'], | ||
| 14290 | ); | ||
| 14291 | |||
| 14292 | # Commify mode | ||
| 14293 | $self->addLabel($grid, '<b>Commify mode</b>', | ||
| 14294 | 0, 12, 0, 1); | ||
| 14295 | $self->addLabel( | ||
| 14296 | $grid, | ||
| 14297 | '<i>How long numbers are made more readable (mostly used by the Status task, but' | ||
| 14298 | . ' available to plugins/scripts)</i>', | ||
| 14299 | 1, 12, 1, 2); | ||
| 14300 | |||
| 14301 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 14302 | $grid, undef, 'Add commas, e.g. 1,000,000', undef, | ||
| 14303 | undef, # IV set to this value when toggled | ||
| 14304 | TRUE, # Sensitive widget | ||
| 14305 | 1, 12, 2, 3); | ||
| 14306 | if ($axmud::CLIENT->commifyMode eq 'comma') { | ||
| 14307 | |||
| 14308 | $radioButton->set_active(TRUE); | ||
| 14309 | } | ||
| 14310 | $radioButton->signal_connect('toggled' => sub { | ||
| 14311 | |||
| 14312 | if ($radioButton->get_active()) { | ||
| 14313 | |||
| 14314 | $axmud::CLIENT->set_commifyMode('comma'); | ||
| 14315 | } | ||
| 14316 | }); | ||
| 14317 | |||
| 14318 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 14319 | $grid, $group, 'Add full stops/periods, e.g. 1.000.000', undef, undef, TRUE, | ||
| 14320 | 1, 12, 3, 4); | ||
| 14321 | if ($axmud::CLIENT->commifyMode eq 'europe') { | ||
| 14322 | |||
| 14323 | $radioButton2->set_active(TRUE); | ||
| 14324 | } | ||
| 14325 | $radioButton2->signal_connect('toggled' => sub { | ||
| 14326 | |||
| 14327 | if ($radioButton2->get_active()) { | ||
| 14328 | |||
| 14329 | $axmud::CLIENT->set_commifyMode('europe'); | ||
| 14330 | } | ||
| 14331 | }); | ||
| 14332 | |||
| 14333 | my ($group3, $radioButton3) = $self->addRadioButton( | ||
| 14334 | $grid, $group, 'Add spaces, e.g. 1 000 000', undef, undef, TRUE, | ||
| 14335 | 1, 12, 4, 5); | ||
| 14336 | if ($axmud::CLIENT->commifyMode eq 'brit') { | ||
| 14337 | |||
| 14338 | $radioButton3->set_active(TRUE); | ||
| 14339 | } | ||
| 14340 | $radioButton3->signal_connect('toggled' => sub { | ||
| 14341 | |||
| 14342 | if ($radioButton3->get_active()) { | ||
| 14343 | |||
| 14344 | $axmud::CLIENT->set_commifyMode('brit'); | ||
| 14345 | } | ||
| 14346 | }); | ||
| 14347 | |||
| 14348 | my ($group4, $radioButton4) = $self->addRadioButton( | ||
| 14349 | $grid, $group, 'Add underlines/undescores, e.g. 1_000_000', undef, undef, TRUE, | ||
| 14350 | 1, 12, 5, 6); | ||
| 14351 | if ($axmud::CLIENT->commifyMode eq 'underline') { | ||
| 14352 | |||
| 14353 | $radioButton4->set_active(TRUE); | ||
| 14354 | } | ||
| 14355 | $radioButton4->signal_connect('toggled' => sub { | ||
| 14356 | |||
| 14357 | if ($radioButton4->get_active()) { | ||
| 14358 | |||
| 14359 | $axmud::CLIENT->set_commifyMode('underline'); | ||
| 14360 | } | ||
| 14361 | }); | ||
| 14362 | |||
| 14363 | my ($group5, $radioButton5) = $self->addRadioButton( | ||
| 14364 | $grid, $group, 'Don\'t commify large numbers', undef, undef, TRUE, | ||
| 14365 | 1, 12, 6, 7); | ||
| 14366 | if ($axmud::CLIENT->commifyMode eq 'none') { | ||
| 14367 | |||
| 14368 | $radioButton5->set_active(TRUE); | ||
| 14369 | } | ||
| 14370 | $radioButton5->signal_connect('toggled' => sub { | ||
| 14371 | |||
| 14372 | if ($radioButton5->get_active()) { | ||
| 14373 | |||
| 14374 | $axmud::CLIENT->set_commifyMode('none'); | ||
| 14375 | } | ||
| 14376 | }); | ||
| 14377 | |||
| 14378 | # Tab complete | ||
| 14379 | return 1; | ||
| 14380 | } | ||
| 14381 | |||
| 14382 | sub scriptsTab { | ||
| 14383 | |||
| 14384 | # Scripts tab | ||
| 14385 | # | ||
| 14386 | # Expected arguments | ||
| 14387 | # (none besides $self) | ||
| 14388 | # | ||
| 14389 | # Return values | ||
| 14390 | # 'undef' on improper arguments | ||
| 14391 | # 1 otherwise | ||
| 14392 | |||
| 14393 | my ($self, $check) = @_; | ||
| 14394 | |||
| 14395 | # Local variables | ||
| 14396 | my ( | ||
| 14397 | @columnList, @initList, @comboList, | ||
| 14398 | %comboHash, | ||
| 14399 | ); | ||
| 14400 | |||
| 14401 | # Check for improper arguments | ||
| 14402 | if (defined $check) { | ||
| 14403 | |||
| 14404 | return $axmud::CLIENT->writeImproper($self->_objClass . '->scriptsTab', @_); | ||
| 14405 | } | ||
| 14406 | |||
| 14407 | # Tab setup | ||
| 14408 | my $grid = $self->addTab( | ||
| 14409 | $self->notebook, | ||
| 14410 | 'Sc_ripts', | ||
| 14411 | ['Initial scripts'], | ||
| 14412 | ); | ||
| 14413 | |||
| 14414 | # Initial tasks | ||
| 14415 | $self->addLabel($grid, '<b>Initial scripts</b>', | ||
| 14416 | 0, 13, 0, 1); | ||
| 14417 | $self->addLabel($grid, | ||
| 14418 | '<i>List of initial scripts that start with every new session (after the character' | ||
| 14419 | . ' logs in)</i>', | ||
| 14420 | 1, 13, 1, 2); | ||
| 14421 | |||
| 14422 | # Add a simple list | ||
| 14423 | @columnList = ( | ||
| 14424 | 'Script' => 'text', | ||
| 14425 | 'Run mode' => 'text', | ||
| 14426 | ); | ||
| 14427 | |||
| 14428 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 14429 | 1, 13, 2, 10); | ||
| 14430 | |||
| 14431 | # Initialise the list | ||
| 14432 | $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 14433 | |||
| 14434 | # Add editing entry boxes/buttons | ||
| 14435 | $self->addLabel($grid, 'Script name', | ||
| 14436 | 1, 3, 10, 11); | ||
| 14437 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 14438 | 3, 7, 10, 11); | ||
| 14439 | |||
| 14440 | @initList = ( | ||
| 14441 | 'no_task' => 'Run without a task', | ||
| 14442 | 'run_task' => 'Run from within a task', | ||
| 14443 | 'run_task_win' => 'Run in \'forced window\' mode', | ||
| 14444 | ); | ||
| 14445 | |||
| 14446 | do { | ||
| 14447 | |||
| 14448 | my ($value, $string, $descrip); | ||
| 14449 | |||
| 14450 | $value = shift @initList; | ||
| 14451 | $string = shift @initList; | ||
| 14452 | $descrip = 'Mode \'' . $value . '\' - ' . $string; | ||
| 14453 | |||
| 14454 | push (@comboList, $descrip); | ||
| 14455 | $comboHash{$descrip} = $value; | ||
| 14456 | |||
| 14457 | } until (! @initList); | ||
| 14458 | |||
| 14459 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 14460 | TRUE, # No 'undef' value used | ||
| 14461 | 7, 13, 10, 11); | ||
| 14462 | |||
| 14463 | my $button = $self->addButton( | ||
| 14464 | $grid, | ||
| 14465 | 'Add', | ||
| 14466 | 'Add this script to the global list of initial scripts', | ||
| 14467 | undef, | ||
| 14468 | 1, 3, 11, 12, | ||
| 14469 | ); | ||
| 14470 | $button->signal_connect('clicked' => sub { | ||
| 14471 | |||
| 14472 | my ($scriptName, $descrip, $mode, $switch); | ||
| 14473 | |||
| 14474 | if ($self->checkEntryIcon($entry)) { | ||
| 14475 | |||
| 14476 | $scriptName = $entry->get_text(); | ||
| 14477 | $descrip = $combo->get_active_text(); | ||
| 14478 | $mode = $comboHash{$descrip}; | ||
| 14479 | |||
| 14480 | if ($mode eq 'no_task') { | ||
| 14481 | $switch = '-r'; | ||
| 14482 | } elsif ($mode eq 'run_task') { | ||
| 14483 | $switch = '-t'; | ||
| 14484 | } else { | ||
| 14485 | $switch = '-c'; | ||
| 14486 | } | ||
| 14487 | |||
| 14488 | $self->session->pseudoCmd( | ||
| 14489 | 'addinitialscript ' . $scriptName . ' ' . $switch, | ||
| 14490 | $self->pseudoCmdMode, | ||
| 14491 | ); | ||
| 14492 | |||
| 14493 | # Reset the simple list and reset the entry box | ||
| 14494 | $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 14495 | $self->resetEntryBoxes($entry); | ||
| 14496 | } | ||
| 14497 | }); | ||
| 14498 | |||
| 14499 | my $button2 = $self->addButton( | ||
| 14500 | $grid, | ||
| 14501 | 'Delete', | ||
| 14502 | 'Delete the selected script', | ||
| 14503 | undef, | ||
| 14504 | 3, 5, 11, 12); | ||
| 14505 | $button2->signal_connect('clicked' => sub { | ||
| 14506 | |||
| 14507 | my ($name) = $self->getSimpleListData($slWidget, 0); | ||
| 14508 | if (defined $name) { | ||
| 14509 | |||
| 14510 | $self->session->pseudoCmd( | ||
| 14511 | 'deleteinitialscript ' . $name, | ||
| 14512 | $self->pseudoCmdMode, | ||
| 14513 | ); | ||
| 14514 | |||
| 14515 | # Reset the simple list and reset the entry box | ||
| 14516 | $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 14517 | $self->resetEntryBoxes($entry); | ||
| 14518 | } | ||
| 14519 | }); | ||
| 14520 | |||
| 14521 | my $button3 = $self->addButton($grid, | ||
| 14522 | 'Move up', 'Move the selected script up the list', undef, | ||
| 14523 | 5, 7, 11, 12); | ||
| 14524 | $button3->signal_connect('clicked' => sub { | ||
| 14525 | |||
| 14526 | my ( | ||
| 14527 | $script, $match, $count, | ||
| 14528 | @orderList, @modList, | ||
| 14529 | ); | ||
| 14530 | |||
| 14531 | ($script) = $self->getSimpleListData($slWidget, 0); | ||
| 14532 | if (defined $script) { | ||
| 14533 | |||
| 14534 | # Import the existing order list | ||
| 14535 | @orderList = $axmud::CLIENT->initScriptOrderList; | ||
| 14536 | |||
| 14537 | # Remove the selected script from the list | ||
| 14538 | $count = -1; | ||
| 14539 | foreach my $item (@orderList) { | ||
| 14540 | |||
| 14541 | $count++; | ||
| 14542 | |||
| 14543 | if ($item ne $script || $count == 0) { | ||
| 14544 | |||
| 14545 | push (@modList, $item); | ||
| 14546 | |||
| 14547 | } else { | ||
| 14548 | |||
| 14549 | $match = $count; | ||
| 14550 | } | ||
| 14551 | } | ||
| 14552 | |||
| 14553 | if (defined $match) { | ||
| 14554 | |||
| 14555 | # A script was removed. Replace it one place higher | ||
| 14556 | $match--; | ||
| 14557 | splice (@modList, $match, 0, $script); | ||
| 14558 | } | ||
| 14559 | |||
| 14560 | # Update the list | ||
| 14561 | $axmud::CLIENT->set_initScriptOrderList(@modList); | ||
| 14562 | |||
| 14563 | # Refresh the simple list and select the same line | ||
| 14564 | $self->scriptsTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14565 | if (defined $match) { | ||
| 14566 | |||
| 14567 | $slWidget->select($match); | ||
| 14568 | } | ||
| 14569 | } | ||
| 14570 | }); | ||
| 14571 | |||
| 14572 | my $button4 = $self->addButton($grid, | ||
| 14573 | 'Move down', 'Move the selected script down the list', undef, | ||
| 14574 | 7, 9, 11, 12); | ||
| 14575 | $button4->signal_connect('clicked' => sub { | ||
| 14576 | |||
| 14577 | my ( | ||
| 14578 | $script, $match, $count, | ||
| 14579 | @orderList, @modList, | ||
| 14580 | ); | ||
| 14581 | |||
| 14582 | ($script) = $self->getSimpleListData($slWidget, 0); | ||
| 14583 | if (defined $script) { | ||
| 14584 | |||
| 14585 | # Import the existing order list | ||
| 14586 | @orderList = $axmud::CLIENT->initScriptOrderList; | ||
| 14587 | |||
| 14588 | # Remove the selected script from the list | ||
| 14589 | $count = -1; | ||
| 14590 | foreach my $item (@orderList) { | ||
| 14591 | |||
| 14592 | $count++; | ||
| 14593 | |||
| 14594 | if ($item ne $script || $count == (scalar (@orderList) - 1)) { | ||
| 14595 | |||
| 14596 | push (@modList, $item); | ||
| 14597 | |||
| 14598 | } else { | ||
| 14599 | |||
| 14600 | $match = $count; | ||
| 14601 | } | ||
| 14602 | } | ||
| 14603 | |||
| 14604 | if (defined $match) { | ||
| 14605 | |||
| 14606 | # A script was removed. Replace it one place lower | ||
| 14607 | $match++; | ||
| 14608 | splice (@modList, $match, 0, $script); | ||
| 14609 | } | ||
| 14610 | |||
| 14611 | # Update the list | ||
| 14612 | $axmud::CLIENT->set_initScriptOrderList(@modList); | ||
| 14613 | |||
| 14614 | # Refresh the simple list and select the same line | ||
| 14615 | $self->scriptsTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 14616 | if (defined $match) { | ||
| 14617 | |||
| 14618 | $slWidget->select($match); | ||
| 14619 | } | ||
| 14620 | } | ||
| 14621 | }); | ||
| 14622 | |||
| 14623 | my $button5 = $self->addButton( | ||
| 14624 | $grid, | ||
| 14625 | 'Dump', | ||
| 14626 | 'Display this profile\'s list of initial tasks in the \'main\' window', | ||
| 14627 | undef, | ||
| 14628 | 9, 11, 11, 12, | ||
| 14629 | ); | ||
| 14630 | $button5->signal_connect('clicked' => sub { | ||
| 14631 | |||
| 14632 | # Display initial scripts | ||
| 14633 | $self->session->pseudoCmd('listinitialscript', $self->pseudoCmdMode); | ||
| 14634 | |||
| 14635 | # Reset the simple list | ||
| 14636 | $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 14637 | }); | ||
| 14638 | |||
| 14639 | my $button6 = $self->addButton( | ||
| 14640 | $grid, | ||
| 14641 | 'Refresh list', | ||
| 14642 | 'Refresh the list of initial scripts', | ||
| 14643 | undef, | ||
| 14644 | 11, 13, 11, 12, | ||
| 14645 | ); | ||
| 14646 | $button6->signal_connect('clicked' => sub { | ||
| 14647 | |||
| 14648 | # Reset the simple list | ||
| 14649 | $self->scriptsTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 14650 | }); | ||
| 14651 | |||
| 14652 | # Tab complete | ||
| 14653 | return 1; | ||
| 14654 | } | ||
| 14655 | |||
| 14656 | sub scriptsTab_refreshList { | ||
| 14657 | |||
| 14658 | # Called by $self->scriptsTab to refresh the GA::Obj::SimpleList | ||
| 14659 | # | ||
| 14660 | # Expected arguments | ||
| 14661 | # $slWidget - The GA::Obj::SimpleList | ||
| 14662 | # $columns - Number of columns in the simple list | ||
| 14663 | # | ||
| 14664 | # Return values | ||
| 14665 | # 'undef' on improper arguments | ||
| 14666 | # 1 otherwise | ||
| 14667 | |||
| 14668 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 14669 | |||
| 14670 | # Local variables | ||
| 14671 | my @dataList; | ||
| 14672 | |||
| 14673 | # Check for improper arguments | ||
| 14674 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 14675 | |||
| 14676 | return $axmud::CLIENT->writeImproper( | ||
| 14677 | $self->_objClass . '->scriptsTab_refreshList', | ||
| 14678 | @_, | ||
| 14679 | ); | ||
| 14680 | } | ||
| 14681 | |||
| 14682 | # Compile the simple list data | ||
| 14683 | OUTER: foreach my $scriptName ($axmud::CLIENT->initScriptOrderList) { | ||
| 14684 | |||
| 14685 | push (@dataList, | ||
| 14686 | $scriptName, | ||
| 14687 | $axmud::CLIENT->ivShow('initScriptHash', $scriptName), | ||
| 14688 | ); | ||
| 14689 | } | ||
| 14690 | |||
| 14691 | # Reset the simple list | ||
| 14692 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 14693 | |||
| 14694 | return 1; | ||
| 14695 | } | ||
| 14696 | |||
| 14697 | sub chatTab { | ||
| 14698 | |||
| 14699 | # Chat tab - called by $self->setupNotebook | ||
| 14700 | # | ||
| 14701 | # Expected arguments | ||
| 14702 | # (none besides $self) | ||
| 14703 | # | ||
| 14704 | # Return values | ||
| 14705 | # 'undef' on improper arguments | ||
| 14706 | # 1 otherwise | ||
| 14707 | |||
| 14708 | my ($self, $check) = @_; | ||
| 14709 | |||
| 14710 | # Check for improper arguments | ||
| 14711 | if (defined $check) { | ||
| 14712 | |||
| 14713 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chatTab', @_); | ||
| 14714 | } | ||
| 14715 | |||
| 14716 | # Tab setup | ||
| 14717 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 14718 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'C_hat'); | ||
| 14719 | |||
| 14720 | # Add tabs to the inner notebook | ||
| 14721 | $self->chat1Tab($innerNotebook); | ||
| 14722 | $self->chat2Tab($innerNotebook); | ||
| 14723 | $self->chat3Tab($innerNotebook); | ||
| 14724 | $self->chat4Tab($innerNotebook); | ||
| 14725 | $self->chat5Tab($innerNotebook); | ||
| 14726 | |||
| 14727 | return 1; | ||
| 14728 | } | ||
| 14729 | |||
| 14730 | sub chat1Tab { | ||
| 14731 | |||
| 14732 | # Chat1 tab | ||
| 14733 | # | ||
| 14734 | # Expected arguments | ||
| 14735 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 14736 | # | ||
| 14737 | # Return values | ||
| 14738 | # 'undef' on improper arguments | ||
| 14739 | # 1 otherwise | ||
| 14740 | |||
| 14741 | my ($self, $innerNotebook, $check) = @_; | ||
| 14742 | |||
| 14743 | # Check for improper arguments | ||
| 14744 | if (! defined $innerNotebook || defined $check) { | ||
| 14745 | |||
| 14746 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat1Tab', @_); | ||
| 14747 | } | ||
| 14748 | |||
| 14749 | # Tab setup | ||
| 14750 | my $grid = $self->addTab( | ||
| 14751 | $innerNotebook, | ||
| 14752 | 'Page _1', | ||
| 14753 | ['Chat task actions (1/2)'], | ||
| 14754 | ); | ||
| 14755 | |||
| 14756 | # Chat task actions (1/2) | ||
| 14757 | $self->addLabel($grid, '<b>Chat task actions (1/2)</b>', | ||
| 14758 | 0, 12, 0, 1); | ||
| 14759 | |||
| 14760 | # Left column | ||
| 14761 | $self->addLabel($grid, '<i>Incoming calls</i>', | ||
| 14762 | 1, 6, 1, 2); | ||
| 14763 | |||
| 14764 | my $button = $self->addButton( | ||
| 14765 | $grid, | ||
| 14766 | 'Listen out for incoming calls', | ||
| 14767 | 'Listen out for incoming calls', | ||
| 14768 | undef, | ||
| 14769 | 1, 6, 2, 3); | ||
| 14770 | $button->signal_connect('clicked' => sub { | ||
| 14771 | |||
| 14772 | $self->session->pseudoCmd('chatlisten', $self->pseudoCmdMode); | ||
| 14773 | }); | ||
| 14774 | |||
| 14775 | my $button2 = $self->addButton( | ||
| 14776 | $grid, | ||
| 14777 | 'Stop listening for incoming calls', | ||
| 14778 | 'Stop listening for incoming calls', | ||
| 14779 | undef, | ||
| 14780 | 1, 6, 3, 4); | ||
| 14781 | $button2->signal_connect('clicked' => sub { | ||
| 14782 | |||
| 14783 | $self->session->pseudoCmd('chatignore', $self->pseudoCmdMode); | ||
| 14784 | }); | ||
| 14785 | |||
| 14786 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 14787 | $grid, undef, | ||
| 14788 | 'Auto-accept all incoming calls', | ||
| 14789 | undef, undef, TRUE, | ||
| 14790 | 1, 6, 4, 5); | ||
| 14791 | if ($axmud::CLIENT->chatAcceptMode eq 'accept_all') { | ||
| 14792 | |||
| 14793 | $radioButton->set_active(TRUE); | ||
| 14794 | } | ||
| 14795 | |||
| 14796 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 14797 | $grid, $group, | ||
| 14798 | 'Auto-accept calls from known contacts', | ||
| 14799 | undef, undef, TRUE, | ||
| 14800 | 1, 6, 5, 6); | ||
| 14801 | if ($axmud::CLIENT->chatAcceptMode eq 'accept_contact') { | ||
| 14802 | |||
| 14803 | $radioButton2->set_active(TRUE); | ||
| 14804 | } | ||
| 14805 | |||
| 14806 | my ($group3, $radioButton3) = $self->addRadioButton( | ||
| 14807 | $grid, $group, | ||
| 14808 | 'Ask before accepting incoming calls', | ||
| 14809 | undef, undef, TRUE, | ||
| 14810 | 1, 6, 6, 7); | ||
| 14811 | if ($axmud::CLIENT->chatAcceptMode eq 'prompt') { | ||
| 14812 | |||
| 14813 | $radioButton3->set_active(TRUE); | ||
| 14814 | } | ||
| 14815 | |||
| 14816 | $radioButton->signal_connect('toggled' => sub { | ||
| 14817 | |||
| 14818 | if ($radioButton->get_active()) { | ||
| 14819 | |||
| 14820 | $self->session->pseudoCmd('chatset -i', $self->pseudoCmdMode); | ||
| 14821 | } | ||
| 14822 | }); | ||
| 14823 | $radioButton2->signal_connect('toggled' => sub { | ||
| 14824 | |||
| 14825 | if ($radioButton2->get_active()) { | ||
| 14826 | |||
| 14827 | $self->session->pseudoCmd('chatset -c', $self->pseudoCmdMode); | ||
| 14828 | } | ||
| 14829 | }); | ||
| 14830 | $radioButton3->signal_connect('toggled' => sub { | ||
| 14831 | |||
| 14832 | if ($radioButton3->get_active()) { | ||
| 14833 | |||
| 14834 | $self->session->pseudoCmd('chatset -u', $self->pseudoCmdMode); | ||
| 14835 | } | ||
| 14836 | }); | ||
| 14837 | |||
| 14838 | # Right column | ||
| 14839 | $self->addLabel($grid, '<i>Outgoing calls (see also <b>Page 4</b>)</i>', | ||
| 14840 | 7, 13, 1, 2); | ||
| 14841 | |||
| 14842 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 3, 128, | ||
| 14843 | 7, 10, 2, 3); | ||
| 14844 | $self->addLabel($grid, 'IP address', | ||
| 14845 | 10, 12, 2, 3); | ||
| 14846 | |||
| 14847 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 65535, | ||
| 14848 | 7, 10, 3, 4); | ||
| 14849 | $entry2->set_text($axmud::CLIENT->constChatPort); | ||
| 14850 | $self->addLabel($grid, 'Port', | ||
| 14851 | 10, 12, 3, 4); | ||
| 14852 | |||
| 14853 | my $button4 = $self->addButton($grid, | ||
| 14854 | 'MudMaster call', 'Call using the MudMaster protocol', undef, | ||
| 14855 | 7, 9, 4, 5); | ||
| 14856 | $button4->signal_connect('clicked' => sub { | ||
| 14857 | |||
| 14858 | my ($ip, $port); | ||
| 14859 | |||
| 14860 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 14861 | |||
| 14862 | $ip = $entry->get_text(); | ||
| 14863 | $port = $entry2->get_text(); | ||
| 14864 | |||
| 14865 | $self->session->pseudoCmd( | ||
| 14866 | 'chatmcall ' . $ip . ' ' . $port, | ||
| 14867 | $self->pseudoCmdMode, | ||
| 14868 | ); | ||
| 14869 | } | ||
| 14870 | }); | ||
| 14871 | |||
| 14872 | my $button5 = $self->addButton($grid, 'zChat call', 'Call using the zChat protocol', undef, | ||
| 14873 | 9, 12, 4, 5); | ||
| 14874 | $button5->signal_connect('clicked' => sub { | ||
| 14875 | |||
| 14876 | my ($ip, $port); | ||
| 14877 | |||
| 14878 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 14879 | |||
| 14880 | $ip = $entry->get_text(); | ||
| 14881 | $port = $entry2->get_text(); | ||
| 14882 | |||
| 14883 | $self->session->pseudoCmd( | ||
| 14884 | 'chatzcall ' . $ip . ' ' . $port, | ||
| 14885 | $self->pseudoCmdMode, | ||
| 14886 | ); | ||
| 14887 | } | ||
| 14888 | }); | ||
| 14889 | |||
| 14890 | $self->addLabel($grid, '<i>Current calls</i>', | ||
| 14891 | 7, 12, 5, 6); | ||
| 14892 | my $button3 = $self->addButton($grid, | ||
| 14893 | 'Terminate all current chat sessions', 'Terminate all current chat sessions', undef, | ||
| 14894 | 7, 12, 6, 7); | ||
| 14895 | $button3->signal_connect('clicked' => sub { | ||
| 14896 | |||
| 14897 | $self->session->pseudoCmd('chathangup', $self->pseudoCmdMode); | ||
| 14898 | }); | ||
| 14899 | |||
| 14900 | # Tab complete | ||
| 14901 | return 1; | ||
| 14902 | } | ||
| 14903 | |||
| 14904 | sub chat2Tab { | ||
| 14905 | |||
| 14906 | # Chat2 tab | ||
| 14907 | # | ||
| 14908 | # Expected arguments | ||
| 14909 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 14910 | # | ||
| 14911 | # Return values | ||
| 14912 | # 'undef' on improper arguments | ||
| 14913 | # 1 otherwise | ||
| 14914 | |||
| 14915 | my ($self, $innerNotebook, $check) = @_; | ||
| 14916 | |||
| 14917 | # Local variables | ||
| 14918 | my ( | ||
| 14919 | $radioChoice, $switchString, | ||
| 14920 | @buttonList, @textButtonList, @noTextButtonList, | ||
| 14921 | ); | ||
| 14922 | |||
| 14923 | # Check for improper arguments | ||
| 14924 | if (! defined $innerNotebook || defined $check) { | ||
| 14925 | |||
| 14926 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat2Tab', @_); | ||
| 14927 | } | ||
| 14928 | |||
| 14929 | # Tab setup | ||
| 14930 | my $grid = $self->addTab( | ||
| 14931 | $innerNotebook, | ||
| 14932 | 'Page _2', | ||
| 14933 | ['Chat task actions (2/2)'], | ||
| 14934 | ); | ||
| 14935 | |||
| 14936 | # Chat task actions (2/2) | ||
| 14937 | $self->addLabel($grid, '<b>Chat task actions (2/2)</b>', | ||
| 14938 | 0, 12, 0, 1); | ||
| 14939 | |||
| 14940 | # Left column | ||
| 14941 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 14942 | $grid, undef, 'Apply to all sessions', undef, undef, TRUE, | ||
| 14943 | 1, 6, 1, 2); | ||
| 14944 | |||
| 14945 | my ($group2, $radioButton2) = $self->addRadioButton( | ||
| 14946 | $grid, $group, 'Apply to group:', undef, undef, TRUE, | ||
| 14947 | 1, 3, 2, 3); | ||
| 14948 | my $entry = $self->addEntryWithIcon($grid, | ||
| 14949 | undef, 'string', 1, 16, | ||
| 14950 | 3, 6, 2, 3); | ||
| 14951 | $entry->set_sensitive(FALSE); # Starts insensitive | ||
| 14952 | |||
| 14953 | my ($group3, $radioButton3) = $self->addRadioButton( | ||
| 14954 | $grid, $group, 'Apply to name:', undef, undef, TRUE, | ||
| 14955 | 1, 3, 3, 4); | ||
| 14956 | my $entry2 = $self->addEntryWithIcon($grid, | ||
| 14957 | undef, 'string', 1, 16, | ||
| 14958 | 3, 6, 3, 4); | ||
| 14959 | $entry2->set_sensitive(FALSE); # Starts insensitive | ||
| 14960 | |||
| 14961 | $radioChoice = 0; | ||
| 14962 | $switchString = ''; | ||
| 14963 | |||
| 14964 | my $button = $self->addButton($grid, | ||
| 14965 | 'Allow snooping', 'Allow the selected contacts to snoop you', undef, | ||
| 14966 | 1, 3, 6, 7); | ||
| 14967 | $button->signal_connect('clicked' => sub { | ||
| 14968 | |||
| 14969 | if (defined $switchString) { | ||
| 14970 | |||
| 14971 | $self->session->pseudoCmd('chatset -a' . $switchString, $self->pseudoCmdMode); | ||
| 14972 | } | ||
| 14973 | }); | ||
| 14974 | |||
| 14975 | my $button2 = $self->addButton($grid, | ||
| 14976 | 'Forbid snooping ', 'Forbid the selected contacts from snooping you', undef, | ||
| 14977 | 3, 6, 6, 7); | ||
| 14978 | $button2->signal_connect('clicked' => sub { | ||
| 14979 | |||
| 14980 | if (defined $switchString) { | ||
| 14981 | |||
| 14982 | $self->session->pseudoCmd('chatset -f' . $switchString, $self->pseudoCmdMode); | ||
| 14983 | } | ||
| 14984 | }); | ||
| 14985 | |||
| 14986 | my $button3 = $self->addButton($grid, | ||
| 14987 | 'Mark public', 'Mark the selected chat sessions as \'public\'', undef, | ||
| 14988 | 1, 3, 7, 8); | ||
| 14989 | $button3->signal_connect('clicked' => sub { | ||
| 14990 | |||
| 14991 | if (defined $switchString) { | ||
| 14992 | |||
| 14993 | $self->session->pseudoCmd('chatset -p' . $switchString, $self->pseudoCmdMode); | ||
| 14994 | } | ||
| 14995 | }); | ||
| 14996 | my $button4 = $self->addButton($grid, | ||
| 14997 | 'Mark private ', 'Mark the selected chat sessions as \'private\'', undef, | ||
| 14998 | 3, 6, 7, 8); | ||
| 14999 | $button4->signal_connect('clicked' => sub { | ||
| 15000 | |||
| 15001 | if (defined $switchString) { | ||
| 15002 | |||
| 15003 | $self->session->pseudoCmd('chatset -v' . $switchString, $self->pseudoCmdMode); | ||
| 15004 | } | ||
| 15005 | }); | ||
| 15006 | |||
| 15007 | my $button5 = $self->addButton($grid, | ||
| 15008 | 'Mark serving', 'Mark the selected chat sessions as \'serving\'', undef, | ||
| 15009 | 1, 3, 8, 9); | ||
| 15010 | $button5->signal_connect('clicked' => sub { | ||
| 15011 | |||
| 15012 | if (defined $switchString) { | ||
| 15013 | |||
| 15014 | $self->session->pseudoCmd('chatset -s' . $switchString, $self->pseudoCmdMode); | ||
| 15015 | } | ||
| 15016 | }); | ||
| 15017 | my $button6 = $self->addButton($grid, | ||
| 15018 | 'Mark not serving ', 'Mark the selected chat sessions as \'not serving\'', undef, | ||
| 15019 | 3, 6, 8, 9); | ||
| 15020 | $button6->signal_connect('clicked' => sub { | ||
| 15021 | |||
| 15022 | if (defined $switchString) { | ||
| 15023 | |||
| 15024 | $self->session->pseudoCmd('chatset -z' . $switchString, $self->pseudoCmdMode); | ||
| 15025 | } | ||
| 15026 | }); | ||
| 15027 | |||
| 15028 | # Right column | ||
| 15029 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 15030 | 7, 13, 1, 2); | ||
| 15031 | |||
| 15032 | my $button7 = $self->addButton($grid, 'Chat', 'Chat to the selected contacts', undef, | ||
| 15033 | 7, 10, 2, 3); | ||
| 15034 | $button7->signal_connect('clicked' => sub { | ||
| 15035 | |||
| 15036 | if ($radioButton->get_active()) { | ||
| 15037 | |||
| 15038 | # ;chatall <text> | ||
| 15039 | $self->session->pseudoCmd('chatall ' . $entry3->get_text(), $self->pseudoCmdMode); | ||
| 15040 | |||
| 15041 | } elsif ($self->checkEntryIcon($entry)) { | ||
| 15042 | |||
| 15043 | # ;chatgroup <group> <text> | ||
| 15044 | $self->session->pseudoCmd( | ||
| 15045 | 'chatgroup ' . $entry->get_text() . ' ' . $entry3->get_text(), | ||
| 15046 | $self->pseudoCmdMode, | ||
| 15047 | ); | ||
| 15048 | |||
| 15049 | } elsif ($self->checkEntryIcon($entry2)) { | ||
| 15050 | |||
| 15051 | # ;chat <name> <text> | ||
| 15052 | $self->session->pseudoCmd( | ||
| 15053 | 'chat ' . $entry2->get_text() . ' ' . $entry3->get_text(), | ||
| 15054 | $self->pseudoCmdMode, | ||
| 15055 | ); | ||
| 15056 | } | ||
| 15057 | }); | ||
| 15058 | my $button8 = $self->addButton($grid, 'Emote', 'Emote to the selected contacts', undef, | ||
| 15059 | 10, 13, 2, 3); | ||
| 15060 | $button8->signal_connect('clicked' => sub { | ||
| 15061 | |||
| 15062 | if ($radioButton->get_active()) { | ||
| 15063 | |||
| 15064 | # ;emoteall <text> | ||
| 15065 | $self->session->pseudoCmd('emoteall ' . $entry3->get_text(), $self->pseudoCmdMode); | ||
| 15066 | |||
| 15067 | } elsif ($self->checkEntryIcon($entry)) { | ||
| 15068 | |||
| 15069 | # ;emotegroup <group> <text> | ||
| 15070 | $self->session->pseudoCmd( | ||
| 15071 | 'emotegroup ' . $entry->get_text() . ' ' . $entry3->get_text(), | ||
| 15072 | $self->pseudoCmdMode, | ||
| 15073 | ); | ||
| 15074 | |||
| 15075 | } elsif ($self->checkEntryIcon($entry2)) { | ||
| 15076 | |||
| 15077 | # ;emote <name> <text> | ||
| 15078 | $self->session->pseudoCmd( | ||
| 15079 | 'emote ' . $entry2->get_text() . ' ' . $entry3->get_text(), | ||
| 15080 | $self->pseudoCmdMode, | ||
| 15081 | ); | ||
| 15082 | } | ||
| 15083 | }); | ||
| 15084 | |||
| 15085 | my $button9 = $self->addButton($grid, 'Ping', 'Ping the selected contacts', undef, | ||
| 15086 | 7, 10, 3, 4); | ||
| 15087 | $button9->signal_connect('clicked' => sub { | ||
| 15088 | |||
| 15089 | if (defined $switchString) { | ||
| 15090 | |||
| 15091 | $self->session->pseudoCmd('chatping' . $switchString, $self->pseudoCmdMode); | ||
| 15092 | } | ||
| 15093 | }); | ||
| 15094 | my $button10 = $self->addButton($grid, | ||
| 15095 | 'DND', 'Send \'Do not disturb\' message to selected contacts (MM only)', undef, | ||
| 15096 | 10, 13, 3, 4); | ||
| 15097 | $button10->signal_connect('clicked' => sub { | ||
| 15098 | |||
| 15099 | if (defined $switchString) { | ||
| 15100 | |||
| 15101 | $self->session->pseudoCmd('chatdnd' . $switchString, $self->pseudoCmdMode); | ||
| 15102 | } | ||
| 15103 | }); | ||
| 15104 | |||
| 15105 | my $button11 = $self->addButton($grid, | ||
| 15106 | 'Submit', 'Allow the selected contacts to send you remote commands', undef, | ||
| 15107 | 7, 9, 4, 5); | ||
| 15108 | $button11->signal_connect('clicked' => sub { | ||
| 15109 | |||
| 15110 | if (defined $switchString) { | ||
| 15111 | |||
| 15112 | $self->session->pseudoCmd('chatsubmit' . $switchString, $self->pseudoCmdMode); | ||
| 15113 | } | ||
| 15114 | }); | ||
| 15115 | my $button12 = $self->addButton($grid, | ||
| 15116 | 'Escape', 'Forbid the selected contacts from sending you remote commands', undef, | ||
| 15117 | 9, 11, 4, 5); | ||
| 15118 | $button12->signal_connect('clicked' => sub { | ||
| 15119 | |||
| 15120 | if (defined $switchString) { | ||
| 15121 | |||
| 15122 | $self->session->pseudoCmd('chatescape' . $switchString, $self->pseudoCmdMode); | ||
| 15123 | } | ||
| 15124 | }); | ||
| 15125 | my $button13 = $self->addButton($grid, | ||
| 15126 | 'Send cmd', 'Send a command to the selected contacts', undef, | ||
| 15127 | 11, 13, 4, 5); | ||
| 15128 | $button13->signal_connect('clicked' => sub { | ||
| 15129 | |||
| 15130 | if (defined $switchString) { | ||
| 15131 | |||
| 15132 | # ;chatcmd <switches> <text> | ||
| 15133 | $self->session->pseudoCmd( | ||
| 15134 | 'chatcommand' . $switchString . ' ' . $entry3->get_text(), | ||
| 15135 | $self->pseudoCmdMode, | ||
| 15136 | ); | ||
| 15137 | } | ||
| 15138 | }); | ||
| 15139 | |||
| 15140 | my $button14 = $self->addButton($grid, | ||
| 15141 | 'Send file', 'Sends a file to the selected contacts', undef, | ||
| 15142 | 7, 10, 5, 6); | ||
| 15143 | $button14->signal_connect('clicked' => sub { | ||
| 15144 | |||
| 15145 | if (defined $switchString) { | ||
| 15146 | |||
| 15147 | if ($self->checkEntryIcon($entry3)) { | ||
| 15148 | |||
| 15149 | # ;chatsendfile <switches> <file> | ||
| 15150 | $self->session->pseudoCmd( | ||
| 15151 | 'chatsendfile' . $switchString . ' ' . $entry3->get_text(), | ||
| 15152 | $self->pseudoCmdMode, | ||
| 15153 | ); | ||
| 15154 | |||
| 15155 | } else { | ||
| 15156 | |||
| 15157 | # ;chatsendfile <switches> | ||
| 15158 | $self->session->pseudoCmd('chatsendfile' . $switchString, $self->pseudoCmdMode); | ||
| 15159 | } | ||
| 15160 | } | ||
| 15161 | }); | ||
| 15162 | my $button15 = $self->addButton($grid, | ||
| 15163 | 'Stop file', | ||
| 15164 | 'Cancels any files transfers in progress with the selected contacts', | ||
| 15165 | undef, | ||
| 15166 | 10, 13, 5, 6); | ||
| 15167 | $button15->signal_connect('clicked' => sub { | ||
| 15168 | |||
| 15169 | if (defined $switchString) { | ||
| 15170 | |||
| 15171 | $self->session->pseudoCmd('chatstopfile' . $switchString, $self->pseudoCmdMode); | ||
| 15172 | } | ||
| 15173 | }); | ||
| 15174 | |||
| 15175 | my $button16 = $self->addButton($grid, | ||
| 15176 | 'Snoop', 'Requests to snoop on the selected contacts', undef, | ||
| 15177 | 7, 10, 6, 7); | ||
| 15178 | $button16->signal_connect('clicked' => sub { | ||
| 15179 | |||
| 15180 | if (defined $switchString) { | ||
| 15181 | |||
| 15182 | $self->session->pseudoCmd('chatsnoop' . $switchString, $self->pseudoCmdMode); | ||
| 15183 | } | ||
| 15184 | }); | ||
| 15185 | my $button17 = $self->addButton($grid, | ||
| 15186 | 'Hang up', 'Hang up on the selected contacts', undef, | ||
| 15187 | 10, 13, 6, 7); | ||
| 15188 | $button17->signal_connect('clicked' => sub { | ||
| 15189 | |||
| 15190 | if (defined $switchString) { | ||
| 15191 | |||
| 15192 | $self->session->pseudoCmd('chathangup' . $switchString, $self->pseudoCmdMode); | ||
| 15193 | } | ||
| 15194 | }); | ||
| 15195 | |||
| 15196 | my $button18 = $self->addButton($grid, | ||
| 15197 | 'Peek', 'Ask for a list of the selected contacts\' own chat connections', undef, | ||
| 15198 | 7, 10, 7, 8); | ||
| 15199 | $button18->signal_connect('clicked' => sub { | ||
| 15200 | |||
| 15201 | if (defined $switchString) { | ||
| 15202 | |||
| 15203 | $self->session->pseudoCmd('chatpeek' . $switchString, $self->pseudoCmdMode); | ||
| 15204 | } | ||
| 15205 | }); | ||
| 15206 | my $button19 = $self->addButton($grid, | ||
| 15207 | 'Request', 'Connect to all of the selected contacts\' own chat connections', undef, | ||
| 15208 | 10, 13, 7, 8); | ||
| 15209 | $button19->signal_connect('clicked' => sub { | ||
| 15210 | |||
| 15211 | if (defined $switchString) { | ||
| 15212 | |||
| 15213 | $self->session->pseudoCmd('chatrequest' . $switchString, $self->pseudoCmdMode); | ||
| 15214 | } | ||
| 15215 | }); | ||
| 15216 | |||
| 15217 | my $button20 = $self->addButton($grid, | ||
| 15218 | 'Set encoding', 'Set the encoding used in the selected chat sessions', undef, | ||
| 15219 | 7, 10, 8, 9); | ||
| 15220 | $button20->signal_connect('clicked' => sub { | ||
| 15221 | |||
| 15222 | if (defined $switchString) { | ||
| 15223 | |||
| 15224 | # ;chatset -e <encoding> <switches> | ||
| 15225 | $self->session->pseudoCmd( | ||
| 15226 | 'chatset -e ' . $entry3->get_text() . $switchString, | ||
| 15227 | $self->pseudoCmdMode, | ||
| 15228 | ); | ||
| 15229 | } | ||
| 15230 | |||
| 15231 | }); | ||
| 15232 | my $button21 = $self->addButton($grid, | ||
| 15233 | 'Default encoding ', 'Use default encoding in the selected chat sessions', undef, | ||
| 15234 | 10, 13, 8, 9); | ||
| 15235 | $button21->signal_connect('clicked' => sub { | ||
| 15236 | |||
| 15237 | if (defined $switchString) { | ||
| 15238 | |||
| 15239 | # ;chatset -e <switches> | ||
| 15240 | $self->session->pseudoCmd( | ||
| 15241 | 'chatset -e' . $switchString, | ||
| 15242 | $self->pseudoCmdMode, | ||
| 15243 | ); | ||
| 15244 | } | ||
| 15245 | }); | ||
| 15246 | |||
| 15247 | # List of all buttons which are sensitised, or not, depending on the radio buttons and entry | ||
| 15248 | # boxes | ||
| 15249 | @buttonList = ( | ||
| 15250 | $button, $button2, $button3, $button4, $button5, $button6, $button7, $button8, $button9, | ||
| 15251 | $button10, $button11, $button12, $button13, $button14, $button15, $button16, $button17, | ||
| 15252 | $button18, $button19, $button20, $button21, | ||
| 15253 | ); | ||
| 15254 | |||
| 15255 | # List of buttons which only be sensitised when there is acceptable text in $entry3 | ||
| 15256 | @textButtonList = ( | ||
| 15257 | $button7, $button8, $button13, $button20, | ||
| 15258 | ); | ||
| 15259 | |||
| 15260 | # List of buttons which are not in @textButtonList | ||
| 15261 | @noTextButtonList = ( | ||
| 15262 | $button, $button2, $button3, $button4, $button5, $button6, $button9, $button10, | ||
| 15263 | $button11, $button12, $button14, $button15, $button16, $button17, $button18, $button19, | ||
| 15264 | $button21, | ||
| 15265 | ); | ||
| 15266 | |||
| 15267 | # Some buttons start desensitised | ||
| 15268 | $self->desensitiseWidgets(@textButtonList); | ||
| 15269 | |||
| 15270 | # Entry/radio button signal_connects | ||
| 15271 | $radioButton->signal_connect('toggled' => sub { | ||
| 15272 | |||
| 15273 | $radioChoice = 0; | ||
| 15274 | $switchString = ''; # Apply to all sessions - no switch needed | ||
| 15275 | |||
| 15276 | $entry->set_sensitive(FALSE); | ||
| 15277 | $entry->set_text(''); | ||
| 15278 | $entry2->set_sensitive(FALSE); | ||
| 15279 | $entry2->set_text(''); | ||
| 15280 | |||
| 15281 | $self->sensitiseWidgets(@noTextButtonList); | ||
| 15282 | if ($self->checkEntryIcon($entry3)) { | ||
| 15283 | $self->sensitiseWidgets(@textButtonList); | ||
| 15284 | } else { | ||
| 15285 | $self->desensitiseWidgets(@textButtonList); | ||
| 15286 | } | ||
| 15287 | }); | ||
| 15288 | |||
| 15289 | $radioButton2->signal_connect('toggled' => sub { | ||
| 15290 | |||
| 15291 | $radioChoice = 1; | ||
| 15292 | $switchString = ''; # $switchString set below | ||
| 15293 | |||
| 15294 | $entry->set_sensitive(TRUE); | ||
| 15295 | $entry->set_text(''); | ||
| 15296 | $entry2->set_sensitive(FALSE); | ||
| 15297 | $entry2->set_text(''); | ||
| 15298 | $self->desensitiseWidgets(@buttonList); | ||
| 15299 | }); | ||
| 15300 | |||
| 15301 | $radioButton3->signal_connect('toggled' => sub { | ||
| 15302 | |||
| 15303 | $radioChoice = 2; | ||
| 15304 | $switchString = ''; # $switchString set below | ||
| 15305 | |||
| 15306 | $entry->set_sensitive(FALSE); | ||
| 15307 | $entry->set_text(''); | ||
| 15308 | $entry2->set_sensitive(TRUE); | ||
| 15309 | $entry2->set_text(''); | ||
| 15310 | $self->desensitiseWidgets(@buttonList); | ||
| 15311 | }); | ||
| 15312 | |||
| 15313 | $entry->signal_connect('changed' => sub { | ||
| 15314 | |||
| 15315 | if ($self->checkEntryIcon($entry)) { | ||
| 15316 | |||
| 15317 | # e.g. '-g mygroup' | ||
| 15318 | $switchString = ' -g ' . $entry->get_text(); | ||
| 15319 | |||
| 15320 | $self->sensitiseWidgets(@noTextButtonList); | ||
| 15321 | if ($self->checkEntryIcon($entry3)) { | ||
| 15322 | $self->sensitiseWidgets(@textButtonList); | ||
| 15323 | } else { | ||
| 15324 | $self->desensitiseWidgets(@textButtonList); | ||
| 15325 | } | ||
| 15326 | |||
| 15327 | } else { | ||
| 15328 | |||
| 15329 | # No buttons can be used | ||
| 15330 | $switchString = undef; | ||
| 15331 | $self->desensitiseWidgets(@buttonList); | ||
| 15332 | } | ||
| 15333 | }); | ||
| 15334 | $entry2->signal_connect('changed' => sub { | ||
| 15335 | |||
| 15336 | if ($self->checkEntryIcon($entry2)) { | ||
| 15337 | |||
| 15338 | # e.g. '-n myname' | ||
| 15339 | $switchString = ' -n ' . $entry2->get_text(); | ||
| 15340 | |||
| 15341 | $self->sensitiseWidgets(@noTextButtonList); | ||
| 15342 | if ($self->checkEntryIcon($entry3)) { | ||
| 15343 | $self->sensitiseWidgets(@textButtonList); | ||
| 15344 | } else { | ||
| 15345 | $self->desensitiseWidgets(@textButtonList); | ||
| 15346 | } | ||
| 15347 | |||
| 15348 | } else { | ||
| 15349 | |||
| 15350 | # No buttons can be used | ||
| 15351 | $switchString = undef; | ||
| 15352 | $self->desensitiseWidgets(@buttonList); | ||
| 15353 | } | ||
| 15354 | }); | ||
| 15355 | $entry3->signal_connect('changed' => sub { | ||
| 15356 | |||
| 15357 | if ($self->checkEntryIcon($entry3)) { | ||
| 15358 | |||
| 15359 | if ( | ||
| 15360 | $self->checkEntryIcon($entry) | ||
| 15361 | || $self->checkEntryIcon($entry2) | ||
| 15362 | || $radioButton->get_active() | ||
| 15363 | ) { | ||
| 15364 | $self->sensitiseWidgets(@buttonList); | ||
| 15365 | |||
| 15366 | } else { | ||
| 15367 | |||
| 15368 | $self->sensitiseWidgets(@noTextButtonList); | ||
| 15369 | $self->desensitiseWidgets(@textButtonList); | ||
| 15370 | } | ||
| 15371 | |||
| 15372 | } else { | ||
| 15373 | |||
| 15374 | if ( | ||
| 15375 | $self->checkEntryIcon($entry) | ||
| 15376 | || $self->checkEntryIcon($entry2) | ||
| 15377 | || $radioButton->get_active() | ||
| 15378 | ) { | ||
| 15379 | $self->sensitiseWidgets(@noTextButtonList); | ||
| 15380 | $self->desensitiseWidgets(@textButtonList); | ||
| 15381 | |||
| 15382 | } else { | ||
| 15383 | |||
| 15384 | $self->desensitiseWidgets(@buttonList); | ||
| 15385 | } | ||
| 15386 | } | ||
| 15387 | }); | ||
| 15388 | |||
| 15389 | # Tab complete | ||
| 15390 | return 1; | ||
| 15391 | } | ||
| 15392 | |||
| 15393 | sub chat3Tab { | ||
| 15394 | |||
| 15395 | # Chat3 tab | ||
| 15396 | # | ||
| 15397 | # Expected arguments | ||
| 15398 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 15399 | # | ||
| 15400 | # Return values | ||
| 15401 | # 'undef' on improper arguments | ||
| 15402 | # 1 otherwise | ||
| 15403 | |||
| 15404 | my ($self, $innerNotebook, $check) = @_; | ||
| 15405 | |||
| 15406 | # Local variables | ||
| 15407 | my ( | ||
| 15408 | $scriptDir, $posn, $count, $shortPath, | ||
| 15409 | @fileList, @taskList, | ||
| 15410 | ); | ||
| 15411 | |||
| 15412 | # Check for improper arguments | ||
| 15413 | if (! defined $innerNotebook || defined $check) { | ||
| 15414 | |||
| 15415 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat3Tab', @_); | ||
| 15416 | } | ||
| 15417 | |||
| 15418 | # Tab setup | ||
| 15419 | my $grid = $self->addTab( | ||
| 15420 | $innerNotebook, | ||
| 15421 | 'Page _3', | ||
| 15422 | ['Chat options'], | ||
| 15423 | ); | ||
| 15424 | |||
| 15425 | # Chat options | ||
| 15426 | $self->addLabel($grid, '<b>Chat options</b>', | ||
| 15427 | 0, 12, 0, 1); | ||
| 15428 | |||
| 15429 | # Left column | ||
| 15430 | $self->addLabel($grid, '<i>Choose an icon for all your chat sessions</i>', | ||
| 15431 | 1, 6, 1, 2); | ||
| 15432 | |||
| 15433 | # Get a list of .bmp files in /icons/chat | ||
| 15434 | $scriptDir = $axmud::SHARE_DIR; | ||
| 15435 | if ($^O eq 'MSWin32') { | ||
| 15436 | @fileList = glob($scriptDir . '\\icons\\chat\\*.bmp'); | ||
| 15437 | } else { | ||
| 15438 | @fileList = glob($scriptDir . '/icons/chat/*.bmp'); | ||
| 15439 | } | ||
| 15440 | |||
| 15441 | # Move the default chat icon to the top of the list (not sure if different code for MSWin is | ||
| 15442 | # actually necessary, but let's keep items in @fileList consistent) | ||
| 15443 | if ($^O eq 'MSWin32') { | ||
| 15444 | unshift (@fileList, $scriptDir . '\\' . $axmud::CLIENT->constChatIcon); | ||
| 15445 | } else { | ||
| 15446 | unshift (@fileList, $scriptDir . '/' . $axmud::CLIENT->constChatIcon); | ||
| 15447 | } | ||
| 15448 | |||
| 15449 | # Find the position of the current chat icon in the list | ||
| 15450 | $count = -1; | ||
| 15451 | OUTER: foreach my $file (@fileList) { | ||
| 15452 | |||
| 15453 | $count++; | ||
| 15454 | if ($file eq $axmud::CLIENT->chatIcon) { | ||
| 15455 | |||
| 15456 | $posn = $count; | ||
| 15457 | last OUTER; | ||
| 15458 | } | ||
| 15459 | } | ||
| 15460 | |||
| 15461 | # If the .bmp file used for the current icon no longer exists, use the default chat icon | ||
| 15462 | # instead | ||
| 15463 | if (! defined $posn) { | ||
| 15464 | |||
| 15465 | $posn = 0; | ||
| 15466 | $axmud::CLIENT->set_chatIcon($scriptDir . '/' . $axmud::CLIENT->constChatIcon); | ||
| 15467 | } | ||
| 15468 | |||
| 15469 | # Add a frame, containing one of the chat icons | ||
| 15470 | my ($image, $frame, $viewPort) = $self->addImage($grid, $fileList[$posn], undef, | ||
| 15471 | FALSE, # Don't use a scrolled window | ||
| 15472 | 128, 128, | ||
| 15473 | 1, 4, 2, 6); | ||
| 15474 | |||
| 15475 | # Add an entry beneath the frame to display the current icon shown | ||
| 15476 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 15477 | 1, 6, 6, 7); | ||
| 15478 | $shortPath = $fileList[$posn]; | ||
| 15479 | if ($shortPath) { | ||
| 15480 | |||
| 15481 | # Repair MSWin paths, so $scriptDir can be used in a substitution | ||
| 15482 | $scriptDir =~ s/\\/\\\\/g; | ||
| 15483 | # Do the substitution | ||
| 15484 | $shortPath =~ s/$scriptDir//; | ||
| 15485 | |||
| 15486 | $entry->set_text($shortPath); | ||
| 15487 | } | ||
| 15488 | |||
| 15489 | # Add two buttons to cycle through images | ||
| 15490 | my $button = $self->addButton($grid, '<<', 'Switch to previous image', undef, | ||
| 15491 | 4, 5, 2, 3); | ||
| 15492 | $button->signal_connect('clicked' => sub { | ||
| 15493 | |||
| 15494 | my $newImage; | ||
| 15495 | |||
| 15496 | $posn--; | ||
| 15497 | if ($posn < 0) { | ||
| 15498 | |||
| 15499 | $posn = (scalar @fileList) - 1; | ||
| 15500 | } | ||
| 15501 | |||
| 15502 | # Change the displayed image | ||
| 15503 | $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 15504 | if ($newImage) { | ||
| 15505 | |||
| 15506 | $shortPath = $fileList[$posn]; | ||
| 15507 | $shortPath =~ s/$scriptDir//; | ||
| 15508 | $entry->set_text($shortPath); | ||
| 15509 | $image = $newImage; | ||
| 15510 | } | ||
| 15511 | }); | ||
| 15512 | |||
| 15513 | my $button2 = $self->addButton($grid, '>>', 'Switch to next image', undef, | ||
| 15514 | 5, 6, 2, 3); | ||
| 15515 | $button2->signal_connect('clicked' => sub { | ||
| 15516 | |||
| 15517 | my $newImage; | ||
| 15518 | |||
| 15519 | $posn++; | ||
| 15520 | if ($posn >= scalar @fileList) { | ||
| 15521 | |||
| 15522 | $posn = 0; | ||
| 15523 | } | ||
| 15524 | |||
| 15525 | # Change the displayed image, and store it as the current chat icon | ||
| 15526 | $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 15527 | if ($newImage) { | ||
| 15528 | |||
| 15529 | $shortPath = $fileList[$posn]; | ||
| 15530 | $shortPath =~ s/$scriptDir//; | ||
| 15531 | $entry->set_text($shortPath); | ||
| 15532 | $image = $newImage; | ||
| 15533 | } | ||
| 15534 | }); | ||
| 15535 | |||
| 15536 | my $button3 = $self->addButton($grid, | ||
| 15537 | 'Choose file...', 'Select a .bmp file to use as the chat icon', undef, | ||
| 15538 | 4, 6, 3, 4); | ||
| 15539 | $button3->signal_connect('clicked' => sub { | ||
| 15540 | |||
| 15541 | my ($newFile, $count, $newImage); | ||
| 15542 | |||
| 15543 | $newFile = $self->showFileChooser( | ||
| 15544 | 'Select an icon file (must be .bmp)', | ||
| 15545 | 'open', | ||
| 15546 | ); | ||
| 15547 | |||
| 15548 | if ($newFile) { | ||
| 15549 | |||
| 15550 | # Check it's a .bmp file | ||
| 15551 | if (substr($newFile, -4) ne '.bmp') { | ||
| 15552 | |||
| 15553 | return $self->showMsgDialogue( | ||
| 15554 | 'Choose chat icon', | ||
| 15555 | 'warning', | ||
| 15556 | 'Only Windows bitmap (.bmp) files can be used as chat icons', | ||
| 15557 | 'ok', | ||
| 15558 | ); | ||
| 15559 | } | ||
| 15560 | |||
| 15561 | # Insert this file into the list of files just after the current position | ||
| 15562 | $posn++; | ||
| 15563 | if ($posn >= scalar @fileList) { | ||
| 15564 | |||
| 15565 | $posn = 0; | ||
| 15566 | } | ||
| 15567 | |||
| 15568 | splice(@fileList, $posn, 0, $newFile); | ||
| 15569 | |||
| 15570 | # Change the displayed image, and store it as the current chat icon | ||
| 15571 | $newImage = $self->changeImage($viewPort, $frame, $image, $newFile); | ||
| 15572 | if ($newImage) { | ||
| 15573 | |||
| 15574 | $shortPath = $fileList[$posn]; | ||
| 15575 | $shortPath =~ s/$scriptDir//; | ||
| 15576 | $entry->set_text($shortPath); | ||
| 15577 | $image = $newImage; | ||
| 15578 | } | ||
| 15579 | |||
| 15580 | # If this file exists somewhere else in the list, remove the duplicate | ||
| 15581 | $count = -1; | ||
| 15582 | OUTER: foreach my $item (@fileList) { | ||
| 15583 | |||
| 15584 | $count++; | ||
| 15585 | if ($count != $posn && $item eq $newFile) { | ||
| 15586 | |||
| 15587 | splice(@fileList, $count, 1); | ||
| 15588 | last OUTER; | ||
| 15589 | |||
| 15590 | if ($count < $posn) { | ||
| 15591 | |||
| 15592 | # The duplicate came before $posn; since the duplicate has been | ||
| 15593 | # removed, $posn shifts one to the left | ||
| 15594 | $posn--; | ||
| 15595 | } | ||
| 15596 | } | ||
| 15597 | } | ||
| 15598 | } | ||
| 15599 | }); | ||
| 15600 | |||
| 15601 | my $button4 = $self->addButton($grid, 'Use random', 'Choose a random icon', undef, | ||
| 15602 | 4, 6, 4, 5); | ||
| 15603 | $button4->signal_connect('clicked' => sub { | ||
| 15604 | |||
| 15605 | my $newImage; | ||
| 15606 | |||
| 15607 | $posn = int(rand(scalar @fileList)); | ||
| 15608 | |||
| 15609 | # Change the displayed image, and store it as the current chat icon | ||
| 15610 | $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 15611 | if ($newImage) { | ||
| 15612 | |||
| 15613 | $shortPath = $fileList[$posn]; | ||
| 15614 | $shortPath =~ s/$scriptDir//; | ||
| 15615 | $entry->set_text($shortPath); | ||
| 15616 | $image = $newImage; | ||
| 15617 | } | ||
| 15618 | }); | ||
| 15619 | |||
| 15620 | my $button5 = $self->addButton($grid, 'Use default', 'Use the default icon', undef, | ||
| 15621 | 4, 6, 5, 6); | ||
| 15622 | $button5->signal_connect('clicked' => sub { | ||
| 15623 | |||
| 15624 | my $newImage; | ||
| 15625 | |||
| 15626 | # It's the first icon in the list | ||
| 15627 | $posn = 0; | ||
| 15628 | |||
| 15629 | # Change the displayed image | ||
| 15630 | $newImage = $self->changeImage($viewPort, $frame, $image, $fileList[$posn]); | ||
| 15631 | if ($newImage) { | ||
| 15632 | |||
| 15633 | $shortPath = $fileList[$posn]; | ||
| 15634 | $shortPath =~ s/$scriptDir//; | ||
| 15635 | $entry->set_text($shortPath); | ||
| 15636 | $image = $newImage; | ||
| 15637 | } | ||
| 15638 | }); | ||
| 15639 | |||
| 15640 | # Right column | ||
| 15641 | $self->addLabel($grid, '<i>Choose a chat name (or leave empty)</i>', | ||
| 15642 | 7, 12, 1, 2); | ||
| 15643 | |||
| 15644 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 3, 16, | ||
| 15645 | 7, 12, 2, 3); | ||
| 15646 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 15647 | 7, 12, 3, 4); | ||
| 15648 | if ($axmud::CLIENT->chatName) { | ||
| 15649 | $entry3->set_text($axmud::CLIENT->chatName); | ||
| 15650 | } elsif ($self->session->currentChar) { | ||
| 15651 | $entry3->set_text($self->session->currentChar->name); | ||
| 15652 | } | ||
| 15653 | |||
| 15654 | $self->addLabel($grid, '<i>Choose an email address to broadcast (or leave empty)</i>', | ||
| 15655 | 7, 12, 4, 5); | ||
| 15656 | |||
| 15657 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'string', 3, 128, | ||
| 15658 | 7, 12, 5, 6); | ||
| 15659 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 15660 | 7, 12, 6, 7); | ||
| 15661 | if ($axmud::CLIENT->chatEmail) { | ||
| 15662 | |||
| 15663 | $entry5->set_text($axmud::CLIENT->chatEmail); | ||
| 15664 | } | ||
| 15665 | |||
| 15666 | my $button6 = $self->addButton( | ||
| 15667 | $grid, | ||
| 15668 | 'Apply these changes now', | ||
| 15669 | 'Store the icon, chat name and email and inform any running Chat tasks', | ||
| 15670 | undef, | ||
| 15671 | 1, 12, 7, 8); | ||
| 15672 | $button6->signal_connect('clicked' => sub { | ||
| 15673 | |||
| 15674 | my ($name, $email); | ||
| 15675 | |||
| 15676 | # Update the icon | ||
| 15677 | if ($fileList[$posn] ne $axmud::CLIENT->chatIcon) { | ||
| 15678 | |||
| 15679 | $self->session->pseudoCmd( | ||
| 15680 | 'chatseticon ' . $fileList[$posn], | ||
| 15681 | $self->pseudoCmdMode, | ||
| 15682 | ); | ||
| 15683 | } | ||
| 15684 | |||
| 15685 | # Update the chat name | ||
| 15686 | if ($self->checkEntryIcon($entry2)) { | ||
| 15687 | |||
| 15688 | $name = $entry2->get_text(); | ||
| 15689 | $self->session->pseudoCmd('chatsetname ' . $name, $self->pseudoCmdMode); | ||
| 15690 | |||
| 15691 | } else { | ||
| 15692 | |||
| 15693 | # Use the current character's name | ||
| 15694 | $self->session->pseudoCmd('chatsetname', $self->pseudoCmdMode); | ||
| 15695 | } | ||
| 15696 | |||
| 15697 | # Update the chat email | ||
| 15698 | if ($self->checkEntryIcon($entry4)) { | ||
| 15699 | |||
| 15700 | $email = $entry4->get_text(); | ||
| 15701 | $self->session->pseudoCmd( | ||
| 15702 | 'chatsetemail ' . $email, | ||
| 15703 | $self->pseudoCmdMode, | ||
| 15704 | ); | ||
| 15705 | |||
| 15706 | } else { | ||
| 15707 | |||
| 15708 | # Don't use an email | ||
| 15709 | $self->session->pseudoCmd('chatsetemail', $self->pseudoCmdMode); | ||
| 15710 | } | ||
| 15711 | |||
| 15712 | # Update the two insensitive entry boxes | ||
| 15713 | if ($axmud::CLIENT->chatName) { | ||
| 15714 | $entry3->set_text($axmud::CLIENT->chatName); | ||
| 15715 | } elsif ($self->session->currentChar) { | ||
| 15716 | $entry3->set_text($self->session->currentChar->name); | ||
| 15717 | } | ||
| 15718 | |||
| 15719 | if ($axmud::CLIENT->chatEmail) { | ||
| 15720 | |||
| 15721 | $entry5->set_text($axmud::CLIENT->chatEmail); | ||
| 15722 | } | ||
| 15723 | }); | ||
| 15724 | |||
| 15725 | # Tab complete | ||
| 15726 | return 1; | ||
| 15727 | } | ||
| 15728 | |||
| 15729 | sub chat4Tab { | ||
| 15730 | |||
| 15731 | # Chat4 tab | ||
| 15732 | # | ||
| 15733 | # Expected arguments | ||
| 15734 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 15735 | # | ||
| 15736 | # Return values | ||
| 15737 | # 'undef' on improper arguments | ||
| 15738 | # 1 otherwise | ||
| 15739 | |||
| 15740 | my ($self, $innerNotebook, $check) = @_; | ||
| 15741 | |||
| 15742 | # Local variables | ||
| 15743 | my @columnList; | ||
| 15744 | |||
| 15745 | # Check for improper arguments | ||
| 15746 | if (! defined $innerNotebook || defined $check) { | ||
| 15747 | |||
| 15748 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat4Tab', @_); | ||
| 15749 | } | ||
| 15750 | |||
| 15751 | # Tab setup | ||
| 15752 | my $grid = $self->addTab( | ||
| 15753 | $innerNotebook, | ||
| 15754 | 'Page _4', | ||
| 15755 | ['Chat contact list'], | ||
| 15756 | ); | ||
| 15757 | |||
| 15758 | # Chat contact list | ||
| 15759 | $self->addLabel($grid, '<b>Chat contact list</b>', | ||
| 15760 | 0, 12, 0, 1); | ||
| 15761 | $self->addLabel($grid, '<i>List of stored chat contacts available to the Chat task</i>', | ||
| 15762 | 1, 12, 1, 2); | ||
| 15763 | |||
| 15764 | # Add a simple list | ||
| 15765 | @columnList = ( | ||
| 15766 | 'Icon', 'pixbuf', # GA::Obj::ChatContact->lastIconScaled | ||
| 15767 | 'Name', 'text', | ||
| 15768 | 'Protocol', 'text', | ||
| 15769 | 'IP', 'text', | ||
| 15770 | 'Port', 'text', | ||
| 15771 | 'Email', 'text', | ||
| 15772 | ); | ||
| 15773 | |||
| 15774 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 15775 | 1, 12, 2, 8); | ||
| 15776 | |||
| 15777 | # Initialise the list | ||
| 15778 | $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 15779 | |||
| 15780 | # Add entry boxes for new chat contacts | ||
| 15781 | $self->addLabel($grid, 'Name', | ||
| 15782 | 1, 3, 8, 9); | ||
| 15783 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, 16, | ||
| 15784 | 3, 6, 8, 9); | ||
| 15785 | $self->addLabel($grid, 'IP address', | ||
| 15786 | 7, 9, 8, 9); | ||
| 15787 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 15788 | 9, 12, 8, 9); | ||
| 15789 | $self->addLabel($grid, 'Port', | ||
| 15790 | 1, 3, 9, 10); | ||
| 15791 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, 65535, | ||
| 15792 | 3, 6, 9, 10); | ||
| 15793 | $entry3->set_text($axmud::CLIENT->constChatPort); | ||
| 15794 | |||
| 15795 | # Add editing buttons | ||
| 15796 | my $button = $self->addButton($grid, 'Add', 'Add the chat contact', undef, | ||
| 15797 | 7, 9, 9, 10); | ||
| 15798 | $button->signal_connect('clicked' => sub { | ||
| 15799 | |||
| 15800 | my ($name, $ip, $port); | ||
| 15801 | |||
| 15802 | if ($self->checkEntryIcon($entry, $entry2, $entry3)) { | ||
| 15803 | |||
| 15804 | $name = $entry->get_text(); | ||
| 15805 | $ip = $entry2->get_text(); | ||
| 15806 | $port = $entry3->get_text(); | ||
| 15807 | |||
| 15808 | # Create a new GA::Obj::ChatContact, using the zChat protocol as the default | ||
| 15809 | $self->session->pseudoCmd( | ||
| 15810 | 'addcontact ' . $name . ' ' . $ip . ' ' . $port, | ||
| 15811 | $self->pseudoCmdMode, | ||
| 15812 | ); | ||
| 15813 | |||
| 15814 | # Refresh the simple list and entry boxes | ||
| 15815 | $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 15816 | $self->resetEntryBoxes($entry, $entry2); | ||
| 15817 | $entry3->set_text($axmud::CLIENT->constChatPort); | ||
| 15818 | } | ||
| 15819 | }); | ||
| 15820 | |||
| 15821 | my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected chat contact', undef, | ||
| 15822 | 9, 10, 9, 10); | ||
| 15823 | $button2->signal_connect('clicked' => sub { | ||
| 15824 | |||
| 15825 | my ($name, $contactObj, $childWinObj); | ||
| 15826 | |||
| 15827 | ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 15828 | if (defined $name) { | ||
| 15829 | |||
| 15830 | # Get the blessed reference | ||
| 15831 | $contactObj = $axmud::CLIENT->ivShow('chatContactHash', $name); | ||
| 15832 | if ($contactObj) { | ||
| 15833 | |||
| 15834 | # Open up an 'edit' window to edit the GA::Obj::ChatContact | ||
| 15835 | $self->createFreeWin( | ||
| 15836 | 'Games::Axmud::EditWin::ChatContact', | ||
| 15837 | $self, | ||
| 15838 | $self->session, | ||
| 15839 | 'Edit chat contact \'' . $name . '\'', | ||
| 15840 | $contactObj, | ||
| 15841 | FALSE, # Not temporary | ||
| 15842 | ); | ||
| 15843 | } | ||
| 15844 | |||
| 15845 | if ($childWinObj) { | ||
| 15846 | |||
| 15847 | # When the 'edit' window closes, update widgets and/or IVs | ||
| 15848 | $self->add_childDestroy( | ||
| 15849 | $childWinObj, | ||
| 15850 | 'chat4Tab_refreshList', | ||
| 15851 | [$slWidget, (scalar @columnList / 2)], | ||
| 15852 | ); | ||
| 15853 | } | ||
| 15854 | } | ||
| 15855 | }); | ||
| 15856 | |||
| 15857 | my $button3 = $self->addButton($grid, 'Delete', 'Delete the selected chat contact', undef, | ||
| 15858 | 10, 12, 9, 10); | ||
| 15859 | $button3->signal_connect('clicked' => sub { | ||
| 15860 | |||
| 15861 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 15862 | if (defined $name) { | ||
| 15863 | |||
| 15864 | # Delete the contact | ||
| 15865 | $self->session->pseudoCmd('deletecontact ' . $name, $self->pseudoCmdMode); | ||
| 15866 | |||
| 15867 | # Refresh the simple list | ||
| 15868 | $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 15869 | } | ||
| 15870 | }); | ||
| 15871 | |||
| 15872 | my $button4 = $self->addButton($grid, 'Call...', 'Call the selected chat contact', undef, | ||
| 15873 | 7, 9, 10, 11); | ||
| 15874 | $button4->signal_connect('clicked' => sub { | ||
| 15875 | |||
| 15876 | my ($name) = $self->getSimpleListData($slWidget, 1); | ||
| 15877 | if (defined $name) { | ||
| 15878 | |||
| 15879 | # Call the contact | ||
| 15880 | $self->session->pseudoCmd('chatcall ' . $name, $self->pseudoCmdMode); | ||
| 15881 | |||
| 15882 | # Refresh the simple list | ||
| 15883 | $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 15884 | } | ||
| 15885 | }); | ||
| 15886 | |||
| 15887 | my $button5 = $self->addButton( | ||
| 15888 | $grid, 'Refresh list', 'Refresh the list of chat contacts', undef, | ||
| 15889 | 9, 12, 10, 11); | ||
| 15890 | $button5->signal_connect('clicked' => sub { | ||
| 15891 | |||
| 15892 | # Refresh the simple list | ||
| 15893 | $self->chat4Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 15894 | }); | ||
| 15895 | |||
| 15896 | # Tab complete | ||
| 15897 | return 1; | ||
| 15898 | } | ||
| 15899 | |||
| 15900 | sub chat4Tab_refreshList { | ||
| 15901 | |||
| 15902 | # Called by $self->chat4Tab to refresh the GA::Obj::SimpleList | ||
| 15903 | # | ||
| 15904 | # Expected arguments | ||
| 15905 | # $slWidget - The GA::Obj::SimpleList | ||
| 15906 | # $columns - The number of columns in the list | ||
| 15907 | # | ||
| 15908 | # Return values | ||
| 15909 | # 'undef' on improper arguments | ||
| 15910 | # 1 otherwise | ||
| 15911 | |||
| 15912 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 15913 | |||
| 15914 | # Local variables | ||
| 15915 | my (@objList, @dataList); | ||
| 15916 | |||
| 15917 | # Check for improper arguments | ||
| 15918 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 15919 | |||
| 15920 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat4Tab_refreshList', @_); | ||
| 15921 | } | ||
| 15922 | |||
| 15923 | # Get a sorted list of GA::Obj::ChatContact objects | ||
| 15924 | @objList | ||
| 15925 | = sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('chatContactHash')); | ||
| 15926 | |||
| 15927 | # Compile the simple list data | ||
| 15928 | foreach my $obj (@objList) { | ||
| 15929 | |||
| 15930 | my $protocol; | ||
| 15931 | |||
| 15932 | if ($obj->protocol == 0) { | ||
| 15933 | $protocol = 'MM'; | ||
| 15934 | } else { | ||
| 15935 | $protocol = 'zChat'; | ||
| 15936 | } | ||
| 15937 | |||
| 15938 | push (@dataList, | ||
| 15939 | $obj->lastIconScaled, | ||
| 15940 | $obj->name, | ||
| 15941 | $protocol, | ||
| 15942 | $obj->ip, | ||
| 15943 | $obj->port, | ||
| 15944 | $obj->email, | ||
| 15945 | ); | ||
| 15946 | } | ||
| 15947 | |||
| 15948 | # Reset the simple list | ||
| 15949 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 15950 | |||
| 15951 | return 1; | ||
| 15952 | } | ||
| 15953 | |||
| 15954 | sub chat5Tab { | ||
| 15955 | |||
| 15956 | # Chat5 tab | ||
| 15957 | # | ||
| 15958 | # Expected arguments | ||
| 15959 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 15960 | # | ||
| 15961 | # Return values | ||
| 15962 | # 'undef' on improper arguments | ||
| 15963 | # 1 otherwise | ||
| 15964 | |||
| 15965 | my ($self, $innerNotebook, $check) = @_; | ||
| 15966 | |||
| 15967 | # Local variables | ||
| 15968 | my @columnList; | ||
| 15969 | |||
| 15970 | # Check for improper arguments | ||
| 15971 | if (! defined $innerNotebook || defined $check) { | ||
| 15972 | |||
| 15973 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat5Tab', @_); | ||
| 15974 | } | ||
| 15975 | |||
| 15976 | # Tab setup | ||
| 15977 | my $grid = $self->addTab( | ||
| 15978 | $innerNotebook, | ||
| 15979 | 'Page _5', | ||
| 15980 | ['Current chat connections'], | ||
| 15981 | ); | ||
| 15982 | |||
| 15983 | # Current chat connections | ||
| 15984 | $self->addLabel($grid, '<b>Current chat connections</b>', | ||
| 15985 | 0, 12, 0, 1); | ||
| 15986 | $self->addLabel( | ||
| 15987 | $grid, '<i>List of current connections to chat contacts (in all sessions)</i>', | ||
| 15988 | 1, 12, 1, 2); | ||
| 15989 | |||
| 15990 | # Add a simple list | ||
| 15991 | @columnList = ( | ||
| 15992 | 'Session', 'int', | ||
| 15993 | 'Icon', 'pixbuf', # GA::Obj::ChatContact->lastIconScaled | ||
| 15994 | 'Name', 'text', | ||
| 15995 | 'Contact', 'text', | ||
| 15996 | 'Protocol', 'text', | ||
| 15997 | 'IP', 'text', | ||
| 15998 | 'Port', 'text', | ||
| 15999 | 'Group', 'text', | ||
| 16000 | 'Can snoop', 'bool', | ||
| 16001 | 'Is snooping', 'bool', | ||
| 16002 | 'Public', 'bool', | ||
| 16003 | 'Serving', 'bool', | ||
| 16004 | ); | ||
| 16005 | |||
| 16006 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 16007 | 1, 12, 2, 8); | ||
| 16008 | |||
| 16009 | # Initialise the list | ||
| 16010 | $self->chat5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 16011 | |||
| 16012 | # Add editing buttons | ||
| 16013 | my $button = $self->addButton($grid, | ||
| 16014 | 'Refresh list', 'Refresh the list of connections', undef, | ||
| 16015 | 9, 12, 8, 9); | ||
| 16016 | $button->signal_connect('clicked' => sub { | ||
| 16017 | |||
| 16018 | # Refresh the list | ||
| 16019 | $self->chat5Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 16020 | }); | ||
| 16021 | |||
| 16022 | # Tab complete | ||
| 16023 | return 1; | ||
| 16024 | } | ||
| 16025 | |||
| 16026 | sub chat5Tab_refreshList { | ||
| 16027 | |||
| 16028 | # Called by $self->chat5Tab to refresh the GA::Obj::SimpleList | ||
| 16029 | # | ||
| 16030 | # Expected arguments | ||
| 16031 | # $slWidget - The GA::Obj::SimpleList | ||
| 16032 | # $columns - The number of columns in the list | ||
| 16033 | # | ||
| 16034 | # Return values | ||
| 16035 | # 'undef' on improper arguments | ||
| 16036 | # 1 otherwise | ||
| 16037 | |||
| 16038 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 16039 | |||
| 16040 | # Local variables | ||
| 16041 | my (@taskList, @dataList); | ||
| 16042 | |||
| 16043 | # Check for improper arguments | ||
| 16044 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 16045 | |||
| 16046 | return $axmud::CLIENT->writeImproper($self->_objClass . '->chat5Tab_refreshList', @_); | ||
| 16047 | } | ||
| 16048 | |||
| 16049 | # Get a list of chat tasks running in every GA::Session | ||
| 16050 | foreach my $session ($axmud::CLIENT->listSessions()) { | ||
| 16051 | |||
| 16052 | my @list; | ||
| 16053 | |||
| 16054 | # If this session has a lead chat task... | ||
| 16055 | if ($session->chatTask) { | ||
| 16056 | |||
| 16057 | # Add all chat tasks for this session | ||
| 16058 | @list = sort { | ||
| 16059 | if ($a->remoteName && $b->remoteName) { | ||
| 16060 | lc($a->remoteName) cmp lc($b->remoteName); | ||
| 16061 | } else { | ||
| 16062 | lc($a) cmp lc($b); | ||
| 16063 | } | ||
| 16064 | } ($session->chatTask->findAllTasks()); | ||
| 16065 | |||
| 16066 | if (@list) { | ||
| 16067 | |||
| 16068 | push (@taskList, @list); | ||
| 16069 | } | ||
| 16070 | } | ||
| 16071 | } | ||
| 16072 | |||
| 16073 | # Compile the simple list data | ||
| 16074 | foreach my $taskObj (@taskList) { | ||
| 16075 | |||
| 16076 | my ($protocol, $contact, $icon); | ||
| 16077 | |||
| 16078 | # Only display Chat tasks connected to someone | ||
| 16079 | if ($taskObj->sessionFlag) { | ||
| 16080 | |||
| 16081 | if ($taskObj->chatType == 0) { | ||
| 16082 | $protocol = 'MM'; | ||
| 16083 | } else { | ||
| 16084 | $protocol = 'zChat'; | ||
| 16085 | } | ||
| 16086 | |||
| 16087 | if ($taskObj->chatContactObj) { | ||
| 16088 | |||
| 16089 | $icon = $taskObj->chatContactObj->lastIconScaled; | ||
| 16090 | $contact = $taskObj->chatContactObj->name; | ||
| 16091 | |||
| 16092 | } else { | ||
| 16093 | |||
| 16094 | $icon = $taskObj->remoteIconScaled; | ||
| 16095 | } | ||
| 16096 | |||
| 16097 | push (@dataList, | ||
| 16098 | $taskObj->session->number, | ||
| 16099 | $icon, | ||
| 16100 | $taskObj->remoteName, | ||
| 16101 | $contact, | ||
| 16102 | $protocol, | ||
| 16103 | $taskObj->remoteIP, | ||
| 16104 | $taskObj->remotePort, | ||
| 16105 | $taskObj->localGroup, | ||
| 16106 | $taskObj->allowSnoopFlag, | ||
| 16107 | $taskObj->isSnoopedFlag, | ||
| 16108 | $taskObj->publicConnectionFlag, | ||
| 16109 | $taskObj->servingFlag, | ||
| 16110 | ); | ||
| 16111 | } | ||
| 16112 | } | ||
| 16113 | |||
| 16114 | # Reset the simple list | ||
| 16115 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 16116 | |||
| 16117 | return 1; | ||
| 16118 | } | ||
| 16119 | |||
| 16120 | ################## | ||
| 16121 | # Accessors - set | ||
| 16122 | |||
| 16123 | ################## | ||
| 16124 | # Accessors - get | ||
| 16125 | } | ||
| 16126 | |||
| 16127 | { package Games::Axmud::PrefWin::Path; | ||
| 16128 | |||
| 16129 | use strict; | ||
| 16130 | use warnings; | ||
| 16131 | # use diagnostics; | ||
| 16132 | |||
| 16133 | use Glib qw(TRUE FALSE); | ||
| 16134 | |||
| 16135 | our @ISA = qw( | ||
| 16136 | Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin | ||
| 16137 | Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud | ||
| 16138 | ); | ||
| 16139 | |||
| 16140 | ################## | ||
| 16141 | # Constructors | ||
| 16142 | |||
| 16143 | # Contents of $self->editConfigHash after $self->new has been called: | ||
| 16144 | # 'room_list' => A list of GA::ModelObj::Room objects along the path | ||
| 16145 | # 'exit_list' => A list of GA::Obj::Exit objects linking the rooms on the path | ||
| 16146 | # 'cmd_list' => A list of commands used to move along the path | ||
| 16147 | # 'reverse_list' => A list of commands used to move along the path in the reverse direction | ||
| 16148 | # (an empty list, if unknown) | ||
| 16149 | |||
| 16150 | sub new { | ||
| 16151 | |||
| 16152 | # Called by GA::Generic::Win->createFreeWin | ||
| 16153 | # Creates a new instance of a 'config' window (any 'free' window object inheriting from this | ||
| 16154 | # object, namely 'edit' windows and 'pref' windows) | ||
| 16155 | # | ||
| 16156 | # Expected arguments | ||
| 16157 | # $number - Unique number for this window object | ||
| 16158 | # $workspaceObj - The GA::Obj::Workspace handling the workspace in which this window | ||
| 16159 | # should be created | ||
| 16160 | # $owner - The owner; a 'grid' window object (but not an 'external' window) or a | ||
| 16161 | # 'free' window object. When this window opens/closes, the owner is | ||
| 16162 | # informed via calls to its ->add_childFreeWin / ->del_childFreeWin | ||
| 16163 | # functions | ||
| 16164 | # | ||
| 16165 | # Optional arguments | ||
| 16166 | # $session - The GA::Session from which this function was called. 'undef' if the | ||
| 16167 | # calling function didn't specify a session and $owner's ->session IV | ||
| 16168 | # is also 'undef' | ||
| 16169 | # $title - A string to use as the window title. If 'undef', a generic title is | ||
| 16170 | # used | ||
| 16171 | # $editObj - The object to be edited in the window (for 'edit' windows only; | ||
| 16172 | # should be 'undef' for 'pref' windows) | ||
| 16173 | # $tempFlag - Flag set to TRUE if $editObj is either temporary, or has not yet been | ||
| 16174 | # added to any registry (usually because the user needs to name it | ||
| 16175 | # first). Set to FALSE (or 'undef') otherwise. Ignored if $editObj is | ||
| 16176 | # not specified | ||
| 16177 | # %configHash - Hash containing any number of key-value pairs needed for this | ||
| 16178 | # particular 'config' window; for example, for example, | ||
| 16179 | # GA::PrefWin::TaskStart uses it to specify a task name and type. | ||
| 16180 | # Set to an empty hash if not required | ||
| 16181 | # | ||
| 16182 | # Return values | ||
| 16183 | # 'undef' on improper arguments | ||
| 16184 | # Blessed reference to the newly-created object on success | ||
| 16185 | |||
| 16186 | my ( | ||
| 16187 | $class, $number, $workspaceObj, $owner, $session, $title, $editObj, $tempFlag, | ||
| 16188 | %configHash, | ||
| 16189 | ) = @_; | ||
| 16190 | |||
| 16191 | # Local variables | ||
| 16192 | my ($winType, $winName, $winWidth, $winHeight); | ||
| 16193 | |||
| 16194 | # Check for improper arguments | ||
| 16195 | if (! defined $class || ! defined $number || ! defined $workspaceObj || ! defined $owner) { | ||
| 16196 | |||
| 16197 | return $axmud::CLIENT->writeImproper($class . '->new', @_); | ||
| 16198 | } | ||
| 16199 | |||
| 16200 | # Set the values to use for some standard window IVs | ||
| 16201 | if ($editObj) { | ||
| 16202 | |||
| 16203 | $winType = 'edit'; | ||
| 16204 | $winName = 'edit'; | ||
| 16205 | if (! defined $title) { | ||
| 16206 | |||
| 16207 | $title = 'Edit window'; | ||
| 16208 | } | ||
| 16209 | |||
| 16210 | } else { | ||
| 16211 | |||
| 16212 | $winType = 'pref'; | ||
| 16213 | $winName = 'pref'; | ||
| 16214 | if (! defined $title) { | ||
| 16215 | |||
| 16216 | $title = 'Preference window'; | ||
| 16217 | } | ||
| 16218 | } | ||
| 16219 | |||
| 16220 | $winWidth = $axmud::CLIENT->customFreeWinWidth; | ||
| 16221 | if ($axmud::CLIENT->configWinIndexFlag) { | ||
| 16222 | |||
| 16223 | $winWidth += $axmud::CLIENT->customConfigWinIndexWidth; | ||
| 16224 | } | ||
| 16225 | |||
| 16226 | # For the benefit of MS Windows and its enormous buttons, increase the height of all | ||
| 16227 | # 'config' windows a little (this removes scrollbars in almost all tabs) | ||
| 16228 | $winHeight = $axmud::CLIENT->customFreeWinHeight; | ||
| 16229 | if ( | ||
| 16230 | $^O eq 'MSWin32' | ||
| 16231 | && $axmud::CLIENT->customFreeWinHeight eq $axmud::CLIENT->constFreeWinHeight | ||
| 16232 | ) { | ||
| 16233 | $winHeight += 30; | ||
| 16234 | } | ||
| 16235 | |||
| 16236 | # Setup | ||
| 16237 | my $self = { | ||
| 16238 | _objName => $winType . '_win_' . $number, | ||
| 16239 | _objClass => $class, | ||
| 16240 | _parentFile => undef, # No parent file object | ||
| 16241 | _parentWorld => undef, # No parent file object | ||
| 16242 | _privFlag => TRUE, # All IVs are private | ||
| 16243 | |||
| 16244 | # Standard window object IVs | ||
| 16245 | # -------------------------- | ||
| 16246 | |||
| 16247 | # Unique number for this window object | ||
| 16248 | number => $number, | ||
| 16249 | # The window category - 'grid' or 'free' | ||
| 16250 | winCategory => 'free', | ||
| 16251 | # The window type, any of the keys in GA::Client->constFreeWinTypeHash | ||
| 16252 | winType => $winType, | ||
| 16253 | # A name for the window (for 'config' windows, the same as the window type) | ||
| 16254 | winName => $winName, | ||
| 16255 | # The GA::Obj::Workspace object for the workspace in which this window is created | ||
| 16256 | workspaceObj => $workspaceObj, | ||
| 16257 | # The owner; a 'grid' window object (but not an 'external' window) or a 'free' window | ||
| 16258 | # object. When this window opens/closes, the owner is informed via calls to its | ||
| 16259 | # ->add_childFreeWin / ->del_childFreeWin functions | ||
| 16260 | owner => $owner, | ||
| 16261 | # The GA::Session from which this function was called. 'undef' if the calling function | ||
| 16262 | # didn't specify a session and $owner's ->session IV is also 'undef' | ||
| 16263 | session => $session, | ||
| 16264 | # When GA::Session->pseudoCmd is called to execute a client command, the mode in which | ||
| 16265 | # it should be called (usually 'win_error' or 'win_only', which causes errors to be | ||
| 16266 | # displayed in a 'dialogue' window) | ||
| 16267 | pseudoCmdMode => 'win_error', | ||
| 16268 | |||
| 16269 | # The window widget. For most window objects, the Gtk3::Window. For pseudo-windows, the | ||
| 16270 | # parent 'main' window's Gtk3::Window | ||
| 16271 | # The code should use this IV when it wants to do something to the window itself | ||
| 16272 | # (minimise it, make it active, etc) | ||
| 16273 | winWidget => undef, | ||
| 16274 | # The window container. For most window objects, the Gtk3::Window. For pseudo-windows, | ||
| 16275 | # the parent GA::Table::PseudoWin table object | ||
| 16276 | # The code should use this IV when it wants to add, modify or remove widgets inside the | ||
| 16277 | # window itself | ||
| 16278 | winBox => undef, | ||
| 16279 | # Flag set to TRUE if the window actually exists (after a call to $self->winEnable), | ||
| 16280 | # FALSE if not | ||
| 16281 | enabledFlag => FALSE, | ||
| 16282 | # Flag set to TRUE if the Gtk3 window itself is visible (after a call to | ||
| 16283 | # $self->setVisible), FALSE if it is not visible (after a call to $self->setInvisible) | ||
| 16284 | visibleFlag => TRUE, | ||
| 16285 | # Registry hash of 'free' windows (excluding 'dialogue' windows) for which this window | ||
| 16286 | # is the parent, a subset of GA::Obj::Desktop->freeWinHash. Hash in the form | ||
| 16287 | # $childFreeWinHash{unique_number} = blessed_reference_to_window_object | ||
| 16288 | childFreeWinHash => {}, | ||
| 16289 | # When a child 'free' window (excluding 'dialogue' windows) is destroyed, this parent | ||
| 16290 | # window is informed via a call to $self->del_childFreeWin | ||
| 16291 | # When the child is destroyed, this window might want to call some of its own functions | ||
| 16292 | # to update various widgets and/or IVs, in which case this window adds an entry to | ||
| 16293 | # this hash; a hash in the form | ||
| 16294 | # $childDestroyHash{unique_number} = list_reference | ||
| 16295 | # ...where 'unique_number' is the child window's ->number, and 'list_reference' is a | ||
| 16296 | # reference to a list in groups of 2, in the form | ||
| 16297 | # (sub_name, argument_list_ref, sub_name, argument_list_ref...) | ||
| 16298 | childDestroyHash => {}, | ||
| 16299 | |||
| 16300 | # The container widget into which all other widgets are packed (usually a Gtk3::VBox or | ||
| 16301 | # Gtk3::HBox, but any container widget can be used; takes up the whole window client | ||
| 16302 | # area) | ||
| 16303 | packingBox => undef, # Gtk3::VBox | ||
| 16304 | |||
| 16305 | # Standard IVs for 'free' windows | ||
| 16306 | |||
| 16307 | # The window's default size, in pixels | ||
| 16308 | widthPixels => $winWidth, | ||
| 16309 | heightPixels => $winHeight, | ||
| 16310 | # Default border/item spacing sizes used in the window, in pixels | ||
| 16311 | borderPixels => $axmud::CLIENT->constFreeBorderPixels, | ||
| 16312 | spacingPixels => $axmud::CLIENT->constFreeSpacingPixels, | ||
| 16313 | |||
| 16314 | # A string to use as the window title. If 'undef', a generic title is used | ||
| 16315 | title => $title, | ||
| 16316 | # Hash containing any number of key-value pairs needed for this particular 'config' | ||
| 16317 | # window; for example, for example, GA::PrefWin::TaskStart uses it to specify a task | ||
| 16318 | # name and type. Set to an empty hash if not required | ||
| 16319 | configHash => {%configHash}, | ||
| 16320 | |||
| 16321 | # Standard IVs for 'config' windows | ||
| 16322 | |||
| 16323 | # Widgets | ||
| 16324 | hPaned => undef, # Gtk3::HPaned | ||
| 16325 | scroller => undef, # Gtk3::ScrolledWindow | ||
| 16326 | treeStore => undef, # Gtk3::TreeStore | ||
| 16327 | treeView => undef, # Gtk3::TreeView | ||
| 16328 | vBox => undef, # Gtk3::VBox | ||
| 16329 | notebook => undef, # Gtk3::Notebook | ||
| 16330 | hBox => undef, # Gtk3::HBox | ||
| 16331 | okButton => undef, # Gtk3::Button | ||
| 16332 | cancelButton => undef, # Gtk3::Button | ||
| 16333 | resetButton => undef, # Gtk3::Button | ||
| 16334 | saveButton => undef, # Gtk3::Button | ||
| 16335 | |||
| 16336 | # The standard grid size for the notebook (any 'edit'/'pref' window can use a different | ||
| 16337 | # size, if it wants) | ||
| 16338 | gridSize => 12, | ||
| 16339 | |||
| 16340 | # The object to be edited in the window (for 'edit' windows only; should be 'undef' for | ||
| 16341 | # 'pref' windows) | ||
| 16342 | editObj => $editObj, | ||
| 16343 | # Flag set to TRUE if $editObj is either temporary, or has not yet been added to any | ||
| 16344 | # registry (usually because the user needs to name it first). Set to FALSE | ||
| 16345 | # (or 'undef') otherwise. Ignored if $editObj is not specified | ||
| 16346 | tempFlag => $tempFlag, | ||
| 16347 | # Flag that can be set to TRUE (usually by $self->setupNotebook or ->expandNotebook) if | ||
| 16348 | # $editObj is a current object (e.g. if it is a current profile); set to FALSE at all | ||
| 16349 | # other times | ||
| 16350 | currentFlag => FALSE, | ||
| 16351 | # For 'edit' windows, a hash of IVs in $editObj that should be changed. If no changes | ||
| 16352 | # have been made in the 'edit' window, the hash is empty; otherwise the hash contains | ||
| 16353 | # the new values for each IV to be modified | ||
| 16354 | # Hash in the form: | ||
| 16355 | # $editHash{iv_name} = scalar; | ||
| 16356 | # $editHash{iv_name} = list_reference; | ||
| 16357 | # $editHash{iv_name} = hash_reference; | ||
| 16358 | # For 'pref' windows, a hash of key-value pairs set by the window's widgets; | ||
| 16359 | # $self->enableButtons can access this hash to perform any necessary actions | ||
| 16360 | # ('pref' windows don't make a call to ->saveChanges) | ||
| 16361 | editHash => {}, | ||
| 16362 | # Hash containing any number of key-value pairs needed for this particular | ||
| 16363 | # 'edit'/'pref' window; for example, GA::PrefWin::TaskStart uses it to specify a task | ||
| 16364 | # name and type. Set to an empty hash if not required | ||
| 16365 | editConfigHash => \%configHash, | ||
| 16366 | |||
| 16367 | # In the index on the left-hand side of the window, the pointer (Gtk3::TreeIter) for | ||
| 16368 | # the $self->notebook tab that's currently being drawn | ||
| 16369 | indexPointer => undef, | ||
| 16370 | # A hash of inner Gtk3::Notebooks. Keys are a tab number in the outer notebook (first | ||
| 16371 | # tab is #0); the corresponding values are the inner notebook for that tab, or | ||
| 16372 | # 'undef' if the tab has no inner notebook | ||
| 16373 | innerNotebookHash => {}, | ||
| 16374 | |||
| 16375 | # IVs for this type of window | ||
| 16376 | |||
| 16377 | # A list of GA::ModelObj::Room objects along the path | ||
| 16378 | roomList => [], | ||
| 16379 | # The first room in the list | ||
| 16380 | initialRoomObj => undef, | ||
| 16381 | # The last room in the list | ||
| 16382 | targetRoomObj => undef, | ||
| 16383 | |||
| 16384 | # A list of GA::Obj::Exit objects, linking the room objects on the path | ||
| 16385 | exitList => [], | ||
| 16386 | # A list of commands (using assisted moves if allowed) to go along the path | ||
| 16387 | cmdList => [], | ||
| 16388 | reverseCmdList => [], | ||
| 16389 | }; | ||
| 16390 | |||
| 16391 | # Bless the object into existence | ||
| 16392 | bless $self, $class; | ||
| 16393 | |||
| 16394 | return $self; | ||
| 16395 | } | ||
| 16396 | |||
| 16397 | ################## | ||
| 16398 | # Methods | ||
| 16399 | |||
| 16400 | # Standard window object functions | ||
| 16401 | |||
| 16402 | # sub winSetup {} # Inherited from GA::Generic::ConfigWin | ||
| 16403 | |||
| 16404 | # sub winEnable {} # Inherited from GA::Generic::ConfigWin | ||
| 16405 | |||
| 16406 | # sub winDesengage {} # Inherited from GA::Generic::FreeWin | ||
| 16407 | |||
| 16408 | # sub winDestroy {} # Inherited from GA::Generic::FreeWin | ||
| 16409 | |||
| 16410 | # sub winShowAll {} # Inherited from GA::Generic::Win | ||
| 16411 | |||
| 16412 | # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin | ||
| 16413 | |||
| 16414 | # sub redrawWidgets {} # Inherited from GA::Generic::Win | ||
| 16415 | |||
| 16416 | # ->signal_connects | ||
| 16417 | |||
| 16418 | # Other functions | ||
| 16419 | |||
| 16420 | # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin | ||
| 16421 | |||
| 16422 | sub enableButtons { | ||
| 16423 | |||
| 16424 | # Called by $self->drawWidgets | ||
| 16425 | # We only need a single button so, instead of calling the generic ->enableButtons, call a | ||
| 16426 | # method that creates just one button | ||
| 16427 | # | ||
| 16428 | # Expected arguments | ||
| 16429 | # $hBox - The horizontal packing box in which the buttons live (not yet stored as | ||
| 16430 | # an IV) | ||
| 16431 | # | ||
| 16432 | # Return values | ||
| 16433 | # An empty list on improper arguments | ||
| 16434 | # Otherwise, a list containing the Gtk::Button object created | ||
| 16435 | |||
| 16436 | my ($self, $hBox, $check) = @_; | ||
| 16437 | |||
| 16438 | # Local variables | ||
| 16439 | my @emptyList; | ||
| 16440 | |||
| 16441 | # Check for improper arguments | ||
| 16442 | if (! defined $hBox || defined $check) { | ||
| 16443 | |||
| 16444 | $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_); | ||
| 16445 | return @emptyList; | ||
| 16446 | } | ||
| 16447 | |||
| 16448 | return $self->enableSingleButton($hBox); | ||
| 16449 | } | ||
| 16450 | |||
| 16451 | # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin | ||
| 16452 | |||
| 16453 | sub setupNotebook { | ||
| 16454 | |||
| 16455 | # Called by $self->winEnable | ||
| 16456 | # Creates the first tab for the notebook. The remaining tabs are created by | ||
| 16457 | # $self->expandNotebook | ||
| 16458 | # | ||
| 16459 | # Expected arguments | ||
| 16460 | # (none besides $self) | ||
| 16461 | # | ||
| 16462 | # Return values | ||
| 16463 | # 'undef' on improper arguments | ||
| 16464 | # 1 otherwise | ||
| 16465 | |||
| 16466 | my ($self, $check) = @_; | ||
| 16467 | |||
| 16468 | # Local variables | ||
| 16469 | my ($roomListRef, $exitListRef, $cmdListRef, $reverseListRef); | ||
| 16470 | |||
| 16471 | # Check for improper arguments | ||
| 16472 | if (defined $check) { | ||
| 16473 | |||
| 16474 | return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_); | ||
| 16475 | } | ||
| 16476 | |||
| 16477 | # Tab setup, using the standard grid size | ||
| 16478 | my $grid = $self->addTab( | ||
| 16479 | $self->notebook, | ||
| 16480 | '_Summary', | ||
| 16481 | ['Shortest path summary'], | ||
| 16482 | ); | ||
| 16483 | |||
| 16484 | # Extract data from $self->editConfigHash, and use it to set initial values for the | ||
| 16485 | # non-standard IVs | ||
| 16486 | $roomListRef = $self->ivShow('editConfigHash', 'room_list'); | ||
| 16487 | $self->ivPoke('roomList', @$roomListRef); | ||
| 16488 | |||
| 16489 | $exitListRef = $self->ivShow('editConfigHash', 'exit_list'); | ||
| 16490 | $self->ivPoke('exitList', @$exitListRef); | ||
| 16491 | |||
| 16492 | $cmdListRef = $self->ivShow('editConfigHash', 'cmd_list'); | ||
| 16493 | $self->ivPoke('cmdList', @$cmdListRef); | ||
| 16494 | |||
| 16495 | $reverseListRef = $self->ivShow('editConfigHash', 'reverse_list'); | ||
| 16496 | $self->ivPoke('reverseCmdList', @$reverseListRef); | ||
| 16497 | |||
| 16498 | $self->ivPoke('initialRoomObj', $$roomListRef[0]); | ||
| 16499 | $self->ivPoke('targetRoomObj', $$roomListRef[-1]); | ||
| 16500 | |||
| 16501 | # Set up the rest of the tab | ||
| 16502 | $self->summaryTab($grid); | ||
| 16503 | |||
| 16504 | # Set up the remaining tabs | ||
| 16505 | $self->expandNotebook(); | ||
| 16506 | |||
| 16507 | # Tab complete | ||
| 16508 | return 1; | ||
| 16509 | } | ||
| 16510 | |||
| 16511 | sub expandNotebook { | ||
| 16512 | |||
| 16513 | # Called by $self->setupNotebook | ||
| 16514 | # Set up additional tabs for the notebook | ||
| 16515 | # | ||
| 16516 | # Expected arguments | ||
| 16517 | # (none besides $self) | ||
| 16518 | # | ||
| 16519 | # Return values | ||
| 16520 | # 'undef' on improper arguments | ||
| 16521 | # 1 otherwise | ||
| 16522 | |||
| 16523 | my ($self, $check) = @_; | ||
| 16524 | |||
| 16525 | # Check for improper arguments | ||
| 16526 | if (defined $check) { | ||
| 16527 | |||
| 16528 | return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_); | ||
| 16529 | } | ||
| 16530 | |||
| 16531 | $self->pathTab(); | ||
| 16532 | if ($self->reverseCmdList) { | ||
| 16533 | |||
| 16534 | $self->reversePathTab(); | ||
| 16535 | } | ||
| 16536 | |||
| 16537 | return 1; | ||
| 16538 | } | ||
| 16539 | |||
| 16540 | sub saveChanges { | ||
| 16541 | |||
| 16542 | # Called by $self->buttonOK | ||
| 16543 | # Unlike GA::Generic::EditWin, there is no Perl object in which we have to store IVs. This | ||
| 16544 | # function does nothing except to get called by the inherited functions | ||
| 16545 | # | ||
| 16546 | # Expected arguments | ||
| 16547 | # (none besides $self) | ||
| 16548 | # | ||
| 16549 | # Return values | ||
| 16550 | # 'undef' on improper arguments | ||
| 16551 | # 1 otherwise | ||
| 16552 | |||
| 16553 | my ($self, $check) = @_; | ||
| 16554 | |||
| 16555 | # Check for improper arguments | ||
| 16556 | if (defined $check) { | ||
| 16557 | |||
| 16558 | return $axmud::CLIENT->writeImproper($self->_objClass . '->saveChanges', @_); | ||
| 16559 | } | ||
| 16560 | |||
| 16561 | # Nothing to do | ||
| 16562 | return 1; | ||
| 16563 | } | ||
| 16564 | |||
| 16565 | # Notebook tabs | ||
| 16566 | |||
| 16567 | sub summaryTab { | ||
| 16568 | |||
| 16569 | # Summary tab | ||
| 16570 | # | ||
| 16571 | # Expected arguments | ||
| 16572 | # $grid - The Gtk3::Grid for this tab | ||
| 16573 | # | ||
| 16574 | # Return values | ||
| 16575 | # 'undef' on improper arguments | ||
| 16576 | # 1 otherwise | ||
| 16577 | |||
| 16578 | my ($self, $grid, $check) = @_; | ||
| 16579 | |||
| 16580 | # Local variables | ||
| 16581 | my @columnList; | ||
| 16582 | |||
| 16583 | # Check for improper arguments | ||
| 16584 | if (! defined $grid || defined $check) { | ||
| 16585 | |||
| 16586 | return $axmud::CLIENT->writeImproper($self->_objClass . '->summaryTab', @_); | ||
| 16587 | } | ||
| 16588 | |||
| 16589 | # Tab setup (already created by the calling function) | ||
| 16590 | |||
| 16591 | # Shortest path found | ||
| 16592 | $self->addLabel( | ||
| 16593 | $grid, | ||
| 16594 | '<b>Shortest path found in ' . $self->ivNumber('exitList') . ' steps</b>', | ||
| 16595 | 0, 12, 0, 1, | ||
| 16596 | ); | ||
| 16597 | |||
| 16598 | if ($self->reverseCmdList) { | ||
| 16599 | |||
| 16600 | $self->addLabel($grid, '<i>(Reverse path also found)</i>', | ||
| 16601 | 1, 12, 1, 2); | ||
| 16602 | |||
| 16603 | } else { | ||
| 16604 | |||
| 16605 | $self->addLabel($grid, '<i>(Reverse path not found)</i>', | ||
| 16606 | 1, 12, 1, 2); | ||
| 16607 | } | ||
| 16608 | |||
| 16609 | # Add a simple list | ||
| 16610 | @columnList = ( | ||
| 16611 | '#', 'text', | ||
| 16612 | 'Region', 'text', | ||
| 16613 | 'Room #', 'text', | ||
| 16614 | 'Room tag', 'text', | ||
| 16615 | 'Exit #', 'text', | ||
| 16616 | 'Nominal dir', 'text', | ||
| 16617 | ); | ||
| 16618 | |||
| 16619 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 16620 | 1, 12, 2, 10); | ||
| 16621 | |||
| 16622 | # Initialise the list | ||
| 16623 | $self->summaryTab_refreshList($slWidget, (scalar @columnList / 2)); | ||
| 16624 | |||
| 16625 | # Add editing buttons | ||
| 16626 | my $button = $self->addButton( | ||
| 16627 | $grid, | ||
| 16628 | 'Edit room...', | ||
| 16629 | 'Edit the selected room model object', | ||
| 16630 | undef, | ||
| 16631 | 8, 10, 10, 11, | ||
| 16632 | ); | ||
| 16633 | $button->signal_connect('clicked' => sub { | ||
| 16634 | |||
| 16635 | my ($roomNum, $roomObj); | ||
| 16636 | |||
| 16637 | ($roomNum) = $self->getSimpleListData($slWidget, 2); | ||
| 16638 | if (defined $roomNum) { | ||
| 16639 | |||
| 16640 | $roomObj = $self->session->worldModelObj->ivShow('modelHash', $roomNum); | ||
| 16641 | |||
| 16642 | # Open the room's 'edit' window | ||
| 16643 | $self->createFreeWin( | ||
| 16644 | 'Games::Axmud::EditWin::ModelObj::Room', | ||
| 16645 | $self, | ||
| 16646 | $self->session, | ||
| 16647 | 'Edit ' . $roomObj->category . ' model object #' . $roomObj->number, | ||
| 16648 | $roomObj, | ||
| 16649 | FALSE, # Not temporary | ||
| 16650 | ); | ||
| 16651 | } | ||
| 16652 | }); | ||
| 16653 | |||
| 16654 | my $button2 = $self->addButton( | ||
| 16655 | $grid, 'Edit exit...', 'Edit the selected exit object', undef, | ||
| 16656 | 10, 12, 10, 11); | ||
| 16657 | $button2->signal_connect('clicked' => sub { | ||
| 16658 | |||
| 16659 | my ($exitNum, $exitObj); | ||
| 16660 | |||
| 16661 | ($exitNum) = $self->getSimpleListData($slWidget, 4); | ||
| 16662 | if (defined $exitNum) { | ||
| 16663 | |||
| 16664 | $exitObj = $self->session->worldModelObj->ivShow('exitModelHash', $exitNum); | ||
| 16665 | |||
| 16666 | # Open up an 'edit' window to edit the object | ||
| 16667 | $self->createFreeWin( | ||
| 16668 | 'Games::Axmud::EditWin::Exit', | ||
| 16669 | $self, | ||
| 16670 | $self->session, | ||
| 16671 | 'Edit exit model object #' . $exitObj->number, | ||
| 16672 | $exitObj, | ||
| 16673 | FALSE, # Not temporary | ||
| 16674 | ); | ||
| 16675 | } | ||
| 16676 | }); | ||
| 16677 | |||
| 16678 | # Tab complete | ||
| 16679 | return 1; | ||
| 16680 | } | ||
| 16681 | |||
| 16682 | sub summaryTab_refreshList { | ||
| 16683 | |||
| 16684 | # Called by $self->summaryTab to refresh the GA::Obj::SimpleList | ||
| 16685 | # | ||
| 16686 | # Expected arguments | ||
| 16687 | # $slWidget - The GA::Obj::SimpleList | ||
| 16688 | # $columns - The number of columns in the list | ||
| 16689 | # | ||
| 16690 | # Return values | ||
| 16691 | # 'undef' on improper arguments | ||
| 16692 | # 1 otherwise | ||
| 16693 | |||
| 16694 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 16695 | |||
| 16696 | # Local variables | ||
| 16697 | my ( | ||
| 16698 | $count, | ||
| 16699 | @dataList, | ||
| 16700 | ); | ||
| 16701 | |||
| 16702 | # Check for improper arguments | ||
| 16703 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 16704 | |||
| 16705 | return $axmud::CLIENT->writeImproper($self->_objClass . '->summaryTab_refreshList', @_); | ||
| 16706 | } | ||
| 16707 | |||
| 16708 | # Compile the simple list data (these IVs are not saved to $self->editHash) | ||
| 16709 | $count = -1; | ||
| 16710 | foreach my $roomObj ($self->roomList) { | ||
| 16711 | |||
| 16712 | my ($regionObj, $regionName, $exitObj, $exitNum, $dir); | ||
| 16713 | |||
| 16714 | $count++; | ||
| 16715 | |||
| 16716 | if ($roomObj->parent) { | ||
| 16717 | |||
| 16718 | $regionObj = $self->session->worldModelObj->ivShow('modelHash', $roomObj->parent); | ||
| 16719 | $regionName = $regionObj->name; | ||
| 16720 | } | ||
| 16721 | |||
| 16722 | $exitObj = $self->ivIndex('exitList', $count); | ||
| 16723 | if ($exitObj) { | ||
| 16724 | |||
| 16725 | # $exitObj is undefined for the last spin of this loop | ||
| 16726 | $exitNum = $exitObj->number; | ||
| 16727 | $dir = $exitObj->dir; | ||
| 16728 | } | ||
| 16729 | |||
| 16730 | push (@dataList, | ||
| 16731 | $count + 1, | ||
| 16732 | $regionName, # May be 'undef' | ||
| 16733 | $roomObj->number, | ||
| 16734 | $roomObj->roomTag, # May be 'undef' | ||
| 16735 | $exitNum, # May be 'undef' | ||
| 16736 | $dir, # May be 'undef' | ||
| 16737 | ); | ||
| 16738 | } | ||
| 16739 | |||
| 16740 | # Reset the simple list | ||
| 16741 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 16742 | |||
| 16743 | return 1; | ||
| 16744 | } | ||
| 16745 | |||
| 16746 | sub pathTab { | ||
| 16747 | |||
| 16748 | # Path tab | ||
| 16749 | # | ||
| 16750 | # Expected arguments | ||
| 16751 | # (none besides $self) | ||
| 16752 | # | ||
| 16753 | # Return values | ||
| 16754 | # 'undef' on improper arguments | ||
| 16755 | # 1 otherwise | ||
| 16756 | |||
| 16757 | my ($self, $check) = @_; | ||
| 16758 | |||
| 16759 | # Check for improper arguments | ||
| 16760 | if (defined $check) { | ||
| 16761 | |||
| 16762 | return $axmud::CLIENT->writeImproper($self->_objClass . '->pathTab', @_); | ||
| 16763 | } | ||
| 16764 | |||
| 16765 | # Tab setup | ||
| 16766 | # N.B. No sub-headings | ||
| 16767 | my $grid = $self->addTab($self->notebook, '_Path'); | ||
| 16768 | |||
| 16769 | # Path | ||
| 16770 | $self->addLabel($grid, '<b>Path</b>', | ||
| 16771 | 0, 12, 0, 1); | ||
| 16772 | |||
| 16773 | $self->pathTab_addWidgets( | ||
| 16774 | $grid, | ||
| 16775 | $self->initialRoomObj->roomTag, | ||
| 16776 | $self->targetRoomObj->roomTag, | ||
| 16777 | $self->cmdList, | ||
| 16778 | ); | ||
| 16779 | |||
| 16780 | # Tab complete | ||
| 16781 | return 1; | ||
| 16782 | } | ||
| 16783 | |||
| 16784 | sub reversePathTab { | ||
| 16785 | |||
| 16786 | # ReversePath tab | ||
| 16787 | # | ||
| 16788 | # Expected arguments | ||
| 16789 | # (none besides $self) | ||
| 16790 | # | ||
| 16791 | # Return values | ||
| 16792 | # 'undef' on improper arguments | ||
| 16793 | # 1 otherwise | ||
| 16794 | |||
| 16795 | my ($self, $check) = @_; | ||
| 16796 | |||
| 16797 | # Check for improper arguments | ||
| 16798 | if (defined $check) { | ||
| 16799 | |||
| 16800 | return $axmud::CLIENT->writeImproper($self->_objClass . '->reversePathTab', @_); | ||
| 16801 | } | ||
| 16802 | |||
| 16803 | # Tab setup | ||
| 16804 | # N.B. No sub-headings | ||
| 16805 | my $grid = $self->addTab($self->notebook, '_Reverse path'); | ||
| 16806 | |||
| 16807 | # Reverse path | ||
| 16808 | $self->addLabel($grid, '<b>Reverse path</b>', | ||
| 16809 | 0, 12, 0, 1); | ||
| 16810 | |||
| 16811 | $self->pathTab_addWidgets( | ||
| 16812 | $grid, | ||
| 16813 | $self->targetRoomObj->roomTag, | ||
| 16814 | $self->initialRoomObj->roomTag, | ||
| 16815 | $self->reverseCmdList, | ||
| 16816 | ); | ||
| 16817 | |||
| 16818 | # Tab complete | ||
| 16819 | return 1; | ||
| 16820 | } | ||
| 16821 | |||
| 16822 | sub pathTab_addWidgets { | ||
| 16823 | |||
| 16824 | # Called by $self->pathTab and $self->reversePathTab | ||
| 16825 | # Adds common widgets to both tabs | ||
| 16826 | # | ||
| 16827 | # Expected arguments | ||
| 16828 | # $grid - The Gtk3::Grid for this tab | ||
| 16829 | # | ||
| 16830 | # Optional arguments | ||
| 16831 | # $roomTag, $otherRoomTag | ||
| 16832 | # - The room tags at each end of the path (may not exits) | ||
| 16833 | # @cmdList - A list of commands to move between them (from either $self->cmdList or | ||
| 16834 | # $self->reverseCmdList) | ||
| 16835 | # | ||
| 16836 | # Return values | ||
| 16837 | # 'undef' on improper arguments | ||
| 16838 | # 1 otherwise | ||
| 16839 | |||
| 16840 | my ($self, $grid, $roomTag, $otherRoomTag, @cmdList) = @_; | ||
| 16841 | |||
| 16842 | # Local variables | ||
| 16843 | my ( | ||
| 16844 | $worldString, | ||
| 16845 | @comboList, @profList, | ||
| 16846 | ); | ||
| 16847 | |||
| 16848 | # Check for improper arguments | ||
| 16849 | if (! defined $grid) { | ||
| 16850 | |||
| 16851 | return $axmud::CLIENT->writeImproper($self->_objClass . '->pathTab_addWidgets', @_); | ||
| 16852 | } | ||
| 16853 | |||
| 16854 | # Add widgets to the grid | ||
| 16855 | $self->addLabel($grid, '<i>Combined commands (copy the path from here)</i>', | ||
| 16856 | 1, 6, 1, 2); | ||
| 16857 | my $textView = $self->addTextView($grid, undef, FALSE, | ||
| 16858 | 1, 12, 2, 5, | ||
| 16859 | FALSE, # Don't treat as a list | ||
| 16860 | FALSE, # Don't remove empty lines | ||
| 16861 | TRUE, # ...but do remove leading/trailing whitespace | ||
| 16862 | FALSE, # Allow horizontal scrolling | ||
| 16863 | ); | ||
| 16864 | my $buffer = $textView->get_buffer(); | ||
| 16865 | $buffer->set_text(join($axmud::CLIENT->cmdSep, @cmdList)); | ||
| 16866 | |||
| 16867 | $self->addLabel($grid, '<i>Split commands (edit the path here)</i>', | ||
| 16868 | 1, 6, 5, 6); | ||
| 16869 | my $textView2 = $self->addTextView($grid, undef, TRUE, | ||
| 16870 | 1, 6, 6, 12, | ||
| 16871 | TRUE, # Treat as a list | ||
| 16872 | TRUE, # Remove empty lines | ||
| 16873 | TRUE, # Remove leading/trailing whitespace | ||
| 16874 | FALSE, # Allow horizontal scrolling | ||
| 16875 | ); | ||
| 16876 | my $buffer2 = $textView2->get_buffer(); | ||
| 16877 | $buffer2->set_text(join("\n", @cmdList)); | ||
| 16878 | |||
| 16879 | # Editing the second textview automatically updates the first one | ||
| 16880 | $buffer2->signal_connect('changed' => sub { | ||
| 16881 | |||
| 16882 | my ( | ||
| 16883 | $startIter, $endIter, $text, | ||
| 16884 | @lineList, | ||
| 16885 | ); | ||
| 16886 | |||
| 16887 | $startIter = $buffer2->get_start_iter(); | ||
| 16888 | $endIter = $buffer2->get_end_iter(); | ||
| 16889 | $text = $buffer2->get_text($startIter, $endIter, 1); | ||
| 16890 | |||
| 16891 | # Set the other textview's contents to match this one | ||
| 16892 | @lineList = split("\n", $text); | ||
| 16893 | $buffer->set_text(join($axmud::CLIENT->cmdSep, @lineList)); | ||
| 16894 | }); | ||
| 16895 | |||
| 16896 | $self->addLabel($grid, 'Initial tag', | ||
| 16897 | 7, 9, 6, 7); | ||
| 16898 | my $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 16899 | 9, 12, 6, 7); | ||
| 16900 | if ($roomTag) { | ||
| 16901 | |||
| 16902 | $entry->set_text($roomTag); | ||
| 16903 | } | ||
| 16904 | |||
| 16905 | $self->addLabel($grid, 'Target tag', | ||
| 16906 | 7, 9, 7, 8); | ||
| 16907 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 16908 | 9, 12, 7, 8); | ||
| 16909 | if ($otherRoomTag) { | ||
| 16910 | |||
| 16911 | $entry2->set_text($otherRoomTag); | ||
| 16912 | } | ||
| 16913 | |||
| 16914 | $self->addLabel($grid, 'Route type', | ||
| 16915 | 7, 9, 8, 9); | ||
| 16916 | @comboList = ('road', 'quick'); # Circuit routes can't be created here | ||
| 16917 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 16918 | TRUE, # No 'undef' value used | ||
| 16919 | 9, 12, 8, 9); | ||
| 16920 | |||
| 16921 | my $checkButton = $self->addCheckButton($grid, 'Hoppable', undef, TRUE, | ||
| 16922 | 9, 12, 9, 10); | ||
| 16923 | $checkButton->set_active(TRUE); | ||
| 16924 | |||
| 16925 | $self->addLabel($grid, 'Profile', | ||
| 16926 | 7, 9, 10, 11); | ||
| 16927 | # Get a list of non-world current profiles | ||
| 16928 | foreach my $category ($self->session->profPriorityList) { | ||
| 16929 | |||
| 16930 | my $profObj; | ||
| 16931 | |||
| 16932 | if ($category ne 'world' && $self->session->ivExists('currentProfHash', $category)) { | ||
| 16933 | |||
| 16934 | $profObj = $self->session->ivShow('currentProfHash', $category); | ||
| 16935 | push (@profList, $profObj->name); | ||
| 16936 | } | ||
| 16937 | } | ||
| 16938 | |||
| 16939 | # Default combo option is 'use current world' | ||
| 16940 | $worldString = '<use current world>'; | ||
| 16941 | push (@profList, $worldString); | ||
| 16942 | |||
| 16943 | # Reverse the list, so that it is in reverse-priority order (and so that 'use current world' | ||
| 16944 | # appears at the top) | ||
| 16945 | @profList = reverse @profList; | ||
| 16946 | |||
| 16947 | my $combo2 = $self->addComboBox($grid, undef, \@profList, '', | ||
| 16948 | TRUE, # No 'undef' value used | ||
| 16949 | 9, 12, 10, 11); | ||
| 16950 | |||
| 16951 | my $button = $self->addButton( | ||
| 16952 | $grid, | ||
| 16953 | 'Add pre-defined route', | ||
| 16954 | 'Create a pre-defined route using this path', | ||
| 16955 | undef, | ||
| 16956 | 7, 12, 11, 12, | ||
| 16957 | ); | ||
| 16958 | $button->set_sensitive(FALSE); # Button initially desensitised | ||
| 16959 | $button->signal_connect('clicked' => sub { | ||
| 16960 | |||
| 16961 | my ($initialTag, $targetTag, $routeType, $flag, $profName, $cmd, $pathText); | ||
| 16962 | |||
| 16963 | # Only create a route if both entry boxes are full | ||
| 16964 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 16965 | |||
| 16966 | $initialTag = $entry->get_text(); | ||
| 16967 | $targetTag = $entry2->get_text(); | ||
| 16968 | $routeType = $combo->get_active_text(); | ||
| 16969 | $flag = $checkButton->get_active(); | ||
| 16970 | $profName = $combo2->get_active_text(); | ||
| 16971 | |||
| 16972 | # Use the edited (not necessarily the original) path | ||
| 16973 | $pathText = $axmud::CLIENT->desktopObj->bufferGetText($buffer); | ||
| 16974 | |||
| 16975 | # Prepare the client command | ||
| 16976 | $cmd = 'addroute <' . $initialTag . '> <' . $targetTag . '> <' . $pathText . '>'; | ||
| 16977 | |||
| 16978 | if ($routeType eq 'quick') { | ||
| 16979 | $cmd .= ' -q'; | ||
| 16980 | } else { | ||
| 16981 | $cmd .= ' -o'; # Road route | ||
| 16982 | } | ||
| 16983 | |||
| 16984 | if ($profName ne $worldString) { | ||
| 16985 | |||
| 16986 | $cmd .= ' -d ' . $profName; | ||
| 16987 | } | ||
| 16988 | |||
| 16989 | if (! $flag) { | ||
| 16990 | |||
| 16991 | $cmd .= ' -h'; | ||
| 16992 | } | ||
| 16993 | |||
| 16994 | # Create the GA::Obj::Route | ||
| 16995 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 16996 | } | ||
| 16997 | }); | ||
| 16998 | |||
| 16999 | # The 'Add pre-defined route' button should be desensitised when $entry and $entry2 contain | ||
| 17000 | # unacceptable text | ||
| 17001 | $entry->signal_connect('changed' => sub { | ||
| 17002 | |||
| 17003 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 17004 | $button->set_sensitive(TRUE); | ||
| 17005 | } else { | ||
| 17006 | $button->set_sensitive(FALSE); | ||
| 17007 | } | ||
| 17008 | }); | ||
| 17009 | $entry2->signal_connect('changed' => sub { | ||
| 17010 | |||
| 17011 | if ($self->checkEntryIcon($entry, $entry2)) { | ||
| 17012 | $button->set_sensitive(TRUE); | ||
| 17013 | } else { | ||
| 17014 | $button->set_sensitive(FALSE); | ||
| 17015 | } | ||
| 17016 | }); | ||
| 17017 | |||
| 17018 | my $button2 = $self->addButton( | ||
| 17019 | $grid, | ||
| 17020 | 'Abbreviate', | ||
| 17021 | 'Abbreviate the directions displayed in this tab', | ||
| 17022 | undef, | ||
| 17023 | 7, 10, 1, 2, | ||
| 17024 | ); | ||
| 17025 | $button2->signal_connect('clicked' => sub { | ||
| 17026 | |||
| 17027 | my ( | ||
| 17028 | $dictObj, $startIter, $endIter, $text, | ||
| 17029 | @lineList, @newList, | ||
| 17030 | ); | ||
| 17031 | |||
| 17032 | # Import the session's current dictionary (for convenience) | ||
| 17033 | $dictObj = $self->session->currentDict; | ||
| 17034 | |||
| 17035 | # Get a list of directions from the second textview | ||
| 17036 | $startIter = $buffer2->get_start_iter(); | ||
| 17037 | $endIter = $buffer2->get_end_iter(); | ||
| 17038 | $text = $buffer2->get_text($startIter, $endIter, 1); | ||
| 17039 | |||
| 17040 | @lineList = split("\n", $text); | ||
| 17041 | |||
| 17042 | # Abbreviate each direction, if possible | ||
| 17043 | foreach my $cmd (@lineList) { | ||
| 17044 | |||
| 17045 | my $abbrevDir = $dictObj->abbrevDir($cmd); | ||
| 17046 | |||
| 17047 | if ($abbrevDir) { | ||
| 17048 | push (@newList, $abbrevDir); | ||
| 17049 | } else { | ||
| 17050 | push (@newList, $cmd); | ||
| 17051 | } | ||
| 17052 | } | ||
| 17053 | |||
| 17054 | # Update each textview | ||
| 17055 | $buffer->set_text(join($axmud::CLIENT->cmdSep, @newList)); | ||
| 17056 | $buffer2->set_text(join("\n", @newList)); | ||
| 17057 | }); | ||
| 17058 | |||
| 17059 | my $button3 = $self->addButton( | ||
| 17060 | $grid, | ||
| 17061 | 'Unabbreviate', | ||
| 17062 | 'Unabbreviate the directions displayed in this tab', | ||
| 17063 | undef, | ||
| 17064 | 10, 12, 1, 2, | ||
| 17065 | ); | ||
| 17066 | $button3->signal_connect('clicked' => sub { | ||
| 17067 | |||
| 17068 | my ( | ||
| 17069 | $dictObj, $startIter, $endIter, $text, | ||
| 17070 | @lineList, @newList, | ||
| 17071 | ); | ||
| 17072 | |||
| 17073 | # Import the session's current dictionary (for convenience) | ||
| 17074 | $dictObj = $self->session->currentDict; | ||
| 17075 | |||
| 17076 | # Get a list of directions from the second textview | ||
| 17077 | $startIter = $buffer2->get_start_iter(); | ||
| 17078 | $endIter = $buffer2->get_end_iter(); | ||
| 17079 | $text = $buffer2->get_text($startIter, $endIter, 1); | ||
| 17080 | |||
| 17081 | @lineList = split("\n", $text); | ||
| 17082 | |||
| 17083 | # Unabbreviate each direction, if possible | ||
| 17084 | foreach my $cmd (@lineList) { | ||
| 17085 | |||
| 17086 | push (@newList, $dictObj->unabbrevDir($cmd)); | ||
| 17087 | } | ||
| 17088 | |||
| 17089 | # Update each textview | ||
| 17090 | $buffer->set_text(join($axmud::CLIENT->cmdSep, @newList)); | ||
| 17091 | $buffer2->set_text(join("\n", @newList)); | ||
| 17092 | }); | ||
| 17093 | |||
| 17094 | return 1; | ||
| 17095 | } | ||
| 17096 | |||
| 17097 | ################## | ||
| 17098 | # Accessors - set | ||
| 17099 | |||
| 17100 | ################## | ||
| 17101 | # Accessors - get | ||
| 17102 | |||
| 17103 | sub roomList | ||
| 17104 | { my $self = shift; return @{$self->{roomList}}; } | ||
| 17105 | sub initialRoomObj | ||
| 17106 | { $_[0]->{initialRoomObj} } | ||
| 17107 | sub targetRoomObj | ||
| 17108 | { $_[0]->{targetRoomObj} } | ||
| 17109 | |||
| 17110 | sub exitList | ||
| 17111 | { my $self = shift; return @{$self->{exitList}}; } | ||
| 17112 | sub cmdList | ||
| 17113 | { my $self = shift; return @{$self->{cmdList}}; } | ||
| 17114 | sub reverseCmdList | ||
| 17115 | { my $self = shift; return @{$self->{reverseCmdList}}; } | ||
| 17116 | } | ||
| 17117 | |||
| 17118 | { package Games::Axmud::PrefWin::Quick; | ||
| 17119 | |||
| 17120 | use strict; | ||
| 17121 | use warnings; | ||
| 17122 | # use diagnostics; | ||
| 17123 | |||
| 17124 | use Glib qw(TRUE FALSE); | ||
| 17125 | |||
| 17126 | our @ISA = qw( | ||
| 17127 | Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin | ||
| 17128 | Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud | ||
| 17129 | ); | ||
| 17130 | |||
| 17131 | ################## | ||
| 17132 | # Constructors | ||
| 17133 | |||
| 17134 | # Contents of $self->editConfigHash after $self->new has been called: | ||
| 17135 | # (none) | ||
| 17136 | |||
| 17137 | # sub new {} # Inherited from GA::Generic::ConfigWin | ||
| 17138 | |||
| 17139 | ################## | ||
| 17140 | # Methods | ||
| 17141 | |||
| 17142 | # Standard window object functions | ||
| 17143 | |||
| 17144 | # sub winSetup {} # Inherited from GA::Generic::ConfigWin | ||
| 17145 | |||
| 17146 | # sub winEnable {} # Inherited from GA::Generic::ConfigWin | ||
| 17147 | |||
| 17148 | # sub winDesengage {} # Inherited from GA::Generic::FreeWin | ||
| 17149 | |||
| 17150 | # sub winDestroy {} # Inherited from GA::Generic::FreeWin | ||
| 17151 | |||
| 17152 | # sub winShowAll {} # Inherited from GA::Generic::Win | ||
| 17153 | |||
| 17154 | # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin | ||
| 17155 | |||
| 17156 | # sub redrawWidgets {} # Inherited from GA::Generic::Win | ||
| 17157 | |||
| 17158 | # ->signal_connects | ||
| 17159 | |||
| 17160 | # Other functions | ||
| 17161 | |||
| 17162 | # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin | ||
| 17163 | |||
| 17164 | sub enableButtons { | ||
| 17165 | |||
| 17166 | # Called by $self->drawWidgets | ||
| 17167 | # We only need a single button so, instead of calling the generic ->enableButtons, call a | ||
| 17168 | # method that creates just one button | ||
| 17169 | # | ||
| 17170 | # Expected arguments | ||
| 17171 | # $hBox - The horizontal packing box in which the buttons live (not yet stored as | ||
| 17172 | # an IV) | ||
| 17173 | # | ||
| 17174 | # Return values | ||
| 17175 | # An empty list on improper arguments | ||
| 17176 | # Otherwise, a list containing the Gtk::Button object created | ||
| 17177 | |||
| 17178 | my ($self, $hBox, $check) = @_; | ||
| 17179 | |||
| 17180 | # Local variables | ||
| 17181 | my @emptyList; | ||
| 17182 | |||
| 17183 | # Check for improper arguments | ||
| 17184 | if (! defined $hBox || defined $check) { | ||
| 17185 | |||
| 17186 | $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_); | ||
| 17187 | return @emptyList; | ||
| 17188 | } | ||
| 17189 | |||
| 17190 | return $self->enableSingleButton($hBox); | ||
| 17191 | } | ||
| 17192 | |||
| 17193 | # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin | ||
| 17194 | |||
| 17195 | sub setupNotebook { | ||
| 17196 | |||
| 17197 | # Called by $self->enable | ||
| 17198 | # Creates the first tab for the notebook. The remaining tabs are created by | ||
| 17199 | # $self->expandNotebook | ||
| 17200 | # | ||
| 17201 | # Expected arguments | ||
| 17202 | # (none besides $self) | ||
| 17203 | # | ||
| 17204 | # Return values | ||
| 17205 | # 'undef' on improper arguments | ||
| 17206 | # 1 otherwise | ||
| 17207 | |||
| 17208 | my ($self, $check) = @_; | ||
| 17209 | |||
| 17210 | # Check for improper arguments | ||
| 17211 | if (defined $check) { | ||
| 17212 | |||
| 17213 | return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_); | ||
| 17214 | } | ||
| 17215 | |||
| 17216 | # Tab setup (already created by the calling function) | ||
| 17217 | |||
| 17218 | # Set up the rest of the first tab (all of it, in this case) | ||
| 17219 | $self->shortcutTab(); | ||
| 17220 | |||
| 17221 | # Set up the remaining tabs | ||
| 17222 | $self->expandNotebook(); | ||
| 17223 | |||
| 17224 | # Tab complete | ||
| 17225 | return 1; | ||
| 17226 | } | ||
| 17227 | |||
| 17228 | sub expandNotebook { | ||
| 17229 | |||
| 17230 | # Called by $self->setupNotebook | ||
| 17231 | # Set up additional tabs for the notebook | ||
| 17232 | # | ||
| 17233 | # Expected arguments | ||
| 17234 | # (none besides $self) | ||
| 17235 | # | ||
| 17236 | # Return values | ||
| 17237 | # 'undef' on improper arguments | ||
| 17238 | # 1 otherwise | ||
| 17239 | |||
| 17240 | my ($self, $check) = @_; | ||
| 17241 | |||
| 17242 | # Check for improper arguments | ||
| 17243 | if (defined $check) { | ||
| 17244 | |||
| 17245 | return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_); | ||
| 17246 | } | ||
| 17247 | |||
| 17248 | $self->autoSaveTab(); | ||
| 17249 | $self->charSetTab(); | ||
| 17250 | $self->coloursFontsTab(); | ||
| 17251 | $self->commandsTab(); | ||
| 17252 | $self->logsTab(); | ||
| 17253 | $self->soundTab(); | ||
| 17254 | $self->speechTab(); | ||
| 17255 | $self->windowsTab(); | ||
| 17256 | |||
| 17257 | return 1; | ||
| 17258 | } | ||
| 17259 | |||
| 17260 | # sub saveChanges {} # Inherited from GA::Generic::ConfigWin | ||
| 17261 | |||
| 17262 | # Notebook tabs | ||
| 17263 | |||
| 17264 | sub shortcutTab { | ||
| 17265 | |||
| 17266 | # Shortcut tab | ||
| 17267 | # | ||
| 17268 | # Expected arguments | ||
| 17269 | # (none besides $self) | ||
| 17270 | # | ||
| 17271 | # Return values | ||
| 17272 | # 'undef' on improper arguments | ||
| 17273 | # 1 otherwise | ||
| 17274 | |||
| 17275 | my ($self, $check) = @_; | ||
| 17276 | |||
| 17277 | # Check for improper arguments | ||
| 17278 | if (defined $check) { | ||
| 17279 | |||
| 17280 | return $axmud::CLIENT->writeImproper($self->_objClass . '->shortcutTab', @_); | ||
| 17281 | } | ||
| 17282 | |||
| 17283 | # Tab setup | ||
| 17284 | my $grid = $self->addTab( | ||
| 17285 | $self->notebook, | ||
| 17286 | '_Shortcuts', | ||
| 17287 | ['Shortcuts to other windows'], | ||
| 17288 | ); | ||
| 17289 | |||
| 17290 | # Shortcuts to other windows | ||
| 17291 | $self->addLabel($grid, '<b>Shortcuts to other windows</b>', | ||
| 17292 | 0, 12, 0, 1); | ||
| 17293 | |||
| 17294 | $self->addLabel($grid, '<i>Preference windows</i>', | ||
| 17295 | 1, 12, 1, 2); | ||
| 17296 | |||
| 17297 | my $button = $self->addButton($grid, | ||
| 17298 | 'Open client preferences', 'Opens the client preference window', undef, | ||
| 17299 | 1, 6, 2, 3); | ||
| 17300 | $button->signal_connect('clicked' => sub { | ||
| 17301 | |||
| 17302 | $self->session->pseudoCmd('editclient', $self->pseudoCmdMode); | ||
| 17303 | }); | ||
| 17304 | |||
| 17305 | my $button2 = $self->addButton($grid, | ||
| 17306 | 'Open session preferences', 'Opens the session preference window', undef, | ||
| 17307 | 6, 12, 2, 3); | ||
| 17308 | $button2->signal_connect('clicked' => sub { | ||
| 17309 | |||
| 17310 | $self->session->pseudoCmd('editsession', $self->pseudoCmdMode); | ||
| 17311 | }); | ||
| 17312 | |||
| 17313 | $self->addLabel($grid, '<i>Edit windows for profiles</i>', | ||
| 17314 | 1, 12, 3, 4); | ||
| 17315 | |||
| 17316 | my $button3 = $self->addButton($grid, | ||
| 17317 | 'Edit current world', 'Opens an edit window for the current world profile', undef, | ||
| 17318 | 1, 6, 4, 5); | ||
| 17319 | $button3->signal_connect('clicked' => sub { | ||
| 17320 | |||
| 17321 | $self->session->pseudoCmd('editworld', $self->pseudoCmdMode); | ||
| 17322 | }); | ||
| 17323 | |||
| 17324 | my $button4 = $self->addButton($grid, | ||
| 17325 | 'Edit current guild', 'Opens an edit window for the current guild profile', undef, | ||
| 17326 | 6, 12, 4, 5); | ||
| 17327 | $button4->signal_connect('clicked' => sub { | ||
| 17328 | |||
| 17329 | $self->session->pseudoCmd('editguild', $self->pseudoCmdMode); | ||
| 17330 | }); | ||
| 17331 | |||
| 17332 | my $button5 = $self->addButton($grid, | ||
| 17333 | 'Edit current race', 'Opens an edit window for the current race profile', undef, | ||
| 17334 | 1, 6, 5, 6); | ||
| 17335 | $button5->signal_connect('clicked' => sub { | ||
| 17336 | |||
| 17337 | $self->session->pseudoCmd('editrace', $self->pseudoCmdMode); | ||
| 17338 | }); | ||
| 17339 | |||
| 17340 | my $button6 = $self->addButton($grid, | ||
| 17341 | 'Edit current character', 'Opens an edit window for the current char profile', undef, | ||
| 17342 | 6, 12, 5, 6); | ||
| 17343 | $button6->signal_connect('clicked' => sub { | ||
| 17344 | |||
| 17345 | $self->session->pseudoCmd('editchar', $self->pseudoCmdMode); | ||
| 17346 | }); | ||
| 17347 | |||
| 17348 | $self->addLabel($grid, '<i>Edit windows for other data</i>', | ||
| 17349 | 1, 12, 6, 7); | ||
| 17350 | |||
| 17351 | my $button7 = $self->addButton($grid, | ||
| 17352 | 'Edit current dictionary', 'Opens an edit window for the current dictionary', undef, | ||
| 17353 | 1, 6, 7, 8); | ||
| 17354 | $button7->signal_connect('clicked' => sub { | ||
| 17355 | |||
| 17356 | $self->session->pseudoCmd('editdictionary', $self->pseudoCmdMode); | ||
| 17357 | }); | ||
| 17358 | |||
| 17359 | my $button8 = $self->addButton($grid, | ||
| 17360 | 'Edit world model', 'Opens an edit window for the current world model', undef, | ||
| 17361 | 6, 12, 7, 8); | ||
| 17362 | $button8->signal_connect('clicked' => sub { | ||
| 17363 | |||
| 17364 | $self->session->pseudoCmd('editmodel', $self->pseudoCmdMode); | ||
| 17365 | }); | ||
| 17366 | |||
| 17367 | $self->addLabel($grid, '<i>Current world\'s interfaces</i>', | ||
| 17368 | 1, 12, 8, 9); | ||
| 17369 | |||
| 17370 | my $button9 = $self->addButton($grid, | ||
| 17371 | 'Edit triggers', 'Edits the current world\'s trigger cage', undef, | ||
| 17372 | 1, 3, 9, 10); | ||
| 17373 | $button9->signal_connect('clicked' => sub { | ||
| 17374 | |||
| 17375 | $self->session->pseudoCmd('editcage -t', $self->pseudoCmdMode); | ||
| 17376 | }); | ||
| 17377 | |||
| 17378 | my $button10 = $self->addButton($grid, | ||
| 17379 | 'Edit aliases', 'Edits the current world\'s alias cage', undef, | ||
| 17380 | 3, 5, 9, 10); | ||
| 17381 | $button10->signal_connect('clicked' => sub { | ||
| 17382 | |||
| 17383 | $self->session->pseudoCmd('editcage -a', $self->pseudoCmdMode); | ||
| 17384 | }); | ||
| 17385 | |||
| 17386 | my $button11 = $self->addButton($grid, | ||
| 17387 | 'Edit macros', 'Edits the current world\'s macro cage', undef, | ||
| 17388 | 5, 7, 9, 10); | ||
| 17389 | $button11->signal_connect('clicked' => sub { | ||
| 17390 | |||
| 17391 | $self->session->pseudoCmd('editcage -m', $self->pseudoCmdMode); | ||
| 17392 | }); | ||
| 17393 | |||
| 17394 | my $button12 = $self->addButton($grid, | ||
| 17395 | 'Edit timers', 'Edits the current world\'s timer cage', undef, | ||
| 17396 | 7, 9, 9, 10); | ||
| 17397 | $button12->signal_connect('clicked' => sub { | ||
| 17398 | |||
| 17399 | $self->session->pseudoCmd('editcage -i', $self->pseudoCmdMode); | ||
| 17400 | }); | ||
| 17401 | |||
| 17402 | my $button13 = $self->addButton($grid, | ||
| 17403 | 'Edit hooks', 'Edits the current world\'s hook cage', undef, | ||
| 17404 | 9, 12, 9, 10); | ||
| 17405 | $button13->signal_connect('clicked' => sub { | ||
| 17406 | |||
| 17407 | $self->session->pseudoCmd('editcage -h', $self->pseudoCmdMode); | ||
| 17408 | }); | ||
| 17409 | |||
| 17410 | $self->addLabel($grid, '<i>Other windows</i>', | ||
| 17411 | 1, 12, 10, 11); | ||
| 17412 | |||
| 17413 | my $button14 = $self->addButton($grid, | ||
| 17414 | 'Open automapper', 'Opens the automapper window', undef, | ||
| 17415 | 1, 4, 11, 12); | ||
| 17416 | $button14->signal_connect('clicked' => sub { | ||
| 17417 | |||
| 17418 | $self->session->pseudoCmd('openautomapper', $self->pseudoCmdMode); | ||
| 17419 | }); | ||
| 17420 | |||
| 17421 | my $button15 = $self->addButton($grid, | ||
| 17422 | 'Open data viewer', 'Opens the data viewer window', undef, | ||
| 17423 | 4, 8, 11, 12); | ||
| 17424 | $button15->signal_connect('clicked' => sub { | ||
| 17425 | |||
| 17426 | $self->session->pseudoCmd('opendataviewer', $self->pseudoCmdMode); | ||
| 17427 | }); | ||
| 17428 | |||
| 17429 | my $button16 = $self->addButton($grid, | ||
| 17430 | 'Open Locator wizard', 'Opens the Locator wizard window', undef, | ||
| 17431 | 8, 12, 11, 12); | ||
| 17432 | $button16->signal_connect('clicked' => sub { | ||
| 17433 | |||
| 17434 | $self->session->pseudoCmd('locatorwizard', $self->pseudoCmdMode); | ||
| 17435 | }); | ||
| 17436 | |||
| 17437 | my $button17 = $self->addButton($grid, | ||
| 17438 | 'Open About window', 'Opens the About window', undef, | ||
| 17439 | 1, 6, 12, 13); | ||
| 17440 | $button17->signal_connect('clicked' => sub { | ||
| 17441 | |||
| 17442 | $self->session->pseudoCmd('openaboutwindow', $self->pseudoCmdMode); | ||
| 17443 | }); | ||
| 17444 | |||
| 17445 | my $button18 = $self->addButton($grid, | ||
| 17446 | 'Open Pattern Test window', 'Opens the Pattern Test window', undef, | ||
| 17447 | 6, 12, 12, 13); | ||
| 17448 | $button18->signal_connect('clicked' => sub { | ||
| 17449 | |||
| 17450 | $self->session->pseudoCmd('testpattern', $self->pseudoCmdMode); | ||
| 17451 | }); | ||
| 17452 | |||
| 17453 | # Tab complete | ||
| 17454 | return 1; | ||
| 17455 | } | ||
| 17456 | |||
| 17457 | sub autoSaveTab { | ||
| 17458 | |||
| 17459 | # Auto-save tab | ||
| 17460 | # | ||
| 17461 | # Expected arguments | ||
| 17462 | # (none besides $self) | ||
| 17463 | # | ||
| 17464 | # Return values | ||
| 17465 | # 'undef' on improper arguments | ||
| 17466 | # 1 otherwise | ||
| 17467 | |||
| 17468 | my ($self, $check) = @_; | ||
| 17469 | |||
| 17470 | # Check for improper arguments | ||
| 17471 | if (defined $check) { | ||
| 17472 | |||
| 17473 | return $axmud::CLIENT->writeImproper($self->_objClass . '->autoSaveTab', @_); | ||
| 17474 | } | ||
| 17475 | |||
| 17476 | # Tab setup | ||
| 17477 | my $grid = $self->addTab( | ||
| 17478 | $self->notebook, | ||
| 17479 | '_Auto-save', | ||
| 17480 | ['Auto-save settings'], | ||
| 17481 | ); | ||
| 17482 | |||
| 17483 | # Auto-save settings | ||
| 17484 | $self->addLabel($grid, '<b>Auto-save settings</b>', | ||
| 17485 | 0, 12, 0, 1); | ||
| 17486 | |||
| 17487 | $self->addLabel($grid, 'Enable auto-saves', | ||
| 17488 | 1, 4, 1, 2); | ||
| 17489 | |||
| 17490 | my $button = $self->addButton($grid, | ||
| 17491 | 'Turn on', 'Turns autosaves on', undef, | ||
| 17492 | 4, 6, 1, 2); | ||
| 17493 | # ->signal_connect appears below | ||
| 17494 | |||
| 17495 | |||
| 17496 | my $button2 = $self->addButton($grid, | ||
| 17497 | 'Turn off', 'Turns autosaves off', undef, | ||
| 17498 | 6, 8, 1, 2); | ||
| 17499 | # ->signal_connect appears below | ||
| 17500 | |||
| 17501 | my $checkButton = $self->addCheckButton($grid, 'Turned on', undef, FALSE, | ||
| 17502 | 9, 12, 1, 2); | ||
| 17503 | $checkButton->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 17504 | |||
| 17505 | $self->addLabel($grid, 'Time interval (minutes)', | ||
| 17506 | 1, 4, 2, 3); | ||
| 17507 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef, | ||
| 17508 | 4, 6, 2, 3, | ||
| 17509 | 8, 8); | ||
| 17510 | $entry3->set_text($axmud::CLIENT->autoSaveWaitTime); | ||
| 17511 | |||
| 17512 | my $button3 = $self->addButton($grid, | ||
| 17513 | 'Set interval', 'Set the time between successive auto-saves', undef, | ||
| 17514 | 6, 8, 2, 3); | ||
| 17515 | # ->signal_connect appears below | ||
| 17516 | |||
| 17517 | # ->signal_connects from above | ||
| 17518 | $button->signal_connect('clicked' => sub { | ||
| 17519 | |||
| 17520 | # Turn autosave on | ||
| 17521 | $self->session->pseudoCmd('autosave on', $self->pseudoCmdMode); | ||
| 17522 | |||
| 17523 | # Update the checkbutton | ||
| 17524 | $checkButton->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 17525 | }); | ||
| 17526 | |||
| 17527 | $button2->signal_connect('clicked' => sub { | ||
| 17528 | |||
| 17529 | # Turn autosave off | ||
| 17530 | $self->session->pseudoCmd('autosave off', $self->pseudoCmdMode); | ||
| 17531 | |||
| 17532 | # Update the checkbutton | ||
| 17533 | $checkButton->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 17534 | }); | ||
| 17535 | |||
| 17536 | $button3->signal_connect('clicked' => sub { | ||
| 17537 | |||
| 17538 | if ($self->checkEntryIcon($entry3)) { | ||
| 17539 | |||
| 17540 | # Set autosave time | ||
| 17541 | $self->session->pseudoCmd('autosave ' . $entry3->get_text(), $self->pseudoCmdMode); | ||
| 17542 | |||
| 17543 | # Update the checkbutton | ||
| 17544 | $checkButton->set_active($axmud::CLIENT->autoSaveFlag); | ||
| 17545 | } | ||
| 17546 | }); | ||
| 17547 | |||
| 17548 | # Tab complete | ||
| 17549 | return 1; | ||
| 17550 | } | ||
| 17551 | |||
| 17552 | sub charSetTab { | ||
| 17553 | |||
| 17554 | # CharSet tab | ||
| 17555 | # | ||
| 17556 | # Expected arguments | ||
| 17557 | # (none besides $self) | ||
| 17558 | # | ||
| 17559 | # Return values | ||
| 17560 | # 'undef' on improper arguments | ||
| 17561 | # 1 otherwise | ||
| 17562 | |||
| 17563 | my ($self, $check) = @_; | ||
| 17564 | |||
| 17565 | # Local variables | ||
| 17566 | my (@setList, @comboList); | ||
| 17567 | |||
| 17568 | # Check for improper arguments | ||
| 17569 | if (defined $check) { | ||
| 17570 | |||
| 17571 | return $axmud::CLIENT->writeImproper($self->_objClass . '->charSetTab', @_); | ||
| 17572 | } | ||
| 17573 | |||
| 17574 | # Tab setup | ||
| 17575 | my $grid = $self->addTab( | ||
| 17576 | $self->notebook, | ||
| 17577 | 'C_harset', | ||
| 17578 | ['Character set settings'], | ||
| 17579 | ); | ||
| 17580 | |||
| 17581 | # Character set settings | ||
| 17582 | $self->addLabel($grid, '<b>Character set settings</b>', | ||
| 17583 | 0, 12, 0, 1); | ||
| 17584 | |||
| 17585 | $self->addLabel($grid, 'Default character set (for incoming text)', | ||
| 17586 | 1, 6, 1, 2); | ||
| 17587 | |||
| 17588 | @setList = $axmud::CLIENT->charSetList; | ||
| 17589 | # (Find the current character set, and put it at the top of the list) | ||
| 17590 | foreach my $item (@setList) { | ||
| 17591 | |||
| 17592 | if ($item ne $axmud::CLIENT->charSet) { | ||
| 17593 | |||
| 17594 | push (@comboList, $item); | ||
| 17595 | } | ||
| 17596 | } | ||
| 17597 | |||
| 17598 | unshift(@comboList, $axmud::CLIENT->charSet); | ||
| 17599 | |||
| 17600 | my $comboBox = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 17601 | TRUE, # No 'undef' value used | ||
| 17602 | 6, 12, 1, 2); | ||
| 17603 | $comboBox->signal_connect('changed' => sub { | ||
| 17604 | |||
| 17605 | my ($choice, $index); | ||
| 17606 | |||
| 17607 | $choice = $comboBox->get_active_text(); | ||
| 17608 | if ($choice) { | ||
| 17609 | |||
| 17610 | $self->session->pseudoCmd( | ||
| 17611 | 'setcharset -d ' . $choice, | ||
| 17612 | $self->pseudoCmdMode, | ||
| 17613 | ); | ||
| 17614 | } | ||
| 17615 | }); | ||
| 17616 | |||
| 17617 | # Tab complete | ||
| 17618 | return 1; | ||
| 17619 | } | ||
| 17620 | |||
| 17621 | sub coloursFontsTab { | ||
| 17622 | |||
| 17623 | # ColoursFonts tab | ||
| 17624 | # | ||
| 17625 | # Expected arguments | ||
| 17626 | # (none besides $self) | ||
| 17627 | # | ||
| 17628 | # Return values | ||
| 17629 | # 'undef' on improper arguments | ||
| 17630 | # 1 otherwise | ||
| 17631 | |||
| 17632 | my ($self, $check) = @_; | ||
| 17633 | |||
| 17634 | # Local variables | ||
| 17635 | my ($mainObj, $customObj); | ||
| 17636 | |||
| 17637 | # Check for improper arguments | ||
| 17638 | if (defined $check) { | ||
| 17639 | |||
| 17640 | return $axmud::CLIENT->writeImproper($self->_objClass . '->coloursFontsTab', @_); | ||
| 17641 | } | ||
| 17642 | |||
| 17643 | # Tab setup | ||
| 17644 | my $grid = $self->addTab( | ||
| 17645 | $self->notebook, | ||
| 17646 | '_Colours/Fonts', | ||
| 17647 | ['Colour/font settings'], | ||
| 17648 | ); | ||
| 17649 | |||
| 17650 | # Import colour schemes | ||
| 17651 | $mainObj = $axmud::CLIENT->ivShow('colourSchemeHash', 'main'); | ||
| 17652 | $customObj = $axmud::CLIENT->ivShow('colourSchemeHash', 'custom'); | ||
| 17653 | |||
| 17654 | # Colour/font settings | ||
| 17655 | $self->addLabel($grid, '<b>Colour/font settings</b>', | ||
| 17656 | 0, 12, 0, 1); | ||
| 17657 | |||
| 17658 | my $button = $self->addButton($grid, | ||
| 17659 | 'Set the colours / fonts used in \'main\' windows', | ||
| 17660 | 'Edit the colour scheme \'main\'', | ||
| 17661 | undef, | ||
| 17662 | 1, 12, 1, 2); | ||
| 17663 | $button->signal_connect('clicked' => sub { | ||
| 17664 | |||
| 17665 | $self->session->pseudoCmd('editcolourscheme main'); | ||
| 17666 | }); | ||
| 17667 | |||
| 17668 | my $button2 = $self->addButton($grid, | ||
| 17669 | 'Set the colours / fonts used in (most) task windows', | ||
| 17670 | 'Edit the colour scheme \'custom\'', | ||
| 17671 | undef, | ||
| 17672 | 1, 12, 2, 3); | ||
| 17673 | $button2->signal_connect('clicked' => sub { | ||
| 17674 | |||
| 17675 | $self->session->pseudoCmd('editcolourscheme custom'); | ||
| 17676 | }); | ||
| 17677 | |||
| 17678 | my $checkButton = $self->addCheckButton( | ||
| 17679 | $grid, | ||
| 17680 | 'Convert invisible text (i.e. text that\'s the same colour as the background)', | ||
| 17681 | undef, | ||
| 17682 | TRUE, | ||
| 17683 | 1, 12, 3, 4); | ||
| 17684 | $checkButton->set_active($axmud::CLIENT->convertInvisibleFlag); | ||
| 17685 | $checkButton->signal_connect('toggled' => sub { | ||
| 17686 | |||
| 17687 | my $flag = $checkButton->get_active(); | ||
| 17688 | |||
| 17689 | if ( | ||
| 17690 | (! $flag && ! $axmud::CLIENT->convertInvisibleFlag) | ||
| 17691 | || ($flag && $axmud::CLIENT->convertInvisibleFlag) | ||
| 17692 | ) { | ||
| 17693 | $self->session->pseudoCmd('convertText'); | ||
| 17694 | } | ||
| 17695 | }); | ||
| 17696 | |||
| 17697 | # Tab complete | ||
| 17698 | return 1; | ||
| 17699 | } | ||
| 17700 | |||
| 17701 | sub commandsTab { | ||
| 17702 | |||
| 17703 | # Commands tab | ||
| 17704 | # | ||
| 17705 | # Expected arguments | ||
| 17706 | # (none besides $self) | ||
| 17707 | # | ||
| 17708 | # Return values | ||
| 17709 | # 'undef' on improper arguments | ||
| 17710 | # 1 otherwise | ||
| 17711 | |||
| 17712 | my ($self, $check) = @_; | ||
| 17713 | |||
| 17714 | # Check for improper arguments | ||
| 17715 | if (defined $check) { | ||
| 17716 | |||
| 17717 | return $axmud::CLIENT->writeImproper($self->_objClass . '->commandsTab', @_); | ||
| 17718 | } | ||
| 17719 | |||
| 17720 | # Tab setup | ||
| 17721 | my $grid = $self->addTab( | ||
| 17722 | $self->notebook, | ||
| 17723 | 'C_ommands', | ||
| 17724 | ['Command sigils', 'World commands', 'System messages'], | ||
| 17725 | ); | ||
| 17726 | |||
| 17727 | # Command sigils | ||
| 17728 | $self->addLabel($grid, '<b>Command sigils</b>', | ||
| 17729 | 0, 12, 0, 1); | ||
| 17730 | |||
| 17731 | $self->addLabel($grid, 'Echo command sigil', | ||
| 17732 | 1, 4, 1, 2); | ||
| 17733 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 17734 | 4, 6, 1, 2); | ||
| 17735 | $entry->set_text($axmud::CLIENT->constEchoSigil); | ||
| 17736 | |||
| 17737 | my $checkButton3 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17738 | 6, 8, 1, 2); | ||
| 17739 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 17740 | |||
| 17741 | my $button = $self->addButton($grid, 'Enable', 'Enable echo commands', undef, | ||
| 17742 | 8, 10, 1, 2); | ||
| 17743 | $button->signal_connect('clicked' => sub { | ||
| 17744 | |||
| 17745 | if (! $axmud::CLIENT->echoSigilFlag) { | ||
| 17746 | |||
| 17747 | $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode); | ||
| 17748 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 17749 | } | ||
| 17750 | }); | ||
| 17751 | my $button2 = $self->addButton($grid, 'Disable', 'Disable echo commands', undef, | ||
| 17752 | 10, 12, 1, 2); | ||
| 17753 | $button2->signal_connect('clicked' => sub { | ||
| 17754 | |||
| 17755 | if ($axmud::CLIENT->echoSigilFlag) { | ||
| 17756 | |||
| 17757 | $self->session->pseudoCmd('togglesigil -e', $self->pseudoCmdMode); | ||
| 17758 | $checkButton3->set_active($axmud::CLIENT->echoSigilFlag); | ||
| 17759 | } | ||
| 17760 | }); | ||
| 17761 | |||
| 17762 | $self->addLabel($grid, 'Perl command sigil', | ||
| 17763 | 1, 4, 2, 3); | ||
| 17764 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 17765 | 4, 6, 2, 3); | ||
| 17766 | $entry2->set_text($axmud::CLIENT->constPerlSigil); | ||
| 17767 | |||
| 17768 | my $checkButton4 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17769 | 6, 8, 2, 3); | ||
| 17770 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 17771 | |||
| 17772 | my $button3 = $self->addButton($grid, 'Enable', 'Enable Perl commands', undef, | ||
| 17773 | 8, 10, 2, 3); | ||
| 17774 | $button3->signal_connect('clicked' => sub { | ||
| 17775 | |||
| 17776 | if (! $axmud::CLIENT->perlSigilFlag) { | ||
| 17777 | |||
| 17778 | $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode); | ||
| 17779 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 17780 | } | ||
| 17781 | }); | ||
| 17782 | my $button4 = $self->addButton($grid, 'Disable', 'Disable Perl commands', undef, | ||
| 17783 | 10, 12, 2, 3); | ||
| 17784 | $button4->signal_connect('clicked' => sub { | ||
| 17785 | |||
| 17786 | if ($axmud::CLIENT->perlSigilFlag) { | ||
| 17787 | |||
| 17788 | $self->session->pseudoCmd('togglesigil -p', $self->pseudoCmdMode); | ||
| 17789 | $checkButton4->set_active($axmud::CLIENT->perlSigilFlag); | ||
| 17790 | } | ||
| 17791 | }); | ||
| 17792 | |||
| 17793 | $self->addLabel($grid, 'Script command sigil', | ||
| 17794 | 1, 4, 3, 4); | ||
| 17795 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 17796 | 4, 6, 3, 4); | ||
| 17797 | $entry3->set_text($axmud::CLIENT->constScriptSigil); | ||
| 17798 | |||
| 17799 | my $checkButton5 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17800 | 6, 8, 3, 4); | ||
| 17801 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 17802 | |||
| 17803 | my $button5 = $self->addButton($grid, 'Enable', 'Enable script commands', undef, | ||
| 17804 | 8, 10, 3, 4); | ||
| 17805 | $button5->signal_connect('clicked' => sub { | ||
| 17806 | |||
| 17807 | if (! $axmud::CLIENT->scriptSigilFlag) { | ||
| 17808 | |||
| 17809 | $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode); | ||
| 17810 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 17811 | } | ||
| 17812 | }); | ||
| 17813 | my $button6 = $self->addButton($grid, 'Disable', 'Disable script commands', undef, | ||
| 17814 | 10, 12, 3, 4); | ||
| 17815 | $button6->signal_connect('clicked' => sub { | ||
| 17816 | |||
| 17817 | if ($axmud::CLIENT->scriptSigilFlag) { | ||
| 17818 | |||
| 17819 | $self->session->pseudoCmd('togglesigil -s', $self->pseudoCmdMode); | ||
| 17820 | $checkButton5->set_active($axmud::CLIENT->scriptSigilFlag); | ||
| 17821 | } | ||
| 17822 | }); | ||
| 17823 | |||
| 17824 | $self->addLabel($grid, 'Multi command sigil', | ||
| 17825 | 1, 4, 4, 5); | ||
| 17826 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 17827 | 4, 6, 4, 5); | ||
| 17828 | $entry4->set_text($axmud::CLIENT->constMultiSigil); | ||
| 17829 | |||
| 17830 | my $checkButton6 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17831 | 6, 8, 4, 5); | ||
| 17832 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 17833 | |||
| 17834 | my $button7 = $self->addButton($grid, 'Enable', 'Enable multi commands', undef, | ||
| 17835 | 8, 10, 4, 5); | ||
| 17836 | $button7->signal_connect('clicked' => sub { | ||
| 17837 | |||
| 17838 | if (! $axmud::CLIENT->multiSigilFlag) { | ||
| 17839 | |||
| 17840 | $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode); | ||
| 17841 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 17842 | } | ||
| 17843 | }); | ||
| 17844 | my $button8 = $self->addButton($grid, 'Disable', 'Disable multi commands', undef, | ||
| 17845 | 10, 12, 4, 5); | ||
| 17846 | $button8->signal_connect('clicked' => sub { | ||
| 17847 | |||
| 17848 | if ($axmud::CLIENT->multiSigilFlag) { | ||
| 17849 | |||
| 17850 | $self->session->pseudoCmd('togglesigil -m', $self->pseudoCmdMode); | ||
| 17851 | $checkButton6->set_active($axmud::CLIENT->multiSigilFlag); | ||
| 17852 | } | ||
| 17853 | }); | ||
| 17854 | |||
| 17855 | $self->addLabel($grid, 'Speedwalk command sigil', | ||
| 17856 | 1, 4, 5, 6); | ||
| 17857 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 17858 | 4, 6, 5, 6); | ||
| 17859 | $entry5->set_text($axmud::CLIENT->constSpeedSigil); | ||
| 17860 | |||
| 17861 | my $checkButton7 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17862 | 6, 8, 5, 6); | ||
| 17863 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 17864 | |||
| 17865 | my $button9 = $self->addButton($grid, 'Enable', 'Enable speedwalk commands', undef, | ||
| 17866 | 8, 10, 5, 6); | ||
| 17867 | $button9->signal_connect('clicked' => sub { | ||
| 17868 | |||
| 17869 | if (! $axmud::CLIENT->speedSigilFlag) { | ||
| 17870 | |||
| 17871 | $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode); | ||
| 17872 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 17873 | } | ||
| 17874 | }); | ||
| 17875 | my $button10 = $self->addButton($grid, 'Disable', 'Disable speedwalk commands', undef, | ||
| 17876 | 10, 12, 5, 6); | ||
| 17877 | $button10->signal_connect('clicked' => sub { | ||
| 17878 | |||
| 17879 | if ($axmud::CLIENT->speedSigilFlag) { | ||
| 17880 | |||
| 17881 | $self->session->pseudoCmd('togglesigil -w', $self->pseudoCmdMode); | ||
| 17882 | $checkButton7->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 17883 | } | ||
| 17884 | }); | ||
| 17885 | |||
| 17886 | $self->addLabel($grid, 'Bypass command sigil', | ||
| 17887 | 1, 4, 6, 7); | ||
| 17888 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 17889 | 4, 6, 6, 7); | ||
| 17890 | $entry6->set_text($axmud::CLIENT->constBypassSigil); | ||
| 17891 | |||
| 17892 | my $checkButton8 = $self->addCheckButton($grid, undef, undef, FALSE, | ||
| 17893 | 6, 8, 6, 7); | ||
| 17894 | $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag); | ||
| 17895 | |||
| 17896 | my $button11 = $self->addButton($grid, 'Enable', 'Enable bypass commands', undef, | ||
| 17897 | 8, 10, 6, 7); | ||
| 17898 | $button11->signal_connect('clicked' => sub { | ||
| 17899 | |||
| 17900 | if (! $axmud::CLIENT->bypassSigilFlag) { | ||
| 17901 | |||
| 17902 | $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode); | ||
| 17903 | $checkButton8->set_active($axmud::CLIENT->bypassSigilFlag); | ||
| 17904 | } | ||
| 17905 | }); | ||
| 17906 | my $button12 = $self->addButton($grid, 'Disable', 'Disable bypass commands', undef, | ||
| 17907 | 10, 12, 6, 7); | ||
| 17908 | $button12->signal_connect('clicked' => sub { | ||
| 17909 | |||
| 17910 | if ($axmud::CLIENT->bypassSigilFlag) { | ||
| 17911 | |||
| 17912 | $self->session->pseudoCmd('togglesigil -b', $self->pseudoCmdMode); | ||
| 17913 | $checkButton8->set_active($axmud::CLIENT->speedSigilFlag); | ||
| 17914 | } | ||
| 17915 | }); | ||
| 17916 | |||
| 17917 | # World commands | ||
| 17918 | $self->addLabel($grid, '<b>World commands</b>', | ||
| 17919 | 0, 12, 7, 8); | ||
| 17920 | my $checkButton9 = $self->addCheckButton( | ||
| 17921 | $grid, 'World commands also shown in \'main\' windows', undef, TRUE, | ||
| 17922 | 1, 12, 8, 9); | ||
| 17923 | $checkButton9->set_active($axmud::CLIENT->confirmWorldCmdFlag); | ||
| 17924 | $checkButton9->signal_connect('toggled' => sub { | ||
| 17925 | |||
| 17926 | if ( | ||
| 17927 | ($checkButton9->get_active() && ! $axmud::CLIENT->confirmWorldCmdFlag) | ||
| 17928 | || (! $checkButton9->get_active() && $axmud::CLIENT->confirmWorldCmdFlag) | ||
| 17929 | ) { | ||
| 17930 | $self->session->pseudoCmd('toggleinstruct -c', $self->pseudoCmdMode); | ||
| 17931 | } | ||
| 17932 | }); | ||
| 17933 | |||
| 17934 | my $checkButton10 = $self->addCheckButton( | ||
| 17935 | $grid, 'Show a visible cursor in \'main\' windows', undef, TRUE, | ||
| 17936 | 1, 12, 9, 10); | ||
| 17937 | $checkButton10->set_active($axmud::CLIENT->useVisibleCursorFlag); | ||
| 17938 | $checkButton10->signal_connect('toggled' => sub { | ||
| 17939 | |||
| 17940 | if ( | ||
| 17941 | ($checkButton10->get_active() && ! $axmud::CLIENT->useVisibleCursorFlag) | ||
| 17942 | || (! $checkButton10->get_active() && $axmud::CLIENT->useVisibleCursorFlag) | ||
| 17943 | ) { | ||
| 17944 | $self->session->pseudoCmd('configureterminal -c', $self->pseudoCmdMode); | ||
| 17945 | } | ||
| 17946 | }); | ||
| 17947 | |||
| 17948 | # System messages | ||
| 17949 | $self->addLabel($grid, '<b>System messages</b>', | ||
| 17950 | 0, 12, 10, 11); | ||
| 17951 | |||
| 17952 | my $checkButton11 = $self->addCheckButton( | ||
| 17953 | $grid, | ||
| 17954 | 'Allow system messages to be displayed in \'main\' windows', | ||
| 17955 | undef, | ||
| 17956 | TRUE, | ||
| 17957 | 1, 12, 11, 12); | ||
| 17958 | $checkButton11->set_active($axmud::CLIENT->mainWinSystemMsgFlag); | ||
| 17959 | $checkButton11->signal_connect('toggled' => sub { | ||
| 17960 | |||
| 17961 | if ( | ||
| 17962 | ($checkButton11->get_active && ! $axmud::CLIENT->mainWinSystemMsgFlag) | ||
| 17963 | || (! $checkButton11->get_active && $axmud::CLIENT->mainWinSystemMsgFlag) | ||
| 17964 | ) { | ||
| 17965 | $self->session->pseudoCmd('togglemainwindow -s', $self->pseudoCmdMode); | ||
| 17966 | } | ||
| 17967 | }); | ||
| 17968 | |||
| 17969 | # Tab complete | ||
| 17970 | return 1; | ||
| 17971 | } | ||
| 17972 | |||
| 17973 | sub logsTab { | ||
| 17974 | |||
| 17975 | # Logs tab | ||
| 17976 | # | ||
| 17977 | # Expected arguments | ||
| 17978 | # (none besides $self) | ||
| 17979 | # | ||
| 17980 | # Return values | ||
| 17981 | # 'undef' on improper arguments | ||
| 17982 | # 1 otherwise | ||
| 17983 | |||
| 17984 | my ($self, $check) = @_; | ||
| 17985 | |||
| 17986 | # Check for improper arguments | ||
| 17987 | if (defined $check) { | ||
| 17988 | |||
| 17989 | return $axmud::CLIENT->writeImproper($self->_objClass . '->logsTab', @_); | ||
| 17990 | } | ||
| 17991 | |||
| 17992 | # Tab setup | ||
| 17993 | my $grid = $self->addTab( | ||
| 17994 | $self->notebook, | ||
| 17995 | '_Logs', | ||
| 17996 | ['Log settings'], | ||
| 17997 | ); | ||
| 17998 | |||
| 17999 | # Log settings | ||
| 18000 | $self->addLabel($grid, '<b>Log settings</b>', | ||
| 18001 | 0, 12, 0, 1); | ||
| 18002 | |||
| 18003 | my $checkButton = $self->addCheckButton($grid, 'Enable logging in general', undef, TRUE, | ||
| 18004 | 1, 12, 1, 2); | ||
| 18005 | $checkButton->set_active($axmud::CLIENT->allowLogsFlag); | ||
| 18006 | $checkButton->signal_connect('toggled' => sub { | ||
| 18007 | |||
| 18008 | $self->session->pseudoCmd('log -l', $self->pseudoCmdMode); | ||
| 18009 | $checkButton->set_active($axmud::CLIENT->allowLogsFlag); | ||
| 18010 | }); | ||
| 18011 | |||
| 18012 | my $checkButton2 = $self->addCheckButton($grid, 'Lines show the current date', undef, TRUE, | ||
| 18013 | 1, 12, 2, 3); | ||
| 18014 | $checkButton2->set_active($axmud::CLIENT->logPrefixDateFlag); | ||
| 18015 | $checkButton2->signal_connect('toggled' => sub { | ||
| 18016 | |||
| 18017 | $self->session->pseudoCmd('log -a', $self->pseudoCmdMode); | ||
| 18018 | $checkButton2->set_active($axmud::CLIENT->logPrefixDateFlag); | ||
| 18019 | }); | ||
| 18020 | |||
| 18021 | my $checkButton3 = $self->addCheckButton($grid, 'Lines show the current time', undef, TRUE, | ||
| 18022 | 1, 12, 3, 4); | ||
| 18023 | $checkButton3->set_active($axmud::CLIENT->logPrefixTimeFlag); | ||
| 18024 | $checkButton3->signal_connect('toggled' => sub { | ||
| 18025 | |||
| 18026 | $self->session->pseudoCmd('log -t', $self->pseudoCmdMode); | ||
| 18027 | $checkButton3->set_active($axmud::CLIENT->logPrefixTimeFlag); | ||
| 18028 | }); | ||
| 18029 | |||
| 18030 | # Tab complete | ||
| 18031 | return 1; | ||
| 18032 | } | ||
| 18033 | |||
| 18034 | sub soundTab { | ||
| 18035 | |||
| 18036 | # Sound tab | ||
| 18037 | # | ||
| 18038 | # Expected arguments | ||
| 18039 | # (none besides $self) | ||
| 18040 | # | ||
| 18041 | # Return values | ||
| 18042 | # 'undef' on improper arguments | ||
| 18043 | # 1 otherwise | ||
| 18044 | |||
| 18045 | my ($self, $check) = @_; | ||
| 18046 | |||
| 18047 | # Check for improper arguments | ||
| 18048 | if (defined $check) { | ||
| 18049 | |||
| 18050 | return $axmud::CLIENT->writeImproper($self->_objClass . '->soundTab', @_); | ||
| 18051 | } | ||
| 18052 | |||
| 18053 | # Tab setup | ||
| 18054 | my $grid = $self->addTab( | ||
| 18055 | $self->notebook, | ||
| 18056 | 'So_und', | ||
| 18057 | ['Sound settings'], | ||
| 18058 | ); | ||
| 18059 | |||
| 18060 | # Sound settings | ||
| 18061 | $self->addLabel($grid, '<b>Sound settings</b>', | ||
| 18062 | 0, 12, 0, 1); | ||
| 18063 | |||
| 18064 | my $checkButton = $self->addCheckButton( | ||
| 18065 | $grid, 'Enable sound effects in general', undef, TRUE, | ||
| 18066 | 1, 12, 1, 2); | ||
| 18067 | $checkButton->set_active($axmud::CLIENT->allowSoundFlag); | ||
| 18068 | $checkButton->signal_connect('toggled' => sub { | ||
| 18069 | |||
| 18070 | if ($checkButton->get_active()) { | ||
| 18071 | $self->session->pseudoCmd('sound on', $self->pseudoCmdMode); | ||
| 18072 | } else { | ||
| 18073 | $self->session->pseudoCmd('sound off', $self->pseudoCmdMode); | ||
| 18074 | } | ||
| 18075 | }); | ||
| 18076 | |||
| 18077 | my $checkButton2 = $self->addCheckButton( | ||
| 18078 | $grid, | ||
| 18079 | 'Enable beeps sent by the world (while sound effects are on)', | ||
| 18080 | undef, | ||
| 18081 | TRUE, | ||
| 18082 | 1, 12, 2, 3); | ||
| 18083 | $checkButton2->set_active($axmud::CLIENT->allowAsciiBellFlag); | ||
| 18084 | $checkButton2->signal_connect('toggled' => sub { | ||
| 18085 | |||
| 18086 | if ($checkButton2->get_active()) { | ||
| 18087 | $self->session->pseudoCmd('asciibell on', $self->pseudoCmdMode); | ||
| 18088 | } else { | ||
| 18089 | $self->session->pseudoCmd('asciibell off', $self->pseudoCmdMode); | ||
| 18090 | } | ||
| 18091 | }); | ||
| 18092 | |||
| 18093 | my $button = $self->addButton( | ||
| 18094 | $grid, | ||
| 18095 | 'Test sound by playing a random sound effect', | ||
| 18096 | 'Play a random sound effect', | ||
| 18097 | undef, | ||
| 18098 | 1, 12, 3, 4); | ||
| 18099 | $button->signal_connect('clicked' => sub { | ||
| 18100 | |||
| 18101 | # Play the sound effect | ||
| 18102 | $self->session->pseudoCmd('playsoundeffect', $self->pseudoCmdMode); | ||
| 18103 | }); | ||
| 18104 | |||
| 18105 | # Tab complete | ||
| 18106 | return 1; | ||
| 18107 | } | ||
| 18108 | |||
| 18109 | sub speechTab { | ||
| 18110 | |||
| 18111 | # Speech tab | ||
| 18112 | # | ||
| 18113 | # Expected arguments | ||
| 18114 | # (none besides $self) | ||
| 18115 | # | ||
| 18116 | # Return values | ||
| 18117 | # 'undef' on improper arguments | ||
| 18118 | # 1 otherwise | ||
| 18119 | |||
| 18120 | my ($self, $check) = @_; | ||
| 18121 | |||
| 18122 | # Check for improper arguments | ||
| 18123 | if (defined $check) { | ||
| 18124 | |||
| 18125 | return $axmud::CLIENT->writeImproper($self->_objClass . '->speechTab', @_); | ||
| 18126 | } | ||
| 18127 | |||
| 18128 | # Tab setup | ||
| 18129 | my $grid = $self->addTab( | ||
| 18130 | $self->notebook, | ||
| 18131 | 'S_peech', | ||
| 18132 | ['Text-to-speech (TTS) settings'], | ||
| 18133 | ); | ||
| 18134 | |||
| 18135 | # Text-to-speech (TTS) settings | ||
| 18136 | $self->addLabel($grid, '<b>Text-to-speech (TTS) settings</b>', | ||
| 18137 | 0, 12, 0, 1); | ||
| 18138 | |||
| 18139 | my $checkButton = $self->addCheckButton( | ||
| 18140 | $grid, 'Enable text-to-speech for all users', undef, TRUE, | ||
| 18141 | 1, 12, 1, 2); | ||
| 18142 | $checkButton->set_active($axmud::CLIENT->customAllowTTSFlag); | ||
| 18143 | $checkButton->signal_connect('toggled' => sub { | ||
| 18144 | |||
| 18145 | if ($checkButton->get_active()) { | ||
| 18146 | $axmud::CLIENT->set_customAllowTTSFlag(TRUE); | ||
| 18147 | } else { | ||
| 18148 | $axmud::CLIENT->set_customAllowTTSFlag(FALSE); | ||
| 18149 | } | ||
| 18150 | }); | ||
| 18151 | |||
| 18152 | my $checkButton2 = $self->addCheckButton( | ||
| 18153 | $grid, | ||
| 18154 | 'Verbose output (precede with \'System message\' or \'Received text\', etc)', | ||
| 18155 | undef, | ||
| 18156 | TRUE, | ||
| 18157 | 1, 12, 2, 3); | ||
| 18158 | $checkButton2->set_active($axmud::CLIENT->ttsVerboseFlag); | ||
| 18159 | $checkButton2->signal_connect('toggled' => sub { | ||
| 18160 | |||
| 18161 | if ($checkButton2->get_active()) { | ||
| 18162 | $axmud::CLIENT->set_ttsFlag('verbose', TRUE); | ||
| 18163 | } else { | ||
| 18164 | $axmud::CLIENT->set_ttsFlag('verbose', FALSE); | ||
| 18165 | } | ||
| 18166 | }); | ||
| 18167 | |||
| 18168 | my $checkButton3 = $self->addCheckButton( | ||
| 18169 | $grid, 'Convert text received from the world', undef, TRUE, | ||
| 18170 | 1, 12, 3, 4); | ||
| 18171 | $checkButton3->set_active($axmud::CLIENT->ttsReceiveFlag); | ||
| 18172 | $checkButton3->signal_connect('toggled' => sub { | ||
| 18173 | |||
| 18174 | if ($checkButton3->get_active()) { | ||
| 18175 | $axmud::CLIENT->set_ttsFlag('receive', TRUE); | ||
| 18176 | } else { | ||
| 18177 | $axmud::CLIENT->set_ttsFlag('receive', FALSE); | ||
| 18178 | } | ||
| 18179 | }); | ||
| 18180 | |||
| 18181 | my $checkButton4 = $self->addCheckButton($grid, 'Convert system messages', undef, TRUE, | ||
| 18182 | 1, 12, 4, 5); | ||
| 18183 | $checkButton4->set_active($axmud::CLIENT->ttsSystemFlag); | ||
| 18184 | $checkButton4->signal_connect('toggled' => sub { | ||
| 18185 | |||
| 18186 | if ($checkButton4->get_active()) { | ||
| 18187 | $axmud::CLIENT->set_ttsFlag('system', TRUE); | ||
| 18188 | } else { | ||
| 18189 | $axmud::CLIENT->set_ttsFlag('system', FALSE); | ||
| 18190 | } | ||
| 18191 | }); | ||
| 18192 | |||
| 18193 | my $checkButton5 = $self->addCheckButton( | ||
| 18194 | $grid, 'Convert system error/warning messages', undef, TRUE, | ||
| 18195 | 1, 12, 5, 6); | ||
| 18196 | $checkButton5->set_active($axmud::CLIENT->ttsSystemErrorFlag); | ||
| 18197 | $checkButton5->signal_connect('toggled' => sub { | ||
| 18198 | |||
| 18199 | if ($checkButton5->get_active()) { | ||
| 18200 | $axmud::CLIENT->set_ttsFlag('error', TRUE); | ||
| 18201 | } else { | ||
| 18202 | $axmud::CLIENT->set_ttsFlag('error', FALSE); | ||
| 18203 | } | ||
| 18204 | }); | ||
| 18205 | |||
| 18206 | my $checkButton6 = $self->addCheckButton($grid, 'Convert world commands', undef, TRUE, | ||
| 18207 | 1, 12, 6, 7); | ||
| 18208 | $checkButton6->set_active($axmud::CLIENT->ttsWorldCmdFlag); | ||
| 18209 | $checkButton6->signal_connect('toggled' => sub { | ||
| 18210 | |||
| 18211 | if ($checkButton6->get_active()) { | ||
| 18212 | $axmud::CLIENT->set_ttsFlag('command', TRUE); | ||
| 18213 | } else { | ||
| 18214 | $axmud::CLIENT->set_ttsFlag('command', FALSE); | ||
| 18215 | } | ||
| 18216 | }); | ||
| 18217 | |||
| 18218 | my $checkButton7 = $self->addCheckButton( | ||
| 18219 | $grid, 'Convert \'dialogue\' windows', undef, TRUE, | ||
| 18220 | 1, 12, 7, 8); | ||
| 18221 | $checkButton7->set_active($axmud::CLIENT->ttsDialogueFlag); | ||
| 18222 | $checkButton7->signal_connect('toggled' => sub { | ||
| 18223 | |||
| 18224 | if ($checkButton7->get_active()) { | ||
| 18225 | $axmud::CLIENT->set_ttsFlag('dialogue', TRUE); | ||
| 18226 | } else { | ||
| 18227 | $axmud::CLIENT->set_ttsFlag('dialogue', FALSE); | ||
| 18228 | } | ||
| 18229 | }); | ||
| 18230 | |||
| 18231 | my $checkButton8 = $self->addCheckButton( | ||
| 18232 | $grid, | ||
| 18233 | 'Allow some tasks (e.g. the Status and Locator tasks) to convert certain strings to' | ||
| 18234 | . ' speech', | ||
| 18235 | undef, | ||
| 18236 | TRUE, | ||
| 18237 | 1, 12, 8, 9); | ||
| 18238 | $checkButton8->set_active($axmud::CLIENT->ttsTaskFlag); | ||
| 18239 | $checkButton8->signal_connect('toggled' => sub { | ||
| 18240 | |||
| 18241 | if ($checkButton8->get_active()) { | ||
| 18242 | $axmud::CLIENT->set_ttsFlag('task', TRUE); | ||
| 18243 | } else { | ||
| 18244 | $axmud::CLIENT->set_ttsFlag('task', FALSE); | ||
| 18245 | } | ||
| 18246 | }); | ||
| 18247 | |||
| 18248 | # Tab complete | ||
| 18249 | return 1; | ||
| 18250 | } | ||
| 18251 | |||
| 18252 | sub windowsTab { | ||
| 18253 | |||
| 18254 | # Windows tab | ||
| 18255 | # | ||
| 18256 | # Expected arguments | ||
| 18257 | # (none besides $self) | ||
| 18258 | # | ||
| 18259 | # Return values | ||
| 18260 | # 'undef' on improper arguments | ||
| 18261 | # 1 otherwise | ||
| 18262 | |||
| 18263 | my ($self, $check) = @_; | ||
| 18264 | |||
| 18265 | # Local variables | ||
| 18266 | my @comboList; | ||
| 18267 | |||
| 18268 | # Check for improper arguments | ||
| 18269 | if (defined $check) { | ||
| 18270 | |||
| 18271 | return $axmud::CLIENT->writeImproper($self->_objClass . '->windowsTab', @_); | ||
| 18272 | } | ||
| 18273 | |||
| 18274 | # Tab setup | ||
| 18275 | my $grid = $self->addTab( | ||
| 18276 | $self->notebook, | ||
| 18277 | '_Windows', | ||
| 18278 | ['Window tiling settings'], | ||
| 18279 | ); | ||
| 18280 | |||
| 18281 | # Window tiling settings | ||
| 18282 | $self->addLabel($grid, '<b>Window tiling settings</b>', | ||
| 18283 | 0, 12, 0, 1); | ||
| 18284 | |||
| 18285 | $self->addLabel( | ||
| 18286 | $grid, | ||
| 18287 | '<i>Zonemap used for window tiling:</i>', | ||
| 18288 | 1, 6, 1, 2); | ||
| 18289 | |||
| 18290 | @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash')); | ||
| 18291 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 18292 | TRUE, # No 'undef' value used | ||
| 18293 | 6, 12, 1, 2); | ||
| 18294 | |||
| 18295 | my $button = $self->addButton( | ||
| 18296 | $grid, | ||
| 18297 | 'Apply to the default workspace (desktop) now', | ||
| 18298 | 'Apply the selected zonemap to the default (first) workspace', | ||
| 18299 | undef, | ||
| 18300 | 1, 12, 2, 3, | ||
| 18301 | ); | ||
| 18302 | $button->signal_connect('clicked' => sub { | ||
| 18303 | |||
| 18304 | my $choice = $combo->get_active_text(); | ||
| 18305 | if (defined $choice) { | ||
| 18306 | |||
| 18307 | $self->session->pseudoCmd('resetgrid -w 0 ' . $choice); | ||
| 18308 | } | ||
| 18309 | }); | ||
| 18310 | |||
| 18311 | my $button2 = $self->addButton( | ||
| 18312 | $grid, | ||
| 18313 | 'Apply to the default workspace whenever ' . $axmud::SCRIPT . ' starts', | ||
| 18314 | 'Apply the selected zonemap to the default (first) initial workspace', | ||
| 18315 | undef, | ||
| 18316 | 1, 12, 3, 4, | ||
| 18317 | ); | ||
| 18318 | $button2->signal_connect('clicked' => sub { | ||
| 18319 | |||
| 18320 | my $choice = $combo->get_active_text(); | ||
| 18321 | if (defined $choice) { | ||
| 18322 | |||
| 18323 | $self->session->pseudoCmd( | ||
| 18324 | 'modifyinitialworkspace 0 ' . $choice, | ||
| 18325 | $self->pseudoCmdMode, | ||
| 18326 | ); | ||
| 18327 | } | ||
| 18328 | }); | ||
| 18329 | |||
| 18330 | # Tab complete | ||
| 18331 | return 1; | ||
| 18332 | } | ||
| 18333 | |||
| 18334 | ################## | ||
| 18335 | # Accessors - set | ||
| 18336 | |||
| 18337 | ################## | ||
| 18338 | # Accessors - get | ||
| 18339 | } | ||
| 18340 | |||
| 18341 | { package Games::Axmud::PrefWin::Search; | ||
| 18342 | |||
| 18343 | use strict; | ||
| 18344 | use warnings; | ||
| 18345 | # use diagnostics; | ||
| 18346 | |||
| 18347 | use Glib qw(TRUE FALSE); | ||
| 18348 | |||
| 18349 | our @ISA = qw( | ||
| 18350 | Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin | ||
| 18351 | Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud | ||
| 18352 | ); | ||
| 18353 | |||
| 18354 | ################## | ||
| 18355 | # Constructors | ||
| 18356 | |||
| 18357 | # Contents of $self->editConfigHash after $self->new has been called: | ||
| 18358 | # (none) | ||
| 18359 | |||
| 18360 | sub new { | ||
| 18361 | |||
| 18362 | # Called by GA::Generic::Win->createFreeWin | ||
| 18363 | # Creates a new instance of a 'config' window (any 'free' window object inheriting from this | ||
| 18364 | # object, namely 'edit' windows and 'pref' windows) | ||
| 18365 | # | ||
| 18366 | # Expected arguments | ||
| 18367 | # $number - Unique number for this window object | ||
| 18368 | # $workspaceObj - The GA::Obj::Workspace handling the workspace in which this window | ||
| 18369 | # should be created | ||
| 18370 | # $owner - The owner; a 'grid' window object (but not an 'external' window) or a | ||
| 18371 | # 'free' window object. When this window opens/closes, the owner is | ||
| 18372 | # informed via calls to its ->add_childFreeWin / ->del_childFreeWin | ||
| 18373 | # functions | ||
| 18374 | # | ||
| 18375 | # Optional arguments | ||
| 18376 | # $session - The GA::Session from which this function was called. 'undef' if the | ||
| 18377 | # calling function didn't specify a session and $owner's ->session IV | ||
| 18378 | # is also 'undef' | ||
| 18379 | # $title - A string to use as the window title. If 'undef', a generic title is | ||
| 18380 | # used | ||
| 18381 | # $editObj - The object to be edited in the window (for 'edit' windows only; | ||
| 18382 | # should be 'undef' for 'pref' windows) | ||
| 18383 | # $tempFlag - Flag set to TRUE if $editObj is either temporary, or has not yet been | ||
| 18384 | # added to any registry (usually because the user needs to name it | ||
| 18385 | # first). Set to FALSE (or 'undef') otherwise. Ignored if $editObj is | ||
| 18386 | # not specified | ||
| 18387 | # %configHash - Hash containing any number of key-value pairs needed for this | ||
| 18388 | # particular 'config' window; for example, for example, | ||
| 18389 | # GA::PrefWin::TaskStart uses it to specify a task name and type. Set | ||
| 18390 | # to an empty hash if not required | ||
| 18391 | # | ||
| 18392 | # Return values | ||
| 18393 | # 'undef' on improper arguments | ||
| 18394 | # Blessed reference to the newly-created object on success | ||
| 18395 | |||
| 18396 | my ( | ||
| 18397 | $class, $number, $workspaceObj, $owner, $session, $title, $editObj, $tempFlag, | ||
| 18398 | %configHash, | ||
| 18399 | ) = @_; | ||
| 18400 | |||
| 18401 | # Local variables | ||
| 18402 | my ($winType, $winName, $winWidth, $winHeight); | ||
| 18403 | |||
| 18404 | # Check for improper arguments | ||
| 18405 | if (! defined $class || ! defined $number || ! defined $workspaceObj || ! defined $owner) { | ||
| 18406 | |||
| 18407 | return $axmud::CLIENT->writeImproper($class . '->new', @_); | ||
| 18408 | } | ||
| 18409 | |||
| 18410 | # Set the values to use for some standard window IVs | ||
| 18411 | if ($editObj) { | ||
| 18412 | |||
| 18413 | $winType = 'edit'; | ||
| 18414 | $winName = 'edit'; | ||
| 18415 | if (! defined $title) { | ||
| 18416 | |||
| 18417 | $title = 'Edit window'; | ||
| 18418 | } | ||
| 18419 | |||
| 18420 | } else { | ||
| 18421 | |||
| 18422 | $winType = 'pref'; | ||
| 18423 | $winName = 'pref'; | ||
| 18424 | if (! defined $title) { | ||
| 18425 | |||
| 18426 | $title = 'Preference window'; | ||
| 18427 | } | ||
| 18428 | } | ||
| 18429 | |||
| 18430 | $winWidth = $axmud::CLIENT->customFreeWinWidth; | ||
| 18431 | if ($axmud::CLIENT->configWinIndexFlag) { | ||
| 18432 | |||
| 18433 | $winWidth += $axmud::CLIENT->customConfigWinIndexWidth; | ||
| 18434 | } | ||
| 18435 | |||
| 18436 | # For the benefit of MS Windows and its enormous buttons, increase the height of all | ||
| 18437 | # 'config' windows a little (this removes scrollbars in almost all tabs) | ||
| 18438 | $winHeight = $axmud::CLIENT->customFreeWinHeight; | ||
| 18439 | if ( | ||
| 18440 | $^O eq 'MSWin32' | ||
| 18441 | && $axmud::CLIENT->customFreeWinHeight eq $axmud::CLIENT->constFreeWinHeight | ||
| 18442 | ) { | ||
| 18443 | $winHeight += 30; | ||
| 18444 | } | ||
| 18445 | |||
| 18446 | # Setup | ||
| 18447 | my $self = { | ||
| 18448 | _objName => $winType . '_win_' . $number, | ||
| 18449 | _objClass => $class, | ||
| 18450 | _parentFile => undef, # No parent file object | ||
| 18451 | _parentWorld => undef, # No parent file object | ||
| 18452 | _privFlag => TRUE, # All IVs are private | ||
| 18453 | |||
| 18454 | # Standard window object IVs | ||
| 18455 | # -------------------------- | ||
| 18456 | |||
| 18457 | # Unique number for this window object | ||
| 18458 | number => $number, | ||
| 18459 | # The window category - 'grid' or 'free' | ||
| 18460 | winCategory => 'free', | ||
| 18461 | # The window type, any of the keys in GA::Client->constFreeWinTypeHash | ||
| 18462 | winType => $winType, | ||
| 18463 | # A name for the window (for 'config' windows, the same as the window type) | ||
| 18464 | winName => $winName, | ||
| 18465 | # The GA::Obj::Workspace object for the workspace in which this window is created | ||
| 18466 | workspaceObj => $workspaceObj, | ||
| 18467 | # The owner; a 'grid' window object (but not an 'external' window) or a 'free' window | ||
| 18468 | # object. When this window opens/closes, the owner is informed via calls to its | ||
| 18469 | # ->add_childFreeWin / ->del_childFreeWin functions | ||
| 18470 | owner => $owner, | ||
| 18471 | # The GA::Session from which this function was called. 'undef' if the calling function | ||
| 18472 | # didn't specify a session and $owner's ->session IV is also 'undef' | ||
| 18473 | session => $session, | ||
| 18474 | # When GA::Session->pseudoCmd is called to execute a client command, the mode in which | ||
| 18475 | # it should be called (usually 'win_error' or 'win_only', which causes errors to be | ||
| 18476 | # displayed in a 'dialogue' window) | ||
| 18477 | pseudoCmdMode => 'win_error', | ||
| 18478 | |||
| 18479 | # The window widget. For most window objects, the Gtk3::Window. For pseudo-windows, the | ||
| 18480 | # parent 'main' window's Gtk3::Window | ||
| 18481 | # The code should use this IV when it wants to do something to the window itself | ||
| 18482 | # (minimise it, make it active, etc) | ||
| 18483 | winWidget => undef, | ||
| 18484 | # The window container. For most window objects, the Gtk3::Window. For pseudo-windows, | ||
| 18485 | # the parent GA::Table::PseudoWin table object | ||
| 18486 | # The code should use this IV when it wants to add, modify or remove widgets inside the | ||
| 18487 | # window itself | ||
| 18488 | winBox => undef, | ||
| 18489 | # Flag set to TRUE if the window actually exists (after a call to $self->winEnable), | ||
| 18490 | # FALSE if not | ||
| 18491 | enabledFlag => FALSE, | ||
| 18492 | # Flag set to TRUE if the Gtk3 window itself is visible (after a call to | ||
| 18493 | # $self->setVisible), FALSE if it is not visible (after a call to $self->setInvisible) | ||
| 18494 | visibleFlag => TRUE, | ||
| 18495 | # Registry hash of 'free' windows (excluding 'dialogue' windows) for which this window | ||
| 18496 | # is the parent, a subset of GA::Obj::Desktop->freeWinHash. Hash in the form | ||
| 18497 | # $childFreeWinHash{unique_number} = blessed_reference_to_window_object | ||
| 18498 | childFreeWinHash => {}, | ||
| 18499 | # When a child 'free' window (excluding 'dialogue' windows) is destroyed, this parent | ||
| 18500 | # window is informed via a call to $self->del_childFreeWin | ||
| 18501 | # When the child is destroyed, this window might want to call some of its own functions | ||
| 18502 | # to update various widgets and/or IVs, in which case this window adds an entry to | ||
| 18503 | # this hash; a hash in the form | ||
| 18504 | # $childDestroyHash{unique_number} = list_reference | ||
| 18505 | # ...where 'unique_number' is the child window's ->number, and 'list_reference' is a | ||
| 18506 | # reference to a list in groups of 2, in the form | ||
| 18507 | # (sub_name, argument_list_ref, sub_name, argument_list_ref...) | ||
| 18508 | childDestroyHash => {}, | ||
| 18509 | |||
| 18510 | # The container widget into which all other widgets are packed (usually a Gtk3::VBox or | ||
| 18511 | # Gtk3::HBox, but any container widget can be used; takes up the whole window client | ||
| 18512 | # area) | ||
| 18513 | packingBox => undef, # Gtk3::VBox | ||
| 18514 | |||
| 18515 | # Standard IVs for 'free' windows | ||
| 18516 | |||
| 18517 | # The window's default size, in pixels | ||
| 18518 | widthPixels => $winWidth, | ||
| 18519 | heightPixels => $winHeight, | ||
| 18520 | # Default border/item spacing sizes used in the window, in pixels | ||
| 18521 | borderPixels => $axmud::CLIENT->constFreeBorderPixels, | ||
| 18522 | spacingPixels => $axmud::CLIENT->constFreeSpacingPixels, | ||
| 18523 | |||
| 18524 | # A string to use as the window title. If 'undef', a generic title is used | ||
| 18525 | title => $title, | ||
| 18526 | # Hash containing any number of key-value pairs needed for this particular 'config' | ||
| 18527 | # window; for example, for example, GA::PrefWin::TaskStart uses it to specify a task | ||
| 18528 | # name and type. Set to an empty hash if not required | ||
| 18529 | configHash => {%configHash}, | ||
| 18530 | |||
| 18531 | # Standard IVs for 'config' windows | ||
| 18532 | |||
| 18533 | # Widgets | ||
| 18534 | hPaned => undef, # Gtk3::HPaned | ||
| 18535 | scroller => undef, # Gtk3::ScrolledWindow | ||
| 18536 | treeStore => undef, # Gtk3::TreeStore | ||
| 18537 | treeView => undef, # Gtk3::TreeView | ||
| 18538 | vBox => undef, # Gtk3::VBox | ||
| 18539 | notebook => undef, # Gtk3::Notebook | ||
| 18540 | hBox => undef, # Gtk3::HBox | ||
| 18541 | okButton => undef, # Gtk3::Button | ||
| 18542 | cancelButton => undef, # Gtk3::Button | ||
| 18543 | resetButton => undef, # Gtk3::Button | ||
| 18544 | saveButton => undef, # Gtk3::Button | ||
| 18545 | |||
| 18546 | # The standard grid size for the notebook (any 'edit'/'pref' window can use a different | ||
| 18547 | # size, if it wants) | ||
| 18548 | gridSize => 12, | ||
| 18549 | |||
| 18550 | # The object to be edited in the window (for 'edit' windows only; should be 'undef' for | ||
| 18551 | # 'pref' windows) | ||
| 18552 | editObj => $editObj, | ||
| 18553 | # Flag set to TRUE if $editObj is either temporary, or has not yet been added to any | ||
| 18554 | # registry (usually because the user needs to name it first). Set to FALSE | ||
| 18555 | # (or 'undef') otherwise. Ignored if $editObj is not specified | ||
| 18556 | tempFlag => $tempFlag, | ||
| 18557 | # Flag that can be set to TRUE (usually by $self->setupNotebook or ->expandNotebook) if | ||
| 18558 | # $editObj is a current object (e.g. if it is a current profile); set to FALSE at all | ||
| 18559 | # other times | ||
| 18560 | currentFlag => FALSE, | ||
| 18561 | # For 'edit' windows, a hash of IVs in $editObj that should be changed. If no changes | ||
| 18562 | # have been made in the 'edit' window, the hash is empty; otherwise the hash contains | ||
| 18563 | # the new values for each IV to be modified | ||
| 18564 | # Hash in the form: | ||
| 18565 | # $editHash{iv_name} = scalar; | ||
| 18566 | # $editHash{iv_name} = list_reference; | ||
| 18567 | # $editHash{iv_name} = hash_reference; | ||
| 18568 | # For 'pref' windows, a hash of key-value pairs set by the window's widgets; | ||
| 18569 | # $self->enableButtons can access this hash to perform any necessary actions | ||
| 18570 | # ('pref' windows don't make a call to ->saveChanges) | ||
| 18571 | editHash => {}, | ||
| 18572 | # Hash containing any number of key-value pairs needed for this particular | ||
| 18573 | # 'edit'/'pref' window; for example, GA::PrefWin::TaskStart uses it to specify a | ||
| 18574 | # task name and type. Set to an empty hash if not required | ||
| 18575 | editConfigHash => \%configHash, | ||
| 18576 | |||
| 18577 | # In the index on the left-hand side of the window, the pointer (Gtk3::TreeIter) for | ||
| 18578 | # the $self->notebook tab that's currently being drawn | ||
| 18579 | indexPointer => undef, | ||
| 18580 | # A hash of inner Gtk3::Notebooks. Keys are a tab number in the outer notebook (first | ||
| 18581 | # tab is #0); the corresponding values are the inner notebook for that tab, or | ||
| 18582 | # 'undef' if the tab has no inner notebook | ||
| 18583 | innerNotebookHash => {}, | ||
| 18584 | |||
| 18585 | # IVs for this type of window | ||
| 18586 | |||
| 18587 | # A flag which, if set to TRUE, means that every object in every region of the world | ||
| 18588 | # model is searched | ||
| 18589 | searchAllFlag => TRUE, | ||
| 18590 | # If ->searchAllFlag is not set, then the name of the region in which to search | ||
| 18591 | searchRegion => undef, | ||
| 18592 | |||
| 18593 | # Which categories of world model objects to search, in the form | ||
| 18594 | # $categoryHash{world_model_category} = undef | ||
| 18595 | categoryHash => { | ||
| 18596 | 'region' => undef, | ||
| 18597 | 'room' => undef, | ||
| 18598 | 'weapon' => undef, | ||
| 18599 | 'armour' => undef, | ||
| 18600 | 'garment' => undef, | ||
| 18601 | 'char' => undef, | ||
| 18602 | 'minion' => undef, | ||
| 18603 | 'sentient' => undef, | ||
| 18604 | 'creature' => undef, | ||
| 18605 | 'portable' => undef, | ||
| 18606 | 'decoration' => undef, | ||
| 18607 | 'custom' => undef, | ||
| 18608 | }, | ||
| 18609 | |||
| 18610 | # IVs required by this 'edit' window (but not by GA::Generic::EditWin) | ||
| 18611 | # A hash to specify which world model IVs should be searched, in the form | ||
| 18612 | # $searchHash{iv_name} = search_string | ||
| 18613 | # Each IV to be checked is added to this hash as a key. The key's value is a search | ||
| 18614 | # string (where appropriate); otherwise the value is 'undef' | ||
| 18615 | # NB Some IVs can be checked in two ways, in which case there are two keys added to the | ||
| 18616 | # hash: 'name' and '_name' | ||
| 18617 | searchHash => {}, | ||
| 18618 | # A parallel hash for IVs that should be checked against a range of values, in the form | ||
| 18619 | # $searchRangeHash{iv_name} = operator | ||
| 18620 | # ...where 'operator' is set to '==', '>', '>=', '<', '<=' or 'min-max' | ||
| 18621 | searchRangeHash => {}, | ||
| 18622 | # A parallel hash for IVs that should be checked against a range of values, when the | ||
| 18623 | # operator is 'min-max' | ||
| 18624 | # The minimum value is the value stored in ->searchHash; the maximum value is the value | ||
| 18625 | # stored in this hash | ||
| 18626 | searchUpperHash => {}, | ||
| 18627 | # Another parallel hash which, this time, contains all possible IVs (i.e. all possible | ||
| 18628 | # keys in ->searchHash), and tells us what kind of check is done on this IV, in the | ||
| 18629 | # form | ||
| 18630 | # $searchTypeHash{iv_name} = type | ||
| 18631 | # 'type' is one of the following: | ||
| 18632 | # 'match' - perform a regex on the IV's value | ||
| 18633 | # 'flag' - check whether the IV flag is set (or not) | ||
| 18634 | # 'string_equal' - check whether the IV string is an exact match for the IV's value | ||
| 18635 | # 'range' - check whether the IV number is in a certain range, or not | ||
| 18636 | # 'include' - check whether the an exact match is found in the IV list | ||
| 18637 | # 'list_match' - perform a regex on every item in the IV list | ||
| 18638 | # 'key' - check whether the key exists in the IV hash | ||
| 18639 | # 'not_key' - check whether the key doesn't exist in the IV hash | ||
| 18640 | # 'used_hash' - check that the IV hash is not empty | ||
| 18641 | # 'value_match' - perform a regex on the values in every key-value pair in the hash | ||
| 18642 | # IV | ||
| 18643 | # 'special' - do something else | ||
| 18644 | searchTypeHash => {}, | ||
| 18645 | |||
| 18646 | # A hash used by $self->performSearch to compile a list of all world model objects in a | ||
| 18647 | # region | ||
| 18648 | compileHash => {}, | ||
| 18649 | }; | ||
| 18650 | |||
| 18651 | # Bless the object into existence | ||
| 18652 | bless $self, $class; | ||
| 18653 | |||
| 18654 | return $self; | ||
| 18655 | } | ||
| 18656 | |||
| 18657 | ################## | ||
| 18658 | # Methods | ||
| 18659 | |||
| 18660 | # Standard window object functions | ||
| 18661 | |||
| 18662 | # sub winSetup {} # Inherited from GA::Generic::ConfigWin | ||
| 18663 | |||
| 18664 | # sub winEnable {} # Inherited from GA::Generic::ConfigWin | ||
| 18665 | |||
| 18666 | # sub winDesengage {} # Inherited from GA::Generic::FreeWin | ||
| 18667 | |||
| 18668 | # sub winDestroy {} # Inherited from GA::Generic::FreeWin | ||
| 18669 | |||
| 18670 | # sub winShowAll {} # Inherited from GA::Generic::Win | ||
| 18671 | |||
| 18672 | # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin | ||
| 18673 | |||
| 18674 | # sub redrawWidgets {} # Inherited from GA::Generic::Win | ||
| 18675 | |||
| 18676 | # ->signal_connects | ||
| 18677 | |||
| 18678 | # Other functions | ||
| 18679 | |||
| 18680 | # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin | ||
| 18681 | |||
| 18682 | sub enableButtons { | ||
| 18683 | |||
| 18684 | # Called by $self->drawWidgets | ||
| 18685 | # We only need a single button so, instead of calling the generic ->enableButtons, call a | ||
| 18686 | # method that creates just one button | ||
| 18687 | # | ||
| 18688 | # Expected arguments | ||
| 18689 | # $hBox - The horizontal packing box in which the buttons live (not yet stored as | ||
| 18690 | # an IV) | ||
| 18691 | # | ||
| 18692 | # Return values | ||
| 18693 | # An empty list on improper arguments | ||
| 18694 | # Otherwise, a list containing the Gtk::Button object created | ||
| 18695 | |||
| 18696 | my ($self, $hBox, $check) = @_; | ||
| 18697 | |||
| 18698 | # Local variables | ||
| 18699 | my @emptyList; | ||
| 18700 | |||
| 18701 | # Check for improper arguments | ||
| 18702 | if (! defined $hBox || defined $check) { | ||
| 18703 | |||
| 18704 | $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_); | ||
| 18705 | return @emptyList; | ||
| 18706 | } | ||
| 18707 | |||
| 18708 | return $self->enableSingleButton($hBox); | ||
| 18709 | } | ||
| 18710 | |||
| 18711 | # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin | ||
| 18712 | |||
| 18713 | sub setupNotebook { | ||
| 18714 | |||
| 18715 | # Called by $self->winEnable | ||
| 18716 | # Creates the first tab for the notebook. The remaining tabs are created by | ||
| 18717 | # $self->expandNotebook | ||
| 18718 | # | ||
| 18719 | # Expected arguments | ||
| 18720 | # (none besides $self) | ||
| 18721 | # | ||
| 18722 | # Return values | ||
| 18723 | # 'undef' on improper arguments | ||
| 18724 | # 1 otherwise | ||
| 18725 | |||
| 18726 | my ($self, $check) = @_; | ||
| 18727 | |||
| 18728 | # Check for improper arguments | ||
| 18729 | if (defined $check) { | ||
| 18730 | |||
| 18731 | return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_); | ||
| 18732 | } | ||
| 18733 | |||
| 18734 | # Tab setup | ||
| 18735 | # N.B. No sub-headings | ||
| 18736 | my $grid = $self->addTab($self->notebook, '_Search'); | ||
| 18737 | |||
| 18738 | # Set up the rest of the tab | ||
| 18739 | $self->searchTab($grid); | ||
| 18740 | |||
| 18741 | # Set up the remaining tabs | ||
| 18742 | $self->expandNotebook(); | ||
| 18743 | |||
| 18744 | # Tab complete | ||
| 18745 | return 1; | ||
| 18746 | } | ||
| 18747 | |||
| 18748 | sub expandNotebook { | ||
| 18749 | |||
| 18750 | # Called by $self->setupNotebook | ||
| 18751 | # Set up additional tabs for the notebook | ||
| 18752 | # | ||
| 18753 | # Expected arguments | ||
| 18754 | # (none besides $self) | ||
| 18755 | # | ||
| 18756 | # Return values | ||
| 18757 | # 'undef' on improper arguments | ||
| 18758 | # 1 otherwise | ||
| 18759 | |||
| 18760 | my ($self, $check) = @_; | ||
| 18761 | |||
| 18762 | # Check for improper arguments | ||
| 18763 | if (defined $check) { | ||
| 18764 | |||
| 18765 | return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_); | ||
| 18766 | } | ||
| 18767 | |||
| 18768 | $self->propertiesTab(); | ||
| 18769 | $self->properties2Tab(); | ||
| 18770 | $self->properties3Tab(); | ||
| 18771 | $self->properties4Tab(); | ||
| 18772 | $self->resultsTab(); | ||
| 18773 | |||
| 18774 | return 1; | ||
| 18775 | } | ||
| 18776 | |||
| 18777 | # sub saveChanges {} # Inherited from GA::Generic::ConfigWin | ||
| 18778 | |||
| 18779 | # Notebook tabs | ||
| 18780 | |||
| 18781 | sub searchTab { | ||
| 18782 | |||
| 18783 | # Search tab | ||
| 18784 | # | ||
| 18785 | # Expected arguments | ||
| 18786 | # $grid - The Gtk3::Grid for this tab | ||
| 18787 | # | ||
| 18788 | # Return values | ||
| 18789 | # 'undef' on improper arguments | ||
| 18790 | # 1 otherwise | ||
| 18791 | |||
| 18792 | my ($self, $grid, $check) = @_; | ||
| 18793 | |||
| 18794 | # Local variables | ||
| 18795 | my (@comboList, @widgetList); | ||
| 18796 | |||
| 18797 | # Check for improper arguments | ||
| 18798 | if (! defined $grid || defined $check) { | ||
| 18799 | |||
| 18800 | return $axmud::CLIENT->writeImproper($self->_objClass . '->searchTab', @_); | ||
| 18801 | } | ||
| 18802 | |||
| 18803 | # Tab setup (already created by the calling function) | ||
| 18804 | |||
| 18805 | # Top section | ||
| 18806 | $self->addLabel($grid, '<b>Search options</b>', | ||
| 18807 | 0, 12, 0, 1); | ||
| 18808 | $self->addLabel($grid, '<i>Specify which parts of the world model to search</i>', | ||
| 18809 | 1, 12, 1, 2); | ||
| 18810 | |||
| 18811 | my ($radioGroup, $radioButton, $radioButton2, $radioButton3); | ||
| 18812 | |||
| 18813 | ($radioGroup, $radioButton) = $self->addRadioButton( | ||
| 18814 | $grid, | ||
| 18815 | undef, | ||
| 18816 | 'Search entire world model', | ||
| 18817 | undef, undef, TRUE, | ||
| 18818 | 1, 12, 2, 3, | ||
| 18819 | ); | ||
| 18820 | $radioButton->signal_connect('toggled' => sub { | ||
| 18821 | |||
| 18822 | if ($radioButton->get_active()) { | ||
| 18823 | |||
| 18824 | $self->ivPoke('searchAllFlag', TRUE); | ||
| 18825 | $self->ivUndef('searchRegion'); | ||
| 18826 | } | ||
| 18827 | }); | ||
| 18828 | |||
| 18829 | ($radioGroup, $radioButton2) = $self->addRadioButton( | ||
| 18830 | $grid, | ||
| 18831 | $radioGroup, | ||
| 18832 | 'Search in current region', | ||
| 18833 | undef, undef, | ||
| 18834 | TRUE, | ||
| 18835 | 1, 12, 3, 4 | ||
| 18836 | ); | ||
| 18837 | $radioButton2->signal_connect('toggled' => sub { | ||
| 18838 | |||
| 18839 | $self->ivPoke('searchAllFlag', FALSE); | ||
| 18840 | $self->ivPoke('searchRegion', $self->session->mapWin->currentRegionmap->name); | ||
| 18841 | }); | ||
| 18842 | # This widget is insensitive, if the current session doesn't have an Automapper window open, | ||
| 18843 | # or if the Automapper window has no current regionmap | ||
| 18844 | if (! $self->session->mapWin || ! $self->session->mapWin->currentRegionmap) { | ||
| 18845 | |||
| 18846 | $radioButton2->set_state('insensitive'); | ||
| 18847 | } | ||
| 18848 | |||
| 18849 | ($radioGroup, $radioButton3) = $self->addRadioButton( | ||
| 18850 | $grid, | ||
| 18851 | $radioGroup, | ||
| 18852 | 'Search in region:', | ||
| 18853 | undef, undef, | ||
| 18854 | TRUE, | ||
| 18855 | 1, 4, 4, 5, | ||
| 18856 | ); | ||
| 18857 | |||
| 18858 | # Get a sorted list of regionmap names | ||
| 18859 | @comboList = sort {lc($a) cmp lc($b)} | ||
| 18860 | ($self->session->worldModelObj->ivKeys('regionmapHash')); | ||
| 18861 | |||
| 18862 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 18863 | TRUE, # No 'undef' value used | ||
| 18864 | 4, 8, 4, 5); | ||
| 18865 | $combo->signal_connect('changed' => sub { | ||
| 18866 | |||
| 18867 | if ($radioButton3->get_active()) { | ||
| 18868 | |||
| 18869 | $self->ivPoke('searchAllFlag', TRUE); | ||
| 18870 | $self->ivPoke('searchRegion', $combo->get_active_text()); | ||
| 18871 | } | ||
| 18872 | }); | ||
| 18873 | |||
| 18874 | $radioButton3->signal_connect('toggled' => sub { | ||
| 18875 | |||
| 18876 | $self->ivPoke('searchAllFlag', FALSE); | ||
| 18877 | $self->ivPoke('searchRegion', $combo->get_active_text()); | ||
| 18878 | }); | ||
| 18879 | |||
| 18880 | # This radiobutton and its combobox are insensitive, if there are no regions | ||
| 18881 | if (! $self->session->worldModelObj->regionmapHash) { | ||
| 18882 | |||
| 18883 | $radioButton3->set_state('insensitive'); | ||
| 18884 | $combo->set_state('insensitive'); | ||
| 18885 | } | ||
| 18886 | |||
| 18887 | # Bottom section | ||
| 18888 | $self->addLabel($grid, '<i>Specify which categories of model object to search</i>', | ||
| 18889 | 1, 12, 6, 7); | ||
| 18890 | |||
| 18891 | # Add check buttons, one for each category of world model object | ||
| 18892 | push ( | ||
| 18893 | @widgetList, | ||
| 18894 | $self->searchTab_addCheckButton($grid, 'region', 'Search regions', 1, 4, 7, 8), | ||
| 18895 | ); | ||
| 18896 | |||
| 18897 | push ( | ||
| 18898 | @widgetList, | ||
| 18899 | $self->searchTab_addCheckButton($grid, 'room', 'Search rooms', 1, 4, 8, 9), | ||
| 18900 | ); | ||
| 18901 | |||
| 18902 | push ( | ||
| 18903 | @widgetList, | ||
| 18904 | $self->searchTab_addCheckButton($grid, 'weapon', 'Search weapons', 1, 4, 10, 11), | ||
| 18905 | ); | ||
| 18906 | |||
| 18907 | push ( | ||
| 18908 | @widgetList, | ||
| 18909 | $self->searchTab_addCheckButton($grid, 'armour', 'Search armour', 1, 4, 11, 12), | ||
| 18910 | ); | ||
| 18911 | |||
| 18912 | push ( | ||
| 18913 | @widgetList, | ||
| 18914 | $self->searchTab_addCheckButton($grid, 'garment', 'Search garments', 4, 8, 7, 8), | ||
| 18915 | ); | ||
| 18916 | |||
| 18917 | push ( | ||
| 18918 | @widgetList, | ||
| 18919 | $self->searchTab_addCheckButton($grid, 'char', 'Search characters', 4, 8, 8, 9), | ||
| 18920 | ); | ||
| 18921 | |||
| 18922 | push ( | ||
| 18923 | @widgetList, | ||
| 18924 | $self->searchTab_addCheckButton($grid, 'minion', 'Search minions', 4, 8, 10, 11), | ||
| 18925 | ); | ||
| 18926 | |||
| 18927 | push ( | ||
| 18928 | @widgetList, | ||
| 18929 | $self->searchTab_addCheckButton($grid, 'sentient', 'Search sentients', 4, 8, 11, 12), | ||
| 18930 | ); | ||
| 18931 | |||
| 18932 | push ( | ||
| 18933 | @widgetList, | ||
| 18934 | $self->searchTab_addCheckButton($grid, 'creature', 'Search creatures', 8, 12, 7, 8), | ||
| 18935 | ); | ||
| 18936 | |||
| 18937 | push ( | ||
| 18938 | @widgetList, | ||
| 18939 | $self->searchTab_addCheckButton($grid, 'portable', 'Search portables', 8, 12, 8, 9), | ||
| 18940 | ); | ||
| 18941 | |||
| 18942 | push ( | ||
| 18943 | @widgetList, | ||
| 18944 | $self->searchTab_addCheckButton( | ||
| 18945 | $grid, | ||
| 18946 | 'decoration', | ||
| 18947 | 'Search decorations', | ||
| 18948 | 8, 12, 10, 11, | ||
| 18949 | ), | ||
| 18950 | ); | ||
| 18951 | |||
| 18952 | push ( | ||
| 18953 | @widgetList, | ||
| 18954 | $self->searchTab_addCheckButton( | ||
| 18955 | $grid, | ||
| 18956 | 'custom', | ||
| 18957 | 'Search custom objects', | ||
| 18958 | 8, 12, 11, 12, | ||
| 18959 | ), | ||
| 18960 | ); | ||
| 18961 | |||
| 18962 | my $checkButton = $self->addCheckButton($grid, 'Select matching rooms on map', undef, TRUE, | ||
| 18963 | 2, 12, 9, 10,); | ||
| 18964 | $checkButton->set_active($self->session->worldModelObj->searchSelectRoomsFlag); | ||
| 18965 | $checkButton->signal_connect('toggled' => sub { | ||
| 18966 | |||
| 18967 | if ($checkButton->get_active()) { | ||
| 18968 | $self->session->worldModelObj->set_searchSelectRoomsFlag(TRUE); | ||
| 18969 | } else { | ||
| 18970 | $self->session->worldModelObj->set_searchSelectRoomsFlag(FALSE); | ||
| 18971 | } | ||
| 18972 | }); | ||
| 18973 | |||
| 18974 | # Add buttons | ||
| 18975 | my $button = $self->addButton( | ||
| 18976 | $grid, | ||
| 18977 | 'Select all', | ||
| 18978 | 'Select all the categories of model object', | ||
| 18979 | undef, | ||
| 18980 | 1, 4, 12, 13, | ||
| 18981 | ); | ||
| 18982 | |||
| 18983 | $button->signal_connect('clicked' => sub { | ||
| 18984 | |||
| 18985 | foreach my $widget (@widgetList) { | ||
| 18986 | |||
| 18987 | $widget->set_active(TRUE); | ||
| 18988 | } | ||
| 18989 | |||
| 18990 | $self->ivPoke('categoryHash', | ||
| 18991 | 'region', undef, | ||
| 18992 | 'room', undef, | ||
| 18993 | 'weapon', undef, | ||
| 18994 | 'armour', undef, | ||
| 18995 | 'garment', undef, | ||
| 18996 | 'character', undef, | ||
| 18997 | 'minion', undef, | ||
| 18998 | 'sentient', undef, | ||
| 18999 | 'creature', undef, | ||
| 19000 | 'portable', undef, | ||
| 19001 | 'decoration', undef, | ||
| 19002 | 'custom', undef, | ||
| 19003 | ); | ||
| 19004 | }); | ||
| 19005 | |||
| 19006 | my $button2 = $self->addButton( | ||
| 19007 | $grid, | ||
| 19008 | 'Unselect all', | ||
| 19009 | 'Unselect all the categories of model object', | ||
| 19010 | undef, | ||
| 19011 | 4, 8, 12, 13, | ||
| 19012 | ); | ||
| 19013 | $button2->signal_connect('clicked' => sub { | ||
| 19014 | |||
| 19015 | foreach my $widget (@widgetList) { | ||
| 19016 | |||
| 19017 | $widget->set_active(FALSE); | ||
| 19018 | } | ||
| 19019 | |||
| 19020 | $self->ivEmpty('categoryHash'); | ||
| 19021 | }); | ||
| 19022 | |||
| 19023 | # Tab complete | ||
| 19024 | return 1; | ||
| 19025 | } | ||
| 19026 | |||
| 19027 | sub searchTab_addCheckButton { | ||
| 19028 | |||
| 19029 | # Called by $self->searchTab | ||
| 19030 | # Creates a single Gtk3::CheckButton at the specified grid position | ||
| 19031 | # | ||
| 19032 | # Expected arguments | ||
| 19033 | # $grid - The Gtk3::Grid for this tab | ||
| 19034 | # $category - The category of model object, e.g. 'room', 'weapon' etc | ||
| 19035 | # $label - The text of the accompanying label | ||
| 19036 | # $leftAttach, $rightAttach, $topAttach, $bottomAttach | ||
| 19037 | # - The position of the checkbutton in the grid | ||
| 19038 | # | ||
| 19039 | # Return values | ||
| 19040 | # 'undef' on improper arguments | ||
| 19041 | # Otherwise, returns the Gtk3::CheckButton created | ||
| 19042 | |||
| 19043 | my ( | ||
| 19044 | $self, $grid, $category, $label, $leftAttach, $rightAttach, $topAttach, $bottomAttach, | ||
| 19045 | $check, | ||
| 19046 | ) = @_; | ||
| 19047 | |||
| 19048 | # Check for improper arguments | ||
| 19049 | if ( | ||
| 19050 | ! defined $grid || ! defined $category || ! defined $label || ! defined $leftAttach | ||
| 19051 | || ! defined $rightAttach || ! defined $topAttach || ! defined $bottomAttach | ||
| 19052 | ) { | ||
| 19053 | return $axmud::CLIENT->writeImproper( | ||
| 19054 | $self->_objClass . '->searchTab_addCheckButton', | ||
| 19055 | @_, | ||
| 19056 | ); | ||
| 19057 | } | ||
| 19058 | |||
| 19059 | # Add the checkbutton | ||
| 19060 | my $checkButton = $self->addCheckButton( | ||
| 19061 | $grid, | ||
| 19062 | $label, | ||
| 19063 | undef, | ||
| 19064 | TRUE, | ||
| 19065 | $leftAttach, $rightAttach, $topAttach, $bottomAttach, | ||
| 19066 | ); | ||
| 19067 | |||
| 19068 | # All the checkbuttons start selected | ||
| 19069 | $checkButton->set_active(TRUE); | ||
| 19070 | |||
| 19071 | # Signal connect | ||
| 19072 | $checkButton->signal_connect('toggled' => sub { | ||
| 19073 | |||
| 19074 | if ($checkButton->get_active()) { | ||
| 19075 | $self->ivAdd('categoryHash', $category, undef); | ||
| 19076 | } else { | ||
| 19077 | $self->ivDelete('categoryHash', $category); | ||
| 19078 | } | ||
| 19079 | }); | ||
| 19080 | |||
| 19081 | return $checkButton; | ||
| 19082 | } | ||
| 19083 | |||
| 19084 | sub propertiesTab { | ||
| 19085 | |||
| 19086 | # Properties tab | ||
| 19087 | # | ||
| 19088 | # Expected arguments | ||
| 19089 | # (none besides $self) | ||
| 19090 | # | ||
| 19091 | # Return values | ||
| 19092 | # 'undef' on improper arguments | ||
| 19093 | # 1 otherwise | ||
| 19094 | |||
| 19095 | my ($self, $check) = @_; | ||
| 19096 | |||
| 19097 | # Check for improper arguments | ||
| 19098 | if (defined $check) { | ||
| 19099 | |||
| 19100 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesTab', @_); | ||
| 19101 | } | ||
| 19102 | |||
| 19103 | # Tab setup | ||
| 19104 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 19105 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'S_hared properties'); | ||
| 19106 | |||
| 19107 | # Add tabs to the inner notebook | ||
| 19108 | $self->propertiesGroup1Tab($innerNotebook); | ||
| 19109 | $self->propertiesGroup2Tab($innerNotebook); | ||
| 19110 | $self->propertiesGroup3Tab($innerNotebook); | ||
| 19111 | $self->propertiesGroup4Tab($innerNotebook); | ||
| 19112 | |||
| 19113 | return 1; | ||
| 19114 | } | ||
| 19115 | |||
| 19116 | sub properties2Tab { | ||
| 19117 | |||
| 19118 | # Properties2 tab | ||
| 19119 | # | ||
| 19120 | # Expected arguments | ||
| 19121 | # (none besides $self) | ||
| 19122 | # | ||
| 19123 | # Return values | ||
| 19124 | # 'undef' on improper arguments | ||
| 19125 | # 1 otherwise | ||
| 19126 | |||
| 19127 | my ($self, $check) = @_; | ||
| 19128 | |||
| 19129 | # Check for improper arguments | ||
| 19130 | if (defined $check) { | ||
| 19131 | |||
| 19132 | return $axmud::CLIENT->writeImproper($self->_objClass . '->properties2Tab', @_); | ||
| 19133 | } | ||
| 19134 | |||
| 19135 | # Tab setup | ||
| 19136 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 19137 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Regions/Rooms'); | ||
| 19138 | |||
| 19139 | # Add tabs to the inner notebook | ||
| 19140 | $self->propertiesRegionsTab($innerNotebook); | ||
| 19141 | $self->propertiesRooms1Tab($innerNotebook); | ||
| 19142 | $self->propertiesRooms2Tab($innerNotebook); | ||
| 19143 | |||
| 19144 | return 1; | ||
| 19145 | } | ||
| 19146 | |||
| 19147 | sub properties3Tab { | ||
| 19148 | |||
| 19149 | # Properties3 tab | ||
| 19150 | # | ||
| 19151 | # Expected arguments | ||
| 19152 | # (none besides $self) | ||
| 19153 | # | ||
| 19154 | # Return values | ||
| 19155 | # 'undef' on improper arguments | ||
| 19156 | # 1 otherwise | ||
| 19157 | |||
| 19158 | my ($self, $check) = @_; | ||
| 19159 | |||
| 19160 | # Check for improper arguments | ||
| 19161 | if (defined $check) { | ||
| 19162 | |||
| 19163 | return $axmud::CLIENT->writeImproper($self->_objClass . '->properties3Tab', @_); | ||
| 19164 | } | ||
| 19165 | |||
| 19166 | # Tab setup | ||
| 19167 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 19168 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Beings'); | ||
| 19169 | |||
| 19170 | # Add tabs to the inner notebook | ||
| 19171 | $self->propertiesCharactersTab($innerNotebook); | ||
| 19172 | $self->propertiesMinionsTab($innerNotebook); | ||
| 19173 | $self->propertiesSentients1Tab($innerNotebook); | ||
| 19174 | $self->propertiesSentients2Tab($innerNotebook); | ||
| 19175 | $self->propertiesCreatures1Tab($innerNotebook); | ||
| 19176 | $self->propertiesCreatures2Tab($innerNotebook); | ||
| 19177 | |||
| 19178 | return 1; | ||
| 19179 | } | ||
| 19180 | |||
| 19181 | sub properties4Tab { | ||
| 19182 | |||
| 19183 | # Properties4 tab | ||
| 19184 | # | ||
| 19185 | # Expected arguments | ||
| 19186 | # (none besides $self) | ||
| 19187 | # | ||
| 19188 | # Return values | ||
| 19189 | # 'undef' on improper arguments | ||
| 19190 | # 1 otherwise | ||
| 19191 | |||
| 19192 | my ($self, $check) = @_; | ||
| 19193 | |||
| 19194 | # Local variables | ||
| 19195 | my (@portList, @decList); | ||
| 19196 | |||
| 19197 | # Check for improper arguments | ||
| 19198 | if (defined $check) { | ||
| 19199 | |||
| 19200 | return $axmud::CLIENT->writeImproper($self->_objClass . '->properties4Tab', @_); | ||
| 19201 | } | ||
| 19202 | |||
| 19203 | # Tab setup | ||
| 19204 | # N.B. No sub-headings | ||
| 19205 | my $grid = $self->addTab($self->notebook, '_Portables/Decorations'); | ||
| 19206 | |||
| 19207 | # Group 5 properties | ||
| 19208 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19209 | 0, 12, 0, 1); | ||
| 19210 | $self->addLabel($grid, '<i>Properties which only apply to portables/decorations</i>', | ||
| 19211 | 1, 12, 1, 2); | ||
| 19212 | |||
| 19213 | @portList = $self->session->currentDict->portableTypeList; | ||
| 19214 | @decList = $self->session->currentDict->decorationTypeList; | ||
| 19215 | |||
| 19216 | $self->propertiesTab_addComboBox($grid, 'type', 'special', | ||
| 19217 | 'Portable object type is', \@portList, 2); | ||
| 19218 | $self->propertiesTab_addComboBox($grid, '_type', 'special', | ||
| 19219 | 'Decoration object type is', \@decList, 3); | ||
| 19220 | |||
| 19221 | # Tab complete | ||
| 19222 | return 1; | ||
| 19223 | } | ||
| 19224 | |||
| 19225 | sub propertiesGroup1Tab { | ||
| 19226 | |||
| 19227 | # PropertiesGroup1 tab | ||
| 19228 | # | ||
| 19229 | # Expected arguments | ||
| 19230 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19231 | # | ||
| 19232 | # Return values | ||
| 19233 | # 'undef' on improper arguments | ||
| 19234 | # 1 otherwise | ||
| 19235 | |||
| 19236 | my ($self, $innerNotebook, $check) = @_; | ||
| 19237 | |||
| 19238 | # Check for improper arguments | ||
| 19239 | if (! defined $innerNotebook || defined $check) { | ||
| 19240 | |||
| 19241 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup1Tab', @_); | ||
| 19242 | } | ||
| 19243 | |||
| 19244 | # Tab setup | ||
| 19245 | # N.B. No sub-headings | ||
| 19246 | my $grid = $self->addTab($innerNotebook, 'Group _1'); | ||
| 19247 | |||
| 19248 | # Group 1 properties | ||
| 19249 | $self->addLabel($grid, '<b>Group 1 properties</b>', | ||
| 19250 | 0, 12, 0, 1); | ||
| 19251 | $self->addLabel($grid, '<i>Applies to all categories of world model object</i>', | ||
| 19252 | 1, 12, 1, 2); | ||
| 19253 | |||
| 19254 | $self->propertiesTab_addEntryWithIcon($grid, 'name', 'match', | ||
| 19255 | 'Name matches (pattern)', 'regex', 1, undef, 2); | ||
| 19256 | $self->propertiesTab_addEntryWithIcon($grid, 'privateHash', 'key', | ||
| 19257 | 'Has private property', 'string', 1, undef, 3); | ||
| 19258 | $self->propertiesTab_addEntryWithIcon($grid, 'sourceCodePath', 'match', | ||
| 19259 | 'Source code path matches (pattern)', 'regex', 1, undef, 4); | ||
| 19260 | $self->propertiesTab_addEntryWithIcon($grid, 'notesList', 'list_match', | ||
| 19261 | 'Line in notes matches (pattern)', 'string', 1, undef, 5); | ||
| 19262 | |||
| 19263 | # Tab complete | ||
| 19264 | return 1; | ||
| 19265 | } | ||
| 19266 | |||
| 19267 | sub propertiesGroup2Tab { | ||
| 19268 | |||
| 19269 | # PropertiesGroup2 tab | ||
| 19270 | # | ||
| 19271 | # Expected arguments | ||
| 19272 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19273 | # | ||
| 19274 | # Return values | ||
| 19275 | # 'undef' on improper arguments | ||
| 19276 | # 1 otherwise | ||
| 19277 | |||
| 19278 | my ($self, $innerNotebook, $check) = @_; | ||
| 19279 | |||
| 19280 | # Check for improper arguments | ||
| 19281 | if (! defined $innerNotebook || defined $check) { | ||
| 19282 | |||
| 19283 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup2Tab', @_); | ||
| 19284 | } | ||
| 19285 | |||
| 19286 | # Tab setup | ||
| 19287 | # N.B. No sub-headings | ||
| 19288 | my $grid = $self->addTab($innerNotebook, 'Group _2'); | ||
| 19289 | |||
| 19290 | # Group 2 properties | ||
| 19291 | $self->addLabel($grid, '<b>Group 2 properties</b>', | ||
| 19292 | 0, 12, 0, 1); | ||
| 19293 | $self->addLabel( | ||
| 19294 | $grid, | ||
| 19295 | '<i>Applies to all categories of world model object except regions and rooms</i>', | ||
| 19296 | 1, 12, 1, 2, | ||
| 19297 | ); | ||
| 19298 | |||
| 19299 | $self->propertiesTab_addEntryWithIcon($grid, 'noun', 'match', | ||
| 19300 | 'Main noun matches (pattern)', 'regex', 1, undef, 2); | ||
| 19301 | $self->propertiesTab_addEntryWithIcon($grid, 'otherNounList', 'include', | ||
| 19302 | 'Other noun list includes', 'string', 1, undef, 3); | ||
| 19303 | $self->propertiesTab_addEntryWithIcon($grid, 'adjList', 'include', | ||
| 19304 | 'Adjective list includes', 'string', 1, undef, 4); | ||
| 19305 | $self->propertiesTab_addEntryWithIcon($grid, 'pseudoAdjList', 'include', | ||
| 19306 | 'Pseudo-adjective list includes', 'string', 1, undef, 5); | ||
| 19307 | $self->propertiesTab_addEntryWithIcon($grid, 'rootAdjList', 'include', | ||
| 19308 | 'Root adjective list includes', 'string', 1, undef, 6); | ||
| 19309 | $self->propertiesTab_addEntryWithIcon($grid, 'unknownWordList', 'include', | ||
| 19310 | 'Unknown word list includes', 'string', 1, undef, 7); | ||
| 19311 | $self->propertiesTab_addEntryWithIcon($grid, 'baseString', 'match', | ||
| 19312 | 'Base string matches (pattern)', 'regex', 1, undef, 8); | ||
| 19313 | $self->propertiesTab_addEntryWithIcon($grid, 'descrip', 'match', | ||
| 19314 | 'Description matches (pattern)', 'regex', 1, undef, 9); | ||
| 19315 | |||
| 19316 | # Tab complete | ||
| 19317 | return 1; | ||
| 19318 | } | ||
| 19319 | |||
| 19320 | sub propertiesGroup3Tab { | ||
| 19321 | |||
| 19322 | # PropertiesGroup3 tab | ||
| 19323 | # | ||
| 19324 | # Expected arguments | ||
| 19325 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19326 | # | ||
| 19327 | # Return values | ||
| 19328 | # 'undef' on improper arguments | ||
| 19329 | # 1 otherwise | ||
| 19330 | |||
| 19331 | my ($self, $innerNotebook, $check) = @_; | ||
| 19332 | |||
| 19333 | # Check for improper arguments | ||
| 19334 | if (! defined $innerNotebook || defined $check) { | ||
| 19335 | |||
| 19336 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup3Tab', @_); | ||
| 19337 | } | ||
| 19338 | |||
| 19339 | # Tab setup | ||
| 19340 | # N.B. No sub-headings | ||
| 19341 | my $grid = $self->addTab($innerNotebook, 'Group _3'); | ||
| 19342 | |||
| 19343 | # Group 3 properties | ||
| 19344 | $self->addLabel($grid, '<b>Group 3 properties</b>', | ||
| 19345 | 0, 12, 0, 1); | ||
| 19346 | $self->addLabel( | ||
| 19347 | $grid, | ||
| 19348 | '<i>Applies to characters, minions, sentients, creatures and custom objects</i>', | ||
| 19349 | 1, 12, 1, 2, | ||
| 19350 | ); | ||
| 19351 | |||
| 19352 | $self->propertiesTab_addCheckButton($grid, 'explicitFlag', 'flag', | ||
| 19353 | 'Explicit in room description?', 2); | ||
| 19354 | $self->propertiesTab_addCheckButton($grid, 'alreadyAttackedFlag', 'flag', | ||
| 19355 | 'Already attacked?', 3); | ||
| 19356 | |||
| 19357 | # Tab complete | ||
| 19358 | return 1; | ||
| 19359 | } | ||
| 19360 | |||
| 19361 | sub propertiesGroup4Tab { | ||
| 19362 | |||
| 19363 | # PropertiesGroup4 tab | ||
| 19364 | # | ||
| 19365 | # Expected arguments | ||
| 19366 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19367 | # | ||
| 19368 | # Return values | ||
| 19369 | # 'undef' on improper arguments | ||
| 19370 | # 1 otherwise | ||
| 19371 | |||
| 19372 | my ($self, $innerNotebook, $check) = @_; | ||
| 19373 | |||
| 19374 | # Check for improper arguments | ||
| 19375 | if (! defined $innerNotebook || defined $check) { | ||
| 19376 | |||
| 19377 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesGroup4Tab', @_); | ||
| 19378 | } | ||
| 19379 | |||
| 19380 | # Tab setup | ||
| 19381 | # N.B. No sub-headings | ||
| 19382 | my $grid = $self->addTab($innerNotebook, 'Group _4'); | ||
| 19383 | |||
| 19384 | # Group 4 properties | ||
| 19385 | $self->addLabel($grid, '<b>Group 4 properties</b>', | ||
| 19386 | 0, 12, 0, 1); | ||
| 19387 | $self->addLabel( | ||
| 19388 | $grid, | ||
| 19389 | '<i>Applies to weapons, armour, garments, portables, decorations and custom' | ||
| 19390 | . ' objects</i>', | ||
| 19391 | 1, 12, 1, 2, | ||
| 19392 | ); | ||
| 19393 | |||
| 19394 | $self->propertiesTab_addCheckButton($grid, 'explicitFlag', 'flag', | ||
| 19395 | 'Explicit in room description?', 2); | ||
| 19396 | $self->propertiesTab_addEntryWithRange($grid, 'weight', 'range', | ||
| 19397 | 'Object\'s weight', 'float', 0, undef, 3); | ||
| 19398 | $self->propertiesTab_addEntryWithRange($grid, 'bonusHash', 'range', | ||
| 19399 | 'Stat bonuses', 'int', undef, undef, 4); | ||
| 19400 | $self->propertiesTab_addEntryWithRange($grid, 'condition', 'range', | ||
| 19401 | 'Condition (0-100)', 'int', 0, undef, 5); | ||
| 19402 | $self->propertiesTab_addCheckButton($grid, 'fixableFlag', 'flag', | ||
| 19403 | 'Fixable/repairable?', 6); | ||
| 19404 | $self->propertiesTab_addCheckButton($grid, 'sellableFlag', 'flag', | ||
| 19405 | 'Sellable?', 7); | ||
| 19406 | $self->propertiesTab_addEntryWithRange($grid, 'buyValue', 'range', | ||
| 19407 | 'Value when bought', 'float', 0, undef, 8); | ||
| 19408 | $self->propertiesTab_addEntryWithRange($grid, 'sellValue', 'range', | ||
| 19409 | 'Value when sold', 'float', 0, undef, 9); | ||
| 19410 | $self->propertiesTab_addEntryWithIcon($grid, 'exclusiveHash', 'key', | ||
| 19411 | 'Exclusive hash includes profile', 'string', 1, undef, 10); | ||
| 19412 | |||
| 19413 | # Tab complete | ||
| 19414 | return 1; | ||
| 19415 | } | ||
| 19416 | |||
| 19417 | sub propertiesRegionsTab { | ||
| 19418 | |||
| 19419 | # PropertiesRegions tab | ||
| 19420 | # | ||
| 19421 | # Expected arguments | ||
| 19422 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19423 | # | ||
| 19424 | # Return values | ||
| 19425 | # 'undef' on improper arguments | ||
| 19426 | # 1 otherwise | ||
| 19427 | |||
| 19428 | my ($self, $innerNotebook, $check) = @_; | ||
| 19429 | |||
| 19430 | # Check for improper arguments | ||
| 19431 | if (! defined $innerNotebook || defined $check) { | ||
| 19432 | |||
| 19433 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRegionsTab', @_); | ||
| 19434 | } | ||
| 19435 | |||
| 19436 | # Tab setup | ||
| 19437 | # N.B. No sub-headings | ||
| 19438 | my $grid = $self->addTab($innerNotebook, 'Re_gions'); | ||
| 19439 | |||
| 19440 | # Group 5 properties | ||
| 19441 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19442 | 0, 12, 0, 1); | ||
| 19443 | $self->addLabel($grid, '<i>Properties which apply only to regions</i>', | ||
| 19444 | 1, 12, 1, 2); | ||
| 19445 | |||
| 19446 | $self->propertiesTab_addCheckButton($grid, 'tempRegionFlag', 'flag', | ||
| 19447 | 'Region is temporary?', 2); | ||
| 19448 | $self->propertiesTab_addCheckButton($grid, 'finishedFlag', 'flag', | ||
| 19449 | 'Region is finished?', 3); | ||
| 19450 | |||
| 19451 | # Tab complete | ||
| 19452 | return 1; | ||
| 19453 | } | ||
| 19454 | |||
| 19455 | sub propertiesRooms1Tab { | ||
| 19456 | |||
| 19457 | # PropertiesRooms1 tab | ||
| 19458 | # | ||
| 19459 | # Expected arguments | ||
| 19460 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19461 | # | ||
| 19462 | # Return values | ||
| 19463 | # 'undef' on improper arguments | ||
| 19464 | # 1 otherwise | ||
| 19465 | |||
| 19466 | my ($self, $innerNotebook, $check) = @_; | ||
| 19467 | |||
| 19468 | # Check for improper arguments | ||
| 19469 | if (! defined $innerNotebook || defined $check) { | ||
| 19470 | |||
| 19471 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRooms1Tab', @_); | ||
| 19472 | } | ||
| 19473 | |||
| 19474 | # Tab setup | ||
| 19475 | # N.B. No sub-headings | ||
| 19476 | my $grid = $self->addTab($innerNotebook, '_Rooms 1'); | ||
| 19477 | |||
| 19478 | # Group 5 properties | ||
| 19479 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19480 | 0, 12, 0, 1); | ||
| 19481 | $self->addLabel($grid, '<i>Properties which apply only to rooms (page 1/2)</i>', | ||
| 19482 | 1, 12, 1, 2); | ||
| 19483 | |||
| 19484 | $self->propertiesTab_addEntryWithIcon($grid, 'descripHash', 'value_match', | ||
| 19485 | 'Verbose descrips match (pattern)', 'regex', 1, undef, 2); | ||
| 19486 | $self->propertiesTab_addEntryWithIcon($grid, 'titleList', 'list_match', | ||
| 19487 | 'Room titles match (pattern)', 'regex', 1, undef, 3); | ||
| 19488 | $self->propertiesTab_addEntryWithIcon($grid, 'sortedExitList', 'include', | ||
| 19489 | 'Exits include', 'string', 1, undef, 4); | ||
| 19490 | $self->propertiesTab_addEntryWithIcon($grid, 'visitHash', 'key', | ||
| 19491 | 'Visitors include', 'string', 1, undef, 5); | ||
| 19492 | $self->propertiesTab_addEntryWithIcon($grid, '_visitHash', 'not_key', | ||
| 19493 | 'Visitors don\'t include', 'string', 1, undef, 6); | ||
| 19494 | $self->propertiesTab_addEntryWithIcon($grid, 'exclusiveHash', 'key', | ||
| 19495 | 'Exclusive hash includes profile', 'string', 1, undef, 7); | ||
| 19496 | $self->propertiesTab_addEntryWithIcon($grid, 'roomFlagHash', 'key', | ||
| 19497 | 'Room flags include', 'string', 1, undef, 8); | ||
| 19498 | $self->propertiesTab_addEntryWithIcon($grid, 'roomGuild', 'match', | ||
| 19499 | 'Room guild matches (pattern)', 'regex', 1, undef, 9); | ||
| 19500 | |||
| 19501 | # Tab complete | ||
| 19502 | return 1; | ||
| 19503 | } | ||
| 19504 | |||
| 19505 | sub propertiesRooms2Tab { | ||
| 19506 | |||
| 19507 | # PropertiesRooms2 tab | ||
| 19508 | # | ||
| 19509 | # Expected arguments | ||
| 19510 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19511 | # | ||
| 19512 | # Return values | ||
| 19513 | # 'undef' on improper arguments | ||
| 19514 | # 1 otherwise | ||
| 19515 | |||
| 19516 | my ($self, $innerNotebook, $check) = @_; | ||
| 19517 | |||
| 19518 | # Check for improper arguments | ||
| 19519 | if (! defined $innerNotebook || defined $check) { | ||
| 19520 | |||
| 19521 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesRooms2Tab', @_); | ||
| 19522 | } | ||
| 19523 | |||
| 19524 | # Tab setup | ||
| 19525 | # N.B. No sub-headings | ||
| 19526 | my $grid = $self->addTab($innerNotebook, 'Rooms 2'); | ||
| 19527 | |||
| 19528 | # Group 5 properties | ||
| 19529 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19530 | 0, 12, 0, 1); | ||
| 19531 | $self->addLabel($grid, '<i>Properties which apply only to rooms (page 2/2)</i>', | ||
| 19532 | 1, 12, 1, 2); | ||
| 19533 | |||
| 19534 | $self->propertiesTab_addCheckButton($grid, 'hiddenObjHash', 'used_hash', | ||
| 19535 | 'Contains hidden objects?', 2); | ||
| 19536 | $self->propertiesTab_addEntryWithIcon($grid, '_hiddenObjHash', 'special', | ||
| 19537 | 'Hidden object name matches (pattern)', 'regex', 1, undef, 3); | ||
| 19538 | $self->propertiesTab_addEntryWithIcon($grid, 'searchHash', 'key', | ||
| 19539 | 'Search strings include', 'string', 1, undef, 4); | ||
| 19540 | $self->propertiesTab_addEntryWithIcon($grid, '_searchHash', 'value_match', | ||
| 19541 | 'Search responses match (pattern)', 'regex', 1, undef, 5); | ||
| 19542 | $self->propertiesTab_addEntryWithIcon($grid, 'nounList', 'include', | ||
| 19543 | 'Noun list includes', 'string', 1, undef, 6); | ||
| 19544 | $self->propertiesTab_addEntryWithIcon($grid, 'adjList', 'include', | ||
| 19545 | 'Adjective list includes', 'string', 1, undef, 7); | ||
| 19546 | $self->propertiesTab_addEntryWithIcon($grid, 'arriveScriptList', 'include', | ||
| 19547 | 'Arrival scripts to run include', 'string', 1, undef, 8); | ||
| 19548 | |||
| 19549 | # Tab complete | ||
| 19550 | return 1; | ||
| 19551 | } | ||
| 19552 | |||
| 19553 | sub propertiesCharactersTab { | ||
| 19554 | |||
| 19555 | # PropertiesCharacters tab | ||
| 19556 | # | ||
| 19557 | # Expected arguments | ||
| 19558 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19559 | # | ||
| 19560 | # Return values | ||
| 19561 | # 'undef' on improper arguments | ||
| 19562 | # 1 otherwise | ||
| 19563 | |||
| 19564 | my ($self, $innerNotebook, $check) = @_; | ||
| 19565 | |||
| 19566 | # Local variables | ||
| 19567 | my @list; | ||
| 19568 | |||
| 19569 | # Check for improper arguments | ||
| 19570 | if (! defined $innerNotebook || defined $check) { | ||
| 19571 | |||
| 19572 | return $axmud::CLIENT->writeImproper( | ||
| 19573 | $self->_objClass . '->propertiesCharactersTab', | ||
| 19574 | @_, | ||
| 19575 | ); | ||
| 19576 | } | ||
| 19577 | |||
| 19578 | # Tab setup | ||
| 19579 | # N.B. No sub-headings | ||
| 19580 | my $grid = $self->addTab($innerNotebook, '_Characters'); | ||
| 19581 | |||
| 19582 | # Group 5 properties | ||
| 19583 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19584 | 0, 12, 0, 1); | ||
| 19585 | $self->addLabel($grid, '<i>Properties which apply only to characters</i>', | ||
| 19586 | 1, 12, 1, 2); | ||
| 19587 | |||
| 19588 | $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match', | ||
| 19589 | 'Guild matches (pattern)', 'regex', 1, undef, 2); | ||
| 19590 | $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match', | ||
| 19591 | 'Race matches (pattern)', 'regex', 1, undef, 3); | ||
| 19592 | $self->propertiesTab_addCheckButton($grid, 'ownCharFlag', 'flag', | ||
| 19593 | 'Belongs to you?', 4); | ||
| 19594 | $self->propertiesTab_addEntryWithIcon($grid, 'owner', 'match', | ||
| 19595 | 'Owner\'s name matches (pattern)', 'regex', 1, undef, 5); | ||
| 19596 | @list = ('mortal', 'wiz', 'test'); | ||
| 19597 | $self->propertiesTab_addComboBox($grid, 'mortalStatus', 'string_equal', | ||
| 19598 | 'Mortal status is', \@list, 6); | ||
| 19599 | @list = ('friendly', 'neutral', 'hostile'); | ||
| 19600 | $self->propertiesTab_addComboBox($grid, 'diplomaticStatus', 'string_equal', | ||
| 19601 | 'Diplomatic status is', \@list, 7); | ||
| 19602 | $self->propertiesTab_addCheckButton($grid, 'grudgeFlag', 'flag', | ||
| 19603 | 'Ever attacked you?', 8); | ||
| 19604 | $self->propertiesTab_addEntryWithRange($grid, 'level', 'range', | ||
| 19605 | 'Level', 'int', 0, undef, 9); | ||
| 19606 | $self->propertiesTab_addEntryWithIcon($grid, 'questList', 'key', | ||
| 19607 | 'Quest list includes', 'string', 1, undef, 10); | ||
| 19608 | |||
| 19609 | # Tab complete | ||
| 19610 | return 1; | ||
| 19611 | } | ||
| 19612 | |||
| 19613 | sub propertiesMinionsTab { | ||
| 19614 | |||
| 19615 | # PropertiesMinions tab | ||
| 19616 | # | ||
| 19617 | # Expected arguments | ||
| 19618 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19619 | # | ||
| 19620 | # Return values | ||
| 19621 | # 'undef' on improper arguments | ||
| 19622 | # 1 otherwise | ||
| 19623 | |||
| 19624 | my ($self, $innerNotebook, $check) = @_; | ||
| 19625 | |||
| 19626 | # Check for improper arguments | ||
| 19627 | if (! defined $innerNotebook || defined $check) { | ||
| 19628 | |||
| 19629 | return $axmud::CLIENT->writeImproper($self->_objClass . '->propertiesMinionsTab', @_); | ||
| 19630 | } | ||
| 19631 | |||
| 19632 | # Tab setup | ||
| 19633 | # N.B. No sub-headings | ||
| 19634 | my $grid = $self->addTab($innerNotebook, '_Minions'); | ||
| 19635 | |||
| 19636 | # Group 5 properties | ||
| 19637 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19638 | 0, 12, 0, 1); | ||
| 19639 | $self->addLabel($grid, '<i>Properties which apply only to minions</i>', | ||
| 19640 | 1, 12, 1, 2); | ||
| 19641 | |||
| 19642 | $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match', | ||
| 19643 | 'Guild matches (pattern)', 'regex', 1, undef, 2); | ||
| 19644 | $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match', | ||
| 19645 | 'Race matches (pattern)', 'regex', 1, undef, 3); | ||
| 19646 | $self->propertiesTab_addCheckButton($grid, 'ownMinionFlag', 'flag', | ||
| 19647 | 'Belongs to you?', 4); | ||
| 19648 | $self->propertiesTab_addEntryWithRange($grid, 'level', 'range', | ||
| 19649 | 'Level', 'int', 0, undef, 5); | ||
| 19650 | $self->propertiesTab_addEntryWithRange($grid, 'value', 'range', | ||
| 19651 | 'Cost of acquiring', 'int', 0, undef, 6); | ||
| 19652 | |||
| 19653 | # Tab complete | ||
| 19654 | return 1; | ||
| 19655 | } | ||
| 19656 | |||
| 19657 | sub propertiesSentients1Tab { | ||
| 19658 | |||
| 19659 | # PropertiesSentients1 tab | ||
| 19660 | # | ||
| 19661 | # Expected arguments | ||
| 19662 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19663 | # | ||
| 19664 | # Return values | ||
| 19665 | # 'undef' on improper arguments | ||
| 19666 | # 1 otherwise | ||
| 19667 | |||
| 19668 | my ($self, $innerNotebook, $check) = @_; | ||
| 19669 | |||
| 19670 | # Local variables | ||
| 19671 | my @list; | ||
| 19672 | |||
| 19673 | # Check for improper arguments | ||
| 19674 | if (! defined $innerNotebook || defined $check) { | ||
| 19675 | |||
| 19676 | return $axmud::CLIENT->writeImproper( | ||
| 19677 | $self->_objClass . '->propertiesSentients1Tab', | ||
| 19678 | @_, | ||
| 19679 | ); | ||
| 19680 | } | ||
| 19681 | |||
| 19682 | # Tab setup | ||
| 19683 | # N.B. No sub-headings | ||
| 19684 | my $grid = $self->addTab($innerNotebook, '_Sentients 1'); | ||
| 19685 | |||
| 19686 | # Group 5 properties | ||
| 19687 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19688 | 0, 12, 0, 1); | ||
| 19689 | $self->addLabel($grid, '<i>Properties which apply only to sentients (page 1/2)</i>', | ||
| 19690 | 1, 12, 1, 2); | ||
| 19691 | |||
| 19692 | $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match', | ||
| 19693 | 'Guild matches (pattern)', 'regex', 1, undef, 2); | ||
| 19694 | $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match', | ||
| 19695 | 'Race matches (pattern)', 'regex', 1, undef, 3); | ||
| 19696 | $self->propertiesTab_addCheckButton($grid, 'talkativeFlag', 'flag', | ||
| 19697 | 'Talkative?', 4); | ||
| 19698 | $self->propertiesTab_addEntryWithIcon($grid, 'talkList', 'list_match', | ||
| 19699 | 'Talk list includes match (pattern)', 'regex', 1, undef, 5); | ||
| 19700 | $self->propertiesTab_addCheckButton($grid, 'actionFlag', 'flag', | ||
| 19701 | 'Seen performing actions?', 6); | ||
| 19702 | $self->propertiesTab_addEntryWithIcon($grid, 'actionList', 'list_match', | ||
| 19703 | 'Action list includes match (pattern)', 'regex', 1, undef, 7); | ||
| 19704 | $self->propertiesTab_addCheckButton($grid, 'unfriendlyFlag', 'flag', | ||
| 19705 | 'Ever initiated combat?', 8); | ||
| 19706 | @list = ('good', 'evil', 'neutral'); | ||
| 19707 | $self->propertiesTab_addComboBox($grid, 'morality', 'string_equal', | ||
| 19708 | 'Morality is', \@list, 9); | ||
| 19709 | |||
| 19710 | # Tab complete | ||
| 19711 | return 1; | ||
| 19712 | } | ||
| 19713 | |||
| 19714 | sub propertiesSentients2Tab { | ||
| 19715 | |||
| 19716 | # PropertiesSentients2 tab | ||
| 19717 | # | ||
| 19718 | # Expected arguments | ||
| 19719 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19720 | # | ||
| 19721 | # Return values | ||
| 19722 | # 'undef' on improper arguments | ||
| 19723 | # 1 otherwise | ||
| 19724 | |||
| 19725 | my ($self, $innerNotebook, $check) = @_; | ||
| 19726 | |||
| 19727 | # Check for improper arguments | ||
| 19728 | if (! defined $innerNotebook || defined $check) { | ||
| 19729 | |||
| 19730 | return $axmud::CLIENT->writeImproper( | ||
| 19731 | $self->_objClass . '->propertiesSentients2Tab', | ||
| 19732 | @_, | ||
| 19733 | ); | ||
| 19734 | } | ||
| 19735 | |||
| 19736 | # Tab setup | ||
| 19737 | # N.B. No sub-headings | ||
| 19738 | my $grid = $self->addTab($innerNotebook, '_Sentients 2'); | ||
| 19739 | |||
| 19740 | # Group 5 properties | ||
| 19741 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19742 | 0, 12, 0, 1); | ||
| 19743 | $self->addLabel($grid, '<i>Properties which apply only to sentients (page 2/2)</i>', | ||
| 19744 | 1, 12, 1, 2); | ||
| 19745 | |||
| 19746 | $self->propertiesTab_addCheckButton($grid, 'wanderFlag', 'flag', | ||
| 19747 | 'Tends to wander off (of own volition)?', 2); | ||
| 19748 | $self->propertiesTab_addCheckButton($grid, 'fleeFlag', 'flag', | ||
| 19749 | 'Has ever fleed combat?', 3); | ||
| 19750 | $self->propertiesTab_addCheckButton($grid, 'quickFleeFlag', 'flag', | ||
| 19751 | 'Tends to flee combat quickly?', 4); | ||
| 19752 | $self->propertiesTab_addCheckButton($grid, 'noAttackFlag', 'flag', | ||
| 19753 | 'Should NEVER be attacked?', 5); | ||
| 19754 | $self->propertiesTab_addCheckButton($grid, 'mercyFlag', 'flag', | ||
| 19755 | 'Mercies, rather than kills, opponents?', 6); | ||
| 19756 | $self->propertiesTab_addEntryWithIcon($grid, 'questName', 'match', | ||
| 19757 | 'Associated with quest matching (pattern)', 'regex', 1, undef, 7); | ||
| 19758 | $self->propertiesTab_addEntryWithRange($grid, 'level', 'range', | ||
| 19759 | 'Level', 'int', 0, undef, 8); | ||
| 19760 | $self->propertiesTab_addEntryWithRange($grid, 'cashList', 'range', | ||
| 19761 | 'Average cash', 'float', 0, undef, 9); | ||
| 19762 | |||
| 19763 | # Tab complete | ||
| 19764 | return 1; | ||
| 19765 | } | ||
| 19766 | |||
| 19767 | sub propertiesCreatures1Tab { | ||
| 19768 | |||
| 19769 | # PropertiesCreatures1 tab | ||
| 19770 | # | ||
| 19771 | # Expected arguments | ||
| 19772 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19773 | # | ||
| 19774 | # Return values | ||
| 19775 | # 'undef' on improper arguments | ||
| 19776 | # 1 otherwise | ||
| 19777 | |||
| 19778 | my ($self, $innerNotebook, $check) = @_; | ||
| 19779 | |||
| 19780 | # Local variables | ||
| 19781 | my @list; | ||
| 19782 | |||
| 19783 | # Check for improper arguments | ||
| 19784 | if (! defined $innerNotebook || defined $check) { | ||
| 19785 | |||
| 19786 | return $axmud::CLIENT->writeImproper( | ||
| 19787 | $self->_objClass . '->propertiesCreatures1Tab', | ||
| 19788 | @_, | ||
| 19789 | ); | ||
| 19790 | } | ||
| 19791 | |||
| 19792 | # Tab setup | ||
| 19793 | # N.B. No sub-headings | ||
| 19794 | my $grid = $self->addTab($innerNotebook, '_Creatures 1'); | ||
| 19795 | |||
| 19796 | # Group 5 properties | ||
| 19797 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19798 | 0, 12, 0, 1); | ||
| 19799 | $self->addLabel($grid, '<i>Properties which apply only to creatures (page 1/2)</i>', | ||
| 19800 | 1, 12, 1, 2); | ||
| 19801 | |||
| 19802 | $self->propertiesTab_addEntryWithIcon($grid, 'guild', 'match', | ||
| 19803 | 'Guild matches (pattern)', 'regex', 1, undef, 2); | ||
| 19804 | $self->propertiesTab_addEntryWithIcon($grid, 'race', 'match', | ||
| 19805 | 'Race matches (pattern)', 'regex', 1, undef, 3); | ||
| 19806 | $self->propertiesTab_addCheckButton($grid, 'actionFlag', 'flag', | ||
| 19807 | 'Seen performing actions?', 4); | ||
| 19808 | $self->propertiesTab_addEntryWithIcon($grid, 'actionList', 'list_match', | ||
| 19809 | 'Action list includes match (pattern)', 'regex', 1, undef, 5); | ||
| 19810 | $self->propertiesTab_addCheckButton($grid, 'unfriendlyFlag', 'flag', | ||
| 19811 | 'Ever initiated combat?', 6); | ||
| 19812 | @list = ('good', 'evil', 'neutral'); | ||
| 19813 | $self->propertiesTab_addComboBox($grid, 'morality', 'string_equal', | ||
| 19814 | 'Morality is', \@list, 7); | ||
| 19815 | |||
| 19816 | # Tab complete | ||
| 19817 | return 1; | ||
| 19818 | } | ||
| 19819 | |||
| 19820 | sub propertiesCreatures2Tab { | ||
| 19821 | |||
| 19822 | # PropertiesCreatures2 tab | ||
| 19823 | # | ||
| 19824 | # Expected arguments | ||
| 19825 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 19826 | # | ||
| 19827 | # Return values | ||
| 19828 | # 'undef' on improper arguments | ||
| 19829 | # 1 otherwise | ||
| 19830 | |||
| 19831 | my ($self, $innerNotebook, $check) = @_; | ||
| 19832 | |||
| 19833 | # Check for improper arguments | ||
| 19834 | if (! defined $innerNotebook || defined $check) { | ||
| 19835 | |||
| 19836 | return $axmud::CLIENT->writeImproper( | ||
| 19837 | $self->_objClass . '->propertiesCreatures2Tab', | ||
| 19838 | @_, | ||
| 19839 | ); | ||
| 19840 | } | ||
| 19841 | |||
| 19842 | # Tab setup | ||
| 19843 | # N.B. No sub-headings | ||
| 19844 | my $grid = $self->addTab($innerNotebook, '_Creatures 2'); | ||
| 19845 | |||
| 19846 | # Group 5 properties | ||
| 19847 | $self->addLabel($grid, '<b>Group 5 properties</b>', | ||
| 19848 | 0, 12, 0, 1); | ||
| 19849 | $self->addLabel($grid, '<i>Properties which apply only to creatures (page 2/2)</i>', | ||
| 19850 | 1, 12, 1, 2); | ||
| 19851 | |||
| 19852 | $self->propertiesTab_addCheckButton($grid, 'wanderFlag', 'flag', | ||
| 19853 | 'Tends to wander off (of own volition)?', 2); | ||
| 19854 | $self->propertiesTab_addCheckButton($grid, 'fleeFlag', 'flag', | ||
| 19855 | 'Has ever fleed combat?', 3); | ||
| 19856 | $self->propertiesTab_addCheckButton($grid, 'quickFleeFlag', 'flag', | ||
| 19857 | 'Tends to flee combat quickly?', 4); | ||
| 19858 | $self->propertiesTab_addCheckButton($grid, 'noAttackFlag', 'flag', | ||
| 19859 | 'Should NEVER be attacked?', 5); | ||
| 19860 | $self->propertiesTab_addCheckButton($grid, 'mercyFlag', 'flag', | ||
| 19861 | 'Mercies, rather than kills, opponents?', 6); | ||
| 19862 | $self->propertiesTab_addEntryWithIcon($grid, 'questName', 'match', | ||
| 19863 | 'Associated with quest matching (pattern)', 'regex', 1, undef, 7); | ||
| 19864 | $self->propertiesTab_addEntryWithRange($grid, 'level', 'range', | ||
| 19865 | 'Level', 'int', 0, undef, 8); | ||
| 19866 | $self->propertiesTab_addEntryWithRange($grid, 'cashList', 'range', | ||
| 19867 | 'Average cash', 'float', 0, undef, 9); | ||
| 19868 | |||
| 19869 | # Tab complete | ||
| 19870 | return 1; | ||
| 19871 | } | ||
| 19872 | |||
| 19873 | sub propertiesTab_addCheckButton { | ||
| 19874 | |||
| 19875 | # Called by several $self->propertiesXXX tabs | ||
| 19876 | # Adds a single line to the tab with a main checkbutton, a label and a second checkbutton | ||
| 19877 | # to specify the state of the flag | ||
| 19878 | # | ||
| 19879 | # Expected arguments | ||
| 19880 | # $grid - The Gtk3::Grid for this tab | ||
| 19881 | # $iv - The IV to add to the search - matches a key in $self->searchHash | ||
| 19882 | # $ivType - What kind of checking should be done on this IV (see the comments in | ||
| 19883 | # ->new) | ||
| 19884 | # $label - The accompanying label text | ||
| 19885 | # $topAttach - The position of the line in the grid | ||
| 19886 | # | ||
| 19887 | # Return values | ||
| 19888 | # 'undef' on improper arguments | ||
| 19889 | # 1 otherwise | ||
| 19890 | |||
| 19891 | my ($self, $grid, $iv, $ivType, $label, $topAttach, $check) = @_; | ||
| 19892 | |||
| 19893 | # Check for improper arguments | ||
| 19894 | if ( | ||
| 19895 | ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label | ||
| 19896 | || ! defined $topAttach || defined $check | ||
| 19897 | ) { | ||
| 19898 | return $axmud::CLIENT->writeImproper( | ||
| 19899 | $self->_objClass . '->propertiesTab_addCheckButton', | ||
| 19900 | @_, | ||
| 19901 | ); | ||
| 19902 | } | ||
| 19903 | |||
| 19904 | # Add a checkbutton which turns on/off checking this IV completely | ||
| 19905 | my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE, | ||
| 19906 | 1, 6, $topAttach, ($topAttach + 1)); | ||
| 19907 | |||
| 19908 | # Add a second checkbutton to specify the state of the flag | ||
| 19909 | my $checkButton2 = $self->addCheckButton( | ||
| 19910 | $grid, 'Select or deselect this setting', undef, TRUE, | ||
| 19911 | 6, 12, $topAttach, ($topAttach + 1)); | ||
| 19912 | |||
| 19913 | # Signal connects | ||
| 19914 | $checkButton->signal_connect('toggled' => sub { | ||
| 19915 | |||
| 19916 | if ($checkButton->get_active()) { | ||
| 19917 | |||
| 19918 | if ($checkButton2->get_active()) { | ||
| 19919 | $self->ivAdd('searchHash', $iv, TRUE); | ||
| 19920 | } else { | ||
| 19921 | $self->ivAdd('searchHash', $iv, FALSE); | ||
| 19922 | } | ||
| 19923 | |||
| 19924 | } else { | ||
| 19925 | |||
| 19926 | $self->ivDelete('searchHash', $iv); | ||
| 19927 | } | ||
| 19928 | }); | ||
| 19929 | |||
| 19930 | $checkButton2->signal_connect('toggled' => sub { | ||
| 19931 | |||
| 19932 | if ($checkButton->get_active()) { | ||
| 19933 | |||
| 19934 | if ($checkButton2->get_active()) { | ||
| 19935 | $self->ivAdd('searchHash', $iv, TRUE); | ||
| 19936 | } else { | ||
| 19937 | $self->ivAdd('searchHash', $iv, FALSE); | ||
| 19938 | } | ||
| 19939 | |||
| 19940 | } else { | ||
| 19941 | |||
| 19942 | $self->ivDelete('searchHash', $iv); | ||
| 19943 | } | ||
| 19944 | }); | ||
| 19945 | |||
| 19946 | $self->ivAdd('searchTypeHash', $iv, $ivType); | ||
| 19947 | |||
| 19948 | return 1; | ||
| 19949 | } | ||
| 19950 | |||
| 19951 | sub propertiesTab_addComboBox { | ||
| 19952 | |||
| 19953 | # Called by several $self->propertiesXXX tabs | ||
| 19954 | # Adds a single line to the tab with a main checkbutton, a label and a combobox | ||
| 19955 | # | ||
| 19956 | # Expected arguments | ||
| 19957 | # $grid - The Gtk3::Grid for this tab | ||
| 19958 | # $iv - The IV to add to the search - matches a key in $self->searchHash | ||
| 19959 | # $ivType - What kind of checking should be done on thiss IV (see the comments in | ||
| 19960 | # ->new) | ||
| 19961 | # $label - The accompanying label text | ||
| 19962 | # $listRef - Reference to a list containing the values to put in the combobox | ||
| 19963 | # $topAttach - The position of the line in the grid | ||
| 19964 | # | ||
| 19965 | # Return values | ||
| 19966 | # 'undef' on improper arguments | ||
| 19967 | # 1 otherwise | ||
| 19968 | |||
| 19969 | my ($self, $grid, $iv, $ivType, $label, $listRef, $topAttach, $check) = @_; | ||
| 19970 | |||
| 19971 | # Check for improper arguments | ||
| 19972 | if ( | ||
| 19973 | ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label | ||
| 19974 | || ! defined $listRef || ! defined $topAttach || defined $check | ||
| 19975 | ) { | ||
| 19976 | return $axmud::CLIENT->writeImproper( | ||
| 19977 | $self->_objClass . '->propertiesTab_addComboBox', | ||
| 19978 | @_, | ||
| 19979 | ); | ||
| 19980 | } | ||
| 19981 | |||
| 19982 | # Add a checkbutton which turns on/off checking this IV completely | ||
| 19983 | my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE, | ||
| 19984 | 1, 6, $topAttach, ($topAttach + 1)); | ||
| 19985 | |||
| 19986 | # Add a combobox | ||
| 19987 | my $combo = $self->addComboBox($grid, undef, $listRef, '', | ||
| 19988 | TRUE, # No 'undef' value used | ||
| 19989 | 6, 12, $topAttach, ($topAttach + 1)); | ||
| 19990 | |||
| 19991 | # Signal connects | ||
| 19992 | $checkButton->signal_connect('toggled' => sub { | ||
| 19993 | |||
| 19994 | if ($checkButton->get_active()) { | ||
| 19995 | $self->ivAdd('searchHash', $iv, $combo->get_active_text()); | ||
| 19996 | } else { | ||
| 19997 | $self->ivDelete('searchHash', $iv); | ||
| 19998 | } | ||
| 19999 | }); | ||
| 20000 | |||
| 20001 | $combo->signal_connect('changed' => sub { | ||
| 20002 | |||
| 20003 | if ($checkButton->get_active()) { | ||
| 20004 | $self->ivAdd('searchHash', $iv, $combo->get_active_text()); | ||
| 20005 | } else { | ||
| 20006 | $self->ivDelete('searchHash', $iv); | ||
| 20007 | } | ||
| 20008 | }); | ||
| 20009 | |||
| 20010 | $self->ivAdd('searchTypeHash', $iv, $ivType); | ||
| 20011 | |||
| 20012 | return 1; | ||
| 20013 | } | ||
| 20014 | |||
| 20015 | sub propertiesTab_addEntryWithIcon { | ||
| 20016 | |||
| 20017 | # Called by several $self->propertiesXXX tabs | ||
| 20018 | # Adds a single line to the tab with a main checkbutton, a label and an entry | ||
| 20019 | # | ||
| 20020 | # Expected arguments | ||
| 20021 | # $grid - The Gtk3::Grid for this tab | ||
| 20022 | # $iv - The IV to add to the search - matches a key in $self->searchHash | ||
| 20023 | # $ivType - What kind of checking should be done on this IV (see the comments in | ||
| 20024 | # ->new) | ||
| 20025 | # $label - The accompanying label text | ||
| 20026 | # $mode - 'int', 'float', 'string' or a reference to a function | ||
| 20027 | # - if 'int', an integer is expected with the specified min/max values | ||
| 20028 | # - if 'float', a floating point number is expected with the specified min/max | ||
| 20029 | # values | ||
| 20030 | # - if 'string', a string is expected (which might be a number) with the | ||
| 20031 | # specified min/max length | ||
| 20032 | # - if 'regex', a regex is expected with the specified min/max length | ||
| 20033 | # - if a function reference, a function is called which should return FALSE or | ||
| 20034 | # TRUE, depending on the value of the entry; the icon is set accordingly | ||
| 20035 | # $min, $max - The values described above (ignored when $mode is a function reference). | ||
| 20036 | # If $min is 'undef', there is no minimum; if $max is 'undef', there is no | ||
| 20037 | # maximum | ||
| 20038 | # $topAttach - The position of the line in the grid | ||
| 20039 | # | ||
| 20040 | # Return values | ||
| 20041 | # 'undef' on improper arguments | ||
| 20042 | # 1 otherwise | ||
| 20043 | |||
| 20044 | |||
| 20045 | my ($self, $grid, $iv, $ivType, $label, $mode, $min, $max, $topAttach, $check) = @_; | ||
| 20046 | |||
| 20047 | # Check for improper arguments | ||
| 20048 | if ( | ||
| 20049 | ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label | ||
| 20050 | || ! defined $mode || ! defined $topAttach || defined $check | ||
| 20051 | ) { | ||
| 20052 | return $axmud::CLIENT->writeImproper( | ||
| 20053 | $self->_objClass . '->propertiesTab_addEntryWithIcon', | ||
| 20054 | @_, | ||
| 20055 | ); | ||
| 20056 | } | ||
| 20057 | |||
| 20058 | # Add a checkbutton which turns on/off checking this IV completely | ||
| 20059 | my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE, | ||
| 20060 | 1, 6, $topAttach, ($topAttach + 1)); | ||
| 20061 | |||
| 20062 | # Add the entry box | ||
| 20063 | my $entry = $self->addEntryWithIcon($grid, undef, $mode, $min, $max, | ||
| 20064 | 6, 12, $topAttach, ($topAttach + 1)); | ||
| 20065 | |||
| 20066 | # Signal connects | ||
| 20067 | $checkButton->signal_connect('toggled' => sub { | ||
| 20068 | |||
| 20069 | if ($checkButton->get_active() && $self->checkEntryIcon($entry)) { | ||
| 20070 | $self->ivAdd('searchHash', $iv, $entry->get_text()); | ||
| 20071 | } else { | ||
| 20072 | $self->ivDelete('searchHash', $iv); | ||
| 20073 | } | ||
| 20074 | }); | ||
| 20075 | |||
| 20076 | $entry->signal_connect('changed' => sub { | ||
| 20077 | |||
| 20078 | if ($checkButton->get_active()) { | ||
| 20079 | $self->ivAdd('searchHash', $iv, $entry->get_text()); | ||
| 20080 | } else { | ||
| 20081 | $self->ivDelete('searchHash', $iv); | ||
| 20082 | } | ||
| 20083 | }); | ||
| 20084 | |||
| 20085 | $self->ivAdd('searchTypeHash', $iv, $ivType); | ||
| 20086 | |||
| 20087 | return 1; | ||
| 20088 | } | ||
| 20089 | |||
| 20090 | sub propertiesTab_addEntryWithRange { | ||
| 20091 | |||
| 20092 | # Called by several $self->propertiesXXX tabs | ||
| 20093 | # Adds a single line to the tab with a main checkbutton, a label, a combobox specifiying an | ||
| 20094 | # operator (equals, less than, etc) and one or two entry boxes | ||
| 20095 | # Used with IVs that have numeric values | ||
| 20096 | # | ||
| 20097 | # Expected arguments | ||
| 20098 | # $grid - The Gtk3::Grid for this tab | ||
| 20099 | # $iv - The IV to add to the search - matches a key in $self->searchHash | ||
| 20100 | # $ivType - What kind of checking should be done on this IV (see the comments in | ||
| 20101 | # ->new) | ||
| 20102 | # $label - The accompanying label text | ||
| 20103 | # $mode - What kind of value is expected - should be 'int' or 'float' | ||
| 20104 | # $min, $max - The values described above (ignored when $mode is a function reference). | ||
| 20105 | # If $min is 'undef', there is no minimum; if $max is 'undef', there is no | ||
| 20106 | # maximum | ||
| 20107 | # $topAttach - The position of the line in the grid | ||
| 20108 | # | ||
| 20109 | # Return values | ||
| 20110 | # 'undef' on improper arguments | ||
| 20111 | # 1 otherwise | ||
| 20112 | |||
| 20113 | my ($self, $grid, $iv, $ivType, $label, $mode, $min, $max, $topAttach, $check) = @_; | ||
| 20114 | |||
| 20115 | # Local variables | ||
| 20116 | my @comboList; | ||
| 20117 | |||
| 20118 | # Check for improper arguments | ||
| 20119 | if ( | ||
| 20120 | ! defined $grid || ! defined $iv || ! defined $ivType || ! defined $label | ||
| 20121 | || ! defined $mode || ! defined $topAttach || defined $check | ||
| 20122 | ) { | ||
| 20123 | return $axmud::CLIENT->writeImproper( | ||
| 20124 | $self->_objClass . '->propertiesTab_addEntryWithRange', | ||
| 20125 | @_, | ||
| 20126 | ); | ||
| 20127 | } | ||
| 20128 | |||
| 20129 | # Add a checkbutton which turns on/off checking this IV completely | ||
| 20130 | my $checkButton = $self->addCheckButton($grid, $label, undef, TRUE, | ||
| 20131 | 1, 4, $topAttach, ($topAttach + 1)); | ||
| 20132 | |||
| 20133 | # Add a combo | ||
| 20134 | @comboList = ( | ||
| 20135 | '==', | ||
| 20136 | '>', | ||
| 20137 | '>=', | ||
| 20138 | '<', | ||
| 20139 | '<=', | ||
| 20140 | 'min-max', | ||
| 20141 | ); | ||
| 20142 | |||
| 20143 | my $combo = $self->addComboBox($grid, undef, \@comboList, '', | ||
| 20144 | TRUE, # No 'undef' value used | ||
| 20145 | 4, 6, $topAttach, ($topAttach + 1)); | ||
| 20146 | |||
| 20147 | # Add two entry boxes, the second only available when the combo box is set to 'min-max', | ||
| 20148 | my $entry = $self->addEntryWithIcon($grid, undef, $mode, $min, $max, | ||
| 20149 | 6, 8, $topAttach, ($topAttach + 1)); | ||
| 20150 | $self->addLabel($grid, '(Max:)', | ||
| 20151 | 8, 10, $topAttach, ($topAttach + 1)); | ||
| 20152 | my $entry2 = $self->addEntryWithIcon($grid, undef, $mode, $min, $max, | ||
| 20153 | 10, 12, $topAttach, ($topAttach + 1)); | ||
| 20154 | |||
| 20155 | # Signal connects - since it's not a trivially simple check (but the same for all the | ||
| 20156 | # widgets), call a special function to respond | ||
| 20157 | $checkButton->signal_connect('toggled' => sub { | ||
| 20158 | |||
| 20159 | $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2); | ||
| 20160 | }); | ||
| 20161 | |||
| 20162 | $combo->signal_connect('changed' => sub { | ||
| 20163 | |||
| 20164 | my $comboText = $combo->get_active_text; | ||
| 20165 | |||
| 20166 | $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2); | ||
| 20167 | }); | ||
| 20168 | |||
| 20169 | $entry->signal_connect('changed' => sub { | ||
| 20170 | |||
| 20171 | $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2); | ||
| 20172 | }); | ||
| 20173 | |||
| 20174 | $entry2->signal_connect('changed' => sub { | ||
| 20175 | |||
| 20176 | $self->propertiesTab_checkRange($iv, $checkButton, $combo, $entry, $entry2); | ||
| 20177 | }); | ||
| 20178 | |||
| 20179 | $self->ivAdd('searchTypeHash', $iv, $ivType); | ||
| 20180 | |||
| 20181 | return 1; | ||
| 20182 | } | ||
| 20183 | |||
| 20184 | sub resultsTab { | ||
| 20185 | |||
| 20186 | # Results tab | ||
| 20187 | # | ||
| 20188 | # Expected arguments | ||
| 20189 | # (none besides $self) | ||
| 20190 | # | ||
| 20191 | # Return values | ||
| 20192 | # 'undef' on improper arguments | ||
| 20193 | # 1 otherwise | ||
| 20194 | |||
| 20195 | my ($self, $check) = @_; | ||
| 20196 | |||
| 20197 | # Local variables | ||
| 20198 | my ( | ||
| 20199 | $wmObj, | ||
| 20200 | @columnList, | ||
| 20201 | ); | ||
| 20202 | |||
| 20203 | # Check for improper arguments | ||
| 20204 | if (defined $check) { | ||
| 20205 | |||
| 20206 | return $axmud::CLIENT->writeImproper($self->_objClass . '->resultsTab', @_); | ||
| 20207 | } | ||
| 20208 | |||
| 20209 | # Tab setup | ||
| 20210 | # N.B. No sub-headings | ||
| 20211 | my $grid = $self->addTab($self->notebook, 'R_esults'); | ||
| 20212 | |||
| 20213 | # Import the world model object | ||
| 20214 | $wmObj = $self->session->worldModelObj; | ||
| 20215 | |||
| 20216 | # Search results | ||
| 20217 | $self->addLabel($grid, '<b>Search results</b>', | ||
| 20218 | 0, 12, 0, 1); | ||
| 20219 | $self->addLabel($grid, '<i>List of matching world model objects</i>', | ||
| 20220 | 1, 12, 1, 2); | ||
| 20221 | |||
| 20222 | # Add a simple list | ||
| 20223 | @columnList = ( | ||
| 20224 | 'Model #', 'int', | ||
| 20225 | 'Category', 'text', | ||
| 20226 | 'Name', 'text', | ||
| 20227 | 'Parent #', 'text', # Must be 'text', or objects without parents shown as 0 | ||
| 20228 | 'Parent category', 'text', | ||
| 20229 | 'Parent name', 'text', | ||
| 20230 | ); | ||
| 20231 | |||
| 20232 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 20233 | 1, 12, 2, 8); | ||
| 20234 | |||
| 20235 | # Add some entries | ||
| 20236 | $self->addLabel($grid, 'Max matches:', | ||
| 20237 | 1, 3, 8, 9); | ||
| 20238 | my $entry = $self->addEntryWithIcon($grid, undef, 'int', 1, undef, | ||
| 20239 | 3, 6, 8, 9); | ||
| 20240 | |||
| 20241 | $self->addLabel($grid, 'Max objects to search:', | ||
| 20242 | 6, 9, 8, 9); | ||
| 20243 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 1, undef, | ||
| 20244 | 9, 12, 8, 9); | ||
| 20245 | |||
| 20246 | $self->addLabel($grid, 'No. matches:', | ||
| 20247 | 1, 3, 9, 10); | ||
| 20248 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 20249 | 3, 6, 9, 10); | ||
| 20250 | $self->addLabel($grid, 'Size of world model:', | ||
| 20251 | 6, 9, 9, 10); | ||
| 20252 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 20253 | 9, 12, 9, 10); | ||
| 20254 | |||
| 20255 | # Set entry box initial values | ||
| 20256 | $entry->set_text($wmObj->searchMaxMatches); | ||
| 20257 | $entry2->set_text($wmObj->searchMaxObjects); | ||
| 20258 | $entry4->set_text($wmObj->modelActualCount); | ||
| 20259 | |||
| 20260 | # Add some buttons | ||
| 20261 | my $button = $self->addButton( | ||
| 20262 | $grid, 'Search model', 'Perform a world model search', undef, | ||
| 20263 | 1, 12, 10, 11); | ||
| 20264 | $button->signal_connect('clicked' => sub { | ||
| 20265 | |||
| 20266 | my ($matchMax, $objMax, $matchCount); | ||
| 20267 | |||
| 20268 | if ($self->checkEntryIcon($entry)) { | ||
| 20269 | |||
| 20270 | $matchMax = $entry->get_text(); | ||
| 20271 | if ($matchMax > $wmObj->modelObjCount) { | ||
| 20272 | |||
| 20273 | # (Use the actual number of objects in the model) | ||
| 20274 | $matchMax = $wmObj->modelObjCount; | ||
| 20275 | } | ||
| 20276 | |||
| 20277 | } else { | ||
| 20278 | |||
| 20279 | # (Use the actual number of objects in the model once again) | ||
| 20280 | $matchMax = $wmObj->modelObjCount; | ||
| 20281 | } | ||
| 20282 | |||
| 20283 | if ($self->checkEntryIcon($entry2)) { | ||
| 20284 | |||
| 20285 | $objMax = $entry2->get_text(); | ||
| 20286 | if ($objMax > $wmObj->modelObjCount) { | ||
| 20287 | |||
| 20288 | $objMax = $wmObj->modelObjCount; | ||
| 20289 | } | ||
| 20290 | |||
| 20291 | } else { | ||
| 20292 | |||
| 20293 | $objMax = $wmObj->modelObjCount; | ||
| 20294 | } | ||
| 20295 | |||
| 20296 | # Check that there's at least on entry in ->categoryHash (if it's empty, then no objects | ||
| 20297 | # in the world model can match) | ||
| 20298 | if (! $self->categoryHash) { | ||
| 20299 | |||
| 20300 | $self->showMsgDialogue( | ||
| 20301 | 'Search', | ||
| 20302 | 'error', | ||
| 20303 | 'You have unselected all categories of model object, so your search won\'t' | ||
| 20304 | . ' match anything (go to the \'Search\' tab to select some categories)', | ||
| 20305 | 'ok', | ||
| 20306 | ); | ||
| 20307 | |||
| 20308 | } elsif (! $wmObj->modelHash) { | ||
| 20309 | |||
| 20310 | $self->showMsgDialogue( | ||
| 20311 | 'Search', | ||
| 20312 | 'error', | ||
| 20313 | 'The world model is currently empty', | ||
| 20314 | 'ok', | ||
| 20315 | ); | ||
| 20316 | |||
| 20317 | } else { | ||
| 20318 | |||
| 20319 | # Perform the search, and display the results in the simple list | ||
| 20320 | # Change the label on the button so that, during long searches, the user can see | ||
| 20321 | # when the search starts, and when it stops | ||
| 20322 | $button->set_label('Searching...'); | ||
| 20323 | $matchCount = $self->performSearch($slWidget, $matchMax, $objMax); | ||
| 20324 | $button->set_label('Search'); | ||
| 20325 | |||
| 20326 | # Display the number of matches in the entry box | ||
| 20327 | $entry3->set_text($matchCount); | ||
| 20328 | # While we're at it, update the size of the world model | ||
| 20329 | $entry4->set_text($wmObj->modelActualCount); | ||
| 20330 | } | ||
| 20331 | }); | ||
| 20332 | |||
| 20333 | my $button2 = $self->addButton($grid, 'Edit...', 'Edit the selected model object', undef, | ||
| 20334 | 1, 3, 11, 12); | ||
| 20335 | $button2->signal_connect('clicked' => sub { | ||
| 20336 | |||
| 20337 | my ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 20338 | if (defined $number && $wmObj->ivExists('modelHash', $number)) { | ||
| 20339 | |||
| 20340 | # Open up an 'edit' window for the child object | ||
| 20341 | $self->openChildEditWin($number); | ||
| 20342 | } | ||
| 20343 | }); | ||
| 20344 | |||
| 20345 | my $button3 = $self->addButton( | ||
| 20346 | $grid, | ||
| 20347 | 'Clear', | ||
| 20348 | 'Clear the list of world model objects', | ||
| 20349 | undef, | ||
| 20350 | 10, 12, 11, 12, | ||
| 20351 | ); | ||
| 20352 | $button3->signal_connect('clicked' => sub { | ||
| 20353 | |||
| 20354 | # Empty the list | ||
| 20355 | @{$slWidget->{data}} = (); | ||
| 20356 | }); | ||
| 20357 | |||
| 20358 | # Tab complete | ||
| 20359 | return 1; | ||
| 20360 | } | ||
| 20361 | |||
| 20362 | # Support functions | ||
| 20363 | |||
| 20364 | sub propertiesTab_checkRange { | ||
| 20365 | |||
| 20366 | # Called by several parts of $self->propertiesTab_addEntryWithRange, in the | ||
| 20367 | # ->signal_connect anonymous subroutine | ||
| 20368 | # Since it's not a trivally simple check (but the same for all four widgets created by the | ||
| 20369 | # calling function), use the same function for each | ||
| 20370 | # | ||
| 20371 | # Expected arguments | ||
| 20372 | # $iv - The IV to add to the search - matches a key in $self->searchHash | ||
| 20373 | # $checkButton - The Gtk3::CheckButton | ||
| 20374 | # $combo - The Gtk3::ComboBox | ||
| 20375 | # $entry, $entry2 - The two Gtk3::Entry boxes | ||
| 20376 | # | ||
| 20377 | # Return values | ||
| 20378 | # 'undef' on improper arguments | ||
| 20379 | # 1 otherwise | ||
| 20380 | |||
| 20381 | my ($self, $iv, $checkButton, $combo, $entry, $entry2, $check) = @_; | ||
| 20382 | |||
| 20383 | # Local variables | ||
| 20384 | my ($comboText, $entryText, $entryText2); | ||
| 20385 | |||
| 20386 | # Check for improper arguments | ||
| 20387 | if ( | ||
| 20388 | ! defined $iv || ! defined $checkButton || ! defined $combo || ! defined $entry | ||
| 20389 | || ! defined $entry2 || defined $check | ||
| 20390 | ) { | ||
| 20391 | return $axmud::CLIENT->writeImproper( | ||
| 20392 | $self->_objClass . '->propertiesTab_checkRange', | ||
| 20393 | @_, | ||
| 20394 | ); | ||
| 20395 | } | ||
| 20396 | |||
| 20397 | $comboText = $combo->get_active_text(); | ||
| 20398 | if ($self->checkEntryIcon($entry)) { | ||
| 20399 | |||
| 20400 | $entryText = $entry->get_text(); | ||
| 20401 | } | ||
| 20402 | |||
| 20403 | if ($self->checkEntryIcon($entry2)) { | ||
| 20404 | |||
| 20405 | $entryText2 = $entry2->get_text(); | ||
| 20406 | } | ||
| 20407 | |||
| 20408 | if ($checkButton->get_active() && $comboText) { | ||
| 20409 | |||
| 20410 | if ($comboText ne 'min-max' && $entryText) { | ||
| 20411 | |||
| 20412 | $self->ivAdd('searchHash', $iv, $entryText); | ||
| 20413 | $self->ivAdd('searchRangeHash', $iv, $comboText); | ||
| 20414 | $self->ivDelete('searchUpperHash', $iv); | ||
| 20415 | |||
| 20416 | } elsif ($comboText eq 'min-max' && $self->checkEntryIcon($entry, $entry2)) { | ||
| 20417 | |||
| 20418 | # Use the higher value as the maximum | ||
| 20419 | if ($entryText2 < $entryText) { | ||
| 20420 | |||
| 20421 | ($entryText2, $entryText) = ($entryText, $entryText2); | ||
| 20422 | } | ||
| 20423 | |||
| 20424 | $self->ivAdd('searchHash', $iv, $entryText); | ||
| 20425 | $self->ivAdd('searchRangeHash', $iv, $comboText); | ||
| 20426 | $self->ivAdd('searchUpperHash', $iv, $entryText2); | ||
| 20427 | |||
| 20428 | } else { | ||
| 20429 | |||
| 20430 | $self->ivDelete('searchHash', $iv); | ||
| 20431 | $self->ivDelete('searchRangeHash', $iv); | ||
| 20432 | $self->ivDelete('searchUpperHash', $iv); | ||
| 20433 | } | ||
| 20434 | |||
| 20435 | } else { | ||
| 20436 | |||
| 20437 | $self->ivDelete('searchHash', $iv); | ||
| 20438 | $self->ivDelete('searchRangeHash', $iv); | ||
| 20439 | $self->ivDelete('searchUpperHash', $iv); | ||
| 20440 | } | ||
| 20441 | |||
| 20442 | # $entry2 is only sensitive when the combo is set to 'min-max' | ||
| 20443 | if ($comboText eq 'min-max') { | ||
| 20444 | |||
| 20445 | $entry2->set_sensitive(TRUE); | ||
| 20446 | |||
| 20447 | } else { | ||
| 20448 | |||
| 20449 | $entry2->set_text(''); | ||
| 20450 | $entry2->set_sensitive(TRUE); | ||
| 20451 | } | ||
| 20452 | |||
| 20453 | return 1; | ||
| 20454 | } | ||
| 20455 | |||
| 20456 | sub performSearch { | ||
| 20457 | |||
| 20458 | # Called by $self->resultsTab | ||
| 20459 | # Perform a search for world model objects matching the parameters specified by the user and | ||
| 20460 | # stored (mainly) in $self->searchHash | ||
| 20461 | # | ||
| 20462 | # Expected arguments | ||
| 20463 | # $slWidget - The GA::Obj::SimpleList | ||
| 20464 | # $matchMax - The maximum number of matching model objects before the search | ||
| 20465 | # algorithm gives up | ||
| 20466 | # $objMax - The maximum number of model objects searched before the search | ||
| 20467 | # algorithm gives up | ||
| 20468 | # | ||
| 20469 | # Return values | ||
| 20470 | # 'undef' on improper arguments or if the search yields no matches | ||
| 20471 | # Otherwise returns the number of matches | ||
| 20472 | |||
| 20473 | my ($self, $slWidget, $matchMax, $objMax, $check) = @_; | ||
| 20474 | |||
| 20475 | # Local variables | ||
| 20476 | my ( | ||
| 20477 | $wmObj, $count, $regionmapObj, $regionmapNum, | ||
| 20478 | @objList, @matchList, @matchRoomList, @dataList, @mapWinList, | ||
| 20479 | ); | ||
| 20480 | |||
| 20481 | # (Error checking removed for speed) | ||
| 20482 | |||
| 20483 | # # Check for improper arguments | ||
| 20484 | # if (! defined $slWidget || ! defined $matchMax || ! defined $objMax || defined $check) { | ||
| 20485 | # | ||
| 20486 | # return $axmud::CLIENT->writeImproper($self->_objClass . '->performSearch', @_); | ||
| 20487 | # } | ||
| 20488 | |||
| 20489 | # Import the world model | ||
| 20490 | $wmObj = $self->session->worldModelObj; | ||
| 20491 | |||
| 20492 | if ($self->searchAllFlag) { | ||
| 20493 | |||
| 20494 | # Start at model object #1, and continue until we reach the supplied limits (the calling | ||
| 20495 | # function has already checked that these limits aren't larger than the model itself) | ||
| 20496 | $count = 0; | ||
| 20497 | do { | ||
| 20498 | |||
| 20499 | my $obj; | ||
| 20500 | |||
| 20501 | $count++; | ||
| 20502 | # (Don't use usual ->ivShow method for improved speed) | ||
| 20503 | $obj = $wmObj->{modelHash}{$count}; | ||
| 20504 | |||
| 20505 | # Check that the object's category, ->category, is one of the ones we want to | ||
| 20506 | # search (in which case, it appears as a key in $self->categoryHash) | ||
| 20507 | if (defined $obj && exists $self->{'categoryHash'}{$obj->category}) { | ||
| 20508 | |||
| 20509 | # If the object matches our search terms, add it to the list of matches | ||
| 20510 | if ($self->checkObj($obj)) { | ||
| 20511 | |||
| 20512 | push (@matchList, $obj); | ||
| 20513 | if ($obj->category eq 'room') { | ||
| 20514 | |||
| 20515 | push (@matchRoomList, $obj, 'room'); | ||
| 20516 | } | ||
| 20517 | } | ||
| 20518 | } | ||
| 20519 | |||
| 20520 | } until ($count == $objMax || scalar @matchList == $matchMax); | ||
| 20521 | |||
| 20522 | } else { | ||
| 20523 | |||
| 20524 | # Compile a list of all model objects in the specified region, saving it as a hash | ||
| 20525 | # in the form | ||
| 20526 | # $hash{model_number} = blessed_reference_to_model_object | ||
| 20527 | |||
| 20528 | # First, empty the hash after previous searches | ||
| 20529 | $self->ivEmpty('compileHash'); | ||
| 20530 | |||
| 20531 | # Find the model object for the region specified by $self->searchRegion, and use it | ||
| 20532 | # as the first item in the hash | ||
| 20533 | $regionmapObj = $wmObj->ivShow('regionmapHash', $self->searchRegion); | ||
| 20534 | if (defined $regionmapObj) { | ||
| 20535 | |||
| 20536 | $regionmapNum = $regionmapObj->number; | ||
| 20537 | $self->{'compileHash'}{$regionmapNum} = $wmObj->{'modelHash'}{$regionmapNum}; | ||
| 20538 | |||
| 20539 | # Compile a list of all model objects in the specified region, by calling | ||
| 20540 | # ->compileObjHash recursively | ||
| 20541 | $self->compileObjHash($wmObj->{'modelHash'}{$regionmapNum}); | ||
| 20542 | } | ||
| 20543 | |||
| 20544 | # Sort the objects in the hash in order of model number | ||
| 20545 | @objList = sort {$a->number <=> $b->number} ( values %{$self->{'compileHash'}} ); | ||
| 20546 | |||
| 20547 | # Perform the same search as above | ||
| 20548 | foreach my $obj (@objList) { | ||
| 20549 | |||
| 20550 | if (exists $self->{'categoryHash'}{$obj->category}) { | ||
| 20551 | |||
| 20552 | # If the object matches our search terms, add it to the list of matches | ||
| 20553 | if ($self->checkObj($obj)) { | ||
| 20554 | |||
| 20555 | push (@matchList, $obj); | ||
| 20556 | if ($obj->category eq 'room') { | ||
| 20557 | |||
| 20558 | push (@matchRoomList, $obj, 'room'); | ||
| 20559 | } | ||
| 20560 | } | ||
| 20561 | } | ||
| 20562 | } | ||
| 20563 | } | ||
| 20564 | |||
| 20565 | # Display the list of objects in the simple list | ||
| 20566 | if (! @matchList) { | ||
| 20567 | |||
| 20568 | # No matches were found | ||
| 20569 | $self->showMsgDialogue( | ||
| 20570 | 'Search', | ||
| 20571 | 'info', | ||
| 20572 | 'No matching objects were found in the world model', | ||
| 20573 | 'ok', | ||
| 20574 | ); | ||
| 20575 | |||
| 20576 | } else { | ||
| 20577 | |||
| 20578 | # Update the simple list | ||
| 20579 | foreach my $obj (@matchList) { | ||
| 20580 | |||
| 20581 | my $parentObj; | ||
| 20582 | |||
| 20583 | if ($obj->parent) { | ||
| 20584 | |||
| 20585 | $parentObj = $wmObj->{'modelHash'}{$obj->parent}; | ||
| 20586 | } | ||
| 20587 | |||
| 20588 | if ($parentObj) { | ||
| 20589 | |||
| 20590 | push (@dataList, | ||
| 20591 | $obj->number, | ||
| 20592 | $obj->category, | ||
| 20593 | $obj->name, | ||
| 20594 | $parentObj->number, | ||
| 20595 | $parentObj->category, | ||
| 20596 | $parentObj->name, | ||
| 20597 | ); | ||
| 20598 | |||
| 20599 | } else { | ||
| 20600 | |||
| 20601 | push (@dataList, | ||
| 20602 | $obj->number, | ||
| 20603 | $obj->category, | ||
| 20604 | $obj->name, | ||
| 20605 | undef, | ||
| 20606 | undef, | ||
| 20607 | undef, | ||
| 20608 | ); | ||
| 20609 | } | ||
| 20610 | } | ||
| 20611 | |||
| 20612 | # Reset the simple list | ||
| 20613 | $self->resetListData($slWidget, [@dataList], 6); | ||
| 20614 | |||
| 20615 | # If there were any matching rooms, and if the flag is set, tell the world model to | ||
| 20616 | # select all matching rooms in Automapper windows | ||
| 20617 | # select the rooms on the map | ||
| 20618 | if (@matchRoomList && $wmObj->searchSelectRoomsFlag) { | ||
| 20619 | |||
| 20620 | # Get a list of Automapper windows using this world model | ||
| 20621 | @mapWinList = $wmObj->collectMapWins(); | ||
| 20622 | foreach my $mapWin (@mapWinList) { | ||
| 20623 | |||
| 20624 | # Clear the previous selection(s) | ||
| 20625 | $mapWin->setSelectedObj(); | ||
| 20626 | |||
| 20627 | # Select the matching room(s) | ||
| 20628 | $mapWin->setSelectedObj(\@matchRoomList, TRUE); | ||
| 20629 | } | ||
| 20630 | } | ||
| 20631 | } | ||
| 20632 | |||
| 20633 | # Operation complete | ||
| 20634 | return scalar @matchList; | ||
| 20635 | } | ||
| 20636 | |||
| 20637 | sub checkObj { | ||
| 20638 | |||
| 20639 | # Called by $self->performSearch | ||
| 20640 | # Given the number of a world model object, checks whether its IVs match those specified by | ||
| 20641 | # the IVs in $self->searchHash | ||
| 20642 | # | ||
| 20643 | # Expected arguments | ||
| 20644 | # $obj - Blessed reference of the model object to check | ||
| 20645 | # | ||
| 20646 | # Return values | ||
| 20647 | # 'undef' on improper arguments or if the object doesn't match IVs specified by | ||
| 20648 | # $self->searchHash | ||
| 20649 | # 1 if the object matches | ||
| 20650 | |||
| 20651 | my ($self, $obj, $check) = @_; | ||
| 20652 | |||
| 20653 | # Local variables | ||
| 20654 | my $wmObj; | ||
| 20655 | |||
| 20656 | # (Error checking removed for speed) | ||
| 20657 | |||
| 20658 | # # Check for improper arguments | ||
| 20659 | # if (! defined $obj || defined $check) { | ||
| 20660 | # | ||
| 20661 | # return $axmud::CLIENT->writeImproper($self->_objClass . '->checkObj', @_); | ||
| 20662 | # } | ||
| 20663 | |||
| 20664 | # Import the world model object | ||
| 20665 | $wmObj = $self->session->worldModelObj; | ||
| 20666 | |||
| 20667 | # Check each IV in turn (for improved speed, we don't use ->ivKeys, etc) | ||
| 20668 | OUTER: foreach my $iv ( keys %{$self->{'searchHash'}} ) { | ||
| 20669 | |||
| 20670 | my ($search, $type, $ivCode, $rangeOp, $flag); | ||
| 20671 | |||
| 20672 | # Get the value corresponding to the key $iv in the hash $self->searchHash | ||
| 20673 | $search = $self->{'searchHash'}{$iv}; | ||
| 20674 | # Get the search type (e.g. 'match', 'key', 'special' etc) | ||
| 20675 | $type = $self->{'searchTypeHash'}{$iv}; | ||
| 20676 | |||
| 20677 | # Some settings of $iv begin with an underline; e.g. $iv can be set to both | ||
| 20678 | # 'visitHash' (when we want to check a key exists in the hash) and '_visitHash' | ||
| 20679 | # (when we want to check the key doesn't exit) | ||
| 20680 | # By having both 'visitHash' and '_visitHash', we can perform two different operation on | ||
| 20681 | # the same IV (i.e. there can be two entries in the hash $self->searchHash, not one | ||
| 20682 | # which potentially overwrites another) | ||
| 20683 | $ivCode = $iv; # Might begin with an underline | ||
| 20684 | $iv =~ s/_//; # Does not begin with an underline | ||
| 20685 | |||
| 20686 | # Some IVs exist in one category of model object, but not in other categories. We need | ||
| 20687 | # to check that the IV actually exists | ||
| 20688 | if (! exists $obj->{$iv}) { | ||
| 20689 | |||
| 20690 | # Can't be a match if the IV isn't used in this category of model object | ||
| 20691 | return undef; | ||
| 20692 | |||
| 20693 | } elsif ($type eq 'match') { | ||
| 20694 | |||
| 20695 | # Perform a regex on the scalar IV's value, to see whether it matches the | ||
| 20696 | # user-specified value in $search (NB The search is case-insensitive) | ||
| 20697 | if (! defined $obj->$iv || ! ($obj->$iv =~ m/$search/i)) { | ||
| 20698 | |||
| 20699 | # This object doesn't match | ||
| 20700 | return undef; | ||
| 20701 | } | ||
| 20702 | |||
| 20703 | } elsif ($type eq 'flag') { | ||
| 20704 | |||
| 20705 | # Check whether the scalar IV, which is a flag, matches the user-specified value in | ||
| 20706 | # $search (i.e. either 'on' or 'off') | ||
| 20707 | if (($obj->$iv && ! $search) || (! $obj->$iv && $search)) { | ||
| 20708 | |||
| 20709 | return undef; | ||
| 20710 | } | ||
| 20711 | |||
| 20712 | } elsif ($type eq 'string_equal') { | ||
| 20713 | |||
| 20714 | # Check whether the scalar IV's value is an exact match for the value of $search | ||
| 20715 | if ($obj->$iv ne $search) { | ||
| 20716 | |||
| 20717 | return undef; | ||
| 20718 | } | ||
| 20719 | |||
| 20720 | } elsif ($type eq 'range') { | ||
| 20721 | |||
| 20722 | # Get the range operator specified by the user | ||
| 20723 | $rangeOp = $self->{'searchRangeHash'}{$ivCode}; | ||
| 20724 | |||
| 20725 | if ( | ||
| 20726 | ! defined $obj->$iv | ||
| 20727 | || ($rangeOp eq '==' && $obj->$iv != $search) | ||
| 20728 | || ($rangeOp eq '>' && $obj->$iv <= $search) | ||
| 20729 | || ($rangeOp eq '>=' && $obj->$iv < $search) | ||
| 20730 | || ($rangeOp eq '<' && $obj->$iv >= $search) | ||
| 20731 | || ($rangeOp eq '<=' && $obj->$iv > $search) | ||
| 20732 | # Min/max: minimum value stored in $search, maximum value stored in | ||
| 20733 | # $self->searchUpperHash) | ||
| 20734 | || ( | ||
| 20735 | $rangeOp eq 'min-max' | ||
| 20736 | && ($obj->$iv < $search || $obj->$iv > $self->{'searchUpperHash'}{$ivCode}) | ||
| 20737 | ) | ||
| 20738 | ) { | ||
| 20739 | return undef; | ||
| 20740 | } | ||
| 20741 | |||
| 20742 | |||
| 20743 | } elsif ($type eq 'include') { | ||
| 20744 | |||
| 20745 | # Check whether the list IV includes an element which is an exact match for the | ||
| 20746 | # value of $search | ||
| 20747 | INNER: foreach my $element ($obj->$iv) { | ||
| 20748 | |||
| 20749 | if ($element eq $search) { | ||
| 20750 | |||
| 20751 | $flag = TRUE; | ||
| 20752 | last INNER; | ||
| 20753 | } | ||
| 20754 | } | ||
| 20755 | |||
| 20756 | if (! $flag) { | ||
| 20757 | |||
| 20758 | return undef; | ||
| 20759 | } | ||
| 20760 | |||
| 20761 | } elsif ($type eq 'list_match') { | ||
| 20762 | |||
| 20763 | # Perform a regex on every element in a list IV, to see whether it matches the value | ||
| 20764 | # of $search | ||
| 20765 | INNER: foreach my $element ($obj->$iv) { | ||
| 20766 | |||
| 20767 | if ($element =~ m/$search/i) { | ||
| 20768 | |||
| 20769 | $flag = TRUE; | ||
| 20770 | last INNER; | ||
| 20771 | } | ||
| 20772 | } | ||
| 20773 | |||
| 20774 | if (! $flag) { | ||
| 20775 | |||
| 20776 | return undef; | ||
| 20777 | } | ||
| 20778 | |||
| 20779 | } elsif ($type eq 'key') { | ||
| 20780 | |||
| 20781 | # Check whether the hash IV contains a key which is an exact match for the value of | ||
| 20782 | # $search | ||
| 20783 | if (! exists $obj->{$iv}{$search}) { | ||
| 20784 | |||
| 20785 | return undef; | ||
| 20786 | } | ||
| 20787 | |||
| 20788 | } elsif ($type eq 'not_key') { | ||
| 20789 | |||
| 20790 | # Check whether the hash IV does NOT contain a key which is an exact match for the | ||
| 20791 | # value of $search | ||
| 20792 | if (exists $obj->{$iv}{$search}) { | ||
| 20793 | |||
| 20794 | return undef; | ||
| 20795 | } | ||
| 20796 | |||
| 20797 | } elsif ($type eq 'used_hash') { | ||
| 20798 | |||
| 20799 | # Check whether the hash IV contains at least one key | ||
| 20800 | if ( | ||
| 20801 | ($obj->$iv && ! $search) | ||
| 20802 | || (! $obj->$iv && $search) | ||
| 20803 | ) { | ||
| 20804 | return undef; | ||
| 20805 | } | ||
| 20806 | |||
| 20807 | } elsif ($type eq 'value_match') { | ||
| 20808 | |||
| 20809 | # Perform a regex on all of the values in the hash IV, hoping to find one that | ||
| 20810 | # matches $search | ||
| 20811 | INNER: foreach my $value ( values %{$obj->{$iv}} ) { | ||
| 20812 | |||
| 20813 | if ($value =~ m/$search/i) { | ||
| 20814 | |||
| 20815 | $flag = TRUE; | ||
| 20816 | last INNER; | ||
| 20817 | } | ||
| 20818 | } | ||
| 20819 | |||
| 20820 | if (! $flag) { | ||
| 20821 | |||
| 20822 | return undef; | ||
| 20823 | } | ||
| 20824 | |||
| 20825 | } elsif ($type eq 'special') { | ||
| 20826 | |||
| 20827 | if ($ivCode eq '_hiddenObjHash') { | ||
| 20828 | |||
| 20829 | # $obj->hiddenObjHash is in the form | ||
| 20830 | # hash{unique_number_of_hidden_object} = 'commands_to_obtain_it' | ||
| 20831 | # Check whether the any of the objects stored in this hash have a ->name | ||
| 20832 | # matching $search | ||
| 20833 | INNER: foreach my $number ( keys %{$obj->{$iv}} ) { | ||
| 20834 | |||
| 20835 | my $obj = $wmObj->{'modelHash'}{$number}; | ||
| 20836 | |||
| 20837 | if (defined $obj && ($obj->name =~ m/$search/i)) { | ||
| 20838 | |||
| 20839 | $flag = TRUE; | ||
| 20840 | last INNER; | ||
| 20841 | } | ||
| 20842 | } | ||
| 20843 | |||
| 20844 | if (! $flag) { | ||
| 20845 | |||
| 20846 | return undef; | ||
| 20847 | } | ||
| 20848 | |||
| 20849 | } elsif ($ivCode eq 'type') { | ||
| 20850 | |||
| 20851 | # We are checking a portable object's type - we must check that it's not a | ||
| 20852 | # decoration | ||
| 20853 | if ($obj->category ne 'portable' || $obj->$iv ne $search) { | ||
| 20854 | |||
| 20855 | return undef; | ||
| 20856 | } | ||
| 20857 | |||
| 20858 | } elsif ($ivCode eq '_type') { | ||
| 20859 | |||
| 20860 | # We are checking a decoration object's type - we must check that it's not a | ||
| 20861 | # decoration | ||
| 20862 | if ($obj->category ne 'decoration' || $obj->$iv ne $search) { | ||
| 20863 | |||
| 20864 | return undef; | ||
| 20865 | } | ||
| 20866 | |||
| 20867 | # Error checking removed for speed | ||
| 20868 | # } else { | ||
| 20869 | # | ||
| 20870 | # return $self->writeError( | ||
| 20871 | # 'Search error: unrecognised ivCode \'' . $ivCode . '\'', | ||
| 20872 | # $self->_objClass . '->new', | ||
| 20873 | # ); | ||
| 20874 | } | ||
| 20875 | |||
| 20876 | # Error checking removed for speed | ||
| 20877 | # } else { | ||
| 20878 | # | ||
| 20879 | # return $self->session->writeError( | ||
| 20880 | # 'Search error: unrecognised type \'' . $type . '\'', | ||
| 20881 | # $self->_objClass . '->new', | ||
| 20882 | # ); | ||
| 20883 | } | ||
| 20884 | } | ||
| 20885 | |||
| 20886 | # The world model object $obj is a match | ||
| 20887 | return 1; | ||
| 20888 | } | ||
| 20889 | |||
| 20890 | sub compileObjHash { | ||
| 20891 | |||
| 20892 | # Called by $self->performSearch when $self->searchAllFlag is not set, and by this function | ||
| 20893 | # recursively | ||
| 20894 | # Given a world model object which already exists as a key-value pair in $self->compileHash, | ||
| 20895 | # add all of its child objects to the same hash, and then call this function recursively | ||
| 20896 | # for each of those objects | ||
| 20897 | # | ||
| 20898 | # Expected arguments | ||
| 20899 | # $obj - Blessed reference to a model object | ||
| 20900 | # | ||
| 20901 | # Return values | ||
| 20902 | # 'undef' on improper arguments | ||
| 20903 | # 1 otherwise | ||
| 20904 | |||
| 20905 | my ($self, $obj, $check) = @_; | ||
| 20906 | |||
| 20907 | # (Error checking removed for speed) | ||
| 20908 | |||
| 20909 | # # Check for improper arguments | ||
| 20910 | # if (! defined $obj || defined $check) { | ||
| 20911 | # | ||
| 20912 | # return $axmud::CLIENT->writeImproper($self->_objClass . '->compileObjHash', @_); | ||
| 20913 | # } | ||
| 20914 | |||
| 20915 | # (For improved speed, don't use ->ivValues, etc) | ||
| 20916 | foreach my $childObj ( values %{$obj->{childHash}} ) { | ||
| 20917 | |||
| 20918 | # Add the child object to the main hash | ||
| 20919 | $self->{compileHash}{$childObj->number} = $childObj; | ||
| 20920 | # Call this function recursively to add its children, too | ||
| 20921 | $self->compileObjHash($childObj); | ||
| 20922 | } | ||
| 20923 | |||
| 20924 | return 1; | ||
| 20925 | } | ||
| 20926 | |||
| 20927 | ################## | ||
| 20928 | # Accessors - set | ||
| 20929 | |||
| 20930 | ################## | ||
| 20931 | # Accessors - get | ||
| 20932 | |||
| 20933 | sub searchAllFlag | ||
| 20934 | { $_[0]->{searchAllFlag} } | ||
| 20935 | sub searchRegion | ||
| 20936 | { $_[0]->{searchRegion} } | ||
| 20937 | |||
| 20938 | sub categoryHash | ||
| 20939 | { my $self = shift; return %{$self->{categoryHash}}; } | ||
| 20940 | |||
| 20941 | sub searchHash | ||
| 20942 | { my $self = shift; return %{$self->{searchHash}}; } | ||
| 20943 | sub searchRangeHash | ||
| 20944 | { my $self = shift; return %{$self->{searchRangeHash}}; } | ||
| 20945 | sub searchUpperHash | ||
| 20946 | { my $self = shift; return %{$self->{searchUpperHash}}; } | ||
| 20947 | sub searchTypeHash | ||
| 20948 | { my $self = shift; return %{$self->{searchTypeHash}}; } | ||
| 20949 | |||
| 20950 | sub compileHash | ||
| 20951 | { my $self = shift; return %{$self->{compileHash}}; } | ||
| 20952 | } | ||
| 20953 | |||
| 20954 | { package Games::Axmud::PrefWin::Session; | ||
| 20955 | |||
| 20956 | use strict; | ||
| 20957 | use warnings; | ||
| 20958 | # use diagnostics; | ||
| 20959 | |||
| 20960 | use Glib qw(TRUE FALSE); | ||
| 20961 | |||
| 20962 | our @ISA = qw( | ||
| 20963 | Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin | ||
| 20964 | Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud | ||
| 20965 | ); | ||
| 20966 | |||
| 20967 | ################## | ||
| 20968 | # Constructors | ||
| 20969 | |||
| 20970 | # Contents of $self->editConfigHash after $self->new has been called: | ||
| 20971 | # (none) | ||
| 20972 | |||
| 20973 | # sub new {} # Inherited from GA::Generic::ConfigWin | ||
| 20974 | |||
| 20975 | ################## | ||
| 20976 | # Methods | ||
| 20977 | |||
| 20978 | # Standard window object functions | ||
| 20979 | |||
| 20980 | # sub winSetup {} # Inherited from GA::Generic::ConfigWin | ||
| 20981 | |||
| 20982 | # sub winEnable {} # Inherited from GA::Generic::ConfigWin | ||
| 20983 | |||
| 20984 | # sub winDesengage {} # Inherited from GA::Generic::FreeWin | ||
| 20985 | |||
| 20986 | # sub winDestroy {} # Inherited from GA::Generic::FreeWin | ||
| 20987 | |||
| 20988 | # sub winShowAll {} # Inherited from GA::Generic::Win | ||
| 20989 | |||
| 20990 | # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin | ||
| 20991 | |||
| 20992 | # sub redrawWidgets {} # Inherited from GA::Generic::Win | ||
| 20993 | |||
| 20994 | # ->signal_connects | ||
| 20995 | |||
| 20996 | # Other functions | ||
| 20997 | |||
| 20998 | # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin | ||
| 20999 | |||
| 21000 | sub enableButtons { | ||
| 21001 | |||
| 21002 | # Called by $self->drawWidgets | ||
| 21003 | # We only need a single button so, instead of calling the generic ->enableButtons, call a | ||
| 21004 | # method that creates just one button | ||
| 21005 | # | ||
| 21006 | # Expected arguments | ||
| 21007 | # $hBox - The horizontal packing box in which the buttons live (not yet stored as | ||
| 21008 | # an IV) | ||
| 21009 | # | ||
| 21010 | # Return values | ||
| 21011 | # An empty list on improper arguments | ||
| 21012 | # Otherwise, a list containing the Gtk::Button object created | ||
| 21013 | |||
| 21014 | my ($self, $hBox, $check) = @_; | ||
| 21015 | |||
| 21016 | # Local variables | ||
| 21017 | my @emptyList; | ||
| 21018 | |||
| 21019 | # Check for improper arguments | ||
| 21020 | if (! defined $hBox || defined $check) { | ||
| 21021 | |||
| 21022 | $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_); | ||
| 21023 | return @emptyList; | ||
| 21024 | } | ||
| 21025 | |||
| 21026 | return $self->enableSingleButton($hBox); | ||
| 21027 | } | ||
| 21028 | |||
| 21029 | # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin | ||
| 21030 | |||
| 21031 | sub setupNotebook { | ||
| 21032 | |||
| 21033 | # Called by $self->enable | ||
| 21034 | # Creates the first tab for the notebook. The remaining tabs are created by | ||
| 21035 | # $self->expandNotebook | ||
| 21036 | # | ||
| 21037 | # Expected arguments | ||
| 21038 | # (none besides $self) | ||
| 21039 | # | ||
| 21040 | # Return values | ||
| 21041 | # 'undef' on improper arguments | ||
| 21042 | # 1 otherwise | ||
| 21043 | |||
| 21044 | my ($self, $check) = @_; | ||
| 21045 | |||
| 21046 | # Check for improper arguments | ||
| 21047 | if (defined $check) { | ||
| 21048 | |||
| 21049 | return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_); | ||
| 21050 | } | ||
| 21051 | |||
| 21052 | # Tab setup (already created by the calling function) | ||
| 21053 | |||
| 21054 | # Set up the rest of the first tab (all of it, in this case) | ||
| 21055 | $self->sessionTab(); | ||
| 21056 | |||
| 21057 | # Set up the remaining tabs | ||
| 21058 | $self->expandNotebook(); | ||
| 21059 | |||
| 21060 | # Tab complete | ||
| 21061 | return 1; | ||
| 21062 | } | ||
| 21063 | |||
| 21064 | sub expandNotebook { | ||
| 21065 | |||
| 21066 | # Called by $self->setupNotebook | ||
| 21067 | # Set up additional tabs for the notebook | ||
| 21068 | # | ||
| 21069 | # Expected arguments | ||
| 21070 | # (none besides $self) | ||
| 21071 | # | ||
| 21072 | # Return values | ||
| 21073 | # 'undef' on improper arguments | ||
| 21074 | # 1 otherwise | ||
| 21075 | |||
| 21076 | my ($self, $check) = @_; | ||
| 21077 | |||
| 21078 | # Check for improper arguments | ||
| 21079 | if (defined $check) { | ||
| 21080 | |||
| 21081 | return $axmud::CLIENT->writeImproper($self->_objClass . '->expandNotebook', @_); | ||
| 21082 | } | ||
| 21083 | |||
| 21084 | $self->interfacesTab(); | ||
| 21085 | $self->tasksTab(); | ||
| 21086 | $self->recordingTab(); | ||
| 21087 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 21088 | $self->protocolsTab(); | ||
| 21089 | $self->msdpTab(); | ||
| 21090 | $self->msspTab(); | ||
| 21091 | $self->mxpTab(); | ||
| 21092 | $self->zmpTab(); | ||
| 21093 | $self->aard102Tab(); | ||
| 21094 | $self->atcpTab(); | ||
| 21095 | $self->gmcpTab(); | ||
| 21096 | $self->mcpTab(); | ||
| 21097 | } | ||
| 21098 | |||
| 21099 | return 1; | ||
| 21100 | } | ||
| 21101 | |||
| 21102 | # sub saveChanges {} # Inherited from GA::Generic::ConfigWin | ||
| 21103 | |||
| 21104 | # Notebook tabs | ||
| 21105 | |||
| 21106 | sub sessionTab { | ||
| 21107 | |||
| 21108 | # Session tab - called by $self->setupNotebook | ||
| 21109 | # | ||
| 21110 | # Expected arguments | ||
| 21111 | # (none besides $self) | ||
| 21112 | # | ||
| 21113 | # Return values | ||
| 21114 | # 'undef' on improper arguments | ||
| 21115 | # 1 otherwise | ||
| 21116 | |||
| 21117 | my ($self, $check) = @_; | ||
| 21118 | |||
| 21119 | # Check for improper arguments | ||
| 21120 | if (defined $check) { | ||
| 21121 | |||
| 21122 | return $axmud::CLIENT->writeImproper($self->_objClass . '->sessionTab', @_); | ||
| 21123 | } | ||
| 21124 | |||
| 21125 | # Tab setup | ||
| 21126 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 21127 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Session'); | ||
| 21128 | |||
| 21129 | # Add tabs to the inner notebook | ||
| 21130 | $self->session1Tab($innerNotebook); | ||
| 21131 | if (! $axmud::CLIENT->configWinSimplifyFlag) { | ||
| 21132 | |||
| 21133 | $self->session2Tab($innerNotebook); | ||
| 21134 | $self->session3Tab($innerNotebook); | ||
| 21135 | $self->session4Tab($innerNotebook); | ||
| 21136 | } | ||
| 21137 | |||
| 21138 | return 1; | ||
| 21139 | } | ||
| 21140 | |||
| 21141 | sub session1Tab { | ||
| 21142 | |||
| 21143 | # Session1 tab | ||
| 21144 | # | ||
| 21145 | # Expected arguments | ||
| 21146 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 21147 | # | ||
| 21148 | # Return values | ||
| 21149 | # 'undef' on improper arguments | ||
| 21150 | # 1 otherwise | ||
| 21151 | |||
| 21152 | my ($self, $innerNotebook, $check) = @_; | ||
| 21153 | |||
| 21154 | # Local variables | ||
| 21155 | my ($offset, $path); | ||
| 21156 | |||
| 21157 | # Check for improper arguments | ||
| 21158 | if (! defined $innerNotebook || defined $check) { | ||
| 21159 | |||
| 21160 | return $axmud::CLIENT->writeImproper($self->_objClass . '->session1Tab', @_); | ||
| 21161 | } | ||
| 21162 | |||
| 21163 | # Tab setup | ||
| 21164 | my $grid = $self->addTab( | ||
| 21165 | $innerNotebook, | ||
| 21166 | 'Page _1', | ||
| 21167 | ['Session settings', 'Current connection'], | ||
| 21168 | ); | ||
| 21169 | |||
| 21170 | # Optional header | ||
| 21171 | if ($axmud::CLIENT->configWinSimplifyFlag) { | ||
| 21172 | |||
| 21173 | $offset = 1; | ||
| 21174 | if ($^O eq 'MSWin32') { | ||
| 21175 | $path = $axmud::SHARE_DIR . '\\icons\\replace\\dialogue_replace_warning.png'; | ||
| 21176 | } else { | ||
| 21177 | $path = $axmud::SHARE_DIR . '/icons/replace/dialogue_replace_warning.png'; | ||
| 21178 | } | ||
| 21179 | |||
| 21180 | my ($image, $frame, $viewPort) = $self->addImage($grid, $path, undef, | ||
| 21181 | FALSE, # Don't use a scrolled window | ||
| 21182 | -1, 50, | ||
| 21183 | 1, 2, 0, 1); | ||
| 21184 | |||
| 21185 | $self->addLabel($grid, | ||
| 21186 | "<b>Some tabs are hidden. Click the button to reveal them," | ||
| 21187 | . "\nor type this command:</b> ;setwindowsize -s", | ||
| 21188 | 2, 9, 0, 1); | ||
| 21189 | |||
| 21190 | my $button = $self->addButton($grid, 'Reveal tabs', 'Reveal hidden tabs', undef, | ||
| 21191 | 9, 12, 0, 1); | ||
| 21192 | $button->signal_connect('clicked' => sub { | ||
| 21193 | |||
| 21194 | # Reveal tabs | ||
| 21195 | $self->session->pseudoCmd('setwindowsize -s', $self->pseudoCmdMode); | ||
| 21196 | |||
| 21197 | $self->showMsgDialogue( | ||
| 21198 | 'Reveal tabs', | ||
| 21199 | 'info', | ||
| 21200 | 'The new setting will be applied when you re-open the window', | ||
| 21201 | 'ok', | ||
| 21202 | ); | ||
| 21203 | }); | ||
| 21204 | |||
| 21205 | } else { | ||
| 21206 | |||
| 21207 | $offset = 0; | ||
| 21208 | } | ||
| 21209 | |||
| 21210 | # Left column | ||
| 21211 | $self->addLabel($grid, '<b>Session settings</b>', | ||
| 21212 | 0, 6, (0 + $offset), (1 + $offset)); | ||
| 21213 | |||
| 21214 | $self->addLabel($grid, 'Session number', | ||
| 21215 | 1, 3, (1 + $offset), (2 + $offset)); | ||
| 21216 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 21217 | 3, 6, (1 + $offset), (2 + $offset)); | ||
| 21218 | |||
| 21219 | my $checkButton = $self->addCheckButton($grid, 'Session start complete', undef, FALSE, | ||
| 21220 | 1, 6, (2 + $offset), (3 + $offset)); | ||
| 21221 | my $checkButton2 = $self->addCheckButton($grid, 'Automatic login complete', undef, FALSE, | ||
| 21222 | 1, 6, (3 + $offset), (4 + $offset)); | ||
| 21223 | |||
| 21224 | $self->addLabel($grid, 'Client (system) time (secs)', | ||
| 21225 | 1, 3, (4 + $offset), (5 + $offset)); | ||
| 21226 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 21227 | 3, 6, (4 + $offset), (5 + $offset)); | ||
| 21228 | |||
| 21229 | $self->addLabel($grid, 'Session time (secs)', | ||
| 21230 | 1, 3, (5 + $offset), (6 + $offset)); | ||
| 21231 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 21232 | 3, 6, (5 + $offset), (6 + $offset)); | ||
| 21233 | |||
| 21234 | $self->addLabel($grid, 'Delayed quit', | ||
| 21235 | 1, 3, (6 + $offset), (7 + $offset)); | ||
| 21236 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 21237 | 3, 6, (6 + $offset), (7 + $offset)); | ||
| 21238 | |||
| 21239 | $self->addLabel($grid, 'Current character set', | ||
| 21240 | 1, 3, (7 + $offset), (8 + $offset)); | ||
| 21241 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 21242 | 3, 6, (7 + $offset), (8 + $offset)); | ||
| 21243 | |||
| 21244 | # Current connection | ||
| 21245 | $self->addLabel($grid, '<b>Current connection</b>', | ||
| 21246 | 0, 6, (8 + $offset), (9 + $offset)); | ||
| 21247 | |||
| 21248 | $self->addLabel($grid, 'Host', | ||
| 21249 | 1, 3, (9 + $offset), (10 + $offset)); | ||
| 21250 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 21251 | 3, 6, (9 + $offset), (10 + $offset)); | ||
| 21252 | |||
| 21253 | $self->addLabel($grid, 'Protocol', | ||
| 21254 | 1, 3, (10 + $offset), (11 + $offset)); | ||
| 21255 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 21256 | 3, 6, (10 + $offset), (11 + $offset)); | ||
| 21257 | |||
| 21258 | # Right column | ||
| 21259 | my $button2 = $self->addButton($grid, 'Update settings', 'Update the displayed data', undef, | ||
| 21260 | 9, 12, (0 + $offset), (1 + $offset)); | ||
| 21261 | # (->signal_connect appears below) | ||
| 21262 | |||
| 21263 | $self->addLabel($grid, 'Current world', | ||
| 21264 | 7, 9, (1 + $offset), (2 + $offset)); | ||
| 21265 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 21266 | 9, 12, (1 + $offset), (2 + $offset)); | ||
| 21267 | |||
| 21268 | $self->addLabel($grid, 'Current guild', | ||
| 21269 | 7, 9, (2 + $offset), (3 + $offset)); | ||
| 21270 | my $entry9 = $self->addEntry($grid, undef, FALSE, | ||
| 21271 | 9, 12, (2 + $offset), (3 + $offset)); | ||
| 21272 | |||
| 21273 | $self->addLabel($grid, 'Current race', | ||
| 21274 | 7, 9, (3 + $offset), (4 + $offset)); | ||
| 21275 | my $entry10 = $self->addEntry($grid, undef, FALSE, | ||
| 21276 | 9, 12, (3 + $offset), (4 + $offset)); | ||
| 21277 | |||
| 21278 | $self->addLabel($grid, 'Current character', | ||
| 21279 | 7, 9, (4 + $offset), (5 + $offset)); | ||
| 21280 | my $entry11 = $self->addEntry($grid, undef, FALSE, | ||
| 21281 | 9, 12, (4 + $offset), (5 + $offset)); | ||
| 21282 | |||
| 21283 | $self->addLabel($grid, 'Current dictionary', | ||
| 21284 | 7, 9, (5 + $offset), (6 + $offset)); | ||
| 21285 | my $entry12 = $self->addEntry($grid, undef, FALSE, | ||
| 21286 | 9, 12, (5 + $offset), (6 + $offset)); | ||
| 21287 | |||
| 21288 | $self->addLabel($grid, 'Current mission', | ||
| 21289 | 7, 9, (6 + $offset), (7 + $offset)); | ||
| 21290 | my $entry13 = $self->addEntry($grid, undef, FALSE, | ||
| 21291 | 9, 12, (6 + $offset), (7 + $offset)); | ||
| 21292 | |||
| 21293 | $self->addLabel($grid, 'Port', | ||
| 21294 | 7, 9, (9 + $offset), (10 + $offset)); | ||
| 21295 | my $entry14 = $self->addEntry($grid, undef, FALSE, | ||
| 21296 | 9, 12, (9 + $offset), (10 + $offset)); | ||
| 21297 | |||
| 21298 | $self->addLabel($grid, 'Connection status', | ||
| 21299 | 7, 9, (10 + $offset), (11 + $offset)); | ||
| 21300 | my $entry15 = $self->addEntry($grid, undef, FALSE, | ||
| 21301 | 9, 12, (10 + $offset), (11 + $offset)); | ||
| 21302 | |||
| 21303 | # ->signal_connects | ||
| 21304 | $button2->signal_connect('clicked' => sub { | ||
| 21305 | |||
| 21306 | $checkButton->set_active($self->session->startCompleteFlag); | ||
| 21307 | $checkButton2->set_active($self->session->loginFlag); | ||
| 21308 | |||
| 21309 | $entry->set_text($self->session->number); | ||
| 21310 | $entry2->set_text($axmud::CLIENT->clientTime); | ||
| 21311 | $entry3->set_text($self->session->sessionTime); | ||
| 21312 | |||
| 21313 | if (defined $self->session->delayedQuitTime) { | ||
| 21314 | |||
| 21315 | $entry4->set_text( | ||
| 21316 | $axmud::CLIENT->clientSigil . $self->session->delayedQuitCmd . ' at ' | ||
| 21317 | . $self->session->delayedQuitTime, | ||
| 21318 | ); | ||
| 21319 | |||
| 21320 | } else { | ||
| 21321 | |||
| 21322 | $entry4->set_text(''); | ||
| 21323 | } | ||
| 21324 | |||
| 21325 | $entry5->set_text($self->session->sessionCharSet); | ||
| 21326 | |||
| 21327 | if ($self->session->host) { | ||
| 21328 | $entry6->set_text($self->session->host); | ||
| 21329 | } else { | ||
| 21330 | $entry6->set_text('(none)'); | ||
| 21331 | } | ||
| 21332 | |||
| 21333 | if ($self->session->protocol) { | ||
| 21334 | $entry7->set_text($self->session->protocol); | ||
| 21335 | } else { | ||
| 21336 | $entry7->set_text('(none)'); | ||
| 21337 | } | ||
| 21338 | |||
| 21339 | if ($self->session->currentWorld) { | ||
| 21340 | $entry8->set_text($self->session->currentWorld->name); | ||
| 21341 | } else { | ||
| 21342 | $entry8->set_text('(none)'); | ||
| 21343 | } | ||
| 21344 | |||
| 21345 | if ($self->session->currentGuild) { | ||
| 21346 | $entry9->set_text($self->session->currentGuild->name); | ||
| 21347 | } else { | ||
| 21348 | $entry9->set_text('(none)'); | ||
| 21349 | } | ||
| 21350 | |||
| 21351 | if ($self->session->currentRace) { | ||
| 21352 | $entry10->set_text($self->session->currentRace->name); | ||
| 21353 | } else { | ||
| 21354 | $entry10->set_text('(none)'); | ||
| 21355 | } | ||
| 21356 | |||
| 21357 | if ($self->session->currentChar) { | ||
| 21358 | $entry11->set_text($self->session->currentChar->name); | ||
| 21359 | } else { | ||
| 21360 | $entry11->set_text('(none)'); | ||
| 21361 | } | ||
| 21362 | |||
| 21363 | $entry12->set_text($self->session->currentDict->name); | ||
| 21364 | |||
| 21365 | if ($self->session->currentMission) { | ||
| 21366 | $entry13->set_text($self->session->currentMission->name); | ||
| 21367 | } else { | ||
| 21368 | $entry13->set_text('(none)'); | ||
| 21369 | } | ||
| 21370 | |||
| 21371 | if ($self->session->port) { | ||
| 21372 | $entry14->set_text($self->session->port); | ||
| 21373 | } else { | ||
| 21374 | $entry14->set_text('(none)'); | ||
| 21375 | } | ||
| 21376 | |||
| 21377 | $entry15->set_text($self->session->status); | ||
| 21378 | }); | ||
| 21379 | |||
| 21380 | # Pseudo-click the button to set all the widgets | ||
| 21381 | $button2->clicked(); | ||
| 21382 | |||
| 21383 | # Tab complete | ||
| 21384 | return 1; | ||
| 21385 | } | ||
| 21386 | |||
| 21387 | sub session2Tab { | ||
| 21388 | |||
| 21389 | # Session2 tab | ||
| 21390 | # | ||
| 21391 | # Expected arguments | ||
| 21392 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 21393 | # | ||
| 21394 | # Return values | ||
| 21395 | # 'undef' on improper arguments | ||
| 21396 | # 1 otherwise | ||
| 21397 | |||
| 21398 | my ($self, $innerNotebook, $check) = @_; | ||
| 21399 | |||
| 21400 | # Local variables | ||
| 21401 | my @columnList; | ||
| 21402 | |||
| 21403 | # Check for improper arguments | ||
| 21404 | if (! defined $innerNotebook || defined $check) { | ||
| 21405 | |||
| 21406 | return $axmud::CLIENT->writeImproper($self->_objClass . '->session2Tab', @_); | ||
| 21407 | } | ||
| 21408 | |||
| 21409 | # Tab setup | ||
| 21410 | my $grid = $self->addTab( | ||
| 21411 | $innerNotebook, | ||
| 21412 | 'Page _2', | ||
| 21413 | ['Session file objects'], | ||
| 21414 | ); | ||
| 21415 | |||
| 21416 | # Session file objects | ||
| 21417 | $self->addLabel($grid, '<b>Session file objects</b>', | ||
| 21418 | 0, 12, 0, 1); | ||
| 21419 | $self->addLabel($grid, '<i>List of data files currently in use by this session</i>', | ||
| 21420 | 1, 12, 1, 2); | ||
| 21421 | |||
| 21422 | # Add a simple list | ||
| 21423 | @columnList = ( | ||
| 21424 | 'Not saved', 'bool', | ||
| 21425 | 'File type', 'text', | ||
| 21426 | 'File name', 'text', | ||
| 21427 | 'Path', 'text', | ||
| 21428 | ); | ||
| 21429 | |||
| 21430 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 21431 | 1, 12, 2, 10); | ||
| 21432 | |||
| 21433 | # Add more widgets (displayed values set by the call to $self->session2Tab_refreshList) | ||
| 21434 | my $checkButton = $self->addCheckButton($grid, 'No saving on disconnection', undef, FALSE, | ||
| 21435 | 1, 4, 10, 11); | ||
| 21436 | |||
| 21437 | $self->addLabel($grid, 'Next autosave time', | ||
| 21438 | 4, 6, 10, 11); | ||
| 21439 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 21440 | 6, 8, 10, 11, 8, 8); | ||
| 21441 | |||
| 21442 | $self->addLabel($grid, 'Previous autosave time', | ||
| 21443 | 8, 10, 10, 11); | ||
| 21444 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 21445 | 10, 12, 10, 11, 8, 8); | ||
| 21446 | |||
| 21447 | my $button = $self->addButton($grid, | ||
| 21448 | 'Save', 'Save all files whose data has been modified', undef, | ||
| 21449 | 1, 3, 11, 12); | ||
| 21450 | $button->signal_connect('clicked' => sub { | ||
| 21451 | |||
| 21452 | $self->session->pseudoCmd('save', $self->pseudoCmdMode); | ||
| 21453 | |||
| 21454 | # Refresh the simple list | ||
| 21455 | $self->session2Tab_refreshList( | ||
| 21456 | $slWidget, | ||
| 21457 | scalar (@columnList / 2), | ||
| 21458 | $checkButton, | ||
| 21459 | $entry, | ||
| 21460 | $entry2, | ||
| 21461 | ); | ||
| 21462 | }); | ||
| 21463 | |||
| 21464 | my $button2 = $self->addButton($grid, | ||
| 21465 | 'Force save', 'Save all files, even if their data has not been modified', undef, | ||
| 21466 | 3, 6, 11, 12); | ||
| 21467 | $button2->signal_connect('clicked' => sub { | ||
| 21468 | |||
| 21469 | $self->session->pseudoCmd('save -f', $self->pseudoCmdMode); | ||
| 21470 | |||
| 21471 | # Refresh the simple list | ||
| 21472 | $self->session2Tab_refreshList( | ||
| 21473 | $slWidget, | ||
| 21474 | scalar (@columnList / 2), | ||
| 21475 | $checkButton, | ||
| 21476 | $entry, | ||
| 21477 | $entry2, | ||
| 21478 | ); | ||
| 21479 | }); | ||
| 21480 | |||
| 21481 | my $button3 = $self->addButton($grid, | ||
| 21482 | 'Refresh list', 'Refresh the list of file objects', undef, | ||
| 21483 | 9, 12, 11, 12); | ||
| 21484 | $button3->signal_connect('clicked' => sub { | ||
| 21485 | |||
| 21486 | # Refresh the simple list | ||
| 21487 | $self->session2Tab_refreshList( | ||
| 21488 | $slWidget, | ||
| 21489 | scalar (@columnList / 2), | ||
| 21490 | $checkButton, | ||
| 21491 | $entry, | ||
| 21492 | $entry2, | ||
| 21493 | ); | ||
| 21494 | }); | ||
| 21495 | |||
| 21496 | # We can now initialise the widgets | ||
| 21497 | $self->session2Tab_refreshList( | ||
| 21498 | $slWidget, | ||
| 21499 | scalar (@columnList / 2), | ||
| 21500 | $checkButton, | ||
| 21501 | $entry, | ||
| 21502 | $entry2, | ||
| 21503 | ); | ||
| 21504 | |||
| 21505 | # Tab complete | ||
| 21506 | return 1; | ||
| 21507 | } | ||
| 21508 | |||
| 21509 | sub session2Tab_refreshList { | ||
| 21510 | |||
| 21511 | # Resets the simple list displayed by $self->session2Tab | ||
| 21512 | # | ||
| 21513 | # Expected arguments | ||
| 21514 | # $slWidget - The GA::Obj::SimpleList | ||
| 21515 | # $columns - The number of columns | ||
| 21516 | # $checkButton, $entry, $entry2 | ||
| 21517 | # - Three widgets whose values should be refreshed at the same time | ||
| 21518 | # | ||
| 21519 | # Return values | ||
| 21520 | # 'undef' on improper arguments | ||
| 21521 | # 1 otherwise | ||
| 21522 | |||
| 21523 | my ($self, $slWidget, $columns, $checkButton, $entry, $entry2, $check) = @_; | ||
| 21524 | |||
| 21525 | # Local variables | ||
| 21526 | my (@fileList, @dataList); | ||
| 21527 | |||
| 21528 | # Check for improper arguments | ||
| 21529 | if ( | ||
| 21530 | ! defined $slWidget || ! defined $columns || ! defined $checkButton | ||
| 21531 | || ! defined $entry || ! defined $entry2 || defined $check | ||
| 21532 | ) { | ||
| 21533 | return $axmud::CLIENT->writeImproper( | ||
| 21534 | $self->_objClass . '->session2Tab_refreshList', | ||
| 21535 | @_, | ||
| 21536 | ); | ||
| 21537 | } | ||
| 21538 | |||
| 21539 | # Get a sorted list of file objects | ||
| 21540 | @fileList = sort {lc($a->name) cmp lc($b->name)} | ||
| 21541 | ($self->session->ivValues('sessionFileObjHash')); | ||
| 21542 | |||
| 21543 | # Compile the simple list data | ||
| 21544 | foreach my $obj (@fileList) { | ||
| 21545 | |||
| 21546 | push (@dataList, | ||
| 21547 | $obj->modifyFlag, | ||
| 21548 | $obj->fileType, | ||
| 21549 | $obj->name, | ||
| 21550 | $obj->actualPath, | ||
| 21551 | ); | ||
| 21552 | } | ||
| 21553 | |||
| 21554 | # Reset the simple list | ||
| 21555 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 21556 | |||
| 21557 | # Refresh the other widgets | ||
| 21558 | $checkButton->set_active($self->session->disconnectNoSaveFlag); | ||
| 21559 | $entry->set_text($self->session->autoSaveCheckTime); | ||
| 21560 | $entry2->set_text($self->session->autoSaveLastTime); | ||
| 21561 | |||
| 21562 | return 1; | ||
| 21563 | } | ||
| 21564 | |||
| 21565 | sub session3Tab { | ||
| 21566 | |||
| 21567 | # Session3 tab | ||
| 21568 | # | ||
| 21569 | # Expected arguments | ||
| 21570 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 21571 | # | ||
| 21572 | # Return values | ||
| 21573 | # 'undef' on improper arguments | ||
| 21574 | # 1 otherwise | ||
| 21575 | |||
| 21576 | my ($self, $innerNotebook, $check) = @_; | ||
| 21577 | |||
| 21578 | |||
| 21579 | # Check for improper arguments | ||
| 21580 | if (! defined $innerNotebook || defined $check) { | ||
| 21581 | |||
| 21582 | return $axmud::CLIENT->writeImproper($self->_objClass . '->session3Tab', @_); | ||
| 21583 | } | ||
| 21584 | |||
| 21585 | # Tab setup | ||
| 21586 | my $grid = $self->addTab( | ||
| 21587 | $innerNotebook, | ||
| 21588 | 'Page _3', | ||
| 21589 | ['Session buffer settings (1/2)'], | ||
| 21590 | ); | ||
| 21591 | |||
| 21592 | # Left column | ||
| 21593 | $self->addLabel($grid, '<b>Session buffer settings (1/2)</b>', | ||
| 21594 | 0, 12, 0, 1); | ||
| 21595 | |||
| 21596 | $self->addLabel($grid, '<i>Display buffer</i>', | ||
| 21597 | 1, 12, 1, 2); | ||
| 21598 | |||
| 21599 | $self->addLabel($grid, 'Max size', | ||
| 21600 | 1, 3, 2, 3); | ||
| 21601 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 21602 | 3, 6, 2, 3); | ||
| 21603 | |||
| 21604 | $self->addLabel($grid, 'Current size', | ||
| 21605 | 1, 3, 3, 4); | ||
| 21606 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 21607 | 3, 6, 3, 4); | ||
| 21608 | |||
| 21609 | $self->addLabel($grid, 'Total lines received', | ||
| 21610 | 1, 3, 4, 5); | ||
| 21611 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 21612 | 3, 6, 4, 5); | ||
| 21613 | |||
| 21614 | $self->addLabel($grid, 'Line number', | ||
| 21615 | 1, 3, 5, 6); | ||
| 21616 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 21617 | 3, 6, 5, 6); | ||
| 21618 | |||
| 21619 | # Right column | ||
| 21620 | my $button = $self->addButton($grid, | ||
| 21621 | 'Update', 'Update the displayed data', undef, | ||
| 21622 | 9, 12, 0, 1); | ||
| 21623 | |||
| 21624 | $self->addLabel($grid, 'First line #', | ||
| 21625 | 7, 9, 2, 3); | ||
| 21626 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 21627 | 9, 12, 2, 3); | ||
| 21628 | |||
| 21629 | $self->addLabel($grid, 'Last line #', | ||
| 21630 | 7, 9, 3, 4); | ||
| 21631 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 21632 | 9, 12, 3, 4); | ||
| 21633 | |||
| 21634 | $self->addLabel($grid, 'Since last line (secs)', | ||
| 21635 | 7, 9, 4, 5); | ||
| 21636 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 21637 | 9, 12, 4, 5); | ||
| 21638 | |||
| 21639 | my $button2 = $self->addButton($grid, | ||
| 21640 | 'View', 'View the specified buffer line', undef, | ||
| 21641 | 7, 8, 5, 6); | ||
| 21642 | |||
| 21643 | my $button3 = $self->addButton($grid, | ||
| 21644 | 'Dump', 'Display the specified buffer line in the \'main\' window', undef, | ||
| 21645 | 8, 9, 5, 6); | ||
| 21646 | |||
| 21647 | my $button4 = $self->addButton($grid, | ||
| 21648 | 'Dump last', 'Display the most recent buffer line in the \'main\' window', undef, | ||
| 21649 | 9, 11, 5, 6); | ||
| 21650 | |||
| 21651 | my $button5 = $self->addButton($grid, | ||
| 21652 | 'Dump 20', 'Display the most recent 20 buffer lines in the \'main\' window', undef, | ||
| 21653 | 11, 12, 5, 6); | ||
| 21654 | |||
| 21655 | # ->signal_connects | ||
| 21656 | |||
| 21657 | # 'Update' | ||
| 21658 | $button->signal_connect('clicked' => sub { | ||
| 21659 | |||
| 21660 | $entry->set_text($axmud::CLIENT->customDisplayBufferSize); | ||
| 21661 | $entry2->set_text($self->session->ivPairs('displayBufferHash')); | ||
| 21662 | $entry3->set_text($self->session->displayBufferCount); | ||
| 21663 | |||
| 21664 | if (defined $self->session->displayBufferFirst) { | ||
| 21665 | |||
| 21666 | $entry5->set_text($self->session->displayBufferFirst); | ||
| 21667 | } | ||
| 21668 | |||
| 21669 | if (defined $self->session->displayBufferLast) { | ||
| 21670 | |||
| 21671 | $entry6->set_text($self->session->displayBufferLast); | ||
| 21672 | } | ||
| 21673 | |||
| 21674 | if (defined $self->session->lastDisplayTime) { | ||
| 21675 | |||
| 21676 | $entry7->set_text($self->session->sessionTime - $self->session->lastDisplayTime); | ||
| 21677 | } | ||
| 21678 | }); | ||
| 21679 | |||
| 21680 | # 'View' | ||
| 21681 | $button2->signal_connect('clicked' => sub { | ||
| 21682 | |||
| 21683 | my $number = $entry4->get_text(); | ||
| 21684 | |||
| 21685 | if ($self->checkEntryIcon($entry4)) { | ||
| 21686 | |||
| 21687 | # Open an 'edit' window for the specified buffer line | ||
| 21688 | $self->session->pseudoCmd('editdisplaybuffer ' . $number, $self->pseudoCmdMode); | ||
| 21689 | } | ||
| 21690 | }); | ||
| 21691 | |||
| 21692 | # 'Dump' | ||
| 21693 | $button3->signal_connect('clicked' => sub { | ||
| 21694 | |||
| 21695 | my $number = $entry4->get_text(); | ||
| 21696 | |||
| 21697 | if ($self->checkEntryIcon($entry4)) { | ||
| 21698 | |||
| 21699 | # Display the specified buffer line | ||
| 21700 | $self->session->pseudoCmd('dumpdisplaybuffer ' . $number, $self->pseudoCmdMode); | ||
| 21701 | } | ||
| 21702 | }); | ||
| 21703 | |||
| 21704 | # 'Dump last' | ||
| 21705 | $button4->signal_connect('clicked' => sub { | ||
| 21706 | |||
| 21707 | # Display most recent buffer line | ||
| 21708 | $self->session->pseudoCmd('dumpdisplaybuffer', $self->pseudoCmdMode); | ||
| 21709 | # Show the number of the most recent buffer line | ||
| 21710 | if (defined $self->session->displayBufferLast) { | ||
| 21711 | |||
| 21712 | $entry4->set_text($self->session->displayBufferLast); | ||
| 21713 | } | ||
| 21714 | }); | ||
| 21715 | |||
| 21716 | # 'Dump 20' | ||
| 21717 | $button5->signal_connect('clicked' => sub { | ||
| 21718 | |||
| 21719 | my ($start, $stop); | ||
| 21720 | |||
| 21721 | $stop = $self->session->displayBufferLast; | ||
| 21722 | $start = $stop - 19; | ||
| 21723 | if ($start < 0) { | ||
| 21724 | |||
| 21725 | $start = 0; | ||
| 21726 | } | ||
| 21727 | |||
| 21728 | # Display most recent buffer lines | ||
| 21729 | $self->session->pseudoCmd( | ||
| 21730 | 'dumpdisplaybuffer ' . $start . ' ' . $stop, | ||
| 21731 | $self->pseudoCmdMode, | ||
| 21732 | ); | ||
| 21733 | }); | ||
| 21734 | |||
| 21735 | # Pseudo-click the button to set all the widgets | ||
| 21736 | $button->clicked(); | ||
| 21737 | |||
| 21738 | # Tab complete | ||
| 21739 | return 1; | ||
| 21740 | } | ||
| 21741 | |||
| 21742 | sub session4Tab { | ||
| 21743 | |||
| 21744 | # Session4 tab | ||
| 21745 | # | ||
| 21746 | # Expected arguments | ||
| 21747 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 21748 | # | ||
| 21749 | # Return values | ||
| 21750 | # 'undef' on improper arguments | ||
| 21751 | # 1 otherwise | ||
| 21752 | |||
| 21753 | my ($self, $innerNotebook, $check) = @_; | ||
| 21754 | |||
| 21755 | |||
| 21756 | # Check for improper arguments | ||
| 21757 | if (! defined $innerNotebook || defined $check) { | ||
| 21758 | |||
| 21759 | return $axmud::CLIENT->writeImproper($self->_objClass . '->session4Tab', @_); | ||
| 21760 | } | ||
| 21761 | |||
| 21762 | # Tab setup | ||
| 21763 | my $grid = $self->addTab( | ||
| 21764 | $innerNotebook, | ||
| 21765 | 'Page _4', | ||
| 21766 | ['Session buffer settings (2/2)'], | ||
| 21767 | ); | ||
| 21768 | |||
| 21769 | # Session buffer settings | ||
| 21770 | $self->addLabel($grid, '<b>Session buffer settings (2/2)</b>', | ||
| 21771 | 0, 12, 0, 1); | ||
| 21772 | |||
| 21773 | # Left column - instruction buffer | ||
| 21774 | $self->addLabel($grid, '<i>Instruction buffer</i>', | ||
| 21775 | 1, 12, 1, 2); | ||
| 21776 | |||
| 21777 | $self->addLabel($grid, 'Max size', | ||
| 21778 | 1, 3, 2, 3); | ||
| 21779 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 21780 | 3, 6, 2, 3); | ||
| 21781 | |||
| 21782 | $self->addLabel($grid, 'Current size', | ||
| 21783 | 1, 3, 3, 4); | ||
| 21784 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 21785 | 3, 6, 3, 4); | ||
| 21786 | |||
| 21787 | $self->addLabel($grid, 'Total items processed', | ||
| 21788 | 1, 3, 4, 5); | ||
| 21789 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 21790 | 3, 6, 4, 5); | ||
| 21791 | |||
| 21792 | $self->addLabel($grid, 'Item number', | ||
| 21793 | 1, 3, 5, 6); | ||
| 21794 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 21795 | 3, 6, 5, 6); | ||
| 21796 | |||
| 21797 | # Right column - instruction buffer | ||
| 21798 | my $button = $self->addButton($grid, | ||
| 21799 | 'Update', 'Update the displayed data', undef, | ||
| 21800 | 9, 12, 0, 1); | ||
| 21801 | |||
| 21802 | $self->addLabel($grid, 'First item #', | ||
| 21803 | 7, 9, 2, 3); | ||
| 21804 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 21805 | 9, 12, 2, 3); | ||
| 21806 | |||
| 21807 | $self->addLabel($grid, 'Last item #', | ||
| 21808 | 7, 9, 3, 4); | ||
| 21809 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 21810 | 9, 12, 3, 4); | ||
| 21811 | |||
| 21812 | $self->addLabel($grid, 'Since last item (secs)', | ||
| 21813 | 7, 9, 4, 5); | ||
| 21814 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 21815 | 9, 12, 4, 5); | ||
| 21816 | |||
| 21817 | my $button2 = $self->addButton($grid, | ||
| 21818 | 'View', 'View the specified buffer item', undef, | ||
| 21819 | 7, 8, 5, 6); | ||
| 21820 | |||
| 21821 | my $button3 = $self->addButton($grid, | ||
| 21822 | 'Dump', 'Display the specified buffer item in the \'main\' window', undef, | ||
| 21823 | 8, 9, 5, 6); | ||
| 21824 | |||
| 21825 | my $button4 = $self->addButton($grid, | ||
| 21826 | 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef, | ||
| 21827 | 9, 11, 5, 6); | ||
| 21828 | |||
| 21829 | my $button5 = $self->addButton($grid, | ||
| 21830 | 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef, | ||
| 21831 | 11, 12, 5, 6); | ||
| 21832 | |||
| 21833 | # Left column - world command buffer | ||
| 21834 | $self->addLabel($grid, '<i>World command buffer</i>', | ||
| 21835 | 1, 12, 6, 7); | ||
| 21836 | |||
| 21837 | $self->addLabel($grid, 'Max size', | ||
| 21838 | 1, 3, 7, 8); | ||
| 21839 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 21840 | 3, 6, 7, 8); | ||
| 21841 | |||
| 21842 | $self->addLabel($grid, 'Current size', | ||
| 21843 | 1, 3, 8, 9); | ||
| 21844 | my $entry9 = $self->addEntry($grid, undef, FALSE, | ||
| 21845 | 3, 6, 8, 9); | ||
| 21846 | |||
| 21847 | $self->addLabel($grid, 'Total items processed', | ||
| 21848 | 1, 3, 9, 10); | ||
| 21849 | my $entry10 = $self->addEntry($grid, undef, FALSE, | ||
| 21850 | 3, 6, 9, 10); | ||
| 21851 | |||
| 21852 | $self->addLabel($grid, 'Item number', | ||
| 21853 | 1, 3, 10, 11); | ||
| 21854 | my $entry11 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 21855 | 3, 6, 10, 11); | ||
| 21856 | |||
| 21857 | # Right column - world command buffer | ||
| 21858 | $self->addLabel($grid, 'First item #', | ||
| 21859 | 7, 9, 7, 8); | ||
| 21860 | my $entry12 = $self->addEntry($grid, undef, FALSE, | ||
| 21861 | 9, 12, 7, 8); | ||
| 21862 | |||
| 21863 | $self->addLabel($grid, 'Last item #', | ||
| 21864 | 7, 9, 8, 9); | ||
| 21865 | my $entry13 = $self->addEntry($grid, undef, FALSE, | ||
| 21866 | 9, 12, 8, 9); | ||
| 21867 | |||
| 21868 | $self->addLabel($grid, 'Since last item (secs)', | ||
| 21869 | 7, 9, 9, 10); | ||
| 21870 | my $entry14 = $self->addEntry($grid, undef, FALSE, | ||
| 21871 | 9, 12, 9, 10); | ||
| 21872 | |||
| 21873 | my $button6 = $self->addButton($grid, | ||
| 21874 | 'View', 'View the specified buffer item', undef, | ||
| 21875 | 7, 8, 10, 11); | ||
| 21876 | |||
| 21877 | my $button7 = $self->addButton($grid, | ||
| 21878 | 'Dump', 'Display the specified buffer item in the \'main\' window', undef, | ||
| 21879 | 8, 9, 10, 11); | ||
| 21880 | |||
| 21881 | my $button8 = $self->addButton($grid, | ||
| 21882 | 'Dump last', 'Display the most recent buffer item in the \'main\' window', undef, | ||
| 21883 | 9, 11, 10, 11); | ||
| 21884 | |||
| 21885 | my $button9 = $self->addButton($grid, | ||
| 21886 | 'Dump 20', 'Display the most recent 20 buffer items in the \'main\' window', undef, | ||
| 21887 | 11, 12, 10, 11); | ||
| 21888 | |||
| 21889 | # ->signal_connects | ||
| 21890 | |||
| 21891 | # 'Update' | ||
| 21892 | $button->signal_connect('clicked' => sub { | ||
| 21893 | |||
| 21894 | # Instruction buffer | ||
| 21895 | $entry->set_text($axmud::CLIENT->customInstructBufferSize); | ||
| 21896 | $entry2->set_text($self->session->ivPairs('instructBufferHash')); | ||
| 21897 | $entry3->set_text($self->session->instructBufferCount); | ||
| 21898 | |||
| 21899 | if (defined $self->session->instructBufferFirst) { | ||
| 21900 | |||
| 21901 | $entry5->set_text($self->session->instructBufferFirst); | ||
| 21902 | } | ||
| 21903 | |||
| 21904 | if (defined $self->session->instructBufferLast) { | ||
| 21905 | |||
| 21906 | $entry6->set_text($self->session->instructBufferLast); | ||
| 21907 | } | ||
| 21908 | |||
| 21909 | if (defined $self->session->lastInstructTime) { | ||
| 21910 | |||
| 21911 | $entry7->set_text($self->session->sessionTime - $self->session->lastInstructTime); | ||
| 21912 | } | ||
| 21913 | |||
| 21914 | # World command buffer | ||
| 21915 | $entry8->set_text($axmud::CLIENT->customCmdBufferSize); | ||
| 21916 | $entry9->set_text($self->session->ivPairs('cmdBufferHash')); | ||
| 21917 | $entry10->set_text($self->session->cmdBufferCount); | ||
| 21918 | |||
| 21919 | if (defined $self->session->cmdBufferFirst) { | ||
| 21920 | |||
| 21921 | $entry12->set_text($self->session->cmdBufferFirst); | ||
| 21922 | } | ||
| 21923 | |||
| 21924 | if (defined $self->session->cmdBufferLast) { | ||
| 21925 | |||
| 21926 | $entry13->set_text($self->session->cmdBufferLast); | ||
| 21927 | } | ||
| 21928 | |||
| 21929 | if (defined $self->session->lastCmdTime) { | ||
| 21930 | |||
| 21931 | $entry14->set_text($self->session->sessionTime - $self->session->lastCmdTime); | ||
| 21932 | } | ||
| 21933 | }); | ||
| 21934 | |||
| 21935 | # 'View' | ||
| 21936 | $button2->signal_connect('clicked' => sub { | ||
| 21937 | |||
| 21938 | my $number = $entry4->get_text(); | ||
| 21939 | |||
| 21940 | if ($self->checkEntryIcon($entry4)) { | ||
| 21941 | |||
| 21942 | # Open an 'edit' window for the specified buffer item | ||
| 21943 | $self->session->pseudoCmd( | ||
| 21944 | 'editinstructionbuffer -s ' . $number, | ||
| 21945 | $self->pseudoCmdMode, | ||
| 21946 | ); | ||
| 21947 | } | ||
| 21948 | }); | ||
| 21949 | |||
| 21950 | # 'Dump' | ||
| 21951 | $button3->signal_connect('clicked' => sub { | ||
| 21952 | |||
| 21953 | my $number = $entry4->get_text(); | ||
| 21954 | |||
| 21955 | if ($self->checkEntryIcon($entry4)) { | ||
| 21956 | |||
| 21957 | # Display the specified buffer item | ||
| 21958 | $self->session->pseudoCmd( | ||
| 21959 | 'dumpinstructionbuffer -s ' . $number, | ||
| 21960 | $self->pseudoCmdMode, | ||
| 21961 | ); | ||
| 21962 | } | ||
| 21963 | }); | ||
| 21964 | |||
| 21965 | # 'Dump last' | ||
| 21966 | $button4->signal_connect('clicked' => sub { | ||
| 21967 | |||
| 21968 | # Display most recent buffer item | ||
| 21969 | $self->session->pseudoCmd('dumpinstructionbuffer -s', $self->pseudoCmdMode); | ||
| 21970 | # Show the number of the most recent buffer item | ||
| 21971 | if (defined $self->session->instructBufferLast) { | ||
| 21972 | |||
| 21973 | $entry4->set_text($self->session->instructBufferLast); | ||
| 21974 | } | ||
| 21975 | }); | ||
| 21976 | |||
| 21977 | # 'Dump 20' | ||
| 21978 | $button5->signal_connect('clicked' => sub { | ||
| 21979 | |||
| 21980 | my ($start, $stop); | ||
| 21981 | |||
| 21982 | $stop = $self->session->instructBufferLast; | ||
| 21983 | $start = $stop - 19; | ||
| 21984 | if ($start < 0) { | ||
| 21985 | |||
| 21986 | $start = 0; | ||
| 21987 | } | ||
| 21988 | |||
| 21989 | # Display most recent buffer items | ||
| 21990 | $self->session->pseudoCmd( | ||
| 21991 | 'dumpinstructionbuffer ' . $start . ' ' . $stop, | ||
| 21992 | $self->pseudoCmdMode, | ||
| 21993 | ); | ||
| 21994 | }); | ||
| 21995 | |||
| 21996 | # 'View' | ||
| 21997 | $button6->signal_connect('clicked' => sub { | ||
| 21998 | |||
| 21999 | my $number = $entry11->get_text(); | ||
| 22000 | |||
| 22001 | if ($self->checkEntryIcon($entry11)) { | ||
| 22002 | |||
| 22003 | # Open an 'edit' window for the specified buffer item | ||
| 22004 | $self->session->pseudoCmd('editcommandbuffer -s ' . $number, $self->pseudoCmdMode); | ||
| 22005 | } | ||
| 22006 | }); | ||
| 22007 | |||
| 22008 | # 'Dump' | ||
| 22009 | $button7->signal_connect('clicked' => sub { | ||
| 22010 | |||
| 22011 | my $number = $entry11->get_text(); | ||
| 22012 | |||
| 22013 | if ($self->checkEntryIcon($entry11)) { | ||
| 22014 | |||
| 22015 | # Display the specified buffer item | ||
| 22016 | $self->session->pseudoCmd('dumpcommandbuffer -s ' . $number, $self->pseudoCmdMode); | ||
| 22017 | } | ||
| 22018 | }); | ||
| 22019 | |||
| 22020 | # 'Dump last' | ||
| 22021 | $button8->signal_connect('clicked' => sub { | ||
| 22022 | |||
| 22023 | # Display most recent buffer item | ||
| 22024 | $self->session->pseudoCmd('dumpcommandbuffer -s', $self->pseudoCmdMode); | ||
| 22025 | # Show the number of the most recent buffer item | ||
| 22026 | if (defined $self->session->cmdBufferLast) { | ||
| 22027 | |||
| 22028 | $entry11->set_text($self->session->cmdBufferLast); | ||
| 22029 | } | ||
| 22030 | }); | ||
| 22031 | |||
| 22032 | # 'Dump 20' | ||
| 22033 | $button9->signal_connect('clicked' => sub { | ||
| 22034 | |||
| 22035 | my ($start, $stop); | ||
| 22036 | |||
| 22037 | $stop = $self->session->cmdBufferLast; | ||
| 22038 | $start = $stop - 19; | ||
| 22039 | if ($start < 0) { | ||
| 22040 | |||
| 22041 | $start = 0; | ||
| 22042 | } | ||
| 22043 | |||
| 22044 | # Display most recent buffer items | ||
| 22045 | $self->session->pseudoCmd( | ||
| 22046 | 'dumpcommandbuffer ' . $start . ' ' . $stop, | ||
| 22047 | $self->pseudoCmdMode, | ||
| 22048 | ); | ||
| 22049 | }); | ||
| 22050 | |||
| 22051 | # Pseudo-click the button to set all the widgets | ||
| 22052 | $button->clicked(); | ||
| 22053 | |||
| 22054 | # Tab complete | ||
| 22055 | return 1; | ||
| 22056 | } | ||
| 22057 | |||
| 22058 | sub interfacesTab { | ||
| 22059 | |||
| 22060 | # Interfaces tab - called by $self->setupNotebook | ||
| 22061 | # | ||
| 22062 | # Expected arguments | ||
| 22063 | # (none besides $self) | ||
| 22064 | # | ||
| 22065 | # Return values | ||
| 22066 | # 'undef' on improper arguments | ||
| 22067 | # 1 otherwise | ||
| 22068 | |||
| 22069 | my ($self, $check) = @_; | ||
| 22070 | |||
| 22071 | # Check for improper arguments | ||
| 22072 | if (defined $check) { | ||
| 22073 | |||
| 22074 | return $axmud::CLIENT->writeImproper($self->_objClass . '->interfacesTab', @_); | ||
| 22075 | } | ||
| 22076 | |||
| 22077 | # Tab setup | ||
| 22078 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 22079 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Interfaces'); | ||
| 22080 | |||
| 22081 | # Add tabs to the inner notebook | ||
| 22082 | $self->interfaces1Tab($innerNotebook); | ||
| 22083 | $self->interfaces2Tab($innerNotebook, 'trigger', 2); | ||
| 22084 | $self->interfaces2Tab($innerNotebook, 'alias', 3); | ||
| 22085 | $self->interfaces2Tab($innerNotebook, 'macro', 4); | ||
| 22086 | $self->interfaces2Tab($innerNotebook, 'timer', 5); | ||
| 22087 | $self->interfaces2Tab($innerNotebook, 'hook', 6); | ||
| 22088 | |||
| 22089 | return 1; | ||
| 22090 | } | ||
| 22091 | |||
| 22092 | sub interfaces1Tab { | ||
| 22093 | |||
| 22094 | # Interfaces1 tab | ||
| 22095 | # | ||
| 22096 | # Expected arguments | ||
| 22097 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 22098 | # | ||
| 22099 | # Return values | ||
| 22100 | # 'undef' on improper arguments | ||
| 22101 | # 1 otherwise | ||
| 22102 | |||
| 22103 | my ($self, $innerNotebook, $check) = @_; | ||
| 22104 | |||
| 22105 | # Local variables | ||
| 22106 | my ( | ||
| 22107 | $listType, | ||
| 22108 | @columnList, @list, @comboList, $title, | ||
| 22109 | %comboHash, | ||
| 22110 | ); | ||
| 22111 | |||
| 22112 | # Check for improper arguments | ||
| 22113 | if (! defined $innerNotebook || defined $check) { | ||
| 22114 | |||
| 22115 | return $axmud::CLIENT->writeImproper($self->_objClass . '->interfaces1Tab', @_); | ||
| 22116 | } | ||
| 22117 | |||
| 22118 | # Tab setup | ||
| 22119 | my $grid = $self->addTab( | ||
| 22120 | $innerNotebook, | ||
| 22121 | 'Page _1', | ||
| 22122 | ['Active interfaces'], | ||
| 22123 | ); | ||
| 22124 | |||
| 22125 | # Left column | ||
| 22126 | $self->addLabel($grid, '<b>Active interfaces</b>', | ||
| 22127 | 0, 12, 0, 1); | ||
| 22128 | $self->addLabel($grid, '<i>List of interfaces which are currently active</i>', | ||
| 22129 | 1, 12, 1, 2); | ||
| 22130 | |||
| 22131 | # Add a simple list | ||
| 22132 | @columnList = ( | ||
| 22133 | '#', 'int', | ||
| 22134 | 'Name', 'text', | ||
| 22135 | 'Category', 'text', | ||
| 22136 | 'Indep', 'bool', | ||
| 22137 | 'Enabled', 'bool_editable', | ||
| 22138 | 'Associated profile', 'text', | ||
| 22139 | 'Cooldown expires (seconds)', 'text', | ||
| 22140 | ); | ||
| 22141 | |||
| 22142 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 22143 | 1, 12, 2, 10, | ||
| 22144 | -1, -1, | ||
| 22145 | $self->getMethodRef('interfaces1Tab_buttonToggled'), | ||
| 22146 | ); | ||
| 22147 | |||
| 22148 | # Unusual step - need to save the simple list, because $self->interfaces1Tab_refreshList | ||
| 22149 | # updates multiple simple lists together. Because this is a 'pref' window, the lists are | ||
| 22150 | # stored in $self->editConfigHash | ||
| 22151 | $self->ivAdd('editConfigHash', 'interface_list_all', $slWidget); | ||
| 22152 | |||
| 22153 | # Initialise the list | ||
| 22154 | $listType = 'all'; | ||
| 22155 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22156 | |||
| 22157 | # Add buttons and combos | ||
| 22158 | my $button = $self->addButton($grid, | ||
| 22159 | 'Edit...', 'Edit the selected active interface', undef, | ||
| 22160 | 1, 3, 10, 11); | ||
| 22161 | $button->signal_connect('clicked' => sub { | ||
| 22162 | |||
| 22163 | my ($number, $interfaceObj); | ||
| 22164 | |||
| 22165 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 22166 | if (defined $number) { | ||
| 22167 | |||
| 22168 | $interfaceObj = $self->session->ivShow('interfaceNumHash', $number); | ||
| 22169 | if ($interfaceObj) { | ||
| 22170 | |||
| 22171 | # Open up an 'edit' window to edit the object | ||
| 22172 | $self->createFreeWin( | ||
| 22173 | 'Games::Axmud::EditWin::Interface::Active', | ||
| 22174 | $self, | ||
| 22175 | $self->session, | ||
| 22176 | 'Edit active ' . $interfaceObj->category . ' interface \'' | ||
| 22177 | . $interfaceObj->name . '\'', | ||
| 22178 | $interfaceObj, | ||
| 22179 | FALSE, # Not temporary | ||
| 22180 | ); | ||
| 22181 | } | ||
| 22182 | |||
| 22183 | # Refresh this simple list | ||
| 22184 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22185 | # Refresh the simple list for the corresponding tab | ||
| 22186 | $self->interfaces1Tab_refreshList( | ||
| 22187 | $self->ivShow('editConfigHash', 'interface_list_' . $interfaceObj->category), | ||
| 22188 | scalar (@columnList / 2), | ||
| 22189 | $interfaceObj->category, | ||
| 22190 | ); | ||
| 22191 | } | ||
| 22192 | }); | ||
| 22193 | |||
| 22194 | my $button2 = $self->addButton($grid, | ||
| 22195 | 'Export', 'Export selected interfaces to the interface clipboard', undef, | ||
| 22196 | 3, 5, 10, 11); | ||
| 22197 | $button2->signal_connect('clicked' => sub { | ||
| 22198 | |||
| 22199 | my ( | ||
| 22200 | $interfaceObj, | ||
| 22201 | @interfaceList, | ||
| 22202 | ); | ||
| 22203 | |||
| 22204 | @interfaceList = $self->getSimpleListData($slWidget, 0); | ||
| 22205 | if (@interfaceList) { | ||
| 22206 | |||
| 22207 | # Empty the clipboard | ||
| 22208 | $self->session->pseudoCmd( | ||
| 22209 | 'clearclipboard', | ||
| 22210 | $self->pseudoCmdMode, | ||
| 22211 | ); | ||
| 22212 | |||
| 22213 | # Export the selected interfaces | ||
| 22214 | foreach my $number (@interfaceList) { | ||
| 22215 | |||
| 22216 | $interfaceObj = $self->session->ivShow('interfaceNumHash', $number); | ||
| 22217 | |||
| 22218 | $self->session->pseudoCmd( | ||
| 22219 | 'export' . $interfaceObj->category . ' -i ' . $number, | ||
| 22220 | $self->pseudoCmdMode, | ||
| 22221 | ); | ||
| 22222 | } | ||
| 22223 | |||
| 22224 | # Refresh this simple list | ||
| 22225 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22226 | # Refresh the simple list for the corresponding tab | ||
| 22227 | $self->interfaces1Tab_refreshList( | ||
| 22228 | $self->ivShow('editConfigHash', 'interface_list_' . $interfaceObj->category), | ||
| 22229 | scalar (@columnList / 2), | ||
| 22230 | $interfaceObj->category, | ||
| 22231 | ); | ||
| 22232 | } | ||
| 22233 | }); | ||
| 22234 | |||
| 22235 | # Prepare a list of combo items. The keys are the combo items themselves, the corresponding | ||
| 22236 | # values are arguments to send to $self->interfaces1Tab_refreshList | ||
| 22237 | @list = ( | ||
| 22238 | 'Numerically' => 'all', | ||
| 22239 | 'Alphabetically' => 'alpha', | ||
| 22240 | 'Dependent only' => 'dependent', | ||
| 22241 | 'Independent only' => 'independent', | ||
| 22242 | 'Triggers only' => 'trigger', | ||
| 22243 | 'Aliases only' => 'alias', | ||
| 22244 | 'Macros only' => 'macro', | ||
| 22245 | 'Timers only' => 'timer', | ||
| 22246 | 'Hooks only' => 'hook', | ||
| 22247 | ); | ||
| 22248 | |||
| 22249 | do { | ||
| 22250 | |||
| 22251 | my $key = shift @list; | ||
| 22252 | my $value = shift @list; | ||
| 22253 | |||
| 22254 | push (@comboList, $key); | ||
| 22255 | $comboHash{$key} = $value; | ||
| 22256 | |||
| 22257 | } until (! @list); | ||
| 22258 | |||
| 22259 | # Add the combo | ||
| 22260 | $title = 'View interfaces:'; | ||
| 22261 | my $comboBox = $self->addComboBox($grid, undef, \@comboList, $title, | ||
| 22262 | FALSE, # Title, so no 'undef' value seen | ||
| 22263 | 9, 12, 10, 11); | ||
| 22264 | $comboBox->signal_connect('changed' => sub { | ||
| 22265 | |||
| 22266 | my $text = $comboBox->get_active_text(); | ||
| 22267 | |||
| 22268 | if ($text ne $title) { | ||
| 22269 | |||
| 22270 | # Refresh this simple list | ||
| 22271 | $listType = $comboHash{$text}; | ||
| 22272 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22273 | } | ||
| 22274 | }); | ||
| 22275 | |||
| 22276 | # Unusual step - also store the combo, so it can be reset by the other tabs | ||
| 22277 | $self->ivAdd('editConfigHash', 'interface_combo', $comboBox); | ||
| 22278 | |||
| 22279 | my $button3 = $self->addButton($grid, | ||
| 22280 | 'Enable all', 'Enable all active interfaces', undef, | ||
| 22281 | 1, 3, 11, 12); | ||
| 22282 | $button3->signal_connect('clicked' => sub { | ||
| 22283 | |||
| 22284 | # Enable all active interfaces | ||
| 22285 | $self->session->pseudoCmd('enableactiveinterface', $self->pseudoCmdMode); | ||
| 22286 | # Refresh this simple list | ||
| 22287 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22288 | # Refresh the simple list in the other tabs | ||
| 22289 | foreach my $category ( ['trigger', 'alias', 'macro', 'timer', 'hook'] ) { | ||
| 22290 | |||
| 22291 | $self->interfaces1Tab_refreshList( | ||
| 22292 | $self->ivShow('editConfigHash', 'interface_list_' . $category), | ||
| 22293 | scalar (@columnList / 2), | ||
| 22294 | $category, | ||
| 22295 | ); | ||
| 22296 | } | ||
| 22297 | }); | ||
| 22298 | |||
| 22299 | my $button4 = $self->addButton($grid, | ||
| 22300 | 'Disable all', 'Disable all active interfaces', undef, | ||
| 22301 | 3, 5, 11, 12); | ||
| 22302 | $button4->signal_connect('clicked' => sub { | ||
| 22303 | |||
| 22304 | # Disable all active interfaces | ||
| 22305 | $self->session->pseudoCmd('disableactiveinterface', $self->pseudoCmdMode); | ||
| 22306 | # Refresh this simple list | ||
| 22307 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22308 | # Refresh the simple list in the other tabs | ||
| 22309 | foreach my $category ( ['trigger', 'alias', 'macro', 'timer', 'hook'] ) { | ||
| 22310 | |||
| 22311 | $self->interfaces1Tab_refreshList( | ||
| 22312 | $self->ivShow('editConfigHash', 'interface_list_' . $category), | ||
| 22313 | scalar (@columnList / 2), | ||
| 22314 | $category, | ||
| 22315 | ); | ||
| 22316 | } | ||
| 22317 | }); | ||
| 22318 | |||
| 22319 | my $button5 = $self->addButton($grid, | ||
| 22320 | 'Update list', 'Update the list of interfaces', undef, | ||
| 22321 | 10, 12, 11, 12); | ||
| 22322 | $button5->signal_connect('clicked' => sub { | ||
| 22323 | |||
| 22324 | # Refresh this simple list | ||
| 22325 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType); | ||
| 22326 | }); | ||
| 22327 | |||
| 22328 | # Tab complete | ||
| 22329 | return 1; | ||
| 22330 | } | ||
| 22331 | |||
| 22332 | sub interfaces1Tab_refreshList { | ||
| 22333 | |||
| 22334 | # Resets the simple lists displayed by $self->interface1Tab and ->interface2Tab | ||
| 22335 | # | ||
| 22336 | # Expected arguments | ||
| 22337 | # $slWidget - The GA::Obj::SimpleList | ||
| 22338 | # $columns - The number of columns | ||
| 22339 | # $type - A string desribing the subset of active interfaces to show - set to | ||
| 22340 | # 'all', 'alpha', 'dependent', 'independent', 'trigger', 'alias', | ||
| 22341 | # 'macro', 'timer', 'hook' | ||
| 22342 | # | ||
| 22343 | # Return values | ||
| 22344 | # 'undef' on improper arguments | ||
| 22345 | # 1 otherwise | ||
| 22346 | |||
| 22347 | my ($self, $slWidget, $columns, $type, $check) = @_; | ||
| 22348 | |||
| 22349 | # Local variables | ||
| 22350 | my ( | ||
| 22351 | $iv, | ||
| 22352 | @modList, @sortedList, @dataList, | ||
| 22353 | ); | ||
| 22354 | |||
| 22355 | # Check for improper arguments | ||
| 22356 | if (! defined $slWidget || ! defined $columns || ! defined $type || defined $check) { | ||
| 22357 | |||
| 22358 | return $axmud::CLIENT->writeImproper( | ||
| 22359 | $self->_objClass . '->interfaces1Tab_refreshList', | ||
| 22360 | @_, | ||
| 22361 | ); | ||
| 22362 | } | ||
| 22363 | |||
| 22364 | # Get a list of active interfaces, and then remove any that we don't want to show (according | ||
| 22365 | # to the value of $type) | ||
| 22366 | foreach my $obj ($self->session->ivValues('interfaceHash')) { | ||
| 22367 | |||
| 22368 | if ( | ||
| 22369 | $type eq 'all' | ||
| 22370 | || $type eq 'alpha' | ||
| 22371 | || ($type eq 'dependent' && ! $obj->indepFlag) | ||
| 22372 | || ($type eq 'independent' && $obj->indepFlag) | ||
| 22373 | || ($obj->category eq $type) # 'trigger', 'alias', etc | ||
| 22374 | ) { | ||
| 22375 | push (@modList, $obj); | ||
| 22376 | } | ||
| 22377 | } | ||
| 22378 | |||
| 22379 | # Sort the list, as appropriate. The default is to sort numerically | ||
| 22380 | if ($type eq 'all') { | ||
| 22381 | |||
| 22382 | @sortedList = sort {$a->number <=> $b->number} (@modList); | ||
| 22383 | |||
| 22384 | } elsif ($type eq 'alpha' || $type eq 'dependent' || $type eq 'independent') { | ||
| 22385 | |||
| 22386 | @sortedList = sort {lc($a->name) cmp lc($b->name)} (@modList); | ||
| 22387 | |||
| 22388 | } else { | ||
| 22389 | |||
| 22390 | $iv = $type . 'OrderList'; # e.g. 'triggerOrderList' | ||
| 22391 | |||
| 22392 | foreach my $number ($self->session->$iv) { | ||
| 22393 | |||
| 22394 | push (@sortedList, $self->session->ivShow('interfaceNumHash', $number)); | ||
| 22395 | } | ||
| 22396 | } | ||
| 22397 | |||
| 22398 | # Compile the simple list data | ||
| 22399 | foreach my $obj (@sortedList) { | ||
| 22400 | |||
| 22401 | my $seconds; | ||
| 22402 | |||
| 22403 | if ($obj->category ne 'timer') { | ||
| 22404 | |||
| 22405 | $iv = $obj->category . 'CooldownHash'; | ||
| 22406 | $seconds = $self->session->ivShow($iv, $obj->number); | ||
| 22407 | if (defined $seconds) { | ||
| 22408 | |||
| 22409 | $seconds = $seconds - $self->session->sessionTime; | ||
| 22410 | if ($seconds < 0) { | ||
| 22411 | |||
| 22412 | # Already expired, but IV not updated yet | ||
| 22413 | $seconds = undef; | ||
| 22414 | |||
| 22415 | } else { | ||
| 22416 | |||
| 22417 | $seconds = sprintf("%.1f", $seconds); | ||
| 22418 | } | ||
| 22419 | } | ||
| 22420 | } | ||
| 22421 | |||
| 22422 | push (@dataList, | ||
| 22423 | $obj->number, | ||
| 22424 | $obj->name, | ||
| 22425 | $obj->category, | ||
| 22426 | $obj->indepFlag, | ||
| 22427 | $obj->enabledFlag, | ||
| 22428 | $obj->assocProf, | ||
| 22429 | $seconds, | ||
| 22430 | ); | ||
| 22431 | } | ||
| 22432 | |||
| 22433 | # Reset the simple list | ||
| 22434 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 22435 | |||
| 22436 | return 1; | ||
| 22437 | } | ||
| 22438 | |||
| 22439 | sub interfaces1Tab_buttonToggled { | ||
| 22440 | |||
| 22441 | # Callback from GA::Generic::EditWin->addSimpleList | ||
| 22442 | # | ||
| 22443 | # Expected arguments | ||
| 22444 | # $slWidget - The GA::Obj::SimpleList | ||
| 22445 | # $model - The Gtk3::ListStore | ||
| 22446 | # $iter - The Gtk3::TreeIter of the line clicked | ||
| 22447 | # @data - Data for all the cells on that line | ||
| 22448 | # | ||
| 22449 | # Return values | ||
| 22450 | # 'undef' on improper arguments | ||
| 22451 | # 1 otherwise | ||
| 22452 | |||
| 22453 | my ($self, $slWidget, $model, $iter, @dataList) = @_; | ||
| 22454 | |||
| 22455 | # Local variables | ||
| 22456 | my ($interfaceName, $flag, $interfaceObj); | ||
| 22457 | |||
| 22458 | # Check for improper arguments | ||
| 22459 | if (! defined $slWidget || ! defined $model || ! defined $iter) { | ||
| 22460 | |||
| 22461 | return $axmud::CLIENT->writeImproper( | ||
| 22462 | $self->_objClass . '->interfaces1Tab_buttonToggled', | ||
| 22463 | @_, | ||
| 22464 | ); | ||
| 22465 | } | ||
| 22466 | |||
| 22467 | # Update IVs | ||
| 22468 | $interfaceName = $dataList[1]; | ||
| 22469 | $flag = $dataList[4]; | ||
| 22470 | |||
| 22471 | $interfaceObj = $self->session->ivShow('interfaceHash', $interfaceName); | ||
| 22472 | if (! $interfaceObj) { | ||
| 22473 | |||
| 22474 | # Failsafe | ||
| 22475 | return undef; | ||
| 22476 | } | ||
| 22477 | |||
| 22478 | if ($flag) { | ||
| 22479 | |||
| 22480 | if (! $interfaceObj->enabledFlag) { | ||
| 22481 | |||
| 22482 | $self->session->pseudoCmd( | ||
| 22483 | 'enableactiveinterface ' . $interfaceName, | ||
| 22484 | $self->pseudoCmdMode, | ||
| 22485 | ); | ||
| 22486 | |||
| 22487 | } else { | ||
| 22488 | |||
| 22489 | # Refresh the simple list for this tab | ||
| 22490 | $self->interfaces1Tab_refreshList($slWidget, scalar @dataList, 'all'); | ||
| 22491 | } | ||
| 22492 | |||
| 22493 | } elsif (! $flag) { | ||
| 22494 | |||
| 22495 | if ($interfaceObj->enabledFlag) { | ||
| 22496 | |||
| 22497 | $self->session->pseudoCmd( | ||
| 22498 | 'disableactiveinterface ' . $interfaceName, | ||
| 22499 | $self->pseudoCmdMode, | ||
| 22500 | ); | ||
| 22501 | |||
| 22502 | } else { | ||
| 22503 | |||
| 22504 | # Refresh the simple list for this tab | ||
| 22505 | $self->interfaces1Tab_refreshList($slWidget, scalar @dataList, 'all'); | ||
| 22506 | } | ||
| 22507 | } | ||
| 22508 | |||
| 22509 | # Refresh the simple list for the corresponding tab | ||
| 22510 | $self->interfaces1Tab_refreshList( | ||
| 22511 | $self->ivShow('editConfigHash', 'interface_list_' . $interfaceObj->category), | ||
| 22512 | scalar @dataList, | ||
| 22513 | $interfaceObj->category, | ||
| 22514 | ); | ||
| 22515 | |||
| 22516 | return 1; | ||
| 22517 | } | ||
| 22518 | |||
| 22519 | sub interfaces2Tab { | ||
| 22520 | |||
| 22521 | # Interfaces2 tab | ||
| 22522 | # | ||
| 22523 | # Expected arguments | ||
| 22524 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 22525 | # $category - The category of interface to show: 'trigger', 'alias', 'macro', | ||
| 22526 | # 'timer' or 'hook' | ||
| 22527 | # $number - The page number to use | ||
| 22528 | # | ||
| 22529 | # Return values | ||
| 22530 | # 'undef' on improper arguments | ||
| 22531 | # 1 otherwise | ||
| 22532 | |||
| 22533 | my ($self, $innerNotebook, $category, $number, $check) = @_; | ||
| 22534 | |||
| 22535 | # Local variables | ||
| 22536 | my @columnList; | ||
| 22537 | |||
| 22538 | # Check for improper arguments | ||
| 22539 | if ( | ||
| 22540 | ! defined $innerNotebook || ! defined $category || ! defined $number || defined $check | ||
| 22541 | ) { | ||
| 22542 | return $axmud::CLIENT->writeImproper($self->_objClass . '->interfaces2Tab', @_); | ||
| 22543 | } | ||
| 22544 | |||
| 22545 | # Tab setup | ||
| 22546 | my $grid = $self->addTab( | ||
| 22547 | $innerNotebook, | ||
| 22548 | 'Page _' . $number, | ||
| 22549 | ['Active ' . $category . ' interfaces'], | ||
| 22550 | ); | ||
| 22551 | |||
| 22552 | # Left column | ||
| 22553 | $self->addLabel($grid, '<b>Active ' . $category . ' interfaces</b>', | ||
| 22554 | 0, 12, 0, 1); | ||
| 22555 | $self->addLabel( | ||
| 22556 | $grid, '<i>List of ' . $category . ' interfaces, in the order in which they are' | ||
| 22557 | . ' consulted</i>', | ||
| 22558 | 1, 12, 1, 2); | ||
| 22559 | |||
| 22560 | # Add a simple list | ||
| 22561 | @columnList = ( | ||
| 22562 | '#', 'int', | ||
| 22563 | 'Name', 'text', | ||
| 22564 | 'Category', 'text', | ||
| 22565 | 'Indep', 'bool', | ||
| 22566 | 'Enabled', 'bool_editable', | ||
| 22567 | 'Associated profile', 'text', | ||
| 22568 | 'Cooldown expires (seconds)', 'text', | ||
| 22569 | ); | ||
| 22570 | |||
| 22571 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 22572 | 1, 12, 2, 10, | ||
| 22573 | -1, -1, | ||
| 22574 | $self->getMethodRef('interfaces2Tab_buttonToggled'), | ||
| 22575 | ); | ||
| 22576 | |||
| 22577 | # Unusual step - need to save the simple list, because $self->interfaces1Tab_refreshList | ||
| 22578 | # updates multiple simple lists together. Because this is a 'pref' window, the lists are | ||
| 22579 | # stored in $self->editConfigHash | ||
| 22580 | $self->ivAdd('editConfigHash', 'interface_list_' . $category, $slWidget); | ||
| 22581 | |||
| 22582 | # Initialise the list | ||
| 22583 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category); | ||
| 22584 | |||
| 22585 | # Add buttons and combos | ||
| 22586 | my $button = $self->addButton($grid, | ||
| 22587 | 'Edit...', 'Edit the selected active interface', undef, | ||
| 22588 | 1, 3, 10, 11); | ||
| 22589 | $button->signal_connect('clicked' => sub { | ||
| 22590 | |||
| 22591 | my ($number, $interfaceObj); | ||
| 22592 | |||
| 22593 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 22594 | if (defined $number) { | ||
| 22595 | |||
| 22596 | $interfaceObj = $self->session->ivShow('interfaceNumHash', $number); | ||
| 22597 | if ($interfaceObj) { | ||
| 22598 | |||
| 22599 | # Open up an 'edit' window to edit the object | ||
| 22600 | $self->createFreeWin( | ||
| 22601 | 'Games::Axmud::EditWin::Interface::Active', | ||
| 22602 | $self, | ||
| 22603 | $self->session, | ||
| 22604 | 'Edit active ' . $interfaceObj->category . ' interface \'' | ||
| 22605 | . $interfaceObj->name . '\'', | ||
| 22606 | $interfaceObj, | ||
| 22607 | FALSE, # Not temporary | ||
| 22608 | ); | ||
| 22609 | } | ||
| 22610 | |||
| 22611 | # Refresh the simple list | ||
| 22612 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category); | ||
| 22613 | } | ||
| 22614 | }); | ||
| 22615 | |||
| 22616 | my $button2 = $self->addButton($grid, | ||
| 22617 | 'Export', 'Export selected interfaces to the interface clipboard', undef, | ||
| 22618 | 3, 5, 10, 11); | ||
| 22619 | $button2->signal_connect('clicked' => sub { | ||
| 22620 | |||
| 22621 | my ( | ||
| 22622 | $interfaceObj, $comboBox, | ||
| 22623 | @interfaceList, | ||
| 22624 | ); | ||
| 22625 | |||
| 22626 | @interfaceList = $self->getSimpleListData($slWidget, 0); | ||
| 22627 | if (@interfaceList) { | ||
| 22628 | |||
| 22629 | # Empty the clipboard | ||
| 22630 | $self->session->pseudoCmd( | ||
| 22631 | 'clearclipboard', | ||
| 22632 | $self->pseudoCmdMode, | ||
| 22633 | ); | ||
| 22634 | |||
| 22635 | # Export the selected interfaces | ||
| 22636 | foreach my $number (@interfaceList) { | ||
| 22637 | |||
| 22638 | $interfaceObj = $self->session->ivShow('interfaceNumHash', $number); | ||
| 22639 | |||
| 22640 | $self->session->pseudoCmd( | ||
| 22641 | 'export' . $interfaceObj->category . ' -i ' . $number, | ||
| 22642 | $self->pseudoCmdMode, | ||
| 22643 | ); | ||
| 22644 | } | ||
| 22645 | |||
| 22646 | # Refresh this simple list | ||
| 22647 | $self->interfaces1Tab_refreshList( | ||
| 22648 | $slWidget, | ||
| 22649 | scalar (@columnList / 2), | ||
| 22650 | $category, | ||
| 22651 | ); | ||
| 22652 | |||
| 22653 | # Refresh the simple list/combo in the first tab | ||
| 22654 | $comboBox = $self->ivShow('editConfigHash', 'interface_combo'); | ||
| 22655 | if ($comboBox->get_active() == 1) { | ||
| 22656 | |||
| 22657 | $self->interfaces1Tab_refreshList( | ||
| 22658 | $self->ivShow('editConfigHash', 'interface_list_all'), | ||
| 22659 | scalar (@columnList / 2), | ||
| 22660 | 'all', | ||
| 22661 | ); | ||
| 22662 | |||
| 22663 | } else { | ||
| 22664 | |||
| 22665 | # Updating the combobox, refreshes the simple list | ||
| 22666 | $comboBox->set_active(1); | ||
| 22667 | } | ||
| 22668 | } | ||
| 22669 | }); | ||
| 22670 | |||
| 22671 | my $button3 = $self->addButton($grid, | ||
| 22672 | 'Move up', 'Move the selected active interface up the list', undef, | ||
| 22673 | 8, 10, 10, 11); | ||
| 22674 | $button3->signal_connect('clicked' => sub { | ||
| 22675 | |||
| 22676 | my ($number, $iv, $posn, $comboBox); | ||
| 22677 | |||
| 22678 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 22679 | if (defined $number) { | ||
| 22680 | |||
| 22681 | # Get the interface's current position in the list | ||
| 22682 | $iv = $category . 'OrderList'; # e.g. 'triggerOrderList' | ||
| 22683 | $posn = $self->session->ivFind($iv, $number); | ||
| 22684 | # Can't move the interface if it's already at the top of the list | ||
| 22685 | if (defined $posn && $posn != 0) { | ||
| 22686 | |||
| 22687 | # Move the active interface. The client command understands the position to be | ||
| 22688 | # a number in the range 1..., whereas $posn is an index in the range 0..., | ||
| 22689 | # so to move the interface up one position, we just use $posn | ||
| 22690 | $self->session->pseudoCmd( | ||
| 22691 | 'moveactiveinterface ' . $number . ' ' . $posn, | ||
| 22692 | $self->pseudoCmdMode, | ||
| 22693 | ); | ||
| 22694 | |||
| 22695 | # Refresh this simple list | ||
| 22696 | $self->interfaces1Tab_refreshList( | ||
| 22697 | $slWidget, | ||
| 22698 | scalar (@columnList / 2), | ||
| 22699 | $category, | ||
| 22700 | ); | ||
| 22701 | |||
| 22702 | # The interface should still be highlighted, after being moved up | ||
| 22703 | $slWidget->select($posn - 1); | ||
| 22704 | |||
| 22705 | # Refresh the simple list/combo in the first tab | ||
| 22706 | $comboBox = $self->ivShow('editConfigHash', 'interface_combo'); | ||
| 22707 | if ($comboBox->get_active() == 1) { | ||
| 22708 | |||
| 22709 | $self->interfaces1Tab_refreshList( | ||
| 22710 | $self->ivShow('editConfigHash', 'interface_list_all'), | ||
| 22711 | scalar (@columnList / 2), | ||
| 22712 | 'all', | ||
| 22713 | ); | ||
| 22714 | |||
| 22715 | } else { | ||
| 22716 | |||
| 22717 | # Updating the combobox, refreshes the simple list | ||
| 22718 | $comboBox->set_active(1); | ||
| 22719 | } | ||
| 22720 | } | ||
| 22721 | } | ||
| 22722 | }); | ||
| 22723 | |||
| 22724 | my $button4 = $self->addButton($grid, | ||
| 22725 | 'Move down', 'Move the selected active interface down the list', undef, | ||
| 22726 | 10, 12, 10, 11); | ||
| 22727 | $button4->signal_connect('clicked' => sub { | ||
| 22728 | |||
| 22729 | my ($number, $iv, $posn, $comboBox); | ||
| 22730 | |||
| 22731 | ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 22732 | if (defined $number) { | ||
| 22733 | |||
| 22734 | # Get the interface's current position in the list | ||
| 22735 | $iv = $category . 'OrderList'; # e.g. 'triggerOrderList' | ||
| 22736 | $posn = $self->session->ivFind($iv, $number); | ||
| 22737 | # Can't move the interface if it's already at the bottom of the list | ||
| 22738 | if (defined $posn && $posn < ((scalar $self->session->$iv) - 1)) { | ||
| 22739 | |||
| 22740 | # Move the active interface. The client command understands the position to be | ||
| 22741 | # a number in the range 1..., whereas $posn is an index in the range 0..., | ||
| 22742 | # so to move the interface down one position, we must add 2 to $posn | ||
| 22743 | $self->session->pseudoCmd( | ||
| 22744 | 'moveactiveinterface ' . $number . ' ' . ($posn + 2), | ||
| 22745 | $self->pseudoCmdMode, | ||
| 22746 | ); | ||
| 22747 | |||
| 22748 | # Refresh this simple list | ||
| 22749 | $self->interfaces1Tab_refreshList( | ||
| 22750 | $slWidget, | ||
| 22751 | scalar (@columnList / 2), | ||
| 22752 | $category, | ||
| 22753 | ); | ||
| 22754 | |||
| 22755 | # The interface should still be highlighted, after being moved down | ||
| 22756 | $slWidget->select($posn + 1); | ||
| 22757 | |||
| 22758 | # Refresh the simple list/combo in the first tab | ||
| 22759 | $comboBox = $self->ivShow('editConfigHash', 'interface_combo'); | ||
| 22760 | if ($comboBox->get_active() == 1) { | ||
| 22761 | |||
| 22762 | $self->interfaces1Tab_refreshList( | ||
| 22763 | $self->ivShow('editConfigHash', 'interface_list_all'), | ||
| 22764 | scalar (@columnList / 2), | ||
| 22765 | 'all', | ||
| 22766 | ); | ||
| 22767 | |||
| 22768 | } else { | ||
| 22769 | |||
| 22770 | # Updating the combobox, refreshes the simple list | ||
| 22771 | $comboBox->set_active(1); | ||
| 22772 | } | ||
| 22773 | } | ||
| 22774 | } | ||
| 22775 | }); | ||
| 22776 | |||
| 22777 | my $button5 = $self->addButton( | ||
| 22778 | $grid, | ||
| 22779 | 'Edit ' . $category . ' interface model...', | ||
| 22780 | 'Edit the model for this type of interface', | ||
| 22781 | undef, | ||
| 22782 | 1, 5, 11, 12); | ||
| 22783 | $button5->signal_connect('clicked' => sub { | ||
| 22784 | |||
| 22785 | my $obj = $axmud::CLIENT->ivShow('interfaceModelHash', $category); | ||
| 22786 | if ($obj) { | ||
| 22787 | |||
| 22788 | # Open up an 'edit' window to edit the object | ||
| 22789 | $self->createFreeWin( | ||
| 22790 | 'Games::Axmud::EditWin::InterfaceModel', | ||
| 22791 | $self, | ||
| 22792 | $self->session, | ||
| 22793 | 'Edit ' . $category . ' interface model', | ||
| 22794 | $obj, | ||
| 22795 | FALSE, # Not temporary | ||
| 22796 | ); | ||
| 22797 | } | ||
| 22798 | }); | ||
| 22799 | |||
| 22800 | my $button6 = $self->addButton($grid, | ||
| 22801 | 'Update list', 'Update the list of interfaces', undef, | ||
| 22802 | 10, 12, 11, 12); | ||
| 22803 | $button6->signal_connect('clicked' => sub { | ||
| 22804 | |||
| 22805 | # Refresh the simple list | ||
| 22806 | $self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $category); | ||
| 22807 | }); | ||
| 22808 | |||
| 22809 | # Tab complete | ||
| 22810 | return 1; | ||
| 22811 | } | ||
| 22812 | |||
| 22813 | sub interfaces2Tab_buttonToggled { | ||
| 22814 | |||
| 22815 | # Callback from GA::Generic::EditWin->addSimpleList | ||
| 22816 | # | ||
| 22817 | # Expected arguments | ||
| 22818 | # $slWidget - The GA::Obj::SimpleList | ||
| 22819 | # $model - The Gtk3::ListStore | ||
| 22820 | # $iter - The Gtk3::TreeIter of the line clicked | ||
| 22821 | # @data - Data for all the cells on that line | ||
| 22822 | # | ||
| 22823 | # Return values | ||
| 22824 | # 'undef' on improper arguments | ||
| 22825 | # 1 otherwise | ||
| 22826 | |||
| 22827 | my ($self, $slWidget, $model, $iter, @dataList) = @_; | ||
| 22828 | |||
| 22829 | # Local variables | ||
| 22830 | my ($interfaceName, $flag, $interfaceObj, $comboBox); | ||
| 22831 | |||
| 22832 | # Check for improper arguments | ||
| 22833 | if (! defined $slWidget || ! defined $model || ! defined $iter) { | ||
| 22834 | |||
| 22835 | return $axmud::CLIENT->writeImproper( | ||
| 22836 | $self->_objClass . '->interfaces2Tab_buttonToggled', | ||
| 22837 | @_, | ||
| 22838 | ); | ||
| 22839 | } | ||
| 22840 | |||
| 22841 | # Update IVs | ||
| 22842 | $interfaceName = $dataList[1]; | ||
| 22843 | $flag = $dataList[4]; | ||
| 22844 | |||
| 22845 | $interfaceObj = $self->session->ivShow('interfaceHash', $interfaceName); | ||
| 22846 | if (! $interfaceObj) { | ||
| 22847 | |||
| 22848 | # Failsafe | ||
| 22849 | return undef; | ||
| 22850 | } | ||
| 22851 | |||
| 22852 | if ($flag) { | ||
| 22853 | |||
| 22854 | if (! $interfaceObj->enabledFlag) { | ||
| 22855 | |||
| 22856 | $self->session->pseudoCmd( | ||
| 22857 | 'enableactiveinterface ' . $interfaceName, | ||
| 22858 | $self->pseudoCmdMode, | ||
| 22859 | ); | ||
| 22860 | |||
| 22861 | } else { | ||
| 22862 | |||
| 22863 | # Refresh the simple list for this tab | ||
| 22864 | $self->interfaces1Tab_refreshList($slWidget, scalar @dataList, 'all'); | ||
| 22865 | } | ||
| 22866 | |||
| 22867 | } elsif (! $flag) { | ||
| 22868 | |||
| 22869 | if ($interfaceObj->enabledFlag) { | ||
| 22870 | |||
| 22871 | $self->session->pseudoCmd( | ||
| 22872 | 'disableactiveinterface ' . $interfaceName, | ||
| 22873 | $self->pseudoCmdMode, | ||
| 22874 | ); | ||
| 22875 | |||
| 22876 | } else { | ||
| 22877 | |||
| 22878 | # Refresh the simple list for this tab | ||
| 22879 | $self->interfaces1Tab_refreshList($slWidget, scalar @dataList, 'all'); | ||
| 22880 | } | ||
| 22881 | } | ||
| 22882 | |||
| 22883 | # Refresh the simple list/combo for the first tab | ||
| 22884 | $comboBox = $self->ivShow('editConfigHash', 'interface_combo'); | ||
| 22885 | if ($comboBox->get_active() == 1) { | ||
| 22886 | |||
| 22887 | $self->interfaces1Tab_refreshList( | ||
| 22888 | $self->ivShow('editConfigHash', 'interface_list_all'), | ||
| 22889 | scalar @dataList, | ||
| 22890 | 'all', | ||
| 22891 | ); | ||
| 22892 | |||
| 22893 | } else { | ||
| 22894 | |||
| 22895 | # Updating the combobox, refreshes the simple list | ||
| 22896 | $comboBox->set_active(1); | ||
| 22897 | } | ||
| 22898 | |||
| 22899 | return 1; | ||
| 22900 | } | ||
| 22901 | |||
| 22902 | sub tasksTab { | ||
| 22903 | |||
| 22904 | # Tasks tab | ||
| 22905 | # | ||
| 22906 | # Expected arguments | ||
| 22907 | # (none besides $self) | ||
| 22908 | # | ||
| 22909 | # Return values | ||
| 22910 | # 'undef' on improper arguments | ||
| 22911 | # 1 otherwise | ||
| 22912 | |||
| 22913 | my ($self, $check) = @_; | ||
| 22914 | |||
| 22915 | # Local variables | ||
| 22916 | my @columnList; | ||
| 22917 | |||
| 22918 | # Check for improper arguments | ||
| 22919 | if (defined $check) { | ||
| 22920 | |||
| 22921 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab', @_); | ||
| 22922 | } | ||
| 22923 | |||
| 22924 | # Tab setup | ||
| 22925 | my $grid = $self->addTab( | ||
| 22926 | $self->notebook, | ||
| 22927 | '_Tasks', | ||
| 22928 | ['Current tasks'], | ||
| 22929 | ); | ||
| 22930 | |||
| 22931 | # Current tasks | ||
| 22932 | $self->addLabel($grid, '<b>Current tasks</b>', | ||
| 22933 | 0, 12, 0, 1); | ||
| 22934 | $self->addLabel($grid, | ||
| 22935 | '<i>List of tasks in this session\'s current tasklist (showing task window status)</i>', | ||
| 22936 | 1, 12, 1, 2); | ||
| 22937 | |||
| 22938 | # Add a simple list | ||
| 22939 | @columnList = ( | ||
| 22940 | 'Task', 'text', | ||
| 22941 | 'Allowed', 'bool', | ||
| 22942 | 'Required', 'bool', | ||
| 22943 | 'Open on start', 'bool', | ||
| 22944 | 'Open now', 'bool', | ||
| 22945 | 'Preferred locations', 'text', | ||
| 22946 | 'Use winmap', 'text', | ||
| 22947 | ); | ||
| 22948 | |||
| 22949 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 22950 | 1, 12, 2, 10); | ||
| 22951 | |||
| 22952 | # Refresh the list | ||
| 22953 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 22954 | |||
| 22955 | # Add buttons to open/close windows | ||
| 22956 | my $button = $self->addButton($grid, | ||
| 22957 | 'Open window', 'Open a task window for the selected task (if allowed)', undef, | ||
| 22958 | 1, 3, 10, 11); | ||
| 22959 | $button->signal_connect('clicked' => sub { | ||
| 22960 | |||
| 22961 | my ($task) = $self->getSimpleListData($slWidget, 0); | ||
| 22962 | if (defined $task) { | ||
| 22963 | |||
| 22964 | # Open a task window for this task | ||
| 22965 | $self->session->pseudoCmd( | ||
| 22966 | 'opentaskwindow ' . $task, | ||
| 22967 | $self->pseudoCmdMode, | ||
| 22968 | ); | ||
| 22969 | |||
| 22970 | # Refresh the simple list | ||
| 22971 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 22972 | } | ||
| 22973 | }); | ||
| 22974 | |||
| 22975 | my $button2 = $self->addButton($grid, | ||
| 22976 | 'Open all windows', 'Open task windows for all tasks (where possible)', undef, | ||
| 22977 | 3, 5, 10, 11); | ||
| 22978 | $button2->signal_connect('clicked' => sub { | ||
| 22979 | |||
| 22980 | # Open a task window for all tasks | ||
| 22981 | $self->session->pseudoCmd('opentaskwindow -a', $self->pseudoCmdMode); | ||
| 22982 | |||
| 22983 | # Refresh the simple list | ||
| 22984 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 22985 | }); | ||
| 22986 | |||
| 22987 | my $button3 = $self->addButton($grid, | ||
| 22988 | 'Close window', 'Closes the task window for the selected task (if open)', undef, | ||
| 22989 | 5, 7, 10, 11); | ||
| 22990 | $button3->signal_connect('clicked' => sub { | ||
| 22991 | |||
| 22992 | my ($task) = $self->getSimpleListData($slWidget, 0); | ||
| 22993 | if (defined $task) { | ||
| 22994 | |||
| 22995 | # Close the task window for this task | ||
| 22996 | $self->session->pseudoCmd( | ||
| 22997 | 'closetaskwindow ' . $task, | ||
| 22998 | $self->pseudoCmdMode, | ||
| 22999 | ); | ||
| 23000 | |||
| 23001 | # Refresh the simple list | ||
| 23002 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 23003 | } | ||
| 23004 | }); | ||
| 23005 | |||
| 23006 | my $button4 = $self->addButton($grid, | ||
| 23007 | 'Close all windows', 'Close task windows for all tasks (when open)', undef, | ||
| 23008 | 7, 9, 10, 11); | ||
| 23009 | $button4->signal_connect('clicked' => sub { | ||
| 23010 | |||
| 23011 | # Close the task window for all tasks | ||
| 23012 | $self->session->pseudoCmd('closetaskwindow -a', $self->pseudoCmdMode); | ||
| 23013 | |||
| 23014 | # Refresh the simple list | ||
| 23015 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 23016 | }); | ||
| 23017 | |||
| 23018 | my $button5 = $self->addButton($grid, | ||
| 23019 | 'Refresh list', 'Refresh the list of tasks and their task windows', undef, | ||
| 23020 | 10, 12, 10, 11); | ||
| 23021 | $button5->signal_connect('clicked' => sub { | ||
| 23022 | |||
| 23023 | # Refresh the simple list | ||
| 23024 | $self->tasksTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 23025 | }); | ||
| 23026 | |||
| 23027 | # Tab complete | ||
| 23028 | return 1; | ||
| 23029 | } | ||
| 23030 | |||
| 23031 | sub tasksTab_refreshList { | ||
| 23032 | |||
| 23033 | # Called by $self->tasksTab to refresh the GA::Obj::SimpleList | ||
| 23034 | # | ||
| 23035 | # Expected arguments | ||
| 23036 | # $slWidget - The GA::Obj::SimpleList | ||
| 23037 | # $columns - The number of columns in the list | ||
| 23038 | # | ||
| 23039 | # Return values | ||
| 23040 | # 'undef' on improper arguments | ||
| 23041 | # 1 otherwise | ||
| 23042 | |||
| 23043 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 23044 | |||
| 23045 | # Local variables | ||
| 23046 | my (@sortedList, @dataList); | ||
| 23047 | |||
| 23048 | # Check for improper arguments | ||
| 23049 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 23050 | |||
| 23051 | return $axmud::CLIENT->writeImproper($self->_objClass . '->tasksTab_refreshList', @_); | ||
| 23052 | } | ||
| 23053 | |||
| 23054 | # Get a sorted list of current tasks | ||
| 23055 | @sortedList = sort {lc($a->name) cmp lc($b->name)} | ||
| 23056 | ($self->session->ivValues('currentTaskHash')); | ||
| 23057 | |||
| 23058 | # Compile the simple list data | ||
| 23059 | foreach my $obj (@sortedList) { | ||
| 23060 | |||
| 23061 | push (@dataList, | ||
| 23062 | $obj->name, | ||
| 23063 | $obj->allowWinFlag, | ||
| 23064 | $obj->requireWinFlag, | ||
| 23065 | $obj->startWithWinFlag, | ||
| 23066 | $obj->taskWinFlag, | ||
| 23067 | join(' ', $obj->winPreferList), | ||
| 23068 | $obj->winmap, | ||
| 23069 | ); | ||
| 23070 | } | ||
| 23071 | |||
| 23072 | # Reset the simple list | ||
| 23073 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 23074 | |||
| 23075 | return 1; | ||
| 23076 | } | ||
| 23077 | |||
| 23078 | sub recordingTab { | ||
| 23079 | |||
| 23080 | # Recording tab | ||
| 23081 | # | ||
| 23082 | # Expected arguments | ||
| 23083 | # (none besides $self) | ||
| 23084 | # | ||
| 23085 | # Return values | ||
| 23086 | # 'undef' on improper arguments | ||
| 23087 | # 1 otherwise | ||
| 23088 | |||
| 23089 | my ($self, $check) = @_; | ||
| 23090 | |||
| 23091 | # Local variables | ||
| 23092 | my (@columnList, @widgetList); | ||
| 23093 | |||
| 23094 | # Check for improper arguments | ||
| 23095 | if (defined $check) { | ||
| 23096 | |||
| 23097 | return $axmud::CLIENT->writeImproper($self->_objClass . '->recordingTab', @_); | ||
| 23098 | } | ||
| 23099 | |||
| 23100 | # Tab setup | ||
| 23101 | my $grid = $self->addTab( | ||
| 23102 | $self->notebook, | ||
| 23103 | '_Recording', | ||
| 23104 | ['Current recording'], | ||
| 23105 | ); | ||
| 23106 | |||
| 23107 | # Current recording | ||
| 23108 | $self->addLabel($grid, '<b>Current recording</b>', | ||
| 23109 | 0, 12, 0, 1); | ||
| 23110 | |||
| 23111 | my $checkButton = $self->addCheckButton($grid, 'Recording in progress', undef, FALSE, | ||
| 23112 | 1, 6, 1, 2); | ||
| 23113 | my $checkButton2 = $self->addCheckButton($grid, 'Recording paused', undef, FALSE, | ||
| 23114 | 7, 12, 1, 2); | ||
| 23115 | |||
| 23116 | # (Other local variables required as arguments in calls to $self->recordingTab_refreshList) | ||
| 23117 | my ($entry, $entry2, $entry3, $entry4); | ||
| 23118 | |||
| 23119 | # Add a simple list | ||
| 23120 | @columnList = ( | ||
| 23121 | 'Line', 'text', # When no recording in progress, don't want '0' to appear in column | ||
| 23122 | 'Insert', 'text', | ||
| 23123 | 'Instruction', 'text', | ||
| 23124 | ); | ||
| 23125 | |||
| 23126 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 23127 | 1, 12, 2, 6); | ||
| 23128 | |||
| 23129 | # Add buttons to open/close windows | ||
| 23130 | $self->addLabel($grid, '<b>Commands:</b> ', | ||
| 23131 | 1, 3, 6, 7); | ||
| 23132 | $self->addLabel($grid, | ||
| 23133 | '<b>></b> <i>world command,</i> ' | ||
| 23134 | . '<b>;</b> <i>client command,</i> ' | ||
| 23135 | . '<b>#</b> <i>\'main\' window comment</i>', | ||
| 23136 | 3, 12, 6, 7); | ||
| 23137 | |||
| 23138 | $self->addLabel($grid, '<b>Breaks:</b> ', | ||
| 23139 | 1, 3, 7, 8); | ||
| 23140 | $self->addLabel($grid, | ||
| 23141 | '<b>@</b> <i>ordinary break,</i> ' | ||
| 23142 | . '<b>t</b> <i>trigger break,</i> ' | ||
| 23143 | . '<b>p</b> <i>pause break,</i> ' | ||
| 23144 | . '<b>l</b> <i>locator break</i>', | ||
| 23145 | 3, 12, 7, 8); | ||
| 23146 | |||
| 23147 | my $button = $self->addButton($grid, | ||
| 23148 | 'Start/stop', 'Starts or stops the current recording', undef, | ||
| 23149 | 1, 3, 8, 9); | ||
| 23150 | # (->signal_connect appears at the bottom) | ||
| 23151 | |||
| 23152 | my $button2 = $self->addButton($grid, | ||
| 23153 | 'Pause/resume', 'Pauses or resumes the current recording', undef, | ||
| 23154 | 3, 5, 8, 9); | ||
| 23155 | $button2->signal_connect('clicked' => sub { | ||
| 23156 | |||
| 23157 | # Pause/resume the recording | ||
| 23158 | $self->session->pseudoCmd('pauserecording', $self->pseudoCmdMode); | ||
| 23159 | |||
| 23160 | # Refresh the simple list and reset widgets | ||
| 23161 | $self->recordingTab_refreshList( | ||
| 23162 | $slWidget, | ||
| 23163 | scalar (@columnList / 2), | ||
| 23164 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23165 | ); | ||
| 23166 | }); | ||
| 23167 | |||
| 23168 | my $button3 = $self->addButton($grid, | ||
| 23169 | 'Add as mission', 'Save this recording as a new mission', undef, | ||
| 23170 | 7, 10, 8, 9); | ||
| 23171 | $button3->signal_connect('clicked' => sub { | ||
| 23172 | |||
| 23173 | my ($name, $descrip); | ||
| 23174 | |||
| 23175 | if ($self->session->recordingList) { | ||
| 23176 | |||
| 23177 | # Prompt the user for a mission name (and optional description) | ||
| 23178 | ($name, $descrip) = $self->showDoubleEntryDialogue( | ||
| 23179 | 'Add mission', | ||
| 23180 | 'Add a name for the mission', | ||
| 23181 | '(Optional) add a description', | ||
| 23182 | ); | ||
| 23183 | |||
| 23184 | # Add the mission | ||
| 23185 | if ($name && $descrip) { | ||
| 23186 | |||
| 23187 | $self->session->pseudoCmd( | ||
| 23188 | 'add mission <' . $name . '> <' . $descrip . '>', | ||
| 23189 | $self->pseudoCmdMode, | ||
| 23190 | ); | ||
| 23191 | |||
| 23192 | } elsif ($name) { | ||
| 23193 | |||
| 23194 | $self->session->pseudoCmd('add mission <' . $name . '>', $self->pseudoCmdMode); | ||
| 23195 | } | ||
| 23196 | } | ||
| 23197 | |||
| 23198 | # Refresh the simple list and reset widgets | ||
| 23199 | $self->recordingTab_refreshList( | ||
| 23200 | $slWidget, | ||
| 23201 | scalar (@columnList / 2), | ||
| 23202 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23203 | ); | ||
| 23204 | }); | ||
| 23205 | |||
| 23206 | my $button4 = $self->addButton($grid, | ||
| 23207 | 'Update list', 'Update the recording list', undef, | ||
| 23208 | 10, 12, 8, 9); | ||
| 23209 | $button4->signal_connect('clicked' => sub { | ||
| 23210 | |||
| 23211 | # Refresh the simple list and reset widgets | ||
| 23212 | $self->recordingTab_refreshList( | ||
| 23213 | $slWidget, | ||
| 23214 | scalar (@columnList / 2), | ||
| 23215 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23216 | ); | ||
| 23217 | }); | ||
| 23218 | |||
| 23219 | $self->addLabel($grid, 'Instruction:', | ||
| 23220 | 1, 3, 9, 10); | ||
| 23221 | $entry = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 23222 | 3, 6, 9, 10); | ||
| 23223 | |||
| 23224 | my $button5 = $self->addButton($grid, | ||
| 23225 | 'World cmd', 'Add a world command at the insertion point', undef, | ||
| 23226 | 6, 8, 9, 10); | ||
| 23227 | $button5->signal_connect('clicked' => sub { | ||
| 23228 | |||
| 23229 | if ($self->checkEntryIcon($entry)) { | ||
| 23230 | |||
| 23231 | # Add the world command | ||
| 23232 | $self->session->pseudoCmd( | ||
| 23233 | 'worldcommand ' . $entry->get_text(), | ||
| 23234 | $self->pseudoCmdMode, | ||
| 23235 | ); | ||
| 23236 | |||
| 23237 | # Refresh the simple list and reset widgets | ||
| 23238 | $self->recordingTab_refreshList( | ||
| 23239 | $slWidget, | ||
| 23240 | scalar (@columnList / 2), | ||
| 23241 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23242 | ); | ||
| 23243 | } | ||
| 23244 | }); | ||
| 23245 | |||
| 23246 | my $button6 = $self->addButton($grid, | ||
| 23247 | 'Client cmd', 'Add a client command at the insertion point', undef, | ||
| 23248 | 8, 10, 9, 10); | ||
| 23249 | $button6->signal_connect('clicked' => sub { | ||
| 23250 | |||
| 23251 | if ($self->checkEntryIcon($entry)) { | ||
| 23252 | |||
| 23253 | # Add the client command | ||
| 23254 | $self->session->pseudoCmd( | ||
| 23255 | 'clientcommand ' . $entry->get_text(), | ||
| 23256 | $self->pseudoCmdMode, | ||
| 23257 | ); | ||
| 23258 | |||
| 23259 | # Refresh the simple list and reset widgets | ||
| 23260 | $self->recordingTab_refreshList( | ||
| 23261 | $slWidget, | ||
| 23262 | scalar (@columnList / 2), | ||
| 23263 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23264 | ); | ||
| 23265 | } | ||
| 23266 | }); | ||
| 23267 | |||
| 23268 | my $button7 = $self->addButton($grid, | ||
| 23269 | 'Comment', 'Add a \'main\' window comment at the insertion point', undef, | ||
| 23270 | 10, 12, 9, 10); | ||
| 23271 | $button7->signal_connect('clicked' => sub { | ||
| 23272 | |||
| 23273 | if ($self->checkEntryIcon($entry)) { | ||
| 23274 | |||
| 23275 | # Add the client command | ||
| 23276 | $self->session->pseudoCmd( | ||
| 23277 | 'clientcommand ' . $entry->get_text(), | ||
| 23278 | $self->pseudoCmdMode, | ||
| 23279 | ); | ||
| 23280 | |||
| 23281 | # Refresh the simple list and reset widgets | ||
| 23282 | $self->recordingTab_refreshList( | ||
| 23283 | $slWidget, | ||
| 23284 | scalar (@columnList / 2), | ||
| 23285 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23286 | ); | ||
| 23287 | } | ||
| 23288 | }); | ||
| 23289 | |||
| 23290 | $self->addLabel($grid, 'Pattern/interval:', | ||
| 23291 | 1, 3, 10, 11); | ||
| 23292 | $entry2 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef, | ||
| 23293 | 3, 5, 10, 11); | ||
| 23294 | |||
| 23295 | my $button8 = $self->addButton($grid, | ||
| 23296 | 'Break', | ||
| 23297 | 'Add an ordinary break at the insertion point', | ||
| 23298 | undef, | ||
| 23299 | 5, 6, 10, 11); | ||
| 23300 | $button8->signal_connect('clicked' => sub { | ||
| 23301 | |||
| 23302 | # Add the ordinary break | ||
| 23303 | $self->session->pseudoCmd('break', $self->pseudoCmdMode); | ||
| 23304 | |||
| 23305 | # Refresh the simple list and reset widgets | ||
| 23306 | $self->recordingTab_refreshList( | ||
| 23307 | $slWidget, | ||
| 23308 | scalar (@columnList / 2), | ||
| 23309 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23310 | ); | ||
| 23311 | }); | ||
| 23312 | |||
| 23313 | my $button9 = $self->addButton($grid, | ||
| 23314 | 'Trigger break', | ||
| 23315 | 'Add a trigger break at the insertion point, using the specified pattern', | ||
| 23316 | undef, | ||
| 23317 | 6, 8, 10, 11); | ||
| 23318 | $button9->signal_connect('clicked' => sub { | ||
| 23319 | |||
| 23320 | if ($self->checkEntryIcon($entry2)) { | ||
| 23321 | |||
| 23322 | # Add the client command | ||
| 23323 | $self->session->pseudoCmd( | ||
| 23324 | 'break -t ' . $entry2->get_text(), | ||
| 23325 | $self->pseudoCmdMode, | ||
| 23326 | ); | ||
| 23327 | |||
| 23328 | # Refresh the simple list and reset widgets | ||
| 23329 | $self->recordingTab_refreshList( | ||
| 23330 | $slWidget, | ||
| 23331 | scalar (@columnList / 2), | ||
| 23332 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23333 | ); | ||
| 23334 | } | ||
| 23335 | }); | ||
| 23336 | |||
| 23337 | my $button10 = $self->addButton($grid, | ||
| 23338 | 'Pause break', | ||
| 23339 | 'Add a pause break at the insertion point, using the specified interval', | ||
| 23340 | undef, | ||
| 23341 | 8, 10, 10, 11); | ||
| 23342 | $button10->signal_connect('clicked' => sub { | ||
| 23343 | |||
| 23344 | if ($self->checkEntryIcon($entry2)) { | ||
| 23345 | |||
| 23346 | # Add the trigger break | ||
| 23347 | $self->session->pseudoCmd( | ||
| 23348 | 'break -p ' . $entry2->get_text(), | ||
| 23349 | $self->pseudoCmdMode, | ||
| 23350 | ); | ||
| 23351 | |||
| 23352 | # Refresh the simple list and reset widgets | ||
| 23353 | $self->recordingTab_refreshList( | ||
| 23354 | $slWidget, | ||
| 23355 | scalar (@columnList / 2), | ||
| 23356 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23357 | ); | ||
| 23358 | } | ||
| 23359 | }); | ||
| 23360 | |||
| 23361 | my $button11 = $self->addButton($grid, | ||
| 23362 | 'Locator break', | ||
| 23363 | 'Add a pause break at the insertion point, using the specified interval', | ||
| 23364 | undef, | ||
| 23365 | 10, 12, 10, 11); | ||
| 23366 | $button11->signal_connect('clicked' => sub { | ||
| 23367 | |||
| 23368 | # Add the locator break | ||
| 23369 | $self->session->pseudoCmd('break -l', $self->pseudoCmdMode); | ||
| 23370 | |||
| 23371 | # Refresh the simple list and reset widgets | ||
| 23372 | $self->recordingTab_refreshList( | ||
| 23373 | $slWidget, | ||
| 23374 | scalar (@columnList / 2), | ||
| 23375 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23376 | ); | ||
| 23377 | }); | ||
| 23378 | |||
| 23379 | $self->addLabel($grid, 'Insertion point:', | ||
| 23380 | 1, 3, 11, 12); | ||
| 23381 | $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef, | ||
| 23382 | 3, 5, 11, 12); | ||
| 23383 | |||
| 23384 | my $button12 = $self->addButton($grid, | ||
| 23385 | 'Set', | ||
| 23386 | 'Sets the insertion point (use 0 to move it to the end)', | ||
| 23387 | undef, | ||
| 23388 | 5, 6, 11, 12); | ||
| 23389 | $button12->signal_connect('clicked' => sub { | ||
| 23390 | |||
| 23391 | if ($self->checkEntryIcon($entry3)) { | ||
| 23392 | |||
| 23393 | # Set the insertion point | ||
| 23394 | $self->session->pseudoCmd( | ||
| 23395 | 'insertrecording ' . $entry3->get_text(), | ||
| 23396 | $self->pseudoCmdMode, | ||
| 23397 | ); | ||
| 23398 | |||
| 23399 | # Refresh the simple list and reset widgets | ||
| 23400 | $self->recordingTab_refreshList( | ||
| 23401 | $slWidget, | ||
| 23402 | scalar (@columnList / 2), | ||
| 23403 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23404 | ); | ||
| 23405 | } | ||
| 23406 | }); | ||
| 23407 | |||
| 23408 | my $button13 = $self->addButton($grid, | ||
| 23409 | 'Reset', | ||
| 23410 | 'Moves the insertion point to the end', | ||
| 23411 | undef, | ||
| 23412 | 6, 8, 11, 12); | ||
| 23413 | $button13->signal_connect('clicked' => sub { | ||
| 23414 | |||
| 23415 | # Move the insertion point to the end | ||
| 23416 | $self->session->pseudoCmd('insertrecording', $self->pseudoCmdMode); | ||
| 23417 | |||
| 23418 | # Refresh the simple list and reset widgets | ||
| 23419 | $self->recordingTab_refreshList( | ||
| 23420 | $slWidget, | ||
| 23421 | scalar (@columnList / 2), | ||
| 23422 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23423 | ); | ||
| 23424 | }); | ||
| 23425 | |||
| 23426 | my $button14 = $self->addButton($grid, | ||
| 23427 | 'Delete selected line', | ||
| 23428 | 'Deletes the selected line', | ||
| 23429 | undef, | ||
| 23430 | 8, 12, 11, 12); | ||
| 23431 | $button14->signal_connect('clicked' => sub { | ||
| 23432 | |||
| 23433 | my ($number) = $self->getSimpleListData($slWidget, 0); | ||
| 23434 | if (defined $number) { | ||
| 23435 | |||
| 23436 | # Delete the selected line | ||
| 23437 | $self->session->pseudoCmd('deleterecording ' . $number, $self->pseudoCmdMode); | ||
| 23438 | |||
| 23439 | # Refresh the simple list and reset widgets | ||
| 23440 | $self->recordingTab_refreshList( | ||
| 23441 | $slWidget, | ||
| 23442 | scalar (@columnList / 2), | ||
| 23443 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23444 | ); | ||
| 23445 | } | ||
| 23446 | }); | ||
| 23447 | |||
| 23448 | # Now we can initialise the list | ||
| 23449 | $self->recordingTab_refreshList( | ||
| 23450 | $slWidget, | ||
| 23451 | scalar (@columnList / 2), | ||
| 23452 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23453 | ); | ||
| 23454 | |||
| 23455 | # If there is no recording in progress, many widgets begin desensitised | ||
| 23456 | @widgetList = ( | ||
| 23457 | $button2, $button5, $button6, $button7, $button8, $button9, $button10, $button11, | ||
| 23458 | $button12, $button13, $button14, $entry, $entry2, $entry3, | ||
| 23459 | ); | ||
| 23460 | |||
| 23461 | if (! $self->session->recordingFlag) { | ||
| 23462 | |||
| 23463 | $self->desensitiseWidgets(@widgetList); | ||
| 23464 | } | ||
| 23465 | |||
| 23466 | # Finally, add a ->signal_connect for the 'Start/stop' button | ||
| 23467 | $button->signal_connect('clicked' => sub { | ||
| 23468 | |||
| 23469 | # Start/stop the recording | ||
| 23470 | $self->session->pseudoCmd('record', $self->pseudoCmdMode); | ||
| 23471 | |||
| 23472 | # When there is no recording in progress, most buttons are desensitised | ||
| 23473 | if ($self->session->recordingFlag) { | ||
| 23474 | $self->sensitiseWidgets(@widgetList); | ||
| 23475 | } else { | ||
| 23476 | $self->desensitiseWidgets(@widgetList); | ||
| 23477 | } | ||
| 23478 | |||
| 23479 | # Refresh the simple list and reset widgets | ||
| 23480 | $self->recordingTab_refreshList( | ||
| 23481 | $slWidget, | ||
| 23482 | scalar (@columnList / 2), | ||
| 23483 | $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23484 | ); | ||
| 23485 | }); | ||
| 23486 | |||
| 23487 | # Tab complete | ||
| 23488 | return 1; | ||
| 23489 | } | ||
| 23490 | |||
| 23491 | sub recordingTab_refreshList { | ||
| 23492 | |||
| 23493 | # Called by $self->recordingTab to refresh the GA::Obj::SimpleList | ||
| 23494 | # | ||
| 23495 | # Expected arguments | ||
| 23496 | # $slWidget - The GA::Obj::SimpleList | ||
| 23497 | # $columns - The number of columns in the list | ||
| 23498 | # $checkButton, $checkButton2, $entry, $entry2, $entry3 | ||
| 23499 | # - Widgets which must be updated at the same time as the simple list | ||
| 23500 | # | ||
| 23501 | # Return values | ||
| 23502 | # 'undef' on improper arguments | ||
| 23503 | # 1 otherwise | ||
| 23504 | |||
| 23505 | my ( | ||
| 23506 | $self, $slWidget, $columns, $checkButton, $checkButton2, $entry, $entry2, $entry3, | ||
| 23507 | $check | ||
| 23508 | ) = @_; | ||
| 23509 | |||
| 23510 | # Local variables | ||
| 23511 | my (@list, @dataList); | ||
| 23512 | |||
| 23513 | # Check for improper arguments | ||
| 23514 | if ( | ||
| 23515 | ! defined $slWidget || ! defined $columns || ! defined $checkButton | ||
| 23516 | || ! defined $checkButton2 || ! defined $entry || ! defined $entry2 || ! defined $entry3 | ||
| 23517 | || defined $check | ||
| 23518 | ) { | ||
| 23519 | return $axmud::CLIENT->writeImproper( | ||
| 23520 | $self->_objClass . '->recordingTab_refreshList', | ||
| 23521 | @_, | ||
| 23522 | ); | ||
| 23523 | } | ||
| 23524 | |||
| 23525 | # Import the recording list | ||
| 23526 | @list = $self->session->recordingList; | ||
| 23527 | if (@list) { | ||
| 23528 | |||
| 23529 | # Compile the simple list data | ||
| 23530 | for (my $count = 0; $count < (scalar @list); $count++) { | ||
| 23531 | |||
| 23532 | my $flag; | ||
| 23533 | |||
| 23534 | # (If ->recordingPosn is 'undef', new lines are just added to the end of the list) | ||
| 23535 | if ($self->session->recordingPosn && $count == $self->session->recordingPosn) { | ||
| 23536 | $flag = '>>>'; | ||
| 23537 | } else { | ||
| 23538 | $flag = ''; | ||
| 23539 | } | ||
| 23540 | |||
| 23541 | push (@dataList, ($count + 1), $flag, $list[$count]); | ||
| 23542 | } | ||
| 23543 | } | ||
| 23544 | |||
| 23545 | # If ->recordingPosn is 'undef', add a blank line to the end of the simple list | ||
| 23546 | if (! $self->session->recordingPosn) { | ||
| 23547 | |||
| 23548 | push (@dataList, '', '>>>', ''); | ||
| 23549 | } | ||
| 23550 | |||
| 23551 | # Reset the simple list | ||
| 23552 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 23553 | |||
| 23554 | # Update other widgets | ||
| 23555 | $checkButton->set_active($self->session->recordingFlag); | ||
| 23556 | $checkButton2->set_active($self->session->recordingPausedFlag); | ||
| 23557 | $self->resetEntryBoxes($entry, $entry2, $entry3); | ||
| 23558 | |||
| 23559 | return 1; | ||
| 23560 | } | ||
| 23561 | |||
| 23562 | sub protocolsTab { | ||
| 23563 | |||
| 23564 | # Protocols tab - called by $self->setupNotebook | ||
| 23565 | # | ||
| 23566 | # Expected arguments | ||
| 23567 | # (none besides $self) | ||
| 23568 | # | ||
| 23569 | # Return values | ||
| 23570 | # 'undef' on improper arguments | ||
| 23571 | # 1 otherwise | ||
| 23572 | |||
| 23573 | my ($self, $check) = @_; | ||
| 23574 | |||
| 23575 | # Check for improper arguments | ||
| 23576 | if (defined $check) { | ||
| 23577 | |||
| 23578 | return $axmud::CLIENT->writeImproper($self->_objClass . '->protocolsTab', @_); | ||
| 23579 | } | ||
| 23580 | |||
| 23581 | # Tab setup | ||
| 23582 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 23583 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Protocols'); | ||
| 23584 | |||
| 23585 | # Add tabs to the inner notebook | ||
| 23586 | $self->protocols1Tab($innerNotebook); | ||
| 23587 | $self->protocols2Tab($innerNotebook); | ||
| 23588 | $self->protocols3Tab($innerNotebook); | ||
| 23589 | |||
| 23590 | return 1; | ||
| 23591 | } | ||
| 23592 | |||
| 23593 | sub protocols1Tab { | ||
| 23594 | |||
| 23595 | # Protocols1 tab | ||
| 23596 | # | ||
| 23597 | # Expected arguments | ||
| 23598 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 23599 | # | ||
| 23600 | # Return values | ||
| 23601 | # 'undef' on improper arguments | ||
| 23602 | # 1 otherwise | ||
| 23603 | |||
| 23604 | my ($self, $innerNotebook, $check) = @_; | ||
| 23605 | |||
| 23606 | # Check for improper arguments | ||
| 23607 | if (! defined $innerNotebook || defined $check) { | ||
| 23608 | |||
| 23609 | return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols1Tab', @_); | ||
| 23610 | } | ||
| 23611 | |||
| 23612 | # Tab setup | ||
| 23613 | my $grid = $self->addTab( | ||
| 23614 | $innerNotebook, | ||
| 23615 | 'Page _1', | ||
| 23616 | ['Telnet option negotiations'], | ||
| 23617 | ); | ||
| 23618 | |||
| 23619 | # Telnet option negotiations | ||
| 23620 | $self->addLabel($grid, '<b>Telnet option negotiations</b>', | ||
| 23621 | 0, 12, 0, 1); | ||
| 23622 | $self->addLabel( | ||
| 23623 | $grid, | ||
| 23624 | '<i>Current status of telnet options for this session (checkbutton selected if protocol' | ||
| 23625 | . ' is enabled generally)</i>', | ||
| 23626 | 1, 12, 1, 2); | ||
| 23627 | |||
| 23628 | my $checkButton = $self->addCheckButton($grid, 'ECHO (hide passwords)', undef, FALSE, | ||
| 23629 | 1, 3, 2, 3); | ||
| 23630 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 23631 | 3, 12, 2, 3); | ||
| 23632 | |||
| 23633 | my $checkButton2 = $self->addCheckButton($grid, 'SGA (Suppress Go Ahead)', undef, FALSE, | ||
| 23634 | 1, 3, 3, 4); | ||
| 23635 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 23636 | 3, 12, 3, 4); | ||
| 23637 | |||
| 23638 | my $checkButton3 = $self->addCheckButton( | ||
| 23639 | $grid, 'TTYPE (detect Terminal Type)', undef, FALSE, | ||
| 23640 | 1, 3, 4, 5); | ||
| 23641 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 23642 | 3, 12, 4, 5); | ||
| 23643 | |||
| 23644 | my $checkButton4 = $self->addCheckButton( | ||
| 23645 | $grid, 'EOR (negotiate End Of Record)', undef, FALSE, | ||
| 23646 | 1, 3, 5, 6); | ||
| 23647 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 23648 | 3, 12, 5, 6); | ||
| 23649 | |||
| 23650 | my $checkButton5 = $self->addCheckButton( | ||
| 23651 | $grid, 'NAWS (Negotiate About Window Size)', undef, FALSE, | ||
| 23652 | 1, 3, 6, 7); | ||
| 23653 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 23654 | 3, 12, 6, 7); | ||
| 23655 | |||
| 23656 | my $checkButton6 = $self->addCheckButton( | ||
| 23657 | $grid, 'NEW-ENVIRON (New Environment option)', undef, FALSE, | ||
| 23658 | 1, 3, 7, 8); | ||
| 23659 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 23660 | 3, 12, 7, 8); | ||
| 23661 | |||
| 23662 | my $checkButton7 = $self->addCheckButton( | ||
| 23663 | $grid, 'CHARSET (Character Set and translation)', undef, FALSE, | ||
| 23664 | 1, 3, 8, 9); | ||
| 23665 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 23666 | 3, 12, 8, 9); | ||
| 23667 | |||
| 23668 | $self->protocols1Tab_updateWidgets( | ||
| 23669 | $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton, | ||
| 23670 | $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23671 | $checkButton7, | ||
| 23672 | ); | ||
| 23673 | |||
| 23674 | my $button = $self->addButton($grid, 'Update', 'Update the telnet options shown', undef, | ||
| 23675 | 10, 12, 9, 10); | ||
| 23676 | $button->signal_connect('clicked' => sub { | ||
| 23677 | |||
| 23678 | $self->protocols1Tab_updateWidgets( | ||
| 23679 | $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton, | ||
| 23680 | $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23681 | $checkButton7, | ||
| 23682 | ); | ||
| 23683 | }); | ||
| 23684 | |||
| 23685 | # Tab complete | ||
| 23686 | return 1; | ||
| 23687 | } | ||
| 23688 | |||
| 23689 | sub protocols1Tab_updateWidgets { | ||
| 23690 | |||
| 23691 | # Called by $self->optionsTab to update the Gtk3::Entry boxes | ||
| 23692 | # | ||
| 23693 | # Expected arguments | ||
| 23694 | # $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7 | ||
| 23695 | # - List of Gtk3::Entry boxes to update | ||
| 23696 | # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23697 | # $checkButton7 | ||
| 23698 | # - List of Gtk3::CheckButtons to update | ||
| 23699 | |||
| 23700 | # | ||
| 23701 | # Return values | ||
| 23702 | # 'undef' on improper arguments | ||
| 23703 | # 1 otherwise | ||
| 23704 | |||
| 23705 | my ( | ||
| 23706 | $self, $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $checkButton, | ||
| 23707 | $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23708 | $checkButton7, $check, | ||
| 23709 | ) = @_; | ||
| 23710 | |||
| 23711 | # Check for improper arguments | ||
| 23712 | if ( | ||
| 23713 | ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4 | ||
| 23714 | || ! defined $entry5 || ! defined $entry6 || ! defined $entry7 || ! defined $checkButton | ||
| 23715 | || ! defined $checkButton2 || ! defined $checkButton3 || ! defined $checkButton4 | ||
| 23716 | || ! defined $checkButton5 || ! defined $checkButton6 || ! defined $checkButton7 | ||
| 23717 | || defined $check | ||
| 23718 | ) { | ||
| 23719 | return $axmud::CLIENT->writeImproper( | ||
| 23720 | $self->_objClass . '->protocols1Tab_updateWidgets', | ||
| 23721 | @_, | ||
| 23722 | ); | ||
| 23723 | } | ||
| 23724 | |||
| 23725 | if ($self->session->echoMode eq 'no_invite') { | ||
| 23726 | $entry->set_text('Server has not suggested stopping ECHO yet'); | ||
| 23727 | } elsif ($self->session->echoMode eq 'client_agree') { | ||
| 23728 | $entry->set_text('Server has suggested stopping ECHO and client has agreed'); | ||
| 23729 | } elsif ($self->session->echoMode eq 'client_refuse') { | ||
| 23730 | $entry->set_text('Server has suggested stopping ECHO and client has refused'); | ||
| 23731 | } elsif ($self->session->echoMode eq 'server_stop') { | ||
| 23732 | $entry->set_text('Server has resumed ECHO and client has agreeed'); | ||
| 23733 | } | ||
| 23734 | |||
| 23735 | if ($self->session->sgaMode eq 'no_invite') { | ||
| 23736 | $entry2->set_text('Server has not suggested SGA yet'); | ||
| 23737 | } elsif ($self->session->sgaMode eq 'client_agree') { | ||
| 23738 | $entry2->set_text('Server has suggested SGA and client has agreed'); | ||
| 23739 | } elsif ($self->session->sgaMode eq 'client_refuse') { | ||
| 23740 | $entry2->set_text('Server has suggested SGA and client has refused'); | ||
| 23741 | } elsif ($self->session->sgaMode eq 'server_stop') { | ||
| 23742 | $entry3->set_text('Server has stopped SGA and client has agreeed'); | ||
| 23743 | } | ||
| 23744 | |||
| 23745 | if ($self->session->specifiedTType) { | ||
| 23746 | $entry3->set_text('Preferred terminal: ' . $self->session->specifiedTType); | ||
| 23747 | } else { | ||
| 23748 | $entry3->set_text('Preferred terminal: (not sent)'); | ||
| 23749 | } | ||
| 23750 | |||
| 23751 | if ($self->session->eorMode eq 'no_invite') { | ||
| 23752 | $entry4->set_text('Server has not negotiated EOR yet'); | ||
| 23753 | } elsif ($self->session->eorMode eq 'client_agree') { | ||
| 23754 | $entry4->set_text('Server has suggested EOR negotiation and client has agreed'); | ||
| 23755 | } elsif ($self->session->eorMode eq 'client_refuse') { | ||
| 23756 | $entry4->set_text('Server has suggested EOR negotiation and client has refused'); | ||
| 23757 | } | ||
| 23758 | |||
| 23759 | if ($self->session->nawsMode eq 'no_invite') { | ||
| 23760 | $entry5->set_text('Server has not suggested NAWS yet'); | ||
| 23761 | } elsif ($self->session->nawsMode eq 'client_agree') { | ||
| 23762 | $entry5->set_text('Server has suggested NAWS and client has agreed'); | ||
| 23763 | } elsif ($self->session->nawsMode eq 'client_refuse') { | ||
| 23764 | $entry5->set_text('Server has suggested NAWS and client has refused'); | ||
| 23765 | } | ||
| 23766 | |||
| 23767 | if ($self->session->nawsMode eq 'no_invite') { | ||
| 23768 | $entry6->set_text('Server has not suggested NEW-ENVIRON yet'); | ||
| 23769 | } elsif ($self->session->nawsMode eq 'client_agree') { | ||
| 23770 | $entry6->set_text('Server has suggested NEW-ENVIRON and client has agreed'); | ||
| 23771 | } elsif ($self->session->nawsMode eq 'client_refuse') { | ||
| 23772 | $entry6->set_text('Server has suggested NEW-ENVIRON and client has refused'); | ||
| 23773 | } | ||
| 23774 | |||
| 23775 | if ($self->session->nawsMode eq 'no_invite') { | ||
| 23776 | $entry7->set_text('Server has not suggested CHARSET yet'); | ||
| 23777 | } elsif ($self->session->nawsMode eq 'client_agree') { | ||
| 23778 | $entry7->set_text('Server has suggested CHARSET and client has agreed'); | ||
| 23779 | } elsif ($self->session->nawsMode eq 'client_refuse') { | ||
| 23780 | $entry7->set_text('Server has suggested CHARSET and client has refused'); | ||
| 23781 | } | ||
| 23782 | |||
| 23783 | $checkButton->set_active($axmud::CLIENT->useEchoFlag); | ||
| 23784 | $checkButton2->set_active($axmud::CLIENT->useSgaFlag); | ||
| 23785 | $checkButton3->set_active($axmud::CLIENT->useTTypeFlag); | ||
| 23786 | $checkButton4->set_active($axmud::CLIENT->useEorFlag); | ||
| 23787 | $checkButton5->set_active($axmud::CLIENT->useNawsFlag); | ||
| 23788 | $checkButton6->set_active($axmud::CLIENT->useNewEnvironFlag); | ||
| 23789 | $checkButton7->set_active($axmud::CLIENT->useCharSetFlag); | ||
| 23790 | |||
| 23791 | return 1; | ||
| 23792 | } | ||
| 23793 | |||
| 23794 | sub protocols2Tab { | ||
| 23795 | |||
| 23796 | # Protocols2 tab | ||
| 23797 | # | ||
| 23798 | # Expected arguments | ||
| 23799 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 23800 | # | ||
| 23801 | # Return values | ||
| 23802 | # 'undef' on improper arguments | ||
| 23803 | # 1 otherwise | ||
| 23804 | |||
| 23805 | my ($self, $innerNotebook, $check) = @_; | ||
| 23806 | |||
| 23807 | # Check for improper arguments | ||
| 23808 | if (! defined $innerNotebook || defined $check) { | ||
| 23809 | |||
| 23810 | return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols2Tab', @_); | ||
| 23811 | } | ||
| 23812 | |||
| 23813 | # Tab setup | ||
| 23814 | my $grid = $self->addTab( | ||
| 23815 | $innerNotebook, | ||
| 23816 | 'Page _2', | ||
| 23817 | ['MUD protocol negotiations (1/2)'], | ||
| 23818 | ); | ||
| 23819 | |||
| 23820 | # MUD Protocol negotiations (1/2) | ||
| 23821 | $self->addLabel($grid, '<b>MUD protocol negotiations (1/2)</b>', | ||
| 23822 | 0, 12, 0, 1); | ||
| 23823 | $self->addLabel($grid, '<i>Current status of MUD protocols for this session</i>', | ||
| 23824 | 1, 12, 1, 2); | ||
| 23825 | |||
| 23826 | my $checkButton = $self->addCheckButton( | ||
| 23827 | $grid, 'MSDP (Mud Server Data Protocol)', undef, FALSE, | ||
| 23828 | 1, 3, 2, 3); | ||
| 23829 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 23830 | 3, 12, 2, 3); | ||
| 23831 | |||
| 23832 | my $checkButton2 = $self->addCheckButton( | ||
| 23833 | $grid, 'MSSP (Mud Server Status Protocol)', undef, FALSE, | ||
| 23834 | 1, 3, 3, 4); | ||
| 23835 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 23836 | 3, 12, 3, 4); | ||
| 23837 | |||
| 23838 | my $checkButton3 = $self->addCheckButton( | ||
| 23839 | $grid, 'MCCP (Mud Client Compression Protocol)', undef, FALSE, | ||
| 23840 | 1, 3, 4, 5); | ||
| 23841 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 23842 | 3, 12, 4, 5); | ||
| 23843 | |||
| 23844 | my $checkButton4 = $self->addCheckButton($grid, 'MSP (Mud Sound Protocol)', undef, FALSE, | ||
| 23845 | 1, 3, 5, 6); | ||
| 23846 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 23847 | 3, 12, 5, 6); | ||
| 23848 | |||
| 23849 | my $checkButton5 = $self->addCheckButton( | ||
| 23850 | $grid, 'MXP (Mud Xtension Protocol)', undef, FALSE, | ||
| 23851 | 1, 3, 6, 7); | ||
| 23852 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 23853 | 3, 12, 6, 7); | ||
| 23854 | |||
| 23855 | my $checkButton6 = $self->addCheckButton($grid, 'PUEBLO', undef, FALSE, | ||
| 23856 | 1, 3, 7, 8); | ||
| 23857 | my $entry6 = $self->addEntry($grid, undef, FALSE, | ||
| 23858 | 3, 12, 7, 8); | ||
| 23859 | |||
| 23860 | my $checkButton7 = $self->addCheckButton($grid, 'ZMP (Zenith Mud Protocol)', undef, FALSE, | ||
| 23861 | 1, 3, 8, 9); | ||
| 23862 | my $entry7 = $self->addEntry($grid, undef, FALSE, | ||
| 23863 | 3, 12, 8, 9); | ||
| 23864 | |||
| 23865 | my $checkButton8 = $self->addCheckButton( | ||
| 23866 | $grid, 'AARD102 (Aardwolf 102 channel)', undef, FALSE, | ||
| 23867 | 1, 3, 9, 10); | ||
| 23868 | my $entry8 = $self->addEntry($grid, undef, FALSE, | ||
| 23869 | 3, 12, 9, 10); | ||
| 23870 | |||
| 23871 | $self->protocolsTab2_updateWidgets( | ||
| 23872 | $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8, $checkButton, | ||
| 23873 | $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23874 | $checkButton7, $checkButton8, | ||
| 23875 | ); | ||
| 23876 | |||
| 23877 | my $button = $self->addButton($grid, 'Update', 'Update the MUD protocols shown', undef, | ||
| 23878 | 10, 12, 10, 11); | ||
| 23879 | $button->signal_connect('clicked' => sub { | ||
| 23880 | |||
| 23881 | $self->protocolsTab2_updateWidgets( | ||
| 23882 | $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8, $checkButton, | ||
| 23883 | $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23884 | $checkButton7, $checkButton8, | ||
| 23885 | ); | ||
| 23886 | }); | ||
| 23887 | |||
| 23888 | # Tab complete | ||
| 23889 | return 1; | ||
| 23890 | } | ||
| 23891 | |||
| 23892 | sub protocolsTab2_updateWidgets { | ||
| 23893 | |||
| 23894 | # Called by $self->protocolsTab2 to update the Gtk3::Entry boxes | ||
| 23895 | # | ||
| 23896 | # Expected arguments | ||
| 23897 | # $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8 | ||
| 23898 | # - List of Gtk3::Entry boxes to update | ||
| 23899 | # $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, | ||
| 23900 | # $checkButton6, $checkButton7, $checkButton8 | ||
| 23901 | # - List of Gtk3::CheckButtons to update | ||
| 23902 | # | ||
| 23903 | # Return values | ||
| 23904 | # 'undef' on improper arguments | ||
| 23905 | # 1 otherwise | ||
| 23906 | |||
| 23907 | my ( | ||
| 23908 | $self, $entry, $entry2, $entry3, $entry4, $entry5, $entry6, $entry7, $entry8, | ||
| 23909 | $checkButton, $checkButton2, $checkButton3, $checkButton4, $checkButton5, $checkButton6, | ||
| 23910 | $checkButton7, $checkButton8, $check, | ||
| 23911 | ) = @_; | ||
| 23912 | |||
| 23913 | # Check for improper arguments | ||
| 23914 | if ( | ||
| 23915 | ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4 | ||
| 23916 | || ! defined $entry5 || ! defined $entry6 || ! defined $entry7 || ! defined $entry8 | ||
| 23917 | || ! defined $checkButton || ! defined $checkButton2 || ! defined $checkButton3 | ||
| 23918 | || ! defined $checkButton4 || ! defined $checkButton5 || ! defined $checkButton6 | ||
| 23919 | || ! defined $checkButton7 || ! defined $checkButton8 || defined $check | ||
| 23920 | ) { | ||
| 23921 | return $axmud::CLIENT->writeImproper( | ||
| 23922 | $self->_objClass . '->protocolsTab2_updateWidgets', | ||
| 23923 | @_, | ||
| 23924 | ); | ||
| 23925 | } | ||
| 23926 | |||
| 23927 | if ($self->session->msdpMode eq 'no_invite') { | ||
| 23928 | $entry->set_text('Server has not suggested MSDP yet'); | ||
| 23929 | } elsif ($self->session->msdpMode eq 'client_agree') { | ||
| 23930 | $entry->set_text('Server has suggested MSDP and client has agreed'); | ||
| 23931 | } elsif ($self->session->msdpMode eq 'client_refuse') { | ||
| 23932 | $entry->set_text('Server has suggested MSDP and client has refused'); | ||
| 23933 | } elsif ($self->session->msdpMode eq 'client_ignore') { | ||
| 23934 | $entry->set_text('Server sent garbage MSDP, so client is ignoring it'); | ||
| 23935 | } | ||
| 23936 | |||
| 23937 | if ($self->session->msspMode eq 'no_invite') { | ||
| 23938 | $entry2->set_text('Server has not suggested MSSP yet'); | ||
| 23939 | } elsif ($self->session->msspMode eq 'client_agree') { | ||
| 23940 | $entry2->set_text('Server has suggested MSSP and client has agreed'); | ||
| 23941 | } elsif ($self->session->msspMode eq 'client_refuse') { | ||
| 23942 | $entry2->set_text('Server has suggested MSSP and client has refused'); | ||
| 23943 | } | ||
| 23944 | |||
| 23945 | if ($self->session->mccpMode eq 'no_invite') { | ||
| 23946 | $entry3->set_text('Server has not suggested MCCP yet'); | ||
| 23947 | } elsif ($self->session->mccpMode eq 'client_agree') { | ||
| 23948 | $entry3->set_text('Server has suggested MCCP and client has agreed'); | ||
| 23949 | } elsif ($self->session->mccpMode eq 'client_refuse') { | ||
| 23950 | $entry3->set_text('Server has suggested MCCP and client has refused'); | ||
| 23951 | } elsif ($self->session->mccpMode eq 'compress_start') { | ||
| 23952 | $entry3->set_text('Server has signalled MCCP compression has begun'); | ||
| 23953 | } elsif ($self->session->mccpMode eq 'compress_error') { | ||
| 23954 | $entry3->set_text('MCCP has stopped after a compression error'); | ||
| 23955 | } elsif ($self->session->mccpMode eq 'compress_stop') { | ||
| 23956 | $entry3->set_text('Server has terminated MCCP compression'); | ||
| 23957 | } | ||
| 23958 | |||
| 23959 | if ($self->session->mspMode eq 'no_invite') { | ||
| 23960 | $entry4->set_text('Server has not suggested MSP yet'); | ||
| 23961 | } elsif ($self->session->mspMode eq 'client_agree') { | ||
| 23962 | $entry4->set_text('Server has suggested MSP and client has agreed'); | ||
| 23963 | } elsif ($self->session->mspMode eq 'client_refuse') { | ||
| 23964 | $entry4->set_text('Server has suggested MSP and client has refused'); | ||
| 23965 | } elsif ($self->session->mspMode eq 'client_simulate') { | ||
| 23966 | |||
| 23967 | $entry4->set_text( | ||
| 23968 | 'Server did not suggest MSP, but ' . $axmud::SCRIPT | ||
| 23969 | . ' is responding to MSP sound/music triggers', | ||
| 23970 | ); | ||
| 23971 | } | ||
| 23972 | |||
| 23973 | if ($self->session->mxpMode eq 'no_invite') { | ||
| 23974 | $entry5->set_text('Server has not suggested MXP yet'); | ||
| 23975 | } elsif ($self->session->mxpMode eq 'client_agree') { | ||
| 23976 | $entry5->set_text('Server has suggested MXP and client has agreed'); | ||
| 23977 | } elsif ($self->session->mxpMode eq 'client_refuse') { | ||
| 23978 | $entry5->set_text('Server has suggested MXP and client has refused'); | ||
| 23979 | } | ||
| 23980 | |||
| 23981 | if ($self->session->puebloMode eq 'no_invite') { | ||
| 23982 | $entry6->set_text('Server has not suggested Pueblo yet'); | ||
| 23983 | } elsif ($self->session->puebloMode eq 'client_agree') { | ||
| 23984 | $entry6->set_text('Server has suggested Pueblo and client has agreed'); | ||
| 23985 | } elsif ($self->session->puebloMode eq 'client_refuse') { | ||
| 23986 | $entry6->set_text('Server has suggested Pueblo and client has refused'); | ||
| 23987 | } | ||
| 23988 | |||
| 23989 | if ($self->session->zmpMode eq 'no_invite') { | ||
| 23990 | $entry7->set_text('Server has not suggested ZMP yet'); | ||
| 23991 | } elsif ($self->session->zmpMode eq 'client_agree') { | ||
| 23992 | $entry7->set_text('Server has suggested ZMP and client has agreed'); | ||
| 23993 | } elsif ($self->session->zmpMode eq 'client_refuse') { | ||
| 23994 | $entry7->set_text('Server has suggested ZMP and client has refused'); | ||
| 23995 | } | ||
| 23996 | |||
| 23997 | if ($self->session->aard102Mode eq 'no_invite') { | ||
| 23998 | $entry8->set_text('Server has not suggested ZMP yet'); | ||
| 23999 | } elsif ($self->session->aard102Mode eq 'client_agree') { | ||
| 24000 | $entry8->set_text('Server has suggested ZMP and client has agreed'); | ||
| 24001 | } elsif ($self->session->aard102Mode eq 'client_refuse') { | ||
| 24002 | $entry8->set_text('Server has suggested ZMP and client has refused'); | ||
| 24003 | } | ||
| 24004 | |||
| 24005 | $checkButton->set_active($axmud::CLIENT->useMsdpFlag); | ||
| 24006 | $checkButton2->set_active($axmud::CLIENT->useMsspFlag); | ||
| 24007 | $checkButton3->set_active($axmud::CLIENT->useMccpFlag); | ||
| 24008 | $checkButton4->set_active($axmud::CLIENT->useMspFlag); | ||
| 24009 | $checkButton5->set_active($axmud::CLIENT->useMxpFlag); | ||
| 24010 | $checkButton6->set_active($axmud::CLIENT->usePuebloFlag); | ||
| 24011 | $checkButton7->set_active($axmud::CLIENT->useZmpFlag); | ||
| 24012 | $checkButton8->set_active($axmud::CLIENT->useAard102Flag); | ||
| 24013 | |||
| 24014 | return 1; | ||
| 24015 | } | ||
| 24016 | |||
| 24017 | sub protocols3Tab { | ||
| 24018 | |||
| 24019 | # Protocols3 tab | ||
| 24020 | # | ||
| 24021 | # Expected arguments | ||
| 24022 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24023 | # | ||
| 24024 | # Return values | ||
| 24025 | # 'undef' on improper arguments | ||
| 24026 | # 1 otherwise | ||
| 24027 | |||
| 24028 | my ($self, $innerNotebook, $check) = @_; | ||
| 24029 | |||
| 24030 | # Check for improper arguments | ||
| 24031 | if (! defined $innerNotebook || defined $check) { | ||
| 24032 | |||
| 24033 | return $axmud::CLIENT->writeImproper($self->_objClass . '->protocols3Tab', @_); | ||
| 24034 | } | ||
| 24035 | |||
| 24036 | # Tab setup | ||
| 24037 | my $grid = $self->addTab( | ||
| 24038 | $innerNotebook, | ||
| 24039 | 'Page _3', | ||
| 24040 | ['MUD protocol negotiations (2/2)'], | ||
| 24041 | ); | ||
| 24042 | |||
| 24043 | # MUD Protocol negotiations (2/2) | ||
| 24044 | $self->addLabel($grid, '<b>MUD protocol negotiations (2/2)</b>', | ||
| 24045 | 0, 12, 0, 1); | ||
| 24046 | $self->addLabel($grid, '<i>Current status of MUD protocols for this session</i>', | ||
| 24047 | 1, 12, 1, 2); | ||
| 24048 | |||
| 24049 | my $checkButton = $self->addCheckButton( | ||
| 24050 | $grid, 'ATCP (Achaea Telnet Client Protocol)', undef, FALSE, | ||
| 24051 | 1, 3, 2, 3); | ||
| 24052 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 24053 | 3, 12, 2, 3); | ||
| 24054 | |||
| 24055 | my $checkButton2 = $self->addCheckButton( | ||
| 24056 | $grid, 'GMCP (Generic MUD Communication Protocol)', undef, FALSE, | ||
| 24057 | 1, 3, 3, 4); | ||
| 24058 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 24059 | 3, 12, 3, 4); | ||
| 24060 | |||
| 24061 | my $checkButton3 = $self->addCheckButton( | ||
| 24062 | $grid, 'MTTS (Mud Terminal Type Standard)', undef, FALSE, | ||
| 24063 | 1, 3, 4, 5); | ||
| 24064 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 24065 | 3, 12, 4, 5); | ||
| 24066 | |||
| 24067 | my $checkButton4 = $self->addCheckButton( | ||
| 24068 | $grid, 'MNES (MUD NEW-ENVIRON Stanard)', undef, FALSE, | ||
| 24069 | 1, 3, 5, 6); | ||
| 24070 | my $entry4 = $self->addEntry($grid, undef, FALSE, | ||
| 24071 | 3, 12, 5, 6); | ||
| 24072 | |||
| 24073 | my $checkButton5 = $self->addCheckButton( | ||
| 24074 | $grid, 'MCP (Mud Client Protocol)', undef, FALSE, | ||
| 24075 | 1, 3, 6, 7); | ||
| 24076 | my $entry5 = $self->addEntry($grid, undef, FALSE, | ||
| 24077 | 3, 12, 6, 7); | ||
| 24078 | |||
| 24079 | $self->protocolsTab3_updateWidgets( | ||
| 24080 | $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2, $checkButton3, | ||
| 24081 | $checkButton4, $checkButton5, | ||
| 24082 | ); | ||
| 24083 | |||
| 24084 | my $button = $self->addButton($grid, 'Update', 'Update the MUD protocols shown', undef, | ||
| 24085 | 10, 12, 7, 8); | ||
| 24086 | $button->signal_connect('clicked' => sub { | ||
| 24087 | |||
| 24088 | $self->protocolsTab3_updateWidgets( | ||
| 24089 | $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2, | ||
| 24090 | $checkButton3, $checkButton4, $checkButton5, | ||
| 24091 | ); | ||
| 24092 | }); | ||
| 24093 | |||
| 24094 | # Tab complete | ||
| 24095 | return 1; | ||
| 24096 | } | ||
| 24097 | |||
| 24098 | sub protocolsTab3_updateWidgets { | ||
| 24099 | |||
| 24100 | # Called by $self->protocolsTab3 to update the Gtk3::Entry boxes | ||
| 24101 | # | ||
| 24102 | # Expected arguments | ||
| 24103 | # $entry, $entry2, $entry3, $entry4, $entry5 | ||
| 24104 | # - List of Gtk3::Entry boxes to update | ||
| 24105 | # $checkButton, $checkButton2, $checkButton3, $checkButton4, $heckButton5 | ||
| 24106 | # - List of Gtk3::CheckButtons to update | ||
| 24107 | # | ||
| 24108 | # Return values | ||
| 24109 | # 'undef' on improper arguments | ||
| 24110 | # 1 otherwise | ||
| 24111 | |||
| 24112 | my ( | ||
| 24113 | $self, $entry, $entry2, $entry3, $entry4, $entry5, $checkButton, $checkButton2, | ||
| 24114 | $checkButton3, $checkButton4, $checkButton5, $check, | ||
| 24115 | ) = @_; | ||
| 24116 | |||
| 24117 | # Check for improper arguments | ||
| 24118 | if ( | ||
| 24119 | ! defined $entry || ! defined $entry2 || ! defined $entry3 || ! defined $entry4 | ||
| 24120 | || ! defined $entry5 || ! defined $checkButton || ! defined $checkButton2 | ||
| 24121 | || ! defined $checkButton3 || ! defined $checkButton4 || ! defined $checkButton5 | ||
| 24122 | || defined $check | ||
| 24123 | ) { | ||
| 24124 | return $axmud::CLIENT->writeImproper( | ||
| 24125 | $self->_objClass . '->protocolsTab3_updateWidgets', | ||
| 24126 | @_, | ||
| 24127 | ); | ||
| 24128 | } | ||
| 24129 | |||
| 24130 | if ($self->session->atcpMode eq 'no_invite') { | ||
| 24131 | $entry->set_text('Server has not suggested ATCP yet'); | ||
| 24132 | } elsif ($self->session->atcpMode eq 'client_agree') { | ||
| 24133 | $entry->set_text('Server has suggested ATCP and client has agreed'); | ||
| 24134 | } elsif ($self->session->atcpMode eq 'client_refuse') { | ||
| 24135 | $entry->set_text('Server has suggested ATCP and client has refused'); | ||
| 24136 | } | ||
| 24137 | |||
| 24138 | if ($self->session->gmcpMode eq 'no_invite') { | ||
| 24139 | $entry2->set_text('Server has not suggested GMCP yet'); | ||
| 24140 | } elsif ($self->session->gmcpMode eq 'client_agree') { | ||
| 24141 | $entry2->set_text('Server has suggested GMCP and client has agreed'); | ||
| 24142 | } elsif ($self->session->gmcpMode eq 'client_refuse') { | ||
| 24143 | $entry2->set_text('Server has suggested GMCP and client has refused'); | ||
| 24144 | } | ||
| 24145 | |||
| 24146 | if ($self->session->specifiedTType) { | ||
| 24147 | $entry3->set_text('Preferred terminal: ' . $self->session->specifiedTType); | ||
| 24148 | } else { | ||
| 24149 | $entry3->set_text('Preferred terminal: (not sent)'); | ||
| 24150 | } | ||
| 24151 | |||
| 24152 | # Strictly speaking a client, not a session setting | ||
| 24153 | if ($axmud::CLIENT->allowMnesSendIPFlag) { | ||
| 24154 | $entry4->set_text('Sending IP address to server enabled'); | ||
| 24155 | } else { | ||
| 24156 | $entry4->set_text('Sending IP address to server disabled'); | ||
| 24157 | } | ||
| 24158 | |||
| 24159 | if ($self->session->mcpMode eq 'no_invite') { | ||
| 24160 | $entry5->set_text('Server has not suggested MCP yet'); | ||
| 24161 | } elsif ($self->session->mcpMode eq 'client_agree') { | ||
| 24162 | $entry5->set_text('Server has suggested MCP and client has agreed'); | ||
| 24163 | } elsif ($self->session->mcpMode eq 'client_refuse') { | ||
| 24164 | $entry5->set_text('Server has suggested MCP and client has refused'); | ||
| 24165 | } | ||
| 24166 | |||
| 24167 | $checkButton->set_active($axmud::CLIENT->useAtcpFlag); | ||
| 24168 | $checkButton2->set_active($axmud::CLIENT->useGmcpFlag); | ||
| 24169 | $checkButton3->set_active($axmud::CLIENT->useMttsFlag); | ||
| 24170 | $checkButton4->set_active($axmud::CLIENT->useMnesFlag); | ||
| 24171 | $checkButton5->set_active($axmud::CLIENT->useMcpFlag); | ||
| 24172 | |||
| 24173 | return 1; | ||
| 24174 | } | ||
| 24175 | |||
| 24176 | sub msdpTab { | ||
| 24177 | |||
| 24178 | # Msdp tab - called by $self->setupNotebook | ||
| 24179 | # | ||
| 24180 | # Expected arguments | ||
| 24181 | # (none besides $self) | ||
| 24182 | # | ||
| 24183 | # Return values | ||
| 24184 | # 'undef' on improper arguments | ||
| 24185 | # 1 otherwise | ||
| 24186 | |||
| 24187 | my ($self, $check) = @_; | ||
| 24188 | |||
| 24189 | # Check for improper arguments | ||
| 24190 | if (defined $check) { | ||
| 24191 | |||
| 24192 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdpTab', @_); | ||
| 24193 | } | ||
| 24194 | |||
| 24195 | # Tab setup | ||
| 24196 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 24197 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'MS_DP'); | ||
| 24198 | |||
| 24199 | # Add tabs to the inner notebook | ||
| 24200 | $self->msdp1Tab($innerNotebook); | ||
| 24201 | $self->msdp2Tab($innerNotebook); | ||
| 24202 | $self->msdp3Tab($innerNotebook); | ||
| 24203 | $self->msdp4Tab($innerNotebook); | ||
| 24204 | $self->msdp5Tab($innerNotebook); | ||
| 24205 | $self->msdp6Tab($innerNotebook); | ||
| 24206 | $self->msdp7Tab($innerNotebook); | ||
| 24207 | $self->msdp8Tab($innerNotebook); | ||
| 24208 | |||
| 24209 | return 1; | ||
| 24210 | } | ||
| 24211 | |||
| 24212 | sub msdp1Tab { | ||
| 24213 | |||
| 24214 | # Msdp1 tab | ||
| 24215 | # | ||
| 24216 | # Expected arguments | ||
| 24217 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24218 | # | ||
| 24219 | # Return values | ||
| 24220 | # 'undef' on improper arguments | ||
| 24221 | # 1 otherwise | ||
| 24222 | |||
| 24223 | my ($self, $innerNotebook, $check) = @_; | ||
| 24224 | |||
| 24225 | # Local variables | ||
| 24226 | my @columnList; | ||
| 24227 | |||
| 24228 | # Check for improper arguments | ||
| 24229 | if (! defined $innerNotebook || defined $check) { | ||
| 24230 | |||
| 24231 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp1Tab', @_); | ||
| 24232 | } | ||
| 24233 | |||
| 24234 | # Tab setup | ||
| 24235 | my $grid = $self->addTab( | ||
| 24236 | $innerNotebook, | ||
| 24237 | 'Page _1', | ||
| 24238 | ['MSDP generic commands'], | ||
| 24239 | ); | ||
| 24240 | |||
| 24241 | # MSDP generic commands | ||
| 24242 | $self->addLabel($grid, '<b>MSDP generic commands</b>', | ||
| 24243 | 0, 12, 0, 1); | ||
| 24244 | $self->addLabel($grid, | ||
| 24245 | '<i>List of generic (official) commands supported by the server</i>', | ||
| 24246 | 1, 12, 1, 2); | ||
| 24247 | |||
| 24248 | # Add a simple list | ||
| 24249 | @columnList = ( | ||
| 24250 | 'Supported', 'bool', | ||
| 24251 | 'Command', 'text', | ||
| 24252 | ); | ||
| 24253 | |||
| 24254 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24255 | 1, 12, 2, 10); | ||
| 24256 | |||
| 24257 | # Initialise the list | ||
| 24258 | $self->msdp1Tab_refreshList( | ||
| 24259 | $slWidget, | ||
| 24260 | scalar (@columnList / 2), | ||
| 24261 | 'msdpGenericCmdHash', | ||
| 24262 | ); | ||
| 24263 | |||
| 24264 | # Add a button | ||
| 24265 | my $button = $self->addButton($grid, | ||
| 24266 | 'Refresh list', 'Refresh the list of commands', undef, | ||
| 24267 | 9, 12, 10, 11); | ||
| 24268 | $button->signal_connect('clicked' => sub { | ||
| 24269 | |||
| 24270 | $self->msdp1Tab_refreshList( | ||
| 24271 | $slWidget, | ||
| 24272 | scalar (@columnList / 2), | ||
| 24273 | 'msdpGenericCmdHash', | ||
| 24274 | ); | ||
| 24275 | }); | ||
| 24276 | |||
| 24277 | # Tab complete | ||
| 24278 | return 1; | ||
| 24279 | } | ||
| 24280 | |||
| 24281 | sub msdp1Tab_refreshList { | ||
| 24282 | |||
| 24283 | # Resets the simple list displayed by $self->msdp1Tab, etc | ||
| 24284 | # | ||
| 24285 | # Expected arguments | ||
| 24286 | # $slWidget - The GA::Obj::SimpleList | ||
| 24287 | # $columns - The number of columns | ||
| 24288 | # $iv - The hash IV whose key-value pairs should be displayed | ||
| 24289 | # | ||
| 24290 | # Return values | ||
| 24291 | # 'undef' on improper arguments | ||
| 24292 | # 1 otherwise | ||
| 24293 | |||
| 24294 | my ($self, $slWidget, $columns, $iv, $check) = @_; | ||
| 24295 | |||
| 24296 | # Local variables | ||
| 24297 | my ( | ||
| 24298 | @dataList, | ||
| 24299 | %hash, | ||
| 24300 | ); | ||
| 24301 | |||
| 24302 | # Check for improper arguments | ||
| 24303 | if (! defined $slWidget || ! defined $columns || ! defined $iv || defined $check) { | ||
| 24304 | |||
| 24305 | return $axmud::CLIENT->writeImproper( | ||
| 24306 | $self->_objClass . '->msdp1Tab_refreshList', | ||
| 24307 | @_, | ||
| 24308 | ); | ||
| 24309 | } | ||
| 24310 | |||
| 24311 | # Import the hash IV | ||
| 24312 | %hash = $self->session->$iv; | ||
| 24313 | |||
| 24314 | # Compile the simple list data | ||
| 24315 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) { | ||
| 24316 | |||
| 24317 | push (@dataList, | ||
| 24318 | $hash{$key}, | ||
| 24319 | $key, | ||
| 24320 | ); | ||
| 24321 | } | ||
| 24322 | |||
| 24323 | # Reset the simple list | ||
| 24324 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 24325 | |||
| 24326 | return 1; | ||
| 24327 | } | ||
| 24328 | |||
| 24329 | sub msdp2Tab { | ||
| 24330 | |||
| 24331 | # Msdp2 tab | ||
| 24332 | # | ||
| 24333 | # Expected arguments | ||
| 24334 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24335 | # | ||
| 24336 | # Return values | ||
| 24337 | # 'undef' on improper arguments | ||
| 24338 | # 1 otherwise | ||
| 24339 | |||
| 24340 | my ($self, $innerNotebook, $check) = @_; | ||
| 24341 | |||
| 24342 | # Local variables | ||
| 24343 | my @columnList; | ||
| 24344 | |||
| 24345 | # Check for improper arguments | ||
| 24346 | if (! defined $innerNotebook || defined $check) { | ||
| 24347 | |||
| 24348 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp2Tab', @_); | ||
| 24349 | } | ||
| 24350 | |||
| 24351 | # Tab setup | ||
| 24352 | my $grid = $self->addTab( | ||
| 24353 | $innerNotebook, | ||
| 24354 | 'Page _2', | ||
| 24355 | ['MSDP custom commands'], | ||
| 24356 | ); | ||
| 24357 | |||
| 24358 | # MSDP custom commands | ||
| 24359 | $self->addLabel($grid, '<b>MSDP custom commands</b>', | ||
| 24360 | 0, 12, 0, 1); | ||
| 24361 | $self->addLabel($grid, | ||
| 24362 | '<i>List of custom (unofficial) commands supported by the server</i>', | ||
| 24363 | 1, 12, 1, 2); | ||
| 24364 | |||
| 24365 | # Add a simple list | ||
| 24366 | @columnList = ( | ||
| 24367 | 'Supported', 'bool', | ||
| 24368 | 'Command', 'text', | ||
| 24369 | ); | ||
| 24370 | |||
| 24371 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24372 | 1, 12, 2, 10); | ||
| 24373 | |||
| 24374 | # Initialise the list | ||
| 24375 | $self->msdp1Tab_refreshList( | ||
| 24376 | $slWidget, | ||
| 24377 | scalar (@columnList / 2), | ||
| 24378 | 'msdpCustomCmdHash', | ||
| 24379 | ); | ||
| 24380 | |||
| 24381 | # Add a button | ||
| 24382 | my $button = $self->addButton($grid, | ||
| 24383 | 'Refresh list', 'Refresh the list of commands', undef, | ||
| 24384 | 9, 12, 10, 11); | ||
| 24385 | $button->signal_connect('clicked' => sub { | ||
| 24386 | |||
| 24387 | $self->msdp1Tab_refreshList( | ||
| 24388 | $slWidget, | ||
| 24389 | scalar (@columnList / 2), | ||
| 24390 | 'msdpCustomCmdHash', | ||
| 24391 | ); | ||
| 24392 | }); | ||
| 24393 | |||
| 24394 | # Tab complete | ||
| 24395 | return 1; | ||
| 24396 | } | ||
| 24397 | |||
| 24398 | sub msdp3Tab { | ||
| 24399 | |||
| 24400 | # Msdp3 tab | ||
| 24401 | # | ||
| 24402 | # Expected arguments | ||
| 24403 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24404 | # | ||
| 24405 | # Return values | ||
| 24406 | # 'undef' on improper arguments | ||
| 24407 | # 1 otherwise | ||
| 24408 | |||
| 24409 | my ($self, $innerNotebook, $check) = @_; | ||
| 24410 | |||
| 24411 | # Local variables | ||
| 24412 | my @columnList; | ||
| 24413 | |||
| 24414 | # Check for improper arguments | ||
| 24415 | if (! defined $innerNotebook || defined $check) { | ||
| 24416 | |||
| 24417 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp3Tab', @_); | ||
| 24418 | } | ||
| 24419 | |||
| 24420 | # Tab setup | ||
| 24421 | my $grid = $self->addTab( | ||
| 24422 | $innerNotebook, | ||
| 24423 | 'Page _3', | ||
| 24424 | ['MSDP generic lists'], | ||
| 24425 | ); | ||
| 24426 | |||
| 24427 | # MSDP generic lists | ||
| 24428 | $self->addLabel($grid, '<b>MSDP generic lists</b>', | ||
| 24429 | 0, 12, 0, 1); | ||
| 24430 | $self->addLabel($grid, | ||
| 24431 | '<i>List of generic (official) lists supported by the server</i>', | ||
| 24432 | 1, 12, 1, 2); | ||
| 24433 | |||
| 24434 | # Add a simple list | ||
| 24435 | @columnList = ( | ||
| 24436 | 'Supported', 'bool', | ||
| 24437 | 'List', 'text', | ||
| 24438 | ); | ||
| 24439 | |||
| 24440 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24441 | 1, 12, 2, 10); | ||
| 24442 | |||
| 24443 | # Initialise the list | ||
| 24444 | $self->msdp1Tab_refreshList( | ||
| 24445 | $slWidget, | ||
| 24446 | scalar (@columnList / 2), | ||
| 24447 | 'msdpGenericListHash', | ||
| 24448 | ); | ||
| 24449 | |||
| 24450 | # Add a button | ||
| 24451 | my $button = $self->addButton($grid, | ||
| 24452 | 'Refresh list', 'Refresh the list of lists', undef, | ||
| 24453 | 9, 12, 10, 11); | ||
| 24454 | $button->signal_connect('clicked' => sub { | ||
| 24455 | |||
| 24456 | $self->msdp1Tab_refreshList( | ||
| 24457 | $slWidget, | ||
| 24458 | scalar (@columnList / 2), | ||
| 24459 | 'msdpGenericListHash', | ||
| 24460 | ); | ||
| 24461 | }); | ||
| 24462 | |||
| 24463 | # Tab complete | ||
| 24464 | return 1; | ||
| 24465 | } | ||
| 24466 | |||
| 24467 | sub msdp4Tab { | ||
| 24468 | |||
| 24469 | # Msdp4 tab | ||
| 24470 | # | ||
| 24471 | # Expected arguments | ||
| 24472 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24473 | # | ||
| 24474 | # Return values | ||
| 24475 | # 'undef' on improper arguments | ||
| 24476 | # 1 otherwise | ||
| 24477 | |||
| 24478 | my ($self, $innerNotebook, $check) = @_; | ||
| 24479 | |||
| 24480 | # Local variables | ||
| 24481 | my @columnList; | ||
| 24482 | |||
| 24483 | # Check for improper arguments | ||
| 24484 | if (! defined $innerNotebook || defined $check) { | ||
| 24485 | |||
| 24486 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp4Tab', @_); | ||
| 24487 | } | ||
| 24488 | |||
| 24489 | # Tab setup | ||
| 24490 | my $grid = $self->addTab( | ||
| 24491 | $innerNotebook, | ||
| 24492 | 'Page _4', | ||
| 24493 | ['MSDP custom lists'], | ||
| 24494 | ); | ||
| 24495 | |||
| 24496 | # MSDP custom lists | ||
| 24497 | $self->addLabel($grid, '<b>MSDP custom lists</b>', | ||
| 24498 | 0, 12, 0, 1); | ||
| 24499 | $self->addLabel($grid, | ||
| 24500 | '<i>List of custom (unofficial) lists supported by the server</i>', | ||
| 24501 | 1, 12, 1, 2); | ||
| 24502 | |||
| 24503 | # Add a simple list | ||
| 24504 | @columnList = ( | ||
| 24505 | 'Supported', 'bool', | ||
| 24506 | 'List', 'text', | ||
| 24507 | ); | ||
| 24508 | |||
| 24509 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24510 | 1, 12, 2, 10); | ||
| 24511 | |||
| 24512 | # Initialise the list | ||
| 24513 | $self->msdp1Tab_refreshList( | ||
| 24514 | $slWidget, | ||
| 24515 | scalar (@columnList / 2), | ||
| 24516 | 'msdpCustomListHash', | ||
| 24517 | ); | ||
| 24518 | |||
| 24519 | # Add a button | ||
| 24520 | my $button = $self->addButton($grid, | ||
| 24521 | 'Refresh list', 'Refresh the list of lists', undef, | ||
| 24522 | 9, 12, 10, 11); | ||
| 24523 | $button->signal_connect('clicked' => sub { | ||
| 24524 | |||
| 24525 | $self->msdp1Tab_refreshList( | ||
| 24526 | $slWidget, | ||
| 24527 | scalar (@columnList / 2), | ||
| 24528 | 'msdpCustomListHash', | ||
| 24529 | ); | ||
| 24530 | }); | ||
| 24531 | |||
| 24532 | # Tab complete | ||
| 24533 | return 1; | ||
| 24534 | } | ||
| 24535 | |||
| 24536 | sub msdp5Tab { | ||
| 24537 | |||
| 24538 | # Msdp5 tab | ||
| 24539 | # | ||
| 24540 | # Expected arguments | ||
| 24541 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24542 | # | ||
| 24543 | # Return values | ||
| 24544 | # 'undef' on improper arguments | ||
| 24545 | # 1 otherwise | ||
| 24546 | |||
| 24547 | my ($self, $innerNotebook, $check) = @_; | ||
| 24548 | |||
| 24549 | # Local variables | ||
| 24550 | my @columnList; | ||
| 24551 | |||
| 24552 | # Check for improper arguments | ||
| 24553 | if (! defined $innerNotebook || defined $check) { | ||
| 24554 | |||
| 24555 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp5Tab', @_); | ||
| 24556 | } | ||
| 24557 | |||
| 24558 | # Tab setup | ||
| 24559 | my $grid = $self->addTab( | ||
| 24560 | $innerNotebook, | ||
| 24561 | 'Page _5', | ||
| 24562 | ['MSDP generic configurable variables'], | ||
| 24563 | ); | ||
| 24564 | |||
| 24565 | # MSDP generic configurable variables | ||
| 24566 | $self->addLabel($grid, '<b>MSDP generic configurable variables</b>', | ||
| 24567 | 0, 12, 0, 1); | ||
| 24568 | $self->addLabel($grid, | ||
| 24569 | '<i>List of generic (official) configurable variables supported by the server</i>', | ||
| 24570 | 1, 12, 1, 2); | ||
| 24571 | |||
| 24572 | # Add a simple list | ||
| 24573 | @columnList = ( | ||
| 24574 | 'Supported', 'bool', | ||
| 24575 | 'Variable', 'text', | ||
| 24576 | 'Value', 'text', | ||
| 24577 | ); | ||
| 24578 | |||
| 24579 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24580 | 1, 12, 2, 10); | ||
| 24581 | |||
| 24582 | # Initialise the list | ||
| 24583 | $self->msdp5Tab_refreshList( | ||
| 24584 | $slWidget, | ||
| 24585 | scalar (@columnList / 2), | ||
| 24586 | 'msdpGenericConfigFlagHash', | ||
| 24587 | 'msdpGenericConfigValHash', | ||
| 24588 | ); | ||
| 24589 | |||
| 24590 | # Add a button | ||
| 24591 | my $button = $self->addButton($grid, | ||
| 24592 | 'Refresh list', 'Refresh the list of configurable variables', undef, | ||
| 24593 | 9, 12, 10, 11); | ||
| 24594 | $button->signal_connect('clicked' => sub { | ||
| 24595 | |||
| 24596 | $self->msdp5Tab_refreshList( | ||
| 24597 | $slWidget, | ||
| 24598 | scalar (@columnList / 2), | ||
| 24599 | 'msdpGenericConfigFlagHash', | ||
| 24600 | 'msdpGenericConfigValHash', | ||
| 24601 | ); | ||
| 24602 | }); | ||
| 24603 | |||
| 24604 | # Tab complete | ||
| 24605 | return 1; | ||
| 24606 | } | ||
| 24607 | |||
| 24608 | sub msdp5Tab_refreshList { | ||
| 24609 | |||
| 24610 | # Resets the simple list displayed by $self->msdp5Tab, etc | ||
| 24611 | # | ||
| 24612 | # Expected arguments | ||
| 24613 | # $slWidget - The GA::Obj::SimpleList | ||
| 24614 | # $columns - The number of columns | ||
| 24615 | # $iv, $iv2 - The hash IVs whose key-value pairs should be displayed | ||
| 24616 | # | ||
| 24617 | # Return values | ||
| 24618 | # 'undef' on improper arguments | ||
| 24619 | # 1 otherwise | ||
| 24620 | |||
| 24621 | my ($self, $slWidget, $columns, $iv, $iv2, $check) = @_; | ||
| 24622 | |||
| 24623 | # Local variables | ||
| 24624 | my ( | ||
| 24625 | @dataList, | ||
| 24626 | %hash, %hash2, | ||
| 24627 | ); | ||
| 24628 | |||
| 24629 | # Check for improper arguments | ||
| 24630 | if ( | ||
| 24631 | ! defined $slWidget || ! defined $columns || ! defined $iv || ! defined $iv2 | ||
| 24632 | || defined $check | ||
| 24633 | ) { | ||
| 24634 | return $axmud::CLIENT->writeImproper( | ||
| 24635 | $self->_objClass . '->msdp5Tab_refreshList', | ||
| 24636 | @_, | ||
| 24637 | ); | ||
| 24638 | } | ||
| 24639 | |||
| 24640 | # Import the hash IVs | ||
| 24641 | %hash = $self->session->$iv; | ||
| 24642 | %hash2 = $self->session->$iv2; | ||
| 24643 | |||
| 24644 | # Compile the simple list data | ||
| 24645 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) { | ||
| 24646 | |||
| 24647 | push (@dataList, | ||
| 24648 | $hash{$key}, # Flag | ||
| 24649 | $key, | ||
| 24650 | $hash2{$key}, # Value | ||
| 24651 | ); | ||
| 24652 | } | ||
| 24653 | |||
| 24654 | # Reset the simple list | ||
| 24655 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 24656 | |||
| 24657 | return 1; | ||
| 24658 | } | ||
| 24659 | |||
| 24660 | sub msdp6Tab { | ||
| 24661 | |||
| 24662 | # Msdp6 tab | ||
| 24663 | # | ||
| 24664 | # Expected arguments | ||
| 24665 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24666 | # | ||
| 24667 | # Return values | ||
| 24668 | # 'undef' on improper arguments | ||
| 24669 | # 1 otherwise | ||
| 24670 | |||
| 24671 | my ($self, $innerNotebook, $check) = @_; | ||
| 24672 | |||
| 24673 | # Local variables | ||
| 24674 | my @columnList; | ||
| 24675 | |||
| 24676 | # Check for improper arguments | ||
| 24677 | if (! defined $innerNotebook || defined $check) { | ||
| 24678 | |||
| 24679 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp6Tab', @_); | ||
| 24680 | } | ||
| 24681 | |||
| 24682 | # Tab setup | ||
| 24683 | my $grid = $self->addTab( | ||
| 24684 | $innerNotebook, | ||
| 24685 | 'Page _6', | ||
| 24686 | ['MSDP custom configurable variables'], | ||
| 24687 | ); | ||
| 24688 | |||
| 24689 | # MSDP custom configurable variables | ||
| 24690 | $self->addLabel($grid, '<b>MSDP custom configurable variables</b>', | ||
| 24691 | 0, 12, 0, 1); | ||
| 24692 | $self->addLabel($grid, | ||
| 24693 | '<i>List of custom (unofficial) configurable variables supported by the server</i>', | ||
| 24694 | 1, 12, 1, 2); | ||
| 24695 | |||
| 24696 | # Add a simple list | ||
| 24697 | @columnList = ( | ||
| 24698 | 'Supported', 'bool', | ||
| 24699 | 'Variable', 'text', | ||
| 24700 | 'Value', 'text', | ||
| 24701 | ); | ||
| 24702 | |||
| 24703 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24704 | 1, 12, 2, 10); | ||
| 24705 | |||
| 24706 | # Initialise the list | ||
| 24707 | $self->msdp5Tab_refreshList( | ||
| 24708 | $slWidget, | ||
| 24709 | scalar (@columnList / 2), | ||
| 24710 | 'msdpCustomConfigFlagHash', | ||
| 24711 | 'msdpCustomConfigValHash', | ||
| 24712 | ); | ||
| 24713 | |||
| 24714 | # Add a button | ||
| 24715 | my $button = $self->addButton($grid, | ||
| 24716 | 'Refresh list', 'Refresh the list of configurable variables', undef, | ||
| 24717 | 9, 12, 10, 11); | ||
| 24718 | $button->signal_connect('clicked' => sub { | ||
| 24719 | |||
| 24720 | $self->msdp5Tab_refreshList( | ||
| 24721 | $slWidget, | ||
| 24722 | scalar (@columnList / 2), | ||
| 24723 | 'msdpCustomConfigFlagHash', | ||
| 24724 | 'msdpCustomConfigValHash', | ||
| 24725 | ); | ||
| 24726 | }); | ||
| 24727 | |||
| 24728 | # Tab complete | ||
| 24729 | return 1; | ||
| 24730 | } | ||
| 24731 | |||
| 24732 | sub msdp7Tab { | ||
| 24733 | |||
| 24734 | # Msdp7 tab | ||
| 24735 | # | ||
| 24736 | # Expected arguments | ||
| 24737 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 24738 | # | ||
| 24739 | # Return values | ||
| 24740 | # 'undef' on improper arguments | ||
| 24741 | # 1 otherwise | ||
| 24742 | |||
| 24743 | my ($self, $innerNotebook, $check) = @_; | ||
| 24744 | |||
| 24745 | # Local variables | ||
| 24746 | my @columnList; | ||
| 24747 | |||
| 24748 | # Check for improper arguments | ||
| 24749 | if (! defined $innerNotebook || defined $check) { | ||
| 24750 | |||
| 24751 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp7Tab', @_); | ||
| 24752 | } | ||
| 24753 | |||
| 24754 | # Tab setup | ||
| 24755 | my $grid = $self->addTab( | ||
| 24756 | $innerNotebook, | ||
| 24757 | 'Page _7', | ||
| 24758 | ['MSDP generic reportable variables'], | ||
| 24759 | ); | ||
| 24760 | |||
| 24761 | # MSDP generic reportable variables | ||
| 24762 | $self->addLabel($grid, '<b>MSDP generic reportable variables</b>', | ||
| 24763 | 0, 12, 0, 1); | ||
| 24764 | $self->addLabel($grid, | ||
| 24765 | '<i>List of generic (official) reportable variables supported by the server</i>', | ||
| 24766 | 1, 12, 1, 2); | ||
| 24767 | |||
| 24768 | # Add a simple list | ||
| 24769 | @columnList = ( | ||
| 24770 | 'Reportable', 'bool', | ||
| 24771 | 'Reported', 'bool', | ||
| 24772 | 'Sendable', 'bool', | ||
| 24773 | 'Variable', 'text', | ||
| 24774 | 'Value', 'text', | ||
| 24775 | ); | ||
| 24776 | |||
| 24777 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 24778 | 1, 12, 2, 10); | ||
| 24779 | |||
| 24780 | # Initialise the list | ||
| 24781 | $self->msdp7Tab_refreshList( | ||
| 24782 | $slWidget, | ||
| 24783 | scalar (@columnList / 2), | ||
| 24784 | 'msdpGenericReportableFlagHash', | ||
| 24785 | 'msdpGenericReportedFlagHash', | ||
| 24786 | 'msdpGenericSendableFlagHash', | ||
| 24787 | 'msdpGenericValueHash', | ||
| 24788 | ); | ||
| 24789 | |||
| 24790 | # Add a button | ||
| 24791 | my $button = $self->addButton($grid, | ||
| 24792 | 'Refresh list', 'Refresh the list of reportable variables', undef, | ||
| 24793 | 9, 12, 10, 11); | ||
| 24794 | $button->signal_connect('clicked' => sub { | ||
| 24795 | |||
| 24796 | $self->msdp7Tab_refreshList( | ||
| 24797 | $slWidget, | ||
| 24798 | scalar (@columnList / 2), | ||
| 24799 | 'msdpGenericReportableFlagHash', | ||
| 24800 | 'msdpGenericReportedFlagHash', | ||
| 24801 | 'msdpGenericSendableFlagHash', | ||
| 24802 | 'msdpGenericValueHash', | ||
| 24803 | ); | ||
| 24804 | }); | ||
| 24805 | |||
| 24806 | # Tab complete | ||
| 24807 | return 1; | ||
| 24808 | } | ||
| 24809 | |||
| 24810 | sub msdp7Tab_refreshList { | ||
| 24811 | |||
| 24812 | # Resets the simple list displayed by $self->msdp7Tab, etc | ||
| 24813 | # | ||
| 24814 | # Expected arguments | ||
| 24815 | # $slWidget - The GA::Obj::SimpleList | ||
| 24816 | # $columns - The number of columns | ||
| 24817 | # $iv, $iv2, $iv3, $iv4 | ||
| 24818 | # - The hash IVs whose key-value pairs should be displayed | ||
| 24819 | # | ||
| 24820 | # Return values | ||
| 24821 | # 'undef' on improper arguments | ||
| 24822 | # 1 otherwise | ||
| 24823 | |||
| 24824 | my ($self, $slWidget, $columns, $iv, $iv2, $iv3, $iv4, $check) = @_; | ||
| 24825 | |||
| 24826 | # Local variables | ||
| 24827 | my ( | ||
| 24828 | @dataList, | ||
| 24829 | %hash, %hash2, %hash3, %hash4, %combHash, | ||
| 24830 | ); | ||
| 24831 | |||
| 24832 | # Check for improper arguments | ||
| 24833 | if ( | ||
| 24834 | ! defined $slWidget || ! defined $columns || ! defined $iv || ! defined $iv2 | ||
| 24835 | || ! defined $iv3 || ! defined $iv4 || defined $check | ||
| 24836 | ) { | ||
| 24837 | return $axmud::CLIENT->writeImproper( | ||
| 24838 | $self->_objClass . '->msdp7Tab_refreshList', | ||
| 24839 | @_, | ||
| 24840 | ); | ||
| 24841 | } | ||
| 24842 | |||
| 24843 | # Import the hash IVs | ||
| 24844 | %hash = $self->session->$iv; # Flag | ||
| 24845 | %hash2 = $self->session->$iv2; # Flag | ||
| 24846 | %hash3 = $self->session->$iv3; # Flag | ||
| 24847 | %hash4 = $self->session->$iv4; # Value | ||
| 24848 | |||
| 24849 | # (Compile a single hash of keys which exist in all three flag hashes) | ||
| 24850 | foreach my $key (keys %hash) { | ||
| 24851 | |||
| 24852 | $combHash{$key} = undef; | ||
| 24853 | } | ||
| 24854 | |||
| 24855 | foreach my $key (keys %hash2) { | ||
| 24856 | |||
| 24857 | $combHash{$key} = undef; | ||
| 24858 | } | ||
| 24859 | |||
| 24860 | foreach my $key (keys %hash3) { | ||
| 24861 | |||
| 24862 | $combHash{$key} = undef; | ||
| 24863 | } | ||
| 24864 | |||
| 24865 | # Compile the simple list data | ||
| 24866 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %combHash)) { | ||
| 24867 | |||
| 24868 | my $value = $hash4{$key}; | ||
| 24869 | if (defined $value) { | ||
| 24870 | |||
| 24871 | # $value can be a scalar or a list/hash reference, representing an MSDP embedded | ||
| 24872 | # array/table. Reduce this to a single string | ||
| 24873 | $value = $self->msdp7Tab_parseScalar($value); | ||
| 24874 | } | ||
| 24875 | |||
| 24876 | push (@dataList, | ||
| 24877 | $hash{$key}, # Flag | ||
| 24878 | $hash2{$key}, # Flag | ||
| 24879 | $hash3{$key}, # Flag | ||
| 24880 | $key, | ||
| 24881 | $value, | ||
| 24882 | ); | ||
| 24883 | } | ||
| 24884 | |||
| 24885 | # Reset the simple list | ||
| 24886 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 24887 | |||
| 24888 | return 1; | ||
| 24889 | } | ||
| 24890 | |||
| 24891 | sub msdp7Tab_parseScalar { | ||
| 24892 | |||
| 24893 | # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar, | ||
| 24894 | # ->msdp7Tab_parseArray and msdp7Tab_parseTable | ||
| 24895 | # The value of an MSDP variable can be a scalar, or a list/hash reference representing an | ||
| 24896 | # embedded array/table. Call these functions recursively to reduce them all to a single | ||
| 24897 | # string we can display in the simple list. | ||
| 24898 | # | ||
| 24899 | # Expected arguments | ||
| 24900 | # $arg - A scalar, or a list/hash reference | ||
| 24901 | # | ||
| 24902 | # Return values | ||
| 24903 | # 'undef' on improper arguments | ||
| 24904 | # Otherwise returns the modified string | ||
| 24905 | |||
| 24906 | my ($self, $arg, $check) = @_; | ||
| 24907 | |||
| 24908 | # Check for improper arguments | ||
| 24909 | if (! defined $arg || defined $check) { | ||
| 24910 | |||
| 24911 | return $axmud::CLIENT->writeImproper( | ||
| 24912 | $self->_objClass . '->msdp7Tab_parseScalar', | ||
| 24913 | @_, | ||
| 24914 | ); | ||
| 24915 | } | ||
| 24916 | |||
| 24917 | if (ref $arg eq 'HASH') { | ||
| 24918 | return ' { ' . $self->msdp7Tab_parseTable($arg) . ' }'; | ||
| 24919 | } elsif (ref $arg eq 'ARRAY') { | ||
| 24920 | return ' ( ' . $self->msdp7Tab_parseArray($arg) . ' )'; | ||
| 24921 | } else { | ||
| 24922 | return ' ' . $arg; | ||
| 24923 | } | ||
| 24924 | } | ||
| 24925 | |||
| 24926 | sub msdp7Tab_parseArray { | ||
| 24927 | |||
| 24928 | # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar, | ||
| 24929 | # ->msdp7Tab_parseArray and msdp7Tab_parseTable | ||
| 24930 | # The value of an MSDP variable can be a scalar, or a list/hash reference representing an | ||
| 24931 | # embedded array/table. Call these functions recursively to reduce them all to a single | ||
| 24932 | # string we can display in the simple list. | ||
| 24933 | # | ||
| 24934 | # Expected arguments | ||
| 24935 | # $arg - A list reference | ||
| 24936 | # | ||
| 24937 | # Return values | ||
| 24938 | # 'undef' on improper arguments | ||
| 24939 | # Otherwise returns the modified string | ||
| 24940 | |||
| 24941 | my ($self, $arg, $check) = @_; | ||
| 24942 | |||
| 24943 | # Local variables | ||
| 24944 | my $string; | ||
| 24945 | |||
| 24946 | # Check for improper arguments | ||
| 24947 | if (! defined $arg || defined $check) { | ||
| 24948 | |||
| 24949 | return $axmud::CLIENT->writeImproper( | ||
| 24950 | $self->_objClass . '->msdp7Tab_parseScalar', | ||
| 24951 | @_, | ||
| 24952 | ); | ||
| 24953 | } | ||
| 24954 | |||
| 24955 | $string = ''; | ||
| 24956 | foreach my $item (@$arg) { | ||
| 24957 | |||
| 24958 | if (ref $item eq 'HASH') { | ||
| 24959 | $string .= ' { ' . $self->msdp7Tab_parseTable($item) . ' }'; | ||
| 24960 | } elsif (ref $item eq 'ARRAY') { | ||
| 24961 | $string .= ' ( ' . $self->msdp7Tab_parseArray($item) . ' )'; | ||
| 24962 | } else { | ||
| 24963 | $string .= ' ' . $item; | ||
| 24964 | } | ||
| 24965 | } | ||
| 24966 | |||
| 24967 | return $string; | ||
| 24968 | } | ||
| 24969 | |||
| 24970 | sub msdp7Tab_parseTable { | ||
| 24971 | |||
| 24972 | # Called by $self->msdp7Tab_refreshList and recursively by ->msdp7Tab_parseScalar, | ||
| 24973 | # ->msdp7Tab_parseArray and msdp7Tab_parseTable | ||
| 24974 | # The value of an MSDP variable can be a scalar, or a list/hash reference representing an | ||
| 24975 | # embedded array/table. Call these functions recursively to reduce them all to a single | ||
| 24976 | # string we can display in the simple list. | ||
| 24977 | # | ||
| 24978 | # Expected arguments | ||
| 24979 | # $arg - A hash reference | ||
| 24980 | # | ||
| 24981 | # Return values | ||
| 24982 | # 'undef' on improper arguments | ||
| 24983 | # Otherwise returns the modified string | ||
| 24984 | |||
| 24985 | my ($self, $arg, $check) = @_; | ||
| 24986 | |||
| 24987 | # Local variables | ||
| 24988 | my $string; | ||
| 24989 | |||
| 24990 | # Check for improper arguments | ||
| 24991 | if (! defined $arg || defined $check) { | ||
| 24992 | |||
| 24993 | return $axmud::CLIENT->writeImproper( | ||
| 24994 | $self->_objClass . '->msdp7Tab_parseScalar', | ||
| 24995 | @_, | ||
| 24996 | ); | ||
| 24997 | } | ||
| 24998 | |||
| 24999 | $string = ''; | ||
| 25000 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %$arg)) { | ||
| 25001 | |||
| 25002 | my $value = $$arg{$key}; | ||
| 25003 | |||
| 25004 | if (ref $value eq 'HASH') { | ||
| 25005 | $string .= ' ' . $key . ': { ' . $self->msdp7Tab_parseTable($value) . ' }'; | ||
| 25006 | } elsif (ref $value eq 'ARRAY') { | ||
| 25007 | $string .= ' ' . $key . ': ( ' . $self->msdp7Tab_parseArray($value) . ' )'; | ||
| 25008 | } else { | ||
| 25009 | $string .= ' ' . $key . ': ' . $value; | ||
| 25010 | } | ||
| 25011 | } | ||
| 25012 | |||
| 25013 | return $string; | ||
| 25014 | } | ||
| 25015 | |||
| 25016 | sub msdp8Tab { | ||
| 25017 | |||
| 25018 | # Msdp8 tab | ||
| 25019 | # | ||
| 25020 | # Expected arguments | ||
| 25021 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 25022 | # | ||
| 25023 | # Return values | ||
| 25024 | # 'undef' on improper arguments | ||
| 25025 | # 1 otherwise | ||
| 25026 | |||
| 25027 | my ($self, $innerNotebook, $check) = @_; | ||
| 25028 | |||
| 25029 | # Local variables | ||
| 25030 | my @columnList; | ||
| 25031 | |||
| 25032 | # Check for improper arguments | ||
| 25033 | if (! defined $innerNotebook || defined $check) { | ||
| 25034 | |||
| 25035 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msdp8Tab', @_); | ||
| 25036 | } | ||
| 25037 | |||
| 25038 | # Tab setup | ||
| 25039 | my $grid = $self->addTab( | ||
| 25040 | $innerNotebook, | ||
| 25041 | 'Page _8', | ||
| 25042 | ['MSDP custom reportable variables'], | ||
| 25043 | ); | ||
| 25044 | |||
| 25045 | # MSDP custom reportable variables | ||
| 25046 | $self->addLabel($grid, '<b>MSDP custom reportable variables</b>', | ||
| 25047 | 0, 12, 0, 1); | ||
| 25048 | $self->addLabel($grid, | ||
| 25049 | '<i>List of custom (unofficial) reportable variables supported by the server</i>', | ||
| 25050 | 1, 12, 1, 2); | ||
| 25051 | |||
| 25052 | # Add a simple list | ||
| 25053 | @columnList = ( | ||
| 25054 | 'Reportable', 'bool', | ||
| 25055 | 'Reported', 'bool', | ||
| 25056 | 'Sendable', 'bool', | ||
| 25057 | 'Variable', 'text', | ||
| 25058 | 'Value', 'text', | ||
| 25059 | ); | ||
| 25060 | |||
| 25061 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25062 | 1, 12, 2, 10); | ||
| 25063 | |||
| 25064 | # Initialise the list | ||
| 25065 | $self->msdp7Tab_refreshList( | ||
| 25066 | $slWidget, | ||
| 25067 | scalar (@columnList / 2), | ||
| 25068 | 'msdpCustomReportableFlagHash', | ||
| 25069 | 'msdpCustomReportedFlagHash', | ||
| 25070 | 'msdpCustomSendableFlagHash', | ||
| 25071 | 'msdpCustomValueHash', | ||
| 25072 | ); | ||
| 25073 | |||
| 25074 | # Add a button | ||
| 25075 | my $button = $self->addButton($grid, | ||
| 25076 | 'Refresh list', 'Refresh the list of reportable variables', undef, | ||
| 25077 | 9, 12, 10, 11); | ||
| 25078 | $button->signal_connect('clicked' => sub { | ||
| 25079 | |||
| 25080 | $self->msdp7Tab_refreshList( | ||
| 25081 | $slWidget, | ||
| 25082 | scalar (@columnList / 2), | ||
| 25083 | 'msdpCustomReportableFlagHash', | ||
| 25084 | 'msdpCustomReportedFlagHash', | ||
| 25085 | 'msdpCustomSendableFlagHash', | ||
| 25086 | 'msdpCustomValueHash', | ||
| 25087 | ); | ||
| 25088 | }); | ||
| 25089 | |||
| 25090 | # Tab complete | ||
| 25091 | return 1; | ||
| 25092 | } | ||
| 25093 | |||
| 25094 | sub msspTab { | ||
| 25095 | |||
| 25096 | # Mssp tab - called by $self->setupNotebook | ||
| 25097 | # | ||
| 25098 | # Expected arguments | ||
| 25099 | # (none besides $self) | ||
| 25100 | # | ||
| 25101 | # Return values | ||
| 25102 | # 'undef' on improper arguments | ||
| 25103 | # 1 otherwise | ||
| 25104 | |||
| 25105 | my ($self, $check) = @_; | ||
| 25106 | |||
| 25107 | # Check for improper arguments | ||
| 25108 | if (defined $check) { | ||
| 25109 | |||
| 25110 | return $axmud::CLIENT->writeImproper($self->_objClass . '->msspTab', @_); | ||
| 25111 | } | ||
| 25112 | |||
| 25113 | # Tab setup | ||
| 25114 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 25115 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_MSSP'); | ||
| 25116 | |||
| 25117 | # Add tabs to the inner notebook | ||
| 25118 | $self->mssp1Tab($innerNotebook); | ||
| 25119 | $self->mssp2Tab($innerNotebook); | ||
| 25120 | |||
| 25121 | return 1; | ||
| 25122 | } | ||
| 25123 | |||
| 25124 | sub mssp1Tab { | ||
| 25125 | |||
| 25126 | # Mssp1 tab | ||
| 25127 | # | ||
| 25128 | # Expected arguments | ||
| 25129 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 25130 | # | ||
| 25131 | # Return values | ||
| 25132 | # 'undef' on improper arguments | ||
| 25133 | # 1 otherwise | ||
| 25134 | |||
| 25135 | my ($self, $innerNotebook, $check) = @_; | ||
| 25136 | |||
| 25137 | # Local variables | ||
| 25138 | my @columnList; | ||
| 25139 | |||
| 25140 | # Check for improper arguments | ||
| 25141 | if (! defined $innerNotebook || defined $check) { | ||
| 25142 | |||
| 25143 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mssp1Tab', @_); | ||
| 25144 | } | ||
| 25145 | |||
| 25146 | # Tab setup | ||
| 25147 | my $grid = $self->addTab( | ||
| 25148 | $innerNotebook, | ||
| 25149 | 'Page _1', | ||
| 25150 | ['MSSP generic data'], | ||
| 25151 | ); | ||
| 25152 | |||
| 25153 | # MSSP generic data | ||
| 25154 | $self->addLabel($grid, '<b>MSSP generic data</b>', | ||
| 25155 | 0, 12, 0, 1); | ||
| 25156 | $self->addLabel($grid, | ||
| 25157 | '<i>List of generic (official) MSSP variables for the current connection\'s world</i>', | ||
| 25158 | 1, 12, 1, 2); | ||
| 25159 | |||
| 25160 | # Add a simple list | ||
| 25161 | @columnList = ( | ||
| 25162 | 'Variable', 'text', | ||
| 25163 | 'Value', 'text', | ||
| 25164 | ); | ||
| 25165 | |||
| 25166 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25167 | 1, 12, 2, 10); | ||
| 25168 | |||
| 25169 | # Initialise the list | ||
| 25170 | $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'official'); | ||
| 25171 | |||
| 25172 | # Add a button | ||
| 25173 | my $button = $self->addButton($grid, | ||
| 25174 | 'Refresh list', 'Refresh the list of MSSP variables', undef, | ||
| 25175 | 9, 12, 10, 11); | ||
| 25176 | $button->signal_connect('clicked' => sub { | ||
| 25177 | |||
| 25178 | # Refresh the simple list | ||
| 25179 | $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'official'); | ||
| 25180 | }); | ||
| 25181 | |||
| 25182 | # Tab complete | ||
| 25183 | return 1; | ||
| 25184 | } | ||
| 25185 | |||
| 25186 | sub mssp1Tab_refreshList { | ||
| 25187 | |||
| 25188 | # Resets the simple list displayed by $self->mssp1Tab and ->mssp2Tab | ||
| 25189 | # | ||
| 25190 | # Expected arguments | ||
| 25191 | # $slWidget - The GA::Obj::SimpleList | ||
| 25192 | # $columns - The number of columns | ||
| 25193 | # $type - 'official' or 'custom' | ||
| 25194 | # | ||
| 25195 | # Return values | ||
| 25196 | # 'undef' on improper arguments | ||
| 25197 | # 1 otherwise | ||
| 25198 | |||
| 25199 | my ($self, $slWidget, $columns, $type, $check) = @_; | ||
| 25200 | |||
| 25201 | # Local variables | ||
| 25202 | my ( | ||
| 25203 | @dataList, | ||
| 25204 | %ivHash, | ||
| 25205 | ); | ||
| 25206 | |||
| 25207 | # Check for improper arguments | ||
| 25208 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25209 | |||
| 25210 | return $axmud::CLIENT->writeImproper( | ||
| 25211 | $self->_objClass . '->mssp1Tab_refreshList', | ||
| 25212 | @_, | ||
| 25213 | ); | ||
| 25214 | } | ||
| 25215 | |||
| 25216 | # Import the IV from the current world profile | ||
| 25217 | if ($type eq 'official') { | ||
| 25218 | %ivHash = $self->session->currentWorld->msspGenericValueHash; | ||
| 25219 | } else { | ||
| 25220 | %ivHash = $self->session->currentWorld->msspCustomValueHash; | ||
| 25221 | } | ||
| 25222 | |||
| 25223 | # Compile the simple list data | ||
| 25224 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %ivHash)) { | ||
| 25225 | |||
| 25226 | push (@dataList, $key, $ivHash{$key}); | ||
| 25227 | } | ||
| 25228 | |||
| 25229 | # Reset the simple list | ||
| 25230 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25231 | |||
| 25232 | return 1; | ||
| 25233 | } | ||
| 25234 | |||
| 25235 | sub mssp2Tab { | ||
| 25236 | |||
| 25237 | # Mssp2 tab | ||
| 25238 | # | ||
| 25239 | # Expected arguments | ||
| 25240 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 25241 | # | ||
| 25242 | # Return values | ||
| 25243 | # 'undef' on improper arguments | ||
| 25244 | # 1 otherwise | ||
| 25245 | |||
| 25246 | my ($self, $innerNotebook, $check) = @_; | ||
| 25247 | |||
| 25248 | # Local variables | ||
| 25249 | my @columnList; | ||
| 25250 | |||
| 25251 | # Check for improper arguments | ||
| 25252 | if (! defined $innerNotebook || defined $check) { | ||
| 25253 | |||
| 25254 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mssp2Tab', @_); | ||
| 25255 | } | ||
| 25256 | |||
| 25257 | # Tab setup | ||
| 25258 | my $grid = $self->addTab( | ||
| 25259 | $innerNotebook, | ||
| 25260 | 'Page _2', | ||
| 25261 | ['MSSP custom data'], | ||
| 25262 | ); | ||
| 25263 | |||
| 25264 | # MSSP custom data | ||
| 25265 | $self->addLabel($grid, '<b>MSSP custom data</b>', | ||
| 25266 | 0, 12, 0, 1); | ||
| 25267 | $self->addLabel($grid, | ||
| 25268 | '<i>List of custom (unofficial) MSSP variables for the current connection\'s world</i>', | ||
| 25269 | 1, 12, 1, 2); | ||
| 25270 | |||
| 25271 | # Add a simple list | ||
| 25272 | @columnList = ( | ||
| 25273 | 'Variable', 'text', | ||
| 25274 | 'Value', 'text', | ||
| 25275 | ); | ||
| 25276 | |||
| 25277 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25278 | 1, 12, 2, 10); | ||
| 25279 | |||
| 25280 | # Initialise the list | ||
| 25281 | $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'custom'); | ||
| 25282 | |||
| 25283 | # Add a button | ||
| 25284 | my $button = $self->addButton($grid, | ||
| 25285 | 'Refresh list', 'Refresh the list of MSSP variables', undef, | ||
| 25286 | 9, 12, 10, 11); | ||
| 25287 | $button->signal_connect('clicked' => sub { | ||
| 25288 | |||
| 25289 | # Refresh the simple list | ||
| 25290 | $self->mssp1Tab_refreshList($slWidget, (scalar @columnList / 2), 'custom'); | ||
| 25291 | }); | ||
| 25292 | |||
| 25293 | # Tab complete | ||
| 25294 | return 1; | ||
| 25295 | } | ||
| 25296 | |||
| 25297 | sub mxpTab { | ||
| 25298 | |||
| 25299 | # Mxp tab | ||
| 25300 | # | ||
| 25301 | # Expected arguments | ||
| 25302 | # (none besides $self) | ||
| 25303 | # | ||
| 25304 | # Return values | ||
| 25305 | # 'undef' on improper arguments | ||
| 25306 | # 1 otherwise | ||
| 25307 | |||
| 25308 | my ($self, $check) = @_; | ||
| 25309 | |||
| 25310 | # Local variables | ||
| 25311 | my @columnList; | ||
| 25312 | |||
| 25313 | # Check for improper arguments | ||
| 25314 | if (defined $check) { | ||
| 25315 | |||
| 25316 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mxpTab', @_); | ||
| 25317 | } | ||
| 25318 | |||
| 25319 | # Tab setup | ||
| 25320 | my $grid = $self->addTab( | ||
| 25321 | $self->notebook, | ||
| 25322 | 'M_XP', | ||
| 25323 | ['MXP entities'], | ||
| 25324 | ); | ||
| 25325 | |||
| 25326 | # MXP entities | ||
| 25327 | $self->addLabel($grid, '<b>MXP entities</b>', | ||
| 25328 | 0, 12, 0, 1); | ||
| 25329 | $self->addLabel($grid, | ||
| 25330 | '<i>List of values stored in MXP entities (some of which may be private)</i>', | ||
| 25331 | 1, 12, 1, 2); | ||
| 25332 | |||
| 25333 | # Add a simple list | ||
| 25334 | @columnList = ( | ||
| 25335 | 'Entity name', 'text', | ||
| 25336 | 'Value', 'text', | ||
| 25337 | 'Description', 'text', | ||
| 25338 | ); | ||
| 25339 | |||
| 25340 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25341 | 1, 12, 2, 10); | ||
| 25342 | |||
| 25343 | # Initialise the list | ||
| 25344 | $self->mxpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25345 | |||
| 25346 | # Add a button | ||
| 25347 | my $button = $self->addButton($grid, | ||
| 25348 | 'Refresh list', 'Refresh the list of MXP entities', undef, | ||
| 25349 | 9, 12, 10, 11); | ||
| 25350 | $button->signal_connect('clicked' => sub { | ||
| 25351 | |||
| 25352 | $self->mxpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25353 | }); | ||
| 25354 | |||
| 25355 | # Tab complete | ||
| 25356 | return 1; | ||
| 25357 | } | ||
| 25358 | |||
| 25359 | sub mxpTab_refreshList { | ||
| 25360 | |||
| 25361 | # Resets the simple list displayed by $self->mxpTab | ||
| 25362 | # | ||
| 25363 | # Expected arguments | ||
| 25364 | # $slWidget - The GA::Obj::SimpleList | ||
| 25365 | # $columns - The number of columns | ||
| 25366 | # | ||
| 25367 | # Return values | ||
| 25368 | # 'undef' on improper arguments | ||
| 25369 | # 1 otherwise | ||
| 25370 | |||
| 25371 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 25372 | |||
| 25373 | # Local variables | ||
| 25374 | my ( | ||
| 25375 | @dataList, | ||
| 25376 | %hash, | ||
| 25377 | ); | ||
| 25378 | |||
| 25379 | # Check for improper arguments | ||
| 25380 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25381 | |||
| 25382 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mxpTab_refreshList', @_); | ||
| 25383 | } | ||
| 25384 | |||
| 25385 | # Import the hash IV | ||
| 25386 | %hash = $self->session->mxpEntityHash; | ||
| 25387 | |||
| 25388 | # Compile the simple list data | ||
| 25389 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) { | ||
| 25390 | |||
| 25391 | my ($entityObj, $value, $descrip); | ||
| 25392 | |||
| 25393 | $entityObj = $hash{$key}; | ||
| 25394 | if ($entityObj->privateFlag) { | ||
| 25395 | $value = '<private>'; | ||
| 25396 | } else { | ||
| 25397 | $value = $entityObj->value; | ||
| 25398 | } | ||
| 25399 | |||
| 25400 | if (! defined $entityObj->privateFlag) { | ||
| 25401 | $descrip = '<not set>'; | ||
| 25402 | } else { | ||
| 25403 | $descrip = $entityObj->descArg; | ||
| 25404 | } | ||
| 25405 | |||
| 25406 | push (@dataList, $entityObj->name, $value, $descrip); | ||
| 25407 | } | ||
| 25408 | |||
| 25409 | # Reset the simple list | ||
| 25410 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25411 | |||
| 25412 | return 1; | ||
| 25413 | } | ||
| 25414 | |||
| 25415 | sub zmpTab { | ||
| 25416 | |||
| 25417 | # Zmp tab | ||
| 25418 | # | ||
| 25419 | # Expected arguments | ||
| 25420 | # (none besides $self) | ||
| 25421 | # | ||
| 25422 | # Return values | ||
| 25423 | # 'undef' on improper arguments | ||
| 25424 | # 1 otherwise | ||
| 25425 | |||
| 25426 | my ($self, $check) = @_; | ||
| 25427 | |||
| 25428 | # Local variables | ||
| 25429 | my @columnList; | ||
| 25430 | |||
| 25431 | # Check for improper arguments | ||
| 25432 | if (defined $check) { | ||
| 25433 | |||
| 25434 | return $axmud::CLIENT->writeImproper($self->_objClass . '->zmpTab', @_); | ||
| 25435 | } | ||
| 25436 | |||
| 25437 | # Tab setup | ||
| 25438 | my $grid = $self->addTab( | ||
| 25439 | $self->notebook, | ||
| 25440 | '_ZMP', | ||
| 25441 | ['Supported ZMP packages'], | ||
| 25442 | ); | ||
| 25443 | |||
| 25444 | # Supported ZMP packages | ||
| 25445 | $self->addLabel($grid, '<b>Supported ZMP packages</b>', | ||
| 25446 | 0, 12, 0, 1); | ||
| 25447 | $self->addLabel($grid, | ||
| 25448 | '<i>List of supported ZMP packages/commands (ZMP packages are created by plugins)</i>', | ||
| 25449 | 1, 12, 1, 2); | ||
| 25450 | |||
| 25451 | # Add a simple list | ||
| 25452 | @columnList = ( | ||
| 25453 | 'Package', 'text', | ||
| 25454 | 'World', 'text', | ||
| 25455 | 'Commands', 'text', | ||
| 25456 | ); | ||
| 25457 | |||
| 25458 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25459 | 1, 12, 2, 10); | ||
| 25460 | |||
| 25461 | # Initialise the list | ||
| 25462 | $self->zmpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25463 | |||
| 25464 | # Add a button | ||
| 25465 | my $button = $self->addButton($grid, | ||
| 25466 | 'Refresh list', 'Refresh the list of GMCP data', undef, | ||
| 25467 | 9, 12, 10, 11); | ||
| 25468 | $button->signal_connect('clicked' => sub { | ||
| 25469 | |||
| 25470 | $self->zmpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25471 | }); | ||
| 25472 | |||
| 25473 | # Tab complete | ||
| 25474 | return 1; | ||
| 25475 | } | ||
| 25476 | |||
| 25477 | sub zmpTab_refreshList { | ||
| 25478 | |||
| 25479 | # Resets the simple list displayed by $self->zmpTab | ||
| 25480 | # | ||
| 25481 | # Expected arguments | ||
| 25482 | # $slWidget - The GA::Obj::SimpleList | ||
| 25483 | # $columns - The number of columns | ||
| 25484 | # | ||
| 25485 | # Return values | ||
| 25486 | # 'undef' on improper arguments | ||
| 25487 | # 1 otherwise | ||
| 25488 | |||
| 25489 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 25490 | |||
| 25491 | # Local variables | ||
| 25492 | my ( | ||
| 25493 | @dataList, | ||
| 25494 | %hash, | ||
| 25495 | ); | ||
| 25496 | |||
| 25497 | # Check for improper arguments | ||
| 25498 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25499 | |||
| 25500 | return $axmud::CLIENT->writeImproper($self->_objClass . '->zmpTab_refreshList', @_); | ||
| 25501 | } | ||
| 25502 | |||
| 25503 | # Actually display ZMP packages for all sessions (they're stored in a GA::Client IV, but | ||
| 25504 | # this is the most logical place to display them) | ||
| 25505 | |||
| 25506 | # Import the IV | ||
| 25507 | %hash = $axmud::CLIENT->zmpPackageHash; | ||
| 25508 | |||
| 25509 | # Compile the simple list data | ||
| 25510 | foreach my $obj (sort {lc($a->packageName) cmp lc($b->packageName)} (values %hash)) { | ||
| 25511 | |||
| 25512 | my $world; | ||
| 25513 | |||
| 25514 | if (! $obj->world) { | ||
| 25515 | $world = '<all worlds>'; | ||
| 25516 | } else { | ||
| 25517 | $world = $world; | ||
| 25518 | } | ||
| 25519 | |||
| 25520 | push ( | ||
| 25521 | @dataList, | ||
| 25522 | $obj->packageName, | ||
| 25523 | $world, | ||
| 25524 | join(' / ', sort {lc($a) cmp lc($b)} ($obj->ivKeys('cmdHash'))), | ||
| 25525 | ); | ||
| 25526 | } | ||
| 25527 | |||
| 25528 | # Reset the simple list | ||
| 25529 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25530 | |||
| 25531 | return 1; | ||
| 25532 | } | ||
| 25533 | |||
| 25534 | sub aard102Tab { | ||
| 25535 | |||
| 25536 | # Aard102 tab | ||
| 25537 | # | ||
| 25538 | # Expected arguments | ||
| 25539 | # (none besides $self) | ||
| 25540 | # | ||
| 25541 | # Return values | ||
| 25542 | # 'undef' on improper arguments | ||
| 25543 | # 1 otherwise | ||
| 25544 | |||
| 25545 | my ($self, $check) = @_; | ||
| 25546 | |||
| 25547 | # Local variables | ||
| 25548 | my @columnList; | ||
| 25549 | |||
| 25550 | # Check for improper arguments | ||
| 25551 | if (defined $check) { | ||
| 25552 | |||
| 25553 | return $axmud::CLIENT->writeImproper($self->_objClass . '->aard102Tab', @_); | ||
| 25554 | } | ||
| 25555 | |||
| 25556 | # Tab setup | ||
| 25557 | my $grid = $self->addTab( | ||
| 25558 | $self->notebook, | ||
| 25559 | 'AARD_102', | ||
| 25560 | ['AARD102 (Aardwolf 102 channel)'], | ||
| 25561 | ); | ||
| 25562 | |||
| 25563 | # AARD102 (Aardwolf 102 channel) | ||
| 25564 | $self->addLabel($grid, '<b>AARD102 (Aardwolf 102 channel)</b>', | ||
| 25565 | 0, 12, 0, 2); | ||
| 25566 | |||
| 25567 | $self->addLabel($grid, | ||
| 25568 | 'AARD102 status, as reported by the world', | ||
| 25569 | 1, 6, 2, 4); | ||
| 25570 | my $entry = $self->addEntry($grid, undef, FALSE, | ||
| 25571 | 6, 12, 2, 4); | ||
| 25572 | if (defined $self->session->aard102Status) { | ||
| 25573 | $entry->set_text($self->session->aard102Status); | ||
| 25574 | } else { | ||
| 25575 | $entry->set_text('<not received>'); | ||
| 25576 | } | ||
| 25577 | |||
| 25578 | $self->addLabel($grid, | ||
| 25579 | 'Tick time', | ||
| 25580 | 1, 6, 4, 6); | ||
| 25581 | my $entry2 = $self->addEntry($grid, undef, FALSE, | ||
| 25582 | 6, 12, 4, 6); | ||
| 25583 | if (defined $self->session->aard102TickTime) { | ||
| 25584 | $entry2->set_text($self->session->aard102TickTime); | ||
| 25585 | } else { | ||
| 25586 | $entry2->set_text('<not received>'); | ||
| 25587 | } | ||
| 25588 | |||
| 25589 | $self->addLabel($grid, | ||
| 25590 | '(Compare the session time)', | ||
| 25591 | 1, 6, 6, 8); | ||
| 25592 | my $entry3 = $self->addEntry($grid, undef, FALSE, | ||
| 25593 | 6, 12, 6, 8); | ||
| 25594 | if (defined $self->session->sessionTime) { | ||
| 25595 | |||
| 25596 | $entry3->set_text($self->session->sessionTime); | ||
| 25597 | } | ||
| 25598 | |||
| 25599 | my $button = $self->addButton($grid, | ||
| 25600 | 'Refresh list', 'Refresh the data displayed', undef, | ||
| 25601 | 10, 12, 8, 10); | ||
| 25602 | $button->signal_connect('clicked' => sub { | ||
| 25603 | |||
| 25604 | if (defined $self->session->aard102Status) { | ||
| 25605 | |||
| 25606 | $entry->set_text($self->session->aard102Status); | ||
| 25607 | } | ||
| 25608 | |||
| 25609 | if (defined $self->session->aard102TickTime) { | ||
| 25610 | |||
| 25611 | $entry2->set_text($self->session->aard102TickTime); | ||
| 25612 | } | ||
| 25613 | |||
| 25614 | if (defined $self->session->sessionTime) { | ||
| 25615 | |||
| 25616 | $entry3->set_text($self->session->sessionTime); | ||
| 25617 | } | ||
| 25618 | }); | ||
| 25619 | |||
| 25620 | # Tab complete | ||
| 25621 | return 1; | ||
| 25622 | } | ||
| 25623 | |||
| 25624 | sub atcpTab { | ||
| 25625 | |||
| 25626 | # Atcp tab | ||
| 25627 | # | ||
| 25628 | # Expected arguments | ||
| 25629 | # (none besides $self) | ||
| 25630 | # | ||
| 25631 | # Return values | ||
| 25632 | # 'undef' on improper arguments | ||
| 25633 | # 1 otherwise | ||
| 25634 | |||
| 25635 | my ($self, $check) = @_; | ||
| 25636 | |||
| 25637 | # Local variables | ||
| 25638 | my @columnList; | ||
| 25639 | |||
| 25640 | # Check for improper arguments | ||
| 25641 | if (defined $check) { | ||
| 25642 | |||
| 25643 | return $axmud::CLIENT->writeImproper($self->_objClass . '->atcpTab', @_); | ||
| 25644 | } | ||
| 25645 | |||
| 25646 | # Tab setup | ||
| 25647 | my $grid = $self->addTab( | ||
| 25648 | $self->notebook, | ||
| 25649 | '_ATCP', | ||
| 25650 | ['ATCP data'], | ||
| 25651 | ); | ||
| 25652 | |||
| 25653 | # ATCP data | ||
| 25654 | $self->addLabel($grid, '<b>ATCP data</b>', | ||
| 25655 | 0, 12, 0, 1); | ||
| 25656 | $self->addLabel($grid, | ||
| 25657 | '<i>List of data supplied by the current world using the ATCP protocol</i>', | ||
| 25658 | 1, 12, 1, 2); | ||
| 25659 | |||
| 25660 | # Add a simple list | ||
| 25661 | @columnList = ( | ||
| 25662 | 'Package', 'text', | ||
| 25663 | 'Data', 'text', | ||
| 25664 | ); | ||
| 25665 | |||
| 25666 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25667 | 1, 12, 2, 10); | ||
| 25668 | |||
| 25669 | # Initialise the list | ||
| 25670 | $self->atcpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25671 | |||
| 25672 | # Add a button | ||
| 25673 | my $button = $self->addButton($grid, | ||
| 25674 | 'Refresh list', 'Refresh the list of ATCP data', undef, | ||
| 25675 | 9, 12, 10, 11); | ||
| 25676 | $button->signal_connect('clicked' => sub { | ||
| 25677 | |||
| 25678 | $self->atcpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25679 | }); | ||
| 25680 | |||
| 25681 | # Tab complete | ||
| 25682 | return 1; | ||
| 25683 | } | ||
| 25684 | |||
| 25685 | sub atcpTab_refreshList { | ||
| 25686 | |||
| 25687 | # Resets the simple list displayed by $self->atcpTab | ||
| 25688 | # | ||
| 25689 | # Expected arguments | ||
| 25690 | # $slWidget - The GA::Obj::SimpleList | ||
| 25691 | # $columns - The number of columns | ||
| 25692 | # | ||
| 25693 | # Return values | ||
| 25694 | # 'undef' on improper arguments | ||
| 25695 | # 1 otherwise | ||
| 25696 | |||
| 25697 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 25698 | |||
| 25699 | # Local variables | ||
| 25700 | my ( | ||
| 25701 | @dataList, | ||
| 25702 | %hash, | ||
| 25703 | ); | ||
| 25704 | |||
| 25705 | # Check for improper arguments | ||
| 25706 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25707 | |||
| 25708 | return $axmud::CLIENT->writeImproper($self->_objClass . '->atcpTab_refreshList', @_); | ||
| 25709 | } | ||
| 25710 | |||
| 25711 | # Import the hash IV | ||
| 25712 | %hash = $self->session->atcpDataHash; | ||
| 25713 | |||
| 25714 | # Compile the simple list data | ||
| 25715 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) { | ||
| 25716 | |||
| 25717 | my $dataObj = $hash{$key}; | ||
| 25718 | |||
| 25719 | push (@dataList, $key, $axmud::CLIENT->encodeJson($dataObj->data)); | ||
| 25720 | } | ||
| 25721 | |||
| 25722 | # Reset the simple list | ||
| 25723 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25724 | |||
| 25725 | return 1; | ||
| 25726 | } | ||
| 25727 | |||
| 25728 | sub gmcpTab { | ||
| 25729 | |||
| 25730 | # Gmcp tab | ||
| 25731 | # | ||
| 25732 | # Expected arguments | ||
| 25733 | # (none besides $self) | ||
| 25734 | # | ||
| 25735 | # Return values | ||
| 25736 | # 'undef' on improper arguments | ||
| 25737 | # 1 otherwise | ||
| 25738 | |||
| 25739 | my ($self, $check) = @_; | ||
| 25740 | |||
| 25741 | # Local variables | ||
| 25742 | my @columnList; | ||
| 25743 | |||
| 25744 | # Check for improper arguments | ||
| 25745 | if (defined $check) { | ||
| 25746 | |||
| 25747 | return $axmud::CLIENT->writeImproper($self->_objClass . '->gmcpTab', @_); | ||
| 25748 | } | ||
| 25749 | |||
| 25750 | # Tab setup | ||
| 25751 | my $grid = $self->addTab( | ||
| 25752 | $self->notebook, | ||
| 25753 | '_GMCP', | ||
| 25754 | ['GMCP data'], | ||
| 25755 | ); | ||
| 25756 | |||
| 25757 | # GMCP data | ||
| 25758 | $self->addLabel($grid, '<b>GMCP data</b>', | ||
| 25759 | 0, 12, 0, 1); | ||
| 25760 | $self->addLabel($grid, | ||
| 25761 | '<i>List of data supplied by the current world using the GMCP protocol</i>', | ||
| 25762 | 1, 12, 1, 2); | ||
| 25763 | |||
| 25764 | # Add a simple list | ||
| 25765 | @columnList = ( | ||
| 25766 | 'Package', 'text', | ||
| 25767 | 'Data', 'text', | ||
| 25768 | ); | ||
| 25769 | |||
| 25770 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25771 | 1, 12, 2, 10); | ||
| 25772 | |||
| 25773 | # Initialise the list | ||
| 25774 | $self->gmcpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25775 | |||
| 25776 | # Add a button | ||
| 25777 | my $button = $self->addButton($grid, | ||
| 25778 | 'Refresh list', 'Refresh the list of GMCP data', undef, | ||
| 25779 | 9, 12, 10, 11); | ||
| 25780 | $button->signal_connect('clicked' => sub { | ||
| 25781 | |||
| 25782 | $self->gmcpTab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25783 | }); | ||
| 25784 | |||
| 25785 | # Tab complete | ||
| 25786 | return 1; | ||
| 25787 | } | ||
| 25788 | |||
| 25789 | sub gmcpTab_refreshList { | ||
| 25790 | |||
| 25791 | # Resets the simple list displayed by $self->gmcpTab | ||
| 25792 | # | ||
| 25793 | # Expected arguments | ||
| 25794 | # $slWidget - The GA::Obj::SimpleList | ||
| 25795 | # $columns - The number of columns | ||
| 25796 | # | ||
| 25797 | # Return values | ||
| 25798 | # 'undef' on improper arguments | ||
| 25799 | # 1 otherwise | ||
| 25800 | |||
| 25801 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 25802 | |||
| 25803 | # Local variables | ||
| 25804 | my ( | ||
| 25805 | @dataList, | ||
| 25806 | %hash, | ||
| 25807 | ); | ||
| 25808 | |||
| 25809 | # Check for improper arguments | ||
| 25810 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25811 | |||
| 25812 | return $axmud::CLIENT->writeImproper($self->_objClass . '->gmcpTab_refreshList', @_); | ||
| 25813 | } | ||
| 25814 | |||
| 25815 | # Import the hash IV | ||
| 25816 | %hash = $self->session->gmcpDataHash; | ||
| 25817 | |||
| 25818 | # Compile the simple list data | ||
| 25819 | foreach my $key (sort {lc($a) cmp lc($b)} (keys %hash)) { | ||
| 25820 | |||
| 25821 | my $dataObj = $hash{$key}; | ||
| 25822 | |||
| 25823 | push (@dataList, $key, $axmud::CLIENT->encodeJson($dataObj->data)); | ||
| 25824 | } | ||
| 25825 | |||
| 25826 | # Reset the simple list | ||
| 25827 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25828 | |||
| 25829 | return 1; | ||
| 25830 | } | ||
| 25831 | |||
| 25832 | sub mcpTab { | ||
| 25833 | |||
| 25834 | # Mcp tab - called by $self->setupNotebook | ||
| 25835 | # | ||
| 25836 | # Expected arguments | ||
| 25837 | # (none besides $self) | ||
| 25838 | # | ||
| 25839 | # Return values | ||
| 25840 | # 'undef' on improper arguments | ||
| 25841 | # 1 otherwise | ||
| 25842 | |||
| 25843 | my ($self, $check) = @_; | ||
| 25844 | |||
| 25845 | # Check for improper arguments | ||
| 25846 | if (defined $check) { | ||
| 25847 | |||
| 25848 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mcpTab', @_); | ||
| 25849 | } | ||
| 25850 | |||
| 25851 | # Tab setup | ||
| 25852 | # Create a notebook within the main one, so that we have two rows of tabs | ||
| 25853 | my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'M_CP'); | ||
| 25854 | |||
| 25855 | # Add tabs to the inner notebook | ||
| 25856 | $self->mcp1Tab($innerNotebook); | ||
| 25857 | $self->mcp2Tab($innerNotebook); | ||
| 25858 | |||
| 25859 | return 1; | ||
| 25860 | } | ||
| 25861 | |||
| 25862 | sub mcp1Tab { | ||
| 25863 | |||
| 25864 | # Mcp1 tab | ||
| 25865 | # | ||
| 25866 | # Expected arguments | ||
| 25867 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 25868 | # | ||
| 25869 | # Return values | ||
| 25870 | # 'undef' on improper arguments | ||
| 25871 | # 1 otherwise | ||
| 25872 | |||
| 25873 | my ($self, $innerNotebook, $check) = @_; | ||
| 25874 | |||
| 25875 | # Local variables | ||
| 25876 | my @columnList; | ||
| 25877 | |||
| 25878 | # Check for improper arguments | ||
| 25879 | if (! defined $innerNotebook || defined $check) { | ||
| 25880 | |||
| 25881 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp1Tab', @_); | ||
| 25882 | } | ||
| 25883 | |||
| 25884 | # Tab setup | ||
| 25885 | my $grid = $self->addTab( | ||
| 25886 | $innerNotebook, | ||
| 25887 | 'Page _1', | ||
| 25888 | ['MCP supported packages'], | ||
| 25889 | ); | ||
| 25890 | |||
| 25891 | # MCP supported packages | ||
| 25892 | $self->addLabel($grid, '<b>MCP supported packages</b>', | ||
| 25893 | 0, 12, 0, 1); | ||
| 25894 | $self->addLabel($grid, | ||
| 25895 | '<i>List of MCP packages supported by ' . $axmud::SCRIPT | ||
| 25896 | . ', or defined by a plugin</i>', | ||
| 25897 | 1, 12, 1, 2); | ||
| 25898 | |||
| 25899 | # Add a simple list | ||
| 25900 | @columnList = ( | ||
| 25901 | 'Package', 'text', | ||
| 25902 | 'Plugin', 'text', | ||
| 25903 | 'Min version', 'text', | ||
| 25904 | 'Max version', 'text', | ||
| 25905 | 'Other packages supplanted', 'text', | ||
| 25906 | ); | ||
| 25907 | |||
| 25908 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 25909 | 1, 12, 2, 10); | ||
| 25910 | |||
| 25911 | # Initialise the list | ||
| 25912 | $self->mcp1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25913 | |||
| 25914 | # Add a button | ||
| 25915 | my $button = $self->addButton($grid, | ||
| 25916 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 25917 | 9, 12, 10, 11); | ||
| 25918 | $button->signal_connect('clicked' => sub { | ||
| 25919 | |||
| 25920 | $self->mcp1Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 25921 | }); | ||
| 25922 | |||
| 25923 | # Tab complete | ||
| 25924 | return 1; | ||
| 25925 | } | ||
| 25926 | |||
| 25927 | sub mcp1Tab_refreshList { | ||
| 25928 | |||
| 25929 | # Resets the simple list displayed by $self->mcp1Tab | ||
| 25930 | # | ||
| 25931 | # Expected arguments | ||
| 25932 | # $slWidget - The GA::Obj::SimpleList | ||
| 25933 | # $columns - The number of columns | ||
| 25934 | # | ||
| 25935 | # Return values | ||
| 25936 | # 'undef' on improper arguments | ||
| 25937 | # 1 otherwise | ||
| 25938 | |||
| 25939 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 25940 | |||
| 25941 | # Local variables | ||
| 25942 | my ( | ||
| 25943 | @dataList, | ||
| 25944 | %hash, | ||
| 25945 | ); | ||
| 25946 | |||
| 25947 | # Check for improper arguments | ||
| 25948 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 25949 | |||
| 25950 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp1Tab_refreshList', @_); | ||
| 25951 | } | ||
| 25952 | |||
| 25953 | # Import the hash IV | ||
| 25954 | %hash = $axmud::CLIENT->mcpPackageHash; | ||
| 25955 | |||
| 25956 | # Compile the simple list data | ||
| 25957 | foreach my $obj (sort {lc($a->name) cmp lc($b->name)} (values %hash)) { | ||
| 25958 | |||
| 25959 | my $plugin; | ||
| 25960 | |||
| 25961 | if (defined $obj->plugin) { | ||
| 25962 | $plugin = $obj->plugin; | ||
| 25963 | } else { | ||
| 25964 | $plugin = 'n/a'; | ||
| 25965 | } | ||
| 25966 | |||
| 25967 | push (@dataList, | ||
| 25968 | $obj->name, | ||
| 25969 | $plugin, | ||
| 25970 | $obj->minVersion, | ||
| 25971 | $obj->maxVersion, | ||
| 25972 | join(' ', $obj->supplantList), | ||
| 25973 | ); | ||
| 25974 | } | ||
| 25975 | |||
| 25976 | # Reset the simple list | ||
| 25977 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 25978 | |||
| 25979 | return 1; | ||
| 25980 | } | ||
| 25981 | |||
| 25982 | sub mcp2Tab { | ||
| 25983 | |||
| 25984 | # Mcp2 tab | ||
| 25985 | # | ||
| 25986 | # Expected arguments | ||
| 25987 | # $innerNotebook - The Gtk3::Notebook object inside $self->notebook | ||
| 25988 | # | ||
| 25989 | # Return values | ||
| 25990 | # 'undef' on improper arguments | ||
| 25991 | # 1 otherwise | ||
| 25992 | |||
| 25993 | my ($self, $innerNotebook, $check) = @_; | ||
| 25994 | |||
| 25995 | # Local variables | ||
| 25996 | my @columnList; | ||
| 25997 | |||
| 25998 | # Check for improper arguments | ||
| 25999 | if (! defined $innerNotebook || defined $check) { | ||
| 26000 | |||
| 26001 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp2Tab', @_); | ||
| 26002 | } | ||
| 26003 | |||
| 26004 | # Tab setup | ||
| 26005 | my $grid = $self->addTab( | ||
| 26006 | $innerNotebook, | ||
| 26007 | 'Page _2', | ||
| 26008 | ['MCP packages in use'], | ||
| 26009 | ); | ||
| 26010 | |||
| 26011 | # MCP packages in use | ||
| 26012 | $self->addLabel($grid, '<b>MCP packages in use</b>', | ||
| 26013 | 0, 12, 0, 1); | ||
| 26014 | $self->addLabel($grid, | ||
| 26015 | '<i>List of MCP packages in use by this session (supported by both the world and ' | ||
| 26016 | . $axmud::SCRIPT . ')</i>', | ||
| 26017 | 1, 12, 1, 2); | ||
| 26018 | |||
| 26019 | # Add a simple list | ||
| 26020 | @columnList = ( | ||
| 26021 | 'Package', 'text', | ||
| 26022 | 'Plugin', 'text', | ||
| 26023 | 'Used version', 'text', | ||
| 26024 | ); | ||
| 26025 | |||
| 26026 | my $slWidget = $self->addSimpleList($grid, undef, \@columnList, | ||
| 26027 | 1, 12, 2, 10); | ||
| 26028 | |||
| 26029 | # Initialise the list | ||
| 26030 | $self->mcp2Tab_refreshList($slWidget, scalar (@columnList / 2)); | ||
| 26031 | |||
| 26032 | # Add a button | ||
| 26033 | my $button = $self->addButton($grid, | ||
| 26034 | 'Refresh list', 'Refresh the list of packages', undef, | ||
| 26035 | 9, 12, 10, 11); | ||
| 26036 | $button->signal_connect('clicked' => sub { | ||
| 26037 | |||
| 26038 | $self->list($slWidget, scalar (@columnList / 2)); | ||
| 26039 | }); | ||
| 26040 | |||
| 26041 | # Tab complete | ||
| 26042 | return 1; | ||
| 26043 | } | ||
| 26044 | |||
| 26045 | sub mcp2Tab_refreshList { | ||
| 26046 | |||
| 26047 | # Resets the simple list displayed by $self->mcp2Tab | ||
| 26048 | # | ||
| 26049 | # Expected arguments | ||
| 26050 | # $slWidget - The GA::Obj::SimpleList | ||
| 26051 | # $columns - The number of columns | ||
| 26052 | # | ||
| 26053 | # Return values | ||
| 26054 | # 'undef' on improper arguments | ||
| 26055 | # 1 otherwise | ||
| 26056 | |||
| 26057 | my ($self, $slWidget, $columns, $check) = @_; | ||
| 26058 | |||
| 26059 | # Local variables | ||
| 26060 | my ( | ||
| 26061 | @dataList, | ||
| 26062 | %hash, | ||
| 26063 | ); | ||
| 26064 | |||
| 26065 | # Check for improper arguments | ||
| 26066 | if (! defined $slWidget || ! defined $columns || defined $check) { | ||
| 26067 | |||
| 26068 | return $axmud::CLIENT->writeImproper($self->_objClass . '->mcp2Tab_refreshList', @_); | ||
| 26069 | } | ||
| 26070 | |||
| 26071 | # Import the hash IV | ||
| 26072 | %hash = $self->session->mcpPackageHash; | ||
| 26073 | |||
| 26074 | # Compile the simple list data | ||
| 26075 | foreach my $obj (sort {lc($a->name) cmp lc($b->name)} (values %hash)) { | ||
| 26076 | |||
| 26077 | my $plugin; | ||
| 26078 | |||
| 26079 | if (defined $obj->plugin) { | ||
| 26080 | $plugin = $obj->plugin; | ||
| 26081 | } else { | ||
| 26082 | $plugin = 'n/a'; | ||
| 26083 | } | ||
| 26084 | |||
| 26085 | push (@dataList, | ||
| 26086 | $obj->name, | ||
| 26087 | $plugin, | ||
| 26088 | $obj->useVersion, | ||
| 26089 | ); | ||
| 26090 | } | ||
| 26091 | |||
| 26092 | # Reset the simple list | ||
| 26093 | $self->resetListData($slWidget, [@dataList], $columns); | ||
| 26094 | |||
| 26095 | return 1; | ||
| 26096 | } | ||
| 26097 | |||
| 26098 | ################## | ||
| 26099 | # Accessors - set | ||
| 26100 | |||
| 26101 | ################## | ||
| 26102 | # Accessors - get | ||
| 26103 | } | ||
| 26104 | |||
| 26105 | { package Games::Axmud::PrefWin::TaskStart; | ||
| 26106 | |||
| 26107 | use strict; | ||
| 26108 | use warnings; | ||
| 26109 | # use diagnostics; | ||
| 26110 | |||
| 26111 | use Glib qw(TRUE FALSE); | ||
| 26112 | |||
| 26113 | our @ISA = qw( | ||
| 26114 | Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin | ||
| 26115 | Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud | ||
| 26116 | ); | ||
| 26117 | |||
| 26118 | ################## | ||
| 26119 | # Constructors | ||
| 26120 | |||
| 26121 | # Contents of $self->editConfigHash after $self->new has been called: | ||
| 26122 | # 'type' => The task type: 'current', 'global_initial', 'profile_initial' or 'custom' | ||
| 26123 | # 'task_name' => The task's standard ->name, e.g. 'status_task', 'locator_task' | ||
| 26124 | # 'prof_name' => Name of the task's parent profile ('undef' if no parent profile) | ||
| 26125 | |||
| 26126 | # sub new {} # Inherited from GA::Generic::ConfigWin | ||
| 26127 | |||
| 26128 | ################## | ||
| 26129 | # Methods | ||
| 26130 | |||
| 26131 | # Standard window object functions | ||
| 26132 | |||
| 26133 | # sub winSetup {} # Inherited from GA::Generic::ConfigWin | ||
| 26134 | |||
| 26135 | # sub winEnable {} # Inherited from GA::Generic::ConfigWin | ||
| 26136 | |||
| 26137 | # sub winDesengage {} # Inherited from GA::Generic::FreeWin | ||
| 26138 | |||
| 26139 | # sub winDestroy {} # Inherited from GA::Generic::FreeWin | ||
| 26140 | |||
| 26141 | # sub winShowAll {} # Inherited from GA::Generic::Win | ||
| 26142 | |||
| 26143 | # sub drawWidgets {} # Inherited from GA::Generic::ConfigWin | ||
| 26144 | |||
| 26145 | # sub redrawWidgets {} # Inherited from GA::Generic::Win | ||
| 26146 | |||
| 26147 | # ->signal_connects | ||
| 26148 | |||
| 26149 | # Other functions | ||
| 26150 | |||
| 26151 | # sub checkEditObj {} # Inherited from GA::Generic::ConfigWin | ||
| 26152 | |||
| 26153 | sub enableButtons { | ||
| 26154 | |||
| 26155 | # Called by $self->drawWidgets | ||
| 26156 | # Creates the Start task/Cancel buttons at the bottom of the window | ||
| 26157 | # | ||
| 26158 | # Expected arguments | ||
| 26159 | # $hBox - The horizontal packing box in which the buttons live | ||
| 26160 | # | ||
| 26161 | # Return values | ||
| 26162 | # An empty list on improper arguments | ||
| 26163 | # Otherwise, a list containing the two Gtk::Button objects created | ||
| 26164 | |||
| 26165 | my ($self, $hBox, $check) = @_; | ||
| 26166 | |||
| 26167 | # Local variables | ||
| 26168 | my ( | ||
| 26169 | $type, $taskName, $profName, $radioChoice, $radioChoice2, | ||
| 26170 | @emptyList, | ||
| 26171 | ); | ||
| 26172 | |||
| 26173 | # Check for improper arguments | ||
| 26174 | if (! defined $hBox || defined $check) { | ||
| 26175 | |||
| 26176 | $axmud::CLIENT->writeImproper($self->_objClass . '->enableButtons', @_); | ||
| 26177 | return @emptyList; | ||
| 26178 | } | ||
| 26179 | |||
| 26180 | # Extract keys from $self->editConfigHash | ||
| 26181 | $type = $self->ivShow('editConfigHash', 'type'); | ||
| 26182 | $taskName = $self->ivShow('editConfigHash', 'task_name'); | ||
| 26183 | $profName = $self->ivShow('editConfigHash', 'prof_name'); | ||
| 26184 | |||
| 26185 | # Create the 'Start task' / 'Add task' button in place of the OK button. For custom tasks, | ||
| 26186 | # the button starts desensitised | ||
| 26187 | my $okButton; | ||
| 26188 | if ($type eq 'current') { | ||
| 26189 | |||
| 26190 | # Tasks in the current tasklist | ||
| 26191 | $okButton = Gtk3::Button->new('Start task'); | ||
| 26192 | $okButton->set_tooltip_text('Start task with these options'); | ||
| 26193 | |||
| 26194 | } else { | ||
| 26195 | |||
| 26196 | # Tasks not in the current tasklist | ||
| 26197 | $okButton = Gtk3::Button->new('Add task'); | ||
| 26198 | $okButton->set_tooltip_text('Add task with these options'); | ||
| 26199 | |||
| 26200 | if ($type eq 'custom') { | ||
| 26201 | |||
| 26202 | $okButton->set_sensitive(FALSE); | ||
| 26203 | } | ||
| 26204 | } | ||
| 26205 | |||
| 26206 | $okButton->signal_connect('clicked' => sub { | ||
| 26207 | |||
| 26208 | my $cmd; | ||
| 26209 | |||
| 26210 | # Prepare the client command to execute, e.g. ';starttask -e status_task -f 2000 -w' | ||
| 26211 | if ($type eq 'current') { | ||
| 26212 | |||
| 26213 | $cmd = 'starttask ' . $taskName; | ||
| 26214 | |||
| 26215 | } elsif ($type eq 'global_initial') { | ||
| 26216 | |||
| 26217 | $cmd = 'addinitialtask ' . $taskName; | ||
| 26218 | |||
| 26219 | } elsif ($type eq 'profile_initial') { | ||
| 26220 | |||
| 26221 | $cmd = 'addinitialtask ' . $taskName . ' ' . $profName; | ||
| 26222 | |||
| 26223 | } elsif ($type eq 'custom') { | ||
| 26224 | |||
| 26225 | $cmd = 'addcustomtask ' . $taskName . ' ' . $self->ivShow('editHash', 'entry'); | ||
| 26226 | |||
| 26227 | } else { | ||
| 26228 | |||
| 26229 | return $self->writeError( | ||
| 26230 | 'Unrecognised task type \'' . $type . '\'', | ||
| 26231 | $self->_objClass . '->setupNotebook', | ||
| 26232 | ); | ||
| 26233 | } | ||
| 26234 | |||
| 26235 | if ($self->ivExists('editHash', 'radio_choice')) { | ||
| 26236 | |||
| 26237 | $radioChoice = $self->ivShow('editHash', 'radio_choice'); | ||
| 26238 | |||
| 26239 | if ($radioChoice == 1 && $self->ivExists('editHash', 'combo')) { | ||
| 26240 | $cmd .= ' -e ' . $self->ivShow('editHash', 'combo'); | ||
| 26241 | } elsif ($radioChoice == 2 && $self->ivExists('editHash', 'combo_2')) { | ||
| 26242 | $cmd .= ' -n ' . $self->ivShow('editHash', 'combo_2'); | ||
| 26243 | } elsif ($radioChoice == 3 && $self->ivExists('editHash', 'combo_3')) { | ||
| 26244 | $cmd .= ' -s ' . $self->ivShow('editHash', 'combo_3'); | ||
| 26245 | } elsif ($radioChoice == 4 && $self->ivExists('editHash', 'entry_2')) { | ||
| 26246 | $cmd .= ' -t ' . $self->ivShow('editHash', 'entry_2'); | ||
| 26247 | } | ||
| 26248 | } | ||
| 26249 | |||
| 26250 | if ($self->ivExists('editHash', 'radio_choice_2')) { | ||
| 26251 | |||
| 26252 | $radioChoice2 = $self->ivShow('editHash', 'radio_choice_2'); | ||
| 26253 | |||
| 26254 | if ($radioChoice2 == 1 && $self->ivExists('editHash', 'entry_3')) { | ||
| 26255 | $cmd .= ' -f ' . $self->ivShow('editHash', 'entry_3'); | ||
| 26256 | } elsif ($radioChoice2 == 2 && $self->ivExists('editHash', 'entry_4')) { | ||
| 26257 | $cmd .= ' -u ' . $self->ivShow('editHash', 'entry_4'); | ||
| 26258 | } | ||
| 26259 | } | ||
| 26260 | |||
| 26261 | if ($self->ivExists('editHash', 'check_button')) { | ||
| 26262 | |||
| 26263 | $cmd .= ' -w'; | ||
| 26264 | } | ||
| 26265 | |||
| 26266 | # Execute the client command | ||
| 26267 | $self->session->pseudoCmd($cmd, $self->pseudoCmdMode); | ||
| 26268 | |||
| 26269 | # Close the 'pref' window | ||
| 26270 | $self->winDestroy(); | ||
| 26271 | }); | ||
| 26272 | |||
| 26273 | $hBox->pack_end($okButton, FALSE, FALSE, $self->borderPixels); | ||
| 26274 | |||
| 26275 | # Create the cancel button | ||
| 26276 | my $cancelButton = Gtk3::Button->new('Cancel'); | ||
| 26277 | $cancelButton->signal_connect('clicked' => sub { | ||
| 26278 | |||
| 26279 | $self->buttonCancel(); | ||
| 26280 | }); | ||
| 26281 | $cancelButton->set_tooltip_text('Cancel'); | ||
| 26282 | $hBox->pack_end($cancelButton, FALSE, FALSE, $self->spacingPixels); | ||
| 26283 | |||
| 26284 | return ($okButton, $cancelButton); | ||
| 26285 | } | ||
| 26286 | |||
| 26287 | # sub enableSingleButton {} # Inherited from GA::Generic::ConfigWin | ||
| 26288 | |||
| 26289 | sub setupNotebook { | ||
| 26290 | |||
| 26291 | # Called by $self->winEnable | ||
| 26292 | # Creates the first tab for the notebook. The remaining tabs are created by | ||
| 26293 | # $self->expandNotebook | ||
| 26294 | # | ||
| 26295 | # Expected arguments | ||
| 26296 | # (none besides $self) | ||
| 26297 | # | ||
| 26298 | # Return values | ||
| 26299 | # 'undef' on improper arguments | ||
| 26300 | # 1 otherwise | ||
| 26301 | |||
| 26302 | my ($self, $check) = @_; | ||
| 26303 | |||
| 26304 | # Local variables | ||
| 26305 | my $type; | ||
| 26306 | |||
| 26307 | # Check for improper arguments | ||
| 26308 | if (defined $check) { | ||
| 26309 | |||
| 26310 | return $axmud::CLIENT->writeImproper($self->_objClass . '->setupNotebook', @_); | ||
| 26311 | } | ||
| 26312 | |||
| 26313 | # Extract data from $self->editConfigHash | ||
| 26314 | $type = $self->ivShow('editConfigHash', 'type'); | ||
| 26315 | |||
| 26316 | # Tab setup, using the standard grid size | ||
| 26317 | my $grid; | ||
| 26318 | |||
| 26319 | if ($type eq 'current') { | ||
| 26320 | |||
| 26321 | # Current tasklist tasks | ||
| 26322 | $grid = $self->addTab( | ||
| 26323 | $self->notebook, | ||
| 26324 | '_Current task', | ||
| 26325 | ['Start options', 'Stop options', 'Task window options'], | ||
| 26326 | ); | ||
| 26327 | |||
| 26328 | } elsif ( | ||
| 26329 | $type eq 'global_initial' | ||
| 26330 | || $type eq 'profile_initial' | ||
| 26331 | ) { | ||
| 26332 | # Initial tasklist tasks | ||
| 26333 | $grid = $self->addTab( | ||
| 26334 | $self->notebook, | ||
| 26335 | '_Initial task', | ||
| 26336 | ['Start options', 'Stop options', 'Task window options'], | ||
| 26337 | ); | ||
| 26338 | |||
| 26339 | } else { | ||
| 26340 | |||
| 26341 | # Custom tasklist tasks | ||
| 26342 | $grid = $self->addTab( | ||
| 26343 | $self->notebook, | ||
| 26344 | 'Custo_m task', | ||
| 26345 | ['Start options', 'Stop options', 'Task window options'], | ||
| 26346 | ); | ||
| 26347 | } | ||
| 26348 | |||
| 26349 | # Set up the rest of the tab | ||
| 26350 | $self->taskTab($grid); | ||
| 26351 | |||
| 26352 | # Set up the remaining tabs | ||
| 26353 | $self->expandNotebook(); | ||
| 26354 | |||
| 26355 | # Tab complete | ||
| 26356 | return 1; | ||
| 26357 | } | ||
| 26358 | |||
| 26359 | # sub expandNotebook {} # Inherited from GA::Generic::ConfigWin | ||
| 26360 | |||
| 26361 | # sub saveChanges {} # Inherited from GA::Generic::ConfigWin | ||
| 26362 | |||
| 26363 | # Notebook tabs | ||
| 26364 | |||
| 26365 | sub taskTab { | ||
| 26366 | |||
| 26367 | # Task tab - called by $self->setupNotebook | ||
| 26368 | # | ||
| 26369 | # Expected arguments | ||
| 26370 | # $grid - The Gtk3::Grid for this tab | ||
| 26371 | # | ||
| 26372 | # Return values | ||
| 26373 | # 'undef' on improper arguments | ||
| 26374 | # 1 otherwise | ||
| 26375 | |||
| 26376 | my ($self, $grid, $check) = @_; | ||
| 26377 | |||
| 26378 | # Local variables | ||
| 26379 | my ( | ||
| 26380 | $type, | ||
| 26381 | @taskList, | ||
| 26382 | ); | ||
| 26383 | |||
| 26384 | # Check for improper arguments | ||
| 26385 | if (defined $check) { | ||
| 26386 | |||
| 26387 | return $axmud::CLIENT->writeImproper($self->_objClass . '->taskTab', @_); | ||
| 26388 | } | ||
| 26389 | |||
| 26390 | # Tab setup (already created by the calling function) | ||
| 26391 | |||
| 26392 | # Get a list of available tasks (actually, the list of task standard names) | ||
| 26393 | @taskList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('taskPackageHash')); | ||
| 26394 | # Extract data from $self->editConfigHash | ||
| 26395 | $type = $self->ivShow('editConfigHash', 'type'); | ||
| 26396 | |||
| 26397 | # Start options | ||
| 26398 | my $entry; | ||
| 26399 | if ($type eq 'custom') { | ||
| 26400 | |||
| 26401 | # Custom tasklist tasks | ||
| 26402 | $self->addLabel($grid, '<b>Start options</b> - Custom task name (3-32 chars):', | ||
| 26403 | 0, 8, 0, 1); | ||
| 26404 | $entry = $self->addEntryWithIcon($grid, undef, 'string', 3, 32, | ||
| 26405 | 8, 12, 0, 1); | ||
| 26406 | $entry->signal_connect('changed' => sub { | ||
| 26407 | |||
| 26408 | my $text = $entry->get_text(); | ||
| 26409 | |||
| 26410 | if ($self->checkEntryIcon($entry)) { | ||
| 26411 | |||
| 26412 | $self->ivAdd('editHash', 'entry', $text); | ||
| 26413 | $self->okButton->set_sensitive(TRUE); | ||
| 26414 | |||
| 26415 | } else { | ||
| 26416 | |||
| 26417 | $self->ivDelete('editHash', 'entry'); | ||
| 26418 | $self->okButton->set_sensitive(FALSE); | ||
| 26419 | } | ||
| 26420 | }); | ||
| 26421 | |||
| 26422 | } else { | ||
| 26423 | |||
| 26424 | # Current tasklist / initial tasklist tasks | ||
| 26425 | $self->addLabel($grid, '<b>Start options</b>', | ||
| 26426 | 0, 12, 0, 1); | ||
| 26427 | } | ||
| 26428 | |||
| 26429 | my ($group, $radioButton) = $self->addRadioButton( | ||
| 26430 | $grid, undef, | ||
| 26431 | 'Start the task immediately', | ||
| 26432 | undef, undef, TRUE, | ||
| 26433 | 1, 12, 1, 2); | ||
| 26434 | $radioButton->signal_connect('toggled' => sub { | ||
| 26435 | |||
| 26436 | $self->ivAdd('editHash', 'radio_choice', 0); | ||
| 26437 | }); | ||
| 26438 | |||
| 26439 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26440 | $grid, $group, | ||
| 26441 | 'Wait for another task to exist, before starting:', | ||
| 26442 | undef, undef, TRUE, | ||
| 26443 | 1, 8, 2, 3); | ||
| 26444 | $radioButton->signal_connect('toggled' => sub { | ||
| 26445 | |||
| 26446 | $self->ivAdd('editHash', 'radio_choice', 1); | ||
| 26447 | }); | ||
| 26448 | my $comboBox = $self->addComboBox($grid, undef, \@taskList, 'Select task', | ||
| 26449 | FALSE, # 'undef' value allowed | ||
| 26450 | 8, 12, 2, 3); | ||
| 26451 | $comboBox->signal_connect('changed' => sub { | ||
| 26452 | |||
| 26453 | my $text = $comboBox->get_active_text(); | ||
| 26454 | |||
| 26455 | if ($text ne 'Select task') { | ||
| 26456 | $self->ivAdd('editHash', 'combo', $text); | ||
| 26457 | } else { | ||
| 26458 | $self->ivDelete('editHash', 'combo'); | ||
| 26459 | } | ||
| 26460 | }); | ||
| 26461 | |||
| 26462 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26463 | $grid, $group, | ||
| 26464 | 'Wait for another task to not exist, before starting:', | ||
| 26465 | undef, undef, TRUE, | ||
| 26466 | 1, 8, 3, 4); | ||
| 26467 | $radioButton->signal_connect('toggled' => sub { | ||
| 26468 | |||
| 26469 | $self->ivAdd('editHash', 'radio_choice', 2); | ||
| 26470 | }); | ||
| 26471 | |||
| 26472 | my $comboBox2 = $self->addComboBox($grid, undef, \@taskList, 'Select task', | ||
| 26473 | FALSE, # 'undef' value allowed | ||
| 26474 | 8, 12, 3, 4); | ||
| 26475 | $comboBox2->signal_connect('changed' => sub { | ||
| 26476 | |||
| 26477 | my $text = $comboBox2->get_active_text(); | ||
| 26478 | |||
| 26479 | if ($text ne 'Select task') { | ||
| 26480 | $self->ivAdd('editHash', 'combo_2', $text); | ||
| 26481 | } else { | ||
| 26482 | $self->ivDelete('editHash', 'combo_2'); | ||
| 26483 | } | ||
| 26484 | }); | ||
| 26485 | |||
| 26486 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26487 | $grid, $group, | ||
| 26488 | 'Wait for another task to start/stop, before starting:', | ||
| 26489 | undef, undef, TRUE, | ||
| 26490 | 1, 8, 4, 5); | ||
| 26491 | $radioButton->signal_connect('toggled' => sub { | ||
| 26492 | |||
| 26493 | $self->ivAdd('editHash', 'radio_choice', 3); | ||
| 26494 | }); | ||
| 26495 | my $comboBox3 = $self->addComboBox($grid, undef, \@taskList, 'Select task', | ||
| 26496 | FALSE, # 'undef' value allowed | ||
| 26497 | 8, 12, 4, 5); | ||
| 26498 | $comboBox3->signal_connect('changed' => sub { | ||
| 26499 | |||
| 26500 | my $text = $comboBox3->get_active_text(); | ||
| 26501 | |||
| 26502 | if ($text ne 'Select task') { | ||
| 26503 | $self->ivAdd('editHash', 'combo_3', $text); | ||
| 26504 | } else { | ||
| 26505 | $self->ivDelete('editHash', 'combo_3'); | ||
| 26506 | } | ||
| 26507 | }); | ||
| 26508 | |||
| 26509 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26510 | $grid, $group, | ||
| 26511 | 'Start the task after this many minutes:', | ||
| 26512 | undef, undef, TRUE, | ||
| 26513 | 1, 8, 5, 6); | ||
| 26514 | $radioButton->signal_connect('toggled' => sub { | ||
| 26515 | |||
| 26516 | $self->ivAdd('editHash', 'radio_choice', 4); | ||
| 26517 | }); | ||
| 26518 | my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, 10080, # 7 days | ||
| 26519 | 8, 12, 5, 6); | ||
| 26520 | $entry2->signal_connect('changed' => sub { | ||
| 26521 | |||
| 26522 | my $text = $entry2->get_text(); | ||
| 26523 | |||
| 26524 | if ($self->checkEntryIcon($entry2)) { | ||
| 26525 | $self->ivAdd('editHash', 'entry_2', $text); | ||
| 26526 | } else { | ||
| 26527 | $self->ivDelete('editHash', 'entry_2'); | ||
| 26528 | } | ||
| 26529 | }); | ||
| 26530 | |||
| 26531 | # Group 2 switches | ||
| 26532 | $self->addLabel($grid, '<b>Stop options</b>', | ||
| 26533 | 0, 12, 6, 7); | ||
| 26534 | |||
| 26535 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26536 | $grid, undef, | ||
| 26537 | 'Run the task for an unlimited amount of time', | ||
| 26538 | undef, undef, TRUE, | ||
| 26539 | 1, 8, 7, 8); | ||
| 26540 | $radioButton->signal_connect('toggled' => sub { | ||
| 26541 | |||
| 26542 | $self->ivAdd('editHash', 'radio_choice_2', 0); | ||
| 26543 | }); | ||
| 26544 | |||
| 26545 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26546 | $grid, $group, | ||
| 26547 | 'Run the task for this many minutes:', | ||
| 26548 | undef, undef, TRUE, | ||
| 26549 | 1, 8, 8, 9); | ||
| 26550 | $radioButton->signal_connect('toggled' => sub { | ||
| 26551 | |||
| 26552 | $self->ivAdd('editHash', 'radio_choice_2', 1); | ||
| 26553 | }); | ||
| 26554 | my $entry3 = $self->addEntryWithIcon($grid, undef, 'int', 0, 10080, # 7 days | ||
| 26555 | 8, 12, 8, 9); | ||
| 26556 | $entry3->signal_connect('changed' => sub { | ||
| 26557 | |||
| 26558 | my $text = $entry3->get_text(); | ||
| 26559 | |||
| 26560 | if ($self->checkEntryIcon($entry3)) { | ||
| 26561 | $self->ivAdd('editHash', 'entry_3', $text); | ||
| 26562 | } else { | ||
| 26563 | $self->ivDelete('editHash', 'entry_3'); | ||
| 26564 | } | ||
| 26565 | }); | ||
| 26566 | |||
| 26567 | ($group, $radioButton) = $self->addRadioButton( | ||
| 26568 | $grid, $group, | ||
| 26569 | 'Run the task until the task loop time reaches:', | ||
| 26570 | undef, undef, TRUE, | ||
| 26571 | 1, 8, 9, 10); | ||
| 26572 | $radioButton->signal_connect('toggled' => sub { | ||
| 26573 | |||
| 26574 | $self->ivAdd('editHash', 'radio_choice_2', 2); | ||
| 26575 | }); | ||
| 26576 | my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, 604800, # 7 days | ||
| 26577 | 8, 12, 9, 10); | ||
| 26578 | $entry4->signal_connect('changed' => sub { | ||
| 26579 | |||
| 26580 | my $text = $entry4->get_text(); | ||
| 26581 | |||
| 26582 | if ($self->checkEntryIcon($entry4)) { | ||
| 26583 | $self->ivAdd('editHash', 'entry_4', $text); | ||
| 26584 | } else { | ||
| 26585 | $self->ivDelete('editHash', 'entry_4'); | ||
| 26586 | } | ||
| 26587 | }); | ||
| 26588 | |||
| 26589 | # Group 3 switches | ||
| 26590 | $self->addLabel($grid, '<b>Task window options</b>', | ||
| 26591 | 0, 12, 10, 11); | ||
| 26592 | |||
| 26593 | my $checkButton = $self->addCheckButton( | ||
| 26594 | $grid, | ||
| 26595 | 'Task runs without opening a task window (if it normally uses one)', | ||
| 26596 | undef, | ||
| 26597 | TRUE, | ||
| 26598 | 1, 12, 11, 12); | ||
| 26599 | $checkButton->signal_connect('toggled' => sub { | ||
| 26600 | |||
| 26601 | if ($checkButton->get_active()) { | ||
| 26602 | $self->ivAdd('editHash', 'check_button', TRUE); | ||
| 26603 | } else { | ||
| 26604 | $self->ivDelete('editHash', 'check_button'); | ||
| 26605 | } | ||
| 26606 | }); | ||
| 26607 | |||
| 26608 | # Tab complete | ||
| 26609 | return 1; | ||
| 26610 | } | ||
| 26611 | |||
| 26612 | ################## | ||
| 26613 | # Accessors - set | ||
| 26614 | |||
| 26615 | ################## | ||
| 26616 | # Accessors - get | ||
| 26617 | } | ||
| 26618 | |||
| 26619 | # Package must return a true value | ||
| 26620 | 1 |