Games-Axmud

 view release on metacpan or  search on metacpan

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

        }

        # Remove the Gtk3::Notebook
        $axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $self->notebook);

        # v1.1.128 This is not necessary, and in fact messes up everything
#        # Replace it with a standalone textview object
#        $axmud::CLIENT->desktopObj->removeWidget($oldTabObj->packableObj, $oldTabObj->packedObj);
#        $self->packingBox2->pack_start($oldTabObj->packedObj, TRUE, TRUE, 0);

        # Update IVs
        $self->ivUndef('notebook');
        $self->ivEmpty('tabObjHash');
        $self->ivPoke('tabObjCount', 0);

        # Add a simple tab, using the old tab's buffer and the old session
        if ($oldTabObj->defaultFlag) {

            $oldLabelText = $oldTabObj->session->getTabLabelText();
        }

        $newTabObj = $self->addSimpleTab(
            $oldTabObj->session,
            $oldTabObj->textViewObj->colourScheme,
            undef,                                  # Not called by GA::Session->setDefaultTab
            $oldTabObj->defaultFlag,
            $oldLabelText,
            $oldTabObj->textViewObj->buffer,
        );

        # Restore the scroll lock, if it was enabled in the old single textview
        if ($oldTabObj->textViewObj->scrollLockFlag) {

            $newTabObj->textViewObj->toggleScrollLock();
        }

        # Restore the old single textview's split screen mode
        $newTabObj->textViewObj->setSplitScreenMode($oldTabObj->textViewObj->splitScreenMode);

        # Update the GA::Session's tab IVs, as required
        if (
            $oldTabObj->session->defaultTabObj
            && $oldTabObj->session->defaultTabObj eq $oldTabObj
        ) {
            $oldTabObj->session->set_defaultTabObj($newTabObj);
        }

        if (
            $oldTabObj->session->currentTabObj
            && $oldTabObj->session->currentTabObj eq $oldTabObj
        ) {
            $oldTabObj->session->set_currentTabObj($newTabObj);
        }

        # Operation complete
        $self->ivPoke('tabConvertFlag', FALSE);

        return 1;
    }

    sub updateColourScheme {

        # Called by GA::Win::Internal->updateColourScheme (only)
        # When a colour scheme is modified, checks all textview objects in this pane object and
        #   updates any that use the modified colour scheme. Alternatively, when no colour scheme is
        #   specified, updates all textview objects
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Optional arguments
        #   $colourScheme   - The name of the modified colour scheme (matches a key in
        #                       GA::Client->colourSchemeHash; the calling function has already
        #                       checked it is valid). If 'undef', all pane objects are updated
        #   $noDrawFlag     - TRUE when the calling function was itself called by
        #                       GA::Win::Internal->redrawWidgets, which doesn't want this function
        #                       to call GA::Win::Generic->winShowAll or
        #                       GA::Obj::Desktop->updateWidgets as it normally would. FALSE (or
        #                       'undef') otherwise
        #
        # Return values
        #   'undef' on improper arguments
        #   1 on success

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

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

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

        # Update each tab in turn
        OUTER: foreach my $tabObj ($self->ivValues('tabObjHash')) {

            my $packedObj;

            if (! $colourScheme || $tabObj->textViewObj->colourScheme eq $colourScheme) {

                $tabObj->textViewObj->objUpdate($colourScheme);
            }
        }

        return 1;
    }

    sub applyColourScheme {

        # Can be called by anything to apply a new colour scheme to one or more of this pane
        #   object's tabs (in contrast to $self->updateColourScheme, which is only called by
        #   GA::Win::Internal->winUpdate and applies a modified colour scheme to any textview
        #   object that uses it)
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Optional arguments
        #   $tabObj         - The tab object (GA::Obj::Tab) containing the textview object to which
        #                       the colour scheme must be applied. If 'undef', the colour scheme is
        #                       applied to all tabs in this pane object
        #   $colourScheme   - The name of the colour scheme to apply (matches a key in



( run in 1.319 second using v1.01-cache-2.11-cpan-39bf76dae61 )