ctk_w.pl

        ClickTk main module.

Programming notes

Maintenance
        See clickTk_maintenance.html for details about maintenance history.

Check folders

        - check existence of folder
        - allocate temp folder if it doesn't yet exist

Set up run time environment

        - Set up main window
        - Check OS
        - Parse command line options
        - Restore session
        - Parse command line file
        - Load widget's class definition
        - Set up error handler
        - Set up some graphic elements
        - Set up main window (menu, toolbar, ...)
        - Initialize project
        - Start main loop .

Methods

General

        ctkTitle
        getDescriptor
        getFile_opt
        getGlobalVariables
        getLocalVariables
        getImageFolder
        getMW
        getNoname
        getPerl
        getSelected
        getSelected
        getTree
        getType
        getW_attr
        getWidgets
        get_picW
        getmw
        haveGeometry
        index_of
        nonVisual
        selectedIsMW
        selectedWidget
        set_selected

selectedWidget

        Return the ref to widget in the preview corresponding to
        the selected widget.
        Return UNDEF if none is selected.

selectedIsMW

        Return true if the $id of the selected widget is
        equal to the root widget.

set_selected

        Make the given widget become the selected widget
                - set the global variable $selected
                - update the widget tree
                - update the status bar
                - eventually blink the widget in the preview
                - return the selected widget id

haveGeometry

        Return true if the given widget's type (class)
        must be managed by a geometry manager.

nonVisual

        Return the value (0 | 1) of the nonVisual attribute
        of the given widget type (class).

getDumpArguments

        Return the argument to dump data to the work instance.

computeState

        Compute the program state to update the main menu.
        Global variables $main::projectName ,
        the state of the undo-stack, the state of the clipboard
        and the return value of main::isChanged() are inspected.
        Additionally the return value of main::computeEditTreeState
        is added.

computeEditTreeState

        - ischanged               rv += 01  undo,redo normal
        - clipboard data                02  paste normal
        - !selectedIsMW                 04  options,Copy,delete,rename,replace disabled
        - selected is not Hidden        08  hide normal
        - selected is hidden            16  unhide normal
        - hasGeometry                   32  view geometryInfo normal
        -at least one must match       128
        - always                       256

parseCmdLineOpt

        Parse the line command options and
        set the global variables accordingly.

parseFileOption

        Parse the line command option files.
        The value is converted to standard format
        depending on the actual options and stored
        into $cmdLineOpt{'file'}.

setApplication

        Set application name and application folder

setupBallon

        Set up an intance of type Balloon.
        Arguments:
                - parent widget (delaut main::getmw())
        Return
                Ref to widget

loadImages

recolorMySelf

        Get fg an bg color and apply them to all defined widgets.
                get current values using message $mw->Palette
                get color for -bg and -fg
                set defualt values if required
                reset to default colors
                recolr all widget of the widget tree
                repaint preview

_resetToDefault

        get default options of -fg and -bg
        apply the options to the given widget
        apply to all children descending the widget tree

resetToDefault

        reset the default option starting at main window
        repaint the preview

pickColor

        See module ctkDialogs

ColorPicker

        See module ctkDialogs

color_Picker

        See module ctkDialogs

tools_edit

        See ctkTools::_edit.

tools_syntax

        See ctkTools::_syntax.

tools_run

        See ctkTools::_run.

tools_cursor

        See std::dlg_selectCursor.

tools_genFontCode

        See required module ctkFontDialog.pm

fontExists

        Wrapper to  std::fontExists.

Tk::Error

        Error handler
                log the exception into ctk log
                show the error dialog to the user
                call the cleanup routine

TkErrorCleanUp

        Process the cleanup code for all exception
                - issue Unbusy message to the given widget.
         TODO:
                exit process if inError is ON
                set inError to ON
                save debug info
                if changed()
                then do
                        roll back last change
                        save the work as ${projectname}_rescue.pl
                end
                else do
                        set inError OFF
                        return to caller
                end

More methods I

clear_preview

        Wrapper to ctkPreview::clear

initPreview

        Wrapper to ctkPreview::init

preview_repaint

        Wrapper to ctkPreview::repaint

edit_indicators

dlg_libraries

file_callbacks

file_other_code

file_pod

file_gcode

file_methods

Handling with variables

        dlg_getVariables
        deleteFromLocal
        deleteFromGlobal
        moveLocal2Global
        moveGlobal2Local
        editLocal
        editGlobal
        addLocal
        addGlobal
        deleteGlobal
        deleteLocal
        code_variables

dlg_getAdvertisedWidgets

dlg_codeOptions

        Set up and handle the dialog to maintain
        all project options
        save original values for restore
        set up modal dialog (message to std::dlg_codeOptions)
        and wait on reply

recolor_dialog

file_init

file_new

file_newx

struct_new

work_save

work_select

work_restore

template_save

template_select

template_load

help

menu_about

doBlink

buildWidgetOptionsOnEdit

buildWidgetOptions

isChanged

isUnchanged

changes

session_restore

session_save

abandon

        This method performs the termination of a clickTk session.
        - save the session state for restart
        - save the project if it has been changed
          (asking the user first)
        - always save the work
        - kill down all help toplevels

save_changes

_extractVariables

extractVariables

extractMethodsAndSubroutineNames

extractAndAssignVariables

Wrapper to ctkTarget classes

        genScript
        genPackage
        genComposite
        genSubroutine
        code_generate

buildTemplateFileName

buildApplicationFileName

updateFileHistory

saveDataToFile

file_close

file_save

file_save_as

file_open

setupPopupMenu4PreviousFiles

        return the ref to a popup-Menu widget
        The menu shows a command for each file saved
        in the global variable $previousFiles.

execPrevious

        This method sets up the project for the given file.
        It is the callback of popup menu set up
        by main::setupPopupMenu4PreviousFiles.
        Arguments
                previous file
        Return
                true if the job went well, false otherwise
        Notes

file_openPrevious

askForOpen

file_import

file_export

file_read

        Read project and convert to internal data.
        Rteun true if the job has been well done,
        false otherwise.

getWidgetIconName

isGeomMgrSupported

        Return true if the given geometry manager is
        in the list of the supported geometry manager
        saved in the global variable $main::geomMgr .

geomForget

        This method issues the Forget message depending on the actal
        geometry manager of the given widget.

geomInfo

        This method issues the message Info depending on the
        actual geometry manager of the given widget.
        It returns an array of lines in array context, or
        the number of lines in scalar context.

hideWidget

        Send packForget to the widget in order to unmap the widget.

unhide

        This is the opposite of main::hideWidget .
        It deletes the given widget from the list of hidden
        widgets, marks the project as changed, send the tree_repaint message
        and send the repaint message to the preview.

updateWidgetClassDef

deleteWidgetClassDef

Clipboard operations

Rules
         1. Clipboard data consistency (check for signature line)
         2. All clipboard operations can be performed on single
            widget selection (and all it's sub-widgets).
         3. When placing to clipboard the data must be 'transferred'
            to root hierarchy level by substitution of 'parent' for
            selected widget.
         4. While pasting data from clipboard 1st of all the type of
            the selected widget (target) must be checked in order to
            decide if it can accept the pasted widget.
         5. Next check is for possible geometry management conflicts
            between widget to be inserted and context. User can
            choose one of following: 'propagate' | 'adopt' | 'cancel'.
         6. Last check must be done per widget to be inserted:
            does it's ID conflicting with existing widgets?
            In case of conflict the widget must be renamed (main::ask_new_id_for_paste).
Class
        Module ctkClipboard.pm models the clipboard object.
Methods in the package main
        These methods implements the use of the clipboard.
        On start up a clipboard operation they first instantiate
        ctkClipboard to get access to the clipboard itself.
                edit_cut
                _edit_copy
                edit_copy
                edit_delete
                _edit_delete
                edit_paste
                edit_replace
                ask_new_id_for_paste
                _adapt

More Methods II

insert

        - process framing & nonVisual
        - determine insertion point,
          handle special cases :
             @legalWidgets,
                 NoteBook ,
                 Menu,
                 (command|checkbutton|radiobutton|separator)
        - ask for widget type
        - call main::do_insert
        - set selected
        - edit widget otions if main::autoEdit is ON

getLegalWidgets

        This method returns the widgets types which are legal
        for the given widget or its parent.
        Thus, if the given parent is of type 'Menu' the the legal widget types are
        the list (cascade command checkbutton radiobutton separator).
        By contrast, if the parent is of type (Menubutton cascade) then only the widget class 'Menu' is legal.
        Non-Visual widgets legalize only other non-visual widgets.
        Further, if the given Parent is $MW then all registered widgets classes are legal.
        Otherwise, all widgets which support a geometry manager are legal.
        Arguments
                - parent widget (default id of widget)
                - path of the widget (default selected widget)
        Return
        list of the legal widget types or
        number of legal widgets depending on context
        Notes
                The concept of legal widget is not yet
                fully implemented. Though, the current implementation
                covers most of the needs of the every day programming.
                Some special topics will be subject of future implementations
                (Toplevel, Frames, non-visuals).

edit_updateAllOptions

        Edit all options of the selected widget.

setDefaultWidgetOptions

do_updateOrder

        Process an order for the selected widget

do_insert

        - Find selected element index in @ctkProject::tree
        - Ask user for human-readable name here:
        - Save current state for undo
        - Create descriptor
        - Set up default widget's values
        - Set up geometry
        - Add data to internal structures according to gathered parameters:
        - Update the display of the widget's tree

insertFrame

ask_new_id

ask_new_id_for_paste

generate_unique_id

rename

ask_new_type

edit_replace

optMenuWidget

askUserForGeom

edit_widgetOptions

        Send message to ctkWidgetOption::edit

getBrotherToBeCheckedForGeom

        Return the list of sibling which need to be checked
        for geometry conflicts.
        It returns the list or the number of widgets depending on
        the context.

imageFileSelect

        Wrapper to the class ctkImages

Wrappers to methods of the class ctkCallback

        callback
        checkCallbackOption
        extractMethodName
        extractMethods
        extractSubroutineName
        extractSubroutines
        pushCallback
        pushMethod
        pushSubroutineName

Specialized Input dialogs

        Fillmenu
        SideMenu
        AnchorMenu
        FrameMenu

Methods - Structure's handling

        cnf_dlg_ballon
        depthOfWidgetPath
        id_to_path
        load_cnf_dlg_ballon
        map_pic
        parent_path
        path_to_id
        replace_id
        tree_get_brothers
        tree_get_sons

Methods - Undo/Redo

        redo
        undo
        undo_save

Methods - View

        main_listBindings
        main_viewWidgetStructure
        view_code

Wrappers

        convertToList       wrapper to ctkParser
        quotatX             wrapper to ctkParser
        quotatY             wrapper to ctkParser
        quotatZ             wrapper to ctkParser
        quotatZZ            wrapper to ctkParser
        gen_TkCode          wrapper to ctkTargetCode
        getWidgetIdList     wrapper to ctkProject
        isRef2Widget        wrapper to ctkProject
        parseTkCode         wrapper to ctkProject
        quotate             wrapper to ctkWidgetOption
        split_opt           wrapper to ctkWidgetOption
        string2Array        wrapper to ctkWidgetOption

normalize

        Obsolete code

parseTargetCode

        - Set upe arguments for the message ctkTargetCode->parseTargetCode,
        - send the message parseTargetCode to the class ctkTargetCode,
        - return the return code

createDescriptor

        Return an instance of the class ctkDescriptor.

defaultGeometryOptions

        Return the default geometry options for the given
        class or an empty string if none exists.
        TODO: precondition : class exists in %w_attr

defaultWidgetOptions

        Return the default widgets options for the given
        class or an empty string if none exists.
        TODO: precondition : class exists in %w_attr

defaultGeometryManager

        Return the name of the default geometry manager for the given
        class or an empty string if none exists.
        TODO: precondition : class exists in %w_attr

preprocessOptions

        See module ctkParser.

showTkVariables

        Set up dialog TkAnalysis::showTkVariables
        and show it.

_setupArgsForRestartSession

        Set up and return a string containing the
        command line options according to the options
        actually in use. (see globals %cmdLineOpt and $debug).
        Arguments
                None.

do_restartSession

        Set up the restart process depending on the
        running platform and the file extension.
        Arguments
                file name (optional)

Back to index