📄 xgdialogs250.tcl
字号:
global rescaleZMax global rescaleAutoZ global rescaleZType global rescaleWindowPath set Window $rescaleWindowPath if { $type == "new" } { C_Rescale $WinData($Window,index) $rescaleXMin $rescaleXMax \ $rescaleAutoX $rescaleXType $rescaleYMin $rescaleYMax \ $rescaleAutoY $rescaleYType $rescaleZMin $rescaleZMax \ $rescaleAutoZ $rescaleZType } else { C_Rescale $WinData($Window,index) $WinData($Window,xMin) \ $WinData($Window,xMax) $WinData($Window,xAuto) \ $WinData($Window,xLinLog) $WinData($Window,yMin) \ $WinData($Window,yMax) $WinData($Window,yAuto) \ $WinData($Window,yLinLog) $WinData($Window,zMin) \ $WinData($Window,zMax) $WinData($Window,zAuto) \ $WinData($Window,zLinLog) }}###################################################################### Pops up the Dialog Box and grabs the focus, stopping if necessaryproc PopupRescale { Window } \{ global WaitVariable global WinData global ThreeD global rescaleTitle global rescaleWindowPath global WasRunning global VectorD set rescaleTitle $WinData($Window,title) set rescaleWindowPath $Window GetRanges $rescaleWindowPath.bframe.rescale configure -relief sunken if { $WinData($Window,type) != $ThreeD } { set RescalePath .2drescaledialog } else { set RescalePath .3drescaledialog } if { $WasRunning == 1 } { C_Stop } if { $WinData($Window,type) == $VectorD } { pack forget $RescalePath.xaxis.linlog $RescalePath.yaxis.linlog update idletasks } wm deiconify $RescalePath focus $RescalePath.xaxis.xmax.entry grab set $RescalePath if { $WasRunning == 1 } { set WaitVariable 0 tkwait variable WaitVariable if { $WaitVariable == 1 } { C_Run } }}######################### The Print Dialog Boxproc CreatePrintDialog { } \{ global WinData global WaitVariable global XGrafixIcon global defaultDialogBoxGeometry global printType global printMode global printTitle global printFile global printPlotTitle global printPeriod global printLimit set PSPath .printdialog toplevel $PSPath wm withdraw $PSPath wm title $PSPath "Print Dialog Box" wm iconbitmap $PSPath $XGrafixIcon wm geometry $PSPath $defaultDialogBoxGeometry wm minsize $PSPath 193 204 label $PSPath.label -relief raised -textvariable printTitle pack $PSPath.label -fill x -ipady 3 frame $PSPath.middle -relief raised -bd 2 ############ # The menus frame $PSPath.top menubutton $PSPath.top.type -text "File Type" -menu \ $PSPath.top.type.menu -relief raised menu $PSPath.top.type.menu $PSPath.top.type.menu add radiobutton -selectcolor red -label "EPS" \ -value eps -variable printType -command { ChangeFileTo PS } $PSPath.top.type.menu add radiobutton -selectcolor red -label "XPM" \ -value xpm -variable printType -command { ChangeFileTo XPM } $PSPath.top.type.menu add radiobutton -selectcolor red -label "PNG" \ -value png -variable printType -command { ChangeFileTo PNG } $PSPath.top.type.menu add radiobutton -selectcolor red -label "GIF" \ -value gif -variable printType -command { ChangeFileTo GIF } $PSPath.top.type.menu add radiobutton -selectcolor red -label "ASCII" \ -value ascii -variable printType -command { ChangeFileTo ASCII } $PSPath.top.type.menu add radiobutton -selectcolor red -label "XGBIN" \ -value bxg -variable printType -command { ChangeFileTo XGBIN } menubutton $PSPath.top.mode -text "Print Mode" -menu \ $PSPath.top.mode.menu -relief raised menu $PSPath.top.mode.menu $PSPath.top.mode.menu add radiobutton -selectcolor red -label "Overwrite" \ -value overwrite -variable printMode $PSPath.top.mode.menu add radiobutton -selectcolor red -label "Append" \ -value append -variable printMode $PSPath.top.mode.menu add radiobutton -selectcolor red -label "Increment" \ -value count -variable printMode label $PSPath.top.end -relief raised pack $PSPath.top.type $PSPath.top.mode -side left -ipadx 3 -ipady 3 pack $PSPath.top.end -fill both -expand true ############### # The entries frame $PSPath.middle.file label $PSPath.middle.file.label -width 10 -text "File name" \ -anchor w entry $PSPath.middle.file.entry -highlightthickness 0 -textvariable printFile \ -relief sunken -width 15 bind $PSPath.middle.file.entry <Control-KeyPress> { EntryControlProc \ %W %K; break } pack $PSPath.middle.file.label -side left pack $PSPath.middle.file.entry -side left -fill x -expand true frame $PSPath.middle.plot label $PSPath.middle.plot.label -width 10 -text "Plot title" \ -anchor w entry $PSPath.middle.plot.entry -highlightthickness 0 -textvariable printPlotTitle \ -relief sunken -width 15 bind $PSPath.middle.plot.entry <Control-KeyPress> { EntryControlProc \ %W %K; break } pack $PSPath.middle.plot.label -side left pack $PSPath.middle.plot.entry -side left -fill x -expand true frame $PSPath.middle.period label $PSPath.middle.period.label -width 10 -text "Print period" \ -anchor w entry $PSPath.middle.period.entry -highlightthickness 0 -textvariable printPeriod \ -relief sunken -width 15 bind $PSPath.middle.period.entry <Control-KeyPress> {EntryIntegerProc \ %W %K; break } pack $PSPath.middle.period.label -side left pack $PSPath.middle.period.entry -side left -fill x -expand true frame $PSPath.middle.limit label $PSPath.middle.limit.label -width 10 -text "Iterations" \ -anchor w entry $PSPath.middle.limit.entry -highlightthickness 0 -textvariable printLimit \ -relief sunken -width 15 bind $PSPath.middle.limit.entry <Control-KeyPress> { EntryIntegerProc \ %W %K; break } pack $PSPath.middle.limit.label -side left pack $PSPath.middle.limit.entry -side left -fill x -expand true pack $PSPath.middle.file $PSPath.middle.plot $PSPath.middle.period \ $PSPath.middle.limit -pady 3 -fill both -expand true ############################# # The Ok and Cancel buttons frame $PSPath.bottom -relief raised -bd 2 button $PSPath.bottom.apply button $PSPath.bottom.ok -padx 0 -pady 0 -highlightthickness 0 -text Ok -command \ [list PSButtonProc $PSPath ok ] button $PSPath.bottom.cancel -padx 0 -pady 0 -highlightthickness 0 -text Cancel -command \ [list PSButtonProc $PSPath cancel] pack $PSPath.bottom.cancel $PSPath.bottom.ok -side right -padx 3 \ -pady 3 -ipadx 3 pack $PSPath.top -fill x pack $PSPath.middle -fill both -expand true pack $PSPath.bottom -fill x ################################ # Key bindings for the entries MakeBindings $PSPath $PSPath.middle.file.entry \ $PSPath.middle.plot.entry "entry2entry" MakeBindings "" $PSPath.middle.plot.entry $PSPath.middle.period.entry \ "entry2entry" MakeBindings $PSPath $PSPath.middle.period.entry \ $PSPath.middle.limit.entry "entry2entry" MakeBindings "" $PSPath.middle.limit.entry $PSPath.middle.file.entry \ "entry2entry"}proc ChangeFileTo { type } \{ global printFile global printMode switch $type { "PS" { set extension ".eps" .printdialog.top.mode.menu entryconfigure 2 -state normal} "XPM" { set extension ".xpm" .printdialog.top.mode.menu entryconfigure 2 -state disabled if { $printMode == "append" } { set printMode count } } "PNG" { set extension ".png" .printdialog.top.mode.menu entryconfigure 2 -state disabled if { $printMode == "append" } { set printMode count } } "GIF" { set extension ".gif" .printdialog.top.mode.menu entryconfigure 2 -state disabled if { $printMode == "append" } { set printMode count } } "ASCII" { set extension ".txt" .printdialog.top.mode.menu entryconfigure 2 -state normal } "XGBIN" { set extension ".bxg" .printdialog.top.mode.menu entryconfigure 2 -state normal } } if { [set index [string last .eps $printFile]] == -1 } { if { [set index [string last .xpm $printFile]] == -1 } { if { [set index [string last .txt $printFile]] == -1} { if { [set index [string last .png $printFile]] == -1} { if { [set index [string last .gif $printFile]] == -1} { if { [set index [string last .bxg $printFile]] == -1} { append printFile $extension return } } } } } } set printFile [string range $printFile 0 [expr $index - 1]] append printFile $extension}proc PSButtonProc { path type } \{ global WaitVariable global WinData global printWindowPath global theCurrentStep set WaitVariable 1 wm withdraw $path grab release $path #focus .list.top.entry if { [string compare $type ok] == 0 } { set WinData($printWindowPath,printSetStep) $theCurrentStep SetPrint if { $WinData($printWindowPath,printPeriod) == 0 } { for {} {$WinData($printWindowPath,printLimit) > 0} \ {incr WinData($printWindowPath,printLimit) -1} { Print $printWindowPath } } } $printWindowPath.bframe.print configure -relief raised}######################################################## Pops up the print dialog box, stopping if necessaryproc PopupPrint { Window } \{ global WaitVariable global WinData global printTitle global printFile global printPlotTitle global printType global printMode global printPeriod global printLimit global printWindowPath global WasRunning set printTitle $WinData($Window,title) set printFile $WinData($Window,PSFile) set printPlotTitle $WinData($Window,plot_title) set printType $WinData($Window,printType) set printMode $WinData($Window,printMode) set printPeriod $WinData($Window,printPeriod) if { $WinData($Window,printLimit) < 1 } { set printLimit 1 } else { set printLimit $WinData($Window,printLimit) } set printWindowPath $Window $printWindowPath.bframe.print configure -relief sunken if { $WasRunning == 1 } { C_Stop } set PSPath .printdialog wm deiconify $PSPath focus $PSPath.middle.file.entry grab set $PSPath if { $WasRunning == 1 } { set WaitVariable 0 tkwait variable WaitVariable if { $WaitVariable == 1 } { C_Run } }}proc SetPrint {} \{ global WinData global printWindowPath global printFile global printPlotTitle global printType global printMode global printPeriod global printLimit set WinData($printWindowPath,PSFile) $printFile set WinData($printWindowPath,plot_title) $printPlotTitle set WinData($printWindowPath,printType) $printType set WinData($printWindowPath,printMode) $printMode set WinData($printWindowPath,printPeriod) $printPeriod set WinData($printWindowPath,printLimit) $printLimit}########################################### Calls a C procedure to do the printingproc Print { windowPath } \{ global WinData if { $WinData($windowPath,printMode) == "count" } { while { 1 } { set index [ string last . $WinData($windowPath,PSFile)] set fileName [ string range \ $WinData($windowPath,PSFile) 0 [expr $index-1]] append fileName "_" $WinData($windowPath,printNumber) \ [ string range $WinData($windowPath,PSFile) \ $index [string length \ $WinData($windowPath,PSFile)] ] incr WinData($windowPath,printNumber) if { [catch { open $fileName RDONLY }] == 1 } { break } } } else { set fileName $WinData($windowPath,PSFile) } C_Print $WinData($windowPath,index) $fileName \ $WinData($windowPath,plot_title) \ $WinData($windowPath,printType) \ $WinData($windowPath,printMode) \ [wm state $windowPath]}###################### The 3D Dialog Boxproc Create3dDialog { } \{ global WinData global WaitVariable global XGrafixIcon global defaultDialogBoxGeometry global 3dTitle global 3dTheta global 3dPhi global 3dShading global 3dColor global 3dGrid set 3dPath .3ddialog toplevel $3dPath wm withdraw $3dPath wm title $3dPath "3DView Dialog Box" wm iconbitmap $3dPath $XGrafixIcon wm geometry $3dPath $defaultDialogBoxGeometry wm minsize $3dPath 174 204 label $3dPath.label -relief raised -textvariable 3dTitle pack $3dPath.label -fill x -ipady 3 ############### # The entries frame $3dPath.middle -relief raised -bd 2 frame $3dPath.middle.theta label $3dPath.middle.theta.label -text theta -width 10 -anchor w entry $3dPath.middle.theta.entry -highlightthickness 0 -relief sunken -width 12 \ -textvariable 3dTheta bind $3dPath.middle.theta.entry <KeyPress> { EntryFloatProc %W %K; break } bind $3dPath.middle.theta.entry <Control-KeyPress> { EntryControlProc \ %W %K; break } pack $3dPath.middle.theta.label -side left pack $3dPath.middle.theta.entry -side left -fill x -expand true frame $3dPath.middle.phi label $3dPath.middle.phi.label -text phi -width 10 -anchor w entry $3dPath.middle.phi.entry -highlightthickness 0 -relief sunken -width 12 \ -textvariable 3dPhi bind $3dPath.middle.phi.entry <KeyPress> { EntryFloatProc %W %K; break } bind $3dPath.middle.phi.entry <Control-KeyPress> { EntryControlProc \ %W %K; break } pack $3dPath.middle.phi.label -side left pack $3dPath.middle.phi.entry -side left -fill x -expand true ############# # The buttons frame $3dPath.middle.shading label $3dPath.middle.shading.label -text Shading -width 10 \ -anchor w button $3dPath.middle.shading.button -padx 0 -pady 0 -highlightthickness 0 -text On -width 12 \ -command "ToggleButton $3dPath.middle.shading.button \ 3dShading On Off" pack $3dPath.middle.shading.label -side left pack $3dPath.middle.shading.button -side left -fill both -expand true frame $3dPath.middle.color label $3dPath.middle.color.label -text "Color Code" -width 10 \ -anchor w button $3dPath.middle.color.button -padx 0 -pady 0 -highlightthickness 0 -text On -width 12 \ -command "ToggleButton $3dPath.middle.color.button \ 3dColor On Off" pack $3dPath.middle.color.label -side left pack $3dPath.middle.color.button -side left -fill both -expand true frame $3dPath.middle.grid label $3dPath.middle.grid.label -text Grid -width 10 \ -anchor w button $3dPath.middle.grid.button -padx 0 -pady 0 -highlightthickness 0 -text On -width 12 \ -command "ToggleButton $3dPath.middle.grid.button \ 3dGrid On Off" pack $3dPath.middle.grid.label -side left pack $3dPath.middle.grid.button -side left -fill both -expand true pack $3dPath.middle.theta $3dPath.middle.phi -pady 3 -fill x pack $3dPath.middle.shading $3dPath.middle.color $3dPath.middle.grid \ -pady 3 -fill both -expand true ############################# # The Ok and Cancel buttons frame $3dPath.bottom -relief raised -bd 2 button $3dPath.bottom.apply -padx 0 -pady 0 -highlightthickness 0 -text Apply -command { \ 3dView new set Changed 1 } button $3dPath.bottom.ok -padx 0 -pady 0 -highlightthickness 0 -text Ok -command " \ [list 3dButtonProc $3dPath new] " button $3dPath.bottom.cancel -padx 0 -pady 0 -highlightthickness 0 -text Cancel -command " \ [list 3dButtonProc $3dPath old] " pack $3dPath.bottom.cancel $3dPath.bottom.ok \ $3dPath.bottom.apply -side right -padx 3 -pady 3 -ipadx 3 pack $3dPath.middle -fill both -expand true pack $3dPath.bottom -fill x ################################################ # Key bindings for the entries and the buttons MakeBindings $3dPath $3dPath.middle.theta.entry \ $3dPath.middle.phi.entry "entry2entry" MakeBindings "" $3dPath.middle.phi.entry \ $3dPath.middle.shading.button "entry2button" MakeBindings $3dPath $3dPath.middle.shading.button \ $3dPath.middle.color.button "button2button" MakeBindings $3dPath $3dPath.middle.color.button \ $3dPath.middle.grid.button "button2button" MakeBindings "" $3dPath.middle.grid.button \ $3dPath.middle.theta.entry "button2entry"}proc 3dButtonProc { path type } \{ global WaitVariable global Changed global 3dWindowPath set WaitVariable 1 wm withdraw $path grab release $path #focus .list.top.entry if { [string compare $type new] == 0 } { Set3D
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -