1# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2# Copyright (C) 2004 - INRIA - Fabrice Leray 3# Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy 4# 5# Copyright (C) 2012 - 2016 - Scilab Enterprises 6# 7# This file is hereby licensed under the terms of the GNU GPL v2.0, 8# pursuant to article 5.3.4 of the CeCILL v.2.1. 9# This file was originally licensed under the terms of the CeCILL v2.1, 10# and continues to be available under such terms. 11# For more information, see the COPYING file which you should have received 12# along with this program. 13 14set pwd [pwd] 15cd [file dirname [info script]] 16variable DEMODIR [pwd] 17cd $pwd 18 19 20 21variable DEMODIR 22 23lappend ::auto_path [file dirname "$env(SCIPATH)/modules/tclsci/tcl/BWidget"] 24namespace inscope :: package require BWidget 25package require BWidget 26 27 28set sourcedir [file join "$env(SCIPATH)" "modules" "tclsci" "tcl" "utils"] 29set sourcedir2 [file join "$env(SCIPATH)" "modules" "graphics" "tcl" "ged"] 30 31source [file join $sourcedir Notebook.tcl] 32source [file join $sourcedir Combobox.tcl] 33source [file join $sourcedir2 ObjectsBrowser.tcl] 34 35package require combobox 2.3 36catch {namespace import combobox::*} 37 38#package require lemonTree 39catch {namespace import LemonTree::*} 40 41global envSCIHOME MAIN_WINDOW_POSITION TICK_WINDOW_POSITION msdos 42set ged_listofpref "MAIN_WINDOW_POSITION TICK_WINDOW_POSITION" 43set MAIN_WINDOW_POSITION "+0+0" 44set TICK_WINDOW_POSITION "+0+0" 45 46set envSCIHOME $SCIHOME 47set preffilename $envSCIHOME/.GedPreferences.tcl 48catch {source $preffilename} 49 50 51global SELOBJECT 52global ged_handle_list_size 53global lalist 54global curgedindex 55global curgedobject 56global ncolors RED GREEN BLUE 57 58global curvis 59global curclipstate Xclipbox Yclipbox Wclipbox Hclipbox letext 60global old_Xclipbox old_Yclipbox old_Wclipbox old_Hclipbox 61global curlinestyle arcVAL nbcol curcolor 62global curfillmode curthick curback 63global curclipstate Xclipbox Yclipbox Wclipbox Hclipbox letext 64global old_Xclipbox old_Yclipbox old_Wclipbox old_Hclipbox ncolors 65 66global Hval Wval Xval Yval Zval A1val A2val 67global curlinemode curfillmode 68global smallPad mediumPad 69 70#To update foreground color grey ("off"), black ("on") for checkbutton boxes 71proc OnOffForeground { frame flag } { 72 73 if { $flag == "on" } { 74 $frame configure -foreground black 75 } else { 76 $frame configure -foreground grey 77 } 78} 79 80set NBheight 270 81set NBwidth 288 82 83set smallPad 4 84set mediumPad 8 85 86set Wheight [expr $NBheight + 110] 87set Wwidth [expr $NBwidth + 270] 88 89#create the font we will use 90set gedFont {Arial -12} 91 92set ww .axes 93catch {destroy $ww} 94 95toplevel $ww 96wm title $ww "Arc Object" 97wm iconname $ww "AO" 98wm geometry $ww [expr $Wwidth]x[expr $Wheight]$MAIN_WINDOW_POSITION 99wm maxsize $ww $Wwidth $Wheight 100wm protocol $ww WM_DELETE_WINDOW "DestroyGlobals; destroy $ww " 101 102set topf [frame $ww.topf] 103set titf1 [TitleFrame $topf.titf1 -text "Graphic Editor" -font $gedFont] 104 105set parent [$titf1 getframe] 106set pw1 [PanedWindow $parent.pw -side top] 107set pane3 $pw1 108 109 110 111# Make a frame scrollable 112 113set sw [ScrolledWindow $pane3.sw -relief sunken -borderwidth 2] 114# pack $sw -in .sw -fill both -expand true 115set sf [ScrollableFrame $sw.f] 116$sw setwidget $sf 117set uf [$sf getframe] 118 119 120 121set w $uf 122set fra [frame $w.frame -borderwidth 0] 123pack $fra -anchor w -fill both 124 125#------------------------------------------------ 126 127set theframe $fra 128 129#adding 15.06.2005 130set topflabel [frame $theframe.topflabel] 131set titf1label [TitleFrame $topflabel.titflabel1 -text "Objects Browser" -font $gedFont] 132set titf1axes [TitleFrame $topflabel.titfaxes1 -text "Object Properties" -font $gedFont] 133 134set w [$titf1label getframe] 135 136pack $titf1label -padx 4 -side left -fill both -expand yes 137pack $topflabel -fill x -pady 0 138pack $titf1axes -pady 0 -padx 4 -fill both -expand yes 139 140frame $w.frame -borderwidth 0 141pack $w.frame -anchor w -fill both 142#end adding 143 144 145set wfortree $w 146 147for {set i 1} {$i<=$ged_handle_list_size} {incr i} { 148 set OBJECTSARRAY($i) $SELOBJECT($i) 149} 150 151set curgedobject $SELOBJECT($curgedindex) 152 153set tree [Tree $wfortree.tree \ 154 -yscrollcommand {$wfortree.y set} -xscrollcommand {$wfortree.x set} \ 155 -width 20 -height 10 \ 156 -background white -opencmd {LemonTree::open $wfortree.tree} \ 157 -selectbackground blue -selectforeground white ] 158 159pack [scrollbar $wfortree.x -orient horiz -command {$wfortree.tree xview}] -side bottom -fill x 160pack [scrollbar $wfortree.y -command {$wfortree.tree yview}] -side right -fill y 161pack $tree -fill both -expand 1 -side left 162 163$tree bindText <1> {LemonTree::Info $tree} 164$tree bindImage <1> {LemonTree::Info $tree} 165 166LemonTree::add $tree root FIGURE currentfigure "Figure(1)" 167 168# I open the tree to browse all the nodes (to know what nodes I have and what their names are) 169$tree opentree n1 170 171set allnodes [$tree selection get] 172 173#I close quickly the tree because openreeatnode expanded the tree... 174$tree closetree n1 175 176 177# I directly point onto the current curgedobject (current Axes or Figure or picked entity) 178LemonTree::finddata $tree $allnodes $curgedobject 179 180 181#adding 15.06.2005 182set w [$titf1axes getframe] 183 184set uf $w 185#------------------------------------------------ 186 187set largeur 14 188 189Notebook:create $uf.n -pages {Style Data Clipping} -pad 0 -height $NBheight -width $NBwidth 190pack $uf.n -in $uf -fill both -expand 1 191 192########### Style onglet ########################################## 193################################################################### 194set w [Notebook:frame $uf.n Style] 195 196frame $w.frame -borderwidth 0 197pack $w.frame -anchor w -fill both 198 199#visibility 200frame $w.frame.vis -borderwidth 0 201pack $w.frame.vis -in $w.frame -side top -fill x 202label $w.frame.vislabel -text "Visibility:" -font $gedFont -anchor e -width $largeur 203checkbutton $w.frame.visib -text "on"\ 204 -variable curvis -onvalue "on" -offvalue "off" \ 205 -command "toggleVis $w.frame.visib" -font $gedFont 206OnOffForeground $w.frame.visib $curvis 207 208pack $w.frame.vislabel -in $w.frame.vis -side left 209pack $w.frame.visib -in $w.frame.vis -side left -fill x -padx $smallPad 210 211#Line mode 212frame $w.frame.linelinemode -borderwidth 0 213pack $w.frame.linelinemode -in $w.frame -side top -fill x 214 215label $w.frame.linemodelabel -height 0 -text "Line mode:" -font $gedFont -anchor e -width $largeur 216checkbutton $w.frame.linemode -text "on" -indicatoron 1 \ 217 -variable curlinemode -onvalue "on" -offvalue "off" \ 218 -command "toggleLinemode $w.frame.linemode" -font $gedFont 219OnOffForeground $w.frame.linemode $curlinemode 220 221pack $w.frame.linemodelabel -in $w.frame.linelinemode -side left 222pack $w.frame.linemode -in $w.frame.linelinemode -side left -fill x -pady 0 -padx $smallPad 223 224#Fill mode 225frame $w.frame.linefillmode -borderwidth 0 226pack $w.frame.linefillmode -in $w.frame -side top -fill x 227 228label $w.frame.fillmodelabel -height 0 -text "Fill mode:" -width 0 -font $gedFont -anchor e -width $largeur 229checkbutton $w.frame.fillmode -text "on" -indicatoron 1 \ 230 -variable curfillmode -onvalue "on" -offvalue "off" \ 231 -command "toggleFill $w.frame.fillmode" -font $gedFont 232OnOffForeground $w.frame.fillmode $curfillmode 233 234pack $w.frame.fillmodelabel -in $w.frame.linefillmode -side left 235pack $w.frame.fillmode -in $w.frame.linefillmode -side left -fill x -pady 0 -padx $smallPad 236 237#Line Style 238frame $w.frame.rectst -borderwidth 0 239pack $w.frame.rectst -in $w.frame -side top -fill x 240 241label $w.frame.stylelabel -height 0 -text "Line:" -width 0 -font $gedFont -anchor e -width $largeur 242combobox $w.frame.style \ 243 -borderwidth 1 \ 244 -highlightthickness 1 \ 245 -maxheight 0 \ 246 -width 14 \ 247 -textvariable curlinestyle \ 248 -editable false \ 249 -command [list SelectLineStyle ] -font $gedFont 250eval $w.frame.style list insert end [list "solid" "dash" "dash dot" "longdash dot" "bigdash dot" "bigdash longdash" "dot" "double dot"] 251 252#Add thickness here 253combobox $w.frame.thickness \ 254 -borderwidth 1 \ 255 -highlightthickness 1 \ 256 -maxheight 0 \ 257 -width 3 \ 258 -textvariable curthick \ 259 -editable true \ 260 -command [list SelectThickness ] -font $gedFont 261eval $w.frame.thickness list insert end [list "0.0" "1.0" "2.0" "3.0" "4.0" "5.0" "6.0" "8.0" "10.0"] 262 263pack $w.frame.stylelabel -in $w.frame.rectst -side left 264pack $w.frame.style -in $w.frame.rectst -side left -padx $mediumPad 265pack $w.frame.thickness -in $w.frame.rectst -expand 1 -fill x -pady 0 -padx 0 266 267#Color scale 268frame $w.frame.clrf -borderwidth 0 269pack $w.frame.clrf -in $w.frame -side top -fill x 270 271label $w.frame.colorlabel -height 0 -text "Foreground:" -width 0 -font $gedFont -anchor e -width $largeur 272# -foreground $color 273scale $w.frame.color -orient horizontal -from -2 -to $ncolors \ 274 -resolution 1.0 -command "setColor $w.frame.color" -tickinterval 0 -font $gedFont 275 276pack $w.frame.colorlabel -in $w.frame.clrf -side left 277pack $w.frame.color -in $w.frame.clrf -side left -expand 1 -fill x -pady 0 -padx $smallPad 278$w.frame.color set $curcolor 279 280 281#Background scale (line) 282frame $w.frame.backg -borderwidth 0 283pack $w.frame.backg -in $w.frame -side top -fill x 284 285label $w.frame.backlabel -height 0 -text "Background:" -font $gedFont -anchor e -width $largeur 286# -foreground $back 287scale $w.frame.back -orient horizontal -from -2 -to $ncolors \ 288 -resolution 1.0 -command "setBack $w.frame.back" -tickinterval 0 -font $gedFont 289 290pack $w.frame.backlabel -in $w.frame.backg -side left 291pack $w.frame.back -in $w.frame.backg -side left -expand 1 -fill x -pady 0 -padx $smallPad 292$w.frame.back set $curback 293 294 295#sep bar 296frame $w.sep -height 2 -borderwidth 1 -relief sunken 297pack $w.sep -fill both 298 299#exit button 300button $w.buttons -text Quit -command "destroy $ww" -font $gedFont 301pack $w.buttons -side bottom 302 303 304 305########### Data onglet ########################################### 306################################################################### 307set w [Notebook:frame $uf.n Data] 308 309frame $w.frame -borderwidth 0 310pack $w.frame -anchor w -fill both 311 312#x 313frame $w.frame.lb1 -borderwidth 0 314pack $w.frame.lb1 -in $w.frame -side top -fill x 315label $w.frame.labelul -text "Upper-left point coordinates:" -font $gedFont 316pack $w.frame.labelul -in $w.frame.lb1 -side left 317 318frame $w.frame.lb2 -borderwidth 0 319pack $w.frame.lb2 -in $w.frame -side top -fill x 320 321frame $w.frame.lb21 -borderwidth 0 322pack $w.frame.lb21 -in $w.frame -side top -fill x 323 324frame $w.frame.lb22 -borderwidth 0 325pack $w.frame.lb22 -in $w.frame -side top -fill x 326 327label $w.frame.labelx -text "X:" -font $gedFont -anchor e -width $largeur 328entry $w.frame.datax -relief sunken -textvariable Xval -width 10 -font $gedFont 329label $w.frame.labely -text "Y:" -font $gedFont -anchor e -width $largeur 330entry $w.frame.datay -relief sunken -textvariable Yval -width 10 -font $gedFont 331label $w.frame.labelz -text "Z:" -font $gedFont -anchor e -width $largeur 332entry $w.frame.dataz -relief sunken -textvariable Zval -width 10 -font $gedFont 333 334pack $w.frame.labelx -in $w.frame.lb2 -side left 335pack $w.frame.datax -in $w.frame.lb2 -side left -fill x -pady 0 -padx $mediumPad 336pack $w.frame.labely -in $w.frame.lb21 -side left 337pack $w.frame.datay -in $w.frame.lb21 -side left -fill x -pady 0 -padx $mediumPad 338pack $w.frame.labelz -in $w.frame.lb22 -side left 339pack $w.frame.dataz -in $w.frame.lb22 -side left -fill x -pady 0 -padx $mediumPad 340bind $w.frame.datax <Return> {SelectXval} 341bind $w.frame.datay <Return> {SelectYval} 342bind $w.frame.dataz <Return> {SelectZval} 343bind $w.frame.datax <KP_Enter> {SelectXval} 344bind $w.frame.datay <KP_Enter> {SelectYval} 345bind $w.frame.dataz <KP_Enter> {SelectZval} 346bind $w.frame.datax <FocusOut> {SelectXval} 347bind $w.frame.datay <FocusOut> {SelectYval} 348bind $w.frame.dataz <FocusOut> {SelectZval} 349 350#----------------------------# 351frame $w.frame.lb3 -borderwidth 0 352pack $w.frame.lb3 -in $w.frame -side top -fill x 353label $w.frame.labelwh -text "Width and height:" -font $gedFont 354pack $w.frame.labelwh -in $w.frame.lb3 -side left 355 356frame $w.frame.lb4 -borderwidth 0 357pack $w.frame.lb4 -in $w.frame -side top -fill x 358 359frame $w.frame.lb41 -borderwidth 0 360pack $w.frame.lb41 -in $w.frame -side top -fill x 361 362label $w.frame.labelw -text "W:" -font $gedFont -anchor e -width $largeur 363entry $w.frame.dataw -relief sunken -textvariable Wval -width 10 -font $gedFont 364label $w.frame.labelh -text "H:" -font $gedFont -anchor e -width $largeur 365entry $w.frame.datah -relief sunken -textvariable Hval -width 10 -font $gedFont 366 367pack $w.frame.labelw -in $w.frame.lb4 -side left 368pack $w.frame.dataw -in $w.frame.lb4 -side left -fill x -pady 0 -padx $mediumPad 369pack $w.frame.labelh -in $w.frame.lb41 -side left 370pack $w.frame.datah -in $w.frame.lb41 -side left -fill x -pady 0 -padx $mediumPad 371bind $w.frame.dataw <Return> {SelectWval} 372bind $w.frame.datah <Return> {SelectHval} 373bind $w.frame.dataw <KP_Enter> {SelectWval} 374bind $w.frame.datah <KP_Enter> {SelectHval} 375bind $w.frame.dataw <FocusOut> {SelectWval} 376bind $w.frame.datah <FocusOut> {SelectHval} 377 378 379 380#----------------------------# 381#a1 and a2 parameters: 382frame $w.frame.lb5 -borderwidth 0 383pack $w.frame.lb5 -in $w.frame -side top -fill x 384label $w.frame.labela1a2 -text "a1 and a2 values:" -font $gedFont 385pack $w.frame.labela1a2 -in $w.frame.lb5 -side left 386 387frame $w.frame.lb6 -borderwidth 0 388pack $w.frame.lb6 -in $w.frame -side top -fill x 389 390frame $w.frame.lb61 -borderwidth 0 391pack $w.frame.lb61 -in $w.frame -side top -fill x 392 393label $w.frame.labela1 -text "a1:" -font $gedFont -anchor e -width $largeur 394entry $w.frame.dataa1 -relief sunken -textvariable A1val -width 10 -font $gedFont 395label $w.frame.labela2 -text "a2:" -font $gedFont -anchor e -width $largeur 396entry $w.frame.dataa2 -relief sunken -textvariable A2val -width 10 -font $gedFont 397 398 399pack $w.frame.labela1 -in $w.frame.lb6 -side left 400pack $w.frame.dataa1 -in $w.frame.lb6 -side left -fill x -pady 0 -padx $mediumPad 401pack $w.frame.labela2 -in $w.frame.lb61 -side left 402pack $w.frame.dataa2 -in $w.frame.lb61 -side left -fill x -pady $smallPad -padx $mediumPad 403bind $w.frame.dataa1 <Return> {SelectA1val} 404bind $w.frame.dataa2 <Return> {SelectA2val} 405bind $w.frame.dataa1 <KP_Enter> {SelectA1val} 406bind $w.frame.dataa2 <KP_Enter> {SelectA2val} 407bind $w.frame.dataa1 <FocusOut> {SelectA1val} 408bind $w.frame.dataa2 <FocusOut> {SelectA2val} 409 410 411 412#sep bar 413frame $w.sep -height 2 -borderwidth 1 -relief sunken 414pack $w.sep -fill both 415 416#exit button 417frame $w.buttons 418button $w.b -text Quit -command "destroy $ww" -font $gedFont 419pack $w.b -side bottom 420 421 422########### Clipping onglet ####################################### 423################################################################### 424 425set w9 [Notebook:frame $uf.n Clipping] 426 427frame $w9.frame -borderwidth 0 428pack $w9.frame -anchor w -fill both 429 430set letext "" 431 432#Clip state 433#frame $w9.frame.clpwarning -borderwidth 0 434 435frame $w9.frame.clpstat -borderwidth 0 436pack $w9.frame.clpstat -in $w9.frame -side top -fill x -pady 0 437 438label $w9.frame.cliplabel -height 0 -text "Clip state:" -width 0 -font $gedFont -anchor e -width $largeur 439combobox $w9.frame.clip \ 440 -borderwidth 1 \ 441 -highlightthickness 1 \ 442 -maxheight 0 \ 443 -width 8 \ 444 -textvariable curclipstate\ 445 -editable false \ 446 -command [list SelectClipState ] -font $gedFont 447eval $w9.frame.clip list insert end [list "on" "off" "clipgrf"] 448 449pack $w9.frame.cliplabel -in $w9.frame.clpstat -side left 450pack $w9.frame.clip -in $w9.frame.clpstat -side left -pady 0 -padx $mediumPad 451 452#clip box 453frame $w9.frame.lb1 -borderwidth 0 454pack $w9.frame.lb1 -in $w9.frame -side top -fill x 455label $w9.frame.labelul -text "Clip box : upper-left point coordinates" -font $gedFont 456pack $w9.frame.labelul -in $w9.frame.lb1 -side left 457 458frame $w9.frame.lb2 -borderwidth 0 459pack $w9.frame.lb2 -in $w9.frame -side top -fill x 460 461frame $w9.frame.lb21 -borderwidth 0 462pack $w9.frame.lb21 -in $w9.frame -side top -fill x 463 464frame $w9.frame.lb22 -borderwidth 0 465pack $w9.frame.lb22 -in $w9.frame -side top -fill x 466 467label $w9.frame.labelx -text "X:" -font $gedFont -anchor e -width $largeur 468entry $w9.frame.datax -relief sunken -textvariable Xclipbox -width 10 -font $gedFont 469label $w9.frame.labely -text "Y:" -font $gedFont -anchor e -width $largeur 470entry $w9.frame.datay -relief sunken -textvariable Yclipbox -width 10 -font $gedFont 471 472pack $w9.frame.labelx -in $w9.frame.lb2 -side left 473pack $w9.frame.datax -in $w9.frame.lb2 -side left -pady 0 -padx $mediumPad 474pack $w9.frame.labely -in $w9.frame.lb21 -side left 475pack $w9.frame.datay -in $w9.frame.lb21 -side left -pady 0 -padx $mediumPad 476bind $w9.frame.datax <Return> "SelectClipBox $w9.frame" 477bind $w9.frame.datay <Return> "SelectClipBox $w9.frame" 478bind $w9.frame.datax <KP_Enter> "SelectClipBox $w9.frame" 479bind $w9.frame.datay <KP_Enter> "SelectClipBox $w9.frame" 480 481#----------------------------# 482frame $w9.frame.lb3 -borderwidth 0 483pack $w9.frame.lb3 -in $w9.frame -side top -fill x 484label $w9.frame.labelwh -text "Clip box : width and height" -font $gedFont 485pack $w9.frame.labelwh -in $w9.frame.lb3 -side left 486 487frame $w9.frame.lb4 -borderwidth 0 488pack $w9.frame.lb4 -in $w9.frame -side top -fill x 489 490frame $w9.frame.lb41 -borderwidth 0 491pack $w9.frame.lb41 -in $w9.frame -side top -fill x 492 493label $w9.frame.labelw -text "W:" -font $gedFont -anchor e -width $largeur 494entry $w9.frame.dataw -relief sunken -textvariable Wclipbox -width 10 -font $gedFont 495label $w9.frame.labelh -text "H:" -font $gedFont -anchor e -width $largeur 496entry $w9.frame.datah -relief sunken -textvariable Hclipbox -width 10 -font $gedFont 497 498pack $w9.frame.labelw -in $w9.frame.lb4 -side left 499pack $w9.frame.dataw -in $w9.frame.lb4 -side left -pady 0 -padx $mediumPad 500pack $w9.frame.labelh -in $w9.frame.lb41 -side left 501pack $w9.frame.datah -in $w9.frame.lb41 -side left -pady 0 -padx $mediumPad 502bind $w9.frame.dataw <Return> "SelectClipBox $w9.frame" 503bind $w9.frame.datah <Return> "SelectClipBox $w9.frame" 504bind $w9.frame.dataw <KP_Enter> "SelectClipBox $w9.frame" 505bind $w9.frame.datah <KP_Enter> "SelectClipBox $w9.frame" 506 507 508frame $w9.frame.warning 509label $w9.frame.mesgwarning -justify left -textvariable letext -font $gedFont 510$w9.frame.mesgwarning config -foreground red 511pack $w9.frame.mesgwarning -in $w9.frame.warning 512pack $w9.frame.warning -in $w9.frame 513 514#sep bar 515frame $w9.sep -height 2 -borderwidth 1 -relief sunken 516pack $w9.sep -fill both 517 518 519#exit button 520frame $w9.buttons 521button $w9.b -text Quit -command "DestroyGlobals; destroy $ww" -font $gedFont 522pack $w9.b -side bottom 523 524 525 526pack $sw $pw1 -fill both -expand yes 527pack $titf1 -padx 4 -side left -fill both -expand yes 528pack $topf -fill both -pady 2 -expand yes 529 530 531#proc associes 532proc toggleVis { frame } { 533 global curvis 534 ScilabEval "global ged_handle;ged_handle.visible='$curvis'" 535 536 OnOffForeground $frame $curvis 537} 538 539proc toggleLinemode { frame } { 540 global curlinemode 541 ScilabEval "global ged_handle;ged_handle.line_mode='$curlinemode'" 542 543 OnOffForeground $frame $curlinemode 544} 545 546proc toggleFillmode { frame } { 547 global curfillmode 548 ScilabEval "global ged_handle;ged_handle.fill_mode='$curfillmode'" 549 550 OnOffForeground $frame $curfillmode 551} 552 553proc SelectLineStyle {w args} { 554global curlinestyle 555ScilabEval "setLineStyle('$curlinestyle')" 556} 557 558 559proc SelectThickness {w args} { 560 global curthick 561 ScilabEval "global ged_handle;ged_handle.thickness=$curthick;" 562} 563 564 565proc setColor {w index} { 566 global RED BLUE GREEN 567 variable REDCOL 568 variable GRECOL 569 variable BLUCOL 570 571 #ScilabEval "global ged_handle;" 572 if { $index == -2 } { 573 ScilabEval "global ged_handle; if ged_handle.foreground <> $index then ged_handle.foreground=$index; end;" 574 #like $index==-2: display white color 575 set color [format \#%02x%02x%02x 255 255 255] 576 $w config -activebackground $color -troughcolor $color 577 } elseif { $index == -1 } { 578 ScilabEval "global ged_handle; if ged_handle.foreground <> $index then ged_handle.foreground=$index; end;" 579 #like $index==-1: display black color 580 set color [format \#%02x%02x%02x 0 0 0] 581 $w config -activebackground $color -troughcolor $color 582 } elseif { $index == 0 } { 583 ScilabEval "global ged_handle; if ged_handle.foreground <> $index then ged_handle.foreground=$index; end;" 584 #like $index==1: display first color 585 set REDCOL $RED(1) 586 set GRECOL $GREEN(1) 587 set BLUCOL $BLUE(1) 588 589 set color [format \#%02x%02x%02x [expr int($REDCOL*255)] [expr int($GRECOL*255)] [expr int($BLUCOL*255)]] 590 591 $w config -activebackground $color -troughcolor $color 592 } else { 593 ScilabEval "global ged_handle; if ged_handle.foreground <> $index then ged_handle.foreground=$index; end;" 594 595 set REDCOL $RED($index) 596 set GRECOL $GREEN($index) 597 set BLUCOL $BLUE($index) 598 599 set color [format \#%02x%02x%02x [expr int($REDCOL*255)] [expr int($GRECOL*255)] [expr int($BLUCOL*255)]] 600 601 $w config -activebackground $color -troughcolor $color 602 603 } 604} 605 606 607proc setBack {w index} { 608 global RED BLUE GREEN 609 variable REDCOL 610 variable GRECOL 611 variable BLUCOL 612 613 #ScilabEval "global ged_handle;" 614 if { $index == -2 } { 615 ScilabEval "global ged_handle; if ged_handle.background <> $index then ged_handle.background=$index; end;" 616 #like $index==-2: display white color 617 set color [format \#%02x%02x%02x 255 255 255] 618 $w config -activebackground $color -troughcolor $color 619 } elseif { $index == -1 } { 620 ScilabEval "global ged_handle; if ged_handle.background <> $index then ged_handle.background=$index; end;" 621 #like $index==-1: display black color 622 set color [format \#%02x%02x%02x 0 0 0] 623 $w config -activebackground $color -troughcolor $color 624 } elseif { $index == 0 } { 625 ScilabEval "global ged_handle; if ged_handle.background <> $index then ged_handle.background=$index; end;" 626 #like $index==1: display first color 627 set REDCOL $RED(1) 628 set GRECOL $GREEN(1) 629 set BLUCOL $BLUE(1) 630 631 set color [format \#%02x%02x%02x [expr int($REDCOL*255)] [expr int($GRECOL*255)] [expr int($BLUCOL*255)]] 632 633 $w config -activebackground $color -troughcolor $color 634 } else { 635 ScilabEval "global ged_handle; if ged_handle.background <> $index then ged_handle.background=$index; end;" 636 637 set REDCOL $RED($index) 638 set GRECOL $GREEN($index) 639 set BLUCOL $BLUE($index) 640 641 set color [format \#%02x%02x%02x [expr int($REDCOL*255)] [expr int($GRECOL*255)] [expr int($BLUCOL*255)]] 642 643 $w config -activebackground $color -troughcolor $color 644 645 } 646} 647 648 649 650proc toggleFill { frame } { 651 global curfillmode 652 ScilabEval "global ged_handle;ged_handle.fill_mode='$curfillmode'" 653 654 OnOffForeground $frame $curfillmode 655} 656 657 658proc setThickness {w thick} { 659ScilabEval "global ged_handle;if ged_handle.thickness <> $thick then ged_handle.thickness=$thick; end;" 660} 661 662 663 664 665proc SelectXval {} { 666global Xval 667ScilabEval "setXval($Xval)" 668} 669 670 671proc SelectYval {} { 672global Yval 673ScilabEval "setYval($Yval)" 674} 675 676 677proc SelectZval {} { 678global Zval 679ScilabEval "setZval($Zval)" 680} 681 682 683 684proc SelectWval {} { 685global Wval 686ScilabEval "setWval($Wval)" 687} 688 689 690 691proc SelectHval {} { 692global Hval 693ScilabEval "setHval($Hval)" 694} 695 696 697 698proc SelectA1val {} { 699global A1val 700ScilabEval "setA1val($A1val)" 701} 702 703 704 705proc SelectA2val {} { 706global A2val 707ScilabEval "setA2val($A2val)" 708} 709 710 711 712 713 714 715 716#Clipping proc for all entities (clip box and clip state fields) 717proc SelectClipBox { w } { 718 global Xclipbox Yclipbox Wclipbox Hclipbox curclipstate letext 719 if { ($Xclipbox == "") || ($Yclipbox == "") || 720 ($Wclipbox == "") || ($Hclipbox == "") } { 721 if { [info exists text] } { 722 unset text 723 } 724 set letext "Note that all clip box fields must be filled." 725 726 } else { 727 if { [info exists text] } { 728 unset text 729 } 730 set letext "" 731 732 ScilabEval "global ged_handle;ged_handle.clip_box=\[$Xclipbox $Yclipbox $Wclipbox $Hclipbox\]" 733 set curclipstate "on" 734 } 735} 736 737proc SelectClipState {w args} { 738global curclipstate Xclipbox Yclipbox Wclipbox Hclipbox 739global old_Xclipbox old_Yclipbox old_Wclipbox old_Hclipbox 740ScilabEval "global ged_handle;ged_handle.clip_state='$curclipstate';" 741 if { $curclipstate == "off" } { 742 set old_Xclipbox $Xclipbox 743 set old_Yclipbox $Yclipbox 744 set old_Wclipbox $Wclipbox 745 set old_Hclipbox $Hclipbox 746 set Xclipbox "" 747 set Yclipbox "" 748 set Wclipbox "" 749 set Hclipbox "" 750 } else { 751 set Xclipbox $old_Xclipbox 752 set Yclipbox $old_Yclipbox 753 set Wclipbox $old_Wclipbox 754 set Hclipbox $old_Hclipbox 755 } 756} 757 758 759proc SavePreferences { } { 760 global ged_listofpref 761 global envSCIHOME MAIN_WINDOW_POSITION TICK_WINDOW_POSITION 762 global ww msdos 763 764 ScilabEval "DestroyGlobals()" "seq" 765 766 if { $msdos == "F" } { 767#unix mandrake (at least) needs this offset 768#test other unix distribution to see (red hat, suse...) 769 set xoffset -5 770 set yoffset -26 771 } else { 772 set xoffset 0 773 set yoffset 0 774 } 775 776 set x [eval {winfo x $ww}] 777 set y [eval {winfo y $ww}] 778 set MAIN_WINDOW_POSITION "+[expr $x+$xoffset]+[expr $y+$yoffset]" 779 780 #save preferences (position...) 781 set preffilename [file join $envSCIHOME .GedPreferences.tcl] 782 catch { 783 set preffile [open $preffilename w] 784 foreach opt $ged_listofpref { 785 global $opt 786 puts $preffile [concat "set $opt " [set $opt]] 787 # puts [concat "set $opt" [set $opt]] 788 } 789 close $preffile 790 } 791} 792 793proc DestroyGlobals { } { 794 ScilabEval "DestroyGlobals()" "seq" 795 796 SavePreferences 797} 798 799