| 1 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2 | # FILE : bysgropt.tcl |
|---|
| 3 | # PURPOSE : This file is continuation of bysgraph.tcl. It contains procedures |
|---|
| 4 | # relative to graph options. |
|---|
| 5 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 6 | |
|---|
| 7 | package require blistbox |
|---|
| 8 | package require bcomboboxplus |
|---|
| 9 | package require blistorder |
|---|
| 10 | package require bcolor |
|---|
| 11 | package require bfont |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 15 | proc ::bayesGraph::ReadIni {this {holdon 0}} { |
|---|
| 16 | # PURPOSE: Reads general graph options from .ini file. The ini file is the |
|---|
| 17 | # active graphic configuration file. |
|---|
| 18 | # |
|---|
| 19 | # PARAMETERS: |
|---|
| 20 | # this -> Instance of BayesGraph |
|---|
| 21 | # |
|---|
| 22 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 23 | upvar \#0 ${this}::data data |
|---|
| 24 | upvar \#0 ${this}::widgets widgets |
|---|
| 25 | upvar \#0 ${this}::options opt |
|---|
| 26 | |
|---|
| 27 | variable optLinesAll |
|---|
| 28 | |
|---|
| 29 | #set rini ::iniFile::Read |
|---|
| 30 | if {!$holdon} { |
|---|
| 31 | set rini ::iniFile::ReadGCF |
|---|
| 32 | set key $data(namespace) |
|---|
| 33 | |
|---|
| 34 | set opt(PhotoLastDir) [$rini $key PhotoLastDir {}] |
|---|
| 35 | set opt(grid) [$rini $key grid 1] |
|---|
| 36 | } |
|---|
| 37 | for {set gr 0} {$gr<$data(gr,numGraph)} {incr gr} { |
|---|
| 38 | set g $widgets(gr,$gr) |
|---|
| 39 | |
|---|
| 40 | if {!$holdon} { |
|---|
| 41 | set opt(gr,$gr,yFormatNumber) [$rini $key yFormatNumber ""] |
|---|
| 42 | set opt(gr,$gr,y2FormatNumber) [$rini $key y2FormatNumber ""] |
|---|
| 43 | set opt(gr,$gr,yFormatPercent) [$rini $key yFormatPercent 0] |
|---|
| 44 | set opt(gr,$gr,y2FormatPercent) [$rini $key y2FormatPercent 0] |
|---|
| 45 | set opt(gr,$gr,xFormatNumber) [$rini $key xFormatNumber ""] |
|---|
| 46 | set opt(gr,$gr,x2FormatNumber) [$rini $key x2FormatNumber ""] |
|---|
| 47 | set opt(gr,$gr,xFormatPercent) [$rini $key xFormatPercent 0] |
|---|
| 48 | set opt(gr,$gr,x2FormatPercent) [$rini $key x2FormatPercent 0] |
|---|
| 49 | |
|---|
| 50 | set opt(gr,$gr,yAxisAll) [$rini $key yAxisAll 1] |
|---|
| 51 | set opt(gr,$gr,xAxisAll) [$rini $key xAxisAll 1] |
|---|
| 52 | set opt(gr,$gr,x2AxisAll) [$rini $key x2AxisAll 1] |
|---|
| 53 | set opt(gr,$gr,y2AxisAll) [$rini $key y2AxisAll 1] |
|---|
| 54 | |
|---|
| 55 | set opt(gr,$gr,xTicksWidth) [$rini $key xTicksWidth 1] |
|---|
| 56 | set opt(gr,$gr,yTicksWidth) [$rini $key yTicksWidth 1] |
|---|
| 57 | set opt(gr,$gr,xTicksShow) [$rini $key xTicksShow 1] |
|---|
| 58 | set opt(gr,$gr,yTicksShow) [$rini $key yTicksShow 1] |
|---|
| 59 | set opt(gr,$gr,xTicksType) [$rini $key xTicksType auto] |
|---|
| 60 | set opt(gr,$gr,yTicksType) [$rini $key yTicksType total] |
|---|
| 61 | set opt(gr,$gr,x2TicksType) [$rini $key x2TicksType auto] |
|---|
| 62 | set opt(gr,$gr,y2TicksType) [$rini $key y2TicksType total] |
|---|
| 63 | |
|---|
| 64 | set opt(gr,$gr,xTicksTotal) [$rini $key xTicksTotal 10] |
|---|
| 65 | set opt(gr,$gr,yTicksTotal) [$rini $key yTicksTotal 10] |
|---|
| 66 | set opt(gr,$gr,x2TicksTotal) [$rini $key x2TicksTotal 10] |
|---|
| 67 | set opt(gr,$gr,y2TicksTotal) [$rini $key y2TicksTotal 10] |
|---|
| 68 | |
|---|
| 69 | set opt(gr,$gr,xTicksStep) [$rini $key xTicksStep 0] |
|---|
| 70 | set opt(gr,$gr,yTicksStep) [$rini $key yTicksStep 0] |
|---|
| 71 | set opt(gr,$gr,xTicksFont) [$rini $key xTicksFont {{Lucida Console} 9}] |
|---|
| 72 | set opt(gr,$gr,yTicksFont) [$rini $key yTicksFont {{Lucida Console} 9}] |
|---|
| 73 | set opt(gr,$gr,xTicksRotate) [$rini $key xTicksRotate 90] |
|---|
| 74 | set opt(gr,$gr,yTicksRotate) [$rini $key yTicksRotate [$g axis cget y -rotate]] |
|---|
| 75 | set opt(gr,$gr,xTicksColor) [$rini $key xTicksColor [$g axis cget x -color]] |
|---|
| 76 | set opt(gr,$gr,yTicksColor) [$rini $key yTicksColor [$g axis cget y -color]] |
|---|
| 77 | set opt(gr,$gr,xTicksShadow) [$rini $key xTicksShadow [lindex [$g axis cget x -tickshadow] 0]] |
|---|
| 78 | set opt(gr,$gr,yTicksShadow) [$rini $key yTicksShadow [lindex [$g axis cget y -tickshadow] 0]] |
|---|
| 79 | set opt(gr,$gr,xTicksLength) [$rini $key xTicksLength 4] |
|---|
| 80 | set opt(gr,$gr,yTicksLength) [$rini $key yTicksLength 4] |
|---|
| 81 | set opt(gr,$gr,xTicksSubdivisions) [$rini $key xTicksSubdivisions 1] |
|---|
| 82 | set opt(gr,$gr,yTicksSubdivisions) [$rini $key yTicksSubdivisions 1] |
|---|
| 83 | |
|---|
| 84 | set opt(gr,$gr,xAxisShow) [$rini $key xAxisShow 1] |
|---|
| 85 | set opt(gr,$gr,yAxisShow) [$rini $key yAxisShow 1] |
|---|
| 86 | set opt(gr,$gr,x2AxisShow) [$rini $key x2AxisShow 0] |
|---|
| 87 | set opt(gr,$gr,y2AxisShow) [$rini $key y2AxisShow 0] |
|---|
| 88 | |
|---|
| 89 | set opt(gr,$gr,xAxisMin) [$rini $key xAxisMin 0] |
|---|
| 90 | set opt(gr,$gr,x2AxisMin) [$rini $key x2AxisMin 0] |
|---|
| 91 | set opt(gr,$gr,yAxisMin) [$rini $key yAxisMin 0] |
|---|
| 92 | set opt(gr,$gr,y2AxisMin) [$rini $key y2AxisMin 0] |
|---|
| 93 | |
|---|
| 94 | set opt(gr,$gr,xAxisMax) [$rini $key xAxisMax 100] |
|---|
| 95 | set opt(gr,$gr,yAxisMax) [$rini $key yAxisMax 100] |
|---|
| 96 | set opt(gr,$gr,x2AxisMax) [$rini $key x2AxisMax 100] |
|---|
| 97 | set opt(gr,$gr,y2AxisMax) [$rini $key y2AxisMax 100] |
|---|
| 98 | |
|---|
| 99 | set opt(gr,$gr,x2TicksWidth) [$rini $key x2TicksWidth 1] |
|---|
| 100 | set opt(gr,$gr,y2TicksWidth) [$rini $key y2TicksWidth 1] |
|---|
| 101 | set opt(gr,$gr,x2TicksShow) [$rini $key x2TicksShow 1] |
|---|
| 102 | set opt(gr,$gr,y2TicksShow) [$rini $key y2TicksShow 1] |
|---|
| 103 | set opt(gr,$gr,x2TicksStep) [$rini $key x2TicksStep 10] |
|---|
| 104 | set opt(gr,$gr,y2TicksStep) [$rini $key y2TicksStep 10] |
|---|
| 105 | set opt(gr,$gr,x2TicksFont) [$rini $key x2TicksFont {{Lucida Console} 9}] |
|---|
| 106 | set opt(gr,$gr,y2TicksFont) [$rini $key y2TicksFont {{Lucida Console} 9}] |
|---|
| 107 | set opt(gr,$gr,x2TicksRotate) [$rini $key x2TicksRotate [$g axis cget x2 -rotate]] |
|---|
| 108 | set opt(gr,$gr,y2TicksRotate) [$rini $key y2TicksRotate [$g axis cget y2 -rotate]] |
|---|
| 109 | set opt(gr,$gr,x2TicksColor) [$rini $key x2TicksColor [$g axis cget x2 -color]] |
|---|
| 110 | set opt(gr,$gr,y2TicksColor) [$rini $key y2TicksColor [$g axis cget y2 -color]] |
|---|
| 111 | set opt(gr,$gr,x2TicksShadow) [$rini $key x2TicksShadow [lindex [$g axis cget x2 -tickshadow] 0]] |
|---|
| 112 | set opt(gr,$gr,y2TicksShadow) [$rini $key y2TicksShadow [lindex [$g axis cget y2 -tickshadow] 0]] |
|---|
| 113 | set opt(gr,$gr,x2TicksLength) [$rini $key x2TicksLength 4] |
|---|
| 114 | set opt(gr,$gr,y2TicksLength) [$rini $key y2TicksLength 4] |
|---|
| 115 | set opt(gr,$gr,x2TicksSubdivisions) [$rini $key x2TicksSubdivisions 1] |
|---|
| 116 | set opt(gr,$gr,y2TicksSubdivisions) [$rini $key y2TicksSubdivisions 1] |
|---|
| 117 | |
|---|
| 118 | set opt(gr,$gr,xAxisTitle) [$rini $key xAxisTitle ""] |
|---|
| 119 | set opt(gr,$gr,xAxisColor) [$rini $key xAxisTitleColor [$g axis cget x -titlecolor]] |
|---|
| 120 | set opt(gr,$gr,xAxisFont) [$rini $key xAxisTitleFont [$g axis cget x -titlefont]] |
|---|
| 121 | set opt(gr,$gr,xAxisShadow) [$rini $key xAxisTitleShadow [lindex [$g axis cget x -titleshadow] 0]] |
|---|
| 122 | set opt(gr,$gr,yAxisTitle) [$rini $key yAxisTitle ""] |
|---|
| 123 | set opt(gr,$gr,yAxisColor) [$rini $key yAxisTitleColor [$g axis cget y -titlecolor]] |
|---|
| 124 | set opt(gr,$gr,yAxisFont) [$rini $key yAxisTitleFont [$g axis cget y -titlefont]] |
|---|
| 125 | set opt(gr,$gr,yAxisShadow) [$rini $key yAxisTitleShadow [lindex [$g axis cget y -titleshadow] 0]] |
|---|
| 126 | set opt(gr,$gr,x2AxisTitle) [$rini $key x2AxisTitle ""] |
|---|
| 127 | set opt(gr,$gr,x2AxisColor) [$rini $key x2AxisTitleColor [$g axis cget x2 -titlecolor]] |
|---|
| 128 | set opt(gr,$gr,x2AxisFont) [$rini $key x2AxisTitleFont [$g axis cget x2 -titlefont]] |
|---|
| 129 | set opt(gr,$gr,x2AxisShadow) [$rini $key x2AxisTitleShadow [lindex [$g axis cget x2 -titleshadow] 0]] |
|---|
| 130 | set opt(gr,$gr,y2AxisTitle) [$rini $key y2AxisTitle ""] |
|---|
| 131 | set opt(gr,$gr,y2AxisColor) [$rini $key y2AxisTitleColor [$g axis cget y2 -titlecolor]] |
|---|
| 132 | set opt(gr,$gr,y2AxisFont) [$rini $key y2AxisTitleFont [$g axis cget y2 -titlefont]] |
|---|
| 133 | set opt(gr,$gr,y2AxisShadow) [$rini $key y2AxisTitleShadow [lindex [$g axis cget y2 -titleshadow] 0]] |
|---|
| 134 | |
|---|
| 135 | set opt(gr,$gr,font) [$rini $key font [$g cget -font]] |
|---|
| 136 | set opt(gr,$gr,foreground) [$rini $key foreground [$g cget -foreground]] |
|---|
| 137 | set opt(gr,$gr,shadow) [$rini $key shadow [lindex [$g cget -shadow] 0]] |
|---|
| 138 | |
|---|
| 139 | # options line |
|---|
| 140 | set opt(gr,$gr,barmode) [$rini $key barmode aligned] |
|---|
| 141 | |
|---|
| 142 | set opt(gr,$gr,linehides) [$rini $key linehides false] |
|---|
| 143 | set opt(gr,$gr,linetypes) [$rini $key linetypes LineElement] |
|---|
| 144 | set opt(gr,$gr,barwidth) [$rini $key barwidth 0.6] |
|---|
| 145 | set opt(gr,$gr,linewidth) [$rini $key linewidth 3] |
|---|
| 146 | set opt(gr,$gr,dashes) [$rini $key dashes {}] |
|---|
| 147 | set opt(gr,$gr,smooth) [$rini $key smooth linear] |
|---|
| 148 | set opt(gr,$gr,barrelief) [$rini $key barrelief raised] |
|---|
| 149 | set opt(gr,$gr,borderwidth) [$rini $key borderwidth 0] |
|---|
| 150 | set opt(gr,$gr,colors) [$rini $key colors {#00c600 blue red yellow orange #d14949 grey purple pink navyblue #356a6a #804000 #05eefa #009148 #ffffbb #29fb04}] |
|---|
| 151 | |
|---|
| 152 | set opt(gr,$gr,xyMappedAxis) [$rini $key xyMappedAxis {{x y}}] |
|---|
| 153 | set opt(gr,$gr,areaTypes) [$rini $key areaTypes none] |
|---|
| 154 | set opt(gr,$gr,areaTypesBar) [$rini $key areaTypesBar none] |
|---|
| 155 | set opt(gr,$gr,areaTiles) [$rini $key areaTiles {}] |
|---|
| 156 | set opt(gr,$gr,areaForegrounds) [$rini $key areaForegrounds defcolor] |
|---|
| 157 | set opt(gr,$gr,areaBackgrounds) [$rini $key areaBackgrounds white] |
|---|
| 158 | set opt(gr,$gr,stippleimages) [$rini $key stippleimages {}] |
|---|
| 159 | set opt(gr,$gr,stippledegradeds) [$rini $key stippledegradeds 50] |
|---|
| 160 | |
|---|
| 161 | set opt(gr,$gr,showvalues) [$rini $key showvalues none] |
|---|
| 162 | set opt(gr,$gr,valuefont) [$rini $key valuefont {Arial 8}] |
|---|
| 163 | set opt(gr,$gr,valuerotate) [$rini $key valuerotate 0] |
|---|
| 164 | set opt(gr,$gr,valuecolor) [$rini $key valuecolor black] |
|---|
| 165 | set opt(gr,$gr,valueformatdec) [$rini $key valueformatdec 2] |
|---|
| 166 | set opt(gr,$gr,valueshadow) [$rini $key valueshadow {}] |
|---|
| 167 | set opt(gr,$gr,valueanchor) [$rini $key valueanchor center] |
|---|
| 168 | set opt(gr,$gr,showsymbols) [$rini $key showsymbols 0] |
|---|
| 169 | set opt(gr,$gr,symbol) [$rini $key symbol triangle] |
|---|
| 170 | set opt(gr,$gr,pixels) [$rini $key pixels 4] |
|---|
| 171 | set opt(gr,$gr,scalesymbols) [$rini $key scalesymbols false] |
|---|
| 172 | set opt(gr,$gr,fill) [$rini $key fill defcolor] |
|---|
| 173 | set opt(gr,$gr,outline) [$rini $key outline defcolor] |
|---|
| 174 | set opt(gr,$gr,outlinewidth) [$rini $key outlinewidth 1] |
|---|
| 175 | |
|---|
| 176 | set opt(gr,$gr,selffit) [$rini $key selffit 0] |
|---|
| 177 | |
|---|
| 178 | set opt(gr,$gr,xMarkers) [$rini $key xMarkers {}] |
|---|
| 179 | set opt(gr,$gr,yMarkers) [$rini $key yMarkers {}] |
|---|
| 180 | set opt(gr,$gr,xMarkersIn) [$rini $key xMarkersIn {}] |
|---|
| 181 | set opt(gr,$gr,yMarkersIn) [$rini $key yMarkersIn {}] |
|---|
| 182 | |
|---|
| 183 | set opt(gr,$gr,x2Markers) [$rini $key x2Markers {}] |
|---|
| 184 | set opt(gr,$gr,y2Markers) [$rini $key y2Markers {}] |
|---|
| 185 | set opt(gr,$gr,x2MarkersIn) [$rini $key x2MarkersIn {}] |
|---|
| 186 | set opt(gr,$gr,y2MarkersIn) [$rini $key y2MarkersIn {}] |
|---|
| 187 | |
|---|
| 188 | set opt(gr,$gr,xMarkersColorsInEach) [$rini $key xMarkersColorsInEach \ |
|---|
| 189 | {#356a6a #804000 #05eefa #009148 #ffffbb}] |
|---|
| 190 | set opt(gr,$gr,x2MarkersColorsInEach) [$rini $key x2MarkersColorsInEach \ |
|---|
| 191 | {#356a6a #804000 #05eefa #009148 #ffffbb}] |
|---|
| 192 | set opt(gr,$gr,yMarkersColorsInEach) [$rini $key yMarkersColorsInEach \ |
|---|
| 193 | {#356a6a #804000 #05eefa #009148 #ffffbb}] |
|---|
| 194 | set opt(gr,$gr,y2MarkersColorsInEach) [$rini $key y2MarkersColorsInEach \ |
|---|
| 195 | {#356a6a #804000 #05eefa #009148 #ffffbb}] |
|---|
| 196 | |
|---|
| 197 | set opt(gr,$gr,xMarkersDashesInEach) [$rini $key xMarkersDashesInEach \ |
|---|
| 198 | {{1 1} {2 2} {3 3} {4 4} {5 5}}] |
|---|
| 199 | set opt(gr,$gr,x2MarkersDashesInEach) [$rini $key x2MarkersDashesInEach \ |
|---|
| 200 | {{1 1} {2 2} {3 3} {4 4} {5 5}}] |
|---|
| 201 | set opt(gr,$gr,yMarkersDashesInEach) [$rini $key yMarkersDashesInEach \ |
|---|
| 202 | {{1 1} {2 2} {3 3} {4 4} {5 5}}] |
|---|
| 203 | set opt(gr,$gr,y2MarkersDashesInEach) [$rini $key y2MarkersDashesInEach \ |
|---|
| 204 | {{1 1} {2 2} {3 3} {4 4} {5 5}}] |
|---|
| 205 | |
|---|
| 206 | set opt(gr,$gr,xMarkersWidthsInEach) [$rini $key xMarkersWidthsInEach \ |
|---|
| 207 | {1 1 1 1 1}] |
|---|
| 208 | set opt(gr,$gr,x2MarkersWidthsInEach) [$rini $key x2MarkersWidthsInEach \ |
|---|
| 209 | {1 1 1 1 1}] |
|---|
| 210 | set opt(gr,$gr,yMarkersWidthsInEach) [$rini $key yMarkersWidthsInEach \ |
|---|
| 211 | {1 1 1 1 1}] |
|---|
| 212 | set opt(gr,$gr,y2MarkersWidthsInEach) [$rini $key y2MarkersWidthsInEach \ |
|---|
| 213 | {1 1 1 1 1}] |
|---|
| 214 | |
|---|
| 215 | set opt(gr,$gr,xMarkersUndersInEach) [$rini $key xMarkersUndersInEach \ |
|---|
| 216 | {0 0 0 0 0}] |
|---|
| 217 | set opt(gr,$gr,x2MarkersUndersInEach) [$rini $key x2MarkersUndersInEach \ |
|---|
| 218 | {0 0 0 0 0}] |
|---|
| 219 | set opt(gr,$gr,yMarkersUndersInEach) [$rini $key yMarkersUndersInEach \ |
|---|
| 220 | {0 0 0 0 0}] |
|---|
| 221 | set opt(gr,$gr,y2MarkersUndersInEach) [$rini $key y2MarkersUndersInEach \ |
|---|
| 222 | {0 0 0 0 0}] |
|---|
| 223 | |
|---|
| 224 | set opt(gr,$gr,legend,Hide) [$rini $key legendHide [$g legend cget -hide]] |
|---|
| 225 | set opt(gr,$gr,legend,Bg) [$rini $key legendBg ""] |
|---|
| 226 | set opt(gr,$gr,legend,Bd) [$rini $key legendBd [$g legend cget -bd]] |
|---|
| 227 | set opt(gr,$gr,legend,Fg) [$rini $key legendFg [$g legend cget -fg]] |
|---|
| 228 | set opt(gr,$gr,legend,Font) [$rini $key legendFont {{Lucida Console} 9}] |
|---|
| 229 | set opt(gr,$gr,legend,Shadow) [$rini $key legendShadow [$g legend cget -shadow]] |
|---|
| 230 | set opt(gr,$gr,legend,Position) [$rini $key legendPosition "bottom"] |
|---|
| 231 | set opt(gr,$gr,legend,Anchor) [$rini $key legendAnchor [$g legend cget -anchor]] |
|---|
| 232 | set opt(gr,$gr,legend,Relief) [$rini $key legendRelief [$g legend cget -relief]] |
|---|
| 233 | set opt(gr,$gr,legend,Raised) [$rini $key legendRaised [$g legend cget -raised]] |
|---|
| 234 | set opt(gr,$gr,legend,IPadXl) [$rini $key legendIPadXl [lindex [$g legend cget -ipadx] 0]] |
|---|
| 235 | set opt(gr,$gr,legend,IPadXr) [$rini $key legendIPadXr [lindex [$g legend cget -ipadx] 1]] |
|---|
| 236 | set opt(gr,$gr,legend,IPadYt) [$rini $key legendIPadYt [lindex [$g legend cget -ipady] 0]] |
|---|
| 237 | set opt(gr,$gr,legend,IPadYb) [$rini $key legendIPadYb [lindex [$g legend cget -ipady] 1]] |
|---|
| 238 | set opt(gr,$gr,legend,PadXl) [$rini $key legendPadXl [lindex [$g legend cget -padx] 0]] |
|---|
| 239 | set opt(gr,$gr,legend,PadXr) [$rini $key legendPadXr [lindex [$g legend cget -padx] 1]] |
|---|
| 240 | set opt(gr,$gr,legend,PadYt) [$rini $key legendPadYt [lindex [$g legend cget -pady] 0]] |
|---|
| 241 | set opt(gr,$gr,legend,PadYb) [$rini $key legendPadYb [lindex [$g legend cget -pady] 1]] |
|---|
| 242 | set opt(gr,$gr,legend,Rows) [$rini $key legendRows [$g legend cget -rows]] |
|---|
| 243 | set opt(gr,$gr,legend,Columns) [$rini $key legendColumns [$g legend cget -columns]] |
|---|
| 244 | |
|---|
| 245 | set opt(gr,$gr,grid,Color) [$rini $key gridColor "#e8e8e8"] |
|---|
| 246 | set opt(gr,$gr,grid,Dashes) [$rini $key gridDashes {3 1}] |
|---|
| 247 | set opt(gr,$gr,grid,LineWidth) [$rini $key gridLineWidth [$g grid cget -linewidth]] |
|---|
| 248 | set opt(gr,$gr,grid,Minor) [$rini $key gridMinor 0] |
|---|
| 249 | set opt(gr,$gr,grid,MapX) [$rini $key gridMapX x] |
|---|
| 250 | set opt(gr,$gr,grid,MapY) [$rini $key gridMapY y] |
|---|
| 251 | |
|---|
| 252 | set opt(gr,$gr,background) [$rini $key background #ffffff] |
|---|
| 253 | set opt(gr,$gr,relief) [$rini $key relief flat] |
|---|
| 254 | set opt(gr,$gr,areaborderwidth) [$rini $key areaborderwidth 0] |
|---|
| 255 | |
|---|
| 256 | set opt(gr,$gr,lm) [$rini $key lm [$g cget -lm]] |
|---|
| 257 | set opt(gr,$gr,rm) [$rini $key rm [$g cget -rm]] |
|---|
| 258 | set opt(gr,$gr,tm) [$rini $key tm [$g cget -tm]] |
|---|
| 259 | set opt(gr,$gr,bm) [$rini $key bm [$g cget -bm]] |
|---|
| 260 | set opt(gr,$gr,plotbackground) [$rini $key plotbackground white] |
|---|
| 261 | set opt(gr,$gr,plotrelief) [$rini $key plotrelief flat] |
|---|
| 262 | set opt(gr,$gr,plotborderwidth) [$rini $key plotborderwidth 0] |
|---|
| 263 | set opt(gr,$gr,plotpadxl) [$rini $key plotpadxl 0] |
|---|
| 264 | set opt(gr,$gr,plotpadxr) [$rini $key plotpadxr 0] |
|---|
| 265 | set opt(gr,$gr,plotpadyt) [$rini $key plotpadyt 0] |
|---|
| 266 | set opt(gr,$gr,plotpadyb) [$rini $key plotpadyb 0] |
|---|
| 267 | set opt(gr,$gr,invertxy) [$rini $key invertxy 0] |
|---|
| 268 | } |
|---|
| 269 | # Para el orden de las series, opt puede cambiar, pero no cambiamos data |
|---|
| 270 | # lstnames {id name caption label} |
|---|
| 271 | set opt(gr,$gr,lstnames) {} |
|---|
| 272 | set i 1 |
|---|
| 273 | foreach it $data(gr,$gr,elements) { |
|---|
| 274 | lappend opt(gr,$gr,lstnames) [list $i \ |
|---|
| 275 | $it \ |
|---|
| 276 | [$g element cget [lindex $it 0] -label] \ |
|---|
| 277 | [$g element cget [lindex $it 0] -label]] |
|---|
| 278 | incr i |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | #Completamos valores de arrays |
|---|
| 282 | GrapOptGetMarkers $this |
|---|
| 283 | |
|---|
| 284 | # Completamos los arrays de opciones de lineas |
|---|
| 285 | foreach it $optLinesAll { |
|---|
| 286 | set len [llength $opt(gr,$gr,$it)] |
|---|
| 287 | for {set i $len} {[expr $i < [llength [$g element names]]]} {incr i} { |
|---|
| 288 | lappend opt(gr,$gr,$it) [lindex $opt(gr,$gr,$it) 0] |
|---|
| 289 | } |
|---|
| 290 | } |
|---|
| 291 | } |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 295 | proc ::bayesGraph::WriteIni {this { gcf 0 } } { |
|---|
| 296 | # |
|---|
| 297 | # PURPOSE: Reads general graph options from .ini file. The ini file is the |
|---|
| 298 | # active graphic configuration file. |
|---|
| 299 | # |
|---|
| 300 | # PARAMETERS: |
|---|
| 301 | # this -> Instance of BayesGraph |
|---|
| 302 | # gcf -> 1. Indicate save in GCF file. O. Save in ini file |
|---|
| 303 | # |
|---|
| 304 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 305 | upvar \#0 ${this}::data data |
|---|
| 306 | upvar \#0 ${this}::options opt |
|---|
| 307 | variable optLinesAll |
|---|
| 308 | |
|---|
| 309 | set gr $data(gr,active) |
|---|
| 310 | |
|---|
| 311 | # exists gcf |
|---|
| 312 | if {$gcf} { |
|---|
| 313 | set wini ::iniFile::WriteGCF |
|---|
| 314 | } else { |
|---|
| 315 | set wini ::iniFile::Write |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | set key $data(namespace) |
|---|
| 319 | |
|---|
| 320 | $wini $key PhotoLastDir $opt(PhotoLastDir) |
|---|
| 321 | #Coger el estado del grid |
|---|
| 322 | $wini $key grid $opt(grid) |
|---|
| 323 | |
|---|
| 324 | # opciones de Max y Min de ejes |
|---|
| 325 | foreach pre {x y x2 y2} { |
|---|
| 326 | foreach post {Show Min Max All} { |
|---|
| 327 | $wini $key ${pre}Axis${post} $opt(gr,$gr,${pre}Axis${post}) |
|---|
| 328 | } |
|---|
| 329 | } |
|---|
| 330 | # opciones de formato de ejes |
|---|
| 331 | foreach pre {y y2 x x2} { |
|---|
| 332 | foreach post {Number Percent} { |
|---|
| 333 | $wini $key ${pre}Format${post} $opt(gr,$gr,${pre}Format${post}) |
|---|
| 334 | } |
|---|
| 335 | } |
|---|
| 336 | #Opciones de ticks (tipo, cuantos, cada cuantos y estilo) de ejes |
|---|
| 337 | foreach pre {x y x2 y2} { |
|---|
| 338 | foreach post {Type Total Step Font Rotate Color Shadow Length Subdivisions Width Show} { |
|---|
| 339 | $wini $key ${pre}Ticks${post} $opt(gr,$gr,${pre}Ticks${post}) |
|---|
| 340 | } |
|---|
| 341 | } |
|---|
| 342 | #Opciones del título del gráfico |
|---|
| 343 | foreach it {font foreground shadow} { |
|---|
| 344 | $wini $key $it $opt(gr,$gr,$it) |
|---|
| 345 | } |
|---|
| 346 | # Titulos y opciones de títulos de título de ejes |
|---|
| 347 | foreach pre {x y x2 y2} { |
|---|
| 348 | $wini $key ${pre}AxisTitle $opt(gr,$gr,${pre}AxisTitle) |
|---|
| 349 | foreach post {Color Font Shadow} { |
|---|
| 350 | $wini $key ${pre}AxisTitle${post} $opt(gr,$gr,${pre}Axis${post}) |
|---|
| 351 | } |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | #Opciones de auto-ajuste |
|---|
| 355 | foreach it {selffit} { |
|---|
| 356 | $wini $key $it $opt(gr,$gr,$it) |
|---|
| 357 | } |
|---|
| 358 | #Opciones de Marcadores |
|---|
| 359 | foreach it {x x2 y y2} { |
|---|
| 360 | foreach at {"" In} { |
|---|
| 361 | $wini $key ${it}Markers${at} $opt(gr,$gr,${it}Markers${at}) |
|---|
| 362 | } |
|---|
| 363 | } |
|---|
| 364 | foreach it {x x2 y y2} { |
|---|
| 365 | foreach ty {Colors Dashes Widths Unders} { |
|---|
| 366 | $wini $key ${it}Markers${ty}InEach $opt(gr,$gr,${it}Markers${ty}InEach) |
|---|
| 367 | } |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | #Opciones de estilo de los elementos |
|---|
| 371 | foreach it $optLinesAll { |
|---|
| 372 | $wini $key $it $opt(gr,$gr,$it) |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | #Opciones del grid |
|---|
| 376 | foreach it {Color Dashes LineWidth Minor MapX MapY} { |
|---|
| 377 | $wini $key grid$it $opt(gr,$gr,grid,$it) |
|---|
| 378 | } |
|---|
| 379 | #Opciones de la leyenda |
|---|
| 380 | foreach it {Hide Rows Columns Font Fg Shadow Bg Bd Relief Position Anchor Raised} { |
|---|
| 381 | $wini $key legend$it $opt(gr,$gr,legend,$it) |
|---|
| 382 | } |
|---|
| 383 | foreach it {IPadXl IPadXr IPadYt IPadYb PadXl PadXr PadYt PadYb} { |
|---|
| 384 | $wini $key legend$it $opt(gr,$gr,legend,$it) |
|---|
| 385 | } |
|---|
| 386 | #Opciones del gráfico |
|---|
| 387 | foreach it {background relief areaborderwidth lm rm tm bm invertxy} { |
|---|
| 388 | $wini $key $it $opt(gr,$gr,$it) |
|---|
| 389 | } |
|---|
| 390 | foreach it {plotbackground plotrelief plotborderwidth plotpadxl plotpadxr plotpadyt plotpadyb} { |
|---|
| 391 | $wini $key $it $opt(gr,$gr,$it) |
|---|
| 392 | } |
|---|
| 393 | |
|---|
| 394 | # OnWriteInit |
|---|
| 395 | if [info exists ${this}::data(proc,OnWriteIni)] { |
|---|
| 396 | $data(proc,OnWriteIni) $this |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | if {$gcf} { |
|---|
| 400 | ::bayesGraph::SaveGCF $this |
|---|
| 401 | ::iniFile::FlushGCF $key |
|---|
| 402 | } |
|---|
| 403 | } |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 407 | proc ::bayesGraph::CalculateXAxisNumTicks {this axis} { |
|---|
| 408 | # |
|---|
| 409 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 410 | upvar \#0 ${this}::data data |
|---|
| 411 | set gr $data(gr,active) |
|---|
| 412 | set g [getActiveGraph $this] |
|---|
| 413 | |
|---|
| 414 | set font [$g axis cget $axis -tickfont] |
|---|
| 415 | if {[$g axis cget $axis -rotate] > 15} { |
|---|
| 416 | array set fontMetrics [font metrics $font] |
|---|
| 417 | set widthTick [expr $fontMetrics(-ascent) + $fontMetrics(-descent)] |
|---|
| 418 | } else { |
|---|
| 419 | set lst [$data(gr,$gr,OnGetXTicks) $this] |
|---|
| 420 | set widthTick [expr [font measure $font [lindex $lst end]] + 4] |
|---|
| 421 | } |
|---|
| 422 | set limits [$g axis limits $axis] |
|---|
| 423 | set pixelIni [$g axis transform $axis [lindex $limits 0]] |
|---|
| 424 | set pixelFin [$g axis transform $axis [lindex $limits 1]] |
|---|
| 425 | |
|---|
| 426 | set widthAxis [expr $pixelFin - $pixelIni] |
|---|
| 427 | set nTicks [expr $widthTick ? ($widthAxis / $widthTick) : 0] |
|---|
| 428 | return $nTicks |
|---|
| 429 | } |
|---|
| 430 | |
|---|
| 431 | |
|---|
| 432 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 433 | proc ::bayesGraph::CalculateYAxisNumTicks {this axis} { |
|---|
| 434 | # |
|---|
| 435 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 436 | set g [getActiveGraph $this] |
|---|
| 437 | set font [$g axis cget $axis -tickfont] |
|---|
| 438 | array set fontMetrics [font metrics $font] |
|---|
| 439 | #si se ha rotado (hacer si se permite rotar) |
|---|
| 440 | set heightTick [expr $fontMetrics(-ascent) + $fontMetrics(-descent)] |
|---|
| 441 | set limits [$g axis limits $axis] |
|---|
| 442 | set pixelIni [$g axis transform $axis [lindex $limits 0]] |
|---|
| 443 | set pixelFin [$g axis transform $axis [lindex $limits 1]] |
|---|
| 444 | |
|---|
| 445 | set heightAxis [expr $pixelIni - $pixelFin] |
|---|
| 446 | set nTicks [expr $heightTick ? ($heightAxis / $heightTick) : 0] |
|---|
| 447 | return $nTicks |
|---|
| 448 | } |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 452 | proc ::bayesGraph::FixXAxisStep {this step axis} { |
|---|
| 453 | # |
|---|
| 454 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 455 | upvar \#0 ${this}::data data |
|---|
| 456 | set g [getActiveGraph $this] |
|---|
| 457 | set min [$g axis cget $axis -min] |
|---|
| 458 | set max [$g axis cget $axis -max] |
|---|
| 459 | if {[info exist data(proc,OnFixStepX)]} { |
|---|
| 460 | set step [$data(proc,OnFixStepX) $this $min $max $step] |
|---|
| 461 | } |
|---|
| 462 | return $step |
|---|
| 463 | } |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 467 | proc ::bayesGraph::FixYAxisStep {this step} { |
|---|
| 468 | # |
|---|
| 469 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 470 | if {$step <= 0} { |
|---|
| 471 | return 0 |
|---|
| 472 | } |
|---|
| 473 | if {$step < 1} { |
|---|
| 474 | set nDig [expr $step ? (int(floor(log10(1/$step)))) : 0] |
|---|
| 475 | set num [expr $nDig + 2] |
|---|
| 476 | set step [format "%.${num}f" $step] |
|---|
| 477 | } else { |
|---|
| 478 | set nDig [expr $step ? (int(floor(log10($step)))) : 0] |
|---|
| 479 | if {$nDig >= 1} { |
|---|
| 480 | set num [expr $nDig - 1] |
|---|
| 481 | if {![catch {expr int(pow(10,$num)) ? floor($step/int(pow(10,$num)))*pow(10,$num) : 0} res]} { |
|---|
| 482 | set step $res |
|---|
| 483 | } else { |
|---|
| 484 | set step 0 |
|---|
| 485 | } |
|---|
| 486 | #set step [expr int(pow(10,$num)) ? floor($step/int(pow(10,$num)))*pow(10,$num) : 0] |
|---|
| 487 | } else { |
|---|
| 488 | set num [expr $nDig] |
|---|
| 489 | set step [format "%.1f" $step] |
|---|
| 490 | } |
|---|
| 491 | } |
|---|
| 492 | return $step |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 496 | proc ::bayesGraph::ComputeXAxisStep {this nTicks axis} { |
|---|
| 497 | # |
|---|
| 498 | # PURPOSE: |
|---|
| 499 | # |
|---|
| 500 | # PARAMETERS: |
|---|
| 501 | # this -> Instance of BayesGraph |
|---|
| 502 | # nTicks -> |
|---|
| 503 | # axis -> |
|---|
| 504 | # RETURN |
|---|
| 505 | # |
|---|
| 506 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 507 | upvar \#0 ${this}::data data |
|---|
| 508 | variable tmpOpt |
|---|
| 509 | if {$nTicks == 0 } { return 0 } |
|---|
| 510 | |
|---|
| 511 | set g [getActiveGraph $this] |
|---|
| 512 | set min [$g axis cget $axis -min] |
|---|
| 513 | set max [$g axis cget $axis -max] |
|---|
| 514 | if {![string length $min] && ![string length $max]} { |
|---|
| 515 | #Le damos el valor minimo y maximo del eje opuesto |
|---|
| 516 | switch [string length $axis] { |
|---|
| 517 | 2 { set axiOpo [string index $axis 0] } |
|---|
| 518 | default { set axiOpo ${axis}2 } |
|---|
| 519 | } |
|---|
| 520 | set values2 [::bayesGraph::GetLimitsValueAxis $this $axiOpo] |
|---|
| 521 | set min [lindex $values2 0] |
|---|
| 522 | set max [lindex $values2 1] |
|---|
| 523 | set tmpOpt(var,${axis}AxisMin) $min |
|---|
| 524 | set tmpOpt(var,${axis}AxisMax) $max |
|---|
| 525 | |
|---|
| 526 | ::bayesGraph::GrapOptApplyAxisLimits $this $axis $min $max |
|---|
| 527 | } elseif {![string length $min]} { |
|---|
| 528 | set min [expr $max - 100] |
|---|
| 529 | } elseif {![string length $max]} { |
|---|
| 530 | set max [expr $min + 100] |
|---|
| 531 | } |
|---|
| 532 | if {[info exist ${this}::data(proc,OnComputeStepX)]} { |
|---|
| 533 | set step [$data(proc,OnComputeStepX) $this $min $max $nTicks] |
|---|
| 534 | } else { |
|---|
| 535 | set dif [expr $max - $min] |
|---|
| 536 | set step [expr $nTicks ? ($dif/$nTicks) : 0] |
|---|
| 537 | } |
|---|
| 538 | return $step |
|---|
| 539 | } |
|---|
| 540 | |
|---|
| 541 | |
|---|
| 542 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 543 | proc ::bayesGraph::ComputeYAxisStep {this nTicks axis} { |
|---|
| 544 | # |
|---|
| 545 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 546 | variable tmpOpt |
|---|
| 547 | if {$nTicks == 0 } { return 0 } |
|---|
| 548 | set g [getActiveGraph $this] |
|---|
| 549 | #Obtenemos valor minimo y maximo de las lineas |
|---|
| 550 | set min [$g axis cget $axis -min] |
|---|
| 551 | set max [$g axis cget $axis -max] |
|---|
| 552 | if {![string length $min] && ![string length $max]} { |
|---|
| 553 | #Le damos el valor minimo y maximo del eje opuesto |
|---|
| 554 | switch [string length $axis] { |
|---|
| 555 | 2 { set axiOpo [string index $axis 0] } |
|---|
| 556 | default { set axiOpo ${axis}2 } |
|---|
| 557 | } |
|---|
| 558 | set values2 [::bayesGraph::GetLimitsValueAxis $this $axiOpo] |
|---|
| 559 | if {[llength $values2]} { |
|---|
| 560 | set min [lindex $values2 0] |
|---|
| 561 | set max [lindex $values2 1] |
|---|
| 562 | set tmpOpt(var,${axis}AxisMin) $min |
|---|
| 563 | set tmpOpt(var,${axis}AxisMax) $max |
|---|
| 564 | ::bayesGraph::GrapOptApplyAxisLimits $this $axis $min $max |
|---|
| 565 | } |
|---|
| 566 | } |
|---|
| 567 | # Se comprueba valor de los ejes |
|---|
| 568 | if {![string length $min] && ![string length $max]} { |
|---|
| 569 | set min 0 |
|---|
| 570 | set max 100 |
|---|
| 571 | } elseif {![string length $min]} { |
|---|
| 572 | set min [expr $max - 100] |
|---|
| 573 | } elseif {![string length $max]} { |
|---|
| 574 | set max [expr $min + 100] |
|---|
| 575 | } |
|---|
| 576 | set dif [expr $max - $min] |
|---|
| 577 | set step [expr $nTicks ? ($dif/$nTicks) : 0] |
|---|
| 578 | return [FixYAxisStep $this $step] |
|---|
| 579 | } |
|---|
| 580 | |
|---|
| 581 | |
|---|
| 582 | # Opciones del grafico |
|---|
| 583 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 584 | proc ::bayesGraph::LoadGCF {this {fileGCF ""}} { |
|---|
| 585 | # |
|---|
| 586 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 587 | upvar \#0 ${this}::data data |
|---|
| 588 | upvar \#0 ${this}::options opt |
|---|
| 589 | set key $data(namespace) |
|---|
| 590 | |
|---|
| 591 | if {[string length $fileGCF]} { |
|---|
| 592 | set opt(GCFlastDir) [file dirname $fileGCF] |
|---|
| 593 | set opt(GCFFile) $fileGCF |
|---|
| 594 | ::iniFile::SetGCF $key $opt(GCFFile) |
|---|
| 595 | } else { |
|---|
| 596 | set opt(GCFFile) [::iniFile::Read $key GCFFile ""] |
|---|
| 597 | set opt(GCFlastDir) [::iniFile::Read $key GCFlastDir ""] |
|---|
| 598 | |
|---|
| 599 | if { ![file exists $opt(GCFFile)] } { |
|---|
| 600 | if {![string equal $opt(GCFFile) ""]} { |
|---|
| 601 | tk_messageBox -type ok -icon info \ |
|---|
| 602 | -message [mc "File $opt(GCFFile) doesn't exist"] \ |
|---|
| 603 | -title [mc "Warning"] |
|---|
| 604 | set opt(GCFFile) "" |
|---|
| 605 | } |
|---|
| 606 | ::iniFile::SetGCF $key "" |
|---|
| 607 | } else { |
|---|
| 608 | ::iniFile::SetGCF $key $opt(GCFFile) |
|---|
| 609 | } |
|---|
| 610 | } |
|---|
| 611 | } |
|---|
| 612 | |
|---|
| 613 | |
|---|
| 614 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 615 | proc ::bayesGraph::SaveGCF {this} { |
|---|
| 616 | # |
|---|
| 617 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 618 | upvar \#0 ${this}::data data |
|---|
| 619 | upvar \#0 ${this}::options opt |
|---|
| 620 | set key $data(namespace) |
|---|
| 621 | |
|---|
| 622 | ::iniFile::Write $key GCFFile $opt(GCFFile) |
|---|
| 623 | ::iniFile::Write $key GCFlastDir $opt(GCFlastDir) |
|---|
| 624 | ::iniFile::SaveGCF $key $opt(GCFFile) |
|---|
| 625 | } |
|---|
| 626 | |
|---|
| 627 | |
|---|
| 628 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 629 | proc ::bayesGraph::OpenGraphOpt {this} { |
|---|
| 630 | # |
|---|
| 631 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 632 | upvar \#0 ${this}::data data |
|---|
| 633 | upvar \#0 ${this}::widgets widgets |
|---|
| 634 | upvar \#0 ${this}::options opt |
|---|
| 635 | set key $data(namespace) |
|---|
| 636 | ::bayesGraph::SaveGCF $this |
|---|
| 637 | #Escribe en la variable opt(GCFFile) |
|---|
| 638 | set typelist {{"Graphic Configuration Files" {".gcf"}}} |
|---|
| 639 | set file [tk_getOpenFile -title [mc "Open"] -parent $widgets(this) \ |
|---|
| 640 | -initialdir $opt(GCFlastDir)\ |
|---|
| 641 | -defaultextension .gcf -filetypes $typelist] |
|---|
| 642 | #Falta comprobar que el GCF es de mi clave |
|---|
| 643 | ::iniFile::SetGCF $key $file |
|---|
| 644 | set opt(GCFFile) $file |
|---|
| 645 | if ![string equal $file ""] { |
|---|
| 646 | set opt(GCFlastDir) [file dirname $file] |
|---|
| 647 | } |
|---|
| 648 | ::${data(namespace)}::ReadIni $this |
|---|
| 649 | ::${data(namespace)}::Configure $this |
|---|
| 650 | } |
|---|
| 651 | |
|---|
| 652 | |
|---|
| 653 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 654 | proc ::bayesGraph::SaveGraphOpt {this} { |
|---|
| 655 | # |
|---|
| 656 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 657 | upvar \#0 ${this}::data data |
|---|
| 658 | upvar \#0 ${this}::widgets widgets |
|---|
| 659 | upvar \#0 ${this}::options opt |
|---|
| 660 | set key $data(namespace) |
|---|
| 661 | #Escribe en la variable opt(GCFFile) |
|---|
| 662 | set typelist {{"Graphic Configuration Files" {".gcf"}}} |
|---|
| 663 | set file [tk_getSaveFile -title [mc "Save as"] -parent $widgets(this) \ |
|---|
| 664 | -initialdir $opt(GCFlastDir)\ |
|---|
| 665 | -defaultextension .gcf -filetypes $typelist] |
|---|
| 666 | set opt(GCFFile) $file |
|---|
| 667 | set opt(GCFlastDir) [file dirname $file] |
|---|
| 668 | ::bayesGraph::SaveGCF $this |
|---|
| 669 | WriteIni $this 1 |
|---|
| 670 | } |
|---|
| 671 | |
|---|
| 672 | |
|---|
| 673 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 674 | proc ::bayesGraph::GrapOpt {this args} { |
|---|
| 675 | # |
|---|
| 676 | # PURPUSE |
|---|
| 677 | # PARAMETERS: this -> Instace |
|---|
| 678 | # args -> options |
|---|
| 679 | # -tabshow: tab selected |
|---|
| 680 | # -nlne: line show |
|---|
| 681 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 682 | global toltk_options |
|---|
| 683 | upvar \#0 ${this}::widgets widgets |
|---|
| 684 | upvar \#0 ${this}::data data |
|---|
| 685 | # options |
|---|
| 686 | array set opts [list \ |
|---|
| 687 | -tabshow {} \ |
|---|
| 688 | -nline 1 \ |
|---|
| 689 | -iniaxis x |
|---|
| 690 | ] |
|---|
| 691 | array set opts $args |
|---|
| 692 | |
|---|
| 693 | set path $widgets(this) |
|---|
| 694 | set dialog [Dialog $path.t -title [mc "Graph Options"]\ |
|---|
| 695 | -modal local -parent $path] |
|---|
| 696 | |
|---|
| 697 | wm protocol $dialog WM_DELETE_WINDOW [list ::bayesGraph::GrapOptDestroy $this $dialog] |
|---|
| 698 | set w [$dialog getframe] |
|---|
| 699 | wm resizable $dialog 0 0 |
|---|
| 700 | set w_tabset [::blt::tabset $w.ts -relief flat -highlightthickness 0\ |
|---|
| 701 | -bd 0 -outerpad 0 -tier 2 -slant both -textside right\ |
|---|
| 702 | -side left -rotate 90 ] |
|---|
| 703 | |
|---|
| 704 | #insertar tabset |
|---|
| 705 | $w_tabset insert end General |
|---|
| 706 | set f0 [frame $w_tabset.f0] |
|---|
| 707 | $w_tabset tab configure "General" -text [mc "General"]\ |
|---|
| 708 | -window $f0 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 709 | #Crear opciones generales |
|---|
| 710 | eval GrapOptCreate $this $f0 [array get opts] |
|---|
| 711 | #Crear opciones especificas |
|---|
| 712 | if [info exists ${this}::data(proc,OnOptionCreate)] { |
|---|
| 713 | $data(proc,OnOptionCreate) $this $w_tabset |
|---|
| 714 | } |
|---|
| 715 | |
|---|
| 716 | set w_bbox \ |
|---|
| 717 | [ButtonBox $w.bb -orient horizontal -spacing 10 -padx 0 -pady 0 \ |
|---|
| 718 | -homogeneous false] |
|---|
| 719 | $w_bbox add -text [mc "Accept"] -image [::Bitmap::get accept] \ |
|---|
| 720 | -helptext [mc "OK"] -relief link -compound left -padx 5 -pady 1\ |
|---|
| 721 | -command [list ::bayesGraph::GrapOptOK $this $dialog] |
|---|
| 722 | $w_bbox add -text [mc "Cancel"] -image [::Bitmap::get cancelx] \ |
|---|
| 723 | -helptext [mc "Cancel"] -relief link -compound left -padx 5 -pady 1\ |
|---|
| 724 | -command [list ::bayesGraph::GrapOptDestroy $this $dialog] |
|---|
| 725 | $w_bbox add -text [mc "Apply"] -image [::Bitmap::get apply] \ |
|---|
| 726 | -helptext [mc "Apply"] -relief link -compound left -padx 5 -pady 1\ |
|---|
| 727 | -command [list ::bayesGraph::GrapOptApply $this] |
|---|
| 728 | |
|---|
| 729 | if {$data(gr,numGraph) > 1} { |
|---|
| 730 | $w_bbox add -text [mc "Apply to all"] -image [::Bitmap::get applyAll] \ |
|---|
| 731 | -helptext [mc "Apply to all"] -relief link -compound left -padx 5 -pady 1\ |
|---|
| 732 | -command [list ::bayesGraph::GrapOptApplyAll $this] |
|---|
| 733 | } |
|---|
| 734 | |
|---|
| 735 | pack $w_bbox -fill x -expand false -side bottom |
|---|
| 736 | pack $w_tabset -fill both -expand true |
|---|
| 737 | bind $dialog <F1> "ShowHelp Tb4GraOpc" |
|---|
| 738 | |
|---|
| 739 | $dialog draw |
|---|
| 740 | } |
|---|
| 741 | |
|---|
| 742 | |
|---|
| 743 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 744 | proc ::bayesGraph::GrapOptDestroy {this dialog} { |
|---|
| 745 | # |
|---|
| 746 | # PURPOSE: Destroy graph options dialog. It also call to procedure that |
|---|
| 747 | # destroy specific options of a bayesGraph's child. |
|---|
| 748 | # |
|---|
| 749 | # PARAMETERS: |
|---|
| 750 | # this -> Instance of bayesGraph |
|---|
| 751 | # dialog -> Graph options dialog |
|---|
| 752 | # |
|---|
| 753 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 754 | upvar \#0 ${this}::data data |
|---|
| 755 | variable tmpOpt |
|---|
| 756 | |
|---|
| 757 | #Destruir opciones especificas |
|---|
| 758 | unset data(lines,selectant) |
|---|
| 759 | if [info exists ${this}::data(proc,OnOptionDestroy)] { |
|---|
| 760 | $data(proc,OnOptionDestroy) $this |
|---|
| 761 | } |
|---|
| 762 | array unset tmpOpt |
|---|
| 763 | destroy $dialog |
|---|
| 764 | } |
|---|
| 765 | |
|---|
| 766 | |
|---|
| 767 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 768 | proc ::bayesGraph::GrapOptCreate {this frame args} { |
|---|
| 769 | # |
|---|
| 770 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 771 | upvar \#0 ${this}::widgets widgets |
|---|
| 772 | # options |
|---|
| 773 | array set opts [list \ |
|---|
| 774 | -tabshow {} \ |
|---|
| 775 | -nline 1 \ |
|---|
| 776 | -iniaxis x |
|---|
| 777 | ] |
|---|
| 778 | array set opts $args |
|---|
| 779 | |
|---|
| 780 | set widgets(general,w_tabset) [::blt::tabset $frame.ts -relief flat \ |
|---|
| 781 | -highlightthickness 0 -bd 0 -outerpad 0 -tier 2 -slant right \ |
|---|
| 782 | -textside right] |
|---|
| 783 | #puts "GrapOptCreate. $widgets(general,w_tabset)" |
|---|
| 784 | $widgets(general,w_tabset) insert end Axis Lines Grid Legend Style |
|---|
| 785 | |
|---|
| 786 | set f1 [frame $widgets(general,w_tabset).f1] |
|---|
| 787 | set f2 [frame $widgets(general,w_tabset).f2] |
|---|
| 788 | set f3 [frame $widgets(general,w_tabset).f3] |
|---|
| 789 | set f4 [frame $widgets(general,w_tabset).f4] |
|---|
| 790 | set f5 [frame $widgets(general,w_tabset).f5] |
|---|
| 791 | |
|---|
| 792 | $widgets(general,w_tabset) tab configure "Axis" -text "[mc "Axis"]" \ |
|---|
| 793 | -window $f1 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 794 | $widgets(general,w_tabset) tab configure "Lines" -text [mc "Lines"] \ |
|---|
| 795 | -window $f2 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 796 | $widgets(general,w_tabset) tab configure "Grid" -text [mc "Grid"] \ |
|---|
| 797 | -window $f3 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 798 | $widgets(general,w_tabset) tab configure "Legend" -text [mc "Legend"] \ |
|---|
| 799 | -window $f4 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 800 | $widgets(general,w_tabset) tab configure "Style" -text [mc "Style"] \ |
|---|
| 801 | -window $f5 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 802 | |
|---|
| 803 | GrapOptGet $this |
|---|
| 804 | GrapOptCreateAxisXY $this $f1 $opts(-iniaxis) |
|---|
| 805 | GrapOptCreateLines $this $f2 $opts(-nline) |
|---|
| 806 | |
|---|
| 807 | GrapOptCreateGrid $this $f3 |
|---|
| 808 | GrapOptCreateLegend $this $f4 |
|---|
| 809 | GrapOptCreateStyle $this $f5 |
|---|
| 810 | |
|---|
| 811 | GrapOptInit $this |
|---|
| 812 | GrapOptCheck $this |
|---|
| 813 | #GrapOptSet $this |
|---|
| 814 | |
|---|
| 815 | # show tabset indicates |
|---|
| 816 | if {[string length $opts(-tabshow)]} { |
|---|
| 817 | set ts $widgets(general,w_tabset) |
|---|
| 818 | $ts select [$ts index -name $opts(-tabshow)] |
|---|
| 819 | } |
|---|
| 820 | |
|---|
| 821 | grid $widgets(general,w_tabset) -sticky news |
|---|
| 822 | grid rowconfigure $frame 0 -weight 1 |
|---|
| 823 | grid columnconfigure $frame 0 -weight 1 |
|---|
| 824 | } |
|---|
| 825 | |
|---|
| 826 | |
|---|
| 827 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 828 | proc ::bayesGraph::ShowAxisSelectXY {this} { |
|---|
| 829 | # |
|---|
| 830 | # PURPOSE: Muestra la informacion relativa al axis seleccionado |
|---|
| 831 | # |
|---|
| 832 | # PARAMETERS: this -> instancia del grafico |
|---|
| 833 | # |
|---|
| 834 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 835 | # completamos las accines pendientes de visualizacion |
|---|
| 836 | update idletasks |
|---|
| 837 | |
|---|
| 838 | global toltk_options |
|---|
| 839 | upvar \#0 ${this}::data data |
|---|
| 840 | set gr $data(gr,active) |
|---|
| 841 | variable tmpOpt |
|---|
| 842 | # eje acutal |
|---|
| 843 | set axis $tmpOpt(var,xyAxisSelect) |
|---|
| 844 | |
|---|
| 845 | # asignacion de valores |
|---|
| 846 | foreach {a b} [list $tmpOpt(var,xyOldAxis) xy xy $axis] { |
|---|
| 847 | if {[info exists tmpOpt(var,${b}AxisShow)]} { |
|---|
| 848 | set tmpOpt(var,${a}AxisShow) $tmpOpt(var,${b}AxisShow) |
|---|
| 849 | set tmpOpt(var,${a}AxisMin) $tmpOpt(var,${b}AxisMin) |
|---|
| 850 | set tmpOpt(var,${a}AxisMax) $tmpOpt(var,${b}AxisMax) |
|---|
| 851 | set tmpOpt(var,${a}AxisAll) $tmpOpt(var,${b}AxisAll) |
|---|
| 852 | set tmpOpt(var,${a}TicksType) $tmpOpt(var,${b}TicksType) |
|---|
| 853 | set tmpOpt(var,${a}TicksTotal) $tmpOpt(var,${b}TicksTotal) |
|---|
| 854 | set tmpOpt(var,${a}TicksStep) $tmpOpt(var,${b}TicksStep) |
|---|
| 855 | set tmpOpt(var,${a}TicksFont) $tmpOpt(var,${b}TicksFont) |
|---|
| 856 | set tmpOpt(var,${a}TicksRotate) $tmpOpt(var,${b}TicksRotate) |
|---|
| 857 | set tmpOpt(var,${a}TicksColor) $tmpOpt(var,${b}TicksColor) |
|---|
| 858 | set tmpOpt(var,${a}TicksLength) $tmpOpt(var,${b}TicksLength) |
|---|
| 859 | set tmpOpt(var,${a}TicksShadow) $tmpOpt(var,${b}TicksShadow) |
|---|
| 860 | set tmpOpt(var,${a}TicksSubdivisions) $tmpOpt(var,${b}TicksSubdivisions) |
|---|
| 861 | set tmpOpt(var,${a}TicksShow) $tmpOpt(var,${b}TicksShow) |
|---|
| 862 | set tmpOpt(var,${a}TicksWidth) $tmpOpt(var,${b}TicksWidth) |
|---|
| 863 | |
|---|
| 864 | set tmpOpt(var,${a}AxisTitle) $tmpOpt(var,${b}AxisTitle) |
|---|
| 865 | set tmpOpt(var,${a}AxisColor) $tmpOpt(var,${b}AxisColor) |
|---|
| 866 | set tmpOpt(var,${a}AxisFont) $tmpOpt(var,${b}AxisFont) |
|---|
| 867 | set tmpOpt(var,${a}AxisShadow) $tmpOpt(var,${b}AxisShadow) |
|---|
| 868 | |
|---|
| 869 | set tmpOpt(var,${a}FormatNumber) $tmpOpt(var,${b}FormatNumber) |
|---|
| 870 | set tmpOpt(var,${a}FormatPercent) $tmpOpt(var,${b}FormatPercent) |
|---|
| 871 | |
|---|
| 872 | set tmpOpt(var,${a}Markers) $tmpOpt(var,${b}Markers) |
|---|
| 873 | set tmpOpt(var,${a}MarkersIn) $tmpOpt(var,${b}MarkersIn) |
|---|
| 874 | |
|---|
| 875 | foreach j {0 1 2 3 4} { |
|---|
| 876 | set tmpOpt(var,${a}MarkerColorInEach$j) $tmpOpt(var,${b}MarkerColorInEach$j) |
|---|
| 877 | set tmpOpt(var,${a}MarkerWidthInEach$j) $tmpOpt(var,${b}MarkerWidthInEach$j) |
|---|
| 878 | set tmpOpt(var,${a}MarkerDasheInEach$j) $tmpOpt(var,${b}MarkerDasheInEach$j) |
|---|
| 879 | set tmpOpt(var,${a}MarkerUnderInEach$j) $tmpOpt(var,${b}MarkerUnderInEach$j) |
|---|
| 880 | } |
|---|
| 881 | } |
|---|
| 882 | } |
|---|
| 883 | # Etiquetas para los ejes |
|---|
| 884 | set AXI [string toupper [string index $axis 0]] |
|---|
| 885 | if {[info exists data(gr,$gr,OnGet${AXI}Ticks)]} { |
|---|
| 886 | if {[string is double $tmpOpt(var,${axis}AxisMin)] && \ |
|---|
| 887 | [string length $tmpOpt(var,${axis}AxisMin)] } { |
|---|
| 888 | set value [lindex [$data(gr,$gr,OnGet${AXI}Ticks) $this] \ |
|---|
| 889 | [expr int(floor($tmpOpt(var,${axis}AxisMin)))]] |
|---|
| 890 | if {[string length $value]} { |
|---|
| 891 | set tmpOpt(var,xyAxisMin) $value |
|---|
| 892 | } |
|---|
| 893 | } |
|---|
| 894 | if {[string is double $tmpOpt(var,${axis}AxisMax)] && \ |
|---|
| 895 | [string length $tmpOpt(var,${axis}AxisMax)]} { |
|---|
| 896 | set value [lindex [$data(gr,$gr,OnGet${AXI}Ticks) $this] \ |
|---|
| 897 | [expr int(floor($tmpOpt(var,${axis}AxisMax)))]] |
|---|
| 898 | if {[string length $value]} { |
|---|
| 899 | set tmpOpt(var,xyAxisMax) $value |
|---|
| 900 | } |
|---|
| 901 | } |
|---|
| 902 | } |
|---|
| 903 | # activamos opciones dependiendo de la pulsacion |
|---|
| 904 | # GrapOptCheckXYTicksType $this |
|---|
| 905 | |
|---|
| 906 | GrapOptCheckXYAxisAll $this |
|---|
| 907 | # guardamos valor actual |
|---|
| 908 | set tmpOpt(var,xyOldAxis) $axis |
|---|
| 909 | } |
|---|
| 910 | |
|---|
| 911 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 912 | proc ::bayesGraph::GrapOptCreateAxisXY {this w {iniaxis x}} { |
|---|
| 913 | # |
|---|
| 914 | # PURPOSE: Muestra la informacion relativa al axis seleccionado |
|---|
| 915 | # |
|---|
| 916 | # PARAMETERS: this -> instancia del grafico |
|---|
| 917 | # |
|---|
| 918 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 919 | global toltk_options |
|---|
| 920 | upvar \#0 ${this}::data data |
|---|
| 921 | variable tmpOpt |
|---|
| 922 | set gr $data(gr,active) |
|---|
| 923 | # X-Selector |
|---|
| 924 | TitleFrame $w.tfxs -text [mc "Axis"] |
|---|
| 925 | set fs [$w.tfxs getframe] |
|---|
| 926 | # inizializamos visulizacion |
|---|
| 927 | set tmpOpt(var,xyOldAxis) $iniaxis |
|---|
| 928 | set tmpOpt(var,xyAxisSelect) $iniaxis |
|---|
| 929 | ShowAxisSelectXY $this |
|---|
| 930 | |
|---|
| 931 | set tmpOpt(widget,rbAxisX) [radiobutton $fs.rbAxisX -text "X: [mc Bottom]"\ |
|---|
| 932 | -value x -highlightthickness 0 -pady 0 \ |
|---|
| 933 | -variable ::bayesGraph::tmpOpt(var,xyAxisSelect) \ |
|---|
| 934 | -command [list ::bayesGraph::ShowAxisSelectXY $this]] |
|---|
| 935 | set tmpOpt(widget,rbAxisX2) [radiobutton $fs.rbAxisX2 -text "X2: [mc Top]"\ |
|---|
| 936 | -value x2 -highlightthickness 0 -pady 0\ |
|---|
| 937 | -variable ::bayesGraph::tmpOpt(var,xyAxisSelect) \ |
|---|
| 938 | -command [list ::bayesGraph::ShowAxisSelectXY $this]] |
|---|
| 939 | set tmpOpt(widget,rbAxisY) [radiobutton $fs.rbAxisY -text "Y: [mc Left]" \ |
|---|
| 940 | -value y -highlightthickness 0 -pady 0 \ |
|---|
| 941 | -variable ::bayesGraph::tmpOpt(var,xyAxisSelect) \ |
|---|
| 942 | -command [list ::bayesGraph::ShowAxisSelectXY $this]] |
|---|
| 943 | set tmpOpt(widget,rbAxisY2) [radiobutton $fs.rbAxisY2 -text "Y2: [mc Right]"\ |
|---|
| 944 | -value y2 -highlightthickness 0 -pady 0\ |
|---|
| 945 | -variable ::bayesGraph::tmpOpt(var,xyAxisSelect) \ |
|---|
| 946 | -command [list ::bayesGraph::ShowAxisSelectXY $this]] |
|---|
| 947 | |
|---|
| 948 | grid $fs.rbAxisX -sticky nws -pady 2 |
|---|
| 949 | grid $fs.rbAxisX2 -sticky nws -pady 2 |
|---|
| 950 | grid $fs.rbAxisY -sticky nws -pady 2 |
|---|
| 951 | grid $fs.rbAxisY2 -sticky nws -pady 2 |
|---|
| 952 | |
|---|
| 953 | grid rowconfigure $fs 9 -weight 1 |
|---|
| 954 | grid columnconfigure $fs 0 -weight 1 |
|---|
| 955 | |
|---|
| 956 | # Tab Set |
|---|
| 957 | set w_tabset [::blt::tabset $w.ts -relief flat -highlightthickness 0\ |
|---|
| 958 | -bd 0 -outerpad 0 -tier 2 -slant right -textside right] |
|---|
| 959 | $w_tabset insert end Scales Title Format Marker |
|---|
| 960 | |
|---|
| 961 | set f1 [frame $w_tabset.f1] |
|---|
| 962 | set f2 [frame $w_tabset.f2] |
|---|
| 963 | set f3 [frame $w_tabset.f3] |
|---|
| 964 | set f4 [frame $w_tabset.f4] |
|---|
| 965 | |
|---|
| 966 | $w_tabset tab configure "Scales" -text [mc Scales] -window $f1 \ |
|---|
| 967 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 968 | $w_tabset tab configure "Format" -text [mc Format] -window $f2 \ |
|---|
| 969 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 970 | $w_tabset tab configure "Marker" -text [mc Marker] -window $f3 \ |
|---|
| 971 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 972 | $w_tabset tab configure "Title" -text [mc Title] -window $f4 \ |
|---|
| 973 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 974 | |
|---|
| 975 | # X-Axis |
|---|
| 976 | TitleFrame $f1.tf1a -text [mc "Scales"] |
|---|
| 977 | set f1a [$f1.tf1a getframe] |
|---|
| 978 | |
|---|
| 979 | checkbutton $f1a.chShow -text [mc "Visible"]\ |
|---|
| 980 | -highlightthickness 0 -pady 0 -padx 0\ |
|---|
| 981 | -variable ::bayesGraph::tmpOpt(var,xyAxisShow) |
|---|
| 982 | |
|---|
| 983 | set AXI [string toupper [string index $tmpOpt(var,xyAxisSelect) 0]] |
|---|
| 984 | #Comprobamos que existe la funcion |
|---|
| 985 | if {[info exists data(gr,$gr,OnGet${AXI}Ticks)]} { |
|---|
| 986 | set lst [$data(gr,$gr,OnGet${AXI}Ticks) $this] |
|---|
| 987 | } else { |
|---|
| 988 | set lst {} |
|---|
| 989 | } |
|---|
| 990 | |
|---|
| 991 | label $f1a.lFirst -text [mc First]: |
|---|
| 992 | set tmpOpt(widget,xyAxisMin) \ |
|---|
| 993 | [SpinBox $f1a.sbFirst -values $lst -justify right -width 20 \ |
|---|
| 994 | -textvariable ::bayesGraph::tmpOpt(var,xyAxisMin)] |
|---|
| 995 | |
|---|
| 996 | label $f1a.lLast -text [mc Last]: |
|---|
| 997 | set tmpOpt(widget,xyAxisMax) \ |
|---|
| 998 | [SpinBox $f1a.sbLast -values $lst -justify right -width 20 \ |
|---|
| 999 | -textvariable ::bayesGraph::tmpOpt(var,xyAxisMax)] |
|---|
| 1000 | |
|---|
| 1001 | set tmpOpt(widget,chXYAll) \ |
|---|
| 1002 | [checkbutton $f1a.chAll -text [mc "All values"]\ |
|---|
| 1003 | -highlightthickness 0 -pady 0 -padx 0\ |
|---|
| 1004 | -variable ::bayesGraph::tmpOpt(var,xyAxisAll)\ |
|---|
| 1005 | -command [list ::bayesGraph::GrapOptCheckXYAxisAll $this]] |
|---|
| 1006 | |
|---|
| 1007 | grid $f1a.chShow - -sticky w -pady 2 |
|---|
| 1008 | grid $f1a.lFirst $f1a.sbFirst -sticky w -pady 2 |
|---|
| 1009 | grid $f1a.lLast $f1a.sbLast -sticky w -pady 2 |
|---|
| 1010 | grid $f1a.chAll -column 1 -sticky nw |
|---|
| 1011 | grid rowconfigure $f1a 3 -weight 1 |
|---|
| 1012 | grid columnconfigure $f1a 1 -weight 1 |
|---|
| 1013 | |
|---|
| 1014 | # X-Axis ticks |
|---|
| 1015 | TitleFrame $f1.tf1b -text [mc "Ticks"] |
|---|
| 1016 | set f1b [$f1.tf1b getframe] |
|---|
| 1017 | |
|---|
| 1018 | set tmpOpt(widget,rbXYTotal) [radiobutton $f1b.rbTotal -text [mc Total]:\ |
|---|
| 1019 | -value total -highlightthickness 0 -pady 0\ |
|---|
| 1020 | -variable ::bayesGraph::tmpOpt(var,xyTicksType)\ |
|---|
| 1021 | -command [list ::bayesGraph::GrapOptCheckXYTicksType $this]] |
|---|
| 1022 | set tmpOpt(widget,rbXYEach) [radiobutton $f1b.rbEach -text [mc Each]:\ |
|---|
| 1023 | -value each -highlightthickness 0 -pady 0\ |
|---|
| 1024 | -variable ::bayesGraph::tmpOpt(var,xyTicksType)\ |
|---|
| 1025 | -command [list ::bayesGraph::GrapOptCheckXYTicksType $this]] |
|---|
| 1026 | set tmpOpt(widget,rbXYAuto) [radiobutton $f1b.rbAuto -text [mc Automatic]\ |
|---|
| 1027 | -value auto -highlightthickness 0 -pady 0\ |
|---|
| 1028 | -variable ::bayesGraph::tmpOpt(var,xyTicksType)\ |
|---|
| 1029 | -command [list ::bayesGraph::GrapOptCheckXYTicksType $this]] |
|---|
| 1030 | |
|---|
| 1031 | set tmpOpt(widget,xyTicksTotal) [Entry $f1b.eTicksTotal -validate key\ |
|---|
| 1032 | -vcmd {expr {[string is int %P] && [string length %P]<3}}\ |
|---|
| 1033 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,xyTicksTotal)] |
|---|
| 1034 | set tmpOpt(widget,xyTicksStep) [Entry $f1b.eTicksStep -validate key\ |
|---|
| 1035 | -vcmd {expr {[string is double %P] && [string length %P]<9}}\ |
|---|
| 1036 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,xyTicksStep)] |
|---|
| 1037 | |
|---|
| 1038 | frame $f1b.f |
|---|
| 1039 | label $f1b.f.lFont -text [mc "Font"]: |
|---|
| 1040 | bfont $f1b.f.bFont -variable ::bayesGraph::tmpOpt(var,xyTicksFont) |
|---|
| 1041 | label $f1b.f.lRotate -text [mc "Rotate"]: |
|---|
| 1042 | SpinBox $f1b.f.sbRotate -range {0 360} -width 4 -justify right -editable true\ |
|---|
| 1043 | -textvariable ::bayesGraph::tmpOpt(var,xyTicksRotate) |
|---|
| 1044 | label $f1b.f.lColor -text [mc "Color"]: |
|---|
| 1045 | bcolor $f1b.f.fColor -variable ::bayesGraph::tmpOpt(var,xyTicksColor) |
|---|
| 1046 | label $f1b.f.lLength -text [mc "Length"]: |
|---|
| 1047 | SpinBox $f1b.f.sbLength -range {0 20} -width 4 -justify right -editable true\ |
|---|
| 1048 | -textvariable ::bayesGraph::tmpOpt(var,xyTicksLength) |
|---|
| 1049 | label $f1b.f.lShadow -text [mc "Shadow"]: |
|---|
| 1050 | bcolor $f1b.f.fShadow -variable ::bayesGraph::tmpOpt(var,xyTicksShadow) \ |
|---|
| 1051 | -label "[mc "Change Shadow"]:" -optmenu 1 |
|---|
| 1052 | label $f1b.f.lSubdiv -text [mc "Subdivisions"]: |
|---|
| 1053 | SpinBox $f1b.f.sbSubdiv -range {1 10} -width 4 -justify right -editable true\ |
|---|
| 1054 | -textvariable ::bayesGraph::tmpOpt(var,xyTicksSubdivisions) |
|---|
| 1055 | checkbutton $f1b.f.chShow -text [mc "Show ticks"]\ |
|---|
| 1056 | -highlightthickness 0 -pady 0 -padx 0\ |
|---|
| 1057 | -variable ::bayesGraph::tmpOpt(var,xyTicksShow) |
|---|
| 1058 | label $f1b.f.lWidth -text [mc "Line width"]: |
|---|
| 1059 | SpinBox $f1b.f.sbWidth -range {0 10} -width 4 -justify right -editable true\ |
|---|
| 1060 | -textvariable ::bayesGraph::tmpOpt(var,xyTicksWidth) |
|---|
| 1061 | |
|---|
| 1062 | frame $f1b.f.f -width 15 |
|---|
| 1063 | grid $f1b.f.f $f1b.f.chShow - $f1b.f.lWidth $f1b.f.sbWidth -sticky nw -padx 2 |
|---|
| 1064 | grid ^ $f1b.f.lFont $f1b.f.bFont $f1b.f.lRotate $f1b.f.sbRotate -sticky nw -padx 2 |
|---|
| 1065 | grid ^ $f1b.f.lColor $f1b.f.fColor $f1b.f.lLength $f1b.f.sbLength -sticky nw -padx 2 |
|---|
| 1066 | grid ^ $f1b.f.lShadow $f1b.f.fShadow $f1b.f.lSubdiv $f1b.f.sbSubdiv -sticky nw -padx 2 |
|---|
| 1067 | grid columnconfigure $f1b.f 2 -pad 12 |
|---|
| 1068 | |
|---|
| 1069 | grid $f1b.rbTotal $f1b.eTicksTotal -sticky w |
|---|
| 1070 | grid $f1b.rbEach $f1b.eTicksStep -sticky w |
|---|
| 1071 | grid $f1b.rbAuto - -sticky nw |
|---|
| 1072 | grid $f1b.f - -sticky ns -pady 4 |
|---|
| 1073 | grid rowconfigure $f1b 5 -weight 1 |
|---|
| 1074 | grid columnconfigure $f1b 2 -weight 1 |
|---|
| 1075 | |
|---|
| 1076 | grid $f1.tf1a -sticky news -padx 2 |
|---|
| 1077 | grid $f1.tf1b -sticky news -padx 2 |
|---|
| 1078 | grid rowconfigure $f1 0 -weight 1 |
|---|
| 1079 | grid rowconfigure $f1 1 -weight 3 |
|---|
| 1080 | grid columnconfigure $f1 0 -weight 1 |
|---|
| 1081 | |
|---|
| 1082 | # Tab Title |
|---|
| 1083 | TitleFrame $f4.tf -text [mc "Title"] |
|---|
| 1084 | set f4a [$f4.tf getframe] |
|---|
| 1085 | ::bayesGraph::GrapOptCreateTitles \ |
|---|
| 1086 | $this $f4a [list xyAxisTitle xyAxisFont xyAxisColor xyAxisShadow] |
|---|
| 1087 | |
|---|
| 1088 | grid $f4.tf -sticky news -padx 2 |
|---|
| 1089 | grid rowconfigure $f4 0 -weight 1 |
|---|
| 1090 | grid columnconfigure $f4 0 -weight 1 |
|---|
| 1091 | |
|---|
| 1092 | # Tab Set Format |
|---|
| 1093 | TitleFrame $f2.tf -text [mc "Number"] |
|---|
| 1094 | set f2a [$f2.tf getframe] |
|---|
| 1095 | # Number |
|---|
| 1096 | set tmpOpt(var,eNumText) 12345.67890 |
|---|
| 1097 | set tmpOpt(var,eSamText) "" |
|---|
| 1098 | |
|---|
| 1099 | label $f2a.lFormat -text [mc "Format"]: |
|---|
| 1100 | Entry $f2a.eFormat -width 60 -justify left -text $tmpOpt(var,xyFormatNumber) \ |
|---|
| 1101 | -textvariable ::bayesGraph::tmpOpt(var,xyFormatNumber) |
|---|
| 1102 | |
|---|
| 1103 | checkbutton $f2a.chPercent -text [mc "Show percent"] \ |
|---|
| 1104 | -highlightthickness 0 -pady 0 -padx 0 \ |
|---|
| 1105 | -variable ::bayesGraph::tmpOpt(var,xyFormatPercent) \ |
|---|
| 1106 | -command [list ::bayesGraph::CheckPercent $this] |
|---|
| 1107 | |
|---|
| 1108 | label $f2a.lNumber -text [mc "Number"]: |
|---|
| 1109 | Entry $f2a.eNumber -width 30 -justify right \ |
|---|
| 1110 | -validate key -vcmd {string is double %P} \ |
|---|
| 1111 | -text $tmpOpt(var,eNumText) -textvariable ::bayesGraph::tmpOpt(var,eNumText) |
|---|
| 1112 | |
|---|
| 1113 | Button $f2a.bApply -text [mc Prove]\ |
|---|
| 1114 | -helptext [mc "It proves the specified format"]\ |
|---|
| 1115 | -command [list ::bayesGraph::ProveNumber $this] |
|---|
| 1116 | |
|---|
| 1117 | label $f2a.lSample -text [mc "Sample"]: |
|---|
| 1118 | Entry $f2a.eSample -width 60 -justify left -editable 0 \ |
|---|
| 1119 | -text $tmpOpt(var,eSamText) -textvariable ::bayesGraph::tmpOpt(var,eSamText) |
|---|
| 1120 | |
|---|
| 1121 | button $f2a.bHelpNumFor -text [mc "Format number"] \ |
|---|
| 1122 | -image [::Bitmap::get infor] -compound left \ |
|---|
| 1123 | -command [list ::bayesGraph::ShowNumberSpecifiers $this $w] |
|---|
| 1124 | |
|---|
| 1125 | grid $f2a.lFormat $f2a.eFormat - -sticky nw -padx 5 -pady 5 |
|---|
| 1126 | grid $f2a.chPercent - - -sticky nw -padx 5 -pady 5 |
|---|
| 1127 | grid $f2a.lNumber $f2a.eNumber $f2a.bApply -sticky nw -padx 5 -pady 5 |
|---|
| 1128 | grid $f2a.lSample $f2a.eSample - -sticky nw -padx 5 -pady 5 |
|---|
| 1129 | grid $f2a.bHelpNumFor - - -sticky nw -padx 5 -pady 5 |
|---|
| 1130 | |
|---|
| 1131 | grid rowconfigure $f2a 6 -weight 1 |
|---|
| 1132 | grid columnconfigure $f2a 1 -weight 1 |
|---|
| 1133 | |
|---|
| 1134 | # Text |
|---|
| 1135 | grid $f2.tf -sticky news -padx 2 |
|---|
| 1136 | grid rowconfigure $f2 0 -weight 1 |
|---|
| 1137 | grid columnconfigure $f2 0 -weight 1 |
|---|
| 1138 | |
|---|
| 1139 | # Marker |
|---|
| 1140 | GrapOptCreateMarkers $this $f3 |
|---|
| 1141 | |
|---|
| 1142 | # Auto-ajuste |
|---|
| 1143 | TitleFrame $w.tfsf -text [mc "Self fit of values"] |
|---|
| 1144 | set f3 [$w.tfsf getframe] |
|---|
| 1145 | |
|---|
| 1146 | checkbutton $f3.cbSelfFit \ |
|---|
| 1147 | -text [mc "Self fit of axes to the data of the graph to open"] \ |
|---|
| 1148 | -highlightthickness 0 -pady 0 -padx 0 -offvalue 0 -onvalue 1 \ |
|---|
| 1149 | -variable ::bayesGraph::tmpOpt(var,selffit) |
|---|
| 1150 | |
|---|
| 1151 | grid $f3.cbSelfFit -sticky nw -padx 2 -pady 4 |
|---|
| 1152 | grid rowconfigure $f3 1 -weight 1 |
|---|
| 1153 | grid columnconfigure $f3 1 -weight 1 |
|---|
| 1154 | |
|---|
| 1155 | |
|---|
| 1156 | # General |
|---|
| 1157 | grid $w.tfxs $w_tabset -sticky news -padx 2 |
|---|
| 1158 | grid ^ $w.tfsf -sticky news -padx 2 |
|---|
| 1159 | grid rowconfigure $w 0 -weight 1 |
|---|
| 1160 | grid rowconfigure $w 1 -weight 0 |
|---|
| 1161 | grid columnconfigure $w 1 -weight 1 |
|---|
| 1162 | } |
|---|
| 1163 | |
|---|
| 1164 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1165 | proc ::bayesGraph::ShowNumberSpecifiers {this w} { |
|---|
| 1166 | # |
|---|
| 1167 | # PURPOSE: Muestra una ventana con informacion sobre como dar formato a un |
|---|
| 1168 | # numero. Tambien se puede especificar el formato deseado y hacer pruebas |
|---|
| 1169 | # |
|---|
| 1170 | # PARAMETERS: |
|---|
| 1171 | # this -> Instance of BayesGraph |
|---|
| 1172 | # w -> Tabset axis |
|---|
| 1173 | # axis -> axis [y | y2] |
|---|
| 1174 | # |
|---|
| 1175 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1176 | if [winfo exist $w.t] { |
|---|
| 1177 | raise $w.numberFormat |
|---|
| 1178 | return |
|---|
| 1179 | } |
|---|
| 1180 | global toltk_options |
|---|
| 1181 | upvar \#0 ${this}::data data |
|---|
| 1182 | variable tmpOpt |
|---|
| 1183 | set dialog [Dialog $w.numberFormat -title [mc "Number format"]\ |
|---|
| 1184 | -default 0 -parent $w -modal local -separator true] |
|---|
| 1185 | wm resizable $dialog 0 0 |
|---|
| 1186 | set f1 [$dialog getframe] |
|---|
| 1187 | set color1 red |
|---|
| 1188 | # help |
|---|
| 1189 | label $f1.lmenos -text "%-" -foreground $color1 |
|---|
| 1190 | label $f1.lmenosd -justify left -text [mc ForNumOpc:-] |
|---|
| 1191 | |
|---|
| 1192 | label $f1.lmas -text "%+" -foreground $color1 |
|---|
| 1193 | label $f1.lmasd -justify left -text [mc ForNumOpc:+] |
|---|
| 1194 | |
|---|
| 1195 | label $f1.lspace -text "%space" -foreground $color1 |
|---|
| 1196 | label $f1.lspaced -justify left -text [mc "ForNumOpc:Space"] |
|---|
| 1197 | |
|---|
| 1198 | label $f1.zero -text "%0" -foreground $color1 |
|---|
| 1199 | label $f1.zerod -justify left -text [mc "ForNumOpc:Zero"] |
|---|
| 1200 | |
|---|
| 1201 | label $f1.lf -text "%f" -foreground $color1 |
|---|
| 1202 | label $f1.lfd -justify left -text [mc "ForNumOpc:f"] |
|---|
| 1203 | |
|---|
| 1204 | label $f1.leE -text "%e %E" -foreground $color1 |
|---|
| 1205 | label $f1.leEd -justify left -text [mc "ForNumOpc:e"] |
|---|
| 1206 | |
|---|
| 1207 | label $f1.lgG -text "%g %G" -foreground $color1 |
|---|
| 1208 | label $f1.lgGd -justify left -text [mc "ForNumOpc:g"] |
|---|
| 1209 | |
|---|
| 1210 | label $f1.lpercent -text "%%" -foreground $color1 |
|---|
| 1211 | label $f1.lpercentd -text [mc "No conversion: just insert %"] |
|---|
| 1212 | |
|---|
| 1213 | Button $f1.b -image [::Bitmap::get "accept"]\ |
|---|
| 1214 | -helptext [mc "OK"] -relief link -compound left -text [mc "Accept"]\ |
|---|
| 1215 | -command "destroy $dialog" |
|---|
| 1216 | |
|---|
| 1217 | grid $f1.lmenos $f1.lmenosd -sticky nw -padx 5 |
|---|
| 1218 | grid $f1.lmas $f1.lmasd -sticky nw -padx 5 |
|---|
| 1219 | grid $f1.lspace $f1.lspaced -sticky nw -padx 5 |
|---|
| 1220 | grid $f1.zero $f1.zerod -sticky nw -padx 5 |
|---|
| 1221 | grid $f1.lf $f1.lfd -sticky nw -padx 5 |
|---|
| 1222 | grid $f1.leE $f1.leEd -sticky nw -padx 5 |
|---|
| 1223 | grid $f1.lgG $f1.lgGd -sticky nw -padx 5 |
|---|
| 1224 | grid $f1.lpercent $f1.lpercentd -sticky nw -padx 5 |
|---|
| 1225 | grid $f1.b -sticky ns -columnspan 2 -pady 3 |
|---|
| 1226 | |
|---|
| 1227 | $dialog draw |
|---|
| 1228 | } |
|---|
| 1229 | |
|---|
| 1230 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1231 | proc ::bayesGraph::ProveNumber {this} { |
|---|
| 1232 | # |
|---|
| 1233 | # PURPOSE: guarda los parametros intoducidos |
|---|
| 1234 | # |
|---|
| 1235 | # PARAMETERS: |
|---|
| 1236 | # this -> Instance of BayesGraph |
|---|
| 1237 | # |
|---|
| 1238 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1239 | variable tmpOpt |
|---|
| 1240 | |
|---|
| 1241 | if {[string length $tmpOpt(var,xyFormatNumber)] && \ |
|---|
| 1242 | [string length $tmpOpt(var,eNumText)]} { |
|---|
| 1243 | if {$tmpOpt(var,xyFormatPercent)} { |
|---|
| 1244 | set n [expr $tmpOpt(var,eNumText) * 100] |
|---|
| 1245 | } else { |
|---|
| 1246 | set n $tmpOpt(var,eNumText) |
|---|
| 1247 | } |
|---|
| 1248 | if {![catch {set tmpOpt(var,eSamText) [format $tmpOpt(var,xyFormatNumber) $n]} res]} { |
|---|
| 1249 | return $tmpOpt(var,eSamText) |
|---|
| 1250 | } else { |
|---|
| 1251 | set tmpOpt(var,eSamText) "" |
|---|
| 1252 | } |
|---|
| 1253 | } else { |
|---|
| 1254 | set tmpOpt(var,eSamText) "" |
|---|
| 1255 | } |
|---|
| 1256 | } |
|---|
| 1257 | |
|---|
| 1258 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1259 | proc ::bayesGraph::CheckPercent {this} { |
|---|
| 1260 | # |
|---|
| 1261 | # PURPOSE: Añade o elimina el tanto por ciento "%%" del formato |
|---|
| 1262 | # |
|---|
| 1263 | # PARAMETERS: |
|---|
| 1264 | # this -> Instance of BayesGraph |
|---|
| 1265 | # |
|---|
| 1266 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1267 | variable tmpOpt |
|---|
| 1268 | if {$tmpOpt(var,xyFormatPercent)} { |
|---|
| 1269 | set tmpOpt(var,xyFormatNumber) $tmpOpt(var,xyFormatNumber)%% |
|---|
| 1270 | } else { |
|---|
| 1271 | set p [string first "%%" $tmpOpt(var,xyFormatNumber)] |
|---|
| 1272 | if {[expr $p >= 0]} { |
|---|
| 1273 | set tmpOpt(var,xyFormatNumber) \ |
|---|
| 1274 | [string replace $tmpOpt(var,xyFormatNumber) $p \ |
|---|
| 1275 | [expr $p + [string length "%%"] - 1] ""] |
|---|
| 1276 | } |
|---|
| 1277 | } |
|---|
| 1278 | } |
|---|
| 1279 | |
|---|
| 1280 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1281 | proc ::bayesGraph::GrapOptCreateTitles {this f lstSuf} { |
|---|
| 1282 | # |
|---|
| 1283 | # PURPOSE: Crea las opcines de visualizacion de titulos de los ejes |
|---|
| 1284 | # |
|---|
| 1285 | # PARAMETERS: |
|---|
| 1286 | # this -> Instance of BayesGraph |
|---|
| 1287 | # f -> Frame title |
|---|
| 1288 | # lstSuf -> Lista de sufijo para los nombres de las variables. de 0 a 3 |
|---|
| 1289 | # |
|---|
| 1290 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1291 | variable tmpOpt |
|---|
| 1292 | |
|---|
| 1293 | label $f.lTitle -text [mc "Title"]: |
|---|
| 1294 | Entry $f.eTitle -width 45 \ |
|---|
| 1295 | -textvariable ::bayesGraph::tmpOpt(var,[lindex $lstSuf 0]) |
|---|
| 1296 | label $f.lFont -text [mc "Font"]: |
|---|
| 1297 | bfont $f.bFont -variable ::bayesGraph::tmpOpt(var,[lindex $lstSuf 1]) |
|---|
| 1298 | label $f.lColor -text [mc "Color"]: |
|---|
| 1299 | bcolor $f.fColor -variable ::bayesGraph::tmpOpt(var,[lindex $lstSuf 2]) |
|---|
| 1300 | label $f.lShadow -text [mc "Shadow"]: |
|---|
| 1301 | bcolor $f.fShadow -variable ::bayesGraph::tmpOpt(var,[lindex $lstSuf 3]) \ |
|---|
| 1302 | -label "[mc "Change shadow"]:" -optmenu 1 |
|---|
| 1303 | |
|---|
| 1304 | frame $f.f -width 25 |
|---|
| 1305 | grid $f.f $f.lTitle $f.eTitle - - - - - -sticky nw -padx 2 -pady 3 |
|---|
| 1306 | grid ^ ^ $f.lFont $f.bFont $f.lColor $f.fColor $f.lShadow $f.fShadow\ |
|---|
| 1307 | -sticky nw -padx 2 -pady 0 |
|---|
| 1308 | |
|---|
| 1309 | grid rowconfigure $f 7 -weight 1 |
|---|
| 1310 | grid columnconfigure $f 7 -weight 1 |
|---|
| 1311 | grid columnconfigure $f 3 -pad 20 |
|---|
| 1312 | grid columnconfigure $f 5 -pad 20 |
|---|
| 1313 | } |
|---|
| 1314 | |
|---|
| 1315 | |
|---|
| 1316 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1317 | proc ::bayesGraph::GrapOptCreateLines {this w {linedefault 1}} { |
|---|
| 1318 | # |
|---|
| 1319 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1320 | upvar \#0 ${this}::widgets widgets |
|---|
| 1321 | variable tmpOpt |
|---|
| 1322 | |
|---|
| 1323 | # Lines list |
|---|
| 1324 | TitleFrame $w.tf0 -text [mc "Lines list"] |
|---|
| 1325 | set f0 [$w.tf0 getframe] |
|---|
| 1326 | |
|---|
| 1327 | set widgets(lines,lst) [blistorder $f0.linesList \ |
|---|
| 1328 | -cols [list id name caption label] -parent $w \ |
|---|
| 1329 | -hiddencols {id name caption} -selectbackground grey \ |
|---|
| 1330 | -colkeypress {label} -orientation horizontal -showtitles false \ |
|---|
| 1331 | -height 200 -width 100 \ |
|---|
| 1332 | -nomenu true -selectmode single -values $tmpOpt(var,lstnames) \ |
|---|
| 1333 | -selectcommand [list ::bayesGraph::ShowSelectLines $this]] |
|---|
| 1334 | |
|---|
| 1335 | # LIST LINES |
|---|
| 1336 | # visualizamos opciones sobre la linea default |
|---|
| 1337 | # calculation position line in listbox |
|---|
| 1338 | set i 1 |
|---|
| 1339 | set lineDef $linedefault |
|---|
| 1340 | foreach it $tmpOpt(var,lstnames) { |
|---|
| 1341 | if {[string equal $linedefault [lindex $it 0]]} { |
|---|
| 1342 | set lineDef $i |
|---|
| 1343 | } |
|---|
| 1344 | incr i |
|---|
| 1345 | } |
|---|
| 1346 | |
|---|
| 1347 | $widgets(lines,lst) selection set $lineDef |
|---|
| 1348 | ::bayesGraph::ShowOptLines $this $linedefault |
|---|
| 1349 | |
|---|
| 1350 | grid $widgets(lines,lst) -sticky news |
|---|
| 1351 | grid rowconfigure $f0 0 -weight 1 |
|---|
| 1352 | grid columnconfigure $f0 0 -weight 1 |
|---|
| 1353 | |
|---|
| 1354 | # OPTIONS LINES AND DATA |
|---|
| 1355 | set w_tabset [::blt::tabset $w.ts -relief flat -highlightthickness 0\ |
|---|
| 1356 | -bd 0 -outerpad 0 -tier 2 -slant right -textside right] |
|---|
| 1357 | $w_tabset insert end Line Data |
|---|
| 1358 | |
|---|
| 1359 | set ts1 [frame $w_tabset.f1] |
|---|
| 1360 | set ts2 [frame $w_tabset.f2] |
|---|
| 1361 | |
|---|
| 1362 | $w_tabset tab configure "Line" -text [mc "Line"] \ |
|---|
| 1363 | -window $ts1 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 1364 | $w_tabset tab configure "Data" -text [mc "Data"]\ |
|---|
| 1365 | -window $ts2 -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 1366 | |
|---|
| 1367 | GrapOptCreateLinesLine $this $ts1 |
|---|
| 1368 | GrapOptCreateLinesData $this $ts2 |
|---|
| 1369 | |
|---|
| 1370 | #GRID |
|---|
| 1371 | grid $w.tf0 $w_tabset -sticky news -padx 1 |
|---|
| 1372 | |
|---|
| 1373 | grid rowconfigure $w 0 -weight 1 |
|---|
| 1374 | |
|---|
| 1375 | grid columnconfigure $w 0 -weight 1 |
|---|
| 1376 | grid columnconfigure $w 1 -weight 0 |
|---|
| 1377 | } |
|---|
| 1378 | |
|---|
| 1379 | |
|---|
| 1380 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1381 | proc ::bayesGraph::GrapOptCreateLinesLine {this w} { |
|---|
| 1382 | # |
|---|
| 1383 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1384 | variable tmpOpt |
|---|
| 1385 | upvar \#0 ${this}::widgets widgets |
|---|
| 1386 | |
|---|
| 1387 | # Optiones lines |
|---|
| 1388 | TitleFrame $w.tf2 -text [mc "Line Options"] |
|---|
| 1389 | set f2 [$w.tf2 getframe] |
|---|
| 1390 | |
|---|
| 1391 | radiobutton $f2.rbIsLine -text [mc "Lines"] \ |
|---|
| 1392 | -value LineElement -highlightthickness 0 -pady 0 -padx 0 \ |
|---|
| 1393 | -variable ::bayesGraph::tmpOpt(var,linetypes_) |
|---|
| 1394 | label $f2.llwidth -text [mc "Lines Width"]: |
|---|
| 1395 | SpinBox $f2.sblwidth -justify right -width 4 -editable 0 -range {0 10}\ |
|---|
| 1396 | -textvariable ::bayesGraph::tmpOpt(var,linewidth_) |
|---|
| 1397 | label $f2.ldashes -text [mc "Lines Type"]: |
|---|
| 1398 | ::Objects::ComboDashesCreate ::bayesGraph::tmpOpt(var,dashes_) ${f2}.sbdashes |
|---|
| 1399 | |
|---|
| 1400 | label $f2.lSmooth -text [mc "Smooth"]: |
|---|
| 1401 | set lst {linear step natural quadratic} |
|---|
| 1402 | foreach it $lst { lappend values [mc $it] } |
|---|
| 1403 | |
|---|
| 1404 | ComboBox $f2.cbSmooth -width 15 -height 5 -editable false\ |
|---|
| 1405 | -values $values -justify right\ |
|---|
| 1406 | -modifycmd [list ::Objects::ComboUnTranslate $f2.cbSmooth $lst\ |
|---|
| 1407 | ::bayesGraph::tmpOpt(var,smooth_)] |
|---|
| 1408 | ::Objects::ComboSetIni $f2.cbSmooth $lst ::bayesGraph::tmpOpt(var,smooth_) |
|---|
| 1409 | |
|---|
| 1410 | if {0} { |
|---|
| 1411 | #puts "\nTitle: values: $values lst: $lst ::bayesGraph::tmpOpt(var,smooth_) : $::bayesGraph::tmpOpt(var,smooth_) \n" |
|---|
| 1412 | #puts "\nTitle: [lindex $values [lsearch -exact $lst $::bayesGraph::tmpOpt(var,smooth_)]] \n" |
|---|
| 1413 | bcomboboxplus $f2.cbSmooth -cols {title id} -varcol {id} -parent $f2 \ |
|---|
| 1414 | -variable ::bayesGraph::tmpOpt(var,smooth_) \ |
|---|
| 1415 | -showtitles false -hiddencols {id} -hiddencolslb {id} \ |
|---|
| 1416 | -text [lindex $values \ |
|---|
| 1417 | [lsearch -exact $lst $::bayesGraph::tmpOpt(var,smooth_)]] \ |
|---|
| 1418 | -values [ljoin $values $lst " "] |
|---|
| 1419 | $f2.cbSmooth activate select |
|---|
| 1420 | } |
|---|
| 1421 | set values {} |
|---|
| 1422 | set lst {none image solid striped {stipple image} {stipple degraded}} |
|---|
| 1423 | foreach it $lst { lappend values [mc $it] } |
|---|
| 1424 | label $f2.llTypeFill -text [mc "Fill type"]: |
|---|
| 1425 | ComboBox $f2.cblTypeFill -width 15 -height 5 \ |
|---|
| 1426 | -editable false -justify right -values $values \ |
|---|
| 1427 | -modifycmd [list ::Objects::ComboUnTranslate $f2.cblTypeFill $lst\ |
|---|
| 1428 | ::bayesGraph::tmpOpt(var,areaTypes_)] |
|---|
| 1429 | ::Objects::ComboSetIni $f2.cblTypeFill $lst \ |
|---|
| 1430 | ::bayesGraph::tmpOpt(var,areaTypes_) |
|---|
| 1431 | |
|---|
| 1432 | variable typelist {{"Gif images" {".gif"}}} |
|---|
| 1433 | variable defExt .gif |
|---|
| 1434 | label $f2.lImage -text [mc Image]: |
|---|
| 1435 | set tmpOpt(widget,areaTile) [::Objects::ChooseFileCreate \ |
|---|
| 1436 | ::bayesGraph::tmpOpt(var,areaTiles_) $f2.bFillImage \ |
|---|
| 1437 | -filetypes $typelist -defaultextension $defExt] |
|---|
| 1438 | |
|---|
| 1439 | grid $f2.rbIsLine - -sticky nw -pady 0 |
|---|
| 1440 | grid $f2.llwidth $f2.sblwidth -sticky nw -pady 0 |
|---|
| 1441 | grid $f2.ldashes $f2.sbdashes -sticky nw -pady 0 |
|---|
| 1442 | grid $f2.lSmooth $f2.cbSmooth -sticky nw -pady 0 |
|---|
| 1443 | grid $f2.llTypeFill $f2.cblTypeFill -sticky nw -pady 0 |
|---|
| 1444 | grid $f2.lImage $f2.bFillImage -sticky nw -pady 0 |
|---|
| 1445 | grid rowconfigure $f2 10 -weight 1 |
|---|
| 1446 | grid columnconfigure $f2 10 -weight 1 |
|---|
| 1447 | |
|---|
| 1448 | # Optiones bar |
|---|
| 1449 | TitleFrame $w.tf3 -text [mc "Bar Options"] |
|---|
| 1450 | set f3 [$w.tf3 getframe] |
|---|
| 1451 | |
|---|
| 1452 | radiobutton $f3.rbIsLine -text [mc "Bar"] \ |
|---|
| 1453 | -value BarElement -highlightthickness 0 -pady 0 -padx 0 \ |
|---|
| 1454 | -variable ::bayesGraph::tmpOpt(var,linetypes_) |
|---|
| 1455 | label $f3.lbwidth -text [mc "Bars Width"]: |
|---|
| 1456 | SpinBox $f3.sbbwidth -justify right -width 4 -editable 0 \ |
|---|
| 1457 | -values {0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1} \ |
|---|
| 1458 | -textvariable ::bayesGraph::tmpOpt(var,barwidth_) |
|---|
| 1459 | |
|---|
| 1460 | set list {flat groove raised ridge solid sunken} |
|---|
| 1461 | set values "" |
|---|
| 1462 | foreach it $list { lappend values [mc $it] } |
|---|
| 1463 | label $f3.lRelief -text [mc "Bar relief"]: |
|---|
| 1464 | ComboBox $f3.cbRelief -width 15 -height 5 -editable false\ |
|---|
| 1465 | -values $values -justify right\ |
|---|
| 1466 | -modifycmd [list ::Objects::ComboUnTranslate $f3.cbRelief $list \ |
|---|
| 1467 | ::bayesGraph::tmpOpt(var,barrelief_)]] |
|---|
| 1468 | ::Objects::ComboSetIni $f3.cbRelief $list \ |
|---|
| 1469 | ::bayesGraph::tmpOpt(var,barrelief_) |
|---|
| 1470 | |
|---|
| 1471 | label $f3.lbdw -text [mc "Border width"]: |
|---|
| 1472 | set tmpOpt(widget,bdwidth) [SpinBox $f3.sbbdw -range {1 100} \ |
|---|
| 1473 | -justify right -width 4 -editable 0 \ |
|---|
| 1474 | -textvariable ::bayesGraph::tmpOpt(var,borderwidth_)] |
|---|
| 1475 | |
|---|
| 1476 | label $f3.lbTypeFill -text [mc "Fill type"]: |
|---|
| 1477 | set values "" |
|---|
| 1478 | set list {none striped {stipple image} {stipple degraded}} |
|---|
| 1479 | foreach it $list { lappend values [mc $it] } |
|---|
| 1480 | ComboBox $f3.cbbTypeFill -width 15 -height 5 \ |
|---|
| 1481 | -editable false -justify right -values $values \ |
|---|
| 1482 | -modifycmd [list ::Objects::ComboUnTranslate $f3.cbbTypeFill $list\ |
|---|
| 1483 | ::bayesGraph::tmpOpt(var,areaTypesBar_)] |
|---|
| 1484 | ::Objects::ComboSetIni $f3.cbbTypeFill $list \ |
|---|
| 1485 | ::bayesGraph::tmpOpt(var,areaTypesBar_) |
|---|
| 1486 | |
|---|
| 1487 | grid $f3.rbIsLine - -sticky nw -pady 1 |
|---|
| 1488 | grid $f3.lbwidth $f3.sbbwidth -sticky nw -pady 1 |
|---|
| 1489 | grid $f3.lRelief $f3.cbRelief -sticky nw -pady 1 |
|---|
| 1490 | grid $f3.lbdw $f3.sbbdw -sticky nw -pady 1 |
|---|
| 1491 | grid $f3.lbTypeFill $f3.cbbTypeFill -sticky nw -pady 1 |
|---|
| 1492 | grid rowconfigure $f3 10 -weight 1 |
|---|
| 1493 | grid columnconfigure $f3 10 -weight 1 |
|---|
| 1494 | |
|---|
| 1495 | # General options |
|---|
| 1496 | TitleFrame $w.tf4 -text [mc "General Options"] |
|---|
| 1497 | set f4 [$w.tf4 getframe] |
|---|
| 1498 | |
|---|
| 1499 | label $f4.lname -text [mc Name]: |
|---|
| 1500 | Entry $f4.ename -width 50 -justify left \ |
|---|
| 1501 | -textvariable ::bayesGraph::tmpOpt(var,linelabels_) |
|---|
| 1502 | |
|---|
| 1503 | checkbutton $f4.chHide -text [mc "Hide line"] \ |
|---|
| 1504 | -highlightthickness 0 -pady 2 -padx 0 -onvalue true -offvalue false \ |
|---|
| 1505 | -variable ::bayesGraph::tmpOpt(var,linehides_) |
|---|
| 1506 | |
|---|
| 1507 | label $f4.lColor -text "[mc Color]:" |
|---|
| 1508 | bcolor $f4.fColor -variable ::bayesGraph::tmpOpt(var,colors_) |
|---|
| 1509 | |
|---|
| 1510 | label $f4.lMapped -text "[mc Mapped]:" |
|---|
| 1511 | foreach axis {x x2 y y2} { |
|---|
| 1512 | radiobutton $f4.rbMap${axis} -text [string toupper $axis] \ |
|---|
| 1513 | -value $axis -highlightthickness 0 -pady 0 \ |
|---|
| 1514 | -variable ::bayesGraph::tmpOpt(var,[string index $axis 0]MappedAxis_) |
|---|
| 1515 | } |
|---|
| 1516 | |
|---|
| 1517 | label $f4.lForeground -text [mc Foreground]: |
|---|
| 1518 | bcolor $f4.fForeground -optmenu 2 \ |
|---|
| 1519 | -variable ::bayesGraph::tmpOpt(var,areaForegrounds_) |
|---|
| 1520 | |
|---|
| 1521 | label $f4.lBackground -text [mc Background]: |
|---|
| 1522 | bcolor $f4.fBackground -optmenu 2 \ |
|---|
| 1523 | -variable ::bayesGraph::tmpOpt(var,areaBackgrounds_) |
|---|
| 1524 | |
|---|
| 1525 | variable typelist {{"XBM images" {".xbm"}}} |
|---|
| 1526 | variable defExt .xbm |
|---|
| 1527 | label $f4.lImageBack -text [mc {Image background}]: |
|---|
| 1528 | ::Objects::ChooseFileCreate \ |
|---|
| 1529 | ::bayesGraph::tmpOpt(var,stippleimages_) $f4.bFillImage \ |
|---|
| 1530 | -filetypes $typelist -defaultextension $defExt |
|---|
| 1531 | |
|---|
| 1532 | label $f4.lsbDegraded -text [mc {Degraded percentage}]: |
|---|
| 1533 | SpinBox $f4.sbbstipple -justify right -width 4 -editable 0 \ |
|---|
| 1534 | -values {12 25 50 75} \ |
|---|
| 1535 | -textvariable ::bayesGraph::tmpOpt(var,stippledegradeds_) |
|---|
| 1536 | |
|---|
| 1537 | grid $f4.chHide - - - \ |
|---|
| 1538 | -sticky nw -pady 1 |
|---|
| 1539 | grid $f4.lColor $f4.fColor - - \ |
|---|
| 1540 | -sticky nw -pady 1 |
|---|
| 1541 | grid $f4.lForeground $f4.fForeground $f4.lImageBack $f4.bFillImage \ |
|---|
| 1542 | -sticky nw -pady 1 |
|---|
| 1543 | grid $f4.lBackground $f4.fBackground $f4.lsbDegraded $f4.sbbstipple \ |
|---|
| 1544 | -sticky nw -pady 1 |
|---|
| 1545 | grid $f4.lMapped $f4.rbMapx $f4.rbMapy - \ |
|---|
| 1546 | -sticky nw -pady 1 |
|---|
| 1547 | grid ^ $f4.rbMapx2 $f4.rbMapy2 - \ |
|---|
| 1548 | -sticky nw -pady 1 |
|---|
| 1549 | grid $f4.lname $f4.ename - - \ |
|---|
| 1550 | -sticky nw -pady 1 |
|---|
| 1551 | |
|---|
| 1552 | grid rowconfigure $f4 10 -weight 1 |
|---|
| 1553 | grid columnconfigure $f4 10 -weight 1 |
|---|
| 1554 | |
|---|
| 1555 | # Optiones bar |
|---|
| 1556 | TitleFrame $w.tf5 -text [mc "For all element options"] |
|---|
| 1557 | set f5 [$w.tf5 getframe] |
|---|
| 1558 | set list {infront stacked overlap aligned} |
|---|
| 1559 | set values "" |
|---|
| 1560 | foreach it $list { lappend values [mc $it] } |
|---|
| 1561 | label $f5.lBarMode -text [mc "Bar mode"]: |
|---|
| 1562 | ComboBox $f5.cbBarMode -width 15 -height 5 -editable false\ |
|---|
| 1563 | -values $values -justify right\ |
|---|
| 1564 | -modifycmd [list ::Objects::ComboUnTranslate $f5.cbBarMode $list\ |
|---|
| 1565 | ::bayesGraph::tmpOpt(var,barmode)] |
|---|
| 1566 | ::Objects::ComboSetIni $f5.cbBarMode $list \ |
|---|
| 1567 | ::bayesGraph::tmpOpt(var,barmode) |
|---|
| 1568 | |
|---|
| 1569 | grid $f5.lBarMode $f5.cbBarMode -sticky nw -pady 1 |
|---|
| 1570 | grid rowconfigure $f5 10 -weight 1 |
|---|
| 1571 | grid columnconfigure $f5 10 -weight 1 |
|---|
| 1572 | |
|---|
| 1573 | # Grid title frame |
|---|
| 1574 | grid $w.tf2 $w.tf3 -sticky news |
|---|
| 1575 | grid $w.tf4 - -sticky news |
|---|
| 1576 | grid $w.tf5 - -sticky news |
|---|
| 1577 | |
|---|
| 1578 | grid rowconfigure $w 2 -weight 1 |
|---|
| 1579 | grid columnconfigure $w 10 -weight 1 |
|---|
| 1580 | } |
|---|
| 1581 | |
|---|
| 1582 | |
|---|
| 1583 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1584 | proc ::bayesGraph::GrapOptCreateLinesData {this w} { |
|---|
| 1585 | # |
|---|
| 1586 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1587 | variable tmpOpt |
|---|
| 1588 | upvar \#0 ${this}::widgets widgets |
|---|
| 1589 | |
|---|
| 1590 | # DATA VALUES |
|---|
| 1591 | TitleFrame $w.tf1 -text [mc "Data values"] |
|---|
| 1592 | set f1 [$w.tf1 getframe] |
|---|
| 1593 | label $f1.lvshowvalues -text [mc "Show"]: |
|---|
| 1594 | |
|---|
| 1595 | set lst {both none x y} |
|---|
| 1596 | foreach it $lst { lappend values [mc $it] } |
|---|
| 1597 | ComboBox $f1.cbshowvalues -width 8 -height 5 -editable false \ |
|---|
| 1598 | -justify right -values $values \ |
|---|
| 1599 | -modifycmd [list ::Objects::ComboUnTranslate $f1.cbshowvalues $lst \ |
|---|
| 1600 | ::bayesGraph::tmpOpt(var,showvalues_)] |
|---|
| 1601 | ::Objects::ComboSetIni $f1.cbshowvalues $lst \ |
|---|
| 1602 | ::bayesGraph::tmpOpt(var,showvalues_) |
|---|
| 1603 | |
|---|
| 1604 | label $f1.lvfont -text [mc "Font"]: |
|---|
| 1605 | bfont $f1.bvfont -variable ::bayesGraph::tmpOpt(var,valuefont_) |
|---|
| 1606 | label $f1.lvrotate -text [mc Rotate]: -justify right |
|---|
| 1607 | SpinBox $f1.sbvrotate -range {0 360} -width 15 -justify right -width 4 \ |
|---|
| 1608 | -editable 0 -textvariable ::bayesGraph::tmpOpt(var,valuerotate_) |
|---|
| 1609 | |
|---|
| 1610 | label $f1.lvcolor -text [mc Color]: |
|---|
| 1611 | bcolor $f1.fvcolor -variable ::bayesGraph::tmpOpt(var,valuecolor_) |
|---|
| 1612 | |
|---|
| 1613 | label $f1.lvformat -text [mc "Decimals"]: |
|---|
| 1614 | SpinBox $f1.sbvformat -range {0 4} -width 4 -justify right -editable false \ |
|---|
| 1615 | -textvariable ::bayesGraph::tmpOpt(var,valueformatdec_) |
|---|
| 1616 | |
|---|
| 1617 | label $f1.lvshadow -text [mc "Shadow"]: |
|---|
| 1618 | bcolor $f1.fvshadow -variable ::bayesGraph::tmpOpt(var,valueshadow_) \ |
|---|
| 1619 | -label "[mc "Change Shadow"]:" -optmenu 1 |
|---|
| 1620 | |
|---|
| 1621 | label $f1.lvanchor -text [mc Anchor]: |
|---|
| 1622 | ::Objects::ComboPosCreate ::bayesGraph::tmpOpt(var,valueanchor_) $f1.fvanchor |
|---|
| 1623 | |
|---|
| 1624 | grid $f1.lvshowvalues $f1.cbshowvalues - - \ |
|---|
| 1625 | -sticky nw -padx 2 -pady 3 |
|---|
| 1626 | grid $f1.lvfont $f1.bvfont $f1.lvrotate $f1.sbvrotate \ |
|---|
| 1627 | -sticky w -padx 2 -pady 1 |
|---|
| 1628 | grid $f1.lvcolor $f1.fvcolor $f1.lvformat $f1.sbvformat \ |
|---|
| 1629 | -sticky w -padx 2 -pady 1 |
|---|
| 1630 | grid $f1.lvshadow $f1.fvshadow $f1.lvanchor $f1.fvanchor \ |
|---|
| 1631 | -sticky w -padx 2 -pady 1 |
|---|
| 1632 | |
|---|
| 1633 | grid rowconfigure $f1 10 -weight 1 |
|---|
| 1634 | grid columnconfigure $f1 10 -weight 1 |
|---|
| 1635 | |
|---|
| 1636 | # SYMBOLS DATA |
|---|
| 1637 | TitleFrame $w.tf2 -text [mc "Data symbols"] |
|---|
| 1638 | set f2 [$w.tf2 getframe] |
|---|
| 1639 | |
|---|
| 1640 | checkbutton $f2.chShowSymbols -text [mc "Show symbols"] \ |
|---|
| 1641 | -highlightthickness 0 -pady 0 -padx 0 \ |
|---|
| 1642 | -variable ::bayesGraph::tmpOpt(var,showsymbols_) |
|---|
| 1643 | #Comando para desabilitar las opciones de simbolos |
|---|
| 1644 | # -command [list ::bayesGraph::GrapOptCheckShowSymbols $this $serie] |
|---|
| 1645 | |
|---|
| 1646 | label $f2.lSymbol -text [mc "Symbol"]: |
|---|
| 1647 | set lst {circle square diamond plus cross splus scross triangle arrow} |
|---|
| 1648 | set values {} |
|---|
| 1649 | foreach it $lst { lappend values [mc $it] } |
|---|
| 1650 | ComboBox $f2.cbSymbol -width 10 -height 5 -values $values -justify right \ |
|---|
| 1651 | -modifycmd [list ::Objects::ComboUnTranslate $f2.cbSymbol $lst \ |
|---|
| 1652 | ::bayesGraph::tmpOpt(var,symbol_)] |
|---|
| 1653 | ::Objects::ComboSetIni $f2.cbSymbol $lst \ |
|---|
| 1654 | ::bayesGraph::tmpOpt(var,symbol_) |
|---|
| 1655 | |
|---|
| 1656 | label $f2.lPixels -text [mc "Pixels"]: |
|---|
| 1657 | SpinBox $f2.sbPixels -range {2 36 2} -width 4 -justify right \ |
|---|
| 1658 | -textvariable ::bayesGraph::tmpOpt(var,pixels_) |
|---|
| 1659 | |
|---|
| 1660 | checkbutton $f2.chScaleSymbols -highlightthickness 0 -pady 0 -padx 0 \ |
|---|
| 1661 | -text [mc "Scale symbols"] \ |
|---|
| 1662 | -variable ::bayesGraph::tmpOpt(var,scalesymbols_) |
|---|
| 1663 | |
|---|
| 1664 | label $f2.lFill -text [mc "Fill"]: |
|---|
| 1665 | bcolor $f2.fFill -variable ::bayesGraph::tmpOpt(var,fill_) -optmenu 3 |
|---|
| 1666 | |
|---|
| 1667 | label $f2.lOutline -text [mc "Outline"]: |
|---|
| 1668 | bcolor $f2.fOutline -variable ::bayesGraph::tmpOpt(var,outline_) -optmenu 2 |
|---|
| 1669 | |
|---|
| 1670 | label $f2.lOWid -text [mc "Outline width"]: |
|---|
| 1671 | SpinBox $f2.sbOWid -range {0 8} -width 4 -justify right \ |
|---|
| 1672 | -textvariable ::bayesGraph::tmpOpt(var,outlinewidth_) |
|---|
| 1673 | |
|---|
| 1674 | grid $f2.chShowSymbols - - - \ |
|---|
| 1675 | -sticky nw -padx 2 -pady 4 |
|---|
| 1676 | grid $f2.lSymbol $f2.cbSymbol $f2.lPixels $f2.sbPixels \ |
|---|
| 1677 | -sticky nw -padx 2 |
|---|
| 1678 | grid $f2.lOutline $f2.fOutline $f2.lOWid $f2.sbOWid \ |
|---|
| 1679 | -sticky nw -padx 2 |
|---|
| 1680 | grid $f2.lFill $f2.fFill $f2.chScaleSymbols - \ |
|---|
| 1681 | -sticky nw -padx 2 |
|---|
| 1682 | |
|---|
| 1683 | grid rowconfigure $f2 10 -weight 1 |
|---|
| 1684 | grid columnconfigure $f2 10 -weight 1 |
|---|
| 1685 | |
|---|
| 1686 | grid $w.tf1 -sticky news -padx 2 |
|---|
| 1687 | grid $w.tf2 -sticky news -padx 2 |
|---|
| 1688 | |
|---|
| 1689 | # GRID |
|---|
| 1690 | grid rowconfigure $w 0 -weight 0 |
|---|
| 1691 | grid rowconfigure $w 1 -weight 1 |
|---|
| 1692 | |
|---|
| 1693 | # grid rowconfigure $w 1 -weight 0 |
|---|
| 1694 | grid columnconfigure $w 0 -weight 1 |
|---|
| 1695 | } |
|---|
| 1696 | |
|---|
| 1697 | |
|---|
| 1698 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1699 | proc ::bayesGraph::GrapOptCreateMarkers {this w} { |
|---|
| 1700 | # |
|---|
| 1701 | # PURPOSE: |
|---|
| 1702 | # |
|---|
| 1703 | # PARAMETERS: |
|---|
| 1704 | # |
|---|
| 1705 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1706 | variable tmpOpt |
|---|
| 1707 | # tab_set |
|---|
| 1708 | set tsmarker [::blt::tabset $w.ts -relief flat -highlightthickness 0\ |
|---|
| 1709 | -bd 0 -outerpad 0 -tier 2 -slant right -textside right] |
|---|
| 1710 | $tsmarker insert end Marker Style |
|---|
| 1711 | |
|---|
| 1712 | set f1 [frame $tsmarker.f1] |
|---|
| 1713 | set f2 [frame $tsmarker.f2] |
|---|
| 1714 | |
|---|
| 1715 | $tsmarker tab configure "Marker" -text [mc Marker] -window $f1 \ |
|---|
| 1716 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 1717 | $tsmarker tab configure "Style" -text [mc Style] -window $f2 \ |
|---|
| 1718 | -fill both -padx 0 -selectbackground \#d9d9d9 -bg gray75 |
|---|
| 1719 | |
|---|
| 1720 | # Marker |
|---|
| 1721 | # Each |
|---|
| 1722 | TitleFrame $f1.eachXY -text [mc "Each"] |
|---|
| 1723 | ::bayesGraph::CreateMarkers $f1.eachXY xyMarkers |
|---|
| 1724 | # In X |
|---|
| 1725 | TitleFrame $f1.inXY -text [mc "In"] |
|---|
| 1726 | ::bayesGraph::CreateMarkers $f1.inXY xyMarkersIn |
|---|
| 1727 | # marker |
|---|
| 1728 | grid $f1.eachXY $f1.inXY -sticky news -padx 2 |
|---|
| 1729 | grid rowconfigure $f1 0 -weight 1 |
|---|
| 1730 | grid columnconfigure $f1 0 -weight 1 |
|---|
| 1731 | grid columnconfigure $f1 1 -weight 1 |
|---|
| 1732 | |
|---|
| 1733 | #Style |
|---|
| 1734 | TitleFrame $f2.tf -text [mc "Markers Style"] |
|---|
| 1735 | set f [$f2.tf getframe] |
|---|
| 1736 | |
|---|
| 1737 | label $f.lStyle -text [mc "Choose lines color, type, position and width for 5 Markers"]: |
|---|
| 1738 | |
|---|
| 1739 | label $f.lColor -text [mc Color]: |
|---|
| 1740 | label $f.lDashes -text [mc "Style"]: |
|---|
| 1741 | label $f.lWidth -text [mc "Width"]: |
|---|
| 1742 | label $f.lUnder -text [mc "Under"]: |
|---|
| 1743 | |
|---|
| 1744 | for {set i 0} {$i < 5} {incr i} { |
|---|
| 1745 | label $f.lDesc$i -text "[mc Marker] [expr $i+1]:" |
|---|
| 1746 | bcolor $f.fColor$i \ |
|---|
| 1747 | -variable ::bayesGraph::tmpOpt(var,xyMarkerColorInEach$i) |
|---|
| 1748 | ::Objects::ComboDashesCreate \ |
|---|
| 1749 | ::bayesGraph::tmpOpt(var,xyMarkerDasheInEach$i) $f.sbDashes$i |
|---|
| 1750 | SpinBox $f.sbWidth$i -justify right -width 4 -editable 0 -range {0 10}\ |
|---|
| 1751 | -textvariable ::bayesGraph::tmpOpt(var,xyMarkerWidthInEach$i) |
|---|
| 1752 | checkbutton $f.chUnder$i -highlightthickness 0 \ |
|---|
| 1753 | -variable ::bayesGraph::tmpOpt(var,xyMarkerUnderInEach$i) |
|---|
| 1754 | } |
|---|
| 1755 | |
|---|
| 1756 | grid $f.lStyle - - - - -sticky nw -padx 5 -pady 5 |
|---|
| 1757 | frame $f.f -width 15 |
|---|
| 1758 | grid $f.f $f.lColor $f.lDashes $f.lWidth $f.lUnder -sticky nw -padx 15 -pady 2 |
|---|
| 1759 | for {set i 0} {$i < 5} {incr i} { |
|---|
| 1760 | grid $f.f $f.fColor$i $f.sbDashes$i \ |
|---|
| 1761 | $f.sbWidth$i $f.chUnder$i -sticky new -padx 15 -pady 2 |
|---|
| 1762 | } |
|---|
| 1763 | |
|---|
| 1764 | grid rowconfigure $f 100 -weight 1 |
|---|
| 1765 | grid columnconfigure $f 100 -weight 1 |
|---|
| 1766 | |
|---|
| 1767 | # Style |
|---|
| 1768 | grid $f2.tf -sticky news -padx 2 |
|---|
| 1769 | grid rowconfigure $f2 0 -weight 1 |
|---|
| 1770 | grid columnconfigure $f2 0 -weight 1 |
|---|
| 1771 | |
|---|
| 1772 | # General |
|---|
| 1773 | grid $tsmarker -sticky news -padx 2 |
|---|
| 1774 | grid rowconfigure $w 0 -weight 1 |
|---|
| 1775 | grid columnconfigure $w 0 -weight 1 |
|---|
| 1776 | } |
|---|
| 1777 | |
|---|
| 1778 | |
|---|
| 1779 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1780 | proc ::bayesGraph::CreateMarkers {tf axis} { |
|---|
| 1781 | # |
|---|
| 1782 | # PURPOSE: |
|---|
| 1783 | # |
|---|
| 1784 | # PARAMETERS: |
|---|
| 1785 | # |
|---|
| 1786 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1787 | variable tmpOpt |
|---|
| 1788 | |
|---|
| 1789 | set f [$tf getframe] |
|---|
| 1790 | |
|---|
| 1791 | entry $f.e -width 18 -validate key\ |
|---|
| 1792 | -vcmd {expr {[string is double %P] && [string length %P]<38}} |
|---|
| 1793 | Button $f.add -image [Bitmap::get downNext] -height 16 -width 16\ |
|---|
| 1794 | -relief link -helptext [mc "AddMarkSel"]\ |
|---|
| 1795 | -command [list ::bayesGraph::AddElto $f.e $f.sw.lb] |
|---|
| 1796 | ScrolledWindow $f.sw |
|---|
| 1797 | blistbox $f.sw.lb -selectmode extended -listvar ::bayesGraph::tmpOpt(var,$axis)\ |
|---|
| 1798 | -width 20 -height 2 -breadonly true -bkeypress true -bparent $tf |
|---|
| 1799 | $f.sw setwidget $f.sw.lb |
|---|
| 1800 | |
|---|
| 1801 | bind $f.e <Key-Return> "[list ::bayesGraph::AddElto $f.e $f.sw.lb]; break" |
|---|
| 1802 | bind $f.sw.lb <Button-1> +[list focus -force %W] |
|---|
| 1803 | bind $f.sw.lb <Key-Delete> +[list ::bayesGraph::DelSelection %W] |
|---|
| 1804 | |
|---|
| 1805 | grid $f.e $f.add -sticky nw -padx 2 |
|---|
| 1806 | grid $f.sw - -sticky news |
|---|
| 1807 | grid rowconfigure $f 1 -weight 1 |
|---|
| 1808 | grid columnconfigure $f 0 -weight 1 |
|---|
| 1809 | } |
|---|
| 1810 | |
|---|
| 1811 | |
|---|
| 1812 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1813 | proc ::bayesGraph::AddElto {e lb} { |
|---|
| 1814 | # |
|---|
| 1815 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1816 | |
|---|
| 1817 | regsub -all -- "( )+" [$e get] "" marker |
|---|
| 1818 | if [string equal $marker ""] { |
|---|
| 1819 | return |
|---|
| 1820 | } |
|---|
| 1821 | if { ([lsearch -exact [$lb get 0 end] $marker] != -1) } { |
|---|
| 1822 | tk_messageBox -type ok -icon info -message [mc "Marker already inserted"] -title [mc "Warning"] |
|---|
| 1823 | } else { |
|---|
| 1824 | $lb insert end $marker |
|---|
| 1825 | $e delete 0 end |
|---|
| 1826 | } |
|---|
| 1827 | } |
|---|
| 1828 | |
|---|
| 1829 | |
|---|
| 1830 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1831 | proc ::bayesGraph::DelSelection {w} { |
|---|
| 1832 | # |
|---|
| 1833 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1834 | foreach i [lsort -integer -decreasing [$w curselection]] { |
|---|
| 1835 | $w delete $i |
|---|
| 1836 | } |
|---|
| 1837 | } |
|---|
| 1838 | |
|---|
| 1839 | |
|---|
| 1840 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1841 | proc ::bayesGraph::GrapOptCreateGrid {this w} { |
|---|
| 1842 | # |
|---|
| 1843 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1844 | variable tmpOpt |
|---|
| 1845 | TitleFrame $w.tf1 -text [mc "Grid options"] |
|---|
| 1846 | set f1 [$w.tf1 getframe] |
|---|
| 1847 | |
|---|
| 1848 | label $f1.lColor -text [mc "Color"]: |
|---|
| 1849 | bcolor $f1.fColor -variable ::bayesGraph::tmpOpt(var,grid,Color) |
|---|
| 1850 | label $f1.lDashes -text [mc "Style"]: |
|---|
| 1851 | ::Objects::ComboDashesCreate ::bayesGraph::tmpOpt(var,grid,Dashes) $f1.sbDashes |
|---|
| 1852 | label $f1.lLineWidth -text [mc "Line width"]: |
|---|
| 1853 | SpinBox $f1.sbLineWidth -range {1 4} -width 4 -justify right\ |
|---|
| 1854 | -editable false -textvariable ::bayesGraph::tmpOpt(var,grid,LineWidth) |
|---|
| 1855 | checkbutton $f1.chMinor -text [mc "Draw for minor ticks"]\ |
|---|
| 1856 | -highlightthickness 0 -pady 0 -padx 0 -variable ::bayesGraph::tmpOpt(var,grid,Minor) |
|---|
| 1857 | |
|---|
| 1858 | frame $f1.f |
|---|
| 1859 | label $f1.f.lMapX -text [mc "Map X to"]: |
|---|
| 1860 | radiobutton $f1.f.x -variable ::bayesGraph::tmpOpt(var,grid,MapX) -text [mc "X axis"] -value x\ |
|---|
| 1861 | -highlightthickness 0 -pady 0 |
|---|
| 1862 | radiobutton $f1.f.x2 -variable ::bayesGraph::tmpOpt(var,grid,MapX) -text [mc "X2 axis"] -value x2\ |
|---|
| 1863 | -highlightthickness 0 -pady 0 |
|---|
| 1864 | radiobutton $f1.f.xN -variable ::bayesGraph::tmpOpt(var,grid,MapX) -text [mc "none"] -value none\ |
|---|
| 1865 | -highlightthickness 0 -pady 0 |
|---|
| 1866 | label $f1.f.lMapY -text [mc "Map Y to"]: |
|---|
| 1867 | radiobutton $f1.f.y -variable ::bayesGraph::tmpOpt(var,grid,MapY) -text [mc "Y axis"] -value y\ |
|---|
| 1868 | -highlightthickness 0 -pady 0 |
|---|
| 1869 | radiobutton $f1.f.y2 -variable ::bayesGraph::tmpOpt(var,grid,MapY) -text [mc "Y2 axis"] -value y2\ |
|---|
| 1870 | -highlightthickness 0 -pady 0 |
|---|
| 1871 | radiobutton $f1.f.yN -variable ::bayesGraph::tmpOpt(var,grid,MapY) -text [mc "none"] -value none\ |
|---|
| 1872 | -highlightthickness 0 -pady 0 |
|---|
| 1873 | |
|---|
| 1874 | grid $f1.f.lMapX $f1.f.x $f1.f.x2 $f1.f.xN -sticky nw -padx 2 |
|---|
| 1875 | grid $f1.f.lMapY $f1.f.y $f1.f.y2 $f1.f.yN -sticky nw -padx 2 |
|---|
| 1876 | |
|---|
| 1877 | frame $f1.f1 -width 25 |
|---|
| 1878 | grid $f1.f1 $f1.lColor $f1.fColor $f1.lDashes $f1.sbDashes -sticky nw -padx 2 |
|---|
| 1879 | grid ^ $f1.lLineWidth $f1.sbLineWidth $f1.chMinor - -sticky nw -padx 2 |
|---|
| 1880 | grid ^ $f1.f - - - -sticky nw -padx 2 |
|---|
| 1881 | |
|---|
| 1882 | grid rowconfigure $f1 2 -weight 1 |
|---|
| 1883 | grid columnconfigure $f1 4 -weight 1 |
|---|
| 1884 | grid columnconfigure $f1 2 -pad 20 |
|---|
| 1885 | |
|---|
| 1886 | grid $w.tf1 -sticky news -padx 2 |
|---|
| 1887 | grid rowconfigure $w 0 -weight 1 |
|---|
| 1888 | grid columnconfigure $w 0 -weight 1 |
|---|
| 1889 | |
|---|
| 1890 | } |
|---|
| 1891 | |
|---|
| 1892 | |
|---|
| 1893 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1894 | proc ::bayesGraph::GrapOptCreateLegend {this w} { |
|---|
| 1895 | # |
|---|
| 1896 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1897 | variable tmpOpt |
|---|
| 1898 | TitleFrame $w.tf1 -text [mc "Legend options"] |
|---|
| 1899 | set f1 [$w.tf1 getframe] |
|---|
| 1900 | |
|---|
| 1901 | checkbutton $f1.chHide -text [mc "Hide legend"] -padx 0 -pady 0\ |
|---|
| 1902 | -highlightthickness 0 -variable ::bayesGraph::tmpOpt(var,legend,Hide) |
|---|
| 1903 | label $f1.lRows -text [mc "Rows"]: |
|---|
| 1904 | SpinBox $f1.sbRows -range {0 16} -width 4 -justify right\ |
|---|
| 1905 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,Rows) |
|---|
| 1906 | label $f1.lColumns -text [mc "Columns"]: |
|---|
| 1907 | SpinBox $f1.sbColumns -range {0 16} -width 4 -justify right\ |
|---|
| 1908 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,Columns) |
|---|
| 1909 | |
|---|
| 1910 | label $f1.lFont -text [mc "Font"]: |
|---|
| 1911 | bfont $f1.bFont -variable ::bayesGraph::tmpOpt(var,legend,Font) |
|---|
| 1912 | label $f1.lFg -text [mc "Color"]: |
|---|
| 1913 | bcolor $f1.fFg -variable ::bayesGraph::tmpOpt(var,legend,Fg) |
|---|
| 1914 | label $f1.lShadow -text [mc "Shadow"]: |
|---|
| 1915 | bcolor $f1.fShadow -variable ::bayesGraph::tmpOpt(var,legend,Shadow) \ |
|---|
| 1916 | -label "[mc "Change Shadow"]:" -optmenu 1 |
|---|
| 1917 | |
|---|
| 1918 | label $f1.lBg -text [mc "Background"]: |
|---|
| 1919 | bcolor $f1.fBg -variable ::bayesGraph::tmpOpt(var,legend,Bg) -optmenu 1 |
|---|
| 1920 | set list {flat groove raised ridge solid sunken} |
|---|
| 1921 | foreach it $list { lappend values [mc $it] } |
|---|
| 1922 | label $f1.lRelief -text [mc Relief]: |
|---|
| 1923 | ComboBox $f1.cbRelief -width 10 -height 5 -editable false\ |
|---|
| 1924 | -values $values -justify right\ |
|---|
| 1925 | -modifycmd [list ::Objects::ComboUnTranslate $f1.cbRelief $list\ |
|---|
| 1926 | ::bayesGraph::tmpOpt(var,legend,Relief)] |
|---|
| 1927 | ::Objects::ComboSetIni $f1.cbRelief $list ::bayesGraph::tmpOpt(var,legend,Relief) |
|---|
| 1928 | label $f1.lBd -text [mc "Border width"]: |
|---|
| 1929 | SpinBox $f1.sbBd -range {0 6} -width 4 -justify right\ |
|---|
| 1930 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,Bd) |
|---|
| 1931 | |
|---|
| 1932 | label $f1.lPosi -text [mc "Position"]: |
|---|
| 1933 | #set list {leftmargin rightmargin topmargin bottommargin plotarea} |
|---|
| 1934 | set list {left right top bottom plotarea} |
|---|
| 1935 | set values {} |
|---|
| 1936 | foreach it $list { lappend values [mc $it] } |
|---|
| 1937 | ComboBox $f1.cbPosi -width 8 -height 5 -editable false\ |
|---|
| 1938 | -values $values -justify right\ |
|---|
| 1939 | -modifycmd [list ::Objects::ComboUnTranslate $f1.cbPosi $list\ |
|---|
| 1940 | ::bayesGraph::tmpOpt(var,legend,Position)] |
|---|
| 1941 | ::Objects::ComboSetIni $f1.cbPosi $list ::bayesGraph::tmpOpt(var,legend,Position) |
|---|
| 1942 | label $f1.lAnchor -text [mc Anchor]: |
|---|
| 1943 | ::Objects::ComboPosCreate ::bayesGraph::tmpOpt(var,legend,Anchor) $f1.fAnchor |
|---|
| 1944 | checkbutton $f1.chRaised -text [mc "Raised"]\ |
|---|
| 1945 | -highlightthickness 0 -pady 0 -padx 0 -variable ::bayesGraph::tmpOpt(var,legend,Raised) |
|---|
| 1946 | |
|---|
| 1947 | label $f1.lXPad -text [mc "X pad (left | right)"] |
|---|
| 1948 | label $f1.lYPad -text [mc "Y pad (top | bottom)"] |
|---|
| 1949 | |
|---|
| 1950 | label $f1.lIX -text [mc "Internal"]: |
|---|
| 1951 | label $f1.lEX -text [mc "External"]: |
|---|
| 1952 | label $f1.lIY -text [mc "Internal"]: |
|---|
| 1953 | label $f1.lEY -text [mc "External"]: |
|---|
| 1954 | SpinBox $f1.sbIPadXl -range {0 50} -width 3 -justify right\ |
|---|
| 1955 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,IPadXl) |
|---|
| 1956 | SpinBox $f1.sbIPadXr -range {0 50} -width 3 -justify right\ |
|---|
| 1957 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,IPadXr) |
|---|
| 1958 | SpinBox $f1.sbIPadYt -range {0 50} -width 3 -justify right\ |
|---|
| 1959 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,IPadYt) |
|---|
| 1960 | SpinBox $f1.sbIPadYb -range {0 50} -width 3 -justify right\ |
|---|
| 1961 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,IPadYb) |
|---|
| 1962 | SpinBox $f1.sbPadXl -range {0 50} -width 3 -justify right\ |
|---|
| 1963 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,PadXl) |
|---|
| 1964 | SpinBox $f1.sbPadXr -range {0 50} -width 3 -justify right\ |
|---|
| 1965 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,PadXr) |
|---|
| 1966 | SpinBox $f1.sbPadYt -range {0 50} -width 3 -justify right\ |
|---|
| 1967 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,PadYt) |
|---|
| 1968 | SpinBox $f1.sbPadYb -range {0 50} -width 3 -justify right\ |
|---|
| 1969 | -editable false -textvariable ::bayesGraph::tmpOpt(var,legend,PadYb) |
|---|
| 1970 | |
|---|
| 1971 | frame $f1.f -width 15 |
|---|
| 1972 | grid $f1.f $f1.chHide - $f1.lRows $f1.sbRows - $f1.lColumns $f1.sbColumns - -sticky nw -padx 2 |
|---|
| 1973 | grid ^ $f1.lFont $f1.bFont $f1.lFg $f1.fFg - $f1.lShadow $f1.fShadow - -sticky nw -padx 2 |
|---|
| 1974 | grid ^ $f1.lBg $f1.fBg $f1.lRelief $f1.cbRelief - $f1.lBd $f1.sbBd - -sticky nw -padx 2 |
|---|
| 1975 | grid ^ $f1.lPosi $f1.cbPosi $f1.lAnchor $f1.fAnchor - $f1.chRaised - - -sticky nw -padx 2 |
|---|
| 1976 | grid ^ $f1.lXPad - $f1.lIX $f1.sbIPadXl $f1.sbIPadXr $f1.lEX $f1.sbPadXl $f1.sbPadXr -sticky nw -padx 2 |
|---|
| 1977 | grid ^ $f1.lYPad - $f1.lIY $f1.sbIPadYt $f1.sbIPadYb $f1.lEY $f1.sbPadYt $f1.sbPadYb -sticky nw -padx 2 |
|---|
| 1978 | |
|---|
| 1979 | grid rowconfigure $f1 5 -weight 1 |
|---|
| 1980 | grid columnconfigure $f1 8 -weight 1 |
|---|
| 1981 | grid columnconfigure $f1 2 -pad 20 |
|---|
| 1982 | grid columnconfigure $f1 5 -pad 20 |
|---|
| 1983 | grid columnconfigure $f1 8 -pad 20 |
|---|
| 1984 | |
|---|
| 1985 | grid $w.tf1 -sticky news -padx 2 |
|---|
| 1986 | grid rowconfigure $w 0 -weight 1 |
|---|
| 1987 | grid columnconfigure $w 0 -weight 1 |
|---|
| 1988 | } |
|---|
| 1989 | |
|---|
| 1990 | |
|---|
| 1991 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1992 | proc ::bayesGraph::GrapOptCreateStyle {this w} { |
|---|
| 1993 | # |
|---|
| 1994 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 1995 | variable tmpOpt |
|---|
| 1996 | |
|---|
| 1997 | # Main title |
|---|
| 1998 | TitleFrame $w.tf0 -text [mc "Main title"] |
|---|
| 1999 | set f0 [$w.tf0 getframe] |
|---|
| 2000 | ::bayesGraph::GrapOptCreateTitles \ |
|---|
| 2001 | $this $f0 [list title font foreground shadow] |
|---|
| 2002 | |
|---|
| 2003 | grid $w.tf0 -sticky news -padx 2 |
|---|
| 2004 | grid rowconfigure $f0 0 -weight 1 |
|---|
| 2005 | grid columnconfigure $f0 0 -weight 1 |
|---|
| 2006 | |
|---|
| 2007 | # Exterior area |
|---|
| 2008 | TitleFrame $w.tf1 -text [mc "Exterior Area"] |
|---|
| 2009 | set f1 [$w.tf1 getframe] |
|---|
| 2010 | label $f1.lBg -text [mc "Background"]: |
|---|
| 2011 | bcolor $f1.fBg -variable ::bayesGraph::tmpOpt(var,background) |
|---|
| 2012 | set list {flat groove raised ridge solid sunken} |
|---|
| 2013 | foreach it $list { lappend values [mc $it] } |
|---|
| 2014 | label $f1.lRelief -text [mc Relief]: |
|---|
| 2015 | ComboBox $f1.cbRelief -width 10 -height 5 -editable false\ |
|---|
| 2016 | -values $values -justify right\ |
|---|
| 2017 | -modifycmd [list ::Objects::ComboUnTranslate $f1.cbRelief $list\ |
|---|
| 2018 | ::bayesGraph::tmpOpt(var,relief)] |
|---|
| 2019 | ::Objects::ComboSetIni $f1.cbRelief $list ::bayesGraph::tmpOpt(var,relief) |
|---|
| 2020 | label $f1.lBd -text [mc "Border width"]: |
|---|
| 2021 | SpinBox $f1.sbBd -range {0 6} -width 4 -justify right\ |
|---|
| 2022 | -editable false -textvariable ::bayesGraph::tmpOpt(var,areaborderwidth) |
|---|
| 2023 | label $f1.lMargins -text "[mc MARGINS]" |
|---|
| 2024 | label $f1.lDesc -text "(0=[mc auto])" |
|---|
| 2025 | label $f1.lLM -text [mc Left]: |
|---|
| 2026 | Entry $f1.eLM -validate key -vcmd {expr {[string is integer %P]}}\ |
|---|
| 2027 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,lm) |
|---|
| 2028 | label $f1.lRM -text [mc Right]: |
|---|
| 2029 | Entry $f1.eRM -validate key -vcmd {expr {[string is integer %P]}}\ |
|---|
| 2030 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,rm) |
|---|
| 2031 | label $f1.lTM -text [mc Top]: |
|---|
| 2032 | Entry $f1.eTM -validate key -vcmd {expr {[string is integer %P]}}\ |
|---|
| 2033 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,tm) |
|---|
| 2034 | label $f1.lBM -text [mc Bottom]: |
|---|
| 2035 | Entry $f1.eBM -validate key -vcmd {expr {[string is integer %P]}}\ |
|---|
| 2036 | -width 10 -justify right -textvariable ::bayesGraph::tmpOpt(var,bm) |
|---|
| 2037 | |
|---|
| 2038 | frame $f1.f -width 25 |
|---|
| 2039 | grid $f1.f $f1.lBg $f1.fBg $f1.lRelief $f1.cbRelief $f1.lBd $f1.sbBd -sticky nw -padx 2 |
|---|
| 2040 | grid ^ $f1.lMargins - $f1.lLM $f1.eLM $f1.lRM $f1.eRM -sticky nw -padx 2 |
|---|
| 2041 | grid ^ $f1.lDesc - $f1.lTM $f1.eTM $f1.lBM $f1.eBM -sticky nw -padx 2 |
|---|
| 2042 | |
|---|
| 2043 | grid rowconfigure $f1 2 -weight 1 |
|---|
| 2044 | grid columnconfigure $f1 6 -weight 1 |
|---|
| 2045 | grid columnconfigure $f1 2 -pad 20 |
|---|
| 2046 | grid columnconfigure $f1 4 -pad 20 |
|---|
| 2047 | grid columnconfigure $f1 6 -pad 20 |
|---|
| 2048 | |
|---|
| 2049 | TitleFrame $w.tf2 -text [mc "Plot Area"] |
|---|
| 2050 | set f2 [$w.tf2 getframe] |
|---|
| 2051 | |
|---|
| 2052 | label $f2.lBg -text [mc "Background"]: |
|---|
| 2053 | bcolor $f2.fBg -variable ::bayesGraph::tmpOpt(var,plotbackground) |
|---|
| 2054 | set list {flat groove raised ridge solid sunken} |
|---|
| 2055 | set values {} |
|---|
| 2056 | foreach it $list { lappend values [mc $it] } |
|---|
| 2057 | label $f2.lRelief -text [mc Relief]: |
|---|
| 2058 | ComboBox $f2.cbRelief -width 10 -height 5 -editable false\ |
|---|
| 2059 | -values $values -justify right\ |
|---|
| 2060 | -modifycmd [list ::Objects::ComboUnTranslate $f2.cbRelief $list\ |
|---|
| 2061 | ::bayesGraph::tmpOpt(var,plotrelief)] |
|---|
| 2062 | ::Objects::ComboSetIni $f2.cbRelief $list ::bayesGraph::tmpOpt(var,plotrelief) |
|---|
| 2063 | label $f2.lBd -text [mc "Border width"]: |
|---|
| 2064 | SpinBox $f2.sbBd -range {0 6} -width 4 -justify right\ |
|---|
| 2065 | -editable false -textvariable ::bayesGraph::tmpOpt(var,plotborderwidth) |
|---|
| 2066 | label $f2.lPad -text [mc "PAD"] |
|---|
| 2067 | label $f2.lPadXl -text [mc Left]: |
|---|
| 2068 | SpinBox $f2.sbPadXl -range {0 20} -width 3 -justify right\ |
|---|
| 2069 | -editable false -textvariable ::bayesGraph::tmpOpt(var,plotpadxl) |
|---|
| 2070 | label $f2.lPadXr -text [mc Right]: |
|---|
| 2071 | SpinBox $f2.sbPadXr -range {0 20} -width 3 -justify right\ |
|---|
| 2072 | -editable false -textvariable ::bayesGraph::tmpOpt(var,plotpadxr) |
|---|
| 2073 | label $f2.lPadYt -text [mc Top]: |
|---|
| 2074 | SpinBox $f2.sbPadYt -range {0 20} -width 3 -justify right\ |
|---|
| 2075 | -editable false -textvariable ::bayesGraph::tmpOpt(var,plotpadyt) |
|---|
| 2076 | label $f2.lPadYb -text [mc Bottom]: |
|---|
| 2077 | SpinBox $f2.sbPadYb -range {0 20} -width 3 -justify right\ |
|---|
| 2078 | -editable false -textvariable ::bayesGraph::tmpOpt(var,plotpadyb) |
|---|
| 2079 | |
|---|
| 2080 | checkbutton $f2.chInvertxy -text [mc "Invert X-Y axis"]\ |
|---|
| 2081 | -highlightthickness 0 -pady 0 -padx 0 -variable ::bayesGraph::tmpOpt(var,invertxy) |
|---|
| 2082 | |
|---|
| 2083 | frame $f2.f -width 25 |
|---|
| 2084 | grid $f2.f $f2.lBg $f2.fBg $f2.lRelief $f2.cbRelief $f2.lBd $f2.sbBd -sticky nw -padx 2 |
|---|
| 2085 | grid ^ $f2.lPad - $f2.lPadXl $f2.sbPadXl $f2.lPadXr $f2.sbPadXr -sticky nw -padx 2 |
|---|
| 2086 | grid ^ ^ ^ $f2.lPadYt $f2.sbPadYt $f2.lPadYb $f2.sbPadYb -sticky nw -padx 2 |
|---|
| 2087 | grid ^ $f2.chInvertxy - - - - - -sticky nw -padx 2 |
|---|
| 2088 | |
|---|
| 2089 | grid rowconfigure $f2 3 -weight 1 |
|---|
| 2090 | grid columnconfigure $f2 6 -weight 1 |
|---|
| 2091 | grid columnconfigure $f2 2 -pad 20 |
|---|
| 2092 | grid columnconfigure $f2 4 -pad 20 |
|---|
| 2093 | grid columnconfigure $f2 6 -pad 20 |
|---|
| 2094 | |
|---|
| 2095 | grid $w.tf0 -sticky news -padx 2 |
|---|
| 2096 | grid $w.tf1 -sticky news -padx 2 |
|---|
| 2097 | grid $w.tf2 -sticky news -padx 2 |
|---|
| 2098 | grid rowconfigure $w 0 -weight 1 |
|---|
| 2099 | grid rowconfigure $w 1 -weight 2 |
|---|
| 2100 | grid rowconfigure $w 2 -weight 3 |
|---|
| 2101 | grid columnconfigure $w 0 -weight 1 |
|---|
| 2102 | } |
|---|
| 2103 | |
|---|
| 2104 | |
|---|
| 2105 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2106 | proc ::bayesGraph::GrapOptGet {this} { |
|---|
| 2107 | # |
|---|
| 2108 | # PURPOSE: Initializes all options variables and stores them into the |
|---|
| 2109 | # temporary 'tmpOpt' array. |
|---|
| 2110 | # |
|---|
| 2111 | # PARAMETERS: |
|---|
| 2112 | # this -> Instance of BayesGraph |
|---|
| 2113 | # |
|---|
| 2114 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2115 | GrapOptGetAxis $this |
|---|
| 2116 | GrapOptGetTitles $this |
|---|
| 2117 | GrapOptGetLines $this |
|---|
| 2118 | # GrapOptGetData $this |
|---|
| 2119 | GrapOptGetMarkers $this |
|---|
| 2120 | GrapOptGetGrid $this |
|---|
| 2121 | GrapOptGetLegend $this |
|---|
| 2122 | GrapOptGetStyle $this |
|---|
| 2123 | #GrapOptSet $this |
|---|
| 2124 | } |
|---|
| 2125 | |
|---|
| 2126 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2127 | proc ::bayesGraph::GrapOptGetAxis {this} { |
|---|
| 2128 | # |
|---|
| 2129 | # PURPOSE: Initializes axis options variables and stores them into the |
|---|
| 2130 | # temporary 'tmpOpt' array. |
|---|
| 2131 | # |
|---|
| 2132 | # PARAMETERS: |
|---|
| 2133 | # this -> Instance of BayesGraph |
|---|
| 2134 | # |
|---|
| 2135 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2136 | upvar \#0 ${this}::data data |
|---|
| 2137 | upvar \#0 ${this}::options opt |
|---|
| 2138 | variable tmpOpt |
|---|
| 2139 | set gr $data(gr,active) |
|---|
| 2140 | set g [getActiveGraph $this] |
|---|
| 2141 | |
|---|
| 2142 | # opciones recogidas del grafico |
|---|
| 2143 | foreach axis {x y x2 y2} { |
|---|
| 2144 | set tmpOpt(var,${axis}AxisMin) [$g axis cget $axis -min] |
|---|
| 2145 | set tmpOpt(var,${axis}AxisMax) [$g axis cget $axis -max] |
|---|
| 2146 | set tmpOpt(var,${axis}TicksWidth) [$g axis cget $axis -linewidth] |
|---|
| 2147 | set tmpOpt(var,${axis}TicksShow) [$g axis cget $axis -showticks] |
|---|
| 2148 | set tmpOpt(var,${axis}TicksStep) [$g axis cget $axis -stepsize] |
|---|
| 2149 | set tmpOpt(var,${axis}TicksFont) [$g axis cget $axis -tickfont] |
|---|
| 2150 | set tmpOpt(var,${axis}TicksRotate) [$g axis cget $axis -rotate] |
|---|
| 2151 | set tmpOpt(var,${axis}TicksColor) [$g axis cget $axis -color] |
|---|
| 2152 | set tmpOpt(var,${axis}TicksShadow) [lindex [$g axis cget $axis -tickshadow] 0] |
|---|
| 2153 | set tmpOpt(var,${axis}TicksLength) [$g axis cget $axis -ticklength] |
|---|
| 2154 | set tmpOpt(var,${axis}TicksSubdivisions) [$g axis cget $axis -subdivisions] |
|---|
| 2155 | } |
|---|
| 2156 | |
|---|
| 2157 | #Estas opciones deben venir del ini |
|---|
| 2158 | foreach axis {x y x2 y2} { |
|---|
| 2159 | set tmpOpt(var,${axis}AxisAll) $opt(gr,$gr,${axis}AxisAll) |
|---|
| 2160 | set tmpOpt(var,${axis}AxisShow) $opt(gr,$gr,${axis}AxisShow) |
|---|
| 2161 | set tmpOpt(var,${axis}TicksType) $opt(gr,$gr,${axis}TicksType) |
|---|
| 2162 | set tmpOpt(var,${axis}TicksTotal) $opt(gr,$gr,${axis}TicksTotal) |
|---|
| 2163 | set tmpOpt(var,${axis}TicksStep) $opt(gr,$gr,${axis}TicksStep) |
|---|
| 2164 | set tmpOpt(var,${axis}FormatNumber) $opt(gr,$gr,${axis}FormatNumber) |
|---|
| 2165 | set tmpOpt(var,${axis}FormatPercent) $opt(gr,$gr,${axis}FormatPercent) |
|---|
| 2166 | } |
|---|
| 2167 | |
|---|
| 2168 | # comprobamos valor maximo y minimo con opcion "Todos los valores" |
|---|
| 2169 | foreach axis {x y x2 y2} { |
|---|
| 2170 | if {$tmpOpt(var,${axis}AxisAll)} { |
|---|
| 2171 | set values [::bayesGraph::GetLimitsValueAxis $this $axis] |
|---|
| 2172 | if {![string eq $tmpOpt(var,${axis}AxisMin) [lindex $values 0]] || \ |
|---|
| 2173 | ![string eq $tmpOpt(var,${axis}AxisMin) [lindex $values 0]]} { |
|---|
| 2174 | set tmpOpt(var,${axis}AxisAll) 0 |
|---|
| 2175 | } |
|---|
| 2176 | } |
|---|
| 2177 | } |
|---|
| 2178 | # Ajust axis chart of values |
|---|
| 2179 | set tmpOpt(var,selffit) $opt(gr,$gr,selffit) |
|---|
| 2180 | } |
|---|
| 2181 | |
|---|
| 2182 | |
|---|
| 2183 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2184 | proc ::bayesGraph::GrapOptGetTitles {this} { |
|---|
| 2185 | # |
|---|
| 2186 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2187 | upvar \#0 ${this}::data data |
|---|
| 2188 | upvar \#0 ${this}::options opt |
|---|
| 2189 | variable tmpOpt |
|---|
| 2190 | set gr $data(gr,active) |
|---|
| 2191 | set g [getActiveGraph $this] |
|---|
| 2192 | |
|---|
| 2193 | set tmpOpt(var,title) [$g cget -title] |
|---|
| 2194 | set tmpOpt(var,font) [$g cget -font] |
|---|
| 2195 | set tmpOpt(var,foreground) [$g cget -foreground] |
|---|
| 2196 | set tmpOpt(var,shadow) [lindex [$g cget -shadow] 0] |
|---|
| 2197 | |
|---|
| 2198 | foreach pre {x y x2 y2} { |
|---|
| 2199 | set tmpOpt(var,${pre}AxisTitle) $opt(gr,$gr,${pre}AxisTitle) |
|---|
| 2200 | foreach post {Color Font Shadow} { |
|---|
| 2201 | set tmpOpt(var,${pre}Axis${post}) $opt(gr,$gr,${pre}Axis${post}) |
|---|
| 2202 | } |
|---|
| 2203 | } |
|---|
| 2204 | } |
|---|
| 2205 | |
|---|
| 2206 | |
|---|
| 2207 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2208 | proc ::bayesGraph::GrapOptGetLines {this} { |
|---|
| 2209 | # |
|---|
| 2210 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2211 | upvar \#0 ${this}::data data |
|---|
| 2212 | upvar \#0 ${this}::options opt |
|---|
| 2213 | variable tmpOpt |
|---|
| 2214 | |
|---|
| 2215 | variable optLinesAll |
|---|
| 2216 | |
|---|
| 2217 | set gr $data(gr,active) |
|---|
| 2218 | set g [getActiveGraph $this] |
|---|
| 2219 | |
|---|
| 2220 | # options general |
|---|
| 2221 | set tmpOpt(var,barmode) $opt(gr,$gr,barmode) |
|---|
| 2222 | # optiones lines & bar |
|---|
| 2223 | foreach key $optLinesAll { |
|---|
| 2224 | set tmpOpt(var,$key) $opt(gr,$gr,$key) |
|---|
| 2225 | } |
|---|
| 2226 | # names lines |
|---|
| 2227 | set tmpOpt(var,lstnames) $opt(gr,$gr,lstnames) |
|---|
| 2228 | } |
|---|
| 2229 | |
|---|
| 2230 | |
|---|
| 2231 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2232 | proc ::bayesGraph::ShowOptLines {this nline} { |
|---|
| 2233 | # |
|---|
| 2234 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2235 | upvar \#0 ${this}::widgets widgets |
|---|
| 2236 | variable tmpOpt |
|---|
| 2237 | variable optLines |
|---|
| 2238 | |
|---|
| 2239 | # options general |
|---|
| 2240 | set idx [expr $nline - 1] |
|---|
| 2241 | foreach key $optLines { |
|---|
| 2242 | set tmpOpt(var,${key}_) [lindex $tmpOpt(var,$key) $idx] |
|---|
| 2243 | } |
|---|
| 2244 | # axis |
|---|
| 2245 | set xy [lindex $tmpOpt(var,xyMappedAxis) $idx] |
|---|
| 2246 | set tmpOpt(var,xMappedAxis_) [lindex $xy 0] |
|---|
| 2247 | set tmpOpt(var,yMappedAxis_) [lindex $xy 1] |
|---|
| 2248 | # Name line. Note: label -> 3 |
|---|
| 2249 | foreach id [$widgets(lines,lst) get] { |
|---|
| 2250 | if {[string equal [$widgets(lines,lst) get $id id] $nline]} { |
|---|
| 2251 | set idLb $id |
|---|
| 2252 | } |
|---|
| 2253 | } |
|---|
| 2254 | set tmpOpt(var,linelabels_) [lindex [$widgets(lines,lst) get $idLb label] 0] |
|---|
| 2255 | } |
|---|
| 2256 | |
|---|
| 2257 | |
|---|
| 2258 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2259 | proc ::bayesGraph::ShowSelectLines {this} { |
|---|
| 2260 | # |
|---|
| 2261 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2262 | upvar \#0 ${this}::data data |
|---|
| 2263 | upvar \#0 ${this}::widgets widgets |
|---|
| 2264 | variable tmpOpt |
|---|
| 2265 | |
|---|
| 2266 | # get info now |
|---|
| 2267 | set linSel {} |
|---|
| 2268 | set idSel [$widgets(lines,lst) selection get] |
|---|
| 2269 | foreach id $idSel { |
|---|
| 2270 | lappend linSel [$widgets(lines,lst) get $id id] |
|---|
| 2271 | } |
|---|
| 2272 | |
|---|
| 2273 | # check exists selection prior ? |
|---|
| 2274 | if {[info exists data(lines,selectant)] && \ |
|---|
| 2275 | [llength $data(lines,selectant)]} { |
|---|
| 2276 | ::bayesGraph::GrapOptSetLines $this $data(lines,selectant) |
|---|
| 2277 | } |
|---|
| 2278 | |
|---|
| 2279 | # select prior |
|---|
| 2280 | set data(lines,selectant) $linSel |
|---|
| 2281 | |
|---|
| 2282 | if {[llength data(lines,selectant)]} { |
|---|
| 2283 | ::bayesGraph::ShowOptLines $this $linSel |
|---|
| 2284 | } |
|---|
| 2285 | } |
|---|
| 2286 | |
|---|
| 2287 | |
|---|
| 2288 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2289 | proc ::bayesGraph::GrapOptSetLines {this lstlines} { |
|---|
| 2290 | # |
|---|
| 2291 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2292 | upvar \#0 ${this}::widgets widgets |
|---|
| 2293 | variable tmpOpt |
|---|
| 2294 | variable optLines |
|---|
| 2295 | |
|---|
| 2296 | foreach idx $lstlines { |
|---|
| 2297 | set i [expr $idx - 1] |
|---|
| 2298 | # options general |
|---|
| 2299 | foreach key $optLines { |
|---|
| 2300 | set tmpOpt(var,$key) \ |
|---|
| 2301 | [lreplace $tmpOpt(var,$key) $i $i $tmpOpt(var,${key}_)] |
|---|
| 2302 | } |
|---|
| 2303 | # axis |
|---|
| 2304 | set tmpOpt(var,xyMappedAxis) [lreplace $tmpOpt(var,xyMappedAxis) $i $i \ |
|---|
| 2305 | "$tmpOpt(var,xMappedAxis_) $tmpOpt(var,yMappedAxis_)"] |
|---|
| 2306 | |
|---|
| 2307 | # Line name |
|---|
| 2308 | foreach id [$widgets(lines,lst) get] { |
|---|
| 2309 | if {[string equal [$widgets(lines,lst) get $id id] $idx]} { |
|---|
| 2310 | set idLb $id |
|---|
| 2311 | } |
|---|
| 2312 | } |
|---|
| 2313 | if {[string length $tmpOpt(var,linelabels_)]} { |
|---|
| 2314 | set name $tmpOpt(var,linelabels_) |
|---|
| 2315 | } else { |
|---|
| 2316 | set name [$widgets(lines,lst) get $idLb caption] |
|---|
| 2317 | } |
|---|
| 2318 | $widgets(lines,lst) set $idLb [list $name] label |
|---|
| 2319 | } |
|---|
| 2320 | |
|---|
| 2321 | # new List Names with order |
|---|
| 2322 | set tmpOpt(var,lstnames) {} |
|---|
| 2323 | foreach id [$widgets(lines,lst) get] { |
|---|
| 2324 | lappend tmpOpt(var,lstnames) [$widgets(lines,lst) get $id] |
|---|
| 2325 | } |
|---|
| 2326 | } |
|---|
| 2327 | |
|---|
| 2328 | |
|---|
| 2329 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2330 | proc ::bayesGraph::GrapOptGetMarkers {this} { |
|---|
| 2331 | # |
|---|
| 2332 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2333 | upvar \#0 ${this}::data data |
|---|
| 2334 | upvar \#0 ${this}::options opt |
|---|
| 2335 | variable tmpOpt |
|---|
| 2336 | set gr $data(gr,active) |
|---|
| 2337 | |
|---|
| 2338 | #Estas opciones deben venir del ini |
|---|
| 2339 | set tmpOpt(var,xMarkers) $opt(gr,$gr,xMarkers) |
|---|
| 2340 | set tmpOpt(var,yMarkers) $opt(gr,$gr,yMarkers) |
|---|
| 2341 | set tmpOpt(var,xMarkersIn) $opt(gr,$gr,xMarkersIn) |
|---|
| 2342 | set tmpOpt(var,yMarkersIn) $opt(gr,$gr,yMarkersIn) |
|---|
| 2343 | set tmpOpt(var,x2Markers) $opt(gr,$gr,x2Markers) |
|---|
| 2344 | set tmpOpt(var,y2Markers) $opt(gr,$gr,y2Markers) |
|---|
| 2345 | set tmpOpt(var,x2MarkersIn) $opt(gr,$gr,x2MarkersIn) |
|---|
| 2346 | set tmpOpt(var,y2MarkersIn) $opt(gr,$gr,y2MarkersIn) |
|---|
| 2347 | |
|---|
| 2348 | foreach axis {x x2 y y2} { |
|---|
| 2349 | set i 0 |
|---|
| 2350 | foreach color $opt(gr,$gr,${axis}MarkersColorsInEach) { |
|---|
| 2351 | set tmpOpt(var,${axis}MarkerColorInEach$i) $color |
|---|
| 2352 | incr i |
|---|
| 2353 | } |
|---|
| 2354 | set i 0 |
|---|
| 2355 | foreach width $opt(gr,$gr,${axis}MarkersWidthsInEach) { |
|---|
| 2356 | set tmpOpt(var,${axis}MarkerWidthInEach$i) $width |
|---|
| 2357 | incr i |
|---|
| 2358 | } |
|---|
| 2359 | set i 0 |
|---|
| 2360 | foreach dashes $opt(gr,$gr,${axis}MarkersDashesInEach) { |
|---|
| 2361 | set tmpOpt(var,${axis}MarkerDasheInEach$i) $dashes |
|---|
| 2362 | incr i |
|---|
| 2363 | } |
|---|
| 2364 | set i 0 |
|---|
| 2365 | foreach under $opt(gr,$gr,${axis}MarkersUndersInEach) { |
|---|
| 2366 | set tmpOpt(var,${axis}MarkerUnderInEach$i) $under |
|---|
| 2367 | incr i |
|---|
| 2368 | } |
|---|
| 2369 | |
|---|
| 2370 | } |
|---|
| 2371 | } |
|---|
| 2372 | |
|---|
| 2373 | |
|---|
| 2374 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2375 | proc ::bayesGraph::GrapOptGetGrid {this} { |
|---|
| 2376 | # |
|---|
| 2377 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2378 | upvar \#0 ${this}::data data |
|---|
| 2379 | upvar \#0 ${this}::options opt |
|---|
| 2380 | set gr $data(gr,active) |
|---|
| 2381 | set g [getActiveGraph $this] |
|---|
| 2382 | variable tmpOpt |
|---|
| 2383 | |
|---|
| 2384 | # Al coger las opciones de opt, perdemos la opcion de que las opciones |
|---|
| 2385 | # muestren los cambios hechos desde otro lugar (TkConsole, p.ejemplo) |
|---|
| 2386 | # pero bueno... |
|---|
| 2387 | foreach it {Color Dashes LineWidth Minor MapX MapY} { |
|---|
| 2388 | set tmpOpt(var,grid,$it) $opt(gr,$gr,grid,$it) |
|---|
| 2389 | } |
|---|
| 2390 | } |
|---|
| 2391 | |
|---|
| 2392 | |
|---|
| 2393 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2394 | proc ::bayesGraph::GrapOptGetLegend {this} { |
|---|
| 2395 | # |
|---|
| 2396 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2397 | upvar \#0 ${this}::data data |
|---|
| 2398 | upvar \#0 ${this}::options opt |
|---|
| 2399 | set gr $data(gr,active) |
|---|
| 2400 | set g [getActiveGraph $this] |
|---|
| 2401 | variable tmpOpt |
|---|
| 2402 | |
|---|
| 2403 | set tmpOpt(var,legend,Hide) [$g legend cget -hide] |
|---|
| 2404 | set tmpOpt(var,legend,Bg) [$g legend cget -bg] |
|---|
| 2405 | set tmpOpt(var,legend,Bd) [$g legend cget -bd] |
|---|
| 2406 | set tmpOpt(var,legend,Fg) [$g legend cget -fg] |
|---|
| 2407 | set tmpOpt(var,legend,Font) [$g legend cget -font] |
|---|
| 2408 | set tmpOpt(var,legend,Shadow) [lindex [$g legend cget -shadow] 0] |
|---|
| 2409 | set tmpOpt(var,legend,Position) $opt(gr,$gr,legend,Position) |
|---|
| 2410 | set tmpOpt(var,legend,Anchor) [$g legend cget -anchor] |
|---|
| 2411 | set tmpOpt(var,legend,Relief) [$g legend cget -relief] |
|---|
| 2412 | set tmpOpt(var,legend,Raised) [$g legend cget -raised] |
|---|
| 2413 | set tmpOpt(var,legend,IPadXl) [lindex [$g legend cget -ipadx] 0] |
|---|
| 2414 | set tmpOpt(var,legend,IPadXr) [lindex [$g legend cget -ipadx] 1] |
|---|
| 2415 | set tmpOpt(var,legend,IPadYt) [lindex [$g legend cget -ipady] 0] |
|---|
| 2416 | set tmpOpt(var,legend,IPadYb) [lindex [$g legend cget -ipady] 1] |
|---|
| 2417 | set tmpOpt(var,legend,PadXl) [lindex [$g legend cget -padx] 0] |
|---|
| 2418 | set tmpOpt(var,legend,PadXr) [lindex [$g legend cget -padx] 1] |
|---|
| 2419 | set tmpOpt(var,legend,PadYt) [lindex [$g legend cget -pady] 0] |
|---|
| 2420 | set tmpOpt(var,legend,PadYb) [lindex [$g legend cget -pady] 1] |
|---|
| 2421 | set tmpOpt(var,legend,Rows) [$g legend cget -rows] |
|---|
| 2422 | set tmpOpt(var,legend,Columns) [$g legend cget -columns] |
|---|
| 2423 | } |
|---|
| 2424 | |
|---|
| 2425 | |
|---|
| 2426 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2427 | proc ::bayesGraph::GrapOptGetStyle {this} { |
|---|
| 2428 | # |
|---|
| 2429 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2430 | upvar \#0 ${this}::data data |
|---|
| 2431 | upvar \#0 ${this}::options opt |
|---|
| 2432 | variable tmpOpt |
|---|
| 2433 | set gr $data(gr,active) |
|---|
| 2434 | set g [getActiveGraph $this] |
|---|
| 2435 | |
|---|
| 2436 | foreach it {background relief lm rm tm bm} { |
|---|
| 2437 | set tmpOpt(var,$it) [$g cget -$it] |
|---|
| 2438 | } |
|---|
| 2439 | foreach it {plotbackground plotrelief plotborderwidth} { |
|---|
| 2440 | set tmpOpt(var,$it) [$g cget -$it] |
|---|
| 2441 | } |
|---|
| 2442 | |
|---|
| 2443 | set tmpOpt(var,areaborderwidth) [$g cget -borderwidth] |
|---|
| 2444 | |
|---|
| 2445 | set tmpOpt(var,invertxy) $opt(gr,$gr,invertxy) |
|---|
| 2446 | set tmpOpt(var,plotpadxl) [lindex [$g cget -plotpadx] 0] |
|---|
| 2447 | set tmpOpt(var,plotpadxr) [lindex [$g cget -plotpadx] 1] |
|---|
| 2448 | set tmpOpt(var,plotpadyt) [lindex [$g cget -plotpady] 0] |
|---|
| 2449 | set tmpOpt(var,plotpadyb) [lindex [$g cget -plotpady] 1] |
|---|
| 2450 | } |
|---|
| 2451 | |
|---|
| 2452 | |
|---|
| 2453 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2454 | proc ::bayesGraph::GrapOptSet {this} { |
|---|
| 2455 | # |
|---|
| 2456 | # PURPOSE: Commits all options values from the temporary 'tmpOpt' array to |
|---|
| 2457 | # other structure. |
|---|
| 2458 | # |
|---|
| 2459 | # PARAMETERS: |
|---|
| 2460 | # this -> Instance of BayesGraph |
|---|
| 2461 | # |
|---|
| 2462 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2463 | upvar \#0 ${this}::widgets widgets |
|---|
| 2464 | upvar \#0 ${this}::data data |
|---|
| 2465 | upvar \#0 ${this}::options options |
|---|
| 2466 | |
|---|
| 2467 | variable tmpOpt |
|---|
| 2468 | |
|---|
| 2469 | set gr $data(gr,active) |
|---|
| 2470 | |
|---|
| 2471 | # options axis |
|---|
| 2472 | foreach axis {x x2 y y2} { |
|---|
| 2473 | set tmpOpt(var,${axis}MarkersColorsInEach) {} |
|---|
| 2474 | set tmpOpt(var,${axis}MarkersWidthsInEach) {} |
|---|
| 2475 | set tmpOpt(var,${axis}MarkersDashesInEach) {} |
|---|
| 2476 | set tmpOpt(var,${axis}MarkersUndersInEach) {} |
|---|
| 2477 | } |
|---|
| 2478 | # options axis list |
|---|
| 2479 | foreach axis {x x2 y y2} { |
|---|
| 2480 | for {set i 0} {$i<5} {incr i} { |
|---|
| 2481 | lappend tmpOpt(var,${axis}MarkersColorsInEach) \ |
|---|
| 2482 | $tmpOpt(var,${axis}MarkerColorInEach$i) |
|---|
| 2483 | lappend tmpOpt(var,${axis}MarkersWidthsInEach) \ |
|---|
| 2484 | $tmpOpt(var,${axis}MarkerWidthInEach$i) |
|---|
| 2485 | lappend tmpOpt(var,${axis}MarkersDashesInEach) \ |
|---|
| 2486 | $tmpOpt(var,${axis}MarkerDasheInEach$i) |
|---|
| 2487 | lappend tmpOpt(var,${axis}MarkersUndersInEach) \ |
|---|
| 2488 | $tmpOpt(var,${axis}MarkerUnderInEach$i) |
|---|
| 2489 | } |
|---|
| 2490 | } |
|---|
| 2491 | |
|---|
| 2492 | regsub -all var, [array names ::bayesGraph::tmpOpt var,*] "" optNames |
|---|
| 2493 | |
|---|
| 2494 | foreach it $optNames { |
|---|
| 2495 | set options(gr,$gr,$it) $tmpOpt(var,$it) |
|---|
| 2496 | } |
|---|
| 2497 | #Ya no se usa |
|---|
| 2498 | set options(gr,${gr}_INIT) YES |
|---|
| 2499 | } |
|---|
| 2500 | |
|---|
| 2501 | |
|---|
| 2502 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2503 | proc ::bayesGraph::GrapOptInit {this} { |
|---|
| 2504 | # |
|---|
| 2505 | # PURPOSE: |
|---|
| 2506 | # |
|---|
| 2507 | # PARAMETERS: |
|---|
| 2508 | # this -> Instance of BayesGraph |
|---|
| 2509 | # |
|---|
| 2510 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2511 | upvar \#0 ${this}::data data |
|---|
| 2512 | variable tmpOpt |
|---|
| 2513 | set gr $data(gr,active) |
|---|
| 2514 | set values [::bayesGraph::GetLimitsValueAxis $this x] |
|---|
| 2515 | if {[string is double $tmpOpt(var,xyAxisMin)] && \ |
|---|
| 2516 | $tmpOpt(var,xyAxisMin) <= [lindex $values 0]} { |
|---|
| 2517 | $tmpOpt(widget,xyAxisMin) setvalue first |
|---|
| 2518 | set tmpOpt(var,xyAxisMin) [$tmpOpt(widget,xyAxisMin) getvalue] |
|---|
| 2519 | } |
|---|
| 2520 | if {[string is double $tmpOpt(var,xyAxisMax)] && \ |
|---|
| 2521 | $tmpOpt(var,xyAxisMax) >= [lindex $values 1]} { |
|---|
| 2522 | $tmpOpt(widget,xyAxisMax) setvalue last |
|---|
| 2523 | set tmpOpt(var,xyAxisMax) [$tmpOpt(widget,xyAxisMax) getvalue] |
|---|
| 2524 | } |
|---|
| 2525 | } |
|---|
| 2526 | |
|---|
| 2527 | |
|---|
| 2528 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2529 | proc ::bayesGraph::GrapOptApplyAll {this} { |
|---|
| 2530 | # |
|---|
| 2531 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2532 | upvar \#0 ${this}::data data |
|---|
| 2533 | set old_active $data(gr,active) |
|---|
| 2534 | for {set gr 0} {$gr<$data(gr,numGraph)} {incr gr} { |
|---|
| 2535 | set data(gr,active) $gr |
|---|
| 2536 | GrapOptApply $this |
|---|
| 2537 | } |
|---|
| 2538 | set data(gr,active) $old_active |
|---|
| 2539 | } |
|---|
| 2540 | |
|---|
| 2541 | |
|---|
| 2542 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2543 | proc ::bayesGraph::GrapOptApply {this} { |
|---|
| 2544 | # |
|---|
| 2545 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2546 | upvar \#0 ${this}::data data |
|---|
| 2547 | upvar \#0 ${this}::options opt |
|---|
| 2548 | |
|---|
| 2549 | set gr $data(gr,active) |
|---|
| 2550 | set g [getActiveGraph $this] |
|---|
| 2551 | variable tmpOpt |
|---|
| 2552 | upvar \#0 ${this}::widgets widgets |
|---|
| 2553 | |
|---|
| 2554 | # leemos los valores actuales de los ejes activos en el formulario |
|---|
| 2555 | ShowAxisSelectXY $this |
|---|
| 2556 | # leemos los valores actuales de la linea marcada |
|---|
| 2557 | set linSel {} |
|---|
| 2558 | foreach id [$widgets(lines,lst) selection get] { |
|---|
| 2559 | lappend linSel [$widgets(lines,lst) get $id id] |
|---|
| 2560 | } |
|---|
| 2561 | GrapOptSetLines $this $linSel |
|---|
| 2562 | # options |
|---|
| 2563 | GrapOptApplyMappedLines $this ::bayesGraph::tmpOpt var |
|---|
| 2564 | #Debe ir antes de calcular el step pq cambia rotate |
|---|
| 2565 | GrapOptApplyTicksStyle $this ::bayesGraph::tmpOpt var |
|---|
| 2566 | GrapOptApplyAxisPos $this ::bayesGraph::tmpOpt var |
|---|
| 2567 | GrapOptApplyAxisTicks $this ::bayesGraph::tmpOpt var |
|---|
| 2568 | GrapOptApplyTitles $this ::bayesGraph::tmpOpt var |
|---|
| 2569 | |
|---|
| 2570 | GrapOptApplyLnesAll $this ::bayesGraph::tmpOpt var |
|---|
| 2571 | |
|---|
| 2572 | GrapOptApplyMarkers $this ::bayesGraph::tmpOpt var |
|---|
| 2573 | GrapOptApplyMarkersIn $this ::bayesGraph::tmpOpt var |
|---|
| 2574 | |
|---|
| 2575 | GrapOptApplyGrid $this ::bayesGraph::tmpOpt var,grid |
|---|
| 2576 | GrapOptApplyLegend $this ::bayesGraph::tmpOpt var,legend |
|---|
| 2577 | GrapOptApplyStyle $this ::bayesGraph::tmpOpt var |
|---|
| 2578 | |
|---|
| 2579 | GrapOptApplyOrder $this ::bayesGraph::tmpOpt var |
|---|
| 2580 | |
|---|
| 2581 | # Show Line |
|---|
| 2582 | if {![info exists opt(gr,$gr,linehides)] || \ |
|---|
| 2583 | ![info exists tmpOpt(::bayesGraph::tmpOpt,linehides)] || \ |
|---|
| 2584 | ![string equal $opt(gr,$gr,linehides) $tmpOpt(::bayesGraph::tmpOpt,linehides)]} { |
|---|
| 2585 | GrapOptApplyLineDefault $this ::bayesGraph::tmpOpt var hide linehides |
|---|
| 2586 | } |
|---|
| 2587 | |
|---|
| 2588 | |
|---|
| 2589 | if [info exists ${this}::data(proc,OnOptionApply)] { |
|---|
| 2590 | $data(proc,OnOptionApply) $this |
|---|
| 2591 | } |
|---|
| 2592 | |
|---|
| 2593 | #Save options after apply |
|---|
| 2594 | GrapOptSet $this |
|---|
| 2595 | } |
|---|
| 2596 | |
|---|
| 2597 | |
|---|
| 2598 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2599 | proc ::bayesGraph::GrapOptApplyAxisPos {this var pre} { |
|---|
| 2600 | # |
|---|
| 2601 | # PURPOSE: |
|---|
| 2602 | # |
|---|
| 2603 | # PARAMETERS: |
|---|
| 2604 | # this -> Instance of BayesGraph |
|---|
| 2605 | # |
|---|
| 2606 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2607 | upvar \#0 $var ary |
|---|
| 2608 | |
|---|
| 2609 | upvar \#0 ${this}::data data |
|---|
| 2610 | # variable tmpOpt |
|---|
| 2611 | set gr $data(gr,active) |
|---|
| 2612 | set g [getActiveGraph $this] |
|---|
| 2613 | foreach axis {x y x2 y2} { |
|---|
| 2614 | # si esta visible |
|---|
| 2615 | if {![$g axis cget $axis -hide]} { |
|---|
| 2616 | set AXIS [string toupper $axis] |
|---|
| 2617 | set AXI [string index $AXIS 0] |
|---|
| 2618 | if {$ary(${pre},${axis}AxisAll)} { |
|---|
| 2619 | set values [::bayesGraph::GetLimitsValueAxis $this $axis] |
|---|
| 2620 | set vmin [lindex $values 0] |
|---|
| 2621 | set vmax [lindex $values 1] |
|---|
| 2622 | } else { |
|---|
| 2623 | set vmin $ary(${pre},${axis}AxisMin) |
|---|
| 2624 | set vmax $ary(${pre},${axis}AxisMax) |
|---|
| 2625 | } |
|---|
| 2626 | if {[info exists data(gr,$gr,OnGet${AXI}Ticks)]} { |
|---|
| 2627 | set lst [$data(gr,$gr,OnGet${AXI}Ticks) $this] |
|---|
| 2628 | if {![string is double $vmin]} { |
|---|
| 2629 | set vmin [lsearch $lst $vmin] |
|---|
| 2630 | } |
|---|
| 2631 | if {![string is double $vmax]} { |
|---|
| 2632 | set vmax [lsearch $lst $vmax] |
|---|
| 2633 | } |
|---|
| 2634 | } |
|---|
| 2635 | if {$vmin<$vmax} { |
|---|
| 2636 | ::bayesGraph::GrapOptApplyAxisLimits $this $axis $vmin $vmax |
|---|
| 2637 | } |
|---|
| 2638 | } |
|---|
| 2639 | } |
|---|
| 2640 | } |
|---|
| 2641 | |
|---|
| 2642 | |
|---|
| 2643 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2644 | proc ::bayesGraph::GrapOptApplyAxisTicks {this var pre} { |
|---|
| 2645 | # |
|---|
| 2646 | # PURPOSE: |
|---|
| 2647 | # |
|---|
| 2648 | # PARAMETERS: |
|---|
| 2649 | # this -> Instance of BayesGraph |
|---|
| 2650 | # var -> |
|---|
| 2651 | # pre -> |
|---|
| 2652 | # |
|---|
| 2653 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2654 | upvar \#0 $var ary |
|---|
| 2655 | set g [getActiveGraph $this] |
|---|
| 2656 | # Axis |
|---|
| 2657 | foreach axis {x x2 y y2} { |
|---|
| 2658 | set AXI [string toupper [string index $axis 0]] |
|---|
| 2659 | if {![$g axis cget $axis -hide]} { |
|---|
| 2660 | switch $ary(${pre},${axis}TicksType) { |
|---|
| 2661 | total { |
|---|
| 2662 | set step \ |
|---|
| 2663 | [Compute${AXI}AxisStep $this \ |
|---|
| 2664 | $ary(${pre},${axis}TicksTotal) \ |
|---|
| 2665 | $axis] |
|---|
| 2666 | } |
|---|
| 2667 | each { |
|---|
| 2668 | if {[info exists data(proc,OnFixStep${AXI})]} { |
|---|
| 2669 | set min [$g axis cget $axis -min] |
|---|
| 2670 | set max [$g axis cget $axis -max] |
|---|
| 2671 | set step [$data(proc,OnFixStep{AXI}) \ |
|---|
| 2672 | $this $min $max $ary(${pre},${axis}TicksStep)] |
|---|
| 2673 | } else { |
|---|
| 2674 | set step $ary(${pre},${axis}TicksStep) |
|---|
| 2675 | } |
|---|
| 2676 | } |
|---|
| 2677 | auto { |
|---|
| 2678 | set nTicks [Calculate${AXI}AxisNumTicks $this $axis] |
|---|
| 2679 | set step [Compute${AXI}AxisStep $this $nTicks $axis] |
|---|
| 2680 | } |
|---|
| 2681 | default {set step 1} |
|---|
| 2682 | } |
|---|
| 2683 | # Verifico si step es demasiado pequeño para los límites del eje |
|---|
| 2684 | set max [$g axis cget $axis -max] |
|---|
| 2685 | set min [$g axis cget $axis -min] |
|---|
| 2686 | set max [expr { $max eq "" ? 1 : $max }] |
|---|
| 2687 | set min [expr { $min eq "" ? 0 : $min }] |
|---|
| 2688 | set step [expr { $step eq "" ? 1 : $step }] |
|---|
| 2689 | if {($step==0) || [expr (($max-$min)/$step) < 1000 ]} { |
|---|
| 2690 | $g axis configure $axis -stepsize $step |
|---|
| 2691 | } |
|---|
| 2692 | } |
|---|
| 2693 | } |
|---|
| 2694 | } |
|---|
| 2695 | |
|---|
| 2696 | |
|---|
| 2697 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2698 | proc ::bayesGraph::GrapOptApplyAxisAuto {this} { |
|---|
| 2699 | # |
|---|
| 2700 | # PURPOSE: |
|---|
| 2701 | # |
|---|
| 2702 | # PARAMETERS: |
|---|
| 2703 | # this -> Instance of BayesGraph |
|---|
| 2704 | # |
|---|
| 2705 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2706 | update |
|---|
| 2707 | set g [getActiveGraph $this] |
|---|
| 2708 | foreach axis {x x2y y2} { |
|---|
| 2709 | set AXI [string toupper [string index $axis 0]] |
|---|
| 2710 | set nTicks [Calculate${AXI}AxisNumTicks $this $axis] |
|---|
| 2711 | set step [Compute${AXI}AxisStep $this $nTicks $axis] |
|---|
| 2712 | $g axis configure $axis -stepsize $step |
|---|
| 2713 | } |
|---|
| 2714 | } |
|---|
| 2715 | |
|---|
| 2716 | |
|---|
| 2717 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2718 | proc ::bayesGraph::GrapOptApplyTicksStyle {this var pre} { |
|---|
| 2719 | # |
|---|
| 2720 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2721 | upvar \#0 $var ary |
|---|
| 2722 | upvar \#0 ${this}::data data |
|---|
| 2723 | |
|---|
| 2724 | set g [getActiveGraph $this] |
|---|
| 2725 | foreach pref {x x2 y y2} { |
|---|
| 2726 | # command axis |
|---|
| 2727 | set cmd {} |
|---|
| 2728 | if {[info exists ${this}::data(proc,${pref}AxisCommand)]} { |
|---|
| 2729 | set cmd "$data(proc,${pref}AxisCommand)" |
|---|
| 2730 | } else { |
|---|
| 2731 | set cmd [list ::bayesGraph::FormatNumberAxis \ |
|---|
| 2732 | $ary(${pre},${pref}FormatNumber) \ |
|---|
| 2733 | $ary(${pre},${pref}FormatPercent)] |
|---|
| 2734 | } |
|---|
| 2735 | # configuration |
|---|
| 2736 | $g axis configure $pref \ |
|---|
| 2737 | -tickfont $ary(${pre},${pref}TicksFont)\ |
|---|
| 2738 | -rotate $ary(${pre},${pref}TicksRotate)\ |
|---|
| 2739 | -color $ary(${pre},${pref}TicksColor)\ |
|---|
| 2740 | -ticklength $ary(${pre},${pref}TicksLength)\ |
|---|
| 2741 | -tickshadow $ary(${pre},${pref}TicksShadow)\ |
|---|
| 2742 | -subdivisions $ary(${pre},${pref}TicksSubdivisions)\ |
|---|
| 2743 | -linewidth $ary(${pre},${pref}TicksWidth)\ |
|---|
| 2744 | -showticks $ary(${pre},${pref}TicksShow)\ |
|---|
| 2745 | -hide [expr !$ary(${pre},${pref}AxisShow)]\ |
|---|
| 2746 | -command $cmd |
|---|
| 2747 | } |
|---|
| 2748 | } |
|---|
| 2749 | |
|---|
| 2750 | |
|---|
| 2751 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2752 | proc ::bayesGraph::FormatNumberAxis {forNum forPer bltg tick} { |
|---|
| 2753 | # |
|---|
| 2754 | # PURPOSE: Aplica un formato a los valores del eje Y. |
|---|
| 2755 | # |
|---|
| 2756 | # PARAMETERS: |
|---|
| 2757 | # forNum -> format number |
|---|
| 2758 | # forPer -> format percent |
|---|
| 2759 | # gltg -> the pathname of the widget |
|---|
| 2760 | # tick -> current the numeric value of the tick |
|---|
| 2761 | # |
|---|
| 2762 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2763 | |
|---|
| 2764 | if {[string length $forNum]} { |
|---|
| 2765 | if {$forPer} { |
|---|
| 2766 | set valAux [expr $tick * 100] |
|---|
| 2767 | } else { |
|---|
| 2768 | set valAux $tick |
|---|
| 2769 | } |
|---|
| 2770 | if {![catch {set nf [format $forNum $valAux]} res]} { |
|---|
| 2771 | return $nf |
|---|
| 2772 | } else { |
|---|
| 2773 | return $tick |
|---|
| 2774 | } |
|---|
| 2775 | } else { |
|---|
| 2776 | return $tick |
|---|
| 2777 | } |
|---|
| 2778 | } |
|---|
| 2779 | |
|---|
| 2780 | |
|---|
| 2781 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2782 | proc ::bayesGraph::GrapOptApplyTitles {this var pre} { |
|---|
| 2783 | # |
|---|
| 2784 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2785 | upvar \#0 $var ary |
|---|
| 2786 | |
|---|
| 2787 | set g [getActiveGraph $this] |
|---|
| 2788 | if [info exist ${var}(${pre},title)] { |
|---|
| 2789 | $g configure -title "$ary(${pre},title)" |
|---|
| 2790 | } |
|---|
| 2791 | $g configure -font $ary(${pre},font)\ |
|---|
| 2792 | -foreground $ary(${pre},foreground)\ |
|---|
| 2793 | -shadow $ary(${pre},shadow) |
|---|
| 2794 | |
|---|
| 2795 | foreach pref {x y x2 y2} { |
|---|
| 2796 | $g axis configure $pref -title $ary(${pre},${pref}AxisTitle)\ |
|---|
| 2797 | -titlefont $ary(${pre},${pref}AxisFont)\ |
|---|
| 2798 | -titlecolor $ary(${pre},${pref}AxisColor)\ |
|---|
| 2799 | -titleshadow $ary(${pre},${pref}AxisShadow) |
|---|
| 2800 | } |
|---|
| 2801 | } |
|---|
| 2802 | |
|---|
| 2803 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2804 | proc ::bayesGraph::GrapOptApplyLnesAll {this var pre} { |
|---|
| 2805 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2806 | upvar \#0 ${this}::options opt |
|---|
| 2807 | upvar \#0 ${this}::data data |
|---|
| 2808 | variable tmpOpt |
|---|
| 2809 | variable optLinesData |
|---|
| 2810 | variable optLinesSymbol |
|---|
| 2811 | set gr $data(gr,active) |
|---|
| 2812 | set okAll 0 |
|---|
| 2813 | |
|---|
| 2814 | # Line Type |
|---|
| 2815 | if {![info exists opt(gr,$gr,linetypes)] || \ |
|---|
| 2816 | ![info exists tmpOpt(var,linetypes)] || \ |
|---|
| 2817 | ![string equal $opt(gr,$gr,linetypes) $tmpOpt(var,linetypes)]} { |
|---|
| 2818 | GrapOptApplyLineTypes $this $var $pre |
|---|
| 2819 | set okAll 1 |
|---|
| 2820 | } |
|---|
| 2821 | # Colors |
|---|
| 2822 | if {($okAll) || \ |
|---|
| 2823 | ![info exists opt(gr,$gr,colors)] || \ |
|---|
| 2824 | ![info exists tmpOpt(var,colors)] || \ |
|---|
| 2825 | ![string equal $opt(gr,$gr,colors) $tmpOpt(var,colors)]} { |
|---|
| 2826 | GrapOptApplyColors $this $var $pre |
|---|
| 2827 | } |
|---|
| 2828 | # Widths |
|---|
| 2829 | if {($okAll) || \ |
|---|
| 2830 | ![info exists opt(gr,$gr,linewidth)] || \ |
|---|
| 2831 | ![info exists tmpOpt(var,linewidth)] || \ |
|---|
| 2832 | ![string equal $opt(gr,$gr,linewidth) $tmpOpt(var,linewidth)]} { |
|---|
| 2833 | GrapOptApplyLineWidth $this $var $pre |
|---|
| 2834 | } |
|---|
| 2835 | # Dashes |
|---|
| 2836 | if {($okAll) || \ |
|---|
| 2837 | ![info exists opt(gr,$gr,dashes)] || \ |
|---|
| 2838 | ![info exists tmpOpt(var,dashes)] || \ |
|---|
| 2839 | ![string equal $opt(gr,$gr,dashes) $tmpOpt(var,dashes)]} { |
|---|
| 2840 | GrapOptApplyDashes $this $var $pre |
|---|
| 2841 | } |
|---|
| 2842 | # Smooths |
|---|
| 2843 | if {($okAll) || \ |
|---|
| 2844 | ![info exists opt(gr,$gr,smooth)] || \ |
|---|
| 2845 | ![info exists tmpOpt(var,smooth)] || \ |
|---|
| 2846 | ![string equal $opt(gr,$gr,smooth) $tmpOpt(var,smooth)]} { |
|---|
| 2847 | GrapOptApplySmooth $this $var $pre |
|---|
| 2848 | } |
|---|
| 2849 | # Bar mode |
|---|
| 2850 | if {($okAll) || \ |
|---|
| 2851 | ![info exists opt(gr,$gr,barmode)] || \ |
|---|
| 2852 | ![info exists tmpOpt(var,barmode)] || \ |
|---|
| 2853 | ![string equal $opt(gr,$gr,barmode) $tmpOpt(var,barmode)]} { |
|---|
| 2854 | GrapOptApplyBarMode $this $var $pre |
|---|
| 2855 | } |
|---|
| 2856 | # Bar Width |
|---|
| 2857 | if {($okAll) || \ |
|---|
| 2858 | ![info exists opt(gr,$gr,barwidth)] || \ |
|---|
| 2859 | ![info exists tmpOpt(var,barwidth)] || \ |
|---|
| 2860 | ![string equal $opt(gr,$gr,barwidth) $tmpOpt(var,barwidth)]} { |
|---|
| 2861 | GrapOptApplyBarWidth $this $var $pre |
|---|
| 2862 | } |
|---|
| 2863 | # Fill. Depent type line and type fill |
|---|
| 2864 | GrapOptApplyFill $this $var $pre |
|---|
| 2865 | # Datas |
|---|
| 2866 | set ok 0 |
|---|
| 2867 | set optData $optLinesData |
|---|
| 2868 | foreach key $optData { |
|---|
| 2869 | if {![info exists opt(gr,$gr,$key)] || \ |
|---|
| 2870 | ![info exists tmpOpt(var,$key)] || \ |
|---|
| 2871 | ![string equal $opt(gr,$gr,$key) $tmpOpt(var,$key)]} { |
|---|
| 2872 | set ok 1 |
|---|
| 2873 | } |
|---|
| 2874 | } |
|---|
| 2875 | if {$ok} { GrapOptApplyShowValues $this $var $pre } |
|---|
| 2876 | # Symbol |
|---|
| 2877 | set ok 0 |
|---|
| 2878 | set optSymbol $optLinesSymbol |
|---|
| 2879 | foreach key $optSymbol { |
|---|
| 2880 | if {![info exists opt(gr,$gr,$key)] || \ |
|---|
| 2881 | ![info exists tmpOpt(var,$key)] || \ |
|---|
| 2882 | ![string equal $opt(gr,$gr,$key) $tmpOpt(var,$key)]} { |
|---|
| 2883 | set ok 1 |
|---|
| 2884 | } |
|---|
| 2885 | } |
|---|
| 2886 | if {$ok} { GrapOptApplyShowSymbols $this $var $pre } |
|---|
| 2887 | # Line Name |
|---|
| 2888 | if {![info exists opt(gr,$gr,lstnames)] || \ |
|---|
| 2889 | ![info exists tmpOpt(var,lstnames)] || \ |
|---|
| 2890 | ![string equal $opt(gr,$gr,lstnames) $tmpOpt(var,lstnames)]} { |
|---|
| 2891 | GrapOptApplyLineName $this $var $pre |
|---|
| 2892 | } |
|---|
| 2893 | } |
|---|
| 2894 | |
|---|
| 2895 | |
|---|
| 2896 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2897 | proc ::bayesGraph::GrapOptApplyLineName {this var pre} { |
|---|
| 2898 | # |
|---|
| 2899 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2900 | upvar \#0 $var ary |
|---|
| 2901 | set g [getActiveGraph $this] |
|---|
| 2902 | |
|---|
| 2903 | if {[info exists ary($pre,lstnames)]} { |
|---|
| 2904 | foreach it $ary($pre,lstnames) { |
|---|
| 2905 | $g element configure [lindex [lindex $it 1] 0] -label [lindex $it 3] |
|---|
| 2906 | } |
|---|
| 2907 | } |
|---|
| 2908 | } |
|---|
| 2909 | |
|---|
| 2910 | |
|---|
| 2911 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2912 | proc ::bayesGraph::GrapOptApplyLineDefault {this var pre opt key} { |
|---|
| 2913 | # |
|---|
| 2914 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2915 | upvar \#0 $var ary |
|---|
| 2916 | set g [getActiveGraph $this] |
|---|
| 2917 | |
|---|
| 2918 | if {[info exists ary($pre,$key)]} { |
|---|
| 2919 | set j 0 |
|---|
| 2920 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 2921 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 2922 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 2923 | foreach e $it { |
|---|
| 2924 | $g element configure $e -$opt [lindex $ary($pre,$key) $i] |
|---|
| 2925 | } |
|---|
| 2926 | incr j |
|---|
| 2927 | } |
|---|
| 2928 | } |
|---|
| 2929 | } |
|---|
| 2930 | |
|---|
| 2931 | |
|---|
| 2932 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2933 | proc ::bayesGraph::GrapOptApplyLineWidth {this var pre} { |
|---|
| 2934 | # |
|---|
| 2935 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2936 | upvar \#0 $var ary |
|---|
| 2937 | set g [getActiveGraph $this] |
|---|
| 2938 | |
|---|
| 2939 | set j 0 |
|---|
| 2940 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 2941 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 2942 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 2943 | foreach e $it { |
|---|
| 2944 | if {[string equal [$g element type $e] "LineElement"]} { |
|---|
| 2945 | $g element configure $e -linewidth [lindex $ary($pre,linewidth) $i] |
|---|
| 2946 | } else { |
|---|
| 2947 | $g element configure $e -borderwidth [lindex $ary($pre,borderwidth) $i] |
|---|
| 2948 | } |
|---|
| 2949 | } |
|---|
| 2950 | incr j |
|---|
| 2951 | } |
|---|
| 2952 | } |
|---|
| 2953 | |
|---|
| 2954 | |
|---|
| 2955 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2956 | proc ::bayesGraph::GrapOptApplyBarMode {this var pre} { |
|---|
| 2957 | # |
|---|
| 2958 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2959 | upvar \#0 $var ary |
|---|
| 2960 | set g [getActiveGraph $this] |
|---|
| 2961 | $g configure -barmode $ary(${pre},barmode) |
|---|
| 2962 | } |
|---|
| 2963 | |
|---|
| 2964 | |
|---|
| 2965 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2966 | proc ::bayesGraph::GrapOptApplyBarRelief {this var pre} { |
|---|
| 2967 | # |
|---|
| 2968 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2969 | upvar \#0 $var ary |
|---|
| 2970 | set g [getActiveGraph $this] |
|---|
| 2971 | |
|---|
| 2972 | set j 0 |
|---|
| 2973 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 2974 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 2975 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 2976 | foreach e $it { |
|---|
| 2977 | if {[string equal [$g element type $e] "BarElement"]} { |
|---|
| 2978 | $g element configure $it -relief [lindex $ary($pre,barrelief) $i] |
|---|
| 2979 | } |
|---|
| 2980 | } |
|---|
| 2981 | incr j |
|---|
| 2982 | } |
|---|
| 2983 | } |
|---|
| 2984 | |
|---|
| 2985 | |
|---|
| 2986 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2987 | proc ::bayesGraph::GrapOptApplyDashes {this var pre} { |
|---|
| 2988 | # |
|---|
| 2989 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 2990 | upvar \#0 $var ary |
|---|
| 2991 | set g [getActiveGraph $this] |
|---|
| 2992 | |
|---|
| 2993 | set j 0 |
|---|
| 2994 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 2995 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 2996 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 2997 | foreach e $it { |
|---|
| 2998 | if {[string equal [$g element type $e] "LineElement"]} { |
|---|
| 2999 | $g element configure $e -dashes [lindex $ary($pre,dashes) $i] |
|---|
| 3000 | } |
|---|
| 3001 | } |
|---|
| 3002 | incr j |
|---|
| 3003 | } |
|---|
| 3004 | } |
|---|
| 3005 | |
|---|
| 3006 | |
|---|
| 3007 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3008 | proc ::bayesGraph::GrapOptApplySmooth {this var pre} { |
|---|
| 3009 | # |
|---|
| 3010 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3011 | upvar \#0 $var ary |
|---|
| 3012 | set g [getActiveGraph $this] |
|---|
| 3013 | |
|---|
| 3014 | set j 0 |
|---|
| 3015 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3016 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3017 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3018 | foreach e $it { |
|---|
| 3019 | if {[string equal [$g element type $e] "LineElement"]} { |
|---|
| 3020 | $g element configure $e -smooth [lindex $ary($pre,smooth) $i] |
|---|
| 3021 | } |
|---|
| 3022 | } |
|---|
| 3023 | incr j |
|---|
| 3024 | } |
|---|
| 3025 | } |
|---|
| 3026 | |
|---|
| 3027 | |
|---|
| 3028 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3029 | proc ::bayesGraph::GrapOptApplyBarWidth {this var pre} { |
|---|
| 3030 | # |
|---|
| 3031 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3032 | upvar \#0 $var ary |
|---|
| 3033 | set g [getActiveGraph $this] |
|---|
| 3034 | |
|---|
| 3035 | set j 0 |
|---|
| 3036 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3037 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3038 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3039 | foreach e $it { |
|---|
| 3040 | if {[string equal [$g element type $e] "BarElement"]} { |
|---|
| 3041 | $g element configure $e -barwidth [lindex $ary($pre,barwidth) $i] |
|---|
| 3042 | } |
|---|
| 3043 | } |
|---|
| 3044 | incr j |
|---|
| 3045 | } |
|---|
| 3046 | } |
|---|
| 3047 | |
|---|
| 3048 | |
|---|
| 3049 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3050 | proc ::bayesGraph::GrapOptApplyOrder {this var pre} { |
|---|
| 3051 | # |
|---|
| 3052 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3053 | upvar \#0 $var ary |
|---|
| 3054 | set g [getActiveGraph $this] |
|---|
| 3055 | $g element show \ |
|---|
| 3056 | [lreverse [join [lindex [ltraspose $ary(${pre},lstnames)] 1]]] |
|---|
| 3057 | } |
|---|
| 3058 | |
|---|
| 3059 | |
|---|
| 3060 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3061 | proc ::bayesGraph::GrapOptApplyLineTypes {this var pre} { |
|---|
| 3062 | # |
|---|
| 3063 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3064 | upvar \#0 $var ary |
|---|
| 3065 | set g [getActiveGraph $this] |
|---|
| 3066 | |
|---|
| 3067 | set j 0 |
|---|
| 3068 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3069 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3070 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3071 | foreach e $it { |
|---|
| 3072 | if {![string equal [$g element type $e] [lindex $ary(${pre},linetypes) $i]]} { |
|---|
| 3073 | ::bayesGraph::GrapOptChangeType $this $e $e |
|---|
| 3074 | } |
|---|
| 3075 | } |
|---|
| 3076 | incr j |
|---|
| 3077 | } |
|---|
| 3078 | } |
|---|
| 3079 | |
|---|
| 3080 | |
|---|
| 3081 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3082 | proc ::bayesGraph::GrapOptApplyColors {this var pre} { |
|---|
| 3083 | # |
|---|
| 3084 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3085 | upvar \#0 $var ary |
|---|
| 3086 | set g [getActiveGraph $this] |
|---|
| 3087 | |
|---|
| 3088 | set j 0 |
|---|
| 3089 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3090 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3091 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3092 | foreach e $it { |
|---|
| 3093 | if {[string equal [$g element type $e] "LineElement"]} { |
|---|
| 3094 | $g element configure $e -color [lindex $ary($pre,colors) $i] |
|---|
| 3095 | } else { |
|---|
| 3096 | $g element configure $e -foreground [lindex $ary($pre,colors) $i] |
|---|
| 3097 | } |
|---|
| 3098 | } |
|---|
| 3099 | incr j |
|---|
| 3100 | } |
|---|
| 3101 | } |
|---|
| 3102 | |
|---|
| 3103 | |
|---|
| 3104 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3105 | proc ::bayesGraph::GrapOptApplyFill {this var pre} { |
|---|
| 3106 | # |
|---|
| 3107 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3108 | global toltk_images_path |
|---|
| 3109 | upvar \#0 $var ary |
|---|
| 3110 | set g [getActiveGraph $this] |
|---|
| 3111 | |
|---|
| 3112 | set j 0 |
|---|
| 3113 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3114 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3115 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3116 | foreach e $it { |
|---|
| 3117 | set areatile "" |
|---|
| 3118 | set areapattern "" |
|---|
| 3119 | # Foreground |
|---|
| 3120 | if {[string equal [lindex $ary($pre,areaForegrounds) $i] defcolor]} { |
|---|
| 3121 | if {[string equal [$g element type $e] LineElement]} { |
|---|
| 3122 | set color [$g line cget $e -color] |
|---|
| 3123 | } else { |
|---|
| 3124 | set color [$g line cget $e -foreground] |
|---|
| 3125 | } |
|---|
| 3126 | } else { |
|---|
| 3127 | set color [lindex $ary($pre,areaForegrounds) $i] |
|---|
| 3128 | } |
|---|
| 3129 | # Background |
|---|
| 3130 | if {[string equal [lindex $ary($pre,areaBackgrounds) $i] defcolor]} { |
|---|
| 3131 | if [string equal [$g element type $e] LineElement] { |
|---|
| 3132 | set backcolor [$g line cget $e -color] |
|---|
| 3133 | } else { |
|---|
| 3134 | set backcolor [$g line cget $e -foreground] |
|---|
| 3135 | } |
|---|
| 3136 | } else { |
|---|
| 3137 | set backcolor [lindex $ary($pre,areaBackgrounds) $i] |
|---|
| 3138 | } |
|---|
| 3139 | # Area Type |
|---|
| 3140 | if [string equal [$g element type $e] LineElement] { |
|---|
| 3141 | set areaTypeAux [lindex $ary($pre,areaTypes) $i] |
|---|
| 3142 | } else { |
|---|
| 3143 | set areaTypeAux [lindex $ary($pre,areaTypesBar) $i] |
|---|
| 3144 | } |
|---|
| 3145 | switch $areaTypeAux { |
|---|
| 3146 | image { |
|---|
| 3147 | if ![string equal [lindex $ary($pre,areaTiles) $i] ""] { |
|---|
| 3148 | set areatile [::Bitmap::get [lindex $ary($pre,areaTiles) $i]] |
|---|
| 3149 | } |
|---|
| 3150 | } |
|---|
| 3151 | solid { set areapattern solid } |
|---|
| 3152 | striped { set areapattern @[file join $toltk_images_path fill.xbm] } |
|---|
| 3153 | "stipple image" { set areapattern @[lindex $ary($pre,stippleimages) $i] } |
|---|
| 3154 | "stipple degraded" { |
|---|
| 3155 | set areapattern "gray[lindex $ary($pre,stippledegradeds) $i]" |
|---|
| 3156 | } |
|---|
| 3157 | } |
|---|
| 3158 | # Apply |
|---|
| 3159 | if [string equal [$g element type $e] LineElement] { |
|---|
| 3160 | $g element configure $e -areatile $areatile -areapattern $areapattern \ |
|---|
| 3161 | -areaforeground $color -areabackground $backcolor |
|---|
| 3162 | } else { |
|---|
| 3163 | if [string equal $areapattern solid] { set areapattern "" } |
|---|
| 3164 | $g element configure $e \ |
|---|
| 3165 | -stipple $areapattern -foreground $color -background $backcolor |
|---|
| 3166 | } |
|---|
| 3167 | } |
|---|
| 3168 | incr j |
|---|
| 3169 | } |
|---|
| 3170 | } |
|---|
| 3171 | |
|---|
| 3172 | |
|---|
| 3173 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3174 | proc ::bayesGraph::GrapOptApplyShowValues {this var pre} { |
|---|
| 3175 | # |
|---|
| 3176 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3177 | upvar \#0 $var ary |
|---|
| 3178 | set g [getActiveGraph $this] |
|---|
| 3179 | |
|---|
| 3180 | set j 0 |
|---|
| 3181 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3182 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3183 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3184 | foreach e $it { |
|---|
| 3185 | $g element configure $e \ |
|---|
| 3186 | -showvalues [lindex $ary(${pre},showvalues) $i] \ |
|---|
| 3187 | -valuefont [lindex $ary(${pre},valuefont) $i] \ |
|---|
| 3188 | -valuecolor [lindex $ary(${pre},valuecolor) $i] \ |
|---|
| 3189 | -valueformat %0.[lindex $ary(${pre},valueformatdec) $i]f \ |
|---|
| 3190 | -valueshadow [lindex $ary(${pre},valueshadow) $i] \ |
|---|
| 3191 | -valuerotate [lindex $ary(${pre},valuerotate) $i] \ |
|---|
| 3192 | -valueanchor [lindex $ary(${pre},valueanchor) $i] |
|---|
| 3193 | } |
|---|
| 3194 | incr j |
|---|
| 3195 | } |
|---|
| 3196 | } |
|---|
| 3197 | |
|---|
| 3198 | |
|---|
| 3199 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3200 | proc ::bayesGraph::GrapOptApplyShowSymbols {this var pre} { |
|---|
| 3201 | # |
|---|
| 3202 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3203 | upvar \#0 $var ary |
|---|
| 3204 | set g [getActiveGraph $this] |
|---|
| 3205 | |
|---|
| 3206 | set j 0 |
|---|
| 3207 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3208 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3209 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3210 | foreach e $it { |
|---|
| 3211 | if {[lindex $ary(${pre},showsymbols) $i]} { |
|---|
| 3212 | if [string equal [$g element type $e] "LineElement"] { |
|---|
| 3213 | $g element configure $e \ |
|---|
| 3214 | -symbol [lindex $ary(${pre},symbol) $i] \ |
|---|
| 3215 | -pixels [lindex $ary(${pre},pixels) $i] \ |
|---|
| 3216 | -scalesymbols [lindex $ary(${pre},scalesymbols) $i] \ |
|---|
| 3217 | -fill [lindex $ary(${pre},fill) $i] \ |
|---|
| 3218 | -outline [lindex $ary(${pre},outline) $i] \ |
|---|
| 3219 | -outlinewidth [lindex $ary(${pre},outlinewidth) $i] |
|---|
| 3220 | } |
|---|
| 3221 | } else { |
|---|
| 3222 | if [string equal [$g element type $e] "LineElement"] { |
|---|
| 3223 | $g element configure $e -symbol none |
|---|
| 3224 | } |
|---|
| 3225 | } |
|---|
| 3226 | } |
|---|
| 3227 | incr j |
|---|
| 3228 | } |
|---|
| 3229 | } |
|---|
| 3230 | |
|---|
| 3231 | |
|---|
| 3232 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3233 | proc ::bayesGraph::GrapOptApplyMarkers {this var pre} { |
|---|
| 3234 | # |
|---|
| 3235 | # PURPOSE: |
|---|
| 3236 | # |
|---|
| 3237 | # PARAMETERS: |
|---|
| 3238 | # this: |
|---|
| 3239 | # var: |
|---|
| 3240 | # pre: |
|---|
| 3241 | # |
|---|
| 3242 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3243 | upvar \#0 ${this}::data data |
|---|
| 3244 | upvar \#0 $var ary |
|---|
| 3245 | variable tmpOpt |
|---|
| 3246 | |
|---|
| 3247 | set gr $data(gr,active) |
|---|
| 3248 | set g [getActiveGraph $this] |
|---|
| 3249 | |
|---|
| 3250 | # delete marker |
|---|
| 3251 | foreach marker [$g marker names] { |
|---|
| 3252 | $g marker delete $marker |
|---|
| 3253 | } |
|---|
| 3254 | # marker each |
|---|
| 3255 | puts "::bayesGraph::GrapOptApplyMarkers: $g, var=$var, pre=$pre" |
|---|
| 3256 | puts "[ $g axis cget x -majorticks ]" |
|---|
| 3257 | foreach {axis map} {x mapx y mapy x2 mapx y2 mapy} { |
|---|
| 3258 | # comprobamos si esta visible el eje |
|---|
| 3259 | if {![$g axis cget $axis -hide]} { |
|---|
| 3260 | # se puede preguntar por la variable |
|---|
| 3261 | # if $tmpOpt(var,${axis}AxisShow) |
|---|
| 3262 | set AXI [string toupper [string index $axis 0]] |
|---|
| 3263 | if {[info exists ary(${pre},${axis}Markers)]} { |
|---|
| 3264 | set lstMarkers $ary(${pre},${axis}Markers) |
|---|
| 3265 | if [llength $lstMarkers] { |
|---|
| 3266 | if {[info exists data(gr,$gr,OnGet${AXI}Ticks)]} { |
|---|
| 3267 | set numTicks [llength [$data(gr,$gr,OnGet${AXI}Ticks) $this]] |
|---|
| 3268 | set iniMarker -1 |
|---|
| 3269 | } else { |
|---|
| 3270 | # nos quedamos con el valor minimo y maximo del eje |
|---|
| 3271 | #TODO: igual es interesante quedarnos con el max y min de las lineas |
|---|
| 3272 | # asociadas al eje |
|---|
| 3273 | $g axis configure x -majorticks [ $g axis cger x -majorticks ] |
|---|
| 3274 | if { 0 } { |
|---|
| 3275 | set max [$g axis cget $axis -max] |
|---|
| 3276 | set min [$g axis cget $axis -min] |
|---|
| 3277 | if {[string length $max] && [string length $min]} { |
|---|
| 3278 | set numTicks $max |
|---|
| 3279 | set iniMarker $min |
|---|
| 3280 | } else { |
|---|
| 3281 | set iniMarker -1 |
|---|
| 3282 | set numTicks 0 |
|---|
| 3283 | } |
|---|
| 3284 | } |
|---|
| 3285 | set i 0 |
|---|
| 3286 | } |
|---|
| 3287 | set j 0 |
|---|
| 3288 | puts "lstMarkers = $lstMarkers" |
|---|
| 3289 | foreach it $lstMarkers { |
|---|
| 3290 | if {$j==5} { set j 0 } |
|---|
| 3291 | set color $tmpOpt(var,${axis}MarkerColorInEach$j) |
|---|
| 3292 | set width $tmpOpt(var,${axis}MarkerWidthInEach$j) |
|---|
| 3293 | set dashe $tmpOpt(var,${axis}MarkerDasheInEach$j) |
|---|
| 3294 | set under $tmpOpt(var,${axis}MarkerUnderInEach$j) |
|---|
| 3295 | incr j |
|---|
| 3296 | #set pos -1 |
|---|
| 3297 | set pos $iniMarker |
|---|
| 3298 | $g marker bind $it <Enter> \ |
|---|
| 3299 | [list ::bayesGraph::WriteInfo $this "[mc Marker]${axis}: each $it"] |
|---|
| 3300 | set majorTicks [ $g axis cget $axis -majorticks ] |
|---|
| 3301 | $g marker bind $it <Leave> \ |
|---|
| 3302 | [list ::bayesGraph::WriteInfo $this ""] |
|---|
| 3303 | puts "voy con it = $it" |
|---|
| 3304 | for { set mt 0 } { $mt < [ llength $majorTicks ] } { incr mt } { |
|---|
| 3305 | if { [ expr { ( $mt + 1 ) % int( $it ) } ] } continue |
|---|
| 3306 | set pos [ lindex $majorTicks $mt ] |
|---|
| 3307 | if { "x" eq [string index $axis 0] } { |
|---|
| 3308 | set coord [list $pos -Inf $pos Inf] |
|---|
| 3309 | } else { |
|---|
| 3310 | set coord [list -Inf $pos Inf $pos] |
|---|
| 3311 | } |
|---|
| 3312 | puts "añadiendo marcador $mt en posicion $pos" |
|---|
| 3313 | catch { |
|---|
| 3314 | $g marker create line -name ${it}_$pos -coords $coord \ |
|---|
| 3315 | -outline $color -dashes $dashe -$map $axis \ |
|---|
| 3316 | -bindtags $it -linewidth $width -under $under |
|---|
| 3317 | } |
|---|
| 3318 | } |
|---|
| 3319 | if { 0 } { |
|---|
| 3320 | while {$pos < $numTicks} { |
|---|
| 3321 | set pos [expr $pos + $it] |
|---|
| 3322 | # limites |
|---|
| 3323 | if {[string equal x [string index $axis 0]]} { |
|---|
| 3324 | set coord [list $pos -Inf $pos Inf] |
|---|
| 3325 | } else { |
|---|
| 3326 | set coord [list -Inf $pos Inf $pos] |
|---|
| 3327 | } |
|---|
| 3328 | catch { $g marker create line -name ${it}_$pos -coords $coord \ |
|---|
| 3329 | -outline $color -dashes $dashe -$map $axis \ |
|---|
| 3330 | -bindtags $it -linewidth $width -under $under } |
|---|
| 3331 | } |
|---|
| 3332 | incr i |
|---|
| 3333 | } |
|---|
| 3334 | } |
|---|
| 3335 | } |
|---|
| 3336 | } |
|---|
| 3337 | } |
|---|
| 3338 | } |
|---|
| 3339 | puts "[ $g axis cget x -majorticks ]" |
|---|
| 3340 | } |
|---|
| 3341 | |
|---|
| 3342 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3343 | proc ::bayesGraph::GrapOptApplyMarkersIn {this var pre} { |
|---|
| 3344 | # |
|---|
| 3345 | # PURPOSE: |
|---|
| 3346 | # |
|---|
| 3347 | # PARAMETERS: |
|---|
| 3348 | # |
|---|
| 3349 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3350 | upvar \#0 ${this}::data data |
|---|
| 3351 | upvar \#0 $var ary |
|---|
| 3352 | variable tmpOpt |
|---|
| 3353 | |
|---|
| 3354 | set gr $data(gr,active) |
|---|
| 3355 | set g [getActiveGraph $this] |
|---|
| 3356 | |
|---|
| 3357 | # marker in |
|---|
| 3358 | foreach {axis map} {x mapx y mapy x2 mapx y2 mapy} { |
|---|
| 3359 | # se puede preguntar tambien por -hide del axis |
|---|
| 3360 | if {![$g axis cget $axis -hide]} { |
|---|
| 3361 | # if $tmpOpt(var,${axis}AxisSelect) |
|---|
| 3362 | if {[info exists ary(${pre},${axis}MarkersIn)]} { |
|---|
| 3363 | set lstMarkersIn $ary(${pre},${axis}MarkersIn) |
|---|
| 3364 | if [llength $lstMarkersIn] { |
|---|
| 3365 | set i 0 |
|---|
| 3366 | set lon [llength [$g marker names]] |
|---|
| 3367 | set j [expr $lon<5 ? $lon : $lon % 5] |
|---|
| 3368 | foreach it $lstMarkersIn { |
|---|
| 3369 | if {$j==5} { set j 0 } |
|---|
| 3370 | set color $tmpOpt(var,${axis}MarkerColorInEach$j) |
|---|
| 3371 | set width $tmpOpt(var,${axis}MarkerWidthInEach$j) |
|---|
| 3372 | set dashe $tmpOpt(var,${axis}MarkerDasheInEach$j) |
|---|
| 3373 | set under $tmpOpt(var,${axis}MarkerUnderInEach$j) |
|---|
| 3374 | incr j |
|---|
| 3375 | # limites |
|---|
| 3376 | if {[string equal x [string index $axis 0]]} { |
|---|
| 3377 | set coord [list $it -Inf $it Inf] |
|---|
| 3378 | } else { |
|---|
| 3379 | set coord [list -Inf $it Inf $it] |
|---|
| 3380 | } |
|---|
| 3381 | # axis |
|---|
| 3382 | if {[string length $it]==2} { |
|---|
| 3383 | set inx 2 |
|---|
| 3384 | } else { |
|---|
| 3385 | set inx {} |
|---|
| 3386 | } |
|---|
| 3387 | # marker |
|---|
| 3388 | $g marker bind $it <Enter> \ |
|---|
| 3389 | [list ::bayesGraph::WriteInfo $this "[mc Marker]$axis: in $it"] |
|---|
| 3390 | $g marker bind $it <Leave> \ |
|---|
| 3391 | [list ::bayesGraph::WriteInfo $this ""] |
|---|
| 3392 | catch { $g marker create line -name $it -coords $coord \ |
|---|
| 3393 | -outline $color -dashes $dashe -$map $axis \ |
|---|
| 3394 | -bindtags $it -linewidth $width -under $under} |
|---|
| 3395 | incr i |
|---|
| 3396 | } |
|---|
| 3397 | } |
|---|
| 3398 | } |
|---|
| 3399 | } |
|---|
| 3400 | } |
|---|
| 3401 | } |
|---|
| 3402 | |
|---|
| 3403 | |
|---|
| 3404 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3405 | proc ::bayesGraph::GrapOptApplyGrid {this var pre} { |
|---|
| 3406 | # |
|---|
| 3407 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3408 | upvar \#0 $var ary |
|---|
| 3409 | |
|---|
| 3410 | set g [getActiveGraph $this] |
|---|
| 3411 | $g grid configure -color $ary(${pre},Color)\ |
|---|
| 3412 | -dashes $ary(${pre},Dashes)\ |
|---|
| 3413 | -linewidth $ary(${pre},LineWidth)\ |
|---|
| 3414 | -minor $ary(${pre},Minor) |
|---|
| 3415 | if [string equal $ary(${pre},MapX) "none"] { |
|---|
| 3416 | $g grid configure -mapx {} |
|---|
| 3417 | } else { |
|---|
| 3418 | $g grid configure -mapx $ary(${pre},MapX) |
|---|
| 3419 | } |
|---|
| 3420 | if [string equal $ary(${pre},MapY) "none"] { |
|---|
| 3421 | $g grid configure -mapy {} |
|---|
| 3422 | } else { |
|---|
| 3423 | $g grid configure -mapy $ary(${pre},MapY) |
|---|
| 3424 | } |
|---|
| 3425 | } |
|---|
| 3426 | |
|---|
| 3427 | |
|---|
| 3428 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3429 | proc ::bayesGraph::GrapOptApplyLegend {this var pre} { |
|---|
| 3430 | # |
|---|
| 3431 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3432 | upvar \#0 $var ary |
|---|
| 3433 | |
|---|
| 3434 | set g [getActiveGraph $this] |
|---|
| 3435 | |
|---|
| 3436 | $g legend configure -hide $ary(${pre},Hide)\ |
|---|
| 3437 | -bg $ary(${pre},Bg)\ |
|---|
| 3438 | -bd $ary(${pre},Bd)\ |
|---|
| 3439 | -fg $ary(${pre},Fg)\ |
|---|
| 3440 | -font $ary(${pre},Font)\ |
|---|
| 3441 | -shadow $ary(${pre},Shadow)\ |
|---|
| 3442 | -position $ary(${pre},Position)\ |
|---|
| 3443 | -anchor $ary(${pre},Anchor)\ |
|---|
| 3444 | -relief $ary(${pre},Relief)\ |
|---|
| 3445 | -raised $ary(${pre},Raised)\ |
|---|
| 3446 | -ipadx [list $ary(${pre},IPadXl) $ary(${pre},IPadXr)]\ |
|---|
| 3447 | -ipady [list $ary(${pre},IPadYt) $ary(${pre},IPadYb)]\ |
|---|
| 3448 | -padx [list $ary(${pre},PadXl) $ary(${pre},PadXr)]\ |
|---|
| 3449 | -pady [list $ary(${pre},PadYt) $ary(${pre},PadYb)]\ |
|---|
| 3450 | -rows $ary(${pre},Rows)\ |
|---|
| 3451 | -columns $ary(${pre},Columns) |
|---|
| 3452 | } |
|---|
| 3453 | |
|---|
| 3454 | |
|---|
| 3455 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3456 | proc ::bayesGraph::GrapOptApplyStyle {this var pre} { |
|---|
| 3457 | # |
|---|
| 3458 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3459 | upvar \#0 $var ary |
|---|
| 3460 | |
|---|
| 3461 | set g [getActiveGraph $this] |
|---|
| 3462 | $g configure -plotbackground $ary(${pre},plotbackground)\ |
|---|
| 3463 | -plotrelief $ary(${pre},plotrelief)\ |
|---|
| 3464 | -plotborderwidth $ary(${pre},plotborderwidth)\ |
|---|
| 3465 | -plotpadx [list $ary(${pre},plotpadxl) $ary(${pre},plotpadxr)]\ |
|---|
| 3466 | -plotpady [list $ary(${pre},plotpadyt) $ary(${pre},plotpadyb)]\ |
|---|
| 3467 | -invertxy $ary(${pre},invertxy)\ |
|---|
| 3468 | -background $ary(${pre},background)\ |
|---|
| 3469 | -relief $ary(${pre},relief)\ |
|---|
| 3470 | -borderwidth $ary(${pre},areaborderwidth)\ |
|---|
| 3471 | -lm $ary(${pre},lm)\ |
|---|
| 3472 | -rm $ary(${pre},rm)\ |
|---|
| 3473 | -tm $ary(${pre},tm)\ |
|---|
| 3474 | -bm $ary(${pre},bm) |
|---|
| 3475 | #El color de los ejes lo vamos a cambiar segun el color de fondo exterior |
|---|
| 3476 | $g axis configure x -background $ary(${pre},background) |
|---|
| 3477 | $g axis configure x2 -background $ary(${pre},background) |
|---|
| 3478 | $g axis configure y -background $ary(${pre},background) |
|---|
| 3479 | $g axis configure y2 -background $ary(${pre},background) |
|---|
| 3480 | } |
|---|
| 3481 | |
|---|
| 3482 | |
|---|
| 3483 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3484 | proc ::bayesGraph::GrapOptOK {this dialog} { |
|---|
| 3485 | # |
|---|
| 3486 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3487 | GrapOptApply $this |
|---|
| 3488 | GrapOptDestroy $this $dialog |
|---|
| 3489 | } |
|---|
| 3490 | |
|---|
| 3491 | |
|---|
| 3492 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3493 | proc ::bayesGraph::GrapOptCheck {this} { |
|---|
| 3494 | # |
|---|
| 3495 | # PURPOSE: Checks for all widgets from graph dialog options that need to be |
|---|
| 3496 | # checked for enabling/disabling other associated controls. |
|---|
| 3497 | # |
|---|
| 3498 | # PARAMETERS: |
|---|
| 3499 | # this -> Instance of bayesGraph |
|---|
| 3500 | # |
|---|
| 3501 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3502 | GrapOptCheckXYAxisAll $this |
|---|
| 3503 | GrapOptCheckXYTicksType $this |
|---|
| 3504 | # GrapOptCheckShowSymbols $this |
|---|
| 3505 | } |
|---|
| 3506 | |
|---|
| 3507 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3508 | proc ::bayesGraph::GrapOptCheckXYAxisAll {this} { |
|---|
| 3509 | # |
|---|
| 3510 | # PURPOSE: |
|---|
| 3511 | # |
|---|
| 3512 | # PARAMETERS: |
|---|
| 3513 | # this -> Instance of bayesGraph |
|---|
| 3514 | # |
|---|
| 3515 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3516 | upvar \#0 ${this}::data data |
|---|
| 3517 | variable tmpOpt |
|---|
| 3518 | set gr $data(gr,active) |
|---|
| 3519 | if {[info exists tmpOpt(widget,xyAxisMin)] && \ |
|---|
| 3520 | [info exists tmpOpt(widget,xyAxisMax)] && \ |
|---|
| 3521 | [info exists tmpOpt(var,xyAxisAll)]} { |
|---|
| 3522 | # eje acutal |
|---|
| 3523 | set axis $tmpOpt(var,xyAxisSelect) |
|---|
| 3524 | set AXI [string toupper [string index $axis 0]] |
|---|
| 3525 | if {[info exists tmpOpt(var,xyAxisSelect)] && |
|---|
| 3526 | [info exists data(gr,$gr,OnGet${AXI}Ticks)]} { |
|---|
| 3527 | $tmpOpt(widget,xyAxisMin) configure \ |
|---|
| 3528 | -values [$data(gr,$gr,OnGet${AXI}Ticks) $this] -range {} |
|---|
| 3529 | $tmpOpt(widget,xyAxisMax) configure \ |
|---|
| 3530 | -values [$data(gr,$gr,OnGet${AXI}Ticks) $this] -range {} |
|---|
| 3531 | } else { |
|---|
| 3532 | $tmpOpt(widget,xyAxisMin) configure -values {} -range {-INF INF 1} |
|---|
| 3533 | $tmpOpt(widget,xyAxisMax) configure -values {} -range {-INF INF 1} |
|---|
| 3534 | } |
|---|
| 3535 | if $tmpOpt(var,xyAxisAll) { |
|---|
| 3536 | focus $tmpOpt(widget,chXYAll) |
|---|
| 3537 | $tmpOpt(widget,xyAxisMin) configure -state disabled |
|---|
| 3538 | $tmpOpt(widget,xyAxisMax) configure -state disabled |
|---|
| 3539 | if {[llength [$tmpOpt(widget,xyAxisMin) cget -values]]} { |
|---|
| 3540 | $tmpOpt(widget,xyAxisMin) setvalue first |
|---|
| 3541 | } |
|---|
| 3542 | if {[llength [$tmpOpt(widget,xyAxisMax) cget -values]]} { |
|---|
| 3543 | $tmpOpt(widget,xyAxisMax) setvalue last |
|---|
| 3544 | } |
|---|
| 3545 | } else { |
|---|
| 3546 | $tmpOpt(widget,xyAxisMin) configure -state normal |
|---|
| 3547 | $tmpOpt(widget,xyAxisMax) configure -state normal |
|---|
| 3548 | } |
|---|
| 3549 | } |
|---|
| 3550 | } |
|---|
| 3551 | |
|---|
| 3552 | |
|---|
| 3553 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3554 | proc ::bayesGraph::GrapOptCheckXYTicksType {this} { |
|---|
| 3555 | # |
|---|
| 3556 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3557 | variable tmpOpt |
|---|
| 3558 | if {[info exists tmpOpt(widget,rbXYTotal)] && \ |
|---|
| 3559 | [info exists tmpOpt(widget,xyTicksStep)] && \ |
|---|
| 3560 | [info exists tmpOpt(widget,xyTicksTotal)]} { |
|---|
| 3561 | switch $tmpOpt(var,xyTicksType) { |
|---|
| 3562 | total { |
|---|
| 3563 | if {[info exists tmpOpt(widget,rbXYTotal)]} { |
|---|
| 3564 | focus $tmpOpt(widget,rbXYTotal) |
|---|
| 3565 | } |
|---|
| 3566 | $tmpOpt(widget,xyTicksStep) configure -state disabled |
|---|
| 3567 | $tmpOpt(widget,xyTicksTotal) configure -state normal |
|---|
| 3568 | } |
|---|
| 3569 | each { |
|---|
| 3570 | if {[info exists tmpOpt(widget,rbXYEach)]} { |
|---|
| 3571 | focus $tmpOpt(widget,rbXYEach) |
|---|
| 3572 | } |
|---|
| 3573 | $tmpOpt(widget,xyTicksTotal) configure -state disabled |
|---|
| 3574 | $tmpOpt(widget,xyTicksStep) configure -state normal |
|---|
| 3575 | } |
|---|
| 3576 | auto { |
|---|
| 3577 | set tmpOpt(var,xyTicksTotal) \ |
|---|
| 3578 | [CalculateXAxisNumTicks $this $tmpOpt(var,xyAxisSelect)] |
|---|
| 3579 | set tmpOpt(var,xyTicksStep) \ |
|---|
| 3580 | [ComputeXAxisStep $this $tmpOpt(var,xyTicksTotal) \ |
|---|
| 3581 | $tmpOpt(var,xyAxisSelect)] |
|---|
| 3582 | if {[info exists tmpOpt(widget,rbXYAuto)]} { |
|---|
| 3583 | focus $tmpOpt(widget,rbXYAuto) |
|---|
| 3584 | } |
|---|
| 3585 | $tmpOpt(widget,xyTicksTotal) configure -state disabled |
|---|
| 3586 | $tmpOpt(widget,xyTicksStep) configure -state disabled |
|---|
| 3587 | } |
|---|
| 3588 | } |
|---|
| 3589 | } |
|---|
| 3590 | } |
|---|
| 3591 | |
|---|
| 3592 | |
|---|
| 3593 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3594 | proc ::bayesGraph::ChangeFormat { var name1 name2 op} { |
|---|
| 3595 | # |
|---|
| 3596 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3597 | upvar \#0 ${name1}($name2) varsource |
|---|
| 3598 | upvar \#0 $var vardestine |
|---|
| 3599 | set vardestine %0.${varsource}f |
|---|
| 3600 | } |
|---|
| 3601 | |
|---|
| 3602 | |
|---|
| 3603 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3604 | proc ::bayesGraph::WriteInfo {this text} { |
|---|
| 3605 | # |
|---|
| 3606 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3607 | upvar \#0 ${this}::widgets widgets |
|---|
| 3608 | $widgets(sb,lInfo) configure -text $text |
|---|
| 3609 | } |
|---|
| 3610 | |
|---|
| 3611 | |
|---|
| 3612 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3613 | proc ::bayesGraph::GrapOptApplyMappedLines {this var pre} { |
|---|
| 3614 | # |
|---|
| 3615 | # PURPOSE: Asigna las lineas a los ejes especificados en opciones |
|---|
| 3616 | # |
|---|
| 3617 | # PARAMETERS: |
|---|
| 3618 | # this -> Instance of bayesGraph |
|---|
| 3619 | # var -> nombre de la variable |
|---|
| 3620 | # pre -> prefijo de array |
|---|
| 3621 | # |
|---|
| 3622 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3623 | upvar \#0 $var ary |
|---|
| 3624 | set g [getActiveGraph $this] |
|---|
| 3625 | |
|---|
| 3626 | # all lines |
|---|
| 3627 | set j 0 |
|---|
| 3628 | set lstId [GrapOptGetIdLines $this $var $pre] |
|---|
| 3629 | foreach it [GrapOptGetNamesLines $this $var $pre] { |
|---|
| 3630 | set i [expr [lindex $lstId $j] - 1] |
|---|
| 3631 | foreach e $it { |
|---|
| 3632 | set xy [lindex $ary($pre,xyMappedAxis) $i] |
|---|
| 3633 | if {!([string equal [$g element cget $e -mapx] [lindex $xy 0]] && \ |
|---|
| 3634 | [string equal [$g element cget $e -mapy] [lindex $xy 1]])} { |
|---|
| 3635 | ::bayesGraph::GrapOptApplyMappedLinesChange \ |
|---|
| 3636 | $this $var $e [lindex $xy 0] [lindex $xy 1] |
|---|
| 3637 | } |
|---|
| 3638 | } |
|---|
| 3639 | incr j |
|---|
| 3640 | } |
|---|
| 3641 | } |
|---|
| 3642 | |
|---|
| 3643 | |
|---|
| 3644 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3645 | proc ::bayesGraph::GrapOptApplyMappedLinesChange {this var le X Y} { |
|---|
| 3646 | # |
|---|
| 3647 | # PURPOSE: Cambiamos de eje/s un linea. Si el eje no esta visible, lo |
|---|
| 3648 | # mostramos y configuramos maximo y minimo. |
|---|
| 3649 | # |
|---|
| 3650 | # PARAMETERS: |
|---|
| 3651 | # this -> Instance of bayesGraph |
|---|
| 3652 | # var -> nombre de la variable |
|---|
| 3653 | # le -> Lista de elementos |
|---|
| 3654 | # X -> Axis X destiny |
|---|
| 3655 | # Y -> Axis Y destiny |
|---|
| 3656 | # |
|---|
| 3657 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3658 | upvar \#0 $var ary |
|---|
| 3659 | set g [getActiveGraph $this] |
|---|
| 3660 | variable tmpOpt |
|---|
| 3661 | # comrpbamos que no este en el mismo eje |
|---|
| 3662 | foreach e $le { |
|---|
| 3663 | set xOld [$g element cget $e -mapx] |
|---|
| 3664 | set yOld [$g element cget $e -mapy] |
|---|
| 3665 | if {($X!=$xOld) || ($Y!=$yOld)} { |
|---|
| 3666 | foreach axis "$X $Y" { |
|---|
| 3667 | set axi [string index $axis 0] |
|---|
| 3668 | # comprobamos si eje X visible |
|---|
| 3669 | if {[$g axis cget $axis -hide]} { |
|---|
| 3670 | $g axis configure $axis -hide 0 |
|---|
| 3671 | if {[info exists tmpOpt(var,${axis}AxisShow)]} { |
|---|
| 3672 | set tmpOpt(var,${axis}AxisShow) 1 |
|---|
| 3673 | } |
|---|
| 3674 | # valores |
|---|
| 3675 | set val [$g line cget $e -${axi}data] |
|---|
| 3676 | set lmax [lmaximo $val] |
|---|
| 3677 | set lmin [lminimo $val] |
|---|
| 3678 | set tmpOpt(var,${axis}AxisMin) $lmin |
|---|
| 3679 | set tmpOpt(var,${axis}AxisMax) $lmax |
|---|
| 3680 | ::bayesGraph::GrapOptApplyAxisLimits $this $axis $lmin $lmax |
|---|
| 3681 | } |
|---|
| 3682 | } |
|---|
| 3683 | } |
|---|
| 3684 | $g element configure $e -mapx $X -mapy $Y |
|---|
| 3685 | } |
|---|
| 3686 | } |
|---|
| 3687 | |
|---|
| 3688 | |
|---|
| 3689 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3690 | proc ::bayesGraph::GetLimitsValueAxis {this axis} { |
|---|
| 3691 | # |
|---|
| 3692 | # PURPOSE: Obtenemos el valor maximo y minimo de todas las lineas ascoicadas a |
|---|
| 3693 | # un eje |
|---|
| 3694 | # this -> Instance of bayesGraph |
|---|
| 3695 | # axis -> Eje actual |
|---|
| 3696 | # |
|---|
| 3697 | # PARAMETERS: el valor minimo y maximo asociado a un eje |
|---|
| 3698 | # |
|---|
| 3699 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3700 | # inicializamos variables |
|---|
| 3701 | set g [getActiveGraph $this] |
|---|
| 3702 | set axi [string index $axis 0] |
|---|
| 3703 | set lst [$g element show] |
|---|
| 3704 | set lmax {} |
|---|
| 3705 | set lmin {} |
|---|
| 3706 | # buscamos valor maximo y minimo de todas las lineas |
|---|
| 3707 | foreach e $lst { |
|---|
| 3708 | if {( [$g element cget $e -map${axi}]==$axis) && \ |
|---|
| 3709 | (![$g element cget $e -hide])} { |
|---|
| 3710 | # valores |
|---|
| 3711 | set val [$g line cget $e -${axi}data] |
|---|
| 3712 | # buscamos valorores maximos y minimos Y |
|---|
| 3713 | if {[set vmax [lmaximo $val]] ne ""} { |
|---|
| 3714 | lappend lmax $vmax |
|---|
| 3715 | } |
|---|
| 3716 | if {[set vmin [lminimo $val]] ne ""} { |
|---|
| 3717 | lappend lmin $vmin |
|---|
| 3718 | } |
|---|
| 3719 | } |
|---|
| 3720 | } |
|---|
| 3721 | # buscamos el maximo y minimo |
|---|
| 3722 | if {[llength $lmax] && [llength $lmin]} { |
|---|
| 3723 | set max [lmaximo $lmax] |
|---|
| 3724 | set min [lminimo $lmin] |
|---|
| 3725 | set lst [list $min $max] |
|---|
| 3726 | } else { |
|---|
| 3727 | set lst {} |
|---|
| 3728 | } |
|---|
| 3729 | return $lst |
|---|
| 3730 | } |
|---|
| 3731 | |
|---|
| 3732 | |
|---|
| 3733 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3734 | proc ::bayesGraph::GrapOptApplyAxisLimits {this axis min max} { |
|---|
| 3735 | # |
|---|
| 3736 | # PURPOSE: Aplicamos la configuracion de minimo y maximo de un eje. Para ello |
|---|
| 3737 | # comprobamos que el stepsize no quede muy pequeño |
|---|
| 3738 | # |
|---|
| 3739 | # this -> Instance of bayesGraph |
|---|
| 3740 | # axis -> Eje actual |
|---|
| 3741 | # min -> Min value |
|---|
| 3742 | # max -> Max value |
|---|
| 3743 | # |
|---|
| 3744 | # PARAMETERS: el valor minimo y maximo asociado a un eje |
|---|
| 3745 | # |
|---|
| 3746 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3747 | # inicializamos variables |
|---|
| 3748 | variable tmpOpt |
|---|
| 3749 | set g [getActiveGraph $this] |
|---|
| 3750 | set stepsize [$g axis cget $axis -stepsize] |
|---|
| 3751 | set maxTicks 200 |
|---|
| 3752 | # comprobamos el valor de stepsize, si es mayor que 1000, aplicamos 1000 |
|---|
| 3753 | # con esta comprobación evitamos que de error al cambiar el min y max |
|---|
| 3754 | if {[string length $max] && [string length $min]} { |
|---|
| 3755 | set n [expr $stepsize ? ($max - $min) / $stepsize : $stepsize] |
|---|
| 3756 | if {$n>$maxTicks} { |
|---|
| 3757 | set tmpOpt(var,${axis}TicksStep) [expr ($max - $min) / $maxTicks] |
|---|
| 3758 | $g axis configure $axis -stepsize $tmpOpt(var,${axis}TicksStep) |
|---|
| 3759 | } |
|---|
| 3760 | } |
|---|
| 3761 | # convertimos a double |
|---|
| 3762 | if {[string is int $min]} { set min "$min.0" } |
|---|
| 3763 | if {[string is int $max]} { set max "$max.0" } |
|---|
| 3764 | if {$min<$max} { |
|---|
| 3765 | if {0 && [string index $axis 0] eq "x"} { |
|---|
| 3766 | set min [expr $min - 0.5] |
|---|
| 3767 | set max [expr $max + 0.5] |
|---|
| 3768 | } |
|---|
| 3769 | $g axis configure $axis $axis -min $min -max $max |
|---|
| 3770 | } |
|---|
| 3771 | } |
|---|
| 3772 | |
|---|
| 3773 | |
|---|
| 3774 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3775 | proc ::bayesGraph::SetMainTitle {this title} { |
|---|
| 3776 | # |
|---|
| 3777 | # PURPOSE: Set main title o chart |
|---|
| 3778 | # |
|---|
| 3779 | # this -> Instance of bayesGraph |
|---|
| 3780 | # title -> list of title |
|---|
| 3781 | # |
|---|
| 3782 | # PARAMETERS: el valor minimo y maximo asociado a un eje |
|---|
| 3783 | # |
|---|
| 3784 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3785 | upvar \#0 ${this}::data data |
|---|
| 3786 | upvar \#0 ${this}::widgets widgets |
|---|
| 3787 | |
|---|
| 3788 | for {set gr 0} {$gr<$data(gr,numGraph)} {incr gr 1} { |
|---|
| 3789 | set inx [expr $gr>=[llength $title] ? [llength $title] - 1 : $gr] |
|---|
| 3790 | $widgets(gr,$gr) configure -title [lindex $title $inx] |
|---|
| 3791 | } |
|---|
| 3792 | } |
|---|
| 3793 | |
|---|
| 3794 | |
|---|
| 3795 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3796 | proc ::bayesGraph::GrapOptChangeType {this elem segs} { |
|---|
| 3797 | # |
|---|
| 3798 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3799 | set g [getActiveGraph $this] |
|---|
| 3800 | set typeElem [$g element type [lindex $segs 0]] |
|---|
| 3801 | |
|---|
| 3802 | foreach el $segs { |
|---|
| 3803 | set xdata [$g element cget $el -xdata] |
|---|
| 3804 | set ydata [$g element cget $el -ydata] |
|---|
| 3805 | set label [$g element cget $el -label] |
|---|
| 3806 | set mapx [$g element cget $el -mapx] |
|---|
| 3807 | set mapy [$g element cget $el -mapy] |
|---|
| 3808 | set label [$g element cget $el -label] |
|---|
| 3809 | set hide [$g element cget $el -hide] |
|---|
| 3810 | set showvalues [$g element cget $el -showvalues] |
|---|
| 3811 | set valueanchor [$g element cget $el -valueanchor] |
|---|
| 3812 | set valuecolor [$g element cget $el -valuecolor] |
|---|
| 3813 | set valuefont [$g element cget $el -valuefont] |
|---|
| 3814 | set valueformat [$g element cget $el -valueformat] |
|---|
| 3815 | set valuerotate [$g element cget $el -valuerotate] |
|---|
| 3816 | set valueshadow [$g element cget $el -valueshadow] |
|---|
| 3817 | if [string equal $typeElem "BarElement"] { |
|---|
| 3818 | set bgcolor [$g element cget $el -background] |
|---|
| 3819 | set color [$g element cget $el -foreground] |
|---|
| 3820 | set width [$g element cget $el -borderwidth] |
|---|
| 3821 | set xbm [$g element cget $el -stipple] |
|---|
| 3822 | |
|---|
| 3823 | $g bar delete $el |
|---|
| 3824 | $g element create $el -xdata $xdata -ydata $ydata\ |
|---|
| 3825 | -color $color -areabackground $bgcolor -areaforeground $color \ |
|---|
| 3826 | -linewidth $width -areapattern $xbm -symbol "none" |
|---|
| 3827 | } else { |
|---|
| 3828 | set color [$g element cget $el -color] |
|---|
| 3829 | set bgcolor [$g element cget $el -areabackground] |
|---|
| 3830 | if {$bgcolor eq "defcolor"} { |
|---|
| 3831 | set bgcolor $color |
|---|
| 3832 | } |
|---|
| 3833 | set width [$g element cget $el -linewidth] |
|---|
| 3834 | set xbm [$g element cget $el -areapattern] |
|---|
| 3835 | if {$xbm eq "solid"} { |
|---|
| 3836 | set xbm "" |
|---|
| 3837 | } |
|---|
| 3838 | $g element delete $el |
|---|
| 3839 | $g bar create $el -xdata $xdata -ydata $ydata\ |
|---|
| 3840 | -foreground $color -barwidth 0.5\ |
|---|
| 3841 | -background $bgcolor -borderwidth $width -stipple $xbm |
|---|
| 3842 | } |
|---|
| 3843 | $g element conf $el\ |
|---|
| 3844 | -valueanchor $valueanchor -valuecolor $valuecolor\ |
|---|
| 3845 | -valuefont $valuefont -valueformat $valueformat\ |
|---|
| 3846 | -valuerotate $valuerotate -valueshadow $valueshadow\ |
|---|
| 3847 | -showvalues $showvalues -hide $hide\ |
|---|
| 3848 | -mapx $mapx -mapy $mapy -label $label |
|---|
| 3849 | } |
|---|
| 3850 | } |
|---|
| 3851 | |
|---|
| 3852 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3853 | #NOTE. No esta en uso. Para usarla habría que modificar la función y guardar |
|---|
| 3854 | #los widget en variables |
|---|
| 3855 | proc ::bayesGraph::GrapOptCheckShowSymbols {this serie} { |
|---|
| 3856 | # |
|---|
| 3857 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3858 | variable tmpOptElem |
|---|
| 3859 | |
|---|
| 3860 | if {!$tmpOptElem(var,curve,$serie,showsymbols)} { |
|---|
| 3861 | SetAttribute $tmpOptElem(widget,fSymbol) state disabled |
|---|
| 3862 | $tmpOptElem(widget,chShow) configure -state normal |
|---|
| 3863 | } else { |
|---|
| 3864 | SetAttribute $tmpOptElem(widget,fSymbol) state normal |
|---|
| 3865 | } |
|---|
| 3866 | } |
|---|
| 3867 | |
|---|
| 3868 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3869 | proc ::bayesGraph::GrapOptGetNamesLines {this var pre} { |
|---|
| 3870 | # |
|---|
| 3871 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3872 | upvar \#0 $var ary |
|---|
| 3873 | return [lindex [ltraspose $ary(${pre},lstnames)] 1] |
|---|
| 3874 | } |
|---|
| 3875 | |
|---|
| 3876 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3877 | proc ::bayesGraph::GrapOptGetIdLines {this var pre} { |
|---|
| 3878 | # |
|---|
| 3879 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 3880 | upvar \#0 $var ary |
|---|
| 3881 | return [lindex [ltraspose $ary(${pre},lstnames)] 0] |
|---|
| 3882 | } |
|---|