Class ctkProject models a project file as used in the clickTk
session.
my $prj = ctkProject->new();
$prj->open ;
$prj->save;
$prj->close;
- Still under construction
Author: marco
date: 28.10.2006
History
28.10.2006 MO03101 mam First draft
26.11.2007 version 1.02 refactoring
14.12.2007 version 1.03 refactoring
13.10.2008 version 1.04
28.10.2008 version 1.05
15.04.2009 version 1.06
23.04.2009 version 1.07
30.07.2010 version 1.08
_extractVariables
_init
assignVariables
conflicts
descriptor
destroy
empty_file_opt
existsFolder
extractVariables
fileName
generate_unique_id
getType
getWidgetIdList
id_to_path
index_of
init
insertGlobal
insertLocal
isRef2Widget
name
new
noname
parseNonvisualConstructor
parseTkCode
path_to_id
refreshVariables
removeGlobal
removeLocal
saveDataToFile
return the index of the given id in the
class data member @tree
TODO : raise an exception if id not found
Return the type (class name) of the given widget path
(default is the selected widget).
Exception
id doesn't exist in the class data member %descriptor
TODO : check existence of $id first, then access the hash
Build the id of a new widget definition
Argument
widget class
Return
id
Note : the class data member $objCount is
used to make the id unique.
Return the hash or ref to hash
of the default file_opt structure.
Return true if the project folder exists.
Build the project name out of the given file name.
Build the file name for the given project name.
Return the id of all currently defined widgets
as array or ref to array.
Check if the geiven widget's ids
are in the list of the defined wigets.
Return the number of name matches.
Return the id of the given path
Default id is getSelected()
Exception 'Missing selected widget'
Scan the class data member ctkProject::tree
for the given id and reurn the found item.
Argument
id
Exception : more thean one item found
Return
found item or
UNDEF if none found
- generate the code
- set up an instance of type ctkFile
- create a backup
- write the generated code
- return true if the close did well.
Argument
- file name
Scan the widgets definitions for existing conflicts
conflict 1 remove option -label from Frame with sub-widgets using grid
(endless loop in Perl)
for each frame widget
get all children id's
get those geometry
remove -label if at least one match 'grid'
Arguments
None
Return
array of conflicts description or
number of conflicts
For each widget description line:
1. get Id, Parent, Type, parameters, geometry
2. check for Parent existence
3. add line to tree descriptor
4. add element to widget descriptor
5. collect variables and callbacks
Arguments
- widget constructor code (string)
- line number within input batch (int)
- assigned order (string)
- nonvisual flag
-
Return
array of exceptions
Global structures
%ctkProject::descriptor (id->descriptor)
@ctkProject::tree
@ctkProject::user_auto_vars - user-defined variables to be pre-declared automatically
use vars qw/$x/;
Global widgets used:
$tf - preview tree
Parse the given constructore code and
build up a descriptor for the given nonvisual entry.
The constructor code looks like this
$<id> = <type> -> new (<optionslist>);
- set up a parser instance
- get descriptor
- parse options string to options list
message parseWidgetOptionsQuotate( return of message parseString)
- scan options list
- build option's pair (opt , value)
skip opt
- check value for
constant
variable's name beginning with %@$ (package name not yet supported)
ref to variable
element of array or hash
ref to list [ ]
closure (get not analyzed)
- return the list of found variable's ident
(depending on context array or ref to array)
Extract valriables form the TK-commands and
put them into data class members @user_local_vars
and @user_auto_vars.
Send message $self->_extractVariables to do the job,
then save its return into the mentioned class data members.
- insertLocal
- insertGlobal
- removeLocal
- removeGlobal
Reassign the extracted variables and inform the user
about reassignments.
See class data member ctkProject::DTmessage
This method saves the given list of variables in the global
arrays depending on the actual conditions.
- Decision table
-
see definition module ctkDT_variables.pl .
- Notes
-
- local variables are declared by means of my $variable .
-
- global variables are declared with use vars qw/$variable/ .
-
- same variable may exist in the local namespace and in the
global one (warning).