File: html.tcl

package info (click to toggle)
moodss 14.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,536 kB
  • ctags: 1,003
  • sloc: tcl: 25,371; ansic: 132; perl: 72; python: 64; sh: 63; makefile: 50
file content (55 lines) | stat: -rw-r--r-- 2,574 bytes parent folder | download
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
# copyright (C) 1997-2001 Jean-Luc Fontaine (mailto:jfontain@free.fr)
# this program is free software: please read the COPYRIGHT file enclosed in this package or use the Help Copyright menu

set rcsId {$Id: html.tcl,v 1.33 2000/12/31 23:14:19 jfontain Exp $}


proc displayHelpWindow {topLevelName name title} {
    upvar $topLevelName toplevel

    # child of common parent so that user interaction can be limited to 2 windows (print dialog box and main help for example)
    set toplevel .grabber.help${name}
    if {[winfo exists $toplevel]} {
        wm deiconify $toplevel
        raise $toplevel
        return 0
    }
    toplevel $toplevel
    wm group $toplevel .                                             ;# for proper window manager (windowmaker for example) behavior
    wm title $toplevel $title
    frame $toplevel.bound                     ;# create a frame for bindings that otherwise would propagate to all toplevel children
    return 1
}

proc generalHelpWindow {{url {}}} {
    static bottom

    if {[displayHelpWindow toplevel moodss {moodss: Global Help}]} {
        set panes [new panner $toplevel -panes 2]                                    ;# split window in 2 for contents and help data
        pack $widget::($panes,path) -fill both -expand 1

        set top [new htmlViewer $panner::($panes,frame1)]
        composite::configure $top base -height 100 -width 500
        pack $widget::($top,path) -fill both -expand 1
        set bottom [new htmlViewer $panner::($panes,frame2) -directory $::global::documentationDirectory]
        composite::configure $top -linkto $bottom
        composite::configure $bottom base -height 400
        pack $widget::($bottom,path) -fill both -expand 1
        bind $toplevel.bound <Destroy> "delete $bottom $top $panes"

        composite::configure $top -data $::htmlHelpContents
        if {![winfo exists $toplevel]} return                       ;# user may have destroyed the window through the window manager
        composite::configure $bottom -data $::htmlHelpData
    }
    if {([string length $url]>0)&&[info exists bottom]} {                                    ;# viewer may not have been created yet
        htmlViewer::goTo $bottom $url
    }
}

proc moduleHelpWindow {name text} {
    if {![displayHelpWindow toplevel $name "moodss: $name Module Help"]} return
    set viewer [new htmlViewer $toplevel -directory $::packageDirectory($name)]
    pack $widget::($viewer,path) -fill both -expand 1
    bind $toplevel.bound <Destroy> "delete $viewer"
    composite::configure $viewer -data $text
}