view release on metacpan or search on metacpan
'Retain backup copies after saving' option in the same tab. Also fixed a
failure to save the files at all in some circumstances (Git #6)
- Fixed the Debian installer (which did not work at all in the previous release)
- Created a new MS Windows installer, since the old one relied on software
repositories that no longer exist. The new installer resolves several other
compatibility and dependency issues. It is probably not possible to run
Axmud with Strawberry Perl or with ActivePerl any more, but MSYS2 still
works just fine, as long as it is set up correctly
- On MS Windows, the code that aligns windows on a grid does not work as
intended because of unresolved problems with the Gtk graphics library, or
perhaps the MS Windows desktop itself. I have added a workaround which
compensates for these problems. If it doesn't improve things on your system,
you can disable the workaround by clicking 'Edit > Axmud preferences... >
Workspaces > Page 1', deselecting the button 'Tweak the size/position...'
and then by setting the sizes of window controls/panels manually in the
'Workspaces > Page 2' tab; see the help for the ;setwindowcontrol and
;setpanel commands)
Minor fixes
- In the automapper window, graffiti mode (when enabled) made no visible changes
to rooms. Tweaked the code which should resolve the problem
- New hook events for these protocols - 'zmp', 'aard102' and 'mcp'
- 'Free' windows (such as the Connections window, edit and preference windows)
were too small on some popular Linux distros and on *BSD. Axmud now
attempts to increase the default size of these windows, if it thinks the
default size isn't big enough. You can now set the default size yourself, if
you need to, using the ';setwindowsize' command (or in the client preference
window). The layout of the Connections window has been rearranged so that
increasing the default the size is necessary on fewer systems
- Window tiling is still disabled on MS Windows. Axmud now remembers the size
and position of each type of window, so you only need to rearrange windows
on your desktop once. On Linux and *BSD, this functionality is turned off by
default, but can be turned on if you want to disactive window tiling
(using the ';disactivategrid' command). New client commands are available:
';togglewindowstorage', ';applywindowstorage', ';dumpwindowstorage' and
';clearwindowstorage'
- A new type of random exit. When an exit leads to a randomly-generated area
every time you go through it, you can now set the exit so that Axmud
automatically creates a temporary region. Axmud will also try to detect
when you've arrived back at the original room and, at that point, the
temporary region is deleted
nsis/axmud_install.nsi
nsis/axmud_mswin.sh
nsis/axmud_wizard.bmp
nsis/baxmud_mswin.sh
nsis/blindaxmud.bat
nsis/ipc_run/README
nsis/ipc_run/Run.txt
nsis/license.txt
nsis/README
nsis/runaxmud.bat
pack/axmud.desktop
pack/axmud.png
pack/axmud.xpm
pack/baxmud.desktop
pack/debian_descrip
pack/install
pack/README
README.rst
screenshots/shot1.png
screenshots/shot10.png
screenshots/shot10m.png
screenshots/shot11.png
screenshots/shot11m.png
screenshots/shot12.png
- `RPM package (for RHEL-based distros, e.g. Fedora) <https://sourceforge.net/projects/axmud/files/Axmud-2.0.0/perl-Games-Axmud-2.0.0.noarch.rpm/download>`__ from Sourceforge
Source code:
- `Source code <https://sourceforge.net/projects/axmud/files/Axmud-2.0.0/Games-Axmud-2.0.0.tar.gz/download>`__ from Sourceforge (see also the source code for `MS Windows <https://sourceforge.net/projects/axmud/files/Axmud-2.0.0/Games-Axmud-2.0.0.tar....
- `Source code <https://github.com/axcore/axmud>`__ and `support <https://github.com/axcore/axmud/issues>`__ from GitHub
3 Running Axmud
===============
There are several ways to install Axmud (see below). Most of them will add an Axmud icon to your desktop, and an entry in your Start Menu.
There are actually two versions of Axmud: a 'normal' version, and a version with optimised settings for visually-impaired users.
The optimised version will start talking at you, as soon as you start it. (If you don't hear anything, then perhaps there are no text-to-speech engines installed on your system.)
If you're running Axmud from the command line, visually-impaired users can run this script:
**baxmud.pl**
Other users can run this script:
lib/Games/Axmud/Client.pm view on Meta::CPAN
my $self = {
_objName => 'client',
_objClass => $class,
_parentFile => undef, # No parent file object
_parentWorld => undef, # No parent file object
_privFlag => TRUE, # All IVs are private
# Perl object components
# ----------------------
# The main desktop object (GA::Obj::Desktop), which arranges windows on the desktop
# across one or more workspaces
desktopObj => undef,
# An IV which stores a 'main' window. First set when Axmud starts, and a spare 'main'
# window, not belonging to any session, opens before the Connections window opens
# Briefly set back to 'undef' when the spare 'main' window is destroyed, just before a
# new 'main' window for a new session is created to replace it
# Then set whenever $self->currentSession is set
mainWin => undef,
# The About window (only one can be open at a time)
aboutWin => undef, # Set by $self->set_aboutWin
lib/Games/Axmud/Client.pm view on Meta::CPAN
'connect' => undef,
'console' => undef,
'contact' => undef,
'contacts' => undef,
'current' => undef,
'custom' => undef,
'default' => undef,
'defn' => undef,
'definition' => undef,
'delete' => undef,
'desktop' => undef,
'dict' => undef,
'dictionary' => undef,
'dicts' => undef,
'edit' => undef,
'exit' => undef,
'external' => undef,
'favourite' => undef,
'favorite' => undef, # American too
'file' => undef,
'fixed' => undef,
lib/Games/Axmud/Client.pm view on Meta::CPAN
debugMcpFlag => FALSE, # [config]
# Desktop and display settings
# ----------------------------
# Display variables
# Axmud makes use of a number of windows, both those it creates and 'external' windows
# it doesn't create
# 'grid' windows are permanent (or semi-permanent). Axmud tries to arrange these windows
# so they don't overlap or, if there isn't enough room on the workspace, to make them
# overlap in sensible ways. Axmud tries to take account of the different desktop
# environments in getting the positioning of its windows right. 'grid' windows can
# include 'external' windows, such as media players, so that they don't overlap
# Axmud's own windows (if required)
# 'free' windows are temporary, and are displayed in the middle of the workspace without
# regard for the positioning of any 'grid' windows
# If your system has multiple workspaces available, 'grid' windows can be arranged on
# each one of them. Each workspace can have one or more 'workspace grids' on which
# 'grid' windows for that workspace are arranged
#
# NB Recent Axmud versions can draw task windows and the Automapper window inside the
lib/Games/Axmud/Client.pm view on Meta::CPAN
# every workspace in use). When the current session changes, no windows are
# made visible or invisible (usually minimised or un-minimised)
shareMainWinFlag => TRUE, # [config]
# When the user wants to change the setting of ->shareMainWinFlag, the change can't be
# applied immediately.
# Instead, this IV is set to 'on' or 'off'. When Axmud next starts, if this IV is not
# set to 'default', ->shareMainWinFlag is set to TRUE (for 'on') or FALSE (for 'off');
# ->restartShareMainWinMode is then set back to 'default'
restartShareMainWinMode => 'default', # [config]
# Workspace grids can be available, or not. GA::Obj::Desktop->gridPermitFlag is set to
# FALSE if workspace grids are not available at all (because the desktop is too small,
# because Axmud is running on MS Windows or running in blind mode, etc)
# Independent of that flag is this one, which the user can set with
# ';activategrid' and ';disactivategrid'. When Axmud starts, it tries to create
# workspace grids if this flag and GA::Obj::Desktop->gridPermitFlag are both TRUE
activateGridFlag => TRUE, # [config]
# When workspace grids are not available, Axmud can try to remember the size and
# position of its 'grid' windows. Users can adjust the size/positions manually, and
# have those settings applied in future sessions
# Flag set to TRUE if Axmud should try to remember the size and position of 'grid'
# windows, FALSE if not (can be TRUE even if workspace grids are available)
lib/Games/Axmud/Client.pm view on Meta::CPAN
# (none besides $self)
#
# Return values
# 'undef' on improper arguments or if setup fails
# 1 otherwise
my ($self, $check) = @_;
# Local variables
my (
$warningFlag, $roomObj, $exitObj, $desktopObj, $host, $engine, $port, $world, $profObj,
$taskObj, $offlineFlag,
@list,
);
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->start', @_);
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
# Initialise the default set of toolbar button objects
if (! $self->initialiseToolbar()) {
return $self->writeError(
'Could not initialise toolbar button objects',
$self->_objClass . '->start',
);
}
# Create the main desktop object. Set up the default workspace, set up window icons, prepare
# rc-file styles for each kind of window, create the first 'main' window
$desktopObj = Games::Axmud::Obj::Desktop->new();
if (! $desktopObj) {
return $self->writeError(
'Could not set up the desktop',
$self->_objClass . '->start',
);
} else {
$self->ivPoke('desktopObj', $desktopObj);
if (! $desktopObj->start()) {
return $self->writeError(
'Could not set up the desktop',
$self->_objClass . '->start',
);
} else {
# Loading of data files and plugins could take some seconds; make the whole 'main'
# window visible in the meantime
$desktopObj->updateWidgets($self->_objClass . '->start');
}
}
# Perform an auto-backup of Axmud's data directory, if required
if (
$self->autoBackupMode eq 'all_start'
|| (
$self->autoBackupMode eq 'interval_start' && $self->checkBackupInterval()
)
) {
lib/Games/Axmud/Client.pm view on Meta::CPAN
'Error reading (or creating) data files - loading/saving disabled',
$self->_objClass . '->start',
);
# Disable all loading/saving of data files (the TRUE argument means 'don't prompt the
# user to do an emergency save')
$self->disableAllFileAccess(TRUE);
}
# Add remaining workspaces, if any are specified
$desktopObj->setupWorkspaces();
# Set up client commands
if (! $self->setupCmds()) {
# (Allow writing to something other than GA::Session - there are no sessions yet)
return $self->writeError(
'Could not initialise ' . $axmud::SCRIPT . ' client commands',
$self->_objClass . '->start',
);
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
# Don't show the setup window twice
$self->set_showSetupWizWinFlag(FALSE);
} else {
# Open the setup window. When it closes, it will open the Connections window for us
$self->mainWin->quickFreeWin('Games::Axmud::WizWin::Setup');
# Disable most main window toolbar/menu items, while the window is open
$self->desktopObj->restrictWidgets();
# Don't show the setup window twice
$self->set_showSetupWizWinFlag(FALSE);
return 1;
}
}
if (@ARGV) {
lib/Games/Axmud/Client.pm view on Meta::CPAN
if ($self->clientLoopObj && ! $self->stopClientLoop()) {
return $self->writeError(
'Could not stop the client loop',
$self->_objClass . '->stop',
);
}
# Close any remaining 'internal' windows, restore 'external' windows to their original size/
# position, close any remaining 'free' windows
if (! $self->desktopObj->stop()) {
return $self->writeError(
'Could not stop the desktop object',
$self->_objClass . '->stop',
);
}
# Delete everything in the temporary directories
# (The former is for plugins; the latter is for Axmud code)
foreach my $tempDir ($axmud::DATA_DIR . '/tmp/', $axmud::DATA_DIR . '/data/temp/') {
# Simplest way to empty the directory and all its sub-directories seems to be to
# destroy the directory and make a new one
lib/Games/Axmud/Client.pm view on Meta::CPAN
# 1 if $zonemap is in use by any workspace grid
my ($self, $zonemap, $check) = @_;
# Check for improper arguments
if (! defined $zonemap || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->checkCurrentZonemap', @_);
}
foreach my $workspaceGridObj ($self->desktopObj->ivValues('gridHash')) {
if ($workspaceGridObj->zonemap && $workspaceGridObj->zonemap eq $zonemap) {
return 1;
}
}
# $zonemap isn't in use by any workspace grid
return undef;
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
@faveList, @visitedList, @otherList, @comboList, @comboList2, @comboList3,
%worldHash, %nameHash, %checkHash, %loginHash,
);
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->connectBlind', @_);
}
# Make sure the test window for finding desktop panels has been removed
$self->desktopObj->updateWidgets($self->_objClass . '->connectBlind');
# Get a list of worlds, favourite worlds first, then all visited worlds sorted by number
# of visits, finally unvisited worlds sorted alphabetically
# (Code borrowed from GA::OtherWin::Connect->resetTreeView)
$newWorldString = 'Create new world';
$newCharString = 'Create new character';
# For each world, decide which name to use. Create a hash in the form
# $nameHash{profile_name} = displayed_name
# (where 'displayed_name' is the long name, if available, or the profile name, if not
lib/Games/Axmud/Client.pm view on Meta::CPAN
# Update IVs
$self->ivPoke('clientTime', $loopObj->spinTime);
# Update blinkers states for each session
foreach my $session ($self->listSessions()) {
$session->updateBlinkers();
}
# Update 'internal' windows
foreach my $winObj ($self->desktopObj->listGridWins()) {
my (
$stripObj,
%hash,
);
if (
$winObj->winType eq 'main'
|| $winObj->winType eq 'protocol'
|| $winObj->winType eq 'custom'
lib/Games/Axmud/Client.pm view on Meta::CPAN
# Redraw this blinker
$stripObj->drawBlinker($blinkerNum, ! ($blinkerObj->onFlag));
}
}
}
}
}
}
# Get a list of textview buffers which might contain blinking text
foreach my $textViewObj ($self->desktopObj->ivValues('textViewHash')) {
push (@bufferList, $textViewObj->buffer);
}
# Update the buffers' text tags (if it's time to do so), making the text appear or disappear
# on cue
if ($self->clientTime > $self->blinkSlowCheckTime) {
foreach my $buffer (@bufferList) {
lib/Games/Axmud/Client.pm view on Meta::CPAN
@winObjList,
);
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->checkMainWinTitles', @_);
}
# Get an ordered list of all 'main' windows
@winObjList = $self->desktopObj->listGridWins('main');
# Check file objects for the client
if ($self->showModFlag) {
# 'main' window titles contain an asterisk, meaning that some files need to be saved. If
# they have all been saved, we change the titles
OUTER: foreach my $fileObj ($self->ivValues('fileObjHash')) {
if ($fileObj->modifyFlag) {
lib/Games/Axmud/Client.pm view on Meta::CPAN
foreach my $time ($self->ivKeys('paneRestoreHash')) {
my $paneObj;
if ($time < $self->clientTime) {
$paneObj = $self->ivShow('paneRestoreHash', $time);
# Check the pane object and its window still exist (just in case)
if (
$paneObj->winObj
&& $self->desktopObj->ivExists('gridWinHash', $paneObj->winObj->number)
) {
# Restore this pane object's border size immediately
$paneObj->set_borderWidth(FALSE);
$self->ivDelete('paneRestoreHash', $time);
}
}
}
return 1;
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
if ($self->ivExists('clientCmdReplacePrettyHash', $plugin)) {
$listRef = $self->ivShow('clientCmdReplacePrettyHash', $plugin);
if (defined $listRef && @$listRef) {
$self->ivPush('clientCmdPrettyList', @$listRef);
}
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$self->desktopObj->restrictWidgets();
# Operation complete
return 1;
}
sub disablePlugin {
# Called by GA::Cmd::DisablePlugin->do
# Disables a loaded plugin. Halts all of the plugin's tasks (new tasks from the plugin
# can't start). Closes any windows of the types added by the plugin. Disables any client
lib/Games/Axmud/Client.pm view on Meta::CPAN
foreach my $taskName ($self->ivKeys('pluginTaskHash')) {
if ($plugin eq $self->ivShow('pluginTaskHash', $taskName)) {
$self->ttsResetAttribs($taskName);
}
}
# Close any 'free' windows added by the plugin
foreach my $winObj
(sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
{
my $thisPlugin = $self->ivShow('pluginFreeWinHash', $winObj->_objClass);
if (defined $thisPlugin && $thisPlugin eq $plugin) {
# Close the window
$winObj->winDestroy();
}
}
# Close any 'grid' windows added by the plugin
foreach my $winObj
(sort {$a->number <=> $b->number} ($self->desktopObj->ivValues('freeWinHash')))
{
my $thisPlugin = $self->ivShow('pluginGridWinHash', $winObj->_objClass);
if (defined $thisPlugin && $thisPlugin eq $plugin) {
# For 'main' windows, terminate any session using the window
if ($winObj->winType eq 'main') {
foreach my $session
(sort {$a->number <=> $b->number} ($self->ivValues('sessionHash')))
{
lib/Games/Axmud/Client.pm view on Meta::CPAN
if ($matchFlag) {
# Remove the group headings and client commands from this plugin
$self->ivSplice('clientCmdPrettyList', $index, scalar @$listRef);
}
}
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$self->desktopObj->restrictWidgets();
# Operation complete
return 1;
}
sub addPluginCmds {
# Called by any Axmud plugin
# Adds client commands defined in the plugin
#
lib/Games/Axmud/Client.pm view on Meta::CPAN
return undef;
} else {
$self->ivAdd('pluginMenuFuncHash', $plugin, $funcRef);
}
# Any 'internal' windows which already exist and which have a menu strip object should add a
# sub-menu for this plugin now; any new 'internal' windows created from now will
# automatically call the referenced function to add their own sub-menus
foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
my ($stripObj, $subMenu);
if (
$winObj->winType eq 'main'
|| $winObj->winType eq 'protocol'
|| $winObj->winType eq 'custom'
) {
$stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::MenuBar');
if ($stripObj) {
lib/Games/Axmud/Client.pm view on Meta::CPAN
$self->ivPoke('autoCompleteMode', $mode);
$self->ivUndef('instructBufferPosn');
$self->ivUndef('cmdBufferPosn');
foreach my $session ($self->listSessions()) {
$session->set_instructBufferPosn();
$session->set_cmdBufferPosn();
}
foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
$winObj->resetEntry();
}
# The data stored in this IV is saved in the 'config' file
$self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteMode');
return 1;
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
$self->ivUndef('instructBufferPosn');
$self->ivUndef('cmdBufferPosn');
foreach my $session ($self->listSessions()) {
$session->set_instructBufferPosn();
$session->set_cmdBufferPosn();
}
foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
$winObj->resetEntry();
}
# The data stored in this IV is saved in the 'config' file
$self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteParent');
return 1;
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
$self->ivUndef('instructBufferPosn');
$self->ivUndef('cmdBufferPosn');
foreach my $session ($self->listSessions()) {
$session->set_instructBufferPosn();
$session->set_cmdBufferPosn();
}
foreach my $winObj ($self->desktopObj->ivValues('gridWinHash')) {
$winObj->resetEntry();
}
# The data stored in this IV is saved in the 'config' file
$self->setModifyFlag('config', TRUE, $self->_objClass . '->set_autoCompleteType');
return 1;
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
|| $winObj->winCategory ne 'grid'
|| $winObj->winType eq 'external'
|| (! defined $xPos && ! defined $yPos && ! defined $width && ! defined $height)
) {
return undef;
}
# An entry is added/replaced in $self->storeGridPosnHash for any 'grid' window, but if there
# are several windows with the same ->winName open, only the one which was opened first is
# used
foreach my $otherWinObj ($self->desktopObj->ivValues('gridWinHash')) {
if (
$otherWinObj ne $winObj
&& $otherWinObj->winName eq $winObj->winName
&& $otherWinObj->number < $winObj->number
) {
return undef;
}
}
lib/Games/Axmud/Client.pm view on Meta::CPAN
# The data stored in this IV is saved in the 'zonemaps' file
$self->setModifyFlag('zonemaps', TRUE, $self->_objClass . '->del_zonemap');
return 1;
}
##################
# Accessors - get
sub desktopObj
{ $_[0]->{desktopObj} }
sub mainWin
{ $_[0]->{mainWin} }
sub aboutWin
{ $_[0]->{aboutWin} }
sub busyWin
{ $_[0]->{busyWin} }
sub connectWin
{ $_[0]->{connectWin} }
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
);
# Check for improper arguments
if ((defined $switch && $switch ne '-f') || defined $check) {
return $self->improper($session, $inputString);
}
# It might be a long wait, so make sure the message is visible right away
$session->writeText('Testing \'' . $session->currentWorld->name . '\' world model...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Perform the test
if ($switch) {
($errorCount, $fixCount, @outputList) = $session->worldModelObj->testModel(
$session,
TRUE, # Fix problems
TRUE, # Use a list of return values
);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$axmud::CLIENT->set_toolbarLabelFlag(TRUE);
$string = 'ON';
} else {
$axmud::CLIENT->set_toolbarLabelFlag(FALSE);
$string = 'OFF';
}
# Update all 'main' and automapper windows
foreach my $winObj ($axmud::CLIENT->desktopObj->ivValues('gridWinHash')) {
my $stripObj;
if ($winObj->winType eq 'main') {
$stripObj = $winObj->getStrip('toolbar');
if ($stripObj) {
$stripObj->resetToolbar();
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
# However, in blind mode don't display a message at all; speech engine struggle to read
# 'file(s)' correctly, and those users are probably not using the automapper anyway, so
# file saves will be more or less instantaneous
if (! $axmud::BLIND_MODE_FLAG) {
$session->writeText('Saving file(s)...');
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# (1) 'config'
if (exists $otherHash{'config'}) {
my $fileObj = $fileObjHash{'config'};
if ($fileObj->modifyFlag || $forceFlag) {
if ($fileObj->saveConfigFile()) {
$count++;
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->complete($session, $standardCmd, 'No files loaded');
}
}
# For large files (e.g. world model containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Loading file(s)...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Load every file in the hash
$count = 0;
$errorCount = 0;
foreach my $file (keys %loadHash) {
my $fileObj;
if ($file eq 'worldmodel') {
$fileObj = $session->ivShow('sessionFileObjHash', $file);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
} else {
$exportPath = $axmud::SHARE_DIR . '/items/worlds/' . $axmud::CLIENT->privConfigAllWorld
. '/' . $axmud::CLIENT->privConfigAllWorld . '.tgz';
}
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Exporting file(s)...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Create a tar object
$tarObj = Archive::Tar->new();
# Save the list of files to the tar object's memory archive
foreach my $file (@exportList) {
my $path = $axmud::DATA_DIR . '/' . $file;
$tarObj->add_files($path);
# Rename each file in the archive to remove the directory structure
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'File(s) not imported (you specified something that doesn\'t appear to be a'
. ' compressed archive, e.g. a .zip or .tar.gz file)',
);
}
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Importing file(s)...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Build an Archive::Extract object
$extractObj = Archive::Extract->new(archive => $importPath);
if (! $extractObj) {
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->error(
$session, $inputString,
'No files imported (file decompression error)',
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'Unknown text-to-speech configuration object \'' . $name . '\'',
);
}
}
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Exporting data...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# %saveHash doesn't include the data file's header information
# Insert the header information into %saveHash, and then export the data by saving it as a
# file
$exportFile = $axmud::CLIENT->configFileObj->exportDataFile($session, $switch, $name);
if (! $exportFile) {
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->error($session, $inputString, 'No data exported');
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->complete($session, $standardCmd, 'Data not imported');
}
}
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Importing data...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Import the data into memory
$fileType = $axmud::CLIENT->configFileObj->importDataFile($session, $importPath);
if (! $fileType) {
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->error($session, $inputString, 'No data imported');
} else {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
);
}
if (! $backupPath) {
return $self->complete($session, $standardCmd, 'Data backup not completed');
}
# In case the data directory is large, display an initial message to explain the pause
$session->writeText('Backing up ' . $axmud::SCRIPT . ' data directory...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Get a list of files in the data directory, recursively searching sub-directories
File::Find::find(
sub { push (@fileList, $File::Find::name); },
$dataDir . '/',
);
# Perform the backup
if ($ext eq 'zip') {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
) {
return $self->error(
$session, $inputString,
'Restore data from backup not completed (you specified something that doesn\'t'
. ' appear to be a compressed archive, e.g. a .zip or .tgz file)',
);
}
# For large files, we need to display an initial message to explain the pause
$session->writeText('Restoring data from backup...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# The old directory is not replaced, but renamed. Cycle through a list of possible names
# until we find one that isn't in use (give up after a reasonable time)
if (! -e $axmud::DATA_DIR . '_OLD') {
$oldDataDir = $axmud::DATA_DIR . '_OLD';
} else {
OUTER: for (my $count = 2; $count <= 1024; $count++) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'Invalid download link \'' . $string . '\'',
);
}
# Attempt to download the file
$session->writeText('Downloading sound pack \'' . $string . '\'...');
# It might be a long wait, so make sure the message is visible right away
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
$fetchObj = File::Fetch->new(uri => $string);
$dlPath = $fetchObj->fetch(to => $axmud::DATA_DIR . '/data/temp');
if (! $dlPath) {
return $self->error(
$session, $inputString,
'Sound pack download failed; check the link and try again',
);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$dlPath =~ m/\.tar$/
|| $dlPath =~ m/\.tgz$/
|| $dlPath =~ m/\.gz$/
|| $dlPath =~ m/\.zip$/
|| $dlPath =~ m/\.bz2$/
|| $dlPath =~ m/\.tbz$/
|| $dlPath =~ m/\.lzma$/
) {
# Attempt to extract the file
$session->writeText('Sound pack downloaded, extracting...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Build an Archive::Extract object
$extractObj = Archive::Extract->new(archive => $dlPath);
if (! $extractObj) {
return $self->error(
$session, $inputString,
'No files extracted (file decompression error)',
);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
@list,
);
# Check for improper arguments
if (! defined $name || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
@list = $axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE);
if (@list) {
OUTER: foreach my $winObj (@list) {
if ($winObj->_objClass eq 'Games::Axmud::EditWin::Dict') {
$matchFlag = TRUE;
last OUTER;
}
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
@list,
);
# Check for improper arguments
if (! defined $name || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no dictionary 'edit' windows open
@list = $axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE);
if (@list) {
OUTER: foreach my $winObj (@list) {
if ($winObj->_objClass eq 'Games::Axmud::EditWin::Dict') {
$matchFlag = TRUE;
last OUTER;
}
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($result, $statusTask);
# Check for improper arguments
if (! defined $world || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t set the current world profile while there are edit, preference and wizard'
. ' windows open (try closing them first)',
);
}
# If the world profile already exists, use it
if ($axmud::CLIENT->ivExists('worldProfHash', $world)) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($worldObj, $result, $fileObj);
# Check for improper arguments
if (! defined $worldName || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t delete a world profile while there are edit, preference and wizard windows'
. ' open (try closing them first)',
);
}
# Check that profile exists
if (! $axmud::CLIENT->ivExists('worldProfHash', $worldName)) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
%fileObjHash, %worldHash, %archivePathHash, %newHash,
);
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t restore a world profile while there are edit, preference and wizard windows'
. ' open (try closing them first)',
);
}
# Check that all sessions have their ->status set to 'disconnected' (already disconnected
# from the world), or running in 'connect offline' mode
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($profObj, $templObj, $oldObj, $currentObj, $fixedFlag);
# Check for improper arguments
if (! defined $profile || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t set a current profile while there are edit, preference and wizard windows'
. ' open (try closing them first)',
);
}
# The user can only omit <templ> if the custom profile <name> already exists
if (! $templ) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my $profObj;
# Check for improper arguments
if (! defined $profile || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t unset a current profile while there are edit, preference and wizard windows'
. ' open (try closing them first)',
);
}
# Check that the profile exists
if (! $session->ivExists('profHash', $profile)) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($profObj, $category);
# Check for improper arguments
if (! defined $profile || defined $check) {
return $self->improper($session, $inputString);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t delete a profile while there are edit, preference and wizard windows'
. ' open (try closing them first)',
);
}
# Check that the original profile exists (without which, we can't find its
# ->category)
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Execute the script
if (! $scriptObj->implement()) {
return $self->error(
$session, $inputString,
'Execution of the ' . $axmud::BASIC_NAME . ' script \'' . $scriptName . '\' failed',
);
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
if ($scriptObj->scriptStatus eq 'paused') {
return $self->complete(
$session, $standardCmd,
'Execution of the ' . $axmud::BASIC_NAME . ' script \'' . $scriptName
. '\' started',
);
} else {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Get the remaining argument (if any)
$name = shift @args;
# There should be no further arguments
if (@args) {
return $self->improper($session, $inputString);
}
# In certain circumstances, new workspaces can't be used
if (! $axmud::CLIENT->desktopObj->newWorkspaceFlag) {
return $self->error(
$session, $inputString,
'Unable to use any new workspaces (try restarting ' . $axmud::SCRIPT . ')',
);
}
# If a zonemap was specified, check it exists
if (defined $zonemap && ! $axmud::CLIENT->ivExists('zonemapHash', $zonemap)) {
return $self->error(
$session, $inputString,
'Zonemap \'' . $zonemap . '\' doesn\'t exist',
);
}
# Get a list of Gnome2::Workspace objects (which might conceivably be different to the
# list found on the original call to GA::Obj::Desktop->detectWorkspaces)
@workspaceList = $axmud::CLIENT->desktopObj->detectWorkspaces();
# ;uws
if (! defined $name) {
# Find the first available workspace that's not in use
OUTER: foreach my $workspace (@workspaceList) {
INNER: foreach $workspaceObj (
$axmud::CLIENT->desktopObj->ivValues('workspaceHash')
) {
if ($workspaceObj->systemNum eq $workspace) {
next OUTER;
}
}
# This workspace is not in use, but is available
$useWorkspace = $workspace;
last OUTER;
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
if (! $useWorkspace) {
return $self->error(
$session, $inputString,
'System workspace \'' . $name . '\' not found',
);
}
}
# Add a workspace object (GA::Obj::Workspace) for this workspace
$workspaceObj = $axmud::CLIENT->desktopObj->useWorkspace($useWorkspace, $zonemap);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'General error adding the system workspace \'' . $name . '\'',
);
} else {
return $self->complete(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my $obj;
# Check for improper arguments
if (! defined $number || defined $check) {
return $self->improper($session, $inputString);
}
# Check the workspace object exists
$obj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $number);
if (! $obj) {
return $self->error(
$session, $inputString,
'Could not edit workspace object #' . $number . ' - object does not exist',
);
}
# Open an 'edit' window for the workspace object
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($workspaceObj, $gridCount, $mainCount, $msg, $choice);
# Check for improper arguments
if (! defined $num || defined $check) {
return $self->improper($session, $inputString);
}
# Check the workspace object exists
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $num . ' is not currently in use (try \';listworkspace\')',
);
}
# The default workspace (the one in which Axmud opened) can't be removed
if ($num == 0) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->complete(
$session, $standardCmd,
'Remove workspace operation cancelled',
);
}
}
}
# Remove the workspace
if (! $axmud::CLIENT->desktopObj->del_workspace($workspaceObj)) {
return $self->error(
$session, $inputString,
'General error removing workspace #' . $num,
);
} else {
return $self->complete(
$session, $standardCmd,
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Display header
$session->writeText('Workspace status');
$msg = ' ' . $axmud::SCRIPT . ' is capable of creating workspace grids: ';
if ($axmud::CLIENT->desktopObj->gridPermitFlag) {
$msg .= 'yes';
} else {
$msg .= 'no';
}
$session->writeText($msg);
$msg = ' Workspace grids are activated in general: ';
if ($axmud::CLIENT->activateGridFlag) {
$msg .= 'yes';
} else {
$msg .= 'no';
}
$session->writeText($msg);
$session->writeText('List of workspaces currently used by ' . $axmud::SCRIPT);
# Display list
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
$session->writeText(
' Workspace #' . $workspaceObj->number . ' (system: #'
. $workspaceObj->systemNum . '\')',
);
$session->writeText(
' Size: width ' . $workspaceObj->currentWidth . ' height '
. $workspaceObj->currentHeight,
);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$session->writeText(
' Workspace grids found: ' . $workspaceObj->ivPairs('gridHash')
. ', default zonemap: ' . $workspaceObj->defaultZonemap,
);
}
}
# Get a list of unused system workspace numbers (which might conceivably be different to
# the list found on the original call to GA::Obj::Desktop->detectWorkspaces)
@workspaceList = $axmud::CLIENT->desktopObj->detectUnusedWorkspaces();
if (@workspaceList) {
$session->writeText('List of unused (but available) workspaces');
foreach my $workspace (@workspaceList) {
$session->writeText(' System #' . $workspace);
}
}
# Display footer
return $self->complete(
$session, $standardCmd,
'End of list (workspaces used: '
. $axmud::CLIENT->desktopObj->ivPairs('workspaceHash')
. ', not used but available: ' . (scalar @workspaceList) . ')',
);
}
}
{ package Games::Axmud::Cmd::SetWorkspaceDirection;
use strict;
use warnings;
# use diagnostics;
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
}
# Decide which workspace should perform the test
if (! defined $num) {
# If none specified, use the default workspace
$num = 0;
}
# Check the specified workspace exists
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error($session, $inputString, 'Workspace #' . $num . ' doesn\'t exist');
}
# Perform the test
@sizeList = $workspaceObj->findWinControlSize();
if (! @sizeList) {
return $self->error(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
),
);
}
# Display header
$session->writeText('List of window controls sizes in workspaces');
$session->writeText(' Wkspace Left Right Top Bottom');
# Display list
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
$session->writeText(
' ' . sprintf(
'%-4.4s %-5.5s %-5.5s %-5.5s %-5.5s',
$workspaceObj->number,
$workspaceObj->controlsLeftSize,
$workspaceObj->controlsRightSize,
$workspaceObj->controlsTopSize,
$workspaceObj->controlsBottomSize,
),
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
}
# Decide which workspace should perform the test
if (! defined $num) {
# If none specified, use the default workspace
$num = 0;
}
# Check the specified workspace exists
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error($session, $inputString, 'Workspace #' . $num . ' doesn\'t exist');
}
# Perform the test
@sizeList = $workspaceObj->findPanelSize();
if (! @sizeList) {
return $self->error(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
),
);
}
# Display header
$session->writeText('List of panel sizes in workspaces');
$session->writeText(' Wkspace Left Right Top Bottom');
# Display list
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
$session->writeText(
' ' . sprintf(
'%-4.4s %-5.5s %-5.5s %-5.5s %-5.5s',
$workspaceObj->number,
$workspaceObj->panelLeftSize,
$workspaceObj->panelRightSize,
$workspaceObj->panelTopSize,
$workspaceObj->panelBottomSize,
),
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Get the remaining arguments
$num = shift @args;
# There should be no further arguments
if (@args) {
return $self->improper($session, $inputString);
}
# Are workspace grids available at all?
if (! $axmud::CLIENT->desktopObj->gridPermitFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are not available at all on this system',
);
}
# If a zonemap was specified, perform some checks
if ($zonemap) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Are workspace grids already activated in general?
if ($axmud::CLIENT->activateGridFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are already activated in general',
);
}
# Activate workspace grids in general
if (! $axmud::CLIENT->desktopObj->activateWorkspaceGrids($zonemap)) {
return $self->error(
$session, $inputString,
'General error activating workspace grids',
);
} else {
return $self->complete(
$session, $standardCmd,
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Are workspace grids disactivated in general?
if (! $axmud::CLIENT->activateGridFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are disactivated in general',
);
}
# Are workspaces enabled on the specified workspace?
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $num . ' doesn\'t exist',
);
} elsif ($workspaceObj->gridEnableFlag) {
return $self->error(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my $workspaceObj;
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Are workspace grids available at all?
if (! $axmud::CLIENT->desktopObj->gridPermitFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are not available at all on this system',
);
}
# ;dwg
if (! defined $num) {
# Are workspace grids already disactivated in general?
if (! $axmud::CLIENT->activateGridFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are already disactivated in general',
);
}
# Disactivate workspace grids in general
if (! $axmud::CLIENT->desktopObj->disactivateWorkspaceGrids()) {
return $self->error(
$session, $inputString,
'General error disactivating workspace grids',
);
} else {
return $self->complete(
$session, $standardCmd,
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Are workspace grids disactivated in general?
if (! $axmud::CLIENT->activateGridFlag) {
return $self->error(
$session, $inputString,
'Workspace grids are disactivated in general',
);
}
# Are workspaces disabled on the specified workspace?
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $num . ' doesn\'t exist',
);
} elsif (! $workspaceObj->gridEnableFlag) {
return $self->error(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$axmud::CLIENT->set_gridInvisWinFlag($testFlag);
$resetMsg = 'Workspace grid invisible window flag set to \'' . $string . '\'',
}
}
}
# If this function hasn't yet used $self->error or $self->complete, then all workspace grids
# must be reset
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
foreach my $gridObj (
sort {$a->number <=> $b->number} ($workspaceObj->ivValues('gridHash'))
) {
$gridObj->applyZonemap();
}
}
return $self->complete($session, $standardCmd, $resetMsg);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
. '\' because it contains no zone models',
);
}
}
# ;rgr <num>
# ;rgr <num> <zonemap>
if (! $sessionFlag && ! $workspaceFlag) {
# Check the specified workspace grid objects exists
$gridObj = $axmud::CLIENT->desktopObj->ivShow('gridHash', $num);
if (! $gridObj) {
return $self->error(
$session, $inputString,
'Workspace grid #' . $num . ' doesn\'t exist',
);
}
# Only one workspace grid to reset
push (@list, $gridObj);
# ;rgr -s
# ;rgr -s <zonemap>
} elsif ($sessionFlag) {
# All workspace grid objects controlled by this session should be reset
foreach my $thisGridObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
) {
if ($thisGridObj->owner && $thisGridObj->owner eq $session) {
push (@list, $thisGridObj);
}
}
# ;rgr -w <num>
# ;rgr -w <num> <zonemap>
} elsif ($workspaceFlag) {
# Check the specified workspace object exists
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $num . ' doesn\'t exist',
);
}
# Set the workspace's new default zonemap
if ($zonemapObj) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my $obj;
# Check for improper arguments
if (! defined $number || defined $check) {
return $self->improper($session, $inputString);
}
# Check the workspace grid object exists
$obj = $axmud::CLIENT->desktopObj->ivShow('gridHash', $number);
if (! $obj) {
return $self->error(
$session, $inputString,
'Could not edit workspace grid #' . $number . ' - object does not exist',
);
}
# Open an 'edit' window for the workspace grid
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
|| defined $check
) {
return $self->improper($session, $inputString);
}
# Compile a list of workspace grids
# ;lwg
if (! defined $switch) {
push (@list,
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
);
# Don't modify confirmation message
$string = '';
# ;lwg -s
# ;lwg -s <num>
} elsif ($switch eq '-s') {
if (! defined $num) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'Session #' . $num . ' doesn\'t exist',
);
} else {
foreach my $thisWorkspaceObj (
sort {$a->number <=> $b->number}
($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
my $thisGridObj = $thisWorkspaceObj->findWorkspaceGrid($thisSession);
if ($thisGridObj) {
push (@list, $thisGridObj);
}
}
}
# Modify confirmation message
$string = 'matching';
# ;lwg -w <num>
} elsif ($switch eq '-w') {
if (! defined $num) {
$num = 0;
}
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $num);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $num . ' doesn\'t exist',
);
} else {
push (@list,
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
);
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Get a list of workspace grids for this session
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
my $gridObj = $workspaceObj->findWorkspaceGrid($session);
if ($gridObj) {
push (@gridList, $gridObj);
}
}
if (! @gridList) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
);
# Check for improper arguments
if ((defined $switch && $switch ne '-l') || defined $check) {
return $self->improper($session, $inputString);
}
# Get a list of workspace grids for this session
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
my $gridObj = $workspaceObj->findWorkspaceGrid($session);
if ($gridObj) {
push (@gridList, $gridObj);
}
}
if (! @gridList) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
);
# Check for improper arguments
if ((defined $switch && $switch ne '-l') || defined $check) {
return $self->improper($session, $inputString);
}
# Get a list of workspace grids for this session
foreach my $workspaceObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('workspaceHash'))
) {
my $gridObj = $workspaceObj->findWorkspaceGrid($session);
if ($gridObj) {
push (@gridList, $gridObj);
}
}
if (! @gridList) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->improper($session, $inputString);
}
# Toggle the flag
if (! $axmud::CLIENT->storeGridPosnFlag) {
$axmud::CLIENT->set_storeGridPosnFlag(TRUE);
# Store the size/position of all 'grid' windows for this session
$axmud::CLIENT->desktopObj->storeGridWinPosn($session);
return $self->complete(
$session, $standardCmd,
'Storage of \'grid\' window sizes/positions has been turned ON',
);
} else {
$axmud::CLIENT->set_storeGridPosnFlag(FALSE);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$check,
) = @_;
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Store the size/position of all 'grid' windows for this session
$axmud::CLIENT->desktopObj->storeGridWinPosn($session);
return $self->complete(
$session, $standardCmd,
'Sizes/positions of this session\'s \'grid\' windows have been stored',
);
}
}
{ package Games::Axmud::Cmd::ClearWindowStorage;
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
} elsif ($axmud::CLIENT->ivExists('standardZonemapHash', $name)) {
return $self->error(
$session, $inputString,
'Standard zonemaps like \'' . $name . '\' can\'t be deleted',
);
}
# Check the zonemap isn't in use by any workspace grid
foreach my $gridObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
) {
if ($gridObj->zonemap && $gridObj->zonemap eq $name) {
return $self->error(
$session, $inputString,
'The zonemap \'' . $name . '\' is currently in use by workspace grid #'
. $gridObj->number . ' (try using \';resetgrid\' first)',
);
}
}
# Delete the zonemap
$axmud::CLIENT->del_zonemap($name);
# Any workspaces using the zonemap as their default zonemap (unlikely after the check above,
# but possible) should be given a new default zonemap
foreach my $workspaceObj ($axmud::CLIENT->desktopObj->ivValues('workspaceHash')) {
if ($workspaceObj->defaultZonemap && $workspaceObj->defaultZonemap eq $name) {
if ($axmud::CLIENT->shareMainWinFlag) {
$workspaceObj->set_defaultZonemap('basic');
} else {
$workspaceObj->set_defaultZonemap('single');
}
}
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
} elsif ($axmud::CLIENT->ivExists('standardZonemapHash', $name)) {
return $self->error(
$session, $inputString,
'Standard zonemaps like \'' . $name . '\' can\'t be reset',
);
}
# Check the zonemap isn't in use by any workspace grid
foreach my $gridObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('gridHash'))
) {
if ($gridObj->zonemap && $gridObj->zonemap eq $name) {
return $self->error(
$session, $inputString,
'The zonemap \'' . $name . '\' is currently in use by workspace grid #'
. $gridObj->number . ' (try using \';resetgrid\' first)',
);
}
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Import a list of zonemap names, sorted alphabetically
@list = sort {lc($a) cmp lc($b)} ($axmud::CLIENT->ivKeys('zonemapHash'));
if (! @list) {
return $self->complete($session, $standardCmd, 'The zonemap list is empty');
}
# Create two hashes to show which zonemaps are the default zonemap in a workspace, and
# which zonemaps are in use in a workspace grid
foreach my $workspaceObj ($axmud::CLIENT->desktopObj->ivValues('workspaceHash')) {
if ($workspaceObj->defaultZonemap) {
$defaultHash{$workspaceObj->defaultZonemap} = undef;
}
foreach my $gridObj ($workspaceObj->ivValues('gridHash')) {
if ($gridObj->zonemap) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($winObj1, $winObj2);
# Check for improper arguments
if (! defined $win1 || ! defined $win2 || defined $check) {
return $self->improper($session, $inputString);
}
# Check the window objects exist
$winObj1 = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $win1);
if (! $winObj1) {
return $self->error(
$session, $inputString,
'Window #' . $win1 . ' doesn\'t seem to exist (try \';listwindow\')',
);
}
$winObj2 = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $win2);
if (! $winObj2) {
return $self->error(
$session, $inputString,
'Window #' . $win2 . ' doesn\'t seem to exist (try \';listwindow\')',
);
}
# Windows can't be swapped with themselves
if ($win1 == $win2) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# 'grid' windows in a workspace without workspace grids can't be swapped
if (! $winObj1->workspaceObj->gridEnableFlag || ! $winObj2->workspaceObj->gridEnableFlag) {
return $self->error(
$session, $inputString,
'Windows can\'t be swapped when they\'re not arranged on a workspace grid',
);
}
# Swap the windows
if (! $axmud::CLIENT->desktopObj->swapGridWin($winObj1, $winObj2)) {
return $self->error(
$session, $inputString,
'Windows #' . $win1 . ' and #' . $win2 . ' could not be swapped',
);
} else {
return $self->complete(
$session, $standardCmd,
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$workspaceNum = shift @args;
$zoneNum = shift @args;
# Check for improper arguments
if (! defined $winNum || ! defined $workspaceNum || @args) {
return $self->improper($session, $inputString);
}
# Check the window exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $winNum . ' doesn\'t exist (try \';listwindow\' first)',
);
}
# Check the workspace exists
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $workspaceNum);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $workspaceNum . ' doesn\'t exist (try \';listworkspace\' first)',
);
}
# Find the session's workspace grid on the specified workspace (this also checks that
# workspaces grids are enabled there at all)
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# ;rwn
if (! defined $winNum) {
# Use all 'grid' windows
@winList = $axmud::CLIENT->desktopObj->listGridWins();
if (! @winList) {
return $self->error(
$session, $inputString,
'No \'grid\' windows found',
);
}
# ;rwn <number>
} else {
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $winNum . ' doesn\'t exist (try \';listwindow\' first)',
);
} else {
push (@winList, $winObj);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Extract remaining arguments
$pattern = shift @args;
# Check for improper arguments
if (! defined $pattern || ($workspaceFlag && ! defined $workspaceNum) || @args) {
return $self->improper($session, $inputString);
}
# Check window grabbing is possible
if (! $axmud::CLIENT->desktopObj->wmCtrlObj) {
return $self->error(
$session, $inputString,
'Sorry, ' . $axmud::SCRIPT . ' is unable to handle external windows on this system',
);
}
# Check $pattern is valid
if ($axmud::CLIENT->regexCheck($pattern)) {
return $self->error(
$session, $inputString,
'The pattern \'' . $pattern . '\' isn\'t a valid regular expression',
);
}
# Set the workspace grid onto which the 'external' window should be grabbed
if ($workspaceFlag) {
$workspaceObj = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $workspaceNum);
if (! $workspaceObj) {
return $self->error(
$session, $inputString,
'Workspace #' . $workspaceNum . ' doesn\'t exist',
);
}
# Find the session's workspace grid (this also checks ->gridEnableFlag)
$gridObj = $workspaceObj->findWorkspaceGrid($session);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# 'grid' or 'free' window (which will include any 'external' windows that have already
# been grabbed)
do {
my ($title, $id, $matchFlag);
$title = shift @matchList;
$id = shift @matchList;
OUTER: foreach my $winObj (
$axmud::CLIENT->desktopObj->ivValues('gridWinHash'),
$axmud::CLIENT->desktopObj->ivValues('freeWinHash'),
) {
if ($winObj->winWidget->get_title() eq $title) {
$matchFlag = TRUE;
last OUTER;
}
}
if (! $matchFlag) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# ;bw
if (! defined $winNum) {
# Get a list of all 'external' windows
@winList = $axmud::CLIENT->desktopObj->listGridWins('external');
# ;bw <number>
} else {
# Check that $winNum is a valid number (the error message if the window doesn't
# exist would read 'Window #firefox doesn't seem to exist, if we don't perform this
# check')
if (! $axmud::CLIENT->intCheck($winNum, 0)) {
return $self->error(
$session, $inputString,
'Invalid window number \'' . $winNum . '\' (try \';listwindow\' first)',
);
}
# Check the window exists and is an 'external' window
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $winNum . ' doesn\'t exist (try \';listwindow\' first)',
);
} elsif ($winObj->winType ne 'external') {
return $self->error(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Extract remaining arguments
$winNum = shift @args;
# Check for improper arguments
if (! defined $winNum || @args) {
return $self->improper($session, $inputString);
}
# Check the window exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $winNum . ' doesn\'t exist (try \';listwindow\' first)',
);
# Can't fix windows in workspaces where workspace grids are disabled
} elsif (! $winObj->workspaceObj->gridEnableFlag) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# ;flw
if (! defined $number) {
$winObj = $session->mainWin;
# ;flw <number>
} else {
# Check the window <number> exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $number . ' doesn\'t exist (try \';listwindow\' first)',
);
}
}
# Set the window's urgency hint. Forcing the setting by using the TRUE flag seems to work
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# ;ufw
if (! defined $number) {
$winObj = $session->mainWin;
# ;ufw <number>
} else {
# Check the window <number> exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $number . ' doesn\'t exist (try \';listwindow\' first)',
);
}
}
# Set the window's urgency hint. Forcing the setting by using the TRUE flag seems to work
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($winObj, $result);
# Check for improper arguments
if (! defined $number || defined $check) {
return $self->improper($session, $inputString);
}
# Check the window <number> exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
if (! $winObj) {
return $self->error(
$session, $inputString,
'Window #' . $number . ' doesn\'t exist (try \';listwindow\' first)',
);
}
# Close the window (if allowed)
if ($winObj->winType eq 'main') {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
if (
! defined $number
|| (defined $switch && $switch ne '-p' && $switch ne '-t')
|| (defined $switch && ! defined $objNumber)
|| defined $check
) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $number);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'grid\' window #' . $number . ' doesn\'t exist',
);
}
# ;ewn <number>
if (! $switch) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'The switches -w, -g and -z can\'t be combined',
);
}
# Get a list of 'grid' window objects, removing any not controlled by this session if that
# switch was specified
foreach my $winObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('gridWinHash'))
) {
if (! $sessionFlag || ($winObj->session && $winObj->session eq $session)) {
push (@winObjList, $winObj);
}
}
if (! @winObjList) {
if (! $sessionFlag) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($winObj, $stripObj);
# Check for improper arguments
if (! defined $winNum || ! defined $stripNum || defined $check) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'grid\' window #' . $winNum . ' doesn\'t exist',
);
}
# Check it's an 'internal' window
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Extract remaining arguments
$winNum = shift @args;
# There should be nothing left in @args
if (! defined $winNum || @args) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'grid\' window #' . $winNum . ' doesn\'t exist',
);
}
# Check it's an 'internal' window
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my ($winObj, $tableObj);
# Check for improper arguments
if (! defined $winNum || ! defined $tableNum || defined $check) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'grid\' window #' . $winNum . ' doesn\'t exist',
);
}
# Check it's an 'internal' window
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Extract remaining arguments
$winNum = shift @args;
# There should be nothing left in @args
if (! defined $winNum || @args) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $winNum);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'grid\' window #' . $winNum . ' doesn\'t exist',
);
}
# Check it's an 'internal' window
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Local variables
my $winObj;
# Check for improper arguments
if (! defined $number || defined $check) {
return $self->improper($session, $inputString);
}
# Check the window object exists
$winObj = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number);
if (! $winObj) {
return $self->error(
$session, $inputString,
'The \'free\' window #' . $number . ' doesn\'t exist',
);
}
# Open an 'edit' window for the 'free' window
if (
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
}
# ;cfw
# ;cfw -s
if (! defined $number || $number eq '-s') {
# Get a list of 'free' window objects, removing any not controlled by this session if
# that switch was specified
foreach my $winObj (
sort {$a->number <=> $b->number}
($axmud::CLIENT->desktopObj->ivValues('freeWinHash'))
) {
if (! defined $number || ($winObj->session && $winObj->session eq $session)) {
push (@winObjList, $winObj);
}
}
# ;cfw <number>
} else {
# Check the window object exists, if specified
if (! $axmud::CLIENT->desktopObj->ivExists('freeWinHash', $number)) {
return $self->error(
$session, $inputString,
'The \'free\' window #' . $number . ' doesn\'t exist',
);
} else {
push (@winObjList, $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $number));
}
}
if (! @winObjList) {
if (! defined $number) {
return $self->error(
$session, $inputString,
'No \'free\' windows found',
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
if (
(defined $switch && $switch ne '-s')
|| defined $check
) {
return $self->improper($session, $inputString);
}
# Get a list of 'free' window objects, removing any not controlled by this session if that
# switch was specified
foreach my $winObj (
sort {$a->number <=> $b->number} ($axmud::CLIENT->desktopObj->ivValues('freeWinHash'))
) {
if (! $switch || ($winObj->session && $winObj->session eq $session)) {
push (@winObjList, $winObj);
}
}
if (! @winObjList) {
if (! $switch) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->improper($session, $inputString);
}
# Compile a list of textview objects which should be cleared
if (! $switch) {
push (@list, $session->defaultTabObj->textViewObj);
} elsif ($switch eq '-m') {
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if ($textViewObj->winObj && $textViewObj->winObj eq $session->mainWin) {
push (@list, $textViewObj);
}
}
} elsif ($switch eq '-s') {
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if (
(
$textViewObj->winObj
&& $textViewObj->winObj->visibleSession
&& $textViewObj->winObj->visibleSession eq $session
) || (
$textViewObj->winObj
&& $textViewObj->winObj->session
&& $textViewObj->winObj->session eq $session
)
) {
push (@list, $textViewObj);
}
}
} elsif ($switch eq '-w') {
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if ($textViewObj->winObj && $textViewObj->winObj->number eq $number) {
push (@list, $textViewObj);
}
}
} elsif ($switch eq '-t') {
if ($axmud::CLIENT->desktopObj->ivExists('textViewHash', $number)) {
push (@list, $axmud::CLIENT->desktopObj->ivShow('textViewHash', $number));
}
}
if (! @list) {
return $self->error(
$session, $inputString,
'No matching textviews found',
);
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
} else {
$axmud::CLIENT->set_customTextBufferSize($size);
}
}
# Update all existing textview objects (the size is applied only to textview which are
# using a non-zero size, with zero meaning unlimited size)
$count = 0;
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if ($textViewObj->maxLines) {
$textViewObj->set_maxLines($axmud::CLIENT->customTextBufferSize);
$count++;
}
}
# Operation complete
return $self->complete(
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->improper($session, $inputString);
}
# Display header
$session->writeText('List of textview objects');
$session->writeText(' Num Win Pane ScrLk SplSc Colour scheme');
# Display list
@list = sort {$a->number <=> $b->number}
($axmud::CLIENT->desktopObj->ivValues('textViewHash'));
foreach my $textViewObj (@list) {
my ($scrollString, $colourString);
if ($textViewObj->scrollLockFlag) {
$scrollString = 'on';
} else {
$scrollString = 'off';
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'The switches \'-p\' and \'-n\' can\'t be combined',
);
}
# Get the textview object whose buffer should be searched. If none was specified, use the
# session's default tab
if ($tvObjFlag) {
$tvObj = $axmud::CLIENT->desktopObj->ivShow('textViewHash', $tvObjNum);
if (! $tvObj) {
return $self->error(
$session, $inputString,
'There is no textview object numbered \'' . $tvObjNum . '\'',
);
}
} else {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# Get the textview object whose search mark should be reset. If none was specified, use the
# session's default tab
if (defined $tvObjNum) {
$tvObj = $axmud::CLIENT->desktopObj->ivShow('textViewHash', $tvObjNum);
if (! $tvObj) {
return $self->error(
$session, $inputString,
'There is no textview object numbered \'' . $tvObjNum . '\'',
);
}
} else {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
# Convert <colour> to an RGB tag (if it's not already an RGB tag) and update the IV
$new = $axmud::CLIENT->returnRGBColour($new);
if (! $axmud::CLIENT->checkBoldTags($tag)) {
$axmud::CLIENT->set_standardColourTag($tag, $new, FALSE);
} else {
$axmud::CLIENT->set_standardColourTag($tag, $new, TRUE);
}
# Update textview objects
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
my $tabObj;
# Update the textview object's Gtk3::TextTag
$textViewObj->updateStandardTag($tag);
# Update any textview object in monochrome mode
if (
$textViewObj->monochromeFlag
&& ($textViewObj->textColour eq $tag || $textViewObj->backgroundColour eq $tag)
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
'The xterm-256 colour cube in use is already \'netscape\'',
);
} else {
$axmud::CLIENT->set_currentColourCube('netscape');
}
}
# Update xterm colour tags in all textviews
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
$textViewObj->updateXTermTags();
}
# Update colour schemes in all 'internal' windows
foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
$winObj->updateColourScheme();
}
return $self->complete(
$session, $standardCmd,
'The xterm-256 colour cube has been set to \'' . $axmud::CLIENT->currentColourCube
. '\'',
);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$session, $inputString,
'The colour scheme \'' . $name . '\' doesn\'t exist',
);
}
# Check the colour scheme's colour tags are valid, before trying to apply them to 'interal'
# windows (e.g. don't use an underlay colour tag like 'ul_black' for text)
$obj->repair();
# Update textviews in any 'internal' window using this colour scheme
foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
$winObj->updateColourScheme($name);
}
# Operation complete
return $self->complete(
$session, $standardCmd,
'All \'internal\' windows using the colour scheme \'' . $name . '\' updated',
);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$schemeObj = $axmud::CLIENT->ivShow('colourSchemeHash', $name);
if (! $schemeObj) {
return $self->error(
$session, $inputString,
'The colour scheme \'' . $name . '\' doesn\'t exist',
);
}
# Get a list of 'internal' windows to which the colour scheme should be applied
foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins('internal')) {
if (
! exists $checkHash{$winObj->number}
&& (! $mainFlag || $winObj->winType eq 'main')
&& (! $protocolFlag || $winObj->winType eq 'protocol')
&& (! $customFlag || $winObj->winType eq 'custom')
&& (
! $sessionFlag
|| (
$winObj->winType eq 'main'
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
return $self->error(
$session, $inputString,
'File(s) not imported (you specified something that doesn\'t appear to be a'
. ' compressed archive, e.g. a .zip or .tar.gz file)',
);
}
# For large files (e.g. world models containing tens of thousands of rooms), we need to
# display an initial message to explain the pause
$session->writeText('Importing file(s)...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Build an Archive::Extract object
$extractObj = Archive::Extract->new(archive => $importPath);
if (! $extractObj) {
$axmud::CLIENT->set_fileFailFlag(TRUE);
return $self->error(
$session, $inputString,
'No files imported (file decompression error)',
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$tempSession->ivPoke('currentWorld', $tempWorldObj);
$tempSession->ivAdd('sessionFileObjHash', 'worldmodel', $tempFileObj);
$tempSession->ivPoke('mapObj', $tempMapObj);
# If the file was created by an earlier version of Axmud, we have to update the model's
# data in the usual way
$fileVersion = $axmud::CLIENT->convertVersion($$hashRef{'script_version'});
if ($fileVersion < $axmud::CLIENT->convertVersion($axmud::VERSION)) {
$session->writeText('Updating data for this ' . $axmud::SCRIPT . ' version...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Now we can update the imported world model
if ($fileVersion < 1_000_868) {
$tempFileObj->update_obj_world_model($wmObj);
}
$tempFileObj->updateExtractedData($fileVersion);
}
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
$wmObj->deleteTempRegions($tempSession, FALSE);
# To avoid unforeseen complications, get rid of the temporary objects immediately
$tempSession = undef;
$tempWorldObj = undef;
$tempFileObj = undef;
$tempMapObj = undef;
# Now we're ready to merge one model into another
$session->writeText('Merging data...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Pass this imported world model to this session's own model, so it can merge rooms, labels
# and so on
if (! $session->worldModelObj->mergeModel($session, $wmObj)) {
return $self->error(
$session, $inputString,
'The specified archive contained a readable world model file, but ' . $axmud::SCRIPT
. ' was not able to merge its contents into the existing world model',
);
}
$session->writeText('Running model test...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
# Run the usual model test
($errorCount, $fixCount, @outputList) = $session->worldModelObj->testModel(
$session,
FALSE, # Don't problems
TRUE, # Use a list of return values
);
if ($errorCount) {
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
) = @_;
# Check for improper arguments
if (defined $check) {
return $self->improper($session, $inputString);
}
# It might be a long wait, so make sure the message is visible right away
$session->writeText('Reducing amount of memory used by world model...');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->do');
foreach my $roomObj ($session->worldModelObj->ivValues('roomModelHash')) {
$roomObj->compress();
}
foreach my $exitObj ($session->worldModelObj->ivValues('exitModelHash')) {
$exitObj->compress();
}
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
# (The 'edit' window presents this IV as a list, but the dictionary object stores it as
# a hash)
my (
$text,
@list, @finalList,
%hash,
);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
# Split the contents of the textview into a list of lines, separated by newline
# characters
@list = split("\n", $text);
# Remove any empty lines and leading/trailing whitespace
foreach my $line (@list) {
if ($line) {
$line =~ s/^\s*//; # Remove leading whitespace
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
# (The 'edit' window presents this IV as a list, but the dictionary object stores it as
# a hash)
my (
$text,
@list, @finalList,
%hash,
);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
# Split the contents of the textview into a list of lines, separated by newline
# characters
@list = split("\n", $text);
# Remove any empty lines and leading/trailing whitespace
foreach my $line (@list) {
if ($line) {
$line =~ s/^\s*//; # Remove leading whitespace
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
if ($comboList[$index] eq $auto) {
$posn = $index;
last OUTER;
}
}
}
$combo->set_active($posn);
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->directions2Tab');
# Store the direction that's being edited because the 'Use changes' button needs it
$thisDir = $dir;
}
});
# 'Delete direction' button
my $button3 = $self->addButton($grid,
'Delete dir', 'Delete the selected direction', undef,
4, 6, 8, 9);
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
$buffer->set_text(join("\n", @sortedList));
# Store any changes the user makes in $self->$localIV
$buffer->signal_connect('changed' => sub {
my (
$text,
@list, @finalList,
);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
# Split the contents of the textview into a list of lines, separated by newline
# characters
@list = split("\n", $text);
# Remove any empty lines and leading/trailing whitespace, if allowed
foreach my $line (@list) {
$line =~ s/^\s+//; # Remove leading whitespace
$line =~ s/\s+$//; # Remove trailing whitespace
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
'View settings for the selected workspace grid',
undef,
8, 10, 10, 11);
$button2->signal_connect('clicked' => sub {
my ($number, $obj);
($number) = $self->getSimpleListData($slWidget, 0);
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
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
'View...',
'View settings for the selected \'grid\' window', undef,
8, 10, 10, 11);
$button->signal_connect('clicked' => sub {
my ($num, $obj);
($num) = $self->getSimpleListData($slWidget, 0);
if (defined $num) {
$obj = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $num);
if ($obj) {
# Open an 'edit' window for the 'grid' window
$self->createFreeWin(
'Games::Axmud::EditWin::Window',
$self,
$self->session,
'Edit \'grid\' window #' . $obj->number,
$obj,
FALSE, # Not temporary
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (
! defined $session || ! defined $inputString || ! defined $standardCmd
|| ! defined $name || ! defined $category || defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->setProfile', @_);
}
# Check there are no 'free' windows open
if ($axmud::CLIENT->desktopObj->listSessionFreeWins($session, TRUE)) {
return $self->error(
$session, $inputString,
'Can\'t set a current profile while there are \'free\' windows (such as edit,'
. ' preference and wizard windows) open - try closing them first',
);
}
# If the profile already exists, check it isn't already a current profile
if ($session->ivExists('currentProfHash', $category)) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (
! defined $session || ! defined $inputString || ! defined $standardCmd
|| ! defined $category || defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->unsetProfile', @_);
}
# Check there are no 'free' windows open in any session
if ($axmud::CLIENT->desktopObj->freeWinHash) {
return $self->error(
$session, $inputString,
'Can\'t delete a profile while there are \'free\' windows (such as edit,'
. ' preference and wizard windows) open in any session - try closing them first',
);
}
# Check there is a current profile of the right category
if (! $session->ivExists('currentProfHash', $category)) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (
! defined $session || ! defined $inputString || ! defined $standardCmd
|| ! defined $name || ! defined $category || defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteProfile', @_);
}
# Check there are no 'free' windows open in any session
if ($axmud::CLIENT->desktopObj->freeWinHash) {
return $self->error(
$session, $inputString,
'Can\'t delete a profile while there are \'free\' windows (such as edit,'
. ' preference and wizard windows) open in any session - try closing them first',
);
}
# Check the profile exists
if (! $session->ivExists('profHash', $name)) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# For 'edit' windows, check that $self->editObj is of the right type. For 'pref' windows,
# $self->editObj is not set, so the check always succeeds
if (! $self->checkEditObj()) {
return undef;
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
return 1;
}
# sub winDesengage {} # Inherited from GA::Generic::FreeWin
# sub winDestroy {} # Inherited from GA::Generic::FreeWin
lib/Games/Axmud/Generic.pm view on Meta::CPAN
my $textView = Gtk3::TextView->new();
$scroll->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
if ($noScrollFlag) {
$textView->set_wrap_mode('word-char'); # Wrap words if possible, characters if not
$textView->set_justification('left');
}
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
if ($iv) {
# Display the existing value of the IV (the call to $buffer->set_text requires a
# defined value, so don't try to display 'undef')
if ($self->editObj->$iv) {
if ($listFlag) {
# The call to ->ivPeek returns the contents of the IV as a flat list
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
}
$buffer->signal_connect('changed' => sub {
my (
$text,
@list, @finalList,
);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
if ($listFlag) {
# Split the contents of the textview into a list of lines, separated by
# newline characters
@list = split("\n", $text);
# Remove any empty lines and leading/trailing whitespace, if allowed
foreach my $line (@list) {
if ($line && $removeSpaceFlag) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$pattern = shift @errorList;
$error = shift @errorList;
$count++;
chomp $pattern;
chomp $error;
$msg .= "\n\n$pattern\n$error";
# (Only show the first 2 errors - don't want a dialogue window as big as
# the desktop)
if ($count >= 2 && @errorList) {
$msg .= "\n\n...";
@errorList = ();
}
} until (! @errorList);
$self->showMsgDialogue(
'Check patterns',
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-ok' => 'accept',
);
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptScalar');
});
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
# The call to ->addDialogueIcon splits $vBox in two, with an icon on the left, and a new
# Gtk3::VBox on the right, into which we put everything
my $vBox2 = $self->addDialogueIcon($vBox);
# Create a label, which will shortly show which IV is being edited (a second label,
# $undefLabel, is sometimes used immediately below it)
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$self->$callFunc(@callFuncArgs);
}
# Close the window and return success value
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make
# sure the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptScalar');
return 1;
});
}
# Widget drawing complete
$vBox->show_all();
# Get the response
$response = $dialogueWin->run();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
}
}
# Destroy the window
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptScalar');
# Operation complete
return 1;
}
sub promptList {
# Creates a 'dialogue' window to prompt the user to view, enter (or edit) a list of values
# If the user supplies any values, sets the IV then closes the window
#
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-ok' => 'accept',
);
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptList');
});
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
# The call to ->addDialogueIcon splits $vBox in two, with an icon on the left, and a new
# Gtk3::VBox on the right, into which we put everything
my $vBox2 = $self->addDialogueIcon($vBox);
# Create a label, which will shortly show which IV is being edited
my $label = Gtk3::Label->new();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
if ($readOnlyFlag) {
$textView->set_editable(FALSE);
} else {
$textView->set_editable(TRUE);
}
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# Set the contents of the label and the textview
if (! defined $key) {
# Mode 1 - edit the list stored in $self->editObj->$iv or $self->editHash->$iv
$label->set_markup('List stored in IV \'' . $iv . '\'');
# If the IV hasn't yet been edited, use the original stored list
if (! $self->ivExists('editHash', $iv)) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($response eq 'accept') {
my (
$text,
@dataList,
);
# Don't save anything for read-only values
if (! $readOnlyFlag) {
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
# Split the contents of the textview into a list of lines, separated by
# newline characters
@dataList = split("\n", $text);
# Mode 1 - edit the list stored in of $self->editObj->$iv or $self->editHash->$iv
if (! defined $key) {
# Store the list we've been editing
$self->ivAdd('editHash', $iv, \@dataList);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
}
}
# Destroy the window
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptList');
# Operation complete
return 1;
}
sub promptHash {
# Creates a 'dialogue' window to prompt the user to view, enter (or edit) a hash of
# key-value pairs
# If the user supplies any pairs, sets the IV then closes the window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-ok' => 'accept',
);
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptHash');
});
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
# The call to ->addDialogueIcon splits $vBox in two, with an icon on the left, and a new
# Gtk3::VBox on the right, into which we put everything
my $vBox2 = $self->addDialogueIcon($vBox);
# Create a label, which will shortly show which IV is being edited
my $label = Gtk3::Label->new();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
}
}
# Destroy the window
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptHash');
# Operation complete
return 1;
}
sub promptHash_displayDataMode1 {
# Called by $self->promptHash when we want to edit a hash IV in $self->editObj or
# $self->editHash
# The calling function had created a GA::Obj::SimpleList; this function's job is to fill
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Set the window title
$winWidget->set_title($self->title);
# Set the window's default size and position
$winWidget->set_default_size($self->widthPixels, $self->heightPixels);
$winWidget->set_border_width($self->borderPixels);
$winWidget->set_position('center');
# Set the icon list for this window
$iv = $self->winType . 'WinIconList';
$winWidget->set_icon_list($axmud::CLIENT->desktopObj->{$iv});
# Draw the widgets used by this window
if (! $self->drawWidgets()) {
return undef;
}
# The calling function can now call $self->winEnable to make the window visible
return 1;
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# 1 on success
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
return 1;
}
sub winDisengage {
# Should not be called, in general (provides compatibility with other types of windows,
# whose window objects can be destroyed without closing the windows themselves)
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
return 1;
}
# sub winShowAll {} # Inherited from GA::Generic::Win
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($listRef) {
foreach my $func (@$listRef) {
$self->$func();
}
}
# Set the icon list for this window
$iv = $self->winType . 'WinIconList';
$winWidget->set_icon_list($axmud::CLIENT->desktopObj->{$iv});
# Draw the widgets used by this window
if (! $self->drawWidgets($winWidget)) {
return undef;
}
# The calling function can now move the window into position, before calling
# $self->winEnable to make it visible, and to set up any more ->signal_connects()
return 1;
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# 1 on success
my ($self, $title, $listRef, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# For windows about to be placed on a grid, briefly minimise the window so it doesn't
# appear in the centre of the desktop before being moved to its correct workspace, size
# and position
if ($self->workspaceGridObj && $self->winWidget eq $self->winBox) {
$self->minimise();
}
# Set up ->signal_connects specified by the calling function, if any
if ($listRef) {
foreach my $func (@$listRef) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (! defined $winmapObj || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->openGridWin', @_);
}
# Compile a list of workspaces, with the workspace containing the parent session's 'main'
# window first
@workspaceList
= $axmud::CLIENT->desktopObj->listWorkspaces($self->session->mainWin->workspaceObj);
OUTER: foreach my $workspaceObj (@workspaceList) {
$winObj = $workspaceObj->createGridWin(
'custom', # All task windows are 'custom' windows
$self->name, # Window name is the same as the task name
$self->prettyName, # Window title
$winmapObj->name,
'Games::Axmud::Win::Internal',
# Package name
lib/Games/Axmud/Generic.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->winShowAll', @_);
}
if ($self->winWidget && $self->visibleFlag) {
$self->winWidget->show_all();
# Any textview objects (GA::Obj::TextView) which are waiting to update their size IVs
# can now do so
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if ($textViewObj->sizeUpdateFlag && $textViewObj->winObj eq $self) {
$textViewObj->updateVisibleSize();
}
}
# Optionally, write information about the calling function to the terminal (for
# debugging)
# if ($string) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->restoreFocus', @_);
}
# Activate the Gtk3::Window, if it is known (for pseudo-windows, activate the parent window)
if ($self->winType eq 'external') {
# Activate the window
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-a',
$self->internalID,
'-i',
);
} else {
if (! $self->winWidget) {
return undef;
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
# If no session is specified, it's the owner's session
if (! $session) {
$session = $owner->session;
}
# Create the 'free' window object
$winObj = $packageName->new(
$axmud::CLIENT->desktopObj->freeWinCount,
$self->workspaceObj,
$owner,
$session,
$title,
$editObj,
$tempFlag,
%configHash,
);
# Check it's any 'free' window besides a 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
return undef;
}
if (! $winObj->winEnable()) {
return undef;
}
# Update IVs
$axmud::CLIENT->desktopObj->add_freeWin($winObj);
$self->add_childFreeWin($winObj);
return $winObj;
}
sub quickFreeWin {
# Shortcut to $self->createFreeWin, allowing the calling code to specify only the bare
# minimum of arguments
#
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
@argList,
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showMsgDialogue');
});
# Set the default response, if specified
if (defined $defaultResponse) {
$dialogueWin->set_default_response($defaultResponse);
}
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
# For the benefit of visually-impaired users who are using the 'tab' key to switch buttons,
# don't allow the label to receive focus
$label->set_can_focus(FALSE);
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showComboDialogue');
# Prepare text-to-speech (TTS) code. Get a hash of possible response buttons, in the form
# $buttonHash{'response'} = Gtk3::Button (if the button is used), or 'undef' (if not)
%buttonHash = (
'ok', $dialogueWin->get_widget_for_response('ok'),
'close', $dialogueWin->get_widget_for_response('close'),
'cancel', $dialogueWin->get_widget_for_response('cancel'),
'yes', $dialogueWin->get_widget_for_response('yes'),
'no', $dialogueWin->get_widget_for_response('no'),
);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
);
}
}
# Destroy the window and return the response
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showMsgDialogue');
return $response;
}
sub showFileChooser {
# Can be called by any function
# Creates a standard Gtk3::FileChooserDialog and returns the response (if any)
#
# Expected arguments
lib/Games/Axmud/Generic.pm view on Meta::CPAN
'gtk-cancel' => 'cancel',
'gtk-ok' => 'ok'
);
if (! $dialogueWin) {
return undef;
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
});
if (defined $arg) {
# If loading a file, set the current folder
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showEntryDialogue');
});
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
# The call to ->addDialogueIcon splits $vBox in two, with an icon on the left, and a new
# Gtk3::VBox on the right, into which we put everything
my $vBox2 = $self->addDialogueIcon($vBox);
my $label = Gtk3::Label->new();
$vBox2->pack_start($label, FALSE, FALSE, $spacing);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$responseText = $entry->get_text();
# ...after we destroy the 'dialogue' window
$dialogueWin->destroy();
$self->restoreFocus();
});
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showEntryDialogue');
# Prepare text-to-speech (TTS) code. Get a hash of the response buttons, in the form
# $buttonHash{'response'} = Gtk3::Button
$buttonHash{'ok'} = $dialogueWin->get_widget_for_response('accept');
if (! $singleFlag) {
$buttonHash{'cancel'} = $dialogueWin->get_widget_for_response('reject');
}
if ($axmud::CLIENT->systemAllowTTSFlag && $axmud::CLIENT->ttsDialogueFlag) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$axmud::CLIENT->ttsAddUrgentJob('Cancelled', 'dialogue', TRUE);
}
}
# Destroy the window
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showEntryDialogue');
# Return the response
if ($obscureModeFlag && defined $starText) {
# The obscured '********' text has not been modified, so we can return the original
# unmodified $entryText
return $entryText;
} else {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($obscureMode eq 'second' || $obscureMode eq 'both') {
$entry2->set_visibility(FALSE);
}
}
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showDoubleEntryDialogue');
# Get the response. If the user clicked 'cancel', $response will be 'reject'
# Otherwise, user clicked 'ok', and we need to get the contents of the two boxes
$response = $dialogueWin->run();
if ($response eq 'accept') {
$responseText = $entry->get_text();
$responseText2 = $entry2->get_text();
# Destroy the window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($obscureMode >= 4) {
$entry3->set_visibility(FALSE);
}
}
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showTripleComboDialogue');
# Get the responses. If the user clicked 'cancel', $response will be 'reject'
# Otherwise, user clicked 'ok', and we need to get the contents of the two boxes
$response = $dialogueWin->run();
if ($response eq 'accept') {
$responseText = $entry->get_text();
$responseText2 = $entry2->get_text();
$responseText3 = $entry3->get_text();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
}
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure
# the window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showComboDialogue');
});
# Add widgets to the 'dialogue' window
my $vBox = $dialogueWin->get_content_area();
# The call to ->addDialogueIcon splits $vBox in two, with an icon on the left, and a new
# Gtk3::VBox on the right, into which we put everything
my $vBox2 = $self->addDialogueIcon($vBox);
my $label = Gtk3::Label->new();
$vBox2->pack_start($label, FALSE, FALSE, $spacing);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
foreach my $line (@$listRef) {
$comboBox->append_text($line);
}
$comboBox->set_active(0);
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showComboDialogue');
# Prepare text-to-speech (TTS) code. Get a hash of the response buttons, in the form
# $buttonHash{'response'} = Gtk3::Button
$buttonHash{'ok'} = $dialogueWin->get_widget_for_response('accept');
if (@$listRef && ! $singleFlag) {
$buttonHash{'cancel'} = $dialogueWin->get_widget_for_response('reject');
}
if ($axmud::CLIENT->systemAllowTTSFlag && $axmud::CLIENT->ttsDialogueFlag) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$axmud::CLIENT->ttsAddUrgentJob('Cancelled', 'dialogue', TRUE);
}
}
# Destroy the window
$dialogueWin->destroy();
$self->restoreFocus();
# (In case TTS is being used and another 'dialogue' window is about to open, make sure the
# window is visibly closed)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showComboDialogue');
return $responseText;
}
sub showDoubleComboDialogue {
# Can be called by any function
# Similar to $self->showDoubleEntryDialogue, but contains two combo boxes; returns the
# contents of both boxes
#
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Destroy the window
$dialogueWin->destroy();
});
}
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showEntryComboDialogue');
# Get the response. If the user clicked 'cancel', $response will be 'reject'
# Otherwise, user clicked 'ok', and we need to get the contents of the two boxes
$response = $dialogueWin->run();
if (defined $responseText) {
# (User pressed their ENTER key when $quickFlag is TRUE)
# Destroy the window
$dialogueWin->destroy();
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($axmud::CLIENT->busyWin) {
$self->closeDialogueWin($axmud::CLIENT->busyWin);
}
# Show the 'dialogue' window
my $dialogueWin = Gtk3::ColorSelectionDialog->new($title);
$dialogueWin->set_transient_for($self->winWidget);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$colorSelectionObj = $dialogueWin->get_color_selection();
if ($initialColour) {
# Split a string like '#FFFFFF' into three seperate colours (red, green and blue),
# convert them to decimals (in the range 0-255), and then convert that to a range of
# 0-65535 - which is what Gtk3::Gdk::Color expects
$red = hex(substr($initialColour, 1, 2)) * 257;
$green = hex(substr($initialColour, 3, 2)) * 257;
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# If an earlier call to $self->showBusyWin created a popup window, close it (otherwise it'll
# be visible above the new dialogue window)
if ($axmud::CLIENT->busyWin) {
$self->closeDialogueWin($axmud::CLIENT->busyWin);
}
# Show the 'dialogue' window
my $dialogueWin = Gtk3::FontChooserDialog->new($title, $self->winWidget);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
if ($initialFont) {
$dialogueWin->set_font($initialFont);
}
# Get the response
$response = $dialogueWin->run();
if ($response eq 'ok') {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Add custom room flag',
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Irreversible icon test',
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return undef;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$vBox2->pack_start($label2, FALSE, FALSE, $axmud::CLIENT->constFreeSpacingPixels);
$label2->set_alignment(0, 0);
$label2->set_markup(
"<i>Click 'OK' to end the test</i>"
);
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showIrreversibleTest');
# If the user clicked 'cancel', $response will be 'reject'
# Otherwise, user clicked 'ok', and we might need to add initial tasks
$dialogueWin->run();
$dialogueWin->destroy();
$self->restoreFocus();
return 1;
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
}
if (! $caption) {
$caption = 'Loading...';
}
# Show the window widget
my $dialogueWin = Gtk3::Window->new('popup');
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->set_title($axmud::SCRIPT);
$dialogueWin->set_border_width(0);
$dialogueWin->set_transient_for($self->winWidget);
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showBusyWin');
});
# Add widgets to the 'dialogue' window
my $frame = Gtk3::Frame->new();
$dialogueWin->add($frame);
my $hBox = Gtk3::HBox->new(FALSE, 0);
$frame->add($hBox);
$hBox->set_border_width(10);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$hBox->pack_start($label, FALSE, FALSE, 5);
$label->set_markup('<i><big>' . $caption . '</big></i>');
$label->set_alignment(0.5, 0.5);
$dialogueWin->show_all();
# For some reason, during certain operations the icon and text are not shown in the
# window; the following lines make them appear
$dialogueWin->present();
# Update Gtk3's events queue
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showBusyWin');
# Update the Client IV
$axmud::CLIENT->set_busyWin($dialogueWin);
return $dialogueWin;
}
# Functions to add widgets to a Gtk3::Grid
sub addLabel {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
if ($string) {
$buffer->set_text(join("\n", $string));
}
# Make the textview editable or not editable
$textView->set_editable($editableFlag);
# Apply a CSS style to the textview
if (defined $colourScheme && $axmud::CLIENT->ivExists('colourSchemeHash', $colourScheme)) {
$axmud::CLIENT->desktopObj->setTextViewStyle($colourScheme, $textView);
} else {
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
}
# If a callback function was specified, apply it
if ($funcRef) {
$buffer->signal_connect('changed' => sub {
&$funcRef(
$self,
$textView,
$buffer,
$axmud::CLIENT->desktopObj->bufferGetText($buffer),
);
});
}
# Add the textview to the grid
$scroll->set_hexpand(TRUE);
$scroll->set_vexpand(TRUE);
$grid->attach(
$scroll,
$leftAttach,
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$newImage = Gtk3::Image->new_from_file($filePath);
} elsif ($pixBuffer) {
$newImage = Gtk3::Image->new_from_pixbuf($pixBuffer);
}
if ($viewPort) {
# Remove the old image from its viewport, if an old image was specified
if ($oldImage) {
$axmud::CLIENT->desktopObj->removeWidget($viewPort, $oldImage);
}
# Add the new image to the viewport, if a new image was created
if ($newImage) {
$viewPort->add($newImage);
}
} else {
# Remove the old image from its frame, if an old image was specified
if ($oldImage) {
$axmud::CLIENT->desktopObj->removeWidget($frame, $oldImage);
}
# Add the new image to the frame, if a new image was created
if ($newImage) {
$frame->add($newImage);
}
}
# Update the window to show the changes
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# 1 on success
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# This type of window is usually unique to its GA::Session (only one can be open at any
# time, per session); inform the session it has opened
# Exception - if $self->session isn't set at all (presumably because there are no sessions
# running), then there's no-one to inform
if ($self->session) {
$self->session->set_wizWin($self);
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is usually unique to its GA::Session (only one can be open at any
# time, per session); inform the session it has closed
# Exception - if $self->session isn't set at all (presumably because there are no sessions
# running), then there's no-one to inform
if ($self->session) {
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->updateGrid', @_);
}
# Empty the grid used for the existing page
foreach my $widget ($self->grid->get_children()) {
$axmud::CLIENT->desktopObj->removeWidget($self->grid, $widget);
}
# Get the name of the function for the new current page
$func = $self->ivIndex('pageList', $self->currentPage) . 'Page';
# Call the function
$rows = $self->$func();
# Set button sensititives ($self->disableNextButtonFlag, etc, override the usual rules, if
# they are set)
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not,
# see <http://www.gnu.org/licenses/>.
#
#
# Games::Axmud::Obj::Desktop
# The main desktop object. Arranges windows on one or more workspaces, each containing one or more
# workspace grids
{ package Games::Axmud::Obj::Desktop;
use strict;
use warnings;
# use diagnostics;
use Glib qw(TRUE FALSE);
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
# Blessed reference to the newly-created object on success
my ($class, $check) = @_;
# Check for improper arguments
if (! defined $class || defined $check) {
return $axmud::CLIENT->writeImproper($class . '->new', @_);
}
# Only one desktop object can exist
if ($axmud::CLIENT->desktopObj) {
return undef;
}
# Setup
my $self = {
_objName => 'desktop',
_objClass => $class,
_parentFile => undef, # No parent file object
_parentWorld => undef, # No parent file object
_privFlag => TRUE, # All IVs are private
# Widget registries
# -----------------
# The GA::Obj::WMCtrl object, based on X11::WMCtrl, which handles multiple workspaces
# (on systems that support wmctrl)
wmCtrlObj => undef,
# Registry hash of all workspace objects which still exist. Workspace objects
# (GA::Obj::Workspace) handle a single workspace on the desktop, on which 'grid'
# windows can be arranged on a 3-dimensional grid to avoid overlapping (each grid is
# handled by a workspace grid object, GA::Obj::WorkspaceGrid)
# If GA::Client->shareMainWinFlag = TRUE, all sessions share a single 'main' window,
# so each session has its own workspace grid object on every workspace. If
# GA::CLIENT->shareMainFlag = FALSE, all sessions have their own 'main' window, so
# there is only one workspace grid for each workspace, shared by all sessions
# NB The workspace object corresponding to the workspace from which Axmud was launched
# has the number 0, and cannot be deleted. Unlike GA::Client->initWorkspaceHash,
# subsequent workspaces don't have to be numbered sequentially (1, 2, 3...) but are
# still numbered in the order in which they're created
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
# $textViewHash{unique_number} = blessed_reference_to_textview_object
textViewHash => {},
# Number of textview objects ever created (used to give each textview object a unique
# number)
textViewCount => 0,
# Other IVs
# ---------
# $self->start will set this flag to FALSE if it's not possible to create workspace
# grids at all (because the desktop is too small, etc). If set to TRUE, workspace
# grids are only created when both this flag and GA::Client->activateGridFlag are
# TRUE
gridPermitFlag => TRUE,
# The number of workspaces that Axmud can potentially use is specified by
# GA::Client->initWorkspaceHash. On each workspace allowed, Axmud tests whether a
# workspace grid can be placed on it. If that test fails, Axmud takes the following
# action:
# - If it's the default (first) workspace, the workspace object's
# ->gridEnableFlag is set to FALSE. Windows are not arranged on a grid on that
# single workspace, and no more workspace objects can be created
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
# textviews left (for error-detection purposes)
$workspaceCount = $self->ivPairs('workspaceHash');
if ($workspaceCount) {
if ($workspaceCount == 1) {
$msg = 'There was 1 un-closed workspace object';
} else {
$msg = 'There were ' . $workspaceCount . ' un-closed workspace objects';
}
$msg .= ' on desktop shutdown';
$axmud::CLIENT->writeWarning($msg, $self->_objClass . '->stop');
}
$gridCount = $self->ivPairs('gridHash');
if ($gridCount) {
if ($gridCount == 1) {
$msg = 'There was 1 un-closed workspace grid object';
} else {
$msg = 'There were ' . $gridCount . ' un-closed workspace grid objects';
}
$msg .= ' on desktop shutdown';
$axmud::CLIENT->writeWarning($msg, $self->_objClass . '->stop');
}
$gridWinCount = $self->ivPairs('gridWinHash');
if ($gridWinCount) {
if ($gridWinCount == 1) {
$msg = 'There was 1 un-closed \'grid\' window object';
} else {
$msg = 'There were ' . $gridWinCount . ' un-closed \'grid\' window objects';
}
$msg .= ' on desktop shutdown';
$axmud::CLIENT->writeWarning($msg, $self->_objClass . '->stop');
}
$freeWinCount = $self->ivPairs('freeWinHash');
if ($freeWinCount) {
if ($freeWinCount == 1) {
$msg = 'There was 1 un-closed \'free\' window object';
} else {
$msg = 'There were ' . $freeWinCount . ' un-closed \'free\' window objects';
}
$msg .= ' on desktop shutdown';
$axmud::CLIENT->writeWarning($msg, $self->_objClass . '->stop');
}
$textViewCount = $self->ivPairs('textViewHash');
if ($textViewCount) {
if ($textViewCount == 1) {
$msg = 'There was 1 un-closed textview object';
} else {
$msg = 'There were ' . $textViewCount . ' un-closed textview objects';
}
$msg .= ' on desktop shutdown';
$axmud::CLIENT->writeWarning($msg, $self->_objClass . '->stop');
}
return 1;
}
sub setupWorkspaces {
# Called by GA::Client->start
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->convertSpareMainWin', @_);
}
# Update IVs
$winObj->set_owner($session);
$winObj->set_session($session);
# Position it on a workspace grid (if grids are activated generally)
if ($axmud::CLIENT->activateGridFlag && $self->gridPermitFlag) {
OUTER: foreach my $workspaceObj ($axmud::CLIENT->desktopObj->listWorkspaces()) {
foreach my $gridObj (
sort {$a->number <=> $b->number} ($workspaceObj->ivValues('gridHash'))
) {
if ($gridObj->repositionGridWin($winObj)) {
# 'main' window repositioned. Decide which winmap to use, if none was
# specified by the calling function
if (! $winmap) {
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
$failFlag = $self->readValue($failFlag, \%dataHash, 'current_xterm_cube');
}
if ($self->scriptConvertVersion >= 1_000_203) {
$failFlag = $self->readFlag($failFlag, \%dataHash, 'osc_palette_flag');
}
$failFlag = $self->readHash($failFlag, \%dataHash, 'colour_tag_hash');
$failFlag = $self->readHash($failFlag, \%dataHash, 'bold_colour_tag_hash');
$failFlag = $self->readEndOfSection($failFlag, $fileHandle);
# Read desktop and display settings
$failFlag = $self->readValue($failFlag, \%dataHash, 'custom_main_win_width');
$failFlag = $self->readValue($failFlag, \%dataHash, 'custom_main_win_height');
if ($self->scriptConvertVersion < 1_000_800) {
$failFlag = $self->readValue($failFlag, \%dataHash, 'discard_me');
$failFlag = $self->readValue($failFlag, \%dataHash, 'discard_me');
$failFlag = $self->readValue($failFlag, \%dataHash, 'discard_me');
$failFlag = $self->readValue($failFlag, \%dataHash, 'discard_me');
$failFlag = $self->readValue($failFlag, \%dataHash, 'discard_me');
}
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
$client->ivPoke('currentColourCube', $dataHash{'current_xterm_cube'});
}
if ($self->scriptConvertVersion >= 1_000_203) {
$client->ivPoke('oscPaletteFlag', $dataHash{'osc_palette_flag'});
}
$client->ivPoke('colourTagHash', %{$dataHash{'colour_tag_hash'}});
$client->ivPoke('boldColourTagHash', %{$dataHash{'bold_colour_tag_hash'}});
# Read desktop and display settings
$client->ivPoke('customMainWinWidth', $dataHash{'custom_main_win_width'});
$client->ivPoke('customMainWinHeight', $dataHash{'custom_main_win_height'});
$client->ivPoke('customGridWinWidth', $dataHash{'custom_grid_win_width'});
$client->ivPoke('customGridWinHeight', $dataHash{'custom_grid_win_height'});
if ($self->scriptConvertVersion >= 1_001_162) {
$client->ivPoke('customFreeWinWidth', $dataHash{'custom_free_win_width'});
$client->ivPoke('customFreeWinHeight', $dataHash{'custom_free_win_height'});
}
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
# The data in memory matches saved data files
$self->set_modifyFlag(FALSE, $self->_objClass . '->extractData');
} else {
# The data in memory doesn't match saved data files
$self->set_modifyFlag(TRUE, $self->_objClass . '->extractData');
}
# Redraw toolbar buttons in all 'internal' windows
foreach my $winObj ($axmud::CLIENT->desktopObj->ivValues('gridWinHash')) {
my $stripObj;
if (
$winObj->winType eq 'main'
|| $winObj->winType eq 'protocol'
|| $winObj->winType eq 'custom'
) {
$stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');
if ($stripObj) {
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
# are reset
if ($overWriteFlag) {
# Replace the data in memory
$client->ivPoke('zonemapHash', %{$loadHash{'zonemap_hash'}});
$client->ivPoke('standardZonemapHash', %{$loadHash{'standard_zonemap_hash'}});
# Check that the default zonemap for all workspaces still exists and, if not,
# replace it with a standard one
foreach my $workspaceObj ($axmud::CLIENT->desktopObj->ivValues('workspaceHash')) {
if (
$workspaceObj->defaultZonemap
&& ! $axmud::CLIENT->ivExists('zonemapHash', $workspaceObj->defaultZonemap)
) {
if ($axmud::CLIENT->shareMainWinFlag) {
$workspaceObj->set_defaultZonemap('basic');
} else {
$workspaceObj->set_defaultZonemap('single');
}
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
%hash = %{$loadHash{'zonemap_hash'}};
if (%hash) {
foreach my $zonemapObj (values %hash) {
$client->add_zonemap($zonemapObj);
}
}
# Any workspace grids using one of the incorporated zonemaps must be reset
foreach my $gridObj ($axmud::CLIENT->desktopObj->ivValues('gridHash')) {
if ($gridObj->zonemap && exists $hash{$gridObj->zonemap}) {
$gridObj->applyZonemap(
$axmud::CLIENT->ivShow('zonemapHash', $gridObj->zonemap),
);
}
}
# (Calls to accessors will have set the right ->modifyFlag values)
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
# This version fixes an error in GA::Obj::WorldModel->connectRegionBrokenExit, in
# which exits that are connected to rooms in different regions as uncertain or
# one-way exits are not added to the parent regionmap's list of region exits
# First, check every region exit. If it can't be found in the parent regionmap's
# list of region exits, add it
# (Only display a warning, if the model contains exits)
if ($wmObj->{exitModelHash}) {
$self->writeText('Applying essential world model update. Please be patient...');
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->updateExtractedData',
);
}
foreach my $exitObj ($wmObj->ivValues('exitModelHash')) {
my ($roomObj, $regionObj, $regionmapObj);
if ($exitObj->{regionFlag}) {
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
# them
my ($count, $hashRef);
# Only display a warning, if the model contains objects
$count = 0;
$hashRef = $wmObj->{modelHash};
if (%$hashRef) {
$self->writeText('Applying essential world model update. Please be patient...');
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->updateExtractedData',
);
}
foreach my $exitObj ($wmObj->ivValues('exitModelHash')) {
if ($exitObj->{superFlag} && $exitObj->{twinExit}) {
my $twinExitObj = $wmObj->ivShow('exitModelHash', $exitObj->{twinExit});
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
$wmObj->ivAdd('updateBoundaryHash', $exitObj->number, $regionObj->name);
}
}
}
if ($version < 1_001_329) {
my %checkHash;
$self->writeText('Applying essential world model update. Please be patient...');
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->updateExtractedData',
);
# When pathfinding routines were updated to allow paths through adjacent regions,
# region paths may have been affected. In addition, there were some problems with
# 'safe' region paths which are supposed to avoid rooms with hazardous room flags,
# but which didn't (in certain situations)
# Check all region paths and replace any whose rooms are not in the same region
OUTER: foreach my $regionmapObj ($wmObj->ivValues('regionmapHash')) {
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
$exitObj->{name} = 'exit';
}
# Now we can compress the world model. For each room object and exit object, any IVs
# which are set to default values can be completely removed. The new code gets its
# default values from the room object and the exit object stored in the global
# variables $DEFAULT_ROOM and $DEFAULT EXIT
if ($wmObj->{modelHash}) {
$self->writeText('Applying essential world model update. Please be patient...');
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->updateExtractedData',
);
}
foreach my $roomObj ($wmObj->ivValues('roomModelHash')) {
$roomObj->compress();
}
foreach my $exitObj ($wmObj->ivValues('exitModelHash')) {
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
} else {
$textView2 = $self->createTextViewWidget($self->buffer, $colourSchemeObj);
# Pack the textviews into a container widget
($vPaned, $scroll, $scroll2) = $self->setupVPaned($textView, $textView2);
}
# Set the textview's CSS style
$axmud::CLIENT->desktopObj->setTextViewObjStyle(
$self->number,
$axmud::CLIENT->returnRGBColour($self->textColour),
$axmud::CLIENT->returnRGBColour($self->backgroundColour),
$self->font,
$self->fontSize,
$textView,
$textView2,
);
# Update IVs
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->objUpdate', @_);
}
# Update the GA::Obj::Desktop registry
$axmud::CLIENT->desktopObj->del_textView($self);
return 1;
}
sub objUpdate {
# Called by GA::Table::Pane->applyColourScheme or ->updateColourScheme (must not be called
# directly)
# Also called by $self->setMonochromeMode and ->resetMonochromeMode when a monochrome colour
# scheme is applied/removed
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
$self->ivPoke('backgroundColour', $backgroundColour);
}
# The fonts are applied in all situations
$self->ivPoke('font', $colourSchemeObj->font);
$self->ivPoke('fontSize', $colourSchemeObj->fontSize);
}
}
# Update the textview's CSS style
$axmud::CLIENT->desktopObj->setTextViewObjStyle(
$self->number,
$self->textColour,
$self->backgroundColour,
$self->font,
$self->fontSize,
$self->textView,
$self->textView2, # May be 'undef'
);
# Gtk3::TextTags might not exist for any RGB tags that have just been copied to
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
# containing no readable characters)
if (
$axmud::CLIENT->systemAllowTTSFlag
&& $axmud::CLIENT->ttsSystemFlag
&& defined $self->systemTextBuffer
&& $self->systemTextBuffer =~ m/\w/
# Also, temporarily don't convert system messages if the GA::Session flag is set
&& ! $self->session->ttsTempDisableFlag
) {
# Make sure the received text is visible in the textview(s)...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showSystemText');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->session->ttsLastType
&& $self->session->ttsLastType ne 'system'
) {
# Last TTS conversion was something other than a system message
$axmud::CLIENT->tts(
'System message: ' . $self->systemTextBuffer,
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
# containing no readable characters)
if (
$axmud::CLIENT->systemAllowTTSFlag
&& $axmud::CLIENT->ttsSystemErrorFlag
&& defined $text
&& $text =~ m/\w/
# Also, temporarily don't convert system messages if the GA::Session flag is set
&& ! $self->session->ttsTempDisableFlag
) {
# Make sure the received text is visible in the textview(s)...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showError');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->session->ttsLastType
&& $self->session->ttsLastType ne 'error'
) {
# Last TTS conversion was something other than a system error (etc) message
$axmud::CLIENT->tts('System error: ' . $text, 'error', 'error', $self->session);
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
# containing no readable characters)
if (
$axmud::CLIENT->systemAllowTTSFlag
&& $axmud::CLIENT->ttsSystemErrorFlag
&& defined $text
&& $text =~ m/\w/
# Also, temporarily don't convert system messages if the GA::Session flag is set
&& ! $self->session->ttsTempDisableFlag
) {
# Make sure the received text is visible in the textview(s)...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showWarning');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->session->ttsLastType
&& $self->session->ttsLastType ne 'error'
) {
# Last TTS conversion was something other than a system error (etc) message
$axmud::CLIENT->tts('System warning: ' . $text, 'error', 'error', $self->session);
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
# containing no readable characters)
if (
$axmud::CLIENT->systemAllowTTSFlag
&& $axmud::CLIENT->ttsSystemErrorFlag
&& defined $text
&& $text =~ m/\w/
# Also, temporarily don't convert system messages if the GA::Session flag is set
&& ! $self->session->ttsTempDisableFlag
) {
# Make sure the received text is visible in the textview(s)...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showDebug');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->session->ttsLastType
&& $self->session->ttsLastType ne 'error'
) {
# Last TTS conversion was something other than a system error (etc) message
$axmud::CLIENT->tts('System debug: ' . $text, 'error', 'error', $self->session);
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
# # containing no readable characters)
# if (
# $axmud::CLIENT->systemAllowTTSFlag
# && $axmud::CLIENT->ttsSystemFlag
# && defined $msg
# && $msg =~ m/\w/
# # Also, temporarily don't convert system messages if the GA::Session flag is set
# && ! $self->session->ttsTempDisableFlag
# ) {
# # Make sure the received text is visible in the textview(s)...
# $axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->showImproper');
#
# # ...before converting text to speech
# $axmud::CLIENT->tts(
# 'System error: improper arguments in function: ' . $func,
# 'error',
# 'error',
# $self->session,
# );
# }
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
if (defined $self->lastTooltipLine && $self->lastTooltipLine != $lineNum) {
# The mouse has moved over a new line. Make the tooltip window 'follow' it by
# briefly resetting the tooltip
$self->textView->set_tooltip_text('');
if ($self->textView2) {
$self->textView2->set_tooltip_text('');
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->checkMousePosn');
}
# Show the window
$tooltip = $self->ivShow('tooltipHash', $lineNum);
$self->textView->set_tooltip_text($tooltip);
if ($self->textView2) {
$self->textView2->set_tooltip_text($tooltip);
}
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
} else {
# Set the new mode
$self->ivPoke('splitScreenMode', 'single');
# Create the new Gtk3::TextView, using the same Gtk3::TextBuffer as the original one
my $textView = $self->createTextViewWidget($self->buffer);
# Set the textview's CSS style
$axmud::CLIENT->desktopObj->setTextViewObjStyle(
$self->number,
$self->textColour,
$self->backgroundColour,
$self->font,
$self->fontSize,
$textView,
);
# Pack the textview into a container widget
my $scroll = $self->setupScroller($textView);
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
} else {
if ($self->splitScreenMode eq 'hidden') {
# Set the new mode
$self->ivPoke('splitScreenMode', 'split');
# Move the divider and rescroll textviews to the bottom (for tidiest visual effect)
$self->setDividerPosn($self->vPaned);
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->enableSplitScreen');
$self->scrollToLock();
# Nothing needs to be re-packed
return undef
} else {
# Set the new mode
$self->ivPoke('splitScreenMode', 'split');
# Create the new Gtk3::TextView, using the same Gtk3::TextBuffer as the original one
my $textView2 = $self->createTextViewWidget($self->buffer);
# Update the textviews' CSS style
$axmud::CLIENT->desktopObj->setTextViewObjStyle(
$self->number,
$self->textColour,
$self->backgroundColour,
$self->font,
$self->fontSize,
$self->textView,
$textView2,
);
# Pack the textviews into a container widget
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
} else {
if ($self->splitScreenMode eq 'split') {
# Set the new mode
$self->ivPoke('splitScreenMode', 'hidden');
# Move the divider and rescroll textviews to the bottom (for tidiest visual effect)
$self->setDividerPosn($self->vPaned);
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->enableHiddenSplitScreen',
);
$self->scrollToLock();
# In case split screen mode has just been turned off, check that the textview's size
# hasn't change (as soon as possible)
$self->ivPoke('sizeUpdateFlag', TRUE);
# Nothing needs to be re-packed
lib/Games/Axmud/Obj/TextView.pm view on Meta::CPAN
} else {
# Set the new mode
$self->ivPoke('splitScreenMode', 'hidden');
# Create the new Gtk3::TextView, using the same Gtk3::TextBuffer as the original one
my $textView2 = $self->createTextViewWidget($self->buffer);
# Update the textviews' CSS style
$axmud::CLIENT->desktopObj->setTextViewObjStyle(
$self->number,
$self->textColour,
$self->backgroundColour,
$self->font,
$self->fontSize,
$self->textView,
$textView2,
);
# Pack the textviews into a container widget
lib/Games/Axmud/Obj/WMCtrl.pm view on Meta::CPAN
sub get_window_manager {
my $self = shift;
my $data = $self->wmctrl('-m');
my $wm = {};
foreach my $line (split(/\n/, $data)) {
my ($name, $value) = split(/:/, $line, 2);
$value =~ s/^\s+//g;
$value =~ s/\s+$//g;
$value = ($value =~ 'OFF' ? undef : 1);
$name = ($name =~ /showing the desktop/i ? 'show_desktop' : $name);
$wm->{lc($name)} = $value;
}
return $wm;
}
#sub get_windows {
# my $self = shift;
# my $data = $self->wmctrl('-l');
# my @windows;
# foreach my $line (split(/\n/, $data)) {
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Local variables
my ($screen, $msg);
# Check for improper arguments
if (! defined $zonemap || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->start', @_);
}
if (! $axmud::CLIENT->desktopObj->gridPermitFlag) {
# Workspace grids are disabled in general
$self->ivPoke('gridEnableFlag', FALSE);
} else {
# Test whether the workspace is too small
# NB Due to technical limitations, we assume that the values returned by this test
# apply to all workspaces, on systems where multiple workspaces are available
$screen = Gtk3::Gdk::Screen::get_default();
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
} elsif ($self->currentHeight > $axmud::CLIENT->constWorkspaceMaxHeight) {
$self->ivPoke('currentHeight', $axmud::CLIENT->constWorkspaceMaxHeight);
$msg = 'Desktop height';
}
if ($msg) {
$axmud::CLIENT->writeWarning(
$msg . ' exceeds maximum, reducing desktop size to '
. $self->currentWidth . 'x' . $self->currentHeight,
$self->_objClass . '->setup',
);
}
# Find the size of panels (taskbars), if possible
$self->findPanelSize();
}
# Find the size of the window controls on this workspace, by creating two test windows in
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->addWorkspaceGrid', @_);
}
if (
# Workspace grids are disactivated generally (at the user's request)
! $axmud::CLIENT->activateGridFlag
# Axmud cannot create workspace grids, because the desktop is too small, etc
|| ! $axmud::CLIENT->desktopObj->gridPermitFlag
# # Workspace grids are disabled on this workspace
|| ! $self->gridEnableFlag
) {
# Workspace grids are disabled on this workspace
return undef;
}
# Add the workspace grid object
$gridObj = $axmud::CLIENT->desktopObj->add_grid($self, $session);
if (! $gridObj) {
# Operation failed
return undef;
} else {
# Also update our own IV
$self->ivAdd('gridHash', $gridObj->number, $gridObj);
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Set up the new workspace grid object
if ($zonemap) {
$result = $gridObj->start($zonemap);
} else {
$result = $gridObj->start($self->defaultZonemap);
}
if (! $result) {
# Setup failed; discard this workspace grid
$axmud::CLIENT->desktopObj->del_grid($gridObj);
$self->ivDelete('gridHash', $gridObj->number);
return undef;
} else {
return $gridObj;
}
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
my ($self, $gridObj, $session, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->removeWorkspaceGrid', @_);
}
# Shut down the workspace grid object
if (! $axmud::CLIENT->desktopObj->del_grid($gridObj, $session)) {
return undef;
} else {
# Update our own IVs
$self->ivDelete('gridHash', $gridObj->number);
return 1;
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
$self->ivPoke('gridEnableFlag', TRUE);
# If a zonemap was specified, it's the default zonemap for this workspace
if (defined $zonemap && $axmud::CLIENT->ivExists('zonemapHash', $zonemap)) {
$self->ivPoke('defaultZonemap', $zonemap);
}
# Get a sorted list of 'grid' window objects
@winList = sort {$a->number <=> $b->number}
($axmud::CLIENT->desktopObj->ivValues('gridWinHash'));
# Create workspace grids
if ($axmud::CLIENT->shareMainWinFlag) {
# Create a grid for every session
foreach my $session ($axmud::CLIENT->listSessions()) {
my $gridObj = $self->addWorkspaceGrid($session, $zonemap);
if ($gridObj) {
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
$timeout = 1;
}
# Create a test window with maximum opacity, so the user doesn't see it
my $testWin = Gtk3::Window->new('toplevel');
$testWin->set_title($testWinName);
$testWin->set_border_width(0);
$testWin->set_size_request($initSize, $initSize);
$testWin->set_decorated(FALSE);
$testWin->set_opacity(0);
$testWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$testWin->set_skip_taskbar_hint(TRUE);
$testWin->set_skip_pager_hint(TRUE);
$testWin->show_all();
# If using X11::WMCtrl, we can move the test window to the correct workspace (if not, there
# is only one workspace in use, anyway)
if ($axmud::CLIENT->desktopObj->wmCtrlObj) {
$axmud::CLIENT->desktopObj->wmCtrlObj->move_to($testWinName, $self->systemNum);
}
$testWin->maximize();
$testWin->show_all();
# Initialise the timeout (a time in seconds)
$startTime = $axmud::CLIENT->getTime();
# The window will not become maximised immediately, so we keep looking on a loop until it
# does on until the timeout expires
do {
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->testWinControls');
($regionX, $regionY, $regionWidth, $regionHeight)
= $self->getWinGeometry($testWin->get_window());
$checkTime = $axmud::CLIENT->getTime();
} until (
($regionWidth != $initSize && $regionHeight != $initSize)
|| $checkTime > ($startTime + $timeout)
);
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
} else {
# Test successful
return ($regionX, $regionY, $regionWidth, $regionHeight);
}
}
sub findWinControlSize {
# Called by $self->start or GA::Cmd::TestWindowControls->do
# Tries to find the sizes of window controls, the edges around windows added by desktop's
# window manager. (It's extremely unlikely that different workspaces will use different
# window controls, but Axmud checks windows controls on every workspace it uses anyway)
# Create two test windows in opposite corners of the workspace and compare their actual size
# and position with what was expected
# If the test succeeds, sets $self->controlsLeftSize, etc. (If
# GA::Client->customControlsLeftSize (etc) are set, those values take precedence over
# the test values)
# If the test fails and $self->controlsLeftSize (etc) have never been set for this
# workspace, sets them using GA::Client->customControlsLeftSize or
# ->constControlsLeftSize (etc)
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Return the results of the test (not the stored controls sizes)
return ($left, $right, $top, $bottom);
}
}
sub testWinControls {
# Called by $self->findWinControlSize
# Creates a test window in one of two opposite corners of this workspace and, by testing its
# actual coordinates against its expected coordinates, finds out the size of two of the
# window controls used by the current desktop theme
#
# Expected arguments
# $gravityFlag - FALSE to use top-left corner, TRUE to use bottom-right corner
#
# Return values
# Returns an empty list on improper arguments or if the window's position on the desktop
# can't be found
# Otherwise returns a list in the form
# ($gravityFlag = FALSE) - The list (size_of_left_control, size_of_top_control)
# ($gravityFlag = TRUE) - The list (size_of_bottom_control, size_of_right_control)
my ($self, $gravityFlag, $check) = @_;
# Local variables
my (
$testWinName, $testWinSize, $testWinDistance, $checkTime, $matchFlag, $regionX,
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
}
# Set the window's gravity
if (! $gravityFlag) {
$testWin->set_gravity('GDK_GRAVITY_NORTH_WEST');
} else {
$testWin->set_gravity('GDK_GRAVITY_SOUTH_EAST');
}
# Use standard 'dialogue' window icons
$testWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
# Make the window visible, briefly
$testWin->show_all();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->testWinControls');
# If using X11::WMCtrl, we can move the test window to the correct workspace (if not, there
# is only one workspace in use, anyway)
if ($axmud::CLIENT->desktopObj->wmCtrlObj) {
# Very rarely, the call to X11::WMCtrl->get_windows() produces an unexplainable error.
# This nudge seems to prevent it from happening
$axmud::CLIENT->desktopObj->wmCtrlObj->get_window_manager();
# In some cases, X11::WMCtrl doesn't know about the test window (despite the call to
# ->updateWidgets just above). Wait for up to a second and, if X11::WMCtrl still
# hasn't spotted the new window, regard the test as a failure
$checkTime = $axmud::CLIENT->getTime() + 1;
do {
OUTER: foreach my $hashRef ($axmud::CLIENT->desktopObj->wmCtrlObj->get_windows()) {
if ($$hashRef{'title'} eq $testWinName) {
$matchFlag = TRUE;
last OUTER;
}
}
} until ($matchFlag || $axmud::CLIENT->getTime() > $checkTime);
if (! $matchFlag) {
# Test failed
return @emptyList;
} else {
# Can move the window to its workspace without triggering an error (providing we do
# a quick ->updateWidgets first)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->testWinControls');
$axmud::CLIENT->desktopObj->wmCtrlObj->move_to($testWinName, $self->systemNum);
}
}
# Get the window's actual position on the desktop
($regionX, $regionY, $regionWidth, $regionHeight, $clientX, $clientY)
= $self->getWinGeometry($testWin->get_window());
# Destroy the test window, now that we have all the data we want
$testWin->destroy();
# Return the window controls sizes as a list
if (! $gravityFlag) {
# Return size of the left and top window controls
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
);
# Check for improper arguments
if (! defined $gdkWin || defined $check) {
$axmud::CLIENT->writeImproper($self->_objClass . '->getWinGeometry', @_);
return @emptyList;
}
# Make sure all drawing operations are complete
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->getWinGeometry');
# Get the position of the visible window
($regionX, $regionY) = $gdkWin->get_root_origin();
# Get the position of the window's client area
($clientX, $clientY) = $gdkWin->get_origin();
# Get the size of the window's client area; the size of the window region can be calculated
# by adding the ttitle bar
$clientWidth = $gdkWin->get_width();
$clientHeight = $gdkWin->get_height();
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
@emptyList, @returnList,
);
# Check for improper arguments
if (! defined $number) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->matchWinList', @_);
}
# Can't do anything without X11::WMCtrl
if (! $axmud::CLIENT->desktopObj->wmCtrlObj) {
return @emptyList;
}
# Cycle through the list of windows on all workspaces, ignoring any windows that aren't on
# this workspace
$count = 0;
OUTER: foreach my $hashRef ($axmud::CLIENT->desktopObj->wmCtrlObj->get_windows()) {
my $title;
if ($$hashRef{'workspace'} == $self->systemNum) {
# X11::WMCtrl handles a string containing both the window's title and the hostname
# of the X client drawing the window; however, when that hostname is 'N/A',
# X11::WMCtrl is unable to remove it, so we'll have to do that ourselves
$title = $$hashRef{'title'};
$title =~ s/^\sN\/A\s//;
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
|| (defined $widthPixels && ! defined $heightPixels)
|| (! defined $widthPixels && defined $heightPixels)
|| defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->moveResizeWin', @_);
}
if ($winObj->winType ne 'external') {
# Move the window to the correct workspace, if possible
if ($axmud::CLIENT->desktopObj->wmCtrlObj) {
# Give the window a unique name, so WMCtrl can find it
my $title = $winObj->winWidget->get_title();
$winObj->winWidget->set_title($axmud::SCRIPT . int(rand(1_000_000_000)));
# Move the window
$axmud::CLIENT->desktopObj->wmCtrlObj->move_to(
$winObj->winWidget->get_title(),
$self->systemNum,
);
# Restore the original title
$winObj->winWidget->set_title($title);
}
# Resize the window, if that was specified
if (defined $widthPixels) {
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
$yPosPixels = -1;
}
if (! defined $widthPixels) {
$widthPixels = -1;
$heightPixels = -1;
}
# Move the window to the correct workspace
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-r',
$winObj->internalID,
'-t',
$self->systemNum,
'-i',
);
# Set the window's size and position
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-r',
$winObj->internalID,
"-e 0,$xPosPixels,$yPosPixels,$widthPixels,$heightPixels",
'-i',
);
}
# Operation complete
return 1;
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Creates a 'grid' window object. 'external' windows use GA::Win::External objects; other
# kinds of 'grid' window use GA::Win::Internal. (This function isn't used to create 'free'
# windows; call GA::Generic::Win->createFreeWin for that)
# If the window itself doesn't exist, creates it using the specified size and coordinates,
# in the specified layer, on the workspace $self->systemNum
# If the window already exists, resizes and moves it using the specified size and
# coordinates
# If workspace grids are available and the window's specified position is occupied by
# another window, moves the specified window to another position in the zone, if possible
# If workspace grids aren't available, ignores the specified coordinates (if supplied), and
# lets the desktop's window manager decide where to put the window
#
# NB If the calling function wants the window to appear on a particular workspace only, it
# can call this function directly
# If the calling function wants the window to appear on the first available workspace, it
# can call GA::Obj::Desktop->listWorkspaces to get an ordered list of workspaces, with
# the preferred workspace (if specified) first in the list. The calling function can then
# call this function for each workspace on the list until a new window object is actually
# created
#
# NB 'main' windows should only be created by code in GA::Client or GA::Session.
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
$packageName = 'Games::Axmud::Win::Map';
} else {
# $winType is 'main', 'protocol', 'custom'
$packageName = 'Games::Axmud::Win::Internal';
}
}
$winObj = $packageName->new(
$axmud::CLIENT->desktopObj->gridWinCount,
$winType,
$winName,
$self,
$owner,
$session,
$workspaceGridObj,
$areaObj,
$winmapName,
);
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# window and then try to add it via a call to GA::Client->createGridWin)
if (! $winObj || $winObj->winCategory ne 'grid' || $winObj->winType ne $winType) {
# Something or other failed. Update the zone
$zoneObj->removeArea($areaObj);
return undef;
}
# Update the GA::Obj::Desktop object's registry of all 'grid' windows
$axmud::CLIENT->desktopObj->add_gridWin($winObj);
# Tell the workspace grid object and area object they have received a new window
$workspaceGridObj->add_gridWin($winObj);
$areaObj->set_win($winObj);
# Move the window to its correct workspace, size and position
if ($winType ne 'external') {
# Create a new Gtk3::Window widget at the specified size and position (but don't make
# it visible yet)
if (! $winObj->winSetup($winTitle, $beforeListRef)) {
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Move the window to its correct workspace, size and position
$self->moveResizeWin(
$winObj,
$xPosPixels,
$yPosPixels,
$widthPixels,
$heightPixels,
);
# # For 'grid' windows, $winObj->winEnable created the window in a minimised state so it
# # didn't appear to jump around on the desktop. Unminimise it now
# $winObj->unminimise();
# Update the GA::Client's hash of stored window positions (if required)
if ($winObj->winWidget) {
$axmud::CLIENT->add_storeGridPosn(
$winObj,
$winObj->winWidget->get_position(),
$winObj->winWidget->get_size(),
);
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
$packageName = 'Games::Axmud::Win::Map';
} else {
# $winType is 'main', 'protocol', 'custom'
$packageName = 'Games::Axmud::Win::Internal';
}
}
$winObj = $packageName->new(
$axmud::CLIENT->desktopObj->gridWinCount,
$winType,
$winName,
$self,
$owner,
$session,
undef,
undef,
$winmapName,
);
# (The check for ->winType makes sure that plugins don't create, for example, a 'free'
# window and then try to add it via a call to GA::Client->createGridWin)
if (! $winObj || $winObj->winCategory ne 'grid' || $winObj->winType ne $winType) {
# Something or other failed
return undef;
}
# Update the GA::Obj::Desktop object's registry of all 'grid' windows
$axmud::CLIENT->desktopObj->add_gridWin($winObj);
# Move the window to its correct workspace, size and position
if ($winType ne 'external') {
# Create a new Gtk3::Window widget (but don't make it visible yet)
if (! $winObj->winSetup($winTitle, $beforeListRef)) {
# Something or other failed
return undef;
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# Make the window actually visible, if it's not already visible
if (! $winObj->enabledFlag) {
$winObj->winEnable($afterListRef);
}
# If this 'external' window has already been grabbed to the workspace grid with
# ';grabwindow' and then removed from it with ';banishwindow', it will be minimised.
# In any case, if the window is minimised, it should be unminimised before being
# restacked
$axmud::CLIENT->desktopObj->wmCtrlObj->unminimize($internalID);
}
# Windows created via this function always have the focus (unlike those created by calls to
# $self->createGridWin, in which the 'main' windows is always given focus)
$winObj->restoreFocus();
# Return the blessed reference of the new window object to show success
return $winObj;
}
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
# assume that the Axmud is still setting up. If there is more than one zone, set the
# 'main' window to fill the zone. If there is only one zone, use the default 'main' window
# size
if (
! $zoneSpecifiedFlag
&& (
(defined $widthPixels && ! defined $heightPixels)
|| (defined $heightPixels && ! defined $widthPixels)
)
) {
if ($winType eq 'main' && ! $axmud::CLIENT->desktopObj->gridWinHash) {
# It's the 'main' window, which is almost always in zone 1
if ($workspaceGridObj->zoneCount == 1) {
$widthPixels = $axmud::CLIENT->customMainWinWidth;
$heightPixels = $axmud::CLIENT->customMainWinHeight;
} else {
$widthPixels = ($zoneObj->widthBlocks * $blockSize);
lib/Games/Axmud/Obj/Workspace.pm view on Meta::CPAN
);
}
# Now that we have the window's final size and position in the zone, reset the variables
# that show the window's size and position, in pixels, on the workspace
($xPosPixels, $yPosPixels) = $zoneObj->getInternalGridPosn($xPosBlocks, $yPosBlocks);
$widthPixels = $widthBlocks * $axmud::CLIENT->gridBlockSize;
$heightPixels = $heightBlocks * $axmud::CLIENT->gridBlockSize;
# If the desktop theme uses window controls, we have to take them into account, changing the
# size of the window accordingly
($xPosPixels, $yPosPixels, $widthPixels, $heightPixels)
= $workspaceGridObj->fineTuneWinSize(
$winType,
$xPosPixels,
$yPosPixels,
$widthPixels,
$heightPixels
);
lib/Games/Axmud/Obj/WorkspaceGrid.pm view on Meta::CPAN
return 1;
}
sub fineTuneWinSize {
# Called by GA::Obj::Workspace->chooseWinPosn, $self->changeWinzone,
# GA::Obj::Zone->adjustMultipleWin and ->replaceAreaSpace
# Makes small adjustments to a window's size and position to close any gaps on the right and
# bottom edges of the workspace grid (because of an arkwardly-sized available workspace)
# Makes more small adjustments to correct for window controls, usually before a call to
# GA::Obj::Workspace->moveResizeWin. (If the desktop theme uses window controls, we have
# to take them into account, changing the size of the window accordingly; $widthPixels and
# $heightPixels must now refer to the client area, not the whole window including the
# window controls)
#
# Expected arguments
# $winType - The window type; one of the 'grid' window types specified by
# GA::Client->constGridWinTypeHash
# $xPosPixels, $yPosPixels
# - The position of the window to be fine-tuned
# $widthPixels, $heightPixels
lib/Games/Axmud/Obj/WorkspaceGrid.pm view on Meta::CPAN
! defined $winObj || ! defined $zoneObj || defined $check
|| (defined $fixWidthPixels && ! defined $fixHeightPixels)
|| (! defined $fixWidthPixels && defined $fixHeightPixels)
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->changeWinzone', @_);
}
# Check that the window is a 'grid' window
if (
$winObj->winCategory ne 'grid'
|| ! $axmud::CLIENT->desktopObj->ivExists('gridWinHash', $winObj->number)
|| ! $winObj->areaObj
|| ! $winObj->areaObj->zoneObj
) {
return $axmud::CLIENT->writeError(
'Can\'t move the window - window is not a grid window',
$self->_objClass . '->changeWinzone',
);
}
# Check that the window is allowed in the new zone
lib/Games/Axmud/Obj/WorkspaceGrid.pm view on Meta::CPAN
return $axmud::CLIENT->writeError(
'Can\'t move the window - ouldn\'t find room for the \'' . $winObj->winType
. '\' window anywhere in zone #' . $zoneObj->number,
$self->_objClass . '->changeWinzone',
);
}
# If the window position on the grid puts it rather close to the edge (or edges) of the
# zone, and if the gaps between the window and the zone's edge are empty, adjust the size
# of the window to fill the gap (this prevents small areas of the zone from always being
# empty: makes the desktop look nice). If the maximum allowable gap size is 0, don't fill
# gaps at all
if ($axmud::CLIENT->gridGapMaxSize) {
($xPosBlocks, $yPosBlocks, $widthBlocks, $heightBlocks)
= $zoneObj->adjustSingleWin(
$layer,
$xPosBlocks,
$yPosBlocks,
$widthBlocks,
$heightBlocks,
lib/Games/Axmud/Obj/WorkspaceGrid.pm view on Meta::CPAN
if (! $successFlag) {
return $axmud::CLIENT->writeError(
'Can\'t move the window - attempt to move it from its current zone failed',
$self->_objClass . '->changeWinzone',
);
}
}
# Work out the window object's size and position on the desktop in pixels
$xPosPixels = $self->xPosPixels + (($zoneObj->xPosBlocks + $xPosBlocks) * $blockSize);
$yPosPixels = $self->yPosPixels + (($zoneObj->yPosBlocks + $yPosBlocks) * $blockSize);
$widthPixels = ($widthBlocks * $blockSize);
$heightPixels = ($heightBlocks * $blockSize);
# Correct for small gaps in the grid and for window controls
($xPosPixels, $yPosPixels, $widthPixels, $heightPixels) = $self->fineTuneWinSize(
$winObj->winType,
$xPosPixels,
$yPosPixels,
lib/Games/Axmud/Obj/Zone.pm view on Meta::CPAN
# There isn't space for this window anywhere in this zone at the specified layer
return @emptyList;
}
sub adjustSingleWin {
# Called by GA::Obj::Workspace->chooseWinPosn
# If the window's proposed position on a zone's internal grid puts it rather close to the
# edge (or edges) of the zone, and if the gaps between the proposed window and the zone's
# edge(s) are unoccupied, adjust the size of the window to fill the gap (this prevents
# small regions of the zone from always being empty and makes the desktop look nice)
#
# Expected arguments
# $layer - Which layer within the zone to check first (matches a number between 0 and
# (GA::Obj::WorkspaceGrid->maxLayers - 1) )
# $winXPosBlocks, $winYPosBlocks
# - The window's proposed x/y coordinates on the zone's internal grid (in
# gridblocks)
# $winWidthBlocks, $winHeightBlocks
# - The window's proposed width and height (in gridblocks)
#
lib/Games/Axmud/Obj/Zone.pm view on Meta::CPAN
# ->ownerString is ignored in GA::Client->shareMainWinFlag = TRUE
if (
! $axmud::CLIENT->shareMainWinFlag
&& defined $session
&& defined $self->ownerString
&& $self->ownerString ne ''
&& ! defined $self->owner
) {
# Claim this zone, and all other zones (across all workspaces) with the same
# ->ownerString for this session
$axmud::CLIENT->desktopObj->claimZones($session, $self->ownerString);
}
# Set its IVs (->set_win is called by GA::Obj::Workspace->createGridWin, once the window
# object has been created)
$areaObj->set_zone($layer, $xPosBlocks, $yPosBlocks, $widthBlocks, $heightBlocks);
$areaObj->set_posn($xPosPixels, $yPosPixels, $widthPixels, $heightPixels);
return $areaObj;
}
lib/Games/Axmud/Obj/Zone.pm view on Meta::CPAN
# Update IVs
$self->ivDelete('areaHash', $areaObj->number);
# If there are no areas left in this zone, and the zone's ->owner is set, tell the
# GA::Obj::Desktop to check all zones across all workspaces. If the session has no windows
# in any of the zones it controls, free up those zones so they're available to another
# session
if ($self->owner && ! $self->areaHash) {
$axmud::CLIENT->desktopObj->relinquishZones($self->ownerString);
}
# If the global flag is set, reshuffle the position of all windows in this zone, removing
# any gaps that might have appeared in the middle of the zone, if the removed window
# occupied that space
if (! $noShuffleFlag && $axmud::CLIENT->gridReshuffleFlag) {
return $self->replaceAreaSpace($areaObj->layer);
} else {
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Local variables
my $firstTab;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# This type of window is unique (only one can be open at any time); inform the GA::Client
# it has opened
$axmud::CLIENT->set_aboutWin($self);
# If a tab to show on startup was specified, open it
$firstTab = $self->ivShow('configHash', 'first_tab');
if (defined $firstTab) {
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is unique (only one can be open at any time); inform the GA::Client
# it has closed
$axmud::CLIENT->set_aboutWin();
return 1;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$notebook->append_page($scroller, $tab);
$scroller->set_policy('automatic', 'automatic');
# Create a textview using the system's preferred colours and fonts
my $textView = Gtk3::TextView->new();
$scroller->add_with_viewport($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(FALSE);
$textView->set_cursor_visible(FALSE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# Fill the textview
if (! $newlineFlag) {
$buffer->set_text(join("", @list));
} else {
$buffer->set_text(join("\n", @list));
}
return 1
}
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# 1 on success
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# Fill the treeview
$self->resetTreeView($self->treeView);
# The 'connect' button should have focus
$self->connectButton->grab_focus();
# This type of window is unique (only one can be open at any time); inform the GA::Client
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is unique (only one can be open at any time); inform the GA::Client
# it has closed
$axmud::CLIENT->set_connectWin();
return 1;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
my $comboBox = $self->resetComboBox(TRUE);
$self->ivPoke('comboBox', $comboBox);
$self->websiteLabel->set_text($self->noWebsiteString);
$self->connectionLabel->set_text($self->noConnectString);
$self->descripBuffer->set_text('');
# (These calls eliminate flashing when the screenshot is updated rapidly, for example when
# the user scrolls through the list of worlds)
$self->winShowAll($self->_objClass . '->resetGridWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->resetGridWidgets');
# Update the world screenshot, using the default logo
# If a logo for this world exists, use it; otherwise use the default logo
my $image = Gtk3::Image->new_from_file($self->defaultIcon);
$axmud::CLIENT->desktopObj->removeWidget($self->frame, $self->image);
$self->frame->add($image);
$self->ivPoke('image', $image);
# (A repeat of those calls eliminates it entirely)
$self->winShowAll($self->_objClass . '->resetGridWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->resetGridWidgets');
# The entry box for the world's name must be made editable
$self->entry->set_editable(TRUE);
# The 'pwd' / 'account' buttons start insensitive, but can be sensitised if the user selects
# a character
$self->editPwdButton->set_sensitive(FALSE);
$self->editAccButton->set_sensitive(FALSE);
# The 'reset world' button must be insensitive when there isn't a corresponding world
# profile
$self->resetWorldButton->set_sensitive(FALSE);
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
}
if ($displayFlag || ! (-e $logoPath)) {
$logoPath = $axmud::CLIENT->getClientLogo($worldObj->adultFlag);
}
# (These calls eliminate flashing when the screenshot is updated rapidly, for example when
# the user scrolls through the list of worlds)
$self->winShowAll($self->_objClass . '->updateGridWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->updateGridWidgets');
# Update the world screenshot
my $image = Gtk3::Image->new_from_file($logoPath);
$axmud::CLIENT->desktopObj->removeWidget($self->frame, $self->image);
$self->frame->add($image);
$self->ivPoke('image', $image);
# (A repeat of those calls eliminates it entirely)
$self->winShowAll($self->_objClass . '->updateGridWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->updateGridWidgets');
# The entry box for the world's name must not be changed
$self->entry->set_editable(FALSE);
# The 'add' button must be sensitive
$self->addCharButton->set_sensitive(TRUE);
# The 'pwd'/'account' buttons start sensitised if there's a selected character, but
# desensitised if not
if ($self->miniWorldObj->selectChar) {
$self->editPwdButton->set_sensitive(TRUE);
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
my ($self, $destroyFlag, @charList) = @_;
# Local variables
my ($count, $index);
# (No improper arguments to check)
# If a Gtk3::ComboBox already exists, destroy it
if ($destroyFlag) {
$axmud::CLIENT->desktopObj->removeWidget($self->grid, $self->comboBox);
}
# Create a new combobox
unshift (@charList, $self->noCharString);
my $comboBox = $self->addComboBox($self->grid, undef, \@charList, undef,
4, 8, 7, 8);
# If the current mini-world object specifies a character, make that the combobox's active
# item. Otherwise, make the '<no character>' string the active item
$index = 0;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Local variables
my @list;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# This type of window is unique (only one can be open at any time); inform the GA::Client
# it has opened
$axmud::CLIENT->set_consoleWin($self);
# If any system messages have been stored, we can display them now
@list = $axmud::CLIENT->systemMsgList;
if (@list) {
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is unique (only one can be open at any time); inform the GA::Client
# it has closed
$axmud::CLIENT->set_consoleWin();
return 1;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Use a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
$scroller->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(FALSE);
$textView->set_cursor_visible(FALSE);
$textView->set_can_focus(FALSE);
$textView->set_wrap_mode('word-char'); # Wrap words if possible, characters if not
$axmud::CLIENT->desktopObj->setTextViewStyle('main', $textView);
# Create a mark at the end of the buffer, with right gravity, so that whenever text is
# inserted, we can scroll to that mark (and the mark stays at the end)
my $endMark = $buffer->create_mark('end', $buffer->get_end_iter(), FALSE);
# Update IVs
$self->ivPoke('packingBox', $packingBox);
$self->ivPoke('textView', $textView);
$self->ivPoke('buffer', $buffer);
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$scroller->set_policy('automatic', 'automatic');
$scroller->set_border_width(0);
# Create a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
$scroller->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(TRUE);
$textView->set_cursor_visible(TRUE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# ->signal_connect appears below
# Set the initial contents of the textview
$buffer->set_text($self->ivShow('configHash', 'mcp_content'));
# At the bottom, create a button strip in a horizontal packing box
my $hBox = Gtk3::HBox->new(FALSE, 0);
$packingBox->pack_end($hBox, FALSE, FALSE, $self->spacingPixels);
# Create some buttons
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$text,
@list,
);
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->doSave', @_);
}
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
@list = split(/\n/, $text);
# Send the MCP message (one or more multiline parts)
$self->session->mcpSendMultiLine(
'dns-org-mud-moo-simpleedit-set',
'reference',
$self->ivShow('configHash', 'mcp_reference'),
'content',
\@list,
'type',
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$scroller->set_policy('automatic', 'automatic');
$scroller->set_border_width(0);
# Create a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
$scroller->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(TRUE);
$textView->set_cursor_visible(TRUE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# At the bottom, create several horizontal packing boxes for various widgets
my $hBox = Gtk3::HBox->new(FALSE, 0);
$packingBox->pack_start($hBox, FALSE, FALSE, $self->spacingPixels);
my $radioButton = Gtk3::RadioButton->new_with_label(undef, 'Execute instructions');
$hBox->pack_start($radioButton, TRUE, TRUE, $self->spacingPixels);
my $checkButton = Gtk3::CheckButton->new_with_label('(ignore empty lines)');
$hBox->pack_start($checkButton, TRUE, TRUE, $self->spacingPixels);
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$clearButton->set_label(' Run and clear text ');
}
});
$okButton->signal_connect('clicked' => sub {
if ($radioButton->get_active()) {
# Execute instructions
$self->executeInstructions(
$axmud::CLIENT->desktopObj->bufferGetText($buffer),
$entry->get_text(),
$entry2->get_text(),
$checkButton->get_active(),
);
} else {
# Save the script as a temporary file, and execute it
$self->runScript($axmud::CLIENT->desktopObj->bufferGetText($buffer));
}
});
$clearButton->signal_connect('clicked' => sub {
if ($radioButton->get_active()) {
# Execute instructions
$self->executeInstructions(
$axmud::CLIENT->desktopObj->bufferGetText($buffer),
$entry->get_text(),
$entry2->get_text(),
$checkButton->get_active(),
);
} else {
# Save the script as a temporary file, and execute it
$self->runScript($axmud::CLIENT->desktopObj->bufferGetText($buffer));
}
$buffer->set_text('');
});
$closeButton->signal_connect('clicked' => sub {
$self->winDestroy();
});
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Local variables
my @list;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# This type of window is unique (only one can be open per session); inform the GA::Session
# it has opened
$self->session->set_consoleWin($self);
# If any system messages have been stored, we can display them now
@list = $self->session->systemMsgList;
if (@list) {
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is unique (only one can be open per session); inform the GA::Session
# it has closed
$self->session->set_consoleWin();
return 1;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$scroller->set_policy('automatic', 'automatic');
$scroller->set_border_width(0);
# Create a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
$scroller->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(TRUE);
$textView->set_cursor_visible(TRUE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# At the bottom, create a button strip in a horizontal packing box
my $hBox = Gtk3::HBox->new(FALSE, 0);
$packingBox->pack_end($hBox, FALSE, FALSE, $self->spacingPixels);
# Create a combo
my $comboBox = Gtk3::ComboBoxText->new();
$hBox->pack_start($comboBox, FALSE, FALSE, $self->borderPixels);
$title = 'Add an ANSI escape sequence:';
$sampleText = 'Sample xterm-256 text colour';
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
});
# Create the 'Simulate' button
my $okButton = Gtk3::Button->new('Simulate');
$hBox->pack_end($okButton, FALSE, FALSE, 0);
$okButton->get_child->set_width_chars(8);
$okButton->signal_connect('clicked' => sub {
my ($text, $type);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
$type = $self->ivShow('configHash', 'type');
# If the textview contains some text, and if the calling GA::Session still exists...
if ($text && $axmud::CLIENT->ivExists('sessionHash', $self->session->number)) {
if ($type eq 'prompt') {
# Simulate a prompt received from the world. The TRUE argument means that the
# 'main' window's blinker shouldn't be turned on.
chomp $text;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Set the window title
$winWidget->set_title($self->title);
# Set the window's default size and position
$winWidget->set_default_size($self->widthPixels, $self->heightPixels);
$winWidget->set_border_width($self->borderPixels);
$winWidget->set_position('center');
# Set the icon list for this window
$iv = $self->winType . 'WinIconList';
$winWidget->set_icon_list($axmud::CLIENT->desktopObj->{$iv});
# Draw the widgets used by this window
if (! $self->drawWidgets()) {
return undef;
}
# The calling function can now call $self->winEnable to make the window visible
return 1;
}
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$scroller->set_policy('automatic', 'automatic');
$scroller->set_border_width(5);
# Create a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
$scroller->add($textView);
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(FALSE);
$textView->set_cursor_visible(FALSE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# Copy the contents of the file to the textview
$buffer->set_text(join("\n", $self->lineList));
# At the bottom, create a button strip in a horizontal packing box
my $hBox = Gtk3::HBox->new(FALSE, 0);
$packingBox->pack_end($hBox, FALSE, FALSE, $self->spacingPixels);
# Add a single button
my $button = Gtk3::Button->new(' Close ');
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# 1 on success
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# This type of window is unique to its GA::Session (only one can be open at any time, per
# session); inform the session it has opened
$self->session->set_viewerWin($self);
return 1;
}
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Window can't be destroyed
return undef;
} else {
$self->ivUndef('winWidget');
$self->ivUndef('winBox');
}
# Inform the owner and the desktop object of this 'free' window's demise
$axmud::CLIENT->desktopObj->del_freeWin($self);
if ($self->owner) {
$self->owner->del_childFreeWin($self);
}
# This type of window is unique to its GA::Session (only one can be open at any time, per
# session); inform the session it has closed
$self->session->set_viewerWin();
return 1;
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
@buttonList = @$buttonListRef;
};
# Remove the existing tabs and buttons (if any)
$self->resetNotebook();
# If a button list was not visible, but should now be visible, do some repacking
if (! $self->hPaned2 && $buttonListRef) {
# Unpack existing widgets
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned, $self->treeViewScroller);
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned, $self->notebook);
# Repack the treeview scroller
$self->hPaned->pack1($self->treeViewScroller, FALSE, FALSE);
# Add a second horizontal pane on the right of the first one
# In this pane, a notebook is on the left, and a strip of buttons is on the right
my $hPaned2 = Gtk3::HPaned->new();
$self->hPaned->pack2($hPaned2, TRUE, FALSE);
# Repack the notebook on the left of $hPaned2
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
$self->hPaned->set_position($self->leftWidth);
$hPaned2->set_position($self->centreWidth);
# Update IVs
$self->ivPoke('hPaned2', $hPaned2);
$self->ivPoke('vBox', $vBox);
# Likewise, if the button list was visible and is no longer required, do some repacking
} elsif ($self->hPaned2 && ! $buttonListRef) {
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned, $self->treeViewScroller);
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned2, $self->notebook);
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned, $self->hPaned2);
# Repack the treeview scroller
$self->hPaned->pack1($self->treeViewScroller, FALSE, FALSE);
# Repack the notebook
$self->hPaned->pack2($self->notebook, TRUE, FALSE);
$self->hPaned->set_position($self->leftWidth);
# Update IVs
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Set the width of the notebook, depending on whether there are any buttons to display
if ($buttonListRef) {
$self->hPaned2->set_position($self->centreWidth);
} else {
$self->hPaned2->set_position($self->centreWidth + $self->rightWidth);
}
# Render the changes
$self->winShowAll($self->_objClass . '->refreshNotebook');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->refreshNotebook');
# If $scrollFlag is set, we can now scroll the Gtk3::ScrolledWindow to the bottom
if ($scrollFlag) {
foreach my $scroller (@scrollerList) {
my $vAdjust = $scroller->get_vadjustment();
$vAdjust->set_value(
$vAdjust->get_lower()
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
# Check for improper arguments
if (! defined $tab) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->refreshTextView', @_);
}
# If the button strip is visible, do some repacking
if ($self->hPaned2) {
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned2, $self->notebook);
$axmud::CLIENT->desktopObj->removeWidget($self->hPaned, $self->hPaned2);
$self->hPaned->add2($self->notebook);
$self->hPaned->set_position($self->leftWidth);
}
# Update IVs
$self->ivUndef('hPaned2');
$self->ivUndef('vBox');
lib/Games/Axmud/OtherWin.pm view on Meta::CPAN
my $scrolled = Gtk3::ScrolledWindow->new(undef, undef);
$scrolled->set_shadow_type($axmud::CLIENT->constShadowType);
$scrolled->set_policy('automatic', 'automatic');
$scrolled->set_border_width(5);
# Create a textview with default colours/fonts
my $textView = Gtk3::TextView->new();
my $buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(FALSE);
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winType, $textView);
# Copy the text into the textview
$buffer->set_text(join("\n", @list));
# Complete setup
$scrolled->add($textView);
# Add a label
$label = Gtk3::Label->new_with_mnemonic($tab);
$self->notebook->append_page($scrolled, $label);
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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;
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
$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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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);
}
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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;
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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);
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
}
# 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;
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
'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
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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 {
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
$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 {
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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);
});
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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));
});
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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);
});
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
. ' 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);
});
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
'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 {
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
. ' 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 {
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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);
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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,
);
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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');
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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));
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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');
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
'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();
}
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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();
}
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
$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));
});
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
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,
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
# 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
}
lib/Games/Axmud/PrefWin.pm view on Meta::CPAN
'<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);
lib/Games/Axmud/Session.pm view on Meta::CPAN
$self->writeText($line);
}
# Update this session's tab label. The TRUE argument means definitely update it.
# (Nothing happens if the session is using a simple tab)
$self->checkTabLabels(TRUE);
# Update the connection info strip object for any 'internal' windows used by this
# session (should only be one, at this point)
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
$winObj->setHostLabel($self->getHostLabelText());
}
}
# Display a list of loaded plugins
if ($axmud::CLIENT->pluginHash) {
$pluginString = '';
lib/Games/Axmud/Session.pm view on Meta::CPAN
# When connecting to a world, the 'Connecting...' message will appear on this line, instead
if ($self->initOfflineFlag) {
$self->writeText('Session ready');
}
# Re-enable text-to-speech after displaying the introductory system messages
$self->ivPoke('ttsTempDisableFlag', FALSE);
# Inserting a Gtk3 update here allows all of the introductory messages actually to be
# displayed, before any text-to-speech stuff is done
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->start');
# In blind mode, and only for the first session, display some helpful information
if (
$axmud::BLIND_MODE_FLAG
&& $axmud::CLIENT->sessionCount <= 1
&& ! $axmud::CLIENT->blindHelpMsgShownFlag
) {
$self->writeText(
'Axmud is ready to start. You might like to read the help for visually-impaired'
. ' users. You can open it in your web browser. In this window, type a semicolon'
lib/Games/Axmud/Session.pm view on Meta::CPAN
# If an attempted connection is immediately refused by the host, $self->status will
# already be set to 'disconnected'. In that case, we don't want to do most of the
# things usually done by the rest of this function
$self->spinIncomingLoop();
if ($self->status eq 'disconnected') {
$self->stopSessionLoop();
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
return 1;
}
}
# The session may now display received text in its 'main' window tab
$self->ivPoke('startCompleteFlag', TRUE);
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# Handle automatic logins
if ($self->initOfflineFlag) {
# In 'connect offline' mode, the character is always marked as logged in immediately
$self->doLogin();
} else {
# Set up the automatic login (if any), but obviously don't attempt a login if we
lib/Games/Axmud/Session.pm view on Meta::CPAN
&& $self->defaultTabObj
&& ! $self->defaultTabObj->paneObj->removeSessionTab($self)
) {
return $self->writeError(
'Could not remove the tab for a session',
$self->_objClass . '->stop',
);
}
# Close any 'free' windows produced by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionFreeWins($self)) {
# As one 'free' window is closed, its child 'free' windows are also closed, so we have
# to check the window still exists, before destroying it
if ($axmud::CLIENT->desktopObj->ivExists('freeWinHash', $winObj->number)) {
$winObj->winDestroy();
}
}
# If sessions have their own workspace grids, remove the workspace grids (which closes their
# 'grid' windows, but not this session's 'main' window, which we'll deal with in a moment)
# If sessions share a workspace grid, do nothing
$axmud::CLIENT->desktopObj->removeSessionWorkspaceGrids($self);
# Remove any temporary zonemaps for this session
foreach my $zonemapObj ($axmud::CLIENT->ivValues('zonemapHash')) {
if ($zonemapObj->tempFlag && $zonemapObj->tempSession eq $self) {
$axmud::CLIENT->del_zonemap($zonemapObj);
}
}
# Check if there are any remaining 'grid' windows associated with this session and, if so,
# close them (but still don't close the 'main' window)
$axmud::CLIENT->desktopObj->removeSessionWindows($self);
# If this session has any 'external' windows on this session's workspace grid, and if this
# wasn't the current session, those 'external' windows may be invisible/minimised. Make
# them visible
$axmud::CLIENT->desktopObj->revealGridWins($self);
# Otherwise, when sessions don't share a 'main' window, we can delete it this session's
# 'main' window now
if (! $axmud::CLIENT->shareMainWinFlag) {
$self->mainWin->winDestroy();
$self->ivUndef('mainWin');
} elsif (! $actualCount && ! $axmud::CLIENT->shutdownFlag) {
# Convert the single remaining 'main' window back into a spare 'main' window
$axmud::CLIENT->desktopObj->deconvertSpareMainWin($self->mainWin);
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
return 1;
}
# Setup
sub setMainWin {
# Called by $self->start
# Creates a new 'main' window or re-uses an existing one
lib/Games/Axmud/Session.pm view on Meta::CPAN
}
# If a winmap has been marked as the default for this world, use it (otherwise the function
# returns 'undef', and a default winmap is used)
$winmap = $self->checkWinmapWorlds($self->initWorld);
# If sessions share a 'main' window, create a workspace grid on every workspace for this
# session
# If sessions don't share a 'main' window, use the shared workspace grid on every
# workspace (or create one on every workspace, if this is the first session)
OUTER: foreach my $workspaceObj ($axmud::CLIENT->desktopObj->listWorkspaces()) {
my $gridObj;
if ($axmud::CLIENT->shareMainWinFlag) {
$gridObj = $workspaceObj->addWorkspaceGrid($self);
} elsif (! $currentCount) {
$gridObj = $workspaceObj->addWorkspaceGrid();
}
# (Temporarily storing workspace grid object makes the following call to
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Use the existing shared 'main' window
$winObj = $axmud::CLIENT->mainWin;
}
if (
! $currentCount
&& (! $axmud::TEST_MODE_FLAG || $axmud::CLIENT->sessionCount)
&& $winObj
) {
# Convert a spare 'main' window into a normal one
if (! $axmud::CLIENT->desktopObj->convertSpareMainWin($self, $winObj, $winmap)) {
# Could not reposition the 'main' window, for some reason. Destroy it, and allow
# the code below to create a new one
$winObj->winDestroy();
$axmud::CLIENT->reset_mainWin();
$winObj = undef;
}
}
if (! $winObj) {
# Create a new 'main' window for this session, using the first available workspace. If
# >shareMainWinFlag = TRUE, we can specify the workspace grid to use, too
OUTER: foreach my $workspaceObj ($axmud::CLIENT->desktopObj->listWorkspaces()) {
$winObj = $workspaceObj->createGridWin(
'main', # Window type
'main', # Window name
undef, # Window title set automatically
$winmap, # Winmap name
'Games::Axmud::Win::Internal', # Package name
undef, # No known Gtk3::Window
undef, # No system internal ID
$self, # Owner
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Update any MXP gauges whose entities have been modified
$self->updateMxpGauges();
# If the GA::Strip::Entry strip object's console button is in flashing mode, check whether
# it's time to stop flashing
if ($self->systemMsgCheckTime && $self->systemMsgCheckTime < $self->sessionTime) {
$self->ivUndef('systemMsgCheckTime');
# Update strip objects for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if (
$stripObj
&& $winObj->visibleSession
&& $winObj->visibleSession eq $self
) {
$stripObj->reset_consoleIconFlash();
}
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
my $adjust = $textView->get_vadjustment();
$adjust->set_value($adjust->get_upper() - $adjust->get_page_size());
}
if (%upHash || %downHash) {
# (Avoid infinite recursion)
if (! $gtkFlag) {
$axmud::CLIENT->desktopObj->updateWidgets();
}
# Check the textviews have actually scrolled to the correct position
foreach my $textView (values %upHash) {
if ($textView->get_vadjustment->get_value()) {
# Forced scrolling wasn't successful, so try again on the next maintain loop
$self->ivAdd('textViewScrollUpHash', $textView, $textView);
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
}
}
# At least one task loop has completed
$self->ivPoke('firstTaskLoopCompleteFlag', TRUE);
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions (if a task
# has started or stopped during this task loop or if a Axbasic script has resumed)
if ($resetWinFlag) {
$axmud::CLIENT->desktopObj->restrictWidgets();
}
# Allow other loops to spin
$self->ivPoke('childLoopSpinFlag', FALSE);
return 1;
}
sub compileTasks {
lib/Games/Axmud/Session.pm view on Meta::CPAN
if ($self->mainWin->visibleSession && $self->mainWin->visibleSession ne $self) {
$self->ivPoke('showNewTextFlag', TRUE);
}
}
# Convert text to speech, if required
if ($axmud::CLIENT->systemAllowTTSFlag && $self->ttsBuffer) {
# Make sure the received text is visible in the 'main' window...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->spinIncomingLoop');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->ttsLastType
&& $self->ttsLastType ne 'receive'
) {
# Last TTS conversion was something other than received text
$axmud::CLIENT->tts(
'Received text: ' . $self->ttsBuffer,
'receive',
lib/Games/Axmud/Session.pm view on Meta::CPAN
$historyObj,
);
# Check for improper arguments
if (! defined $host || ! defined $port || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->doConnect', @_);
}
# Make sure any 'Connecting...' messages are visible immediately
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->doConnect');
# Decide which protocol to use, if one was not specified by the calling function
if (! $protocol) {
if ($self->initProtocol) {
$protocol = $self->initProtocol;
} elsif ($self->currentWorld->protocol) {
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Update the object's ->currentTime every second
$self->ivPoke('historyCheckTIme', $self->sessionTime + 1);
# Update world profile IVs
$self->currentWorld->ivPush('connectHistoryList', $historyObj);
}
}
# Update the connection info strip object for any 'internal' windows used by this
# session (should only be one, at this point)
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
$winObj->setHostLabel($self->getHostLabelText());
}
# Make sure any system messages so far are actually visible, in case the connection hangs
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->doConnect');
# Connect to the world using the specified protocol
if ($protocol eq 'telnet') {
# Connect using GA::Obj::Telnet
$connectObj = Games::Axmud::Obj::Telnet->new(
Axmud_session => $self,
Errmode => 'return',
Timeout => $self->connectTimeOut,
);
lib/Games/Axmud/Session.pm view on Meta::CPAN
}
# Update the world's connection history object, if one was created for this session
if ($self->connectHistoryObj) {
$self->connectHistoryObj->set_disconnectedTime();
}
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# Make sure the command entry box isn't obscured in any 'internal' windows used by this
# session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj) {
$stripObj->obscureEntry(FALSE);
}
}
}
# Operation complete
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Update (some) IVs
$self->ivUndef('connectObj');
$self->ivUndef('sshObj');
$self->ivUndef('ptyObj');
$self->ivUndef('sslObj');
$self->ivPoke('status', 'disconnected');
$self->ivPoke('loginFlag', FALSE);
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# Make sure the command entry box isn't obscured in any 'internal' windows used by this
# session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj) {
$stripObj->obscureEntry(FALSE);
}
}
return 1;
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
if (! $axmud::CLIENT->offlineOnDisconnectFlag) {
$self->ivPoke('disconnectTime', $axmud::CLIENT->localClock);
} else {
$self->ivPoke('disconnectTime', undef);
}
if (! $flag) {
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
}
if (! $axmud::CLIENT->offlineOnDisconnectFlag) {
# Remove all active interfaces
$self->ivEmpty('interfaceHash');
$self->ivEmpty('interfaceNumHash');
$self->ivPoke('interfaceCount', 0);
$self->ivEmpty('deleteInterfaceList');
lib/Games/Axmud/Session.pm view on Meta::CPAN
# can't be stopped, as we still need to terminate the connection itself)
if ($self->sessionLoopObj && ! $self->stopSessionLoop()) {
$self->writeError(
'Could not stop the session loop',
$self->_objClass . '->reactDisconnect',
);
}
# Close any 'free' windows produced by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionFreeWins($self)) {
# As one 'free' window is closed, its child 'free' windows are also closed, so we
# have to check the window still exists, before destroying it
if ($axmud::CLIENT->desktopObj->ivExists('freeWinHash', $winObj->number)) {
$winObj->winDestroy();
}
}
# Check if there are any remaining 'grid' windows associated with this session and, if
# so, close them (but still don't close the 'main' window)
$axmud::CLIENT->desktopObj->removeSessionWindows($self);
# If this session has any 'external' windows on this session's workspace grid, and if
# this wasn't the current session, those 'external' windows may be invisible/
# minimised. Make them visible
$axmud::CLIENT->desktopObj->revealGridWins($self);
} else {
# After switching to 'offline' mode, reset all running tasks (as if the session had just
# started in 'offline' mode
foreach my $taskObj ($self->ivValues('currentTaskHash')) {
if ($taskObj->status eq 'running' || $taskObj->status eq 'paused') {
$taskObj->set_status('reset');
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Spin the task loop so that current tasks are reset immediately
$self->spinTaskLoop();
}
# Update this session's tab label to mark the session as disconnected (or in 'offline'
# mode). The TRUE flag forces the function to update the tab label
$self->checkTabLabels(TRUE);
# Update strip objects for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj;
# Update information stored in each 'internal' window's connection info strip, if
# visible
$winObj->setHostLabel($self->getHostLabelText());
$winObj->setTimeLabel($self->getTimeLabelText());
# Reset the 'internal' window's entry box
$winObj->resetEntry();
lib/Games/Axmud/Session.pm view on Meta::CPAN
# as we normally would
$stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($stripObj) {
$stripObj->removeSessionGauges($self, TRUE);
}
}
}
# Make sure all changes are visible immediately
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->reactDisconnect');
# Update gauge IVs stored by MXP
$self->ivUndef('mxpGaugeLevel');
$self->ivEmpty('mxpGaugeHash');
return 1;
}
sub connectionError {
lib/Games/Axmud/Session.pm view on Meta::CPAN
# can use it as a tooltip
# (After an MXP crosslinking operation, the time connected to the new server is displayed)
$self->ivPoke('connectedTimeString', $axmud::CLIENT->localTime());
# Update the world's connection history object, if one was created for this session
if ($self->connectHistoryObj) {
$self->connectHistoryObj->set_connectedTime();
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# Update the connection info strip object for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
$winObj->setHostLabel(
$self->getHostLabelText(),
'Connected since ' . $self->connectedTimeString,
);
}
# (Make sure that message is visible immediately)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->connectionComplete');
if ($self->currentWorld->loginMode eq 'immediate') {
# Automatic login mode 'immediate' - immediate login (character marked as 'logged in' as
# soon as the connection is established)
$self->doLogin();
} else {
# Set the time at which $self->spinMaintainLoop should show a warning that the character
lib/Games/Axmud/Session.pm view on Meta::CPAN
$self->ivPoke('specialEchoMode', 'enabled');
}
# Inform all strip entry objects (GA::Strip::Entry) of the change
$self->updateSpecialEcho();
}
}
# Update the connection info strip object for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
# Update information stored in each 'internal' window's connection info strip,
# if visible
$winObj->setTimeLabel($self->getTimeLabelText());
}
# Set the 'main' window's urgency hint, if allowed
if ($axmud::CLIENT->mainWinUrgencyFlag || $axmud::CLIENT->tempUrgencyFlag) {
# The TRUE argument means only set the hint, if it's not already set
lib/Games/Axmud/Session.pm view on Meta::CPAN
$origToken,
'Internal error creating frame \'' . $ivHash{'name'} . '\'',
2722,
);
return @emptyList;
}
# This call makes the original frame's textview scroll to the bottom, as it's
# supposed to
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->processMxpFrameElement',
);
# Update IVs
$frameObj->ivPoke('tabObj', $tabObj);
$frameObj->ivPoke('paneObj', $tabObj->paneObj);
$frameObj->ivPoke('textViewObj', $tabObj->textViewObj);
}
# Close an existing frame, if specified
lib/Games/Axmud/Session.pm view on Meta::CPAN
$availableWidth = $workspaceObj->currentWidth - $workspaceObj->panelLeftSize
- $workspaceObj->panelRightSize;
$availableHeight = $workspaceObj->currentHeight - $workspaceObj->panelTopSize
- $workspaceObj->panelBottomSize;
# Get size of an 'X' character (because the MXP specification demands it)
($charWidth, $charHeight) = $self->currentTabObj->textViewObj->getCharSize('X');
# $frameObj->left (etc) can be in the form 'n%' (a percentage), 'nc' (a multiple of
# character widths/heights) or 'n' (a value in pixels), relative to the left or top of the
# available desktop
# A minus value, i.e. '-n%', '-nc' or '-n' signifies that the value is relative to the
# right or bottom of the available desktop
# If an invalid value was specified, use a default value
foreach my $iv ('left', 'top', 'width', 'height') {
my ($value, $minus, $num, $type, $newValue);
$value = $frameObj->$iv;
if ($value =~ m/(\-)?(\d+)([\%c]?)/) {
$minus = $1;
lib/Games/Axmud/Session.pm view on Meta::CPAN
$newValue = int($availableWidth / 2);
} else {
$newValue = int($availableHeight / 2);
}
}
push (@returnList, $newValue);
}
# Sanity checking, for the benefit of an MXP frame tag which tries to draw a window outside
# the bounds of the desktop
# Left
if ($returnList[0] < 0) {
$returnList[0] = 0;
}
# Top
if ($returnList[1] < 0) {
lib/Games/Axmud/Session.pm view on Meta::CPAN
if ($axmud::CLIENT->autoSaveFlag && $self->autoSaveCheckTime) {
# Perform the auto-save
$self->pseudoCmd('save');
$self->ivPoke('autoSaveLastTime', $self->sessionTime);
# Set the time at which the next auto-save will occur
$self->resetAutoSave();
}
# Update the connection info strip object for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
$winObj->setHostLabel(
$self->getHostLabelText(),
'MXP crosslinking operation in progress...',
);
}
# Terminate the current connection
$self->doTempDisconnect();
$self->ivPoke('mxpRelocateMode', 'started');
# Make sure all changes are visible immediately
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->dispatchCmd');
# Intitiate the new connection
if (! $self->doConnect($self->mxpRelocateHost, $self->mxpRelocatePort, $self->protocol)) {
# Reconnection failed
$self->doDisconnect();
} else {
$self->ivPoke('mxpRelocateMode', 'wait_login');
lib/Games/Axmud/Session.pm view on Meta::CPAN
my @list;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->updateEcho', @_);
}
# Generate a list of this session's entry strip objects (the TRUE argument means 'only
# return 'internal' windows')
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if (
$stripObj
&& $stripObj->winObj->visibleSession
&& $stripObj->winObj->visibleSession eq $self
) {
push (@list, $stripObj);
}
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->updateSpecialEcho', @_);
}
# (The TRUE argument means 'only return 'internal' windows)
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj) {
# Make sure the entry box is unobscured (assuming this session is the visible one,
# and that the world has actually turned on echo mode)
# visible one)
if (
$stripObj->winObj->visibleSession
&& $stripObj->winObj->visibleSession eq $self
lib/Games/Axmud/Session.pm view on Meta::CPAN
);
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->textViewKeysUpdate', @_);
}
# Generate a list of this session's entry strip objects (the TRUE argument means 'only
# return 'internal' windows')
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if (
$stripObj
&& $stripObj->winObj->visibleSession
&& $stripObj->winObj->visibleSession eq $self
) {
push (@list, $stripObj);
}
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
# Call the corresponding command object's ->do function to execute the command
$result = $cmdObj->do($self, $inputString, $userCmd, @inputWord);
if (! $result) {
return undef;
} else {
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# If the user typed a command like ';north portal' which was translated into
# ';allocateexit north portal', execute the corresponding world command
if ($worldCmd) {
$self->worldCmd($worldCmd);
}
return 1;
lib/Games/Axmud/Session.pm view on Meta::CPAN
$self->turnOnBlinker(2);
}
$self->ivIncrement('excessCmdCount');
# Fire any hooks that are using the 'send_cmd' hook event
$self->checkHooks('send_cmd', $cmd);
}
# Update the connection info strip object for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
# Update information stored in each 'internal' window's connection info strip, if
# visible
$winObj->setTimeLabel($self->getTimeLabelText());
}
# Convert text to speech, if required
if ($axmud::CLIENT->systemAllowTTSFlag && $axmud::CLIENT->ttsWorldCmdFlag) {
# Make sure the received text is visible in the 'main' window...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->dispatchCmd');
# ...before converting text to speech
if (
$axmud::CLIENT->ttsVerboseFlag
&& defined $self->session->ttsLastType
&& $self->session->ttsLastType ne 'command'
) {
# Last TTS conversion was something other than a world command
$axmud::CLIENT->tts('Sent: ' . $cmd, 'command', 'command', $self);
lib/Games/Axmud/Session.pm view on Meta::CPAN
}
}
# (Reset this IV in either case)
$self->ivUndef('promptCheckTime');
# Turn on the window blinker, and update IVs
$self->turnOnBlinker(2);
# Update the connection info strip object for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
# Update information stored in each 'internal' window's connection info strip, if
# visible
$winObj->setTimeLabel($self->getTimeLabelText());
}
# Convert text to speech, if required
if ($axmud::CLIENT->systemAllowTTSFlag && $axmud::CLIENT->ttsWorldCmdFlag) {
# Make sure the received text is visible in the 'main' window...
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->dispatchPassword');
# ...before converting text to speech
$axmud::CLIENT->tts('Sent password', 'command', 'command', $self);
}
return 1;
}
sub checkRedirect {
# Called by $self->worldCmd to see whether a command should be processed in redirect mode.
lib/Games/Axmud/Session.pm view on Meta::CPAN
$blessed = $axmud::CLIENT;
$ivName = $clientHash{$string};
$var = $axmud::CLIENT->{$ivName};
$privFlag = TRUE;
} else {
$error = $genError;
}
} elsif ($first eq 'desktop') {
# S desktop.panel.left
# S desktop.panel.right
# S desktop.panel.top
# S desktop.panel.bottom
# S desktop.controls.left
# S desktop.controls.right
# S desktop.controls.top
# S desktop.controls.bottom
if (
$size != 3
|| ($second ne 'panel' && $second ne 'controls')
|| ($third ne 'left' && $third ne 'right' && $third ne 'top' && $third ne 'bottom')
) {
$error = $genError;
} else {
$blessed = $axmud::CLIENT;
lib/Games/Axmud/Session.pm view on Meta::CPAN
$var = $axmud::CLIENT->{$ivName};
$privFlag = TRUE;
# O window.grid.NUMBER
} elsif ($second eq 'grid') {
if ($size < 3 || $size > 4) {
$error = $genError;
} elsif (! $axmud::CLIENT->desktopObj->ivExists('gridWinHash', $third)) {
if ($size == 3) {
$error = '\'Grid\' window \'' . $string . '\' doesn\'t exist';
} else {
$error = '\'Grid\' window \'' . $obj . '\' doesn\'t exist';
}
} else {
$blessed = $axmud::CLIENT->desktopObj->ivShow('gridWinHash', $third);
$privFlag = $blessed->_privFlag;
if (defined $fourth) {
$var = $blessed->{$last};
$ivName = $last;
} else {
$objFlag = TRUE;
}
}
# O window.free.NUMBER
} elsif ($second eq 'free') {
if ($size < 3 || $size > 4) {
$error = $genError;
} elsif (! $axmud::CLIENT->desktopObj->ivExists('freeWinHash', $third)) {
if ($size == 3) {
$error = '\'Free\' window \'' . $string . '\' doesn\'t exist';
} else {
$error = '\'Free\' window \'' . $obj . '\' doesn\'t exist';
}
} else {
$blessed = $axmud::CLIENT->desktopObj->ivShow('freeWinHash', $third);
$privFlag = $blessed->_privFlag;
if (defined $fourth) {
$var = $blessed->{$last};
$ivName = $last;
} else {
$objFlag = TRUE;
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
$privFlag = TRUE;
}
# O workspace.obj.NUMBER
} elsif ($second eq 'obj') {
if ($size < 3 || $size > 4) {
$error = $genError;
} elsif (! $axmud::CLIENT->desktopObj->ivExists('workspaceHash', $third)) {
if ($size == 3) {
$error = 'Workspace object \'' . $string . '\' doesn\'t exist';
} else {
$error = 'Workspace object \'' . $obj . '\' doesn\'t exist';
}
} else {
$blessed = $axmud::CLIENT->desktopObj->ivShow('workspaceHash', $third);
$privFlag = $blessed->_privFlag;
if (defined $fourth) {
$var = $blessed->{$last};
$ivName = $last;
} else {
$objFlag = TRUE;
}
}
# O workspace.grid.NUMBER
} elsif ($second eq 'grid') {
if ($size < 3 || $size > 4) {
$error = $genError;
} elsif (! $axmud::CLIENT->desktopObj->ivExists('gridHash', $third)) {
if ($size == 3) {
$error = 'Workspace grid \'' . $string . '\' doesn\'t exist';
} else {
$error = 'Workspace grid \'' . $obj . '\' doesn\'t exist';
}
} else {
$blessed = $axmud::CLIENT->desktopObj->ivShow('gridHash', $third);
$privFlag = $blessed->_privFlag;
if (defined $fourth) {
$var = $blessed->{$last};
$ivName = $last;
} else {
$objFlag = TRUE;
}
lib/Games/Axmud/Session.pm view on Meta::CPAN
} else {
$self->ivPoke('systemMsgTempMode', $type);
}
$self->ivPoke(
'systemMsgCheckTime',
($self->sessionTime + $self->systemMsgWaitTime),
);
# Update strip objects for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj) {
$stripObj->updateConsoleButton($self->systemMsgMode, $self->systemMsgTempMode);
}
}
}
return 1;
lib/Games/Axmud/Session.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->reset_systemMsg', @_);
}
$self->ivEmpty('systemMsgList');
$self->ivPoke('systemMsgMode', 'empty');
$self->ivPoke('systemMsgTempMode', 'empty');
$self->ivUndef('systemMsgCheckTime');
# Update strip objects for any 'internal' windows used by this session
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($self, TRUE)) {
my $stripObj = $winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj) {
$stripObj->updateConsoleButton('empty');
}
}
return 1;
}
lib/Games/Axmud/Strip.pm view on Meta::CPAN
$subMenu = $self->addPluginWidgets($pluginObj->name);
if ($funcRef && $subMenu) {
&$funcRef($self, $subMenu);
}
}
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
return 1;
}
sub objDestroy {
# Called by GA::Win::Internal->removeStripObj, just before the strip is removed from its
# parent window, and also by ->winDestroy and ->resetWinmap, to give this object a chance
# to do any necessary tidying up
#
lib/Games/Axmud/Strip.pm view on Meta::CPAN
$allSessionSwitch = '';
$self->ivPoke('saveAllSessionsFlag', FALSE);
} else {
$allSessionSwitch = ' -a';
$self->ivPoke('saveAllSessionsFlag', TRUE);
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
});
$subMenu_saveOptions->append($menuColumn_allSession_radio1);
my $menuColumn_allSession_radio2 = Gtk3::RadioMenuItem->new_with_mnemonic(
$menuColumn_allSession_radio1->get_group(),
'Save in _all sessions',
);
$subMenu_saveOptions->append($menuColumn_allSession_radio2);
$subMenu_saveOptions->append(Gtk3::SeparatorMenuItem->new()); # Separator
lib/Games/Axmud/Strip.pm view on Meta::CPAN
if ($winObj) {
# Only one About window can be open at a time
$axmud::CLIENT->set_aboutWin($winObj);
}
}
}
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
});
$iconName = 'icon_' . $buttonObj->name;
if ($buttonObj->requireConnectFlag) {
# (Button requires a connection to a world, even if it's in 'offline' mode)
$self->ivAdd('requireConnectHash', $iconName, $toolButton_item);
} elsif ($buttonObj->requireSessionFlag) {
lib/Games/Axmud/Strip.pm view on Meta::CPAN
push (@widgetList, $toolButton_item);
}
}
$self->toolbar->show_all();
# Store the list of buttons and separators
$self->ivPoke('toolbarWidgetList', @widgetList);
# Sensitise/desensitise menu bar/toolbar items, depending on current conditions
$axmud::CLIENT->desktopObj->restrictWidgets();
# Setup complete
return 1;
}
sub resetToolbar {
# Called by GA::PrefWin::Client->toolbarTab to re-draw the list of toolbar buttons, after
# the GA::Client->toolbarHash and ->toolbarList have been modified
#
lib/Games/Axmud/Strip.pm view on Meta::CPAN
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->resetToolbar', @_);
}
# Remove the existing buttons and separators
foreach my $widget ($self->toolbarWidgetList) {
$axmud::CLIENT->desktopObj->removeWidget($self->toolbar, $widget);
}
# Draw a new set of buttons and separators
$self->fillToolbar();
return 1;
}
sub sensitiseWidgets {
lib/Games/Axmud/Strip.pm view on Meta::CPAN
'Specified table object doesn\'t exist (or no longer exists)',
$self->_objClass . '->removeTableObj',
)
}
return undef;
}
# Remove the table object
$axmud::CLIENT->desktopObj->removeWidget($self->table, $tableObj->packingBox);
# Update IVs
$self->ivDelete('tableObjHash', $tableObj->number);
$self->ivDelete('tablezoneHash', $tableObj->zoneObj->number);
# Notify all of this window's strip objects of the table object's demise
foreach my $stripObj (
sort {$a->number <=> $b->number} ($self->winObj->ivValues('stripHash'))
) {
$stripObj->notify_removeTableObj($tableObj);
lib/Games/Axmud/Strip.pm view on Meta::CPAN
} else {
$self->ivAdd('tablezoneHash', $zoneObj->number, $zoneObj);
$self->ivIncrement('tablezoneCount');
$tableObj->set_zoneObj($zoneObj);
}
# Resize the table object
$axmud::CLIENT->desktopObj->removeWidget($self->table, $tableObj->packingBox);
$self->table->attach(
$tableObj->packingBox,
$zoneObj->left,
$zoneObj->top,
# Axmud uses 59,59, but Gtk expects 60,60
($zoneObj->right - $zoneObj->left + 1),
($zoneObj->bottom - $zoneObj->top + 1),
);
lib/Games/Axmud/Strip.pm view on Meta::CPAN
# This function is being called for the first time
$packingBox = Gtk3::VBox->new(FALSE, 0);
$packingBox->set_border_width(0);
} else {
# This function is being called for a subsequent time. Remove its current contents, so
# new widgets can be created
$packingBox = $self->packingBox;
$axmud::CLIENT->desktopObj->removeWidget($packingBox, $self->frame);
}
# Different sessions might be using different numbers of gauge levels. Find the highest
# number of gauge levels used by the greediest session (might be 0, if there are no gauge
# levels at the moment)
$levelCount = 0;
foreach my $gaugeLevelObj ($self->ivValues('gaugeLevelHash')) {
my $num = $gaugeLevelObj->session->number;
lib/Games/Axmud/Strip.pm view on Meta::CPAN
my ($widget, $hashRef) = @_;
$self->ivPoke('canvasFrameWidth', $$hashRef{width});
$self->ivPoke('canvasFrameHeight', $$hashRef{height});
if ($self->canvas) {
$self->updateGauges();
# The resized canvas won't be visible until a Gtk main loop occurs
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->drawGaugeBox');
}
});
# Add a drawing canvas, inside the frame
my $canvas = GooCanvas2::Canvas->new();
$frame->add($canvas);
# Update IVs
$self->ivPoke('packingBox', $packingBox);
$self->ivPoke('frame', $frame);
lib/Games/Axmud/Strip.pm view on Meta::CPAN
if ($self->postEntry) {
$postText = $self->postEntry->get_text();
}
# Remove the packing box's current contents, so new widgets can be created
$packingBox = $self->packingBox;
foreach my $child ($self->packingBox->get_children()) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $child);
}
}
# Draw a Gtk3::Entry box (compulsory) and any buttons specified by $self->initHash
# (->signal_connects for each appear later in the function)
# Draw a 'wipe entry' icon as a toolbutton (optional)
my $wipeButton;
if ($self->ivShow('initHash', 'wipe_flag') && ! $axmud::BLIND_MODE_FLAG) {
lib/Games/Axmud/Strip.pm view on Meta::CPAN
if ($self->entry) {
if (! $axmud::CLIENT->sessionHash) {
# If there are no sessions at all, the main entry box must be empty, and the
# minor entry boxes must be removed entirely
$self->entry->set_text('');
if ($self->preEntry) {
$axmud::CLIENT->desktopObj->removeWidget(
$self->packingBox,
$self->preEntry,
);
$self->ivUndef('preEntry');
}
if ($self->postEntry) {
$axmud::CLIENT->desktopObj->removeWidget(
$self->packingBox,
$self->postEntry,
);
$self->ivUndef('postEntry');
}
}
}
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
# 1 otherwise
my ($self, $widget, $check) = @_;
# Check for improper arguments
if (! defined $widget || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->remove', @_);
}
return $axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $widget);
}
sub empty {
# Can be called by anything to remove all widgets from the main container widget
#
# Expected arguments
# (none besides $self)
#
# Return values
lib/Games/Axmud/Table.pm view on Meta::CPAN
# 1 otherwise
my ($self, $widget, $check) = @_;
# Check for improper arguments
if (! defined $widget || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->remove', @_);
}
return $axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $widget);
}
sub empty {
# Can be called by anything to remove all widgets from the mini-table
#
# Expected arguments
# (none besides $self)
#
# Return values
lib/Games/Axmud/Table.pm view on Meta::CPAN
$textView->set_editable(TRUE);
$textView->set_cursor_visible(TRUE);
$textView->set_can_focus(TRUE);
}
$textView->set_wrap_mode('word-char'); # Wrap words if possible, characters if not
$textView->set_justification('left');
if ($systemFlag && $axmud::CLIENT->ivExists('colourSchemeHash', $colourScheme)) {
$axmud::CLIENT->desktopObj->setTextViewStyle($colourScheme, $textView);
} else {
$axmud::CLIENT->desktopObj->setTextViewStyle($self->winObj->winType, $textView);
}
$buffer->set_text($text);
# Set expansion
$textView->set_hexpand($hExpandFlag);
$textView->set_vexpand($vExpandFlag);
# Update IVs
$self->ivPoke('funcRef', $funcRef);
lib/Games/Axmud/Table.pm view on Meta::CPAN
my $currentFuncRef = $self->funcRef;
if ($currentFuncRef) {
&$currentFuncRef(
$self,
$self->textView,
$self->buffer,
$self->funcID,
$axmud::CLIENT->desktopObj->bufferGetText($self->buffer),
);
}
});
return 1;
}
# Other functions
##################
lib/Games/Axmud/Table.pm view on Meta::CPAN
sub get_text {
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->get_text', @_);
}
return $axmud::CLIENT->desktopObj->bufferGetText($self->buffer);
}
##################
# Accessors - get
sub frame
{ $_[0]->{frame} }
sub scroll
{ $_[0]->{scroll} }
sub textView
lib/Games/Axmud/Table.pm view on Meta::CPAN
# If there is already a simple tab, don't create another one
} elsif ($self->tabObjHash) {
return $self->writeError(
'Tried to add a simple tab, but one or more tabs already exist',
$self->_objClass . '->addSimpleTab',
);
}
# Create a new GA::Obj::Textview object to handle the Gtk3::Textview(s)
$textViewObj = $axmud::CLIENT->desktopObj->add_textView(
$session,
$self->winObj,
$self,
);
if (! $textViewObj) {
return undef;
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
if ($self->canCloseFlag) {
$button = Gtk3::Button->new();
$hBox->pack_start($button, FALSE, FALSE, 0);
$button->set_image(Gtk3::Image->new_from_stock('gtk-close', 'menu'));
$button->set_relief('none');
$button->show();
}
# Create a new GA::Obj::Textview object to handle the Gtk3::Textview(s)
$textViewObj = $axmud::CLIENT->desktopObj->add_textView(
$session,
$self->winObj,
$self,
);
if (! $textViewObj) {
return undef;
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
if (! $oldBuffer) {
$self->notebook->set_current_page($tabNum);
}
# After replacing a standalone textview object with a Gtk3::Notebook, the original session's
# textview(s) don't scroll to the bottom (as it should) without this code (and placing the
# code anywhere else doesn't work, either)
if ($oldBuffer) {
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addTab');
}
# Set up ->signal_connects for the close button, if it was created
if ($button) {
if (! $defaultFlag) {
$self->setButtonClicked($button, $tabObj);
} else {
$self->setButtonClicked($button, $tabObj, $session);
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
# A simple tab, containing a standalone textview object
$tabObj = $self->ivShow('tabObjHash', 0);
if (! $tabObj || ! $tabObj->defaultFlag || $tabObj->session ne $session) {
# (Error message displayed by calling function)
return undef;
}
# Remove the simple tab by removing everything from the main packing box
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $tabObj->packedObj);
# Inform the textview object (if any) of its demise
if ($tabObj->textViewObj) {
$tabObj->textViewObj->objDestroy();
}
# Update IVs
$self->ivEmpty('tabObjHash');
$self->ivPoke('tabObjCount', 0);
lib/Games/Axmud/Table.pm view on Meta::CPAN
if (! $self->convertTab()) {
# (Error message already displayed)
return undef;
}
# If there are no tabs left, remove the notebook itself, so the next tab to be added can
# be a simple or normal tab
} elsif (! $count) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $self->notebook);
$self->ivUndef('notebook');
}
}
# If there are no tabs left, the calling code can create a simple tab or a normal tab
if (! $self->tabObjHash) {
$self->ivPoke('simpleTabFlag', FALSE);
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
return undef;
}
# Remove the tab
if (! $self->notebook) {
# A simple tab, containing a standalone textview object
# Remove the simple tab by removing everything from the main packing box
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $tabObj->packedObj);
# Inform the textview object (if any) of its demise
if ($tabObj->textViewObj) {
$tabObj->textViewObj->objDestroy();
}
# Update IVs
$self->ivEmpty('tabObjHash');
$self->ivPoke('tabObjCount', 0);
lib/Games/Axmud/Table.pm view on Meta::CPAN
if (! $self->convertTab()) {
# (Error message already displayed)
return undef;
}
# If there are no tabs left, remove the notebook itself, so the next tab to be added can
# be a simple or normal tab
} elsif (! $count) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $self->notebook);
$self->ivUndef('notebook');
}
}
# If there are no tabs left, the calling code can create a simple tab or a normal tab
if (! $self->tabObjHash) {
$self->ivPoke('simpleTabFlag', FALSE);
}
lib/Games/Axmud/Table.pm view on Meta::CPAN
}
# Set a flag that various ->signal_connects can use to avoid responding when a tab
# conversion operation is in progress
$self->ivPoke('tabConvertFlag', TRUE);
# Get the single existing tab
$oldTabObj = $self->ivShow('tabObjHash', 0);
# Remove the standalone textview object
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox2, $oldTabObj->packedObj);
# Add a Gtk3::Notebook in its place
$notebook = $self->drawNotebook();
if (! $notebook) {
# Emergency fallback - put the old textview back, as if nothing had happened (but show a
# warning)
$self->packingBox2->pack_start($oldTabObj->packedObj, TRUE, TRUE, 0);
return $self->writeWarning(
lib/Games/Axmud/Table.pm view on Meta::CPAN
($oldTabObj) = $self->ivValues('tabObjHash');
if (! $oldTabObj) {
return $self->writeWarning(
'General error converting tab',
$self->_objClass . '->convertTab',
);
}
# 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) {
lib/Games/Axmud/Table.pm view on Meta::CPAN
|| $tabObj->textViewObj->splitScreenMode eq 'hidden'
) {
$packedObj = $tabObj->textViewObj->setSplitScreenMode('split');
} else {
$packedObj = $tabObj->textViewObj->setSplitScreenMode('hidden');
}
# If $packedObj is defined, it must be re-packed, replacing the old packable widget
if ($packedObj) {
$axmud::CLIENT->desktopObj->removeWidget($tabObj->packableObj, $tabObj->packedObj);
$tabObj->packableObj->pack_start($packedObj, TRUE, TRUE, 0);
$tabObj->ivPoke('packedObj', $packedObj);
}
# Find the entry strip object (if it exists)
$entryObj = $self->winObj->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($entryObj) {
# Update the toolbutton icon for its scroll lock button
if ($tabObj->textViewObj->splitScreenMode eq 'split') {
lib/Games/Axmud/Table.pm view on Meta::CPAN
} else {
$entryObj->updateSplitButton(FALSE);
}
}
if ($packedObj) {
# (If we try to scroll the textviews before they've been re-packed, we get an
# uncomfortable flash, so the scrolling function is called last)
$self->winObj->winShowAll($self->_objClass . '->toggleSplitScreen');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->toggleSplitScreen');
$tabObj->textViewObj->scrollToLock();
}
return 1;
}
sub findPage {
# Can be called by anything
# Finds the tab object (GA::Obj::Tab) corresponding to a specified page in the
lib/Games/Axmud/Task.pm view on Meta::CPAN
$modLine,
FALSE, # Don't precede with a newline character
TRUE, # Use final newline character
'attack', # Write to this logfile
);
# Play a sound effect (if allowed)
$axmud::CLIENT->playSound('kill');
# Read a text-to-speech (TTS) message, if required
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->targetKilledSeen');
if ($self->ivShow('ttsFlagAttribHash', 'fight')) {
$self->ttsQuick('Killed ' . $victim);
}
# Send the list of victim commands (if any)
foreach my $cmd ($self->fightCmdList) {
$session->relayCmd($cmd);
}
lib/Games/Axmud/Task.pm view on Meta::CPAN
$modLine,
FALSE, # Don't precede with a newline character
TRUE, # Use final newline character
'attack', # Write to this logfile
);
# Play a sound effect (if allowed)
$axmud::CLIENT->playSound('notify');
# Read a text-to-speech (TTS) message, if required
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->interactionSuccessSeen');
if (
$self->ivShow('ttsFlagAttribHash', 'interact')
|| $self->ivShow('ttsFlagAttribHash', 'interaction')
) {
$self->ttsQuick('Successful interaction with ' . $victim);
}
# Send the list of victim commands (if any)
foreach my $cmd ($self->interactCmdList) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
$modLine,
FALSE, # Don't precede with a newline character
TRUE, # Use final newline character
'attack', # Write to this logfile
);
# Play a sound effect (if allowed)
$axmud::CLIENT->playSound('notify');
# Read a text-to-speech (TTS) message, if required
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->interactionFailSeen');
if (
$self->ivShow('ttsFlagAttribHash', 'interact')
|| $self->ivShow('ttsFlagAttribHash', 'interaction')
) {
$self->ttsQuick('Failed interaction with ' . $victim);
}
# Send the list of victim commands (if any)
foreach my $cmd ($self->interactCmdList) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
$modLine,
FALSE, # Don't precede with a newline character
TRUE, # Use final newline character
'attack', # Write to this logfile
);
# Play a sound effect (if allowed)
$axmud::CLIENT->playSound('notify');
# Read a text-to-speech (TTS) message, if required
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->interactionFightSeen');
if (
$self->ivShow('ttsFlagAttribHash', 'interact')
|| $self->ivShow('ttsFlagAttribHash', 'interaction')
) {
$self->ttsQuick('Interaction with ' . $victim . ' has become a fight');
}
# Send the list of victim commands (if any)
foreach my $cmd ($self->interactCmdList) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
$modLine,
FALSE, # Don't precede with a newline character
TRUE, # Use final newline character
'attack', # Write to this logfile
);
# Play a sound effect (if allowed)
$axmud::CLIENT->playSound('notify');
# Read a text-to-speech (TTS) message, if required
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->interactionDisasterSeen');
if (
$self->ivShow('ttsFlagAttribHash', 'interact')
|| $self->ivShow('ttsFlagAttribHash', 'interaction')
) {
$self->ttsQuick('Disastrous interaction with ' . $victim);
}
# Send the list of victim commands (if any)
foreach my $cmd ($self->interactCmdList) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
# Flags which, if set to TRUE, cause the automapper object's current room to be displayed
# when a tell, social or custom alert occurs. (If the automapper's current room isn't set,
# nothing extra is displayed)
$self->{tellRoomFlag} = FALSE;
$self->{socialRoomFlag} = FALSE;
$self->{customRoomFlag} = FALSE;
$self->{warningRoomFlag} = FALSE;
$self->{otherRoomFlag} = FALSE;
# Flags which, if set to TRUE, cause the task window's urgency hint to be set when text is
# diverted (might not work in all desktop environments)
$self->{tellUrgencyFlag} = FALSE;
$self->{socialUrgencyFlag} = FALSE;
$self->{customUrgencyFlag} = FALSE;
$self->{warningUrgencyFlag} = FALSE;
$self->{otherUrgencyFlag} = FALSE;
# When diverted text is received, the time (matching GA::Session->sessionTime) at which the
# alert background colour should be replaced by the default background colour . Usually
# set to 'undef', which means the default background colour is visible
$self->{resetTime} = undef;
lib/Games/Axmud/Task.pm view on Meta::CPAN
$emptyCol,
$labelCol,
TRUE,
);
if ($gaugeObj) {
$self->ivAdd('gaugeHash', $number, $gaugeObj);
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addMainWinGauge');
return 1;
}
sub deleteMainWinGauge {
# Called by LA::Statement::delgauge->implement
# Deletes a 'main' window gauge, removing the gauge level if there are no gauges/status bars
# left for this task
#
lib/Games/Axmud/Task.pm view on Meta::CPAN
undef,
$addFlag,
$label,
);
if ($gaugeObj) {
$self->ivAdd('statusBarHash', $number, $gaugeObj);
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addMainWinStatusBar');
return 1;
}
sub deleteMainWinStatusBar {
# Called by LA::Statement::delstatus->implement
# Deletes a 'main' window status bar, removing the gauge level if there are no gauges/status
# bars left for this task
#
lib/Games/Axmud/Task.pm view on Meta::CPAN
$emptyCol,
$labelCol,
TRUE,
);
if ($gaugeObj) {
$self->ivAdd('taskWinGaugeHash', $number, $gaugeObj);
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addTaskWinGauge');
return 1;
}
sub deleteTaskWinGauge {
# Called by LA::Statement::windelgauge->implement
# Deletes a task window gauge, removing the gauge level if there are no gauges/status bars
# left for this task
#
lib/Games/Axmud/Task.pm view on Meta::CPAN
undef,
$addFlag,
$label,
);
if ($gaugeObj) {
$self->ivAdd('taskWinStatusBarHash', $number, $gaugeObj);
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addTaskWinStatusBar');
return 1;
}
sub deleteTaskWinStatusBar {
# Called by LA::Statement::windelstatus->implement
# Deletes a task window status bar, removing the gauge level if there are no gauges/status
# bars left for this task
#
lib/Games/Axmud/Win/External.pm view on Meta::CPAN
$winObj->winDestroy();
}
# Inform the parent workspace grid object (if any)
if ($self->workspaceGridObj) {
$self->workspaceGridObj->del_gridWin($self);
}
# Inform the desktop object
$axmud::CLIENT->desktopObj->del_gridWin($self);
# Look for other 'grid' windows (besides this one) handling the same 'external' window. If
# there are none, it's safe to minimise the 'external' window
if (defined $self->internalID) {
OUTER: foreach my $winObj ($axmud::CLIENT->desktopObj->ivValues('gridWinHash')) {
if (
$winObj->winType eq 'external'
&& $self->internalID
&& $winObj->internalID
&& $self->internalID eq $winObj->internalID
) {
$flag = TRUE;
last OUTER;
}
lib/Games/Axmud/Win/External.pm view on Meta::CPAN
$winObj->winDestroy();
}
# Inform the parent workspace grid object (if any)
if ($self->workspaceGridObj) {
$self->workspaceGridObj->del_gridWin($self);
}
# Inform the desktop object
$axmud::CLIENT->desktopObj->del_gridWin($self);
# Inform the ->owner, if there is one
if ($self->owner) {
$self->owner->del_winObj($self);
}
# Operation complete
$self->ivUndef('internalID');
lib/Games/Axmud/Win/External.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->minimise', @_);
}
if (! $self->internalID) {
return undef;
} else {
# Unmaximise the window
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-r',
$self->internalID,
'-i',
'-b',
'remove,maximised_vert,maximised_horz',
);
# Then minimise it
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-r',
$self->internalID,
'-i',
'-b',
'add,hidden',
);
return 1
}
}
lib/Games/Axmud/Win/External.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->unminimise', @_);
}
if (! $self->internalID) {
return undef;
} else {
# Unminimise the window
$axmud::CLIENT->desktopObj->wmCtrlObj->wmctrl(
'-r',
$self->internalID,
'-i',
'-b',
'remove,hidden',
);
return 1;
}
}
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
if ($self->winType eq 'main') {
$winWidget->set_default_size(
$axmud::CLIENT->customMainWinWidth,
$axmud::CLIENT->customMainWinHeight,
);
$winWidget->set_border_width($axmud::CLIENT->constMainBorderPixels);
# When workspace grids are disabled, 'main' windows should appear in the middle of the
# desktop
if (! $self->workspaceObj->gridEnableFlag) {
$winWidget->set_position('center');
}
} else {
$winWidget->set_default_size(
$axmud::CLIENT->customGridWinWidth,
$axmud::CLIENT->customGridWinHeight,
);
$winWidget->set_border_width($axmud::CLIENT->constGridBorderPixels);
}
# Set the icon list for this window
$iv = $self->winType . 'WinIconList';
$winWidget->set_icon_list($axmud::CLIENT->desktopObj->{$iv});
# Draw the widgets used by this window
if (! $self->drawWidgets()) {
return undef;
}
# The calling function can now move the window into position, before calling
# $self->winEnable to make it visible, and to set up any more ->signal_connects()
return 1;
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# 1 on success
my ($self, $listRef, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# # For windows about to be placed on a grid, briefly minimise the window so it doesn't
# # appear in the centre of the desktop before being moved to its correct workspace, size
# # and position
# if ($self->workspaceGridObj && $self->winWidget eq $self->winBox) {
#
# $self->minimise();
# }
# Set up ->signal_connects that must not be set up until the window is visible
$self->setConfigureEvent(); # 'configure-event'
$self->setWindowStateEvent(); # 'window-state-event'
$self->setFocusInEvent(); # 'focus-in-event'
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
}
}
return 1;
}
sub winDestroy {
# Called by GA::Obj::WorkspaceGrid->stop or by any other function
# Informs the window's strip objects of their imminent demise, informs the parent workspace
# grid (if this 'grid' window is on a workspace grid) and the desktop object, and then
# destroys the Gtk3::Window (if it is open)
#
# Expected arguments
# (none besides $self)
#
# Return values
# 'undef' on improper arguments, if the window can't be destroyed or if it has already
# been destroyed
# 1 on success
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$winObj->winDestroy();
}
# Inform the parent workspace grid object (if any)
if ($self->workspaceGridObj) {
$self->workspaceGridObj->del_gridWin($self);
}
# Inform the desktop object
$axmud::CLIENT->desktopObj->del_gridWin($self);
# Destroy the Gtk3::Window
eval { $self->winBox->destroy(); };
if ($@) {
# Window can't be destroyed
return undef;
} else {
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$self->restrictMenuBars();
$self->restrictToolbars();
# Any Gtk3::TextViews will now be using the colours of the most recently-created
# Gtk3::TextView, not the colours that we want them to use. Update colours for all pane
# objects (GA::Table::Pane) before the forthcoming call to ->winShowAll
$self->updateColourScheme(undef, TRUE);
# Make everything visible
$self->winShowAll($self->_objClass . '->redrawWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->redrawWidgets');
# Adding/removing widgets upsets the position of the scrollbar in each tab's textview.
# Make sure all the textviews are scrolled to the bottom
$self->rescrollTextViews();
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->redrawWidgets');
}
return 1;
}
# ->signal_connects
sub setDeleteEvent {
# Called by $self->winSetup
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$winObj->winDestroy();
}
# Inform the parent workspace grid object (if any)
if ($self->workspaceGridObj) {
$self->workspaceGridObj->del_gridWin($self);
}
# Inform the desktop object
$axmud::CLIENT->desktopObj->del_gridWin($self);
# Halt the client
$axmud::CLIENT->stop();
# Allow Gtk3 to close the window directly
return undef;
});
} else {
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
! defined $self->actualWinWidth # Windows size checked for the first time
|| $event->width != $self->actualWinWidth
|| $event->height != $self->actualWinHeight
) {
$self->ivPoke('actualWinWidth', $event->width);
$self->ivPoke('actualWinHeight', $event->height);
}
# Every textview object (GA::Obj::TextView) in this window must update its size IVs,
# which informs the GA::Session (so it can send NAWS data to the world)
foreach my $textViewObj ($axmud::CLIENT->desktopObj->ivValues('textViewHash')) {
if ($textViewObj->winObj eq $self) {
# Update the IVs once the changes have been rendered
$textViewObj->set_sizeUpdateFlag();
}
}
# Let the GA::Client store the most recent size and position for a window of this
# ->winName, if it needs to
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
}
# After drawing gauges or unmaximising the window, the focus is lost from the command entry
# box, so restore it
$stripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::Entry');
if ($stripObj && $stripObj->entry) {
$stripObj->entry->grab_focus();
}
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->rescrollTextViews');
return 1;
}
sub findTableObj {
# Can be called by anything
# Finds the first table object of a particular type created in the compulsory table strip
# object, if there is one
#
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$otherSession->set_instructBufferPosn();
$otherSession->set_cmdBufferPosn();
}
# No visible session
if (! $session) {
# Update certain strip objects in any 'internal' window used by the old visible session
# (if any; the TRUE flag means 'return 'internal' windows only)
foreach my $winObj (
$axmud::CLIENT->desktopObj->listSessionGridWins($self->visibleSession, TRUE)
) {
# Update information stored in the window's connection info strip, if visible
$winObj->setHostLabel('');
$winObj->setTimeLabel('');
# Reset the window's entry box and blinkers, if visible
$winObj->resetEntry();
$winObj->resetBlinkers();
}
# Update the GA::Client's IVs
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
} else {
# If this window is a 'main' window shared by all sessions...
if (
$axmud::CLIENT->shareMainWinFlag
&& $self->visibleSession
&& $self->visibleSession ne $session
) {
# ...need to hide windows on the former visible session's workspace grids (though
# obviously not the shared 'main' window)
$axmud::CLIENT->desktopObj->hideGridWins($self->visibleSession);
# The new visible session's windows, on the other hand, need to be un-hidden
$axmud::CLIENT->desktopObj->revealGridWins($session);
# Fire any hooks that are using the 'not_visible' hook event
$self->visibleSession->checkHooks('not_visible', $session->number);
}
# Update the GA::Client's IVs
# ->currentSession is modified only when a 'main' window that's in focus changes its
# ->visibleSession (exception - if the IV isn't set at all, set it regardless of
# whether this window has the focus, or not)
if (! $axmud::CLIENT->currentSession || $self->focusFlag) {
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# received from the world but hadn't been viewed by the user yet, reset the flag to
# show that the text is now visible to the user
$session->reset_showNewTextFlag();
# Update information stored in the 'main' window's connection info strip, if visible
$self->setHostLabel($session->getHostLabelText());
$self->setTimeLabel($session->getTimeLabelText());
# Update certain strip objects in any 'internal' window used by the new visible session
# (if any; the TRUE flag means 'return 'internal' windows only)
foreach my $winObj ($axmud::CLIENT->desktopObj->listSessionGridWins($session, TRUE)) {
# Reset the 'internal' window's entry box and blinkers, if any
$winObj->resetEntry();
$winObj->resetBlinkers();
}
# Fire any hooks that are using the 'visible_session' hook event
$session->checkHooks('visible_session', undef);
# Fire any hooks that are using the 'change_visible' hook event
foreach my $otherSession ($axmud::CLIENT->listSessions()) {
if ($otherSession ne $session) {
$otherSession->checkHooks('change_visible', $session->number);
}
}
}
# Update all 'internal' windows
foreach my $winObj ($axmud::CLIENT->desktopObj->listGridWins()) {
if (
$winObj->winType eq 'main'
|| $winObj->winType eq 'protocol'
|| $winObj->winType eq 'custom'
) {
# Sensitise/desensitise menu items in 'internal' windows, as appropriate
$winObj->restrictMenuBars();
$winObj->restrictToolbars();
# Update the gauge box, if visible
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$self->visibleSession
&& (
$self->visibleSession->status eq 'connected'
|| $self->visibleSession->status eq 'offline'
)
) {
$openFlag = TRUE;
}
# Test whether the setup wizwin is open (in which case, almost everything is desensitised)
OUTER: foreach my $winObj ($axmud::CLIENT->desktopObj->ivValues('freeWinHash')) {
if ($winObj->isa('Games::Axmud::WizWin::Setup')) {
$setupFlag = TRUE;
# In addition, the following menu items are desensitised
push (@desensitiseList,
# 'World' column
'connect', 'stop_client',
# 'Edit' column
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# Get the strip object
$stripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::Toolbar');
if (! $stripObj) {
# Nothing to sensitise/desensitise
return undef;
}
# Test whether the setup wizwin is open (in which case, everything is desensitised)
OUTER: foreach my $winObj ($axmud::CLIENT->desktopObj->ivValues('freeWinHash')) {
if ($winObj->isa('Games::Axmud::WizWin::Setup')) {
foreach my $widget ($stripObj->toolbarWidgetList) {
$widget->set_sensitive(FALSE);
}
return 1;
}
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
return undef;
}
# Remove all strip objects (table objects in the compulsory Gtk3::Grid are also destroyed)
foreach my $stripObj ($self->ivValues('stripHash')) {
$stripObj->objDestroy();
if ($stripObj->visibleFlag) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $stripObj->packingBox);
}
}
# Remove the Gtk3::HBox or Gtk3::VBox into which everything is packed
$axmud::CLIENT->desktopObj->removeWidget($self->winBox, $self->packingBox);
# Update IVs
$self->ivUndef('packingBox');
$self->ivEmpty('stripHash');
$self->ivEmpty('firstStripHash');
$self->ivPoke('stripCount', 0);
$self->ivEmpty('stripList');
$self->ivUndef('tableStripObj');
$self->ivPoke('winmap', $winmapObj->name);
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$otherStripObj->notify_addStripObj($stripObj);
}
}
# Sensitise/desensitise widgets according to current conditions
$self->restrictMenuBars();
$self->restrictToolbars();
# Make everything visible
$self->winShowAll($self->_objClass . '->addStripObj');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addStripObj');
# Adding/removing widgets upsets the position of the scrollbar in each tab's textview.
# Make sure all the textviews are scrolled to the bottom
$self->rescrollTextViews();
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->addStripObj');
}
return $stripObj;
}
sub removeStripObj {
# Can be called by anything
# Removes a strip object (inheriting from GA::Generic::Strip) from the list of strip objects
# that can be displayed in this window (whether the Gtk widget was actually drawn, or not,
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
if (
$stripObj->_objClass eq 'Games::Axmud::Strip::Table'
|| ! $self->ivExists('stripHash', $stripObj->number)
) {
return undef
}
# Tell the strip object it's about to be removed, so it can do any necessary tidying up
$stripObj->objDestroy();
# Remove the Gtk3 widget that's contains the whole strip
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $stripObj->packingBox);
# Remove the object by updating IVs
$self->ivDelete('stripHash', $stripObj->number);
foreach my $otherObj ($self->stripList) {
if ($otherObj ne $stripObj) {
push (@stripList, $otherObj);
}
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$otherStripObj->notify_removeStripObj($stripObj);
}
}
# Sensitise/desensitise widgets according to current conditions
$self->restrictMenuBars();
$self->restrictToolbars();
# Make everything visible
$self->winShowAll($self->_objClass . '->removeStripObj');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->removeStripObj');
# Hack to resolve a Gtk3 issue, in which a white area appears at the bottom of textviews
# when the gauge strip object is removed (and possibly in similar situations)
foreach my $tableObj ($self->tableStripObj->ivValues('tableObjHash')) {
if ($tableObj->type eq 'pane') {
foreach my $tabObj ($tableObj->ivValues('tabObjHash')) {
$tabObj->textViewObj->insertNewLine();
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# Make sure all the textviews are scrolled to the bottom
$self->rescrollTextViews();
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->removeStripObj');
}
return 1;
}
sub addStrip {
# Convenient shortcut to $self->addStripObj, which expects a package name like
# GA::Strip::GaugeBox as an argument
#
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# exists in the window object's list of strip objects and is actually visible
if (
$stripObj->_objClass eq 'Games::Axmud::Strip::Table'
|| ! $self->ivExists('stripHash', $stripObj->number)
|| ! $stripObj->visibleFlag
) {
return undef
}
# Remove the Gtk3 widget that contains the whole strip
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $stripObj->packingBox);
# Update IVs
$stripObj->set_visibleFlag(FALSE);
# Sensitise/desensitise widgets according to current conditions
$self->restrictMenuBars();
$self->restrictToolbars();
# Make everything visible
$self->winShowAll($self->_objClass . '->hideStripObj');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->hideStripObj');
# Hack to resolve a Gtk3 issue, in which a white area appears at the bottom of textviews
# when the gauge strip object is removed (and possibly in similar situations)
foreach my $tableObj ($self->tableStripObj->ivValues('tableObjHash')) {
if ($tableObj->type eq 'pane') {
foreach my $tabObj ($tableObj->ivValues('tabObjHash')) {
$tabObj->textViewObj->insertNewLine();
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# Make sure all the textviews are scrolled to the bottom
$self->rescrollTextViews();
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->hideStripObj');
}
return 1;
}
sub revealStripObj {
# Can be called by anything
# Reveals a hidden strip object; the strip object was still in the list of strip objects
# this window can display, but the Gtk widget itself was not drawn, so draw it and add it
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
# Update IVs
$stripObj->set_visibleFlag(TRUE);
# Sensitise/desensitise widgets according to current conditions
$self->restrictMenuBars();
$self->restrictToolbars();
# Make everything visible
$self->winShowAll($self->_objClass . '->revealStripObj');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->revealStripObj');
# Adding/removing widgets upsets the position of the scrollbar in each tab's textview.
# Make sure all the textviews are scrolled to the bottom
$self->rescrollTextViews();
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->revealStripObj');
}
return 1;
}
sub replaceStripObj {
# Can be called by anything
# If a strip object has been redrawn for any reason, replace the old Gtk widget with the
# new one. The strip object's ->packingBox IV must already have been set to the new Gtk
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
}
if (! defined $posn) {
# Strip object is missing (for some unlikely reason)
return undef;
}
# Remove the old Gtk3 widget that contains the whole strip
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $stripObj->packingBox);
# Pack the newly-visible strip, leaving a gap if it's not at the beginning or end of the
# list
if (! $count || $posn == ($count - 1)) {
$spacing = 0;
} else {
$spacing = $self->stripSpacingPixels;
}
$self->packingBox->pack_start(
$stripObj->packingBox,
lib/Games/Axmud/Win/Internal.pm view on Meta::CPAN
$self->packingBox->reorder_child($stripObj->packingBox, $posn);
}
# Sensitise/desensitise widgets according to current conditions
$self->restrictMenuBars();
$self->restrictToolbars();
# Make everything visible
$self->winShowAll($self->_objClass . '->replaceStripObj');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->replaceStripObj');
# Redraw any visible gauges, otherwise the gauge box will be visible, but the gauges
# themselves will have disappeared
$gaugeStripObj = $self->ivShow('firstStripHash', 'Games::Axmud::Strip::GaugeBox');
if ($gaugeStripObj && $gaugeStripObj->visibleFlag) {
$gaugeStripObj->updateGauges();
# (Need to call this a second time, or the re-draw doesn't work...)
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->replaceStripObj');
}
return 1;
}
sub getStrip {
# Convenient method for getting the blessed reference of the earliest-created instance of a
# type of strip object
#
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# the call to $self->winEnable() )
$winWidget->set_default_size(
$axmud::CLIENT->customGridWinWidth,
$axmud::CLIENT->customGridWinHeight,
);
$winWidget->set_border_width($axmud::CLIENT->constGridBorderPixels);
# Set the icon list for this window
$iv = $self->winType . 'WinIconList';
$winWidget->set_icon_list($axmud::CLIENT->desktopObj->{$iv});
# Draw the widgets used by this window
if (! $self->drawWidgets()) {
return undef;
}
# The calling function can now move the window into position, before calling
# $self->winEnable to make it visible, and to set up any more ->signal_connects()
return 1;
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# 1 on success
my ($self, $listRef, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->winEnable', @_);
}
# Make the window appear on the desktop
$self->winShowAll($self->_objClass . '->winEnable');
$self->ivPoke('enabledFlag', TRUE);
# For windows about to be placed on a grid, briefly minimise the window so it doesn't
# appear in the centre of the desktop before being moved to its correct workspace, size
# and position
# if ($self->workspaceGridObj && $self->winWidget eq $self->winBox) {
#
# $self->minimise();
# }
# This type of window is unique to its GA::Session (only one can be open at any time, per
# session); inform the session it has opened
$self->session->set_mapWin($self);
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->winDisengage', @_);
}
return $self->winDestroy();
}
sub winDestroy {
# Called by GA::Obj::WorkspaceGrid->stop or by any other function
# Updates the automapper object (GA::Obj::Map), informs the parent workspace grid (if this
# 'grid' window is on a workspace grid) and the desktop object, and then destroys the
# Gtk3::Window (if it is open)
#
# Expected arguments
# (none besides $self)
#
# Return values
# 'undef' on improper arguments, if the window can't be destroyed or if it has already
# been destroyed
# 1 on success
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
$winObj->winDestroy();
}
# Inform the parent workspace grid object (if any)
if ($self->workspaceGridObj) {
$self->workspaceGridObj->del_gridWin($self);
}
# Inform the desktop object
$axmud::CLIENT->desktopObj->del_gridWin($self);
# Destroy the Gtk3::Window
eval { $self->winBox->destroy(); };
if ($@) {
# Window can't be destroyed
return undef;
} else {
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# If the same string appears more than once in @widgetList, we only draw the widget
# once
$widgetHash{$name} = TRUE;
}
}
# Remove the old widgets from the vertical packing box
if ($self->menuBar) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $self->menuBar);
}
foreach my $toolbar ($self->toolbarList) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $toolbar);
}
if ($self->hPaned) {
foreach my $child ($self->hPaned->get_children()) {
$self->hPaned->remove($child);
}
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $self->hPaned);
} else {
if ($self->treeViewScroller) {
$axmud::CLIENT->desktopObj->removeWidget(
$self->packingBox,
$self->treeViewScroller,
);
}
if ($self->canvasFrame) {
$axmud::CLIENT->desktopObj->removeWidget($self->packingBox, $self->canvasFrame);
}
}
# Redraw the menu bar, if specified (and if allowed)
if ($self->worldModelObj->showMenuBarFlag) {
if ($widgetHash{'menu_bar'}) {
$self->resetMenuBarIVs();
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
$self->resetTreeViewIVs();
}
if (! $self->worldModelObj->showCanvasFlag) {
$self->resetCanvasIVs();
}
# Repack complete
$self->winShowAll($self->_objClass . '->redrawWidgets');
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->redrawWidgets');
return 1;
}
# Standard 'map' window object functions
sub winReset {
# Called by GA::Obj::Map->openWin to reset an existing Automapper window
#
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
if (! $nextSet) {
# All button sets are visible; cannot switch set
return undef;
}
# Remove the existing button set (preserving the switcher and add buttons, and the separator
# that follows them)
foreach my $widget ($self->toolbarButtonList) {
$axmud::CLIENT->desktopObj->removeWidget($toolbar, $widget);
}
# After the separator, we draw the specified button set. This function decides which
# specific function to call, and returns the result
@buttonList = $self->chooseButtonSet($toolbar, $nextSet);
# Add the buttons/separators to the toolbar
foreach my $button (@buttonList) {
my $label;
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
}
# Standard callback check
if (! $self->currentRegionmap) {
return undef;
}
# The menu column is presumably still open - which will get in the way of the screenshot.
# Give it a chance to close
$axmud::CLIENT->desktopObj->updateWidgets(
$self->_objClass . '->regionScreenshotCallback',
);
if ($type eq 'visible') {
# Find the position of the top-left corner of the visible canvas
($xOffset, $yOffset, $xPos, $yPos) = $self->getMapPosn();
$left = int($self->currentRegionmap->mapWidthPixels * $xPos);
$top = int($self->currentRegionmap->mapHeightPixels * $yPos);
# Import the size of the visible canvas
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Select gridblock',
$self->winWidget, # Parent window is this window
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# That completes the setup. Now, show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# That completes the setup. Now, show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# That completes the setup. Now, show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Add multiple exits',
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
# Destroy the window, when required
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return undef;
});
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# Create the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Set file path',
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# Show the 'dialogue' window
my $dialogueWin = Gtk3::Dialog->new(
'Adjacent regions regions mode',
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
$entry->set_text('');
$entry->set_sensitive(FALSE);
}
});
# Display the 'dialogue' window. Without this combination of Gtk calls, the window is not
# consistently active (don't know why this works; it just does)
$dialogueWin->show_all();
$dialogueWin->present();
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->promptAdjacentMode');
# Get the response. If the user clicked 'cancel', $response will be 'reject'
# Otherwise, user clicked 'ok', and we need to get the contents of the two boxes
$response = $dialogueWin->run();
if (defined $response && $response eq 'accept') {
$responseText = $combo->get_active_text();
$responseText2 = $entry->get_text();
# Destroy the window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
my $dialogueWin = Gtk3::Dialog->new(
$title,
$self->winWidget,
Gtk3::DialogFlags->new([qw/modal destroy-with-parent/]),
'gtk-cancel' => 'reject',
'gtk-ok' => 'accept',
);
$dialogueWin->set_position('center-always');
$dialogueWin->set_icon_list($axmud::CLIENT->desktopObj->{dialogueWinIconList});
$dialogueWin->signal_connect('delete-event' => sub {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
});
# Add widgets to the 'dialogue' window
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
$scroller->set_size_request(200, 75);
# Create a textview with default colours/fonts for a dialogue window
$textView = Gtk3::TextView->new();
$scroller->add($textView);
$buffer = Gtk3::TextBuffer->new();
$textView->set_buffer($buffer);
$textView->set_editable(TRUE);
$textView->set_cursor_visible(TRUE);
$axmud::CLIENT->desktopObj->setTextViewStyle('dialogue', $textView);
if ($labelObj) {
$buffer->set_text($labelObj->name);
}
}
my (
$label2, $combo,
$table,
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# User pressed their ENTER key in the Gtk3::Entry, so $text is already set
$response = 'accept';
} elsif ($entry) {
$text = $entry->get_text();
} else {
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
}
if ($response ne 'accept') {
$dialogueWin->destroy();
$self->restoreFocus();
return @emptyList;
# Otherwise, user clicked 'ok'
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->winSetup', @_);
}
# Most of the code is in the generic function
if (! $self->Games::Axmud::Generic::FreeWin::winSetup()) {
return undef;
}
# Some desktop managers use a bigger font than the author's desktop manager; as a result,
# 'free' windows like this one will be too small for comfort
# This window is (usually) only seen the first time Axmud is run. If the user's destkop
# manager font is too big, this window's Gtk3::ScrolledWindow will contain scrollbars
# If the scrollbars are present, we can increase the size of default 'free' windows to
# compensate, which removes the scrollbars in this window and (hopefully) most other
# 'free' windows, too
# Typically, this process makes the default 'free' window size slightly larger than it
# strictly needs to be, but that's still better than a Connections window with none of
# the 'Connect' buttons visible
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
# Update Client IVs
if (! $self->shareMainWinFlag) {
$axmud::CLIENT->set_shareMainWinFlag(FALSE);
} else {
$axmud::CLIENT->set_shareMainWinFlag(TRUE);
}
if ($self->zonemap eq 'none') {
$axmud::CLIENT->set_activateGridFlag(TRUE);
$axmud::CLIENT->desktopObj->defaultWorkspaceObj->disableWorkspaceGrids();
$axmud::CLIENT->desktopObj->defaultWorkspaceObj->reset_defaultZonemap();
} else {
$axmud::CLIENT->ivAdd('initWorkspaceHash', 0, $self->zonemap);
$zonemapObj = $axmud::CLIENT->ivShow('zonemapHash', $self->zonemap);
if ($zonemapObj) {
$axmud::CLIENT->desktopObj->defaultWorkspaceObj->set_defaultZonemap($zonemapObj);
}
}
# In v1.2.0, window tiling was enabled for MSWin users. For those users with existing Axmud
# installations, this 'wiz' window is called a second time
# For that reason, check that Locator/Status tasks don't already exist in the global
# tasklist. If they do, update their settings, rather than creating a new task
foreach my $initTaskObj ($axmud::CLIENT->ivValues('initTaskHash')) {
if ($initTaskObj->name eq 'status_task') {
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->zonemapPage', @_);
}
# Zonemaps
$self->addLabel($self->grid, '<b>Zonemaps (' . $self->getPageString() . ')</b>',
0, 12, 0, 1);
$self->addLabel(
$self->grid,
"<i>A zonemap is a plan for arranging windows on the desktop. Select the best zonemap"
. " for your system.</i>",
1, 12, 1, 2);
if ($self->shareMainWinFlag) {
$self->addSimpleImage(
$self->grid,
$axmud::SHARE_DIR . '/icons/setup/basic_zonemap.png',
undef,
1, 4, 2, 5);
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
$group,
'Widescreen',
FALSE,
TRUE,
4, 6, 7, 8);
# (->signal_connects from above)
# As a convenience for users, auto-set the 'widescreen' zonemap (but only do this once,
# otherwise widescreen will be re-selected if the 'Previous' button is clicked)
# Use 1800, rather than 1920, as the test in case there are desktop panels on the
# left and/or right sides
if (
defined $self->workspaceObj->currentWidth
&& $self->workspaceObj->currentWidth >= 1800
&& ! $self->widescreenFlag
) {
$radioButton3->set_active(TRUE);
$self->ivPoke('zonemap', 'widescreen');
$self->ivPoke('widescreenFlag', TRUE);
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
$self->_objClass . '->capturePage_drawWidgets',
@_,
);
}
# If any labels/entries/combo boxes have already been drawn, remove them from the grid
if (@$labelListRef) {
foreach my $label (@$labelListRef) {
$axmud::CLIENT->desktopObj->removeWidget($self->grid, $label);
}
@$labelListRef = ();
foreach my $entry (@$entryListRef) {
$axmud::CLIENT->desktopObj->removeWidget($self->grid, $entry);
}
@$entryListRef = ();
foreach my $comboBox (@$comboListRef) {
$axmud::CLIENT->desktopObj->removeWidget($self->grid, $comboBox);
}
@$comboListRef = ();
}
# Add a list of entry boxes, one for each line
$row = $startRow;
for (my $line = 0; $line < $self->analysisLength; $line++) {
$row++;
lib/Games/Axmud/WizWin.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->textViewSignalConnect', @_);
}
$buffer->signal_connect('changed' => sub {
my (
$text,
@list, @finalList,
);
$text = $axmud::CLIENT->desktopObj->bufferGetText($buffer);
# Split the contents of the textview into a list of lines, separated by newline
# characters
@list = split("\n", $text);
# Remove any empty lines and leading/trailing whitespace
foreach my $line (@list) {
if ($line) {
$line =~ s/^\s*//; # Remove leading whitespace
lib/Language/Axbasic/Statement.pm view on Meta::CPAN
$session->writeText($string);
}
$self->scriptObj->set_column(0);
}
}
}
# Make sure the text is visible immediately
$axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->implement');
# Implementation complete
return 1;
}
}
{ package Language::Axbasic::Statement::profile;
use strict;
use warnings;
pack/install view on Meta::CPAN
pack/axmud.desktop usr/share/applications
pack/baxmud.desktop usr/share/applications
pack/axmud.png usr/share/pixmaps
pack/axmud.xpm usr/share/pixmaps
share/docs/guide/ch04.html view on Meta::CPAN
<p>A few of the most common configuration options have been grouped together in a single window.</p>
<pre><code> ;editquick
;edq
</code></pre>
<h2><a name="4.12">4.12 Storing data</a></h2>
<p>Axmud stores data files in a location that depends on your system, and also on how you installed Axmud on that system.</p>
<p>If you want to stored data in a different location - on a USB stick, or an external hard drive, for example - you can use this command:</p>
<pre><code> ;setdatadirectory
;sdd
</code></pre>
<p>If you use Axmud on multiple devices - a desktop and a laptop, for example - you can set the location to a network drive that both devices can access.</p>
<p>Note that you shouldn't use both devices simultaneously - if you try, Axmud on one device will arbitrarily overwrite filed saved by Axmud on the other device.</p>
<p>(If you don't have your own network drive, or don't know how to set one up, you might like to use a commerical service like <a href="https://www.dropbox.com">Dropbox</a>).</p>
<p>If you want to make a backup copy of the data directory - a wise decision, in many cases - you can do that manually, or you can use a client command.</p>
<p>This command will create a backup copy of the entire data directory:</p>
<pre><code> ;backupdata
;bud
</code></pre>
<p>When you're ready to restore files from the backup, you can do it manually, or use the client command:</p>
<pre><code> ;restoredata
;rsd
share/docs/guide/ch04.mkd view on Meta::CPAN
##<a name="4.12">4.12 Storing data</a>
Axmud stores data files in a location that depends on your system, and also on how you installed Axmud on that system.
If you want to stored data in a different location - on a USB stick, or an external hard drive, for example - you can use this command:
;setdatadirectory
;sdd
If you use Axmud on multiple devices - a desktop and a laptop, for example - you can set the location to a network drive that both devices can access.
Note that you shouldn't use both devices simultaneously - if you try, Axmud on one device will arbitrarily overwrite filed saved by Axmud on the other device.
(If you don't have your own network drive, or don't know how to set one up, you might like to use a commerical service like [Dropbox](https://www.dropbox.com)).
If you want to make a backup copy of the data directory - a wise decision, in many cases - you can do that manually, or you can use a client command.
This command will create a backup copy of the entire data directory:
;backupdata
share/docs/guide/ch11.html view on Meta::CPAN
<li>Reset the task to apply your changes, using <strong>;resettask channels</strong></li>
</ul>
<p>That will modify the current task; in <a href="ch12.html">Section 12</a>, we'll discuss how to make those changes permanent.</p>
<p><img alt="Channels task window" src="img/ch11/channels_task_2.png"></p>
<h3><a name="11.6.3">11.6.3 The Divert task</a></h3>
<p>The Divert task is the (much) older brother of the Channels task.</p>
<p>Divert task windows doesn't have multiple tabs; instead, when some text is intercepted, the background colour changes temporarily. In this case, it has turned yellow signifying that the text is in the <strong>tell</strong> channel.</p>
<p><img alt="Divert task window" src="img/ch11/divert_task.png"></p>
<p>Traditionally, the Divert task used just four channels - one for <strong>social</strong> messages, one for <strong>tell</strong> messages, a <strong>warning</strong> channel and a <strong>custom</strong> channel for everything else.</p>
<p>The task can now use any channel. The four channels above each have their own colour; any other channel you might create is displayed using a fifth colour (magenta by default).</p>
<p>For your convenience, the window provides a command entry box. Any type of instruction, including client commands and speedwalk commands, can be typed in this box. This is useful if you're connected to a world, but busy doing something else; as lo...
<p>If you're connected to several worlds at the same time, you might also find the Watch task useful. Everything displayed in Channels, Chat and Divert task windows, in any session, is copied into any Watch task window that's open.</p>
<h2><a name="11.7">11.7 The Chat task</a></h2>
<p>The Chat task is an instant messenger service. It is an almost complete implementation of the MudMaster and zChat protocols (only encryption has not yet been implemented).</p>
<p>Several popular MUD clients implement these protocols, so your friends don't need to be using Axmud; they only need to be using a compatible MUD client.</p>
<p>There are some issues of security to consider, so we recommend you read the whole of this Section before using the task.</p>
<p>You can get started by listening out for incoming calls.</p>
<pre><code> ;chatlisten
;listen
</code></pre>
<p>When you receive an incoming call, you can either accept or decline it.</p>
share/docs/guide/ch11.mkd view on Meta::CPAN
The Divert task is the (much) older brother of the Channels task.
Divert task windows doesn't have multiple tabs; instead, when some text is intercepted, the background colour changes temporarily. In this case, it has turned yellow signifying that the text is in the **tell** channel.

Traditionally, the Divert task used just four channels - one for **social** messages, one for **tell** messages, a **warning** channel and a **custom** channel for everything else.
The task can now use any channel. The four channels above each have their own colour; any other channel you might create is displayed using a fifth colour (magenta by default).
For your convenience, the window provides a command entry box. Any type of instruction, including client commands and speedwalk commands, can be typed in this box. This is useful if you're connected to a world, but busy doing something else; as long ...
If you're connected to several worlds at the same time, you might also find the Watch task useful. Everything displayed in Channels, Chat and Divert task windows, in any session, is copied into any Watch task window that's open.
##<a name="11.7">11.7 The Chat task</a>
The Chat task is an instant messenger service. It is an almost complete implementation of the MudMaster and zChat protocols (only encryption has not yet been implemented).
Several popular MUD clients implement these protocols, so your friends don't need to be using Axmud; they only need to be using a compatible MUD client.
There are some issues of security to consider, so we recommend you read the whole of this Section before using the task.