Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

        });

        my $button2 = $self->addButton($grid,
            'Switch to session', 'Make the selected session the current (visible) one', undef,
            3, 6, 8, 9);
        $button2->signal_connect('clicked' => sub {

            my ($number, $session);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $session = $axmud::CLIENT->ivShow('sessionHash', $number);
                if ($session && $session->defaultTabObj) {

                    $session->defaultTabObj->paneObj->setVisibleTab($session->defaultTabObj);
                }

                # Refresh the simple list
                $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2));
            }
        });

        my $button3 = $self->addButton($grid,
            'Refresh list', 'Refresh the list of sessions', undef,
            9, 12, 8, 9);
        $button3->signal_connect('clicked' => sub {

            # Refresh the simple list
            $self->client2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        # Tab complete
        return 1;
    }

    sub client2Tab_refreshList {

        # Resets the simple list displayed by $self->client2Tab
        #
        # Expected arguments
        #   $slWidget       - The GA::Obj::SimpleList
        #   $columns        - The number of columns
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my (@winList, @dataList);

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->client2Tab_refreshList', @_);
        }

        # Get a list of 'main' windows, so we can mark visible windows
        @winList = $axmud::CLIENT->desktopObj->listGridWins('main');

        # Compile the simple list data
        OUTER: foreach my $session ($axmud::CLIENT->listSessions()) {

            my ($currentFlag, $visibleFlag, $world, $char);

            if ($session eq $axmud::CLIENT->currentSession) {
                $currentFlag = TRUE;
            } else {
                $currentFlag = FALSE;
            }

            $visibleFlag = FALSE;
            INNER: foreach my $winObj (@winList) {

                if ($winObj->visibleSession && $winObj->visibleSession eq $session) {

                    $visibleFlag = TRUE;
                    last INNER;
                }
            }

            $world = $session->currentWorld->name;
            if ($session->currentChar) {

                $char = $session->currentChar->name;
            }

            push (@dataList,
                $session->number,
                $currentFlag,
                $visibleFlag,
                $session->loginFlag,
                $session->status,
                $world,
                $char,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub client3Tab {

        # Client3 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

        my $grid = $self->addTab(
            $innerNotebook,
            'Page _7',
            ['IP lookup services'],
        );

        # IP lookup services
        $self->addLabel($grid, '<b>IP lookup services</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of URLs that return your IP address (one URL perl line, or use an empty'
            . ' list to disable lookup)</i>',
            1, 12, 1, 2);

        my $textView = $self->addTextView($grid, undef, TRUE,
            1, 12, 2, 10);
        my $buffer = $textView->get_buffer();
        $buffer->set_text(join("\n", $axmud::CLIENT->ipLookupList));

        my $button = $self->addButton(
            $grid, 'Set list', 'Set the list of IP lookup services', undef,
            1, 3, 10, 11);
        # (->signal_connect appears below)

        my $button2 = $self->addButton(
            $grid, 'Use default list', 'Uses the default list of IP lookup services', undef,
            3, 6, 10, 11);
        # (->signal_connect appears below)

        my $button3 = $self->addButton(
            $grid, 'Update list', 'Updates the list of IP lookup services', undef,
            9, 12, 10, 11);
        # (->signal_connect appears below)

        $self->addLabel($grid, '<u>Your IP address:</u>',
            1, 3, 11, 12);
        my $entry = $self->addEntry($grid, undef, FALSE,
            3, 9, 11, 12);
        if (! defined $axmud::CLIENT->currentIP) {
            $entry->set_text('<unknown>');
        } else {
            $entry->set_text($axmud::CLIENT->currentIP);
        }

        my $button4 = $self->addButton(
            $grid, 'Fetch', 'Fetch your current IP address', undef,
            9, 12, 11, 12);
        # (->signal_connect appears below)

        # Set values for the textview and the entry
        $self->client7Tab_updateWidgets($buffer, $entry);

        # (->signal_connects from above)
        $button->signal_connect('clicked' => sub {

            my (
                $text,
                @list,
            );

            $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
            if ($text =~ m/\S/) {

                # Split the contents of the textview into a list
                @list = split("\n", $text);

                # Set the list of IP lookup services. By using a join so soon after a split, we
                #   safely eliminate newline chars
                $self->session->pseudoCmd(
                    'setlookup ' . join(' ', @list),
                    $self->pseudoCmdMode,
                );

            } else {

                # Empty the list of IP lookup services
                $self->session->pseudoCmd('setlookup', $self->pseudoCmdMode);
            }

            # Update the textview and the entry
            $self->client7Tab_updateWidgets($buffer, $entry);
        });

        $button2->signal_connect('clicked' => sub {

            # Reset the list of IP lookup services to the default list
            $self->session->pseudoCmd('resetlookup', $self->pseudoCmdMode);

            # Update the textview and the entry
            $self->client7Tab_updateWidgets($buffer, $entry);
        });

        $button3->signal_connect('clicked' => sub {

            # Update the textview and the entry
            $self->client7Tab_updateWidgets($buffer, $entry);
        });

        $button4->signal_connect('clicked' => sub {

            # Force the client to re-fetch the user's IP address
            $self->session->pseudoCmd('forcelookup', $self->pseudoCmdMode);

            # Update the textview and the entry
            $self->client7Tab_updateWidgets($buffer, $entry);
        });

        # Tab complete
        return 1;
    }

    sub client7Tab_updateWidgets {

        # Resets the textview and entry displayed by $self->client7Tab
        #
        # Expected arguments
        #   $buffer     - The Gtk3::TextBuffer
        #   $entry      - The Gtk3::Entry
        #
        # Return values
        #   'undef' on improper arguments

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            7, 12, 10, 11);
        $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag);
        $checkButton10->signal_connect('toggled' => sub {

            $self->session->pseudoCmd('setsession -r', $self->pseudoCmdMode);
            $checkButton10->set_active($axmud::CLIENT->confirmCloseToolButtonFlag);
        });

        # Tab complete
        return 1;
    }

    sub settings2Tab {

        # Settings2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->settings2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Favourite world list', 'Auto-connect world list'],
        );

        # Favourite world list
        $self->addLabel($grid, '<b>Favourite world list</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid, '<i>Worlds displayed at the top of the list in the Connections window</i>',
            1, 12, 1, 2);

        my $textView = $self->addTextView($grid, undef, TRUE,
            1, 12, 2, 5);
        my $buffer = $textView->get_buffer();
        $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));

        my $button = $self->addButton(
            $grid, 'Set list', 'Set the list of favourite worlds', undef,
            1, 4, 5, 6);
        $button->signal_connect('clicked' => sub {

            my (
                $text,
                @list,
            );

            $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
            if ($text =~ m/\S/) {

                # Split the contents of the textview into a list
                @list = split("\n", $text);

                # Set the favourite world list. By using a join so soon after a split, we safely
                #   eliminate newline chars
                $self->session->pseudoCmd(
                    'setfavouriteworld ' . join(' ', @list),
                    $self->pseudoCmdMode,
                );

            } else {

                # Reset the favourite world list
                $self->session->pseudoCmd('setfavouriteworld', $self->pseudoCmdMode);
            }

            # Update the textview
            $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));
        });

        my $button2 = $self->addButton(
            $grid, 'Update list', 'Updates the list of favourite worlds', undef,
            9, 12, 5, 6);
        $button2->signal_connect('clicked' => sub {

            # Update the textview
            $buffer->set_text(join("\n", $axmud::CLIENT->favouriteWorldList));
        });

        # Auto-connect world list
        $self->addLabel($grid, '<b>Auto-connect world list</b>',
            0, 12, 6, 7);
        $self->addLabel(
            $grid, "<i>Worlds to which " . $axmud::SCRIPT . " auto-connects when it starts. Each"
            . " world profile name can be followed by\none or more character profile names, e.g."
            . " <b>deathmud bilbo gandalf</b></i>",
            1, 12, 7, 8);
        my $textView2 = $self->addTextView($grid, undef, TRUE,
            1, 12, 8, 11);
        my $buffer2 = $textView2->get_buffer();
        $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));

        my $button3 = $self->addButton(
            $grid, 'Set list', 'Set the list of auto-connecting worlds', undef,
            1, 4, 11, 12);
        $button3->signal_connect('clicked' => sub {

            my $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer2);
            if ($text =~ m/\S/) {

                foreach my $item (split("\n", $text)) {

                    # (Ignore empty lines)
                    if ($item =~ m/\S/) {

                        $self->session->pseudoCmd('setautoworld ' . $item, $self->pseudoCmdMode);
                    }
                }

            } else {

                # Reset the list
                $self->session->pseudoCmd('setautoworld', $self->pseudoCmdMode);
            }

            # Update the textview
            $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));
        });

        my $button4 = $self->addButton(
            $grid, 'Update list', 'Updates the list of auto-connecting worlds', undef,
            9, 12, 11, 12);
        $button4->signal_connect('clicked' => sub {

            # Update the textview
            $buffer2->set_text(join("\n", $axmud::CLIENT->autoConnectList));
        });

        # Tab complete
        return 1;
    }

    sub settings3Tab {

        # Settings3 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->settings3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Pre-configured world list'],
        );

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            $grid, 'Logfiles record image filenames', undef, TRUE,
            1, 12, 8, 9);
        $checkButton8->set_active($axmud::CLIENT->logImageFlag);
        $checkButton8->signal_connect('toggled' => sub {

            $self->session->pseudoCmd('log -i', $self->pseudoCmdMode);
            $checkButton8->set_active($axmud::CLIENT->logImageFlag);
        });

        # Tab complete
        return 1;
    }

    sub logs2Tab {

        # Logs2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->logs2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['Logfile preamble'],
        );

        # Logfile preamble
        $self->addLabel($grid, '<b>Logfile preamble</b>',
            0, 12, 0, 1);
        $self->addLabel($grid, '<i>Text to add to the beginning of every logfile</i>',
            1, 12, 1, 2);

        my $textView = $self->addTextView($grid, undef, TRUE,
            1, 12, 2, 10);
        my $buffer = $textView->get_buffer();
        $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));

        my $button = $self->addButton(
            $grid, 'Set list', 'Set the logfile preamble', undef,
            1, 4, 10, 11);
        $button->signal_connect('clicked' => sub {

            my (
                $text,
                @list,
            );

            $text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);

            # Split the contents of the textview into a list, and set the IV
            $axmud::CLIENT->set_logPreamble(split("\n", $text));

            # Update the textview
            $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));
        });

        my $button2 = $self->addButton(
            $grid, 'Reset list', 'Resets the logfile preamble', undef,
            9, 12, 10, 11);
        $button2->signal_connect('clicked' => sub {

            # Update the textview
            $buffer->set_text(join("\n", $axmud::CLIENT->logPreambleList));
        });

        # Tab complete
        return 1;
    }

    sub logs3Tab {

        # Logs3 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->logs3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Status task events'],
        );

        # Status task events
        $self->addLabel($grid, '<b>Status task events</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>Number of logfile lines to write before/after a change in the character\'s life'
            . ' status</i>',
            1, 12, 1, 2);

        $self->addLabel($grid, 'Lines to write before an event (0-999)',
            1, 6, 2, 3);

        my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, 999,

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            $self->session->pseudoCmd(
                'setcolour ' . $tag . ' ' . $rgbDefault,
                $self->pseudoCmdMode,
            );
        });

        $self->addSimpleCanvas($grid, $rgbDefault, undef,
            9, 10, $row, ($row + 1));

        my $entry2 = $self->addEntry($grid, undef, FALSE,
            10, 12, $row, ($row + 1), 7, 7);
        $entry2->set_text($axmud::CLIENT->ivShow($defaultIV, $tag));

        return 1;
    }

    sub colours1Tab_applyAll {

        # Called by $self->colours1Tab and ->colours2Tab
        # Re-applies any colour scheme that uses a standard colour tag (e.g. 'red' instead of
        #   '#FF0000')
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Local variables
        my %hash;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->colours1Tab_applyAll', @_);
        }

        # Compile a hash of colour scheme objects that use Axmud standard colour tags
        foreach my $obj (
            sort {lc($a->name) cmp lc($b->name)} ($axmud::CLIENT->ivValues('colourSchemeHash'))
        ) {
            my ($type, $textFlag, $underlayFlag, $backgroundFlag);

            # (The flags are set to TRUE if the argument is an underlay tag, FALSE if not)
            ($type, $textFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);
            ($type, $underlayFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);
            ($type, $backgroundFlag) = $axmud::CLIENT->checkColourTags($obj->textColour);

            if (! $textFlag || $underlayFlag || ! $backgroundFlag) {

                $hash{$obj->name} = undef;
            }
        }

        if (%hash) {

            # Update every 'internal' window
            foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {

                foreach my $name (keys %hash) {

                    $winObj->updateColourScheme($name);
                }
            }
        }

        return 1;
    }

    sub colours2Tab {

        # Colours2 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @tagList;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->colours2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            [$axmud::SCRIPT . ' standard (bold) colour tags'],
        );

        # Axmud standard (bold) colour tags
        $self->addLabel($grid, '<b>' . $axmud::SCRIPT . ' standard (bold) colour tags</b>',
            0, 8, 0, 1);

        # Import IV from the GA::Client
        @tagList = $axmud::CLIENT->constBoldColourTagList;

        for (my $row = 1; $row <= 8; $row++) {

            $self->colours1Tab_addRow(
                $grid,
                $row,
                'boldColourTagHash',
                'constBoldColourTagHash',
                shift @tagList,
            );
        }

        # Tab complete
        return 1;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->workspacesTab', @_);
        }

        # Tab setup
        # Create a notebook within the main one, so that we have two rows of tabs
        my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, '_Workspaces');

        # Add tabs to the inner notebook
        $self->workspaces1Tab($innerNotebook);
        $self->workspaces2Tab($innerNotebook);
        $self->workspaces3Tab($innerNotebook);
        $self->workspaces4Tab($innerNotebook);
        $self->workspaces5Tab($innerNotebook);
        $self->workspaces6Tab($innerNotebook);
        $self->workspaces7Tab($innerNotebook);
        $self->workspaces8Tab($innerNotebook);

        return 1;
    }

    sub workspaces1Tab {

        # Workspaces1 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my (
            @list, @comboList,
            %comboHash,
        );

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces1Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _1',
            ['Workspace (desktop) settings', 'Workspace debug settings'],
        );

        # Left column
        $self->addLabel($grid, '<b>Workspace (desktop) settings</b>',
            0, 12, 0, 1);

        $self->addLabel($grid, 'Maximum workspace width',
            1, 3, 1, 2);
        my $entry = $self->addEntry($grid, undef, FALSE,
            3, 6, 1, 2, 8, 8);
        $entry->set_text($axmud::CLIENT->constWorkspaceMaxWidth);

        $self->addLabel($grid, 'Maximum workspace height',
            1, 3, 2, 3);
        my $entry2 = $self->addEntry($grid, undef, FALSE,
            3, 6, 2, 3, 8, 8);
        $entry2->set_text($axmud::CLIENT->constWorkspaceMaxHeight);

        # Right column
        $self->addLabel($grid, 'Minimum workspace width',
            6, 8, 1, 2);
        my $entry3 = $self->addEntry($grid, undef, FALSE,
            8, 12, 1, 2, 8, 8);
        $entry3->set_text($axmud::CLIENT->constWorkspaceMinWidth);

        $self->addLabel($grid, 'Minimum workspace height',
            6, 8, 2, 3);
        my $entry4 = $self->addEntry($grid, undef, FALSE,
            8, 12, 2, 3, 8, 8);
        $entry4->set_text($axmud::CLIENT->constWorkspaceMinHeight);

        # Bottom section
        $self->addLabel($grid, 'When adding workspaces,',
            1, 3, 3, 4);

        @list = (
            'move left from default workspace' => '-l',
            'move right from default workspace' => '-r',
            'after default workspace, start from left' => '-b',
            'ffter default workspace, start from right' => '-e',
        );

        do {
            my ($string, $switch);

            $string = shift @list;
            $switch = shift @list;

            $comboHash{$string} = $switch;
            push (@comboList, $string);

        } until (! @list);

        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            3, 10, 3, 4);

        my $button = $self->addButton($grid,
            'Set', 'Set the default width/height', undef,
            10, 12, 3, 4);
        $button->signal_connect('clicked' => sub {

            my ($string, $switch);

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['Workspaces'],
        );

        # Workspaces
        $self->addLabel($grid, '<b>Workspaces</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of workspace objects (one for each workspace in use by ' . $axmud::SCRIPT
            . ')</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Object num', 'int',
            'Default', 'bool',
            'System num', 'text',
            'System name', 'text',
            'Width', 'int',
            'Height', 'int',
            'Default zonemap', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 6);

        # Initialise the list
        $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add another simple list
        $self->addLabel($grid,
            '<i>List of available (but unused) workspaces</i>',
            1, 12, 7, 8);

        @columnList2 = (
            'System num', 'int',
        );

        my $slWidget2 = $self->addSimpleList($grid, undef, \@columnList2,
            1, 12, 8, 12);

        # Initialise the list
        $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));

        # Add editing widgets for both simple lists
        my $button = $self->addButton($grid, 'View...', 'View this workspace\'s settings', undef,
            1, 3, 6, 7);
        $button->signal_connect('clicked' => sub {

            my ($number, $obj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $obj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $number);
                if ($obj) {

                    # Open an 'edit' window for the selected workspace object
                    $self->createFreeWin(
                        'Games::Axmud::EditWin::Workspace',
                        $self,
                        $self->session,,
                        'Edit workspace object #' . $obj->number,
                        $obj,
                        FALSE,                          # Not temporary
                    );
                }
            }
        });

        my $button2 = $self->addButton(
            $grid,
            'Remove',
            'Stop using this workspace for ' . $axmud::SCRIPT . ' windows',
            undef,
            3, 5, 6, 7);
        $button2->signal_connect('clicked' => sub {

            my ($num) = $self->getSimpleListData($slWidget, 0);
            if (defined $num) {

                $self->session->pseudoCmd(
                    'removeworkspace  ' . $num,
                    $self->pseudoCmdMode,
                );
            }

            # Update simple lists
            $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
            $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
        });

        $title = '(Optional) default zonemap';
        @comboList = (sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash')));

        my $combo = $self->addComboBox($grid, undef, \@comboList, $title,
            TRUE,               # No 'undef' value used
            1, 5, 12, 13);

        my $button3 = $self->addButton($grid, 'Use', 'Use the selected workspace', undef,
            5, 7, 12, 13);
        $button3->signal_connect('clicked' => sub {

            my ($num, $name, $zonemap, $string);

            ($num) = $self->getSimpleListData($slWidget2, 0);
            ($name) = $self->getSimpleListData($slWidget2, 1);
            $zonemap = $combo->get_active_text();
            if ($zonemap && $zonemap eq $title) {

                $zonemap = undef;
            }

            if ($zonemap) {
                $string = ' -z ' . $zonemap;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

                );

            } elsif (defined $name) {

                $self->session->pseudoCmd(
                    'useworkspace ' . $name . $string,
                    $self->pseudoCmdMode,
                );
            }

            # Update simple lists
            $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
            $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
        });

        my $button4 = $self->addButton(
            $grid,
            'Refresh lists',
            'Refresh the lists of workspaces',
            undef,
            10, 12, 12, 13);
        $button4->signal_connect('clicked' => sub {

            # Update simple lists
            $self->workspaces3Tab_refreshList($slWidget, scalar (@columnList / 2));
            $self->workspaces3Tab_refreshList2($slWidget2, scalar (@columnList2 / 2));
        });

        # Tab complete
        return 1;
    }

    sub workspaces3Tab_refreshList {

        # Called by $self->workspaces3Tab to refresh the first GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my @dataList;

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->workspaces3Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        foreach my $obj (
            sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
        ) {
            my ($flag, $name);

            if (! $obj->number) {
                $flag = TRUE;
            } else {
                $flag = FALSE;
            }

            push (@dataList,
                $obj->number,
                $flag,
                $obj->systemNum,
                $name,
                $obj->currentWidth,
                $obj->currentHeight,
                $obj->defaultZonemap,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub workspaces3Tab_refreshList2 {

        # Called by $self->workspaces3Tab to refresh the second GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my (@workspaceList, @dataList);

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->workspaces3Tab_refreshList2',
                @_,
            );
        }

        # Get an ordered list of unused workspaces
        @dataList = $axmud::CLIENT->desktopObj->detectUnusedWorkspaces();

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub workspaces4Tab {

        # Workspaces4 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my (
            $defaultString,
            @columnList, @comboList,
        );

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Initial workspaces'],
        );

        # Initial workspaces
        $self->addLabel($grid, '<b>Initial workspaces</b>',
            0, 12, 0, 1);
        $self->addLabel($grid,
            '<i>List of workspaces to use when ' . $axmud::SCRIPT . ' starts</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Number', 'int',
            'Default zonemap', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->workspaces4Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add editing widgets
        $self->addLabel($grid, 'Zonemap',

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            $self->session->pseudoCmd('setgrid -g', $self->pseudoCmdMode);

            # Update the entry box
            $entry2->set_text($axmud::CLIENT->gridBlockSize);
        });

        my $checkButton = $self->addCheckButton(
            $grid, 'Workspace grids activated in general', undef, FALSE,
            1, 6, 3, 4);
        $checkButton->set_active($axmud::CLIENT->activateGridFlag);

        my $button5 = $self->addButton(
            $grid,
            'Activate grids',
            'Actcvate workspace grids in general',
            undef,
            6, 9, 3, 4);
        $button5->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('activategrid', $self->pseudoCmdMode);

            # Update widgets
            $checkButton->set_active($axmud::CLIENT->activateGridFlag);
        });

        my $button6 = $self->addButton(
            $grid,
            'Disactivate grids',
            'Disactivate workspace grids in general',
            undef,
            9, 12, 3, 4);
        $button6->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('disactivategrid', $self->pseudoCmdMode);

            # Update widgets
            $checkButton->set_active($axmud::CLIENT->activateGridFlag);
        });

        my $checkButton2 = $self->addCheckButton(
            $grid, 'Enable grid adjustment (fill small gaps)', undef, TRUE,
            1, 6, 5, 6);
        $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag);
        $checkButton2->signal_connect('toggled' => sub {

            my $flag = $checkButton2->get_active();
            if (! $flag) {
                $flag = 0;
            } else {
                $flag = 1;
            }

            # Toggle grid adjustment
            $self->session->pseudoCmd('setgrid -a ' . $flag);

            # Update the checkbutton
            $checkButton2->set_active($axmud::CLIENT->gridAdjustmentFlag);
        });

        my $checkButton3 = $self->addCheckButton(
            $grid, 'Enable edge correction (edge of desktop)', undef, TRUE,
            1, 6, 6, 7);
        $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag);
        $checkButton3->signal_connect('toggled' => sub {

            my $flag = $checkButton3->get_active();
            if (! $flag) {
                $flag = 0;
            } else {
                $flag = 1;
            }

            # Toggle edge correction
            $self->session->pseudoCmd('setgrid -e ' . $flag);

            # Update the checkbutton
            $checkButton3->set_active($axmud::CLIENT->gridEdgeCorrectionFlag);
        });

        my $checkButton4 = $self->addCheckButton(
            $grid, 'Enable window reshuffling', undef, TRUE,
            1, 6, 7, 8);
        $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag);
        $checkButton4->signal_connect('toggled' => sub {

            my $flag = $checkButton4->get_active();
            if (! $flag) {
                $flag = 0;
            } else {
                $flag = 1;
            }

            # Toggle window reshuffling
            $self->session->pseudoCmd('setgrid -r ' . $flag);

            # Update the checkbutton
            $checkButton4->set_active($axmud::CLIENT->gridReshuffleFlag);
        });

        my $checkButton5 = $self->addCheckButton(
            $grid, 'Enable hiding of other session\'s windows', undef, TRUE,
            1, 6, 8, 9);
        $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag);
        $checkButton5->signal_connect('toggled' => sub {

            my $flag = $checkButton5->get_active();
            if (! $flag) {
                $flag = 0;
            } else {
                $flag = 1;
            }

            # Toggle window reshuffling
            $self->session->pseudoCmd('setgrid -i ' . $flag);

            # Update the checkbutton
            $checkButton5->set_active($axmud::CLIENT->gridInvisWinFlag);
        });

        # Tab complete
        return 1;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            # Refresh the list
            $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
            # Update widgets
            $self->workspaces6Tab_resetCombo($combo, $allString);
            $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
            $checkButton->set_active($axmud::CLIENT->activateGridFlag);
        });

        my $button4 = $self->addButton(
            $grid,
            'Reset grids',
            'Reset workspace grid(s) on the specified workspace using the specified default'
            . ' zonemap',
            undef,
            10, 12, 10, 11);
        $button4->signal_connect('clicked' => sub {

            my ($cmd, $number, $zonemap);

            $cmd = 'resetgrid';

            $number = $combo->get_active_text();
            if (defined $number) {

                if ($number eq $allString) {
                    $cmd .= ' -s';
                } else {
                    $cmd .= ' -w ' . $number;
                }

                $zonemap = $combo2->get_active_text();
                if ($zonemap ne $defaultString) {

                    $cmd .= ' ' . $zonemap;
                }

                $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
            }

            # Refresh the list
            $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
            # Update widgets
            $self->workspaces6Tab_resetCombo($combo, $allString);
            $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
            $checkButton->set_active($axmud::CLIENT->activateGridFlag);
        });

        my $button5 = $self->addButton(
            $grid,
            'View selected grid...',
            'View settings for the selected workspace grid',
            undef,
            6, 10, 11, 12);
        $button5->signal_connect('clicked' => sub {

            my ($number, $obj);

            ($number) = $self->getSimpleListData($slWidget, 1);
            if (defined $number) {

                $obj = $axmud::CLIENT->desktopObj->ivShow('gridHash', $number);
                if ($obj) {

                    # Open an 'edit' window to edit the workspace grid
                    $self->createFreeWin(
                        'Games::Axmud::EditWin::WorkspaceGrid',
                        $self,
                        $self->session,
                        'Edit workspace grid #' . $number,
                        $obj,
                        FALSE,                          # Not temporary
                    );
                }
            }
        });

        my $button6 = $self->addButton(
            $grid,
            'Refresh list',
            'Refresh the list of workspace grids',
            undef,
            10, 12, 11, 12);
        $button6->signal_connect('clicked' => sub {

            # Refresh the list
            $self->workspaces6Tab_refreshList($slWidget, scalar (@columnList / 2));
            # Update widgets
            $self->workspaces6Tab_resetCombo($combo, $allString);
            $self->workspaces6Tab_resetCombo2($combo2, $defaultString);
            $checkButton->set_active($axmud::CLIENT->activateGridFlag);
        });

        # Tab complete
        return 1;
    }

    sub workspaces6Tab_refreshList {

        # Called by $self->workspaces6Tab to refresh the first GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my @dataList;

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->workspaces6Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        foreach my $obj (
            sort {
                if ($a->workspaceObj->number != $b->workspaceObj->number) {
                    return $a->workspaceObj->number <=> $b->workspaceObj->number;
                } else {
                    return $a->number <=> $b->number;
                }
            }
            ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
        ) {
            my $string;

            if ($obj->owner) {
                $string = $obj->owner->number;
            } else {
                $string = '(shared)';
            }

            push (@dataList,
                $obj->workspaceObj->number,
                $obj->number,
                $string,
                $obj->zonemap,
                $obj->currentLayer,
                $obj->maxLayers,
                $obj->ivPairs('zoneHash'),
                $obj->ivPairs('gridWinHash'),
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub workspaces6Tab_resetCombo {

        # Called by $self->workspaces6Tab to reset the contents of the first combobox
        #
        # Expected arguments
        #   $combo      - The combobox whose contents should be reset
        #   $title      - The title used in the combobox
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $combo, $title, $check) = @_;

        # Local variables
        my @comboList;

        # Check for improper arguments
        if (! defined $combo || ! defined $title || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->workspaces6Tab_resetCombo',
                @_,
            );
        }

        # Compile a list of combobox items
        @comboList = sort {$a <=> $b} ($axmud::CLIENT->desktopObj->ivKeys('workspaceHash'));
        unshift (@comboList, $title);

        # Reset the combobox
        $self->resetComboBox($combo, @comboList);

        return 1;
    }

    sub workspaces6Tab_resetCombo2 {

        # Called by $self->workspaces6Tab to reset the contents of the second combobox
        #
        # Expected arguments
        #   $combo      - The combobox whose contents should be reset
        #   $title      - The title used in the combobox
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $combo, $title, $check) = @_;

        # Local variables
        my @comboList;

        # Check for improper arguments
        if (! defined $combo || ! defined $title || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->workspaces6Tab_resetCombo2',
                @_,
            );
        }

        # Compile a list of combobox items
        @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
        unshift (@comboList, $title);

        # Reset the combobox
        $self->resetComboBox($combo, @comboList);

        return 1;
    }

    sub workspaces7Tab {

        # Workspaces7 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN


        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->workspaces8Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _8',
            ['Window size/position storage'],
        );

        # Window size/position storage
        $self->addLabel($grid, '<b>Window size/position storage</b>',
            0, 6, 0, 1);

        my $checkButton = $self->addCheckButton(
            $grid, 'Automatically store size/position of all \'grid\' windows', undef, TRUE,
            6, 12, 0, 1);
        $checkButton->set_active($axmud::CLIENT->storeGridPosnFlag);
        $checkButton->signal_connect('toggled' => sub {

            if (
                ($checkButton->get_active() && ! $axmud::CLIENT->storeGridPosnFlag)
                || (! $checkButton->get_active() && $axmud::CLIENT->storeGridPosnFlag)
            ) {
                $self->session->pseudoCmd('togglewindowstorage', $self->pseudoCmdMode);
            }
        });

        $self->addLabel($grid,
            '<i>List of stored \'grid\' window size/positions (used when workspace grids are'
            . ' disactivated)</i>',
            1, 12, 1, 2);

        # Add a simple list
        @columnList = (
            'Window name', 'text',
            'X', 'int',
            'Y', 'int',
            'Width', 'int',
            'Height', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add editing widgets
        my $button = $self->addButton($grid,
            'Store current sizes/positions',
            'Store the sizes of this session\'s \'grid\' windows',
            undef,
            1, 4, 10, 11);
        $button->signal_connect('clicked' => sub {

            $axmud::CLIENT->desktopObj->storeGridWinPosn($self->session);

            # Refresh the simple list
            $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button2 = $self->addButton($grid,
            'Clear selected', 'Clear the selected stored size/position', undef,
            4, 6, 10, 11);
        $button2->signal_connect('clicked' => sub {

            my ($winName) = $self->getSimpleListData($slWidget, 0);
            if (defined $winName) {

                $self->session->pseudoCmd(
                    'clearwindowstorage <' . $winName . '>',
                    $self->pseudoCmdMode,
                );

                # Refresh the simple list
                $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
            }
        });

        my $button3 = $self->addButton($grid,
            'Clear all', 'Clear all stored sizes/positions', undef,
            6, 8, 10, 11);
        $button3->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('clearwindowstorage', $self->pseudoCmdMode);

            # Refresh the simple list
            $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button4 = $self->addButton($grid,
            'Refresh list', 'Refresh the list of stored sizes/positions', undef,
            10, 12, 10, 11);
        $button4->signal_connect('clicked' => sub {

            # Refresh the simple list
            $self->workspaces8Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        # Tab complete
        return 1;
    }

    sub workspaces8Tab_refreshList {

        # Called by $self->workspaces8Tab to refresh the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->windows2Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _2',
            ['\'Grid\' windows'],
        );

        # 'Grid' windows
        $self->addLabel($grid, '<b>\'Grid\' windows</b>',
            0, 13, 0, 1);
        $self->addLabel($grid, '<i>List of windows that can be arranged on a workspace grid</i>',
            1, 13, 1, 2);

       # Add a simple list
        @columnList = (
            '#', 'int',
            'Type', 'text',
            'Name', 'text',
            'Enab', 'bool',
            'Vis', 'bool',
            'Gtk', 'bool',
            'Wsp', 'int',
            'WGrd', 'text',
            'Sesn', 'text',
            'Zone', 'int',
            'Layer', 'int',
            'X/Y', 'text',
            'Wid/Hei', 'text',
            'Zone X/Y', 'text',
            'Wid/Hei', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 13, 2, 8);

        # Refresh the list
        $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add editing buttons
        my $button = $self->addButton($grid,
            'View...', 'View the selected window\'s settings', undef,
            1, 3, 8, 9);
        $button->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    # Open an 'edit' window for the selected 'grid' window
                    $self->createFreeWin(
                        'Games::Axmud::EditWin::Window',
                        $self,
                        $self->session,
                        'Edit \'grid\' window #' . $number,
                        $winObj,
                        FALSE,                  # Not temporary
                    );
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button2 = $self->addButton($grid,
            'Restore', 'Restore the selected window to its allocated zone', undef,
            3, 5, 8, 9);
        $button2->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    # Restore the window
                    $self->session->pseudoCmd('restorewindow ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        my $button3 = $self->addButton($grid,
            'Restore all', 'Restore all windows to their allocated zones', undef,
            5, 7, 8, 9);
        $button3->signal_connect('clicked' => sub {

            # Restore all windows
            $self->session->pseudoCmd('restorewindow', $self->pseudoCmdMode);

            # Refresh the simple list and entry boxes
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button4 = $self->addButton($grid, 'Close', 'Close the selected window', undef,
            7, 9, 8, 9);
        $button4->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    # Close the window
                    $self->session->pseudoCmd('closewindow ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button5 = $self->addButton($grid,
            'Fix', 'Fix the selected window in whichever zone it is currently located', undef,
            9, 11, 8, 9);
        $button5->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    # Fix the window
                    $self->session->pseudoCmd('fixwindow ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        my $button6 = $self->addButton(
            $grid,
            'Fix/Resize',
            'Fix the selected window in whichever zone it is currently located, and resize to fit'
            . ' if possible',
            undef,
            11, 13, 8, 9);
        $button6->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    # Fix/resize the window
                    $self->session->pseudoCmd('fixwindow -r ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        $self->addLabel($grid, 'Workspace',
            1, 2, 9, 10);
        my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            2, 5, 9, 10);
        $self->addLabel($grid, 'Zone',
            5, 6, 9, 10);
        my $entry2 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            6, 9, 9, 10);

        my $button7 = $self->addButton($grid,
            'Move',
            'Move the selected window to the specified workspace and/or zone',
            undef,
            9, 11, 9, 10);
        $button7->signal_connect('clicked' => sub {

            my ($number, $winObj, $cmd);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    $cmd = 'movewindow ' . $number;

                    if ($self->checkEntryIcon($entry)) {

                        # Use specified workspace
                        $cmd .= ' ' . $entry->get_text();

                    } else {

                        # Use window's existing workspace
                        $cmd .= ' ' . $winObj->workspaceObj->number;
                    }

                    if ($self->checkEntryIcon($entry2)) {

                        $cmd .= ' ' . $entry2->get_text();
                    }

                    # Move the window and reset entry boxes
                    $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
                    $self->resetEntryBoxes($entry, $entry2);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
            $self->resetEntryBoxes($entry, $entry2);
        });

        my $button8 = $self->addButton(
            $grid,
            'Move/Resize',
            'Move the selected window to the specified workspace and/or zone, and resize'
            . ' if possible',
            undef,
            11, 13, 9, 10);
        $button8->signal_connect('clicked' => sub {

            my ($number, $winObj, $cmd);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {

                    $cmd = 'movewindow -r ' . $number;

                    if ($self->checkEntryIcon($entry)) {

                        # Use specified workspace
                        $cmd .= ' ' . $entry->get_text();

                    } else {

                        # Use window's existing workspace
                        $cmd .= ' ' . $winObj->workspaceObj->number;
                    }

                    if ($self->checkEntryIcon($entry2)) {

                        $cmd .= ' ' . $entry2->get_text();
                    }

                    # Move the window and reset entry boxes
                    $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
                    $self->resetEntryBoxes($entry, $entry2);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        $self->addLabel($grid, 'Pattern',
            1, 2, 10, 11);
        my $entry3 = $self->addEntryWithIcon($grid, undef, 'string', 1, undef,
            2, 5, 10, 11);
        my $button9 = $self->addButton($grid,
            'Grab', 'Incorporate the first window matching the specified pattern (regex)', undef,
            5, 7, 10, 11);
        $button9->signal_connect('clicked' => sub {

            my $regex;

            if ($self->checkEntryIcon($entry3)) {

                $regex = $entry3->get_text();

                # Grab the window matching the regex
                $self->session->pseudoCmd(
                    'grabwindow <' . $regex . '>',
                    $self->pseudoCmdMode,
                );

                # Refresh the simple list and entry boxes
                $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
                $self->resetEntryBoxes($entry3);
            }
        });

        my $button10 = $self->addButton($grid,
            'Grab All', 'Incorporate all windows matching the specified pattern (regex)', undef,
            7, 9, 10, 11);
        $button10->signal_connect('clicked' => sub {

            my $regex;

            if ($self->checkEntryIcon($entry3)) {

                $regex = $entry3->get_text();

                # Grab all windows matching the regex
                $self->session->pseudoCmd(
                    'grabwindow -a <' . $regex . '>',
                    $self->pseudoCmdMode,
                );

                # Refresh the simple list and entry boxes
                $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
                $self->resetEntryBoxes($entry3);
            }
        });

        my $button11 = $self->addButton($grid,
            'Banish', 'Remove the selected external window from its workspace grid', undef,
            9, 11, 10, 11);
        $button11->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($winObj) {


                    # Banish the external window
                    $self->session->pseudoCmd('banishwindow ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        my $button12 = $self->addButton($grid,
            'Banish all', 'Remove all external windows from their workspace grids', undef,
            11, 13, 10, 11);
        $button12->signal_connect('clicked' => sub {

            # Banish all external windows
            $self->session->pseudoCmd('banishwindow', $self->pseudoCmdMode);

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        $self->addLabel($grid, 'Window',
            1, 2, 11, 12);
        my $entry4 = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            2, 5, 11, 12);
        my $button13 = $self->addButton($grid,
            'Swap', 'Swap the selected window with the specified window', undef,
            5, 7, 11, 12);
        $button13->signal_connect('clicked' => sub {

            my ($number, $winObj, $swapNumber, $swapWinObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
                if ($self->checkEntryIcon($entry4)) {

                    $swapNumber = $entry4->get_text();
                    $swapWinObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $swapNumber);
                }

                if ($winObj && $swapWinObj) {

                    # Swap the two windows
                    $self->session->pseudoCmd(
                        'swapwindow ' . $number . ' ' . $swapNumber,
                        $self->pseudoCmdMode,
                    );
                }
            }

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2), $number);
        });

        my $button14 = $self->addButton($grid,
            'Dump', 'Display this list of windows in the \'main\' window', undef,
            9, 11, 11, 12);
        $button14->signal_connect('clicked' => sub {

            # List windows
            $self->session->pseudoCmd('listwindow', $self->pseudoCmdMode);

            # Refresh the simple list
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button15 = $self->addButton($grid,
            'Refresh list', 'Refresh the list of windows', undef,
            11, 13, 11, 12);
        $button15->signal_connect('clicked' => sub {

            # Refresh the simple list and entry boxes
            $self->windows2Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        # Tab complete
        return 1;
    }

    sub windows2Tab_refreshList {

        # Called by $self->windows1Tab to refresh the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Optional arguments
        #   $number     - A 'grid' window number which should be selected in the list (if specified)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $number, $check) = @_;

        # Local variables
        my (
            $count, $selectRow,
            @dataList,
        );

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->windows2Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        $count = 0;
        foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins()) {

            my ($gtkFlag, $gridString, $sessionString, $areaObj);

            if ($winObj->winWidget) {

                $gtkFlag = TRUE;
            }

            if (! $winObj->workspaceGridObj) {
                $gridString = ('n/a');
            } else {
                $gridString = $winObj->workspaceGridObj->number;
            }

            if (! $winObj->session) {
                $sessionString = ('n/a');
            } else {
                $sessionString = $winObj->session->number;
            }

            push (@dataList,
                $winObj->number,
                $winObj->winType,
                $winObj->winName,
                $winObj->enabledFlag,
                $winObj->visibleFlag,
                $gtkFlag,
                $winObj->workspaceObj->number,
                $gridString,
                $sessionString,
            );

            $areaObj = $winObj->areaObj;
            if (! $areaObj) {

                push (@dataList, undef, undef, undef, undef, undef, undef);

            } else {

                push (@dataList,
                    $areaObj->zoneObj->number,
                    $areaObj->layer,
                    $areaObj->xPosPixels . '/' . $areaObj->yPosPixels,
                    $areaObj->widthPixels . '/' . $areaObj->heightPixels,
                    $areaObj->leftBlocks . '/' . $areaObj->topBlocks,
                    $areaObj->widthBlocks . '/' . $areaObj->heightBlocks,
                );
            }

            if (defined $number && $winObj->number eq $number) {

                $selectRow = $count;
            }

            $count++;
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->windows3Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _3',
            ['\'Free\' windows'],
        );

        # 'Free' windows
        $self->addLabel($grid, '<b>\'Free\' windows</b>',
            0, 12, 0, 1);
        $self->addLabel(
            $grid,
            '<i>List of windows that can\'t be arranged on a workspace grid (doesn\'t include'
            . ' \'dialogue\' windows)</i>',
            1, 12, 1, 2);

       # Add a simple list
        @columnList = (
            '#', 'int',
            'Type', 'text',
            'Name', 'text',
            'Enab', 'bool',
            'Vis', 'bool',
            'Gtk', 'bool',
            'Wsp', 'int',
            'Sesn', 'int',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Refresh the list
        $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add editing buttons
        my $button = $self->addButton($grid,
            'View...', 'View the selected window\'s settings', undef,
            1, 3, 10, 11);
        $button->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number);
                if ($winObj) {

                    # Open an 'edit' window for the selected 'free' window
                    $self->createFreeWin(
                        'Games::Axmud::EditWin::Window',
                        $self,
                        $self->session,
                        'Edit \'free\' window #' . $number,
                        $winObj,
                        FALSE,                  # Not temporary
                    );
                }
            }

            # Refresh the simple list
            $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button2 = $self->addButton($grid, 'Close', 'Close the selected window', undef,
            3, 5, 10, 11);
        $button2->signal_connect('clicked' => sub {

            my ($number, $winObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number);
                if ($winObj) {

                    # Close the window
                    $self->session->pseudoCmd('closefreewindow ' . $number, $self->pseudoCmdMode);

                    if ($winObj ne $self) {

                        # Refresh the simple list
                        $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
                    }
                }
            }
        });

        my $button14 = $self->addButton($grid,
            'Dump', 'Display this list of windows in the \'main\' window', undef,
            8, 10, 10, 11);
        $button14->signal_connect('clicked' => sub {

            # List windows
            $self->session->pseudoCmd('listfreewindow', $self->pseudoCmdMode);

            # Refresh the simple list
            $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button15 = $self->addButton($grid,
            'Refresh list', 'Refresh the list of windows', undef,
            10, 12, 10, 11);
        $button15->signal_connect('clicked' => sub {

            # Refresh the simple list and entry boxes
            $self->windows3Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        # Tab complete
        return 1;
    }

    sub windows3Tab_refreshList {

        # Called by $self->windows2Tab to refresh the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my @dataList;

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->windows3Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        foreach my $winObj ($axmud::CLIENT->desktopObj->listFreeWins()) {

            my ($gktFlag, $sessionString);

            if ($winObj->winWidget) {

                $gktFlag = TRUE;
            }

            if (! $winObj->session) {
                $sessionString = ('n/a');
            } else {
                $sessionString = $winObj->session->number;
            }

            push (@dataList,
                $winObj->number,
                $winObj->winType,
                $winObj->winName,
                $winObj->enabledFlag,
                $winObj->visibleFlag,
                $gktFlag,
                $winObj->workspaceObj->number,
                $sessionString,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub windows4Tab {

        # Windows4 tab
        #
        # Expected arguments
        #   $innerNotebook  - The Gtk3::Notebook object inside $self->notebook
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $innerNotebook, $check) = @_;

        # Local variables
        my @columnList;

        # Check for improper arguments
        if (! defined $innerNotebook || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->windows4Tab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $innerNotebook,
            'Page _4',
            ['Winmaps'],
        );

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

                $self->windows5Tab_refreshList(
                    $slWidget,
                    scalar (@columnList / 2),
                    \@buttonList,
                    \%buttonHash,
                );
            }
        });

        my $button9 = $self->addButton(
            $grid, 'Reset buttons', 'Reset your changes to this list',  undef,
            8, 10, 10, 11);
        $button9->signal_connect('clicked' => sub {

            # Re-import the IVs
            @buttonList = $axmud::CLIENT->toolbarList;
            %buttonHash = $axmud::CLIENT->toolbarHash;

            # Refresh the simple list
            $self->windows5Tab_refreshList(
                $slWidget,
                scalar (@columnList / 2),
                \@buttonList,
                \%buttonHash,
            );
        });

        my $button10 = $self->addButton(
            $grid, 'Refresh list', 'Refresh the list of toolbar buttons',  undef,
            10, 12, 10, 11);
        $button10->signal_connect('clicked' => sub {

            # Refresh the simple list
            $self->windows5Tab_refreshList(
                $slWidget,
                scalar (@columnList / 2),
                \@buttonList,
                \%buttonHash,
            );
        });

        my $button11 = $self->addButton(
            $grid, 'Apply changes now', 'Apply changes to \'internal\' windows now',  undef,
            7, 9, 11, 12);
        $button11->signal_connect('clicked' => sub {

            my $choice = $self->showMsgDialogue(
                'Apply changes',
                'question',
                'Are you sure you want to apply your changes now?',
                'yes-no',
            );

            if ($choice && $choice eq 'yes') {

                # Update the Client's IVs
                $axmud::CLIENT->set_toolbarHash(%buttonHash);
                $axmud::CLIENT->set_toolbarList(@buttonList);

                # Tell all 'internal' windows to re-draw their toolbar strip objects
                foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {

                    my $stripObj
                        = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');

                    if ($stripObj) {

                        $stripObj->resetToolbar();
                    }
                }

                # Refresh the simple list
                $self->windows5Tab_refreshList(
                    $slWidget,
                    scalar (@columnList / 2),
                    \@buttonList,
                    \%buttonHash,
                );
            }
        });

        my $button12 = $self->addButton(
            $grid, 'Use default buttons', 'Use the default set of toolbar buttons',  undef,
            9, 12, 11, 12);
        $button12->signal_connect('clicked' => sub {

            my $choice = $self->showMsgDialogue(
                'Use default toolbar buttons',
                'question',
                'Are you sure you want to reset the toolbar? (Any custom buttons you\'ve created'
                . ' will be destroyed)',
                'yes-no',
            );

            if ($choice && $choice eq 'yes') {

                # Replace the contents of the client's IVs with the default values
                $axmud::CLIENT->initialiseToolbar();
                # Re-import the IVs
                @buttonList = $axmud::CLIENT->toolbarList;
                %buttonHash = $axmud::CLIENT->toolbarHash;

                # Tell all 'internal' windows to re-draw their toolbar strip objects
                foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {

                    my $stripObj
                        = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');

                    if ($stripObj) {

                        $stripObj->resetToolbar();
                    }
                }

                # Refresh the simple list
                $self->windows5Tab_refreshList(
                    $slWidget,
                    scalar (@columnList / 2),
                    \@buttonList,
                    \%buttonHash,
                );
            }
        });

        # Tab complete
        return 1;
    }

    sub windows5Tab_refreshList {

        # Called by $self->windows4Tab to refresh the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget       - The GA::Obj::SimpleList
        #   $columns        - The number of columns in the list
        #   $buttonListRef  - Reference to a list containing a local copy of GA::Client->buttonList
        #   $buttonHashRef  - Reference to a hash containing a local copy of GA::Client->buttonHash
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $buttonListRef, $buttonHashRef, $check) = @_;

        # Local variables
        my (
            $count,
            @dataList,
        );

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->windows5Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        $count = 0;
        foreach my $buttonName (@$buttonListRef) {

            my ($buttonObj, $path, $pixBuffer);

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            'Pane', 'int',
            'Lock', 'bool',
            'O/W', 'bool',
            'Split', 'text',
            'Wid', 'text',
            'Hei', 'text',
            'Scheme', 'text',
            'Mono', 'bool',
            'Text', 'text',
            'Undly', 'text',
            'Bckgrnd', 'text',
            'Font', 'text',
        );

        my $slWidget = $self->addSimpleList($grid, undef, \@columnList,
            1, 12, 2, 10);

        # Initialise the list
        $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2));

        # Add editing widgets
        $self->addLabel($grid, 'Size',
            1, 2, 10, 11);
        my $entry = $self->addEntryWithIcon($grid, undef, 'int', 0, undef,
            2, 4, 10, 11);
        my $button = $self->addButton(
            $grid,
            'Set default size', 'Sets the default size for textview objects', undef,
            4, 6, 10, 11);
        $button->signal_connect('clicked' => sub {

            if ($self->checkEntryIcon($entry)) {

                $self->session->pseudoCmd(
                    'settextview ' . $entry->get_text(),
                    $self->pseudoCmdMode,
                );
            }
        });

        my $button2 = $self->addButton(
            $grid,
            'Reset default size', 'Resets the default size for textview objects', undef,
            6, 9, 10, 11);
        $button2->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('settextview', $self->pseudoCmdMode);
        });

        my $button3 = $self->addButton(
            $grid,
            'Clear textview', 'Removes all text from the selected textview object', undef,
            9, 12, 10, 11);
        $button3->signal_connect('clicked' => sub {

            my ($number, $textViewObj);

            ($number) = $self->getSimpleListData($slWidget, 0);
            if (defined $number) {

                $textViewObj = $axmud::CLIENT->desktopObj->ivShow('textViewHash', $number);
                if ($textViewObj && $textViewObj->paneObj) {

                    # Clear the textview of text
                    $self->session->pseudoCmd('cleartextview -t ' . $number, $self->pseudoCmdMode);
                }
            }

            # Refresh the simple list and entry boxes
            $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button4 = $self->addButton(
            $grid,
            'Dump', 'Display the list of textview objects in the \'main\' window', undef,
            8, 10, 11, 12);
        $button4->signal_connect('clicked' => sub {

            $self->session->pseudoCmd('listtextview', $self->pseudoCmdMode);

            # Refresh the simple list and entry boxes
            $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        my $button5 = $self->addButton(
            $grid,
            'Refresh', 'Refresh the list of textview objects', undef,
            10, 12, 11, 12);
        $button5->signal_connect('clicked' => sub {

            # Refresh the simple list and entry boxes
            $self->windows6Tab_refreshList($slWidget, scalar (@columnList / 2));
        });

        # Tab complete
        return 1;
    }

    sub windows6Tab_refreshList {

        # Called by $self->windows5Tab to refresh the GA::Obj::SimpleList
        #
        # Expected arguments
        #   $slWidget   - The GA::Obj::SimpleList
        #   $columns    - The number of columns in the list
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $slWidget, $columns, $check) = @_;

        # Local variables
        my @dataList;

        # Check for improper arguments
        if (! defined $slWidget || ! defined $columns || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->windows6Tab_refreshList',
                @_,
            );
        }

        # Compile the simple list data
        foreach my $textViewObj (
            sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('textViewHash'))
        ) {
            my $paneString;

            if ($textViewObj->paneObj) {

                $paneString = $textViewObj->paneObj->number;
            }

            push (@dataList,
                $textViewObj->number,
                $textViewObj->session->number,
                $textViewObj->winObj->number,
                $paneString,
                $textViewObj->scrollLockFlag,
                $textViewObj->overwriteFlag,
                $textViewObj->splitScreenMode,
                $textViewObj->textWidthChars,
                $textViewObj->textHeightChars,
                $textViewObj->colourScheme,
                $textViewObj->monochromeFlag,
                $textViewObj->textColour,
                $textViewObj->underlayColour,
                $textViewObj->backgroundColour,
                $textViewObj->font . ' ' . $textViewObj->fontSize,
            );
        }

        # Reset the simple list
        $self->resetListData($slWidget, [@dataList], $columns);

        return 1;
    }

    sub soundTab {

        # Sound tab - called by $self->setupNotebook
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->soundTab', @_);
        }

        # Tab setup
        # Create a notebook within the main one, so that we have two rows of tabs
        my $innerNotebook = $self->addInnerNotebookTabs($self->notebook, 'So_und');

        # Add tabs to the inner notebook
        $self->sound1Tab($innerNotebook);
        $self->sound2Tab($innerNotebook);
        $self->sound3Tab($innerNotebook);

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN


        $self->addLabel($grid, 'Route type',
            7, 9, 8, 9);
        @comboList = ('road', 'quick'); # Circuit routes can't be created here
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            9, 12, 8, 9);

        my $checkButton = $self->addCheckButton($grid, 'Hoppable', undef, TRUE,
            9, 12, 9, 10);
        $checkButton->set_active(TRUE);

        $self->addLabel($grid, 'Profile',
            7, 9, 10, 11);
        # Get a list of non-world current profiles
        foreach my $category ($self->session->profPriorityList) {

            my $profObj;

            if ($category ne 'world' && $self->session->ivExists('currentProfHash', $category)) {

                $profObj = $self->session->ivShow('currentProfHash', $category);
                push (@profList, $profObj->name);
            }
        }

        # Default combo option is 'use current world'
        $worldString = '<use current world>';
        push (@profList, $worldString);

        # Reverse the list, so that it is in reverse-priority order (and so that 'use current world'
        #   appears at the top)
        @profList = reverse @profList;

        my $combo2 = $self->addComboBox($grid, undef, \@profList, '',
            TRUE,               # No 'undef' value used
            9, 12, 10, 11);

        my $button = $self->addButton(
            $grid,
            'Add pre-defined route',
            'Create a pre-defined route using this path',
            undef,
            7, 12, 11, 12,
        );
        $button->set_sensitive(FALSE);  # Button initially desensitised
        $button->signal_connect('clicked' => sub {

            my ($initialTag, $targetTag, $routeType, $flag, $profName, $cmd, $pathText);

            # Only create a route if both entry boxes are full
            if ($self->checkEntryIcon($entry, $entry2)) {

                $initialTag = $entry->get_text();
                $targetTag = $entry2->get_text();
                $routeType = $combo->get_active_text();
                $flag = $checkButton->get_active();
                $profName = $combo2->get_active_text();

                # Use the edited (not necessarily the original) path
                $pathText = $axmud::CLIENT->desktopObj->bufferGetText($buffer);

                # Prepare the client command
                $cmd = 'addroute <' . $initialTag . '> <' . $targetTag . '> <' . $pathText . '>';

                if ($routeType eq 'quick') {
                    $cmd .= ' -q';
                } else {
                    $cmd .= ' -o';      # Road route
                }

                if ($profName ne $worldString) {

                    $cmd .= ' -d ' . $profName;
                }

                if (! $flag) {

                    $cmd .= ' -h';
                }

                # Create the GA::Obj::Route
                $self->session->pseudoCmd($cmd, $self->pseudoCmdMode);
            }
        });

        # The 'Add pre-defined route' button should be desensitised when $entry and $entry2 contain
        #   unacceptable text
        $entry->signal_connect('changed' => sub {

            if ($self->checkEntryIcon($entry, $entry2)) {
                $button->set_sensitive(TRUE);
            } else {
                $button->set_sensitive(FALSE);
            }
        });
        $entry2->signal_connect('changed' => sub {

            if ($self->checkEntryIcon($entry, $entry2)) {
                $button->set_sensitive(TRUE);
            } else {
                $button->set_sensitive(FALSE);
            }
        });

        my $button2 = $self->addButton(
            $grid,
            'Abbreviate',
            'Abbreviate the directions displayed in this tab',
            undef,
            7, 10, 1, 2,
        );
        $button2->signal_connect('clicked' => sub {

            my (
                $dictObj, $startIter, $endIter, $text,
                @lineList, @newList,
            );

            # Import the session's current dictionary (for convenience)
            $dictObj = $self->session->currentDict;

lib/Games/Axmud/PrefWin.pm  view on Meta::CPAN

            1, 12, 8, 9);
        $checkButton8->set_active($axmud::CLIENT->ttsTaskFlag);
        $checkButton8->signal_connect('toggled' => sub {

            if ($checkButton8->get_active()) {
                $axmud::CLIENT->set_ttsFlag('task', TRUE);
            } else {
                $axmud::CLIENT->set_ttsFlag('task', FALSE);
            }
        });

        # Tab complete
        return 1;
    }

    sub windowsTab {

        # Windows tab
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Local variables
        my @comboList;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->windowsTab', @_);
        }

        # Tab setup
        my $grid = $self->addTab(
            $self->notebook,
            '_Windows',
            ['Window tiling settings'],
        );

        # Window tiling settings
        $self->addLabel($grid, '<b>Window tiling settings</b>',
            0, 12, 0, 1);

        $self->addLabel(
            $grid,
            '<i>Zonemap used for window tiling:</i>',
            1, 6, 1, 2);

        @comboList = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
        my $combo = $self->addComboBox($grid, undef, \@comboList, '',
            TRUE,               # No 'undef' value used
            6, 12, 1, 2);

        my $button = $self->addButton(
            $grid,
            'Apply to the default workspace (desktop) now',
            'Apply the selected zonemap to the default (first) workspace',
            undef,
            1, 12, 2, 3,
        );
        $button->signal_connect('clicked' => sub {

            my $choice = $combo->get_active_text();
            if (defined $choice) {

                $self->session->pseudoCmd('resetgrid -w 0 ' . $choice);
            }
        });

        my $button2 = $self->addButton(
            $grid,
            'Apply to the default workspace whenever ' . $axmud::SCRIPT . ' starts',
            'Apply the selected zonemap to the default (first) initial workspace',
            undef,
            1, 12, 3, 4,
        );
        $button2->signal_connect('clicked' => sub {

            my $choice = $combo->get_active_text();
            if (defined $choice) {

                $self->session->pseudoCmd(
                    'modifyinitialworkspace 0 ' . $choice,
                    $self->pseudoCmdMode,
                );
            }
        });

        # Tab complete
        return 1;
    }

    ##################
    # Accessors - set

    ##################
    # Accessors - get
}

{ package Games::Axmud::PrefWin::Search;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    our @ISA = qw(
        Games::Axmud::Generic::EditWin Games::Axmud::Generic::ConfigWin
        Games::Axmud::Generic::FreeWin Games::Axmud::Generic::Win Games::Axmud
    );

    ##################
    # Constructors

    # Contents of $self->editConfigHash after $self->new has been called:



( run in 0.551 second using v1.01-cache-2.11-cpan-f56aa216473 )