blob: 84c1207fc427aeda1c9d4216fc56d93b38a67b31 (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
# Copyright (C) 2004 - INRIA - Fabrice Leray
# Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
#
# This file must be used under the terms of the CeCILL.
# This source file is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at
# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
set pwd [pwd]
cd [file dirname [info script]]
variable DEMODIR [pwd]
cd $pwd
variable DEMODIR
lappend ::auto_path [file dirname "$env(SCIPATH)/modules/tclsci/tcl/BWidget"]
namespace inscope :: package require BWidget
package require BWidget
set sourcedir [file join "$env(SCIPATH)" "modules" "tclsci" "tcl" "utils"]
set sourcedir2 [file join "$env(SCIPATH)" "modules" "graphics" "tcl" "ged"]
source [file join $sourcedir Notebook.tcl]
source [file join $sourcedir Combobox.tcl]
source [file join $sourcedir2 ObjectsBrowser.tcl]
package require combobox 2.3
catch {namespace import combobox::*}
#package require lemonTree
catch {namespace import LemonTree::*}
global envSCIHOME MAIN_WINDOW_POSITION TICK_WINDOW_POSITION msdos SCIHOME
set ged_listofpref "MAIN_WINDOW_POSITION TICK_WINDOW_POSITION"
set MAIN_WINDOW_POSITION "+0+0"
set TICK_WINDOW_POSITION "+0+0"
set envSCIHOME $SCIHOME
set preffilename $envSCIHOME/.GedPreferences.tcl
catch {source $preffilename}
global SELOBJECT
global ged_handle_list_size
global lalist
global curgedindex
global curgedobject
global curvis
#To update foreground color grey ("off"), black ("on") for checkbutton boxes
proc OnOffForeground { frame flag } {
if { $flag == "on" } {
$frame configure -foreground black
} else {
$frame configure -foreground grey
}
}
set NBheight 105
set NBwidth 130
set Wheight [expr $NBheight + 170]
set Wwidth [expr $NBwidth + 275]
set smallPad 4
set mediumPad 8
#create the font we will use
set gedFont {Arial -12}
set ww .axes
catch {destroy $ww}
toplevel $ww
wm title $ww "Compound Editor"
wm iconname $ww "CE"
wm geometry $ww [expr $Wwidth]x[expr $Wheight]$MAIN_WINDOW_POSITION
wm maxsize $ww $Wwidth $Wheight
wm protocol $ww WM_DELETE_WINDOW "DestroyGlobals; destroy $ww "
set topf [frame $ww.topf]
set titf1 [TitleFrame $topf.titf1 -text "Graphic Editor" -font $gedFont]
set parent [$titf1 getframe]
set pw1 [PanedWindow $parent.pw -side top]
set pane3 $pw1
# Make a frame scrollable
set sw [ScrolledWindow $pane3.sw -relief sunken -borderwidth 2]
# pack $sw -in .sw -fill both -expand true
set sf [ScrollableFrame $sw.f]
$sw setwidget $sf
set uf [$sf getframe]
set w $uf
set fra [frame $w.frame -borderwidth 0]
pack $fra -anchor w -fill both
#------------------------------------------------
set theframe $fra
#adding 15.06.2005
set topflabel [frame $theframe.topflabel]
set titf1label [TitleFrame $topflabel.titflabel1 -text "Objects Browser" -font $gedFont]
set titf1axes [TitleFrame $topflabel.titfaxes1 -text "Object Properties" -font $gedFont]
set w [$titf1label getframe]
pack $titf1label -padx 4 -side left -fill both -expand yes
pack $topflabel -fill x -pady 0
pack $titf1axes -pady 0 -padx 4 -fill both -expand yes
frame $w.frame -borderwidth 0
pack $w.frame -anchor w -fill both
#end adding
set wfortree $w
for {set i 1} {$i<=$ged_handle_list_size} {incr i} {
set OBJECTSARRAY($i) $SELOBJECT($i)
}
set curgedobject $SELOBJECT($curgedindex)
set tree [Tree $wfortree.tree \
-yscrollcommand {$wfortree.y set} -xscrollcommand {$wfortree.x set} \
-width 20 -height 11 \
-background white -opencmd {LemonTree::open $wfortree.tree} \
-selectbackground blue -selectforeground white ]
pack [scrollbar $wfortree.x -orient horiz -command {$wfortree.tree xview}] -side bottom -fill x
pack [scrollbar $wfortree.y -command {$wfortree.tree yview}] -side right -fill y
pack $tree -fill both -expand 1 -side left
$tree bindText <1> {LemonTree::Info $tree}
$tree bindImage <1> {LemonTree::Info $tree}
LemonTree::add $tree root FIGURE currentfigure "Figure(1)"
# I open the tree to browse all the nodes (to know what nodes I have and what their names are)
$tree opentree n1
set allnodes [$tree selection get]
#I close quickly the tree because openreeatnode expanded the tree...
$tree closetree n1
# I directly point onto the current curgedobject (current Axes or Figure or picked entity)
LemonTree::finddata $tree $allnodes $curgedobject
#adding 15.06.2005
set w [$titf1axes getframe]
set uf $w
#------------------------------------------------
set largeur 10
Notebook:create $uf.n -pages {Style} -pad 0 -height $NBheight -width $NBwidth
pack $uf.n -fill both -expand 1
########### Style onglet ##########################################
###################################################################
set w [Notebook:frame $uf.n Style]
frame $w.frame -borderwidth 0
pack $w.frame -anchor w -fill both
#visibility
frame $w.frame.vis -borderwidth 0
pack $w.frame.vis -in $w.frame -side top -fill x
label $w.frame.vislabel -text "Visibility:" -font $gedFont -anchor e -width $largeur
checkbutton $w.frame.visib -text "on"\
-variable curvis -onvalue "on" -offvalue "off" \
-command "toggleVis $w.frame.visib" -font $gedFont
OnOffForeground $w.frame.visib $curvis
pack $w.frame.vislabel -in $w.frame.vis -side left
pack $w.frame.visib -in $w.frame.vis -side left -fill x -padx $mediumPad
#sep bar
frame $w.sep -height 2 -borderwidth 1 -relief sunken
pack $w.sep -fill both
#exit button
frame $w.buttons
pack $w.buttons -side bottom -fill x -pady 0
button $w.buttons.dismiss -text Quit -command "DestroyGlobals; destroy $ww" -font $gedFont
pack $w.buttons.dismiss -side bottom
pack $sw $pw1 -fill both -expand yes
pack $titf1 -padx 4 -side left -fill both -expand yes
pack $topf -fill both -pady 2 -expand yes
#proc associes
proc toggleVis { frame } {
global curvis
ScilabEval "global ged_handle;ged_handle.visible='$curvis'"
OnOffForeground $frame $curvis
}
proc SavePreferences { } {
global ged_listofpref
global envSCIHOME MAIN_WINDOW_POSITION TICK_WINDOW_POSITION
global ww msdos
ScilabEval "DestroyGlobals()" "seq"
if { $msdos == "F" } {
#unix mandrake (at least) needs this offset
#test other unix distribution to see (red hat, suse...)
set xoffset -5
set yoffset -26
} else {
set xoffset 0
set yoffset 0
}
set x [eval {winfo x $ww}]
set y [eval {winfo y $ww}]
set MAIN_WINDOW_POSITION "+[expr $x+$xoffset]+[expr $y+$yoffset]"
#save preferences (position...)
set preffilename [file join $envSCIHOME .GedPreferences.tcl]
catch {
set preffile [open $preffilename w]
foreach opt $ged_listofpref {
global $opt
puts $preffile [concat "set $opt " [set $opt]]
# puts [concat "set $opt" [set $opt]]
}
close $preffile
}
}
proc DestroyGlobals { } {
ScilabEval "DestroyGlobals()" "seq"
SavePreferences
}
|