Games-Axmud
view release on metacpan or search on metacpan
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
$self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
# Refresh the simple list for the corresponding tab
$self->interfaces1Tab_refreshList(
$self->ivShow('editConfigHash', 'interface_list_' . $interfaceObj->category),
scalar (@columnList / 2),
$interfaceObj->category,
);
}
});
my $button2 = $self->addButton($grid,
'Export', 'Export selected interfaces to the interface clipboard', undef,
3, 5, 10, 11);
$button2->signal_connect('clicked' => sub {
my (
$interfaceObj,
@interfaceList,
);
@interfaceList = $self->getSimpleListData($slWidget, 0);
if (@interfaceList) {
# Empty the clipboard
$self->session->pseudoCmd(
'clearclipboard',
$self->pseudoCmdMode,
);
# Export the selected interfaces
foreach my $number (@interfaceList) {
$interfaceObj = $self->session->ivShow('interfaceNumHash', $number);
$self->session->pseudoCmd(
'export' . $interfaceObj->category . ' -i ' . $number,
$self->pseudoCmdMode,
);
}
# Refresh this simple list
$self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
# Refresh the simple list for the corresponding tab
$self->interfaces1Tab_refreshList(
$self->ivShow('editConfigHash', 'interface_list_' . $interfaceObj->category),
scalar (@columnList / 2),
$interfaceObj->category,
);
}
});
# Prepare a list of combo items. The keys are the combo items themselves, the corresponding
# values are arguments to send to $self->interfaces1Tab_refreshList
@list = (
'Numerically' => 'all',
'Alphabetically' => 'alpha',
'Dependent only' => 'dependent',
'Independent only' => 'independent',
'Triggers only' => 'trigger',
'Aliases only' => 'alias',
'Macros only' => 'macro',
'Timers only' => 'timer',
'Hooks only' => 'hook',
);
do {
my $key = shift @list;
my $value = shift @list;
push (@comboList, $key);
$comboHash{$key} = $value;
} until (! @list);
# Add the combo
$title = 'View interfaces:';
my $comboBox = $self->addComboBox($grid, undef, \@comboList, $title,
FALSE, # Title, so no 'undef' value seen
9, 12, 10, 11);
$comboBox->signal_connect('changed' => sub {
my $text = $comboBox->get_active_text();
if ($text ne $title) {
# Refresh this simple list
$listType = $comboHash{$text};
$self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
}
});
# Unusual step - also store the combo, so it can be reset by the other tabs
$self->ivAdd('editConfigHash', 'interface_combo', $comboBox);
my $button3 = $self->addButton($grid,
'Enable all', 'Enable all active interfaces', undef,
1, 3, 11, 12);
$button3->signal_connect('clicked' => sub {
# Enable all active interfaces
$self->session->pseudoCmd('enableactiveinterface', $self->pseudoCmdMode);
# Refresh this simple list
$self->interfaces1Tab_refreshList($slWidget, scalar (@columnList / 2), $listType);
# Refresh the simple list in the other tabs
foreach my $category ( ['trigger', 'alias', 'macro', 'timer', 'hook'] ) {
$self->interfaces1Tab_refreshList(
$self->ivShow('editConfigHash', 'interface_list_' . $category),
scalar (@columnList / 2),
$category,
);
}
});
my $button4 = $self->addButton($grid,
'Disable all', 'Disable all active interfaces', undef,
3, 5, 11, 12);
$button4->signal_connect('clicked' => sub {
# Disable all active interfaces
( run in 1.010 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )