Eskil

Diff
Login

Differences From Artifact [eb6902f5de]:

To Artifact [a2f22895c5]:


15
16
17
18
19
20
21

















22
23
24
25
26
27
28
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







#
#  You should have received a copy of the GNU General Public License
#  along with this program; see the file COPYING.  If not, write to
#  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA 02111-1307, USA.
#
#----------------------------------------------------------------------

# The format of the ::Pref(preprocess) is:
# Flat list of stride 3 (RE sub side)

# Return active preprocess items as a flat list with stride 3
proc getActivePreprocess {top} {
    set res {}
    foreach {RE sub side} $::Pref(preprocess) {
        lappend res $RE $sub $side
    }
    return $res
}

# Entry for adding preprocess from command line
proc addPreprocess {name RE sub side} {
    lappend ::Pref(preprocess) $RE $sub $side
}

# This is called when Ok or Apply is pressed.
# Update preference from dialog contents.
proc EditPrefRegsubOk {top w {keep 0}} {
    set exa $::eskil($top,prefregexa)

    set result {}
240
241
242
243
244
245
246













































257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

    trace add variable ::eskil($top,prefregexa) write \
            [list EditPrefRegsubUpdate $top]
    trace add variable ::eskil($top,prefregexa2) write \
            [list EditPrefRegsubUpdate $top]
    EditPrefRegsubUpdate $top
}


# This is called when Ok or Apply is pressed.
# Update preference from dialog contents.
proc EditPrefPrepOk {top w {keep 0}} {
    #TODO
    
    if {$keep} return
    destroy $w
}

proc EditPrefPreprocess {top} {
    set w $top.prefpreprocess

    if {[winfo exists $w] && [winfo toplevel $w] eq $w} {
        wm deiconify $w
        raise $w
        focus $w
    } else {
        destroy $w
        toplevel $w -padx 3 -pady 3
        wm title $w "Preferences: Preprocess"
    }

    # Heading labels for columns
    ttk::label $w.hl1 -text "Name"
    addBalloon $w.hl1 "Name of preprocess item"
    ttk::label $w.hl2 -text "Active"
    addBalloon $w.hl2 "Is item active for this session?"
    ttk::label $w.hl3 -text "Saved"
    addBalloon $w.hl3 "Is item saved with preferences?"

    # TODO
    

    # Buttons
    ttk::frame $w.fb -padding 3
    ttk::button $w.fb.b1 -text "Ok"     -command [list EditPrefPrepOk $top $w]
    ttk::button $w.fb.b2 -text "Apply"  -command [list EditPrefPrepOk $top $w 1]
    ttk::button $w.fb.b3 -text "Cancel" -command [list destroy $w]

    grid $w.fb.b1 x $w.fb.b2 x $w.fb.b3 -sticky we
    grid columnconfigure $w.fb {0 2 4} -uniform a
    grid columnconfigure $w.fb {1 3} -weight 1
}