Changeset 0731938 in tol


Ignore:
Timestamp:
Nov 4, 2016, 11:04:56 AM (10 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
e933fd6
Parents:
e0578ae
Message:

Refs #1933

  • Se corrige la acción del doble clic sobre un nodo, para evitar errores cuando no está seleccionado.
  • Se utiliza la columna gramática para obtenerla cuando hace falta.
  • Se obvia (temporalmente) el insert de wtree por lento, se insertándose directamente sobre treectrl.
  • Se corrige ClearHiertables para evitar que se intenten seleccionar nodos mientras se borran.
  • Se sustituye el tabset de BLT por el NoteBook de BWidget. Se dejan sin efecto la desactivación de las pestañas (véanse los comentarios #@D)

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7335 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tolbase/lib/toltk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/toltk/tclIndex

    re0578ae r0731938  
    362362set auto_index(::TolInspector::SelectGrammar) [list source [file join $dir tolinspe__wtree1.tcl]]
    363363set auto_index(::TolInspector::SelectSet) [list source [file join $dir tolinspe__wtree1.tcl]]
    364 set auto_index(::TolInspector::GetParentGrammar) [list source [file join $dir tolinspe__main.tcl]]
    365364set auto_index(::TolInspector::OpenVariable) [list source [file join $dir tolinspe__wtree1.tcl]]
    366365set auto_index(::TolInspector::SelectItem) [list source [file join $dir tolinspe__wtree1.tcl]]
    … …  
    398397set auto_index(::TolInspector::SelectionExpand) [list source [file join $dir tolinspe__wtree2.tcl]]
    399398set auto_index(::TolInspector::SelectionCollapse) [list source [file join $dir tolinspe__wtree2.tcl]]
     399set auto_index(::TolInspector::ToggleItem) [list source [file join $dir tolinspe__wtree2.tcl]]
    400400set auto_index(::TolInspector::DrawSet) [list source [file join $dir tolinspe__draw.tcl]]
    401401set auto_index(::TolInspector::DrawMatrix) [list source [file join $dir tolinspe__draw.tcl]]
  • tolbase/lib/toltk/tolinspe__main.tcl

    re0578ae r0731938  
    297297 
    298298  # expand/collapse (and fill/unfill) a node with a double clic
    299   bind ${wt_tree}.frameTree.t <Double-1> "$wt_tree item toggle \[ $wt_tree selection get 0 \]"
     299  bind ${wt_tree}.frameTree.t <Double-1> "::TolInspector::ToggleItem %x %y"
    300300}
    301301
    … …  
    314314  variable wt_funcs
    315315 
    316   # creates the tabset to display the variables & functions   
    317   #set w_tabset [::blt::tabset $paneRight.ts -relief flat\
    318             -bd 0 -outerpad 0 -tier 2 -slant none -textside top \
    319             -highlightthickness 0 -side left -rotate 90]
    320   set w_tabset [::blt::tabset $paneRight.ts -relief flat\
    321             -bd 0 -outerpad 0 -tier 2 -slant right -textside right \
    322             -highlightthickness 0]
     316  # creates the tabset to display the variables & functions
     317  set w_tabset [NoteBook $paneRight.nb -tabbevelsize 8 -tabpady {2 6} \
     318    -font $toltk_options(fonts,Label)]           
     319 
     320  # inserts in the tabset the tabs of functions and variables       
     321  $w_tabset insert 0 Variables -text [mc Variables] -image [::Bitmap::get Variables] -background \#d9d9d9
     322  $w_tabset insert 1 Functions -text [mc Functions] -image [::Bitmap::get Functions] -background \#d9d9d9
     323  $w_tabset raise Variables
     324 
    323325  # creates the scrolled windows for each one of the tabs
    324   set sw21 [ScrolledWindow $w_tabset.sw12 -scrollbar none] 
    325   set sw22 [ScrolledWindow $w_tabset.sw22 -scrollbar none]
    326  
    327   # inserts in the tabset the tabs of functions and variables
    328   $w_tabset insert end \
    329       Variables -text [mc Variables] -selectbackground \#d9d9d9 -bg gray75 \
    330       -image [::Bitmap::get Variables] -pady 0\
    331       Functions -text [mc Functions] -selectbackground \#d9d9d9 -bg gray75 \
    332       -image [::Bitmap::get Functions] -pady 0
     326  set tab1 [$w_tabset getframe Variables]
     327  set tab2 [$w_tabset getframe Functions]
     328  set sw21 [ScrolledWindow $tab1.sw12 -scrollbar none] 
     329  set sw22 [ScrolledWindow $tab2.sw22 -scrollbar none]
    333330
    334331  # Creation of the right TREE RIGHT with VARIABLES
    … …  
    345342  $wt_vars notify bind $wt_vars <Selection> "::TolInspector::SelectItem $wt_vars"
    346343  #@! el bind debería poder hacerse directamente sobre el wtree
    347   bind ${wt_vars}.frameTree.t  <Button-1> "::focus $wt_vars"   
     344  bind ${wt_vars}.frameTree.t <Button-1> "::focus $wt_vars"   
    348345  bind ${wt_vars}.frameTree.t <Double-1> "::TolInspector::SelectionExpand"
    349346 
    … …  
    365362  $sw22 setwidget $wt_funcs 
    366363  # configure the tabs
    367   $w_tabset tab configure Variables -window $sw21 -fill both -padx 0
    368   $w_tabset tab configure Functions -window $sw22 -fill both -padx 0
     364  $tab1 configure -borderwidth 2 -background \#d9d9d9
     365  $tab2 configure -borderwidth 2 -background \#d9d9d9
    369366
    370367  # packing the tabset
    371   pack $w_tabset -fill both -expand yes
    372   $w_tabset tab configure Variables\
    373          -command "::TolInspector::SelectItem $wt_vars"
    374   $w_tabset tab configure Functions\
    375          -command "::TolInspector::SelectItem $wt_funcs"
     368  pack $tab1.sw12 -fill both -expand yes
     369  pack $tab2.sw22 -fill both -expand yes   
     370  pack $w_tabset -fill both -expand yes 
     371  #@! $w_tabset tab configure Variables\
     372  #@!        -command "::TolInspector::SelectItem $wt_vars"
     373  #@! $w_tabset tab configure Functions\
     374  #@!        -command "::TolInspector::SelectItem $wt_funcs"
    376375}
    377376
    … …  
    569568#>> proc ::TolInspector::SelectGrammar
    570569#>> proc ::TolInspector::SelectSet
    571 
    572 #/////////////////////////////////////////////////////////////////////////////
    573 proc ::TolInspector::GetParentGrammar { set_ref } {
    574 #/////////////////////////////////////////////////////////////////////////////
    575   set root [ lindex $set_ref 0 ]
    576   set L [ llength $set_ref ]
    577   if { ( $root eq "File" && $L <= 2 ) } {
    578     set root
    579   } else {
    580     lindex [ tol::info var $set_ref ] 0
    581   }
    582 }
    583570
    584571#>> [tolinspe_wtree1.tcl]
  • tolbase/lib/toltk/tolinspe__wtree1.tcl

    re0578ae r0731938  
    125125
    126126  set parent_grammar $arguments(parent_grammar) 
    127 
     127 
    128128  #@ Si la llamada a InsertChild viene de SelectSet el argumento tolref
    129129  #@ no está definido y se crea a partir de parent_tolref
    … …  
    183183  #?   }
    184184  #? }
    185    
    186   #@ ::TolInspector::LNode index grammar
     185 
     186  #@ ::TolInspector::RNode index grammar
    187187  #@   icon name content description path reference
    188   set wt_row [::TolInspector::RNode $arguments(index) $grammar \
    189     $icon_grammar $name $data3 $brief_desc $path $tolref]
    190  
    191   set idx [$wt insert $wt_row -at child -relative root]
     188  #@! set wt_row [::TolInspector::RNode $arguments(index) $grammar \
     189    $icon_grammar $name $data3 $brief_desc $path $tolref] 
     190  #@! set idx [$wt insert $wt_row -at child -relative root]
     191  #@! Las líneas anteriores parecen lentas y se sustituyen por las siguientes:
     192  set idx [$wt item create -button 1]
     193  $wt item element configure $idx \
     194    [RiIndex] eTXT -text $arguments(index) , \
     195    [RiGrammar] eTXT -text $grammar , \
     196    [RiName] eIMG -image $icon_grammar + eTXT -text $name , \
     197    [RiContent] eTXT -text $data3 , \
     198    [RiDescription] eTXT -text $brief_desc , \
     199    [RiPath] eTXT -text $path , \
     200    [RiReference] eTXT -text $tolref
     201  $wt item lastchild root $idx 
     202 
    192203  $wt item element configure $idx \
    193204    [RiIndex] eTXT -fill $fcolor , \
    … …  
    196207    [RiDescription] eTXT -fill $fcolor , \
    197208    [RiPath] eTXT -fill $fcolor
    198  
     209
    199210  incr arguments(index)
    200211}
    … …  
    211222  variable OnSelectItem
    212223
    213   foreach it [$wt_vars item children root] {
    214     $wt_vars item delete $it
    215   }
    216   foreach it [$wt_funcs item children root] {
    217     $wt_funcs item delete $it
    218   } 
     224  $wt_vars selection clear
     225  $wt_vars item delete all
     226  $wt_funcs selection clear
     227  $wt_funcs item delete all
     228
    219229  #@ToDo $wt_vars  column configure Index -hide no
    220230  #@ToDo $wt_funcs column configure Index -hide no
    221231 
    222   $w_tabset tab configure Variables -text [mc Variables] -state normal
    223   $w_tabset tab configure Functions -state normal
     232  $w_tabset itemconfigure Variables -text [mc Variables] -state normal
     233  $w_tabset itemconfigure Functions -state normal
    224234
    225235  if { [string length $OnSelectItem] } {
    … …  
    264274    #@  + parent_grammar es usado por InsertSubset para abrir o no un nodo
    265275    #@  + parent_tolref es usado por InsertSubset para determinar tolref
    266     set arguments(parent_grammar) [GetParentGrammar $tolReference]     
     276    set arguments(parent_grammar) [$wt_tree item text $node [LiGrammar]]
    267277    set arguments(parent_tolref) $tolReference
    268278    ::tol::forallchild $tolReference ::TolInspector::InsertSubset
    … …  
    399409  set parent_grammar $arguments(parent_grammar)
    400410  #@ para obtener el icono de las instancias
    401   set parent_tolref $arguments(parent_tolref) 
     411  set parent_tolref $arguments(parent_tolref)
    402412 
    403413#@# Tolcon_Trace "InsertSubset $args"   
    … …  
    464474  variable wt_tree
    465475  variable arguments
    466 
     476 
    467477  set node [$wt_tree selection get 0]
    468478  if { ![string length $node] } return
    469479  if { $node == 0 } {
    470480    ClearHiertables
     481    #@D $w_tabset itemconfigure Variables -state disabled
     482    #@D $w_tabset itemconfigure Functions -state disabled   
    471483    return
    472484  }
    … …  
    478490    #@ Aquí llegan los nodos raíz y las gramáticas
    479491    #@ Argumentos pasados por atributo
    480     #@  + parent_grammar es usado por InsertItem para determinar el color de sus miembros si es NameBlock     
     492    #@  + parent_grammar es usado por InsertItem para saber si es NameBlock 
    481493    set arguments(parent_grammar) ""
    482494    switch $tolReference {
    … …  
    484496      File    SelectFileRoot
    485497      Console SelectConsoleRoot
    486       default ClearHiertables
     498      default {
     499        ClearHiertables
     500        #@D $w_tabset itemconfigure Variables -state disabled
     501        #@D $w_tabset itemconfigure Functions -state disabled
     502      }
    487503    }
    488504  } elseif { [lindex $tolReference 0] == "Grammar" } {
    489505    #@ Argumentos pasados por atributo
    490     #@  + parent_grammar es usado por InsertItem para determinar el color de sus miembros si es NameBlock 
     506    #@  + parent_grammar es usado por InsertItem para saber si es NameBlock
    491507    set arguments(parent_grammar) ""
    492508    SelectGrammar
    493509  } else {
     510    #@ Argumentos pasados por atributo
     511    #@  + parent_grammar es usado por InsertItem para saber si es NameBlock
     512    set arguments(parent_grammar) [$wt_tree item text $node [LiGrammar]]
    494513    SelectSet $tolReference
    495514  }
    … …  
    513532
    514533  ClearHiertables
    515   $w_tabset select 0 ;# Variables
     534  $w_tabset itemconfigure Variables -text [mc Packages] 
     535  $w_tabset raise Variables 
     536  #@D $w_tabset itemconfigure Functions -state disabled 
    516537 
    517538  #@=> tiene que incrementarse automáticamente es el contador del foreach 
    … …  
    543564
    544565  ClearHiertables
    545   $w_tabset tab configure Variables -text [mc Files]
    546   #  $w_tabset tab configure Functions -state disabled
    547   $w_tabset select 0 ;# Variables
     566  $w_tabset itemconfigure Variables -text [mc Files]
     567  $w_tabset raise Variables
     568  #@D $w_tabset itemconfigure Functions -state disabled
    548569 
    549570  #@=> tiene que incrementarse automáticamente es el contador del foreach 
    … …  
    568589#
    569590#/////////////////////////////////////////////////////////////////////////////
    570   variable w_tabset
    571591  variable wt_tree
    572592  variable arguments
    … …  
    577597
    578598  ClearHiertables
     599
    579600#(pgea) se quita la linea que oculta la columna del indice y que
    580601#(pgea) el procedimimento anterior ClearHiertables muestra
    581602#  $ht_vars column  configure Index -hide yes
    582 #  $w_tabset tab configure Functions -state disabled
    583603 
    584604  foreach co [::tol::console stack list] {
     605  Tolcon_Trace "co $co"
    585606    #puts "SelectConsoleRoot: co = $co"
    586607    set gra  [lindex $co 0]
    … …  
    662683    }
    663684  } else {
    664 #    $w_tabset tab configure Variables -state disabled
    665 #    $w_tabset select 1
     685    $w_tabset raise Functions 
     686    #@D $w_tabset itemconfigure Variables -state disabled
    666687  }
    667688  foreach fun  [::tol::info functions $grammar] {
    … …  
    689710 
    690711  #@ Argumentos pasados por atributo
    691   #@  + index es usado e incrementado por InsertItem     
    692   #@  + parent_grammar es usado por InsertItem para determinar el color de sus miembros si es NameBlock
     712  #@  + index es usado e incrementado por InsertItem
    693713  #@  + tolref indica a InsertItem que se ha de obtener desde parent_tolref
    694714  #@  + parent_tolref es usado por InsertItem para encontrar tolref 
    695715  set arguments(index) 1 
    696   set arguments(parent_grammar) [GetParentGrammar $tolReference]
    697716  set arguments(tolref) ""
    698   set arguments(parent_tolref) $tolReference  
     717  set arguments(parent_tolref) $tolReference
    699718  ::tol::forallchild $tolReference ::TolInspector::InsertChild
    700719}
  • tolbase/lib/toltk/tolinspe__wtree2.tcl

    re0578ae r0731938  
    5858  $wt_tree selection clear
    5959  $wt_tree selection add $idx_con
     60
    6061  #Tolcon_Trace "Abierto el nodo root-console"
    6162  if { [$wt_tree item state get $idx_con focus] } {
    … …  
    664665#
    665666#/////////////////////////////////////////////////////////////////////////////
    666   #set found [$ht find]
    667   #if {[llength $found] > 1} {
    668   #  $ht selection set [lindex $found 1] [lindex $found end]
    669   #}
    670667  $wt selection add 0 end
    671668}
    … …  
    680677#
    681678#/////////////////////////////////////////////////////////////////////////////
    682   #set found [$ht find]
    683   #if {[llength $found] > 1} {
    684   #  $ht selection toggle [lindex $found 1] [lindex $found end]
    685   #}
    686679  set sel [$wt selection get 0 end]
    687680  $wt selection add 0 end
    … …  
    713706  }
    714707}
     708
     709#/////////////////////////////////////////////////////////////////////////////
     710proc ::TolInspector::ToggleItem { x y } {
     711#/////////////////////////////////////////////////////////////////////////////
     712  variable wt_tree
     713
     714  set lstxy [$wt_tree identify $x $y]
     715  if { [llength $lstxy] } {
     716    if { [lindex $lstxy 0] == "item" } {
     717      $wt_tree item toggle [lindex $lstxy 1]
     718    }
     719  }
     720}
Note: See TracChangeset for help on using the changeset viewer.