| [6d7779d] | 1 | # FILE : newToolbarDiag.tcl |
|---|
| 2 | # PURPOSE : Formulario destinado a los parámetros necesarios para visualizar |
|---|
| 3 | # Anómalos en el proyecto ForNews. |
|---|
| 4 | # |
|---|
| 5 | # Data Variables para controles: |
|---|
| 6 | # |
|---|
| 7 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 8 | |
|---|
| 9 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 10 | namespace eval ::newToolbarDiag { |
|---|
| 11 | # |
|---|
| 12 | # PURPOSE: Namespace principal del visualizador |
|---|
| 13 | # |
|---|
| 14 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 15 | variable widget |
|---|
| 16 | variable data |
|---|
| 17 | |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 21 | proc ::newToolbarDiag::Show { args } { |
|---|
| 22 | # |
|---|
| 23 | # PURPOSE: Muestra el formulario, de no existir lo crea |
|---|
| 24 | # |
|---|
| 25 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 26 | variable widget |
|---|
| 27 | variable data |
|---|
| 28 | |
|---|
| 29 | if { [info exist widget(document)] && [winfo exists $widget(document)] } { |
|---|
| 30 | if { [$widget(document) cget -state] eq "minimized" } { |
|---|
| 31 | $widget(document) restore |
|---|
| 32 | } |
|---|
| 33 | $widget(document) raise |
|---|
| 34 | } else { |
|---|
| 35 | if [llength $args] { |
|---|
| 36 | eval Create $args |
|---|
| 37 | } else { |
|---|
| 38 | Create |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 45 | proc ::newToolbarDiag::Create { args } { |
|---|
| 46 | # |
|---|
| 47 | # PURPOSE: Crea un formulario destinado a la Tirada de ForNews |
|---|
| 48 | # |
|---|
| 49 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 50 | variable widget |
|---|
| 51 | variable data |
|---|
| 52 | |
|---|
| 53 | array set options { |
|---|
| 54 | -toolbartype "" |
|---|
| 55 | -toolbarparent "" |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | array set options $args |
|---|
| 59 | |
|---|
| 60 | if {[llength $args]} { |
|---|
| 61 | puts "TIENE ARGS" |
|---|
| 62 | #read ini |
|---|
| 63 | ::newToolbarDiag::ReadIni |
|---|
| 64 | |
|---|
| 65 | set data(tooldig,toolbartype) $options(-toolbartype) |
|---|
| 66 | set data(tooldig,toolbarparent) $options(-toolbarparent) |
|---|
| 67 | puts "data(tooldig,toolbartype) -> $data(tooldig,toolbartype)" |
|---|
| 68 | puts "data(tooldig,toolbarparent) -> $data(tooldig,toolbarparent)" |
|---|
| 69 | } else { |
|---|
| 70 | puts "no tiene parametros" |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | set widget(document) [::project::CreateForm \ |
|---|
| 74 | -type [mc {For News}] -iniconfig FORNEWSnewToolbarDiag \ |
|---|
| 75 | -modal 1 \ |
|---|
| 76 | -height 385 \ |
|---|
| 77 | -width 310 \ |
|---|
| 78 | -resizable 1 \ |
|---|
| 79 | -title [mc {New Toolbar Wizard}] \ |
|---|
| 80 | -closecmd [list ::newToolbarDiag::Destroy]] |
|---|
| 81 | |
|---|
| 82 | set tl $widget(document).work |
|---|
| 83 | |
|---|
| 84 | set widget(tfwizard) [CreateTFWizard $tl] |
|---|
| 85 | set widget(bbox) [CreateBBox $tl] |
|---|
| 86 | |
|---|
| 87 | grid $widget(tfwizard) -sticky news |
|---|
| 88 | grid $widget(bbox) -sticky nes |
|---|
| 89 | |
|---|
| 90 | grid rowconfigure $tl 0 -weight 1 |
|---|
| 91 | grid rowconfigure $tl 1 -weight 0 |
|---|
| 92 | |
|---|
| 93 | grid columnconfigure $tl 0 -weight 1 |
|---|
| 94 | |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 98 | proc ::newToolbarDiag::CreateTFWizard {tl} { |
|---|
| 99 | # |
|---|
| 100 | # PURPOSE: Creamos el frame con las opciones comunes de la ventana |
|---|
| 101 | # PARAMETERS: tl -> path donde creamos el componente |
|---|
| 102 | # RETURN: devolvemos el path del objeto creado |
|---|
| 103 | # |
|---|
| 104 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 105 | variable widget |
|---|
| 106 | variable data |
|---|
| 107 | |
|---|
| 108 | # titulo |
|---|
| 109 | set tf [TitleFrame $tl.params \ |
|---|
| 110 | -text [mc {Options}] -bd 1 -side left] |
|---|
| 111 | set f [$tf getframe] |
|---|
| 112 | |
|---|
| 113 | set f2 [frame $f.f2 -bd 0] |
|---|
| 114 | |
|---|
| 115 | Label $f2.leToolname -text [mc {ToolName}] \ |
|---|
| 116 | -justify left -anchor w |
|---|
| 117 | |
|---|
| 118 | set widget(tooldig,toolname) \ |
|---|
| 119 | [Entry $f2.etoolname -state normal -width 20 \ |
|---|
| 120 | -textvariable ::newToolbarDiag::data(tooldig,toolname)] |
|---|
| 121 | |
|---|
| 122 | grid $f2.leToolname $widget(tooldig,toolname) -sticky news |
|---|
| 123 | |
|---|
| 124 | grid columnconfigure $f2 0 -weight 0 |
|---|
| 125 | grid columnconfigure $f2 1 -weight 1 |
|---|
| 126 | grid rowconfigure $f2 0 -weight 0 |
|---|
| 127 | |
|---|
| 128 | grid $f2 -sticky news |
|---|
| 129 | |
|---|
| 130 | grid rowconfigure $f 0 -weight 0 |
|---|
| 131 | grid rowconfigure $f 10 -weight 1 |
|---|
| 132 | grid columnconfigure $f 0 -weight 1 |
|---|
| 133 | |
|---|
| 134 | return $tf |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 139 | proc ::newToolbarDiag::CreateBBox {tl} { |
|---|
| 140 | # |
|---|
| 141 | # PURPOSE: Creamos el frame con las opciones comunes de la ventana |
|---|
| 142 | # PARAMETERS: tl -> path donde creamos el componente |
|---|
| 143 | # RETURN: devolvemos el path del objeto creado |
|---|
| 144 | # |
|---|
| 145 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 146 | set bbox \ |
|---|
| 147 | [ButtonBox $tl.bb -orient horizontal -spacing 10 -padx 0 -pady 0 \ |
|---|
| 148 | -homogeneous false] |
|---|
| 149 | |
|---|
| 150 | $bbox add -text [mc "Create"] -relief link \ |
|---|
| 151 | -command [list ::newToolbarDiag::Create_command] \ |
|---|
| 152 | -helptext [mc "Create button"] -disabledforeground ""\ |
|---|
| 153 | -image [Bitmap::get bexec] -compound left -padx 3 -pady 1 |
|---|
| 154 | $bbox add -text [mc "Exit"] -relief link \ |
|---|
| 155 | -command [list ::newToolbarDiag::Destroy] \ |
|---|
| 156 | -helptext [mc "Close window"] -disabledforeground ""\ |
|---|
| 157 | -image [Bitmap::get exit] -compound left -padx 3 -pady 1 |
|---|
| 158 | |
|---|
| 159 | return $bbox |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 164 | proc ::newToolbarDiag::ReadIni { } { |
|---|
| 165 | # |
|---|
| 166 | # PURPOSE: Lee del ini |
|---|
| 167 | # |
|---|
| 168 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 169 | variable data |
|---|
| 170 | variable widget |
|---|
| 171 | |
|---|
| 172 | Tolcon_Trace "Leyendo ini" |
|---|
| 173 | set rini ::iniFile::Read |
|---|
| 174 | set key FORNEWSnewToolbarDiag |
|---|
| 175 | |
|---|
| 176 | } |
|---|
| 177 | |
|---|
| 178 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 179 | proc ::newToolbarDiag::WriteIni { } { |
|---|
| 180 | # |
|---|
| 181 | # PURPOSE: Escribe en el ini |
|---|
| 182 | # |
|---|
| 183 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 184 | variable data |
|---|
| 185 | variable widget |
|---|
| 186 | |
|---|
| 187 | set wini ::iniFile::Write |
|---|
| 188 | set key FORNEWSnewToolbarDiag |
|---|
| 189 | Tolcon_Trace "Guardando ini" |
|---|
| 190 | |
|---|
| 191 | return 1 |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 195 | proc ::newToolbarDiag::Destroy { } { |
|---|
| 196 | # |
|---|
| 197 | # PURPOSE: Cerramos la ventana y destruimos toda las variables temporales |
|---|
| 198 | # |
|---|
| 199 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 200 | variable data |
|---|
| 201 | variable widget |
|---|
| 202 | |
|---|
| 203 | destroy $widget(document) |
|---|
| 204 | array unset data |
|---|
| 205 | array unset widget |
|---|
| 206 | return 1 |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 210 | proc ::newToolbarDiag::Create_command {} { |
|---|
| 211 | # |
|---|
| 212 | # PURPOSE: Creamos el frame con las opciones comunes de la ventana |
|---|
| 213 | # PARAMETERS: tl -> path donde creamos el componente |
|---|
| 214 | # RETURN: devolvemos el path del objeto creado |
|---|
| 215 | # |
|---|
| 216 | #///////////////////////////////////////////////////////////////////////////// |
|---|
| 217 | variable widget |
|---|
| 218 | variable data |
|---|
| 219 | |
|---|
| 220 | set ok 0 |
|---|
| 221 | |
|---|
| 222 | switch $data(tooldig,toolbartype) { |
|---|
| 223 | "toolbar" { |
|---|
| 224 | set winfoAux "${data(tooldig,toolbarparent)}.tb_${data(tooldig,toolname)}" |
|---|
| 225 | } |
|---|
| 226 | "toolbarframe" { |
|---|
| 227 | set winfoAux "$::project::widgets(mainframe).toolbarFrame_${data(tooldig,toolname)}" |
|---|
| 228 | } |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | puts "WINFOAUX -> $winfoAux" |
|---|
| 232 | |
|---|
| 233 | if {[llength $data(tooldig,toolname)]} { |
|---|
| 234 | set ok 1 |
|---|
| 235 | puts "INFORMACION ----> winfo exists $winfoAux" |
|---|
| 236 | if {[winfo exists $winfoAux]} { |
|---|
| 237 | set ok 0 |
|---|
| 238 | set msg [mc {Toolbar Name already exists}] |
|---|
| 239 | ShowMessage W $msg $widget(document) |
|---|
| 240 | } else { |
|---|
| 241 | set ok 1 |
|---|
| 242 | } |
|---|
| 243 | } else { |
|---|
| 244 | set msg [mc {Toolbar Name is required}] |
|---|
| 245 | ShowMessage W $msg $widget(document) |
|---|
| 246 | set ok 0 |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | if {$ok} { |
|---|
| 250 | |
|---|
| 251 | switch $data(tooldig,toolbartype) { |
|---|
| 252 | "toolbar" { |
|---|
| 253 | #data(tooldig,toolbarparent) |
|---|
| 254 | ::TolConsole::NewToolBarB $data(tooldig,toolbarparent) $data(tooldig,toolname) |
|---|
| 255 | ::newToolbarDiag::Destroy |
|---|
| 256 | } |
|---|
| 257 | "toolbarframe" { |
|---|
| 258 | ::TolConsole::NewToolFrame $data(tooldig,toolname) 8 |
|---|
| 259 | ::newToolbarDiag::Destroy |
|---|
| 260 | } |
|---|
| 261 | } |
|---|
| 262 | } |
|---|
| 263 | } |
|---|
| 264 | |
|---|