# PANEL.GUI -- Test GUI for the frame and layout widgets. # This gui can be run as "cl> hello gui=panel.gui". reset-server appInitialize panel2 Panel2 { *objects:\ toplevel Layout panel \ panel Group viewBox \ panel Group enhancementBox \ panel Group blinkBox \ panel Group optionsBox \ panel Frame controlBox \ \ viewBox Layout view \ view Group frameSelect \ frameSelect Layout frame \ frame TextToggle frame1 \ frame TextToggle frame2 \ frame TextToggle frame3 \ frame TextToggle frame4 \ frame Command prevFrame \ frame Command nextFrame \ view Frame frameDataBox \ frameDataBox TextBox frameData \ view Group zoomBox \ zoomBox Layout zoom \ zoom TextButton toggleZoom \ zoom TextButton zoomIn \ zoom Command x1 \ zoom Command z2 \ zoom Command z3 \ zoom Command z4 \ zoom Command z5 \ zoom Command z8 \ zoom TextButton zoomOut \ zoom TextButton centerFrame \ zoom Command d2 \ zoom Command d3 \ zoom Command d4 \ zoom Command d5 \ zoom Command d8 \ view Layout viewButtons \ viewButtons Command clearFrame \ viewButtons Command flipX \ viewButtons Command flipY \ viewButtons Command flipXY \ viewButtons Command fitFrame \ \ enhancementBox Layout enhancement \ enhancement Scrollbar2 colorlistScroll \ enhancement Frame colorlistFrame \ colorlistFrame Porthole colorlistPort \ colorlistPort MultiList colorlist \ enhancement Frame colordataFrame \ colordataFrame TextBox colordata \ enhancement Label contrastLabel \ enhancement Slider2d contrastSlider \ enhancement Label brightnessLabel \ enhancement Slider2d brightnessSlider \ enhancement Command invertButton \ enhancement Command optimizeButton \ \ blinkBox Layout blink \ blink Label blinkFramesLabel \ blink Command blinkFrame1 \ blink Command blinkFrame2 \ blink Command blinkFrame3 \ blink Command blinkFrame4 \ blink Command blinkReset \ blink Label blinkRateLabel \ blink Frame BRframe \ BRframe Layout BRlayout \ BRlayout Arrow BRdecrease \ BRlayout TextBox BRtext \ BRlayout Arrow BRincrease \ blink Command registerButton \ blink Command matchButton \ blink Toggle blinkButton \ \ optionsBox TextToggle pannerButton \ optionsBox TextToggle coordsBoxButton \ optionsBox TextToggle autoscaleButton \ optionsBox TextToggle antialiasButton \ optionsBox TextToggle tileFramesButton \ optionsBox TextToggle warningsButton \ \ controlBox Layout control \ control Command initializeButton \ control Command normalizeButton \ control Command doneButton \ \ toplevel TransientShell warning \ warning Layout warn \ warn Frame warnFrame \ warnFrame Layout WFlayout \ WFlayout Icon warnIcon \ WFlayout TextBox warnText \ warn TextButton warnOk \ warn TextButton warnCancel \ warn TextButton warnHelp *background: gray *foreground: black *TextBox.background: gray60 *internalWidth: 0 *borderWidth: 0 *Command.highlightThickness: 0 *TextBox.font: 7x13bold *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 *Command.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 *zoom*Command.font: 7x13bold *blinkFrame1.font: 7x13bold *blinkFrame2.font: 7x13bold *blinkFrame3.font: 7x13bold *blinkFrame4.font: 7x13bold *panel.debug: False *panel.layout: vertical { \ 5 < -5 > \ horizontal { \ -1 \ viewBox < +inf -inf * > \ -1 \ } \ 5 < -5 > \ horizontal { \ -1 \ enhancementBox < +inf -inf * +inf -inf > \ -1 \ vertical { \ -1 \ blinkBox < * +inf -inf > \ -1 \ optionsBox < * +inf -inf > \ -1 \ } \ -1 \ } \ controlBox < +inf * > \ } ! VIEW ! ------------------ *viewBox.label: View *viewBox.location: 0 0 400 0 *viewBox.shrinkToFit: True *viewBox.outerOffset: 5 *view.debug: False *view.layout: vertical { \ 5 < +inf -5 > \ horizontal { \ -1 \ frameSelect \ -1 \ vertical { \ 5 < -5 > \ frameDataBox < +inff -100% * +inff -100% > \ 5 < -5 > \ } \ -1 \ zoomBox \ -1 \ } \ 1 < +inf > \ viewButtons < +inf -inf * +inf -inf > \ 5 < +inf -5 > \ } *frameDataBox.frameType: sunken *frameDataBox.frameWidth: 2 *frameData.width: 130 *frameData.height: 50 *frameData.label:\ -- Frame 1 --\nX center: 123.45\nY center: 345.67\nX scale: 4\nY scale: 4 *frameSelect.location: 0 0 72 0 *frameSelect.shrinkToFit: True *frameSelect.outerOffset: 5 *frameSelect.innerOffset: 5 *frameSelect.frameWidth: 2 *frameSelect*offIcon: diamond0s *frameSelect*onIcon: diamond1s *frameSelect*highlightColor: blue *frameSelect.label: Frame: *frame.debug: False *frame.layout: vertical { \ frame1 < +inf * > \ frame2 < +inf * > \ frame3 < +inf * > \ frame4 < +inf * > \ 10 < +inf -10 > \ horizontal { \ -1 \ prevFrame \ 10 < +inf -5 > \ nextFrame \ -1 \ } \ -1 \ } *frame*location: 0 0 10 20 *frame*alignment: left *frame*frameWidth: 0 *frame*highlightThickness: 0 *frame*frame1.label: \ 1\ \ *frame*frame2.label: \ 2\ \ *frame*frame3.label: \ 3\ \ *frame*frame4.label: \ 4\ \ *frame*Command.width: 24 *frame*prevFrame.label: xx *frame*nextFrame.label: xx *zoomBox.label: Zoom: *zoomBox.location: 0 0 160 127 *zoomBox.outerOffset: 5 *zoomBox.shrinkToFit: True *zoom.debug: False *zoom*internalWidth: 4 *zoom.layout: vertical { \ space = ((50% of width zoom) - (50% of width z5)) \ 1 < +inf > \ horizontal { \ vertical { \ toggleZoom < +inf * +inf > \ 2 \ } \ 2 \ vertical { \ 2 < +inf > \ z5 \ 1 < +inf > \ z3 \ 0 < +inf > \ } \ 2 \ vertical { \ zoomIn < +inf * +inf > \ 2 \ } \ } \ 1 < +inf > \ horizontal { \ 2 < +inf > \ d8 d4 d2 x1 z2 z4 z8 \ 2 < +inf > \ } \ 1 < +inf > \ horizontal { \ vertical { \ 2 \ zoomOut < +inf * +inf > \ } \ 2 \ vertical { \ 0 < +inf > \ d3 \ 1 < +inf > \ d5 \ 2 < +inf > \ } \ 2 \ vertical { \ 2 \ centerFrame < +inf * +inf > \ } \ } \ 1 < +inf > \ } *toggleZoom.label: Toggle\nZoom *toggleZoom.outerOffset: 0 *toggleZoom.width: 30 *toggleZoom.height: 25 *zoomIn.label: Zoom\nIn *zoomIn.outerOffset: 0 *zoomIn.width: 30 *zoomIn.height: 25 *x1.label: 1 *z2.label: 2 *z3.label: 3 *z4.label: 4 *z5.label: 5 *z8.label: 8 *zoomIn.foreground: royalBlue3 *z4.foreground: royalBlue3 *z5.foreground: royalBlue3 *z8.foreground: royalBlue3 *z2.foreground: royalBlue3 *z3.foreground: royalBlue3 *zoomOut.label: Zoom\nOut *zoomOut.outerOffset: 0 *zoomOut.width: 30 *zoomOut.height: 25 *centerFrame.label: Center *centerFrame.outerOffset: 0 *centerFrame.width: 30 *centerFrame.height: 25 *d2.label: 2 *d3.label: 3 *d4.label: 4 *d5.label: 5 *d8.label: 8 *zoomOut.foreground: mediumVioletRed *d2.foreground: mediumVioletRed *d3.foreground: mediumVioletRed *d4.foreground: mediumVioletRed *d5.foreground: mediumVioletRed *d8.foreground: mediumVioletRed *viewButtons.location: 0 0 100 80 *viewButtons.debug: False *viewButtons.layout: horizontal { \ 5 < -2 > \ flipX < +inf * > \ 5 < -2 > \ flipY < +inf * > \ 5 < -2 > \ flipXY < +inf * > \ 5 < -2 > \ clearFrame < +inf * > \ 5 < -2 > \ fitFrame < +inf * > \ 5 < -2 > \ } *nextFrame.label: Next Frame *prevFrame.label: Previous Frame *fitFrame.label: Fit Frame *clearFrame.label: Clear Frame *flipX.label: Flip X *flipY.label: Flip Y *flipXY.label: Flip XY ! ENHANCEMENT ! ------------------ *enhancementBox.label: Enhancement *enhancementBox.location: 0 0 100 0 *enhancementBox.shrinkToFit: True *enhancementBox.outerOffset: 5 *enhancement.debug: False *enhancement.layout: vertical { \ 3 < -3 > \ horizontal { \ 2 < -2 > \ colorlistScroll < * +inf -inf > \ -1 \ colorlistFrame < +inf -inf * +inf -inf > \ 2 < -2 > \ } \ -1 \ horizontal { \ 2 < -2 > \ colordataFrame < +inf -inf * +inf -inf > \ 2 < -2 > \ } \ 5 < -5 > \ horizontal { \ 2 < -2 > \ vertical { \ -1 \ contrastLabel \ 3 < -3 > \ brightnessLabel \ -1 \ } \ 3 < -3 > \ vertical { \ -1 \ contrastSlider < +inf -inf * > \ 3 < -3 > \ brightnessSlider < +inf -inf * > \ -1 \ } \ 2 < -2 > \ } \ 5 < -5 > \ horizontal { \ 3 < -3 > \ invertButton < +inf -inf * > \ 5 < -5 > \ optimizeButton < +inf -inf * > \ 3 < -3 > \ } \ 3 < -3 > \ } *enhancement*Minsize: 20 *enhancement*FrameType: sunken *enhancement*FrameWidth: 2 *enhancement*BorderWidth: 0 *enhancement*Label.ShadowWidth: 0 *enhancement*thumbColor: gray *colorlistScroll.location: 0 0 20 10 *colorlistScroll.vertical: True *colorlist.width: 100 *colorlist.height: 78 *colordata.width: 100 *colordata.height: 45 *enhancement*colordata.frameWidth: 0 *contrastLabel.label: x *contrastSlider.location: 0 0 100 20 *brightnessLabel.label: x *brightnessSlider.location: 0 0 100 20 *invertButton.label: Invert *optimizeButton.label: Optimize ! BLINK ! --------------------- *blinkBox.label: Blink *blinkBox.location: 0 0 230 0 *blinkBox.shrinkToFit: False *blinkBox.outerOffset: 5 *blink.debug: False *blink.layout: vertical { \ space = (width blinkFramesLabel - width blinkRateLabel) \ 3 < -3 > \ horizontal { \ 0 \ blinkFramesLabel \ 3 < +inf > \ blinkFrame1 < -50% * > \ blinkFrame2 < -50% * > \ blinkFrame3 < -50% * > \ blinkFrame4 < -50% * > \ 4 < +inf > \ blinkReset \ 2 \ } \ 5 < -5 > \ horizontal { \ $space \ blinkRateLabel \ 2 \ BRframe < +inf * > \ } \ 10 < +inf -100% > \ horizontal { \ 3 \ registerButton < +inf * > \ 5 < -5 > \ matchButton < +inf * > \ 5 < -5 > \ blinkButton < +inf * > \ 2 \ } \ 3 < -3 > \ } *BRlayout.layout: horizontal { \ BRdecrease \ BRtext < +inf -100% * > \ BRincrease \ } *blink.Label.borderWidth: 0 *blink.Label.shadowWidth: 0 *blink*internalWidth: 4 *blink*Arrow.background: gray60 *blink*Arrow.foreground: gray *blink*Arrow.width: 16 *blink*Arrow.height: 25 *blinkFramesLabel.label: Blink Frames: *blinkFrame1.label: 1 *blinkFrame2.label: 2 *blinkFrame3.label: 3 *blinkFrame4.label: 4 *blinkReset.label: Reset *blinkRateLabel.label: Blink Rate: *BRframe.frameType: sunken *BRframe.frameWidth: 2 *BRtext.width: 40 *BRtext.height: 25 *BRdecrease.direction: left *BRincrease.direction: right *registerButton.label: Register *matchButton.label: Match LUTs *blinkButton.label: Blink ! OPTIONS ! --------------------- *optionsBox.label: Options *optionsBox.location: 0 0 220 0 *optionsBox.shrinkToFit: False *optionsBox.outerOffset: 5 *optionsBox*offIcon: square0s *optionsBox*onIcon: square1s *optionsBox*selectionStyle: multi *optionsBox*highlightColor: yellow *optionsBox.TextToggle.location: 0 0 102 25 *optionsBox.TextToggle.frameWidth: 0 *optionsBox*alignment: left *pannerButton.label: Panner *coordsBoxButton.label: Coords Box *autoscaleButton.label: Autoscale *antialiasButton.label: Antialias *tileFramesButton.label: Tile Frames *warningsButton.label: Warnings ! CONTROL ! ---------------------- *controlBox.frameType: chiseled *controlBox.frameWidth: 2 *controlBox.outerOffset: 5 *controlBox.innerOffset: 5 *controlBox.height: 30 *control.debug: False *control.layout: horizontal { \ 1 \ initializeButton < +inf * > \ 5 < -5 > \ normalizeButton < +inf * > \ 80 < +inf -100% > \ doneButton < +inf * > \ 1 \ } *initializeButton.label: Initialize *normalizeButton.label: Normalize *doneButton.label: Done ! WARNING dialog. ! --------------------- *warning.geometry: +400+300 *warning*Layout.debug: False *warning*TextBox.frameWidth: 0 *warning*TextBox.background: gray *warning*TextButton.frameWidth: 2 *warning*TextButton.width: 40 *warning*TextButton.height: 25 *warn.layout: vertical { \ 5 < -5 > \ horizontal { \ 5 < -5 > \ warnFrame < +inf * +inf > \ 5 < -5 > \ } \ 1 < -1 > \ horizontal { \ 5 < -5 > \ warnOk < +inf * > \ 5 < +inf -5 > \ warnCancel < +inf * > \ 5 < +inf -5 > \ warnHelp < +inf * > \ 5 < -5 > \ } \ 1 < -1 > \ } *WFlayout.layout: horizontal { \ 5 < -5 > \ vertical { \ 5 < +inf -5 > \ warnIcon \ 5 < +inf -5 > \ } \ 5 < -5 > \ warnText < +inf -inf * +inf -inf > \ 5 < -5 > \ } *warnLabel.label: Warning *warnLabel.width: 280 *warnLabel.height: 20 *warnFrame.frameType: sunken *warnFrame.frameWidth: 2 *warnIcon.location: 0 0 40 40 *warnIcon.image: WARNING *warnText.label: generic warning text *warnText.width: 250 *warnText.height: 60 *warnOk.label: OK *warnCancel.label: Cancel *warnHelp.label: Help *warnHelp.sensitive: False *allowShellResize: true *beNiceToColormap: False } # Start up the GUI. createObjects activate proc quit args { send client gkey q; deactivate unmap } send doneButton addCallback quit # Initialize icons. createBitmap larrow 16 16 { 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}; createBitmap rarrow 16 16 { 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}; createBitmap brightness 15 15 { 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}; createBitmap contrast 15 15 { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}; send prevFrame set bitmap larrow send nextFrame set bitmap rarrow send contrastLabel set bitmap contrast send brightnessLabel set bitmap brightness # Initialize sliders. send contrastSlider resizeThumb 0.1 1.0 send brightnessSlider resizeThumb 0.1 1.0 send colorlistScroll setScrollbar 0.5 0.1 # The following code doesn't do anything useful, but helps demonstrate the # GUI and tests various callbacks and other capabilities. # Frame selection. set frame 1 proc setFrame {widget args} { global frame send frame$frame set on 0 set frame [expr [send $widget get label] + 1 - 1] send frame$frame set on 1 } proc nextFrame args { global frame send frame$frame set on 0 incr frame; if {$frame > 4} {set frame 1} send frame$frame set on 1 } proc prevFrame args { global frame send frame$frame set on 0 set frame [expr $frame - 1] if {$frame < 1} {set frame 4} send frame$frame set on 1 } proc clearFrame args { global warnings if {$warnings} { send warnText set label \ "Clearing the frame will destroy\n\ all data in the frame" send warning map } } proc warnDone args { send warning unmap } send prevFrame addCallback prevFrame send nextFrame addCallback nextFrame send clearFrame addCallback clearFrame foreach w {warnOk warnCancel} { send $w addCallback warnDone } foreach i {1 2 3 4} { send frame$i addCallback setFrame } send frame1 set on 1 # Enhancement stuff. set scrollHeight 0 set colortable Grayscale set contrast 0 set brightness 0 proc resizeScrollbar {widget cbtype flags x y w h cw ch} { global scrollHeight set newHeight [expr $ch - $h] if {$newHeight != $scrollHeight} { send colorlistScroll setScrollbar 0.0 [expr double($h) / $ch] set scrollHeight $newHeight } }; send colorlistPort addCallback resizeScrollbar proc scrollColorlist {widget cbtype pos} { global scrollHeight send colorlist set y [expr -int($scrollHeight * $pos)] }; send colorlistScroll addCallback scrollColorlist scroll proc selectColor {widget cbtype selections indices} { global colortable foreach selection $selections { set colortable $selection; updateColordata } }; send colorlist addCallback selectColor proc scrollContrast {widget cbtype x y} { global contrast; set contrast $x; updateColordata }; send contrastSlider addCallback scrollContrast proc scrollBrightness {widget cbtype x y} { global brightness; set brightness $x; updateColordata }; send brightnessSlider addCallback scrollBrightness proc updateColordata args { global colortable contrast brightness send colordata set label [format "-- %s --\nCon %4.2f Brt %4.2f" \ $colortable $contrast $brightness] } set colortables { "Grayscale" "Heat" "Halley" "Spectrum" "Random" "Ramp1" "Ramp2" } send colorlist setList $colortables resize updateColordata # Blink stuff. set blinkRate 2.0 proc setBlinkRate {widget args} { global blinkRate if {$widget == "BRincrease"} { if {$blinkRate < 0.01} { set blinkRate 0.125 } else { set blinkRate [expr $blinkRate * 2.0] } } else { set blinkRate [expr $blinkRate / 2.0] if {$blinkRate < 0.01} { set blinkRate 0 } } send BRtext set label $blinkRate } foreach widget {BRincrease BRdecrease} { send $widget addCallback setBlinkRate } proc setBlinkFrame {widget args} { set frame [send $widget get label] if {$frame == " "} { set frame 1 } else { incr frame if {$frame > 4} { set frame " " } } send $widget set label $frame } foreach i {1 2 3 4} { send blinkFrame$i addCallback setBlinkFrame } proc toggleBlink {widget args} { global blinkRate if {$blinkRate < 0.01} { send $widget set state 0 } } proc resetBlink args { global blinkRate foreach i {1 2 3 4} { send blinkFrame$i set label " " } set blinkRate 2.0 send BRtext set label $blinkRate } send blinkButton addCallback toggleBlink send blinkReset addCallback resetBlink send BRtext set label 2.0 # Options stuff. set warnings 1 proc setWarnings args { global warnings set warnings [send warningsButton get on] } send warningsButton addCallback setWarnings send warningsButton set on 1 send coordsBoxButton set on 1 send autoscaleButton set on 1