KillerBots

Check-in [64cb3a83d0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bring it upto speed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:64cb3a83d0d4a7bf992d664b2c7c7f74c669d43e
User & Date: gerald 2013-08-09 21:22:01
Context
2013-08-12
20:28
Added base pieces. check-in: 8d591e05b7 user: gerald tags: trunk
2013-08-09
21:22
Bring it upto speed. check-in: 64cb3a83d0 user: gerald tags: trunk
2013-07-22
20:27
Initial checkin. check-in: 43587e4ad2 user: gerald tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added gui/HelpSystem.tcl.































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package require struct::stack

struct::stack ::gui::help::helpStack
array set ::gui::help::links {}

proc ::gui::help::loadHtml {window {file {}} {push yes}} {
    global baseDir
    variable links

    if {[string equal $file {}]} {
        ::gui::help::helpStack clear
        set baseFile [::msgcat::mc index.html]
    } else {
        set baseFile $file
    }

    if {$push} {
        ::gui::help::helpStack push $baseFile
    }

    if {[file exists [file join /.XmlFileBrowser helpFiles $baseFile]]} {
        set file [file join /.XmlFileBrowser helpFiles $baseFile]
    } else {
        set file [file join $baseDir helpFiles $baseFile]
    }

    set ifd [open $file r]
    fconfigure $ifd -encoding utf-8
    set html [read $ifd]
    close $ifd

    $window.helpText reset
    array unset links
    $window.helpText parse -final $html

   if {[::gui::help::helpStack size] == 1} {
        $window.toolBar.back configure -state disabled
    } else {
        $window.toolBar.back configure -state normal
    }

    return;
}

proc ::gui::help::back {window} {
    ::gui::help::helpStack pop
    ::gui::help::loadHtml $window [::gui::help::helpStack peek] no
}

proc ::gui::help::linkNode {window node} {
    variable links

    catch {
        set links($node) [$node attribute href]
        $node dynamic set link
    }
}


proc ::gui::help::followLink {window x y} {
    variable links

    set node [$window node $x $y]
    while {![string equal $node {}] && ![info exists links($node)]} {
        set node [$node parent]
    }
    if {[info exists links($node)]} {
        loadHtml [winfo parent $window] $links($node) yes
    }
    return
}

proc ::gui::help::dismiss {} {
    variable ::gui::windows

    wm withdraw $::gui::windows(helpViewer)

    return;
}

Added gui/createGui.tcl.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##
## Create all the toplevel GUI windows and a namespace to store variables in
##
array set ::gui::windows {}

##
## Load packages we are using from TkLib
##
package require autoscroll
package require tooltip

##
## Load images we are using
##
foreach file [glob [file join $baseDir gui icons *]] {
    image create photo [file tail [file rootname $file]] -file $file
}

proc createGui {} {
    ::gui::createMainWindow
    ::gui::createHelpWindow
}

wm withdraw .

Added gui/createHelpWindow.tcl.

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package require Tkhtml 3.0

proc ::gui::createHelpWindow {} {
    variable windows

    set w [toplevel $windows(main).helpViewer]
    wm withdraw $w
    set windows(helpViewer) $w
    set windows(helpViewer,displayCommand) ::gui::help::loadHtml
    wm transient $w $windows(main)
    wm title $w [::msgcat::mc helpViwer.title]
    wm protocol $w WM_DELETE_WINDOW ::gui::help::dismiss

    frame $w.toolBar
    button $w.toolBar.back \
        -command [list ::gui::help::back $w] \
        -image back
    grid configure $w.toolBar.back x -sticky ew
    grid columnconfigure $w.toolBar 2 -weight 1

    html $w.helpText \
        -xscrollcommand [list $w.hsb set] \
        -yscrollcommand [list $w.hsb set]
    scrollbar $w.hsb \
        -orient horizontal \
        -command [list $w.helpText xview]
    scrollbar $w.vsb \
        -orient vertical \
        -command [list $w.helpText yview]

    grid configure $w.toolBar -columnspan 2 -sticky ew
    grid configure $w.helpText $w.vsb -sticky nsew
    grid configure $w.hsb -sticky nsew
    grid columnconfigure $w $w.helpText -weight 1
    grid rowconfigure $w $w.helpText -weight 1

    ::autoscroll::autoscroll $w.vsb
    ::autoscroll::autoscroll $w.hsb

    $w.helpText handler node a [list ::gui::help::linkNode $w.helpText]
    bind $w.helpText <1> [list ::gui::help::followLink %W %x %y]

    return;
}

Added gui/createMainWindow.tcl.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
proc ::gui::createMainWindow {} {
    variable windows

    set w [toplevel .main]
    wm withdraw $w
    set windows(main) $w
    wm transient $w .
    wm title $w [::msgcat::mc main.title]
    wm protocol $w WM_DELETE_WINDOW ::gui::createMainWindowDismiss

    set menu $w.menubar
    $w configure -menu $menu
    menu $menu
    menu $menu.help
    menu $menu.file
    $menu add cascade \
        -menu $menu.file \
        -label [::msgcat::mc main.FileMenuLabel]
    createMainWindowFileMenu $menu.file

    $menu add cascade \
        -menu $menu.help \
        -label [::msgcat::mc main.HelpMenuLabel]
    createMainWindowHelpMenu $menu.help

    ::ttk::frame $w.frame
    grid configure $w.frame -sticky nsew
    grid columnconfigure $w $w.frame -weight 1
    grid rowconfigure $w $w.frame -weight 1

    set f $w.frame
    canvas $f.data \
        -xscrollcommand [list $f.hsb set] \
        -yscrollcommand [list $f.hsb set] \
        -scrollregion [list 0 1000 1000 0]
    ::ttk::scrollbar $f.hsb \
        -orient horizontal \
        -command [list $f.data xview]
    ::ttk::scrollbar $f.vsb \
        -orient vertical \
        -command [list $f.data yview]

    grid configure $f.data $f.vsb -sticky nsew
    grid configure $f.hsb -sticky nsew
    grid columnconfigure $f $f.data -weight 1
    grid rowconfigure $f $f.data -weight 1

    ::autoscroll::autoscroll $f.vsb
    ::autoscroll::autoscroll $f.hsb

    ::gui::createAboutWindow $w
    return;
}

proc ::gui::createMainWindowDismiss {} {
    destroy .
}

proc ::gui::createMainWindowFileMenu {menu} {
}

proc ::gui::createMainWindowHelpMenu {menu} {
    $menu add command \
        -label [::msgcat::mc HelpMenu.About] \
        -command {displayWindow helpAbout}
    $menu add command \
        -label [::msgcat::mc HelpMenu.Help] \
        -command {displayWindow helpViewer}
}

proc ::gui::createAboutWindow {main} {
    variable windows

    set windows(helpAbout) $main.helpAbout
    set windows(helpAbout,displayCommand) [list ::gui::displayAboutWindow]
    return;
}

proc ::gui::displayAboutWindow {main} {
    variable windows

    tk_messageBox \
        -default ok \
        -icon info \
        -message [::msgcat::mc helpAbout.details] \
        -parent $windows(main) \
        -title [::msgcat::mc helpAbout.title] \
        -type ok
    return;
}

Added gui/icons/back.png.

cannot compute difference between binary files

Added helpFiles/index.html.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd"
    >
<html lang="en">
<head>
    <title>Documentation for XmlFileBrowser</title>
</head>
<body>
    <h1>Documentation for XmlFileBrowser</h1>
    <a href="test.html">Test link</a>
</body>
</html>

Added helpFiles/test.html.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd"
    >
<html lang="en">
<head>
    <title>Second page in example</title>
</head>
<body>
    <h1>Second page of example</h1>
    <p>
        Use the back button to navigate backwards.
    </p>
</body>
</html>

Added lib/displayWindow.tcl.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
##
## Display a window if it is not already displayed
##
proc displayWindow {windowAlias} {
    variable ::gui::windows

    update idletasks
    set w $windows($windowAlias)
    if {[winfo exists $w]} {
        wm deiconify $w
        update idletasks
        raise $w
    }
    if {[info exists windows($windowAlias,displayCommand)]} {
        $windows($windowAlias,displayCommand) $w
    }
    return;
}

Changes to msgs/C.msg.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
::msgcat::mcset C main.title           {Killer Robots}
::msgcat::mcset C main.FileMenuLabel   {File}
::msgcat::mcset C main.HelpMenuLabel   {Help}

::msgcat::mcset C HelpMenu.About       {About}
::msgcat::mcset C HelpMenu.Help        {Details}

::msgcat::mcset C helpAbout.title      {About Killer Robots}
::msgcat::mcset C helpAbout.details    {
Version 1.0

Copyright ©2013 KnG Consulting, LLC.
}

::msgcat::mcset C helpViewer.title     {Help for XML File Exporer}

::msgcat::mcset C index.html           {index.html}

Changes to msgs/ROOT.msg.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
::msgcat::mcset {} main.title           {Killer Robots}
::msgcat::mcset {} main.FileMenuLabel   {File}
::msgcat::mcset {} main.HelpMenuLabel   {Help}

::msgcat::mcset {} HelpMenu.About       {About}
::msgcat::mcset {} HelpMenu.Help        {Details}

::msgcat::mcset {} helpAbout.title      {About Killer Robots}
::msgcat::mcset {} helpAbout.details    {
Version 1.0

Copyright ©2013 KnG Consulting, LLC.
}

::msgcat::mcset {} helpViewer.title     {Help for Killer Robots}

::msgcat::mcset {} index.html           {index.html}

Changes to msgs/en.msg.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
::msgcat::mcset en main.title           {Killer Robots}
::msgcat::mcset en main.FileMenuLabel   {File}
::msgcat::mcset en main.HelpMenuLabel   {Help}

::msgcat::mcset en HelpMenu.About       {About}
::msgcat::mcset en HelpMenu.Help        {Details}

::msgcat::mcset en helpAbout.title      {About Killer Robots}
::msgcat::mcset en helpAbout.details    {
Version 1.0

Copyright ©2013 KnG Consulting, LLC.
}

::msgcat::mcset en helpViewer.title     {Help for XML File Exporer}

::msgcat::mcset en index.html           {index.html}