Games-Axmud

 view release on metacpan or  search on metacpan

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

                        'Edit ' . $self->singular . ' interface \'' . $interfaceName . '\'',
                        $interfaceObj,
                        FALSE,                          # Not temporary
                    );

                    if ($childWinObj) {

                        # When the 'edit' window closes, update widgets and/or IVs
                        $self->add_childDestroy(
                            $childWinObj,
                            'interfaces1Tab_refreshList',
                            [],         # No arguments required
                        );

                        $self->add_childDestroy(
                            $childWinObj,
                            'interfaces2Tab_refreshList',
                            [],         # No arguments required
                        );
                    }
                }
            }
        });

        my $button3 = $self->addButton(
            $grid,
            'Delete',
            'Delete the selected ' . $self->singular,
            undef,
            3, 4, 11, 12,
            TRUE,               # Irreversible
        );
        $button3->signal_connect('clicked' => sub {

            my ($interfaceName, $profName);

            ($interfaceName) = $self->getSimpleListData($slWidget, 0);
            $profName = $self->editObj->profName;

            if (defined $interfaceName && defined $profName) {

                # Check that there's an interface with that name stored in this cage
                if ($self->editObj->ivExists('interfaceHash', $interfaceName)) {

                    # Delete the interface
                    $self->session->pseudoCmd(
                        'delete' . $self->singular . ' ' . $interfaceName . ' -d ' . $profName,
                        $self->pseudoCmdMode,
                    );

                    # Refresh (both) lists
                    $self->interfaces1Tab_refreshList();
                    $self->interfaces2Tab_refreshList();
                }
            }
        });

        my $button4 = $self->addButton(
            $grid,
            'Export',
            'Export selected ' . $self->plural . ' to the interface clipboard',
            undef,
            4, 6, 11, 12,
            TRUE,               # Irreversible
        );
        $button4->signal_connect('clicked' => sub {

            my (
                $profName,
                @interfaceList,
            );

            @interfaceList = $self->getSimpleListData($slWidget, 0);
            $profName = $self->editObj->profName;

            if (@interfaceList && defined $profName) {

                # Empty the clipboard
                $self->session->pseudoCmd(
                    'clearclipboard',
                    $self->pseudoCmdMode,
                );

                # Export the selected interfaces
                foreach my $interfaceName (@interfaceList) {

                    $self->session->pseudoCmd(
                        'export' . $self->singular . ' ' . $interfaceName . ' -d ' . $profName,
                        $self->pseudoCmdMode,
                    );
                }

                # Refresh (both) lists
                $self->interfaces1Tab_refreshList();
                $self->interfaces2Tab_refreshList();
            }
        });

        my $button5 = $self->addButton(
            $grid,
            'Import',
            'Import all ' . $self->plural . ' from the interface clipboard',
            undef,
            6, 8, 11, 12,
            TRUE,               # Irreversible
        );
        $button5->signal_connect('clicked' => sub {

            my $profName = $self->editObj->profName;

            if (defined $profName) {

                # Import all interfaces of the correct category (triggers, etc)
                $self->session->pseudoCmd(
                    'import' . $self->singular . ' -d ' . $profName,
                    $self->pseudoCmdMode,
                );

                # Refresh (both) lists
                $self->interfaces1Tab_refreshList();
                $self->interfaces2Tab_refreshList();
            }
        });

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

            my $profName = $self->editObj->profName;
            if ($profName) {

                # Display the data
                $self->session->pseudoCmd(
                    'list' . $self->singular . ' -d ' . $profName,
                    $self->pseudoCmdMode,
                );

                # Refresh (both) lists
                $self->interfaces1Tab_refreshList();
                $self->interfaces2Tab_refreshList();
            }
        });

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

            # Refresh (both) lists
            $self->interfaces1Tab_refreshList();
            $self->interfaces2Tab_refreshList();
        });



( run in 1.175 second using v1.01-cache-2.11-cpan-84e82930d8c )