Changeset 6dc91d2 in tol for tolbase


Ignore:
Timestamp:
Nov 23, 2016, 12:06:20 PM (10 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
cc64b09
Parents:
ffeacdc
Message:

Refs #1933
Se incorporan las barras a la ventana de salida del inspector (tolbase.tcl).
Se corrige un bug con el botón derecho sobre el árbol del inspector (tolinspewtree2.tcl).
Se revisan los binds del editor de PRJs (tolprj.tcl) y se hace uso de la nueva opción de wtree: -selectcommand.
Se añade el método focus y dos opciones de configuración (selectcommand y bindtags) al wtree (wtree.tcl).

Se revisa listboxplus:

+ Se añaden algunas opciones auxiliares (para evitar errores)
+ Se suspenden las barras para que no salgan duplicadas (wtree ya las tiene)
+ Se redirigen los mecanismos de ordenación a los de wtree (véase _SortByColumn, por ejemplo).

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

Location:
tolbase/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/byswidget/blistboxplus/blistboxplus.tcl

    rffeacdc r6dc91d2  
    7777  option -iniconfig ""
    7878 
     79  #@O treeview options
     80  option -exportselection false
     81  option -linewidth 1 ;# unused
     82  option -selectbackground "unused"
     83 
    7984  variable _listbox
    8085  variable menu
    … …  
    96101  #
    97102  #///////////////////////////////////////////////////////////////////////////
    98 
    99103    debug_init
    100104
    101105    debug_msg "install listbox ..."
    102106
    103     if {0} {
    104       return
     107    if {1} {
    105108      #@T install _listbox using ::blt::treeview $win.lb -hideroot yes \
    106109          -activeicons "" -icons {} -selectmode multiple \
    … …  
    108111          -highlightthickness 0 -borderwidth 1 -selectborderwidth 1 \
    109112          -nofocusselectbackground grey -font {Arial 9} -flat yes
     113      install _listbox using ::wtree $win.lb -table 0 -filter no \
     114        -background white -showroot 0 -selectmode extended -showheader 1 \
     115        -highlightbackground gray75 -highlightcolor black \
     116        -highlightthickness 0 -font {Arial 9}
    110117    } else {
    111118      set _listbox [::wtree $win.lb -table 0 -filter no \
    112119        -background white -showroot 0 -selectmode extended -showheader 1 \
    113120        -highlightbackground gray75 -highlightcolor black \
    114         -highlightthickness 0 -font {Arial 9} \
    115         -columns [::TolInspector::LNodeDef] ]
     121        -highlightthickness 0 -font {Arial 9}]
    116122      #@T set _listbox [::blt::treeview $win.lb -hideroot yes \
    117123                        -activeicons "" -icons {} -selectmode multiple \
    … …  
    125131
    126132    install menu using menu $win.m -tearoff 0
    127     install xbar using scrollbar $win.sbh -orient horizontal \
     133    #@!scroll install xbar using scrollbar $win.sbh -orient horizontal \
    128134                                           -command "$win xview"
    129     install ybar using scrollbar $win.sbv -orient vertical \
     135    #@!scroll install ybar using scrollbar $win.sbv -orient vertical \
    130136                                           -command "$win yview"
    131137
    132138    #bindtags is modified to make possible to associate binds to self
    133     bindtags $_listbox [linsert [bindtags $_listbox] 2 $win]
     139    $_listbox configure -bindtags [list $self Blistboxplus]
    134140
    135141    #@T! $_listbox style  configure text     -bg white
    … …  
    161167    #pack
    162168    grid $_listbox -row 0 -column 0 -sticky news
    163     grid $ybar -row 0 -column 1 -sticky ns
    164     grid $xbar -row 1 -column 0 -sticky ew
     169    #@!scroll grid $ybar -row 0 -column 1 -sticky ns
     170    #@!scroll grid $xbar -row 1 -column 0 -sticky ew
    165171    grid columnconfigure $self 0 -weight 1
    166172    grid rowconfigure    $self 0 -weight 1
    167173
    168     ::autoscroll::autoscroll $ybar
    169     ::autoscroll::autoscroll $xbar
     174    #@!scroll ::autoscroll::autoscroll $ybar
     175    #@!scroll ::autoscroll::autoscroll $xbar
    170176    debug_msg "voy a pillarte: antes de _ReadIni"
    171177    $self _ReadIni
    … …  
    206212    set lstx [list [list image -label Icon -tags Icon] ]
    207213    foreach col $lst {
     214      #set colx [list text -label [msgcat::mc $col] -tags $col]
    208215      set colx [list text -label $col -tags $col]
    209216      lappend lstx $colx
    210217    }
    211     Tolcon_Trace "lstx $lstx"
     218    #@! Tolcon_Trace "lstx $lstx"
    212219    $_listbox configure -columns $lstx
    213220   
    … …  
    240247  onconfigure -showtitles { bool } {
    241248    set options(-showtitles) $bool
    242     $_listbox configure -showtitles $bool
    243     $_listbox show
     249    #@O $_listbox configure -showtitles $bool
     250    $_listbox configure -showheader $bool   
     251    #@O! $_listbox show
    244252  }
    245253
    … …  
    263271    set cols [$self column names]
    264272    foreach col $cols {
    265      $self column configure $col -title [mc [lindex $titles $c] ]
     273     #@O $self column configure $col -title [mc [lindex $titles $c] ]
     274     $_listbox column configure $col -text [mc [lindex $titles $c] ]
    266275     incr c 1     
    267276    }
    … …  
    299308      set options(-selectmode) $mode
    300309    }
     310    $_listbox configure -selectmode $options(-selectmode)
    301311  } 
    302312
    … …  
    318328    }
    319329  }
     330 
     331  onconfigure -exportselection { bool } {
     332    if { $bool } {
     333      error "\[blistboxplus\] option -exportselection should be 'no'"
     334    }
     335  }
     336 
     337  #///////////////////////////////////////////////////////////////////////////
     338  method show { args } {
     339  #///////////////////////////////////////////////////////////////////////////
     340    error "\[blistboxplus\] method show unimplemented"
     341  }
     342 
     343  #///////////////////////////////////////////////////////////////////////////
     344  method hide { args } {
     345  #///////////////////////////////////////////////////////////////////////////
     346    error "\[blistboxplus\] method hide unimplemented"
     347  }
     348 
     349  #///////////////////////////////////////////////////////////////////////////
     350  method sort { args } {
     351  #///////////////////////////////////////////////////////////////////////////
     352    if { [lindex $args 1] eq "configure" } {
     353      if { [lindex $args 2] eq "-column" } {
     354        return [$self _SortByColumn [lindex $args 3]]
     355      } else {
     356        return
     357      }
     358    } elseif { [lindex $args 1] eq "auto" } {
     359      #@O! Nothing to do ??
     360      return
     361    } else {
     362      return
     363    }     
     364  }
    320365
    321366  #///////////////////////////////////////////////////////////////////////////
    … …  
    371416        -command "$self _LoadFromFile"
    372417    }
    373     # bindings   
    374     #@T $self bind all <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
    375     #@T $self bind all <Key-Delete>    "lbDeleteSelection $self"
    376     #@T $self bind all <Key-Insert>    "$self _OpenWR"   
    377     #@T $self bind all <Shift-Up>      "$self addPrevious"
    378     #@T $self bind all <Shift-Down>    "$self addNext"
    379     #@T $self bind all <Up>            "$self previous"
    380     #@T $self bind all <Down>          "$self next"
    381     #@T $self bind all <Home>          "$self first"
    382     #@T $self bind all <End>           "$self last"
    383     #@T $self bind all <Shift-Home>    "$self addAllPrevious"
    384     #@T $self bind all <Shift-End>     "$self addAllNext"
    385     #@T $self bind all <Button-1>      +[list focus -force %W]
    386    
    387     bind $_listbox.frameTree.t <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
    388     bind $_listbox.frameTree.t <Key-Delete>    "lbDeleteSelection $self"
    389     bind $_listbox.frameTree.t <Key-Insert>    "$self _OpenWR"   
    390     bind $_listbox.frameTree.t <Shift-Up>      "$self addPrevious"
    391     bind $_listbox.frameTree.t <Shift-Down>    "$self addNext"
    392     bind $_listbox.frameTree.t <Up>            "$self previous"
    393     bind $_listbox.frameTree.t <Down>          "$self next"
    394     bind $_listbox.frameTree.t <Home>          "$self first"
    395     bind $_listbox.frameTree.t <End>           "$self last"
    396     bind $_listbox.frameTree.t <Shift-Home>    "$self addAllPrevious"
    397     bind $_listbox.frameTree.t <Shift-End>     "$self addAllNext"
    398     bind $_listbox.frameTree.t <Button-1>      +[list focus -force %W]   
     418    # bindings 
     419    bind $_listbox <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
     420    bind $_listbox <Key-Delete>         "lbDeleteSelection $self" 
     421    bind $_listbox <Key-Insert>         "$self _OpenWR"
     422    bind $_listbox <Shift-Up>           "$self addPrevious"
     423    bind $_listbox <Shift-Down>         "$self addNext"
     424    bind $_listbox <Up>                 "$self previous"
     425    bind $_listbox <Down>               "$self next"
     426    bind $_listbox <Home>               "$self first"
     427    bind $_listbox <End>                "$self last"
     428    bind $_listbox <Shift-Home>         "$self addAllPrevious"
     429    bind $_listbox <Shift-End>          "$self addAllNext"
     430    bind $_listbox <Button-1>           +[list focus -force %W]   
    399431  }
    400432
    … …  
    631663      if { ![ catch { set fd [open $filNam r] } msgerr] } {
    632664         while { [gets $fd line ] >= 0} {
    633            Tolcon_Trace "adding $line"
    634665           $self add $line
    635666         }
    … …  
    650681  #///////////////////////////////////////////////////////////////////////////
    651682
     683    #@O!
     684    return [$_listbox SortbyColumn $_listbox $col]
     685 
    652686    set numofel [$self size]
    653687    set lst [list]
    … …  
    870904  #
    871905  #///////////////////////////////////////////////////////////////////////////   
    872     Tolcon_Trace "insert pos: $pos args: $args"
    873906    if { [lindex $args 0] eq "cols" } {
    874907      set cols [lindex $args 1]
    … …  
    963996  #
    964997  #///////////////////////////////////////////////////////////////////////////
    965     Tolcon_Trace "get ids: $ids cols: $cols"
    966998    if { $ids eq "" } {
    967999      #@T! return [lrange [$self find] 1 end]
    … …  
    9971029    }
    9981030     
    999     if { [llength $ids] eq 1 } {
    1000       Tolcon_Trace "get result: $result"
    1001       Tolcon_Trace "get result0: [lindex $result 0]"       
     1031    if { [llength $ids] eq 1 } {   
    10021032      return [lindex $result 0]
    10031033    }
    … …  
    10171047  #
    10181048  #///////////////////////////////////////////////////////////////////////////
    1019     Tolcon_Trace "set id: $id data: $data cols: $cols"
    10201049    if { "$cols" eq "" } {
    10211050      set cols [$self column names]
    … …  
    12691298  #
    12701299  #///////////////////////////////////////////////////////////////////////////
    1271     #@T! if { [lindex $args 0] eq "names" } {
    1272     #@T!   return [lrange [$_listbox column names] 1 end]
    1273     #@T! }
    1274     #@T! return [eval $_listbox column $args]
    12751300    if { [lindex $args 0] eq "names" } {
    12761301      set names {}
    … …  
    12791304      }
    12801305      return $names
    1281     }
    1282     return [eval $_listbox column id $args]   
     1306    } elseif { [lindex $args 0] eq "configure" } {
     1307      return [eval $_listbox column $args]
     1308    } else {
     1309      return [eval $_listbox column id $args]
     1310    } 
    12831311  }
    12841312
  • tolbase/lib/toltk/tolbase.tcl

    rffeacdc r6dc91d2  
    186186  $tab2 configure -borderwidth 2 -background \#d9d9d9 
    187187  $tab3 configure -borderwidth 2 -background \#d9d9d9   
    188   set sw2 [ScrolledWindow $tab2.sw -scrollbar none]
    189   set sw3 [ScrolledWindow $tab3.sw -scrollbar none]
     188  set sw2 [ScrolledWindow $tab2.sw -auto both]
     189  set sw3 [ScrolledWindow $tab3.sw -auto both]
    190190  set widgets(tabset,info) $sw3
    191191
  • tolbase/lib/toltk/tolinspe__wtree2.tcl

    rffeacdc r6dc91d2  
    558558     
    559559      # label of object showed in the tree
    560       set objName [$wt_tree item text Name]
    561       set object [$wt_tree item text Reference]
     560      set objName [$wt_tree item text $index Name]
     561      set object [$wt_tree item text $index Reference]
    562562     
    563563      if {$InRootFiles} {
  • tolbase/lib/toltk/tolprj.tcl

    rffeacdc r6dc91d2  
    408408  set tv [::wtree $f.sw.t -table 0 -filter no \
    409409    -background white -showroot 1 -selectmode single -showheader 0 \
     410    -selectcommand "::TolProject::SelectProc $this" \
    410411    -highlightbackground gray75 -highlightcolor black \
    411412    -highlightthickness 0 -font $toltk_options(fonts,Label) \
    … …  
    425426  $tv column configure "range 1 end" -visible no
    426427  $tv column configure first -expand yes -weight 1
    427   $tv column configure all -itembackground ""       
    428   $tv notify bind $tv <Selection> "::TolProject::SelectProc $this"       
     428  $tv column configure all -itembackground ""
    429429 
    430430  $f.sw setwidget $f.sw.t
    … …  
    441441  grid columnconfigure $f 0 -weight 1
    442442
    443 
    444   bind $tv.frameTree.t <Control-KeyRelease> [list ::TolProject::OnControlKey $this %K %k]
    445 
    446   bind $tv.frameTree.t <Button-1> "::focus $tv" 
    447  
    448   bind $tv.frameTree.t <Button-3> +[list ::TolProject::PostVariable $this %X %Y]
    449  
    450   set prevBind [bind $tv.frameTree.t <Double-1>]
    451   set newBind "[lrange $prevBind 0 [expr [llength $prevBind]-3]] ; mdidoc disableglobalraise ; ::TolProject::OpenNodeIfTerminal $this ; break"
    452   #@ mdidoc disableglobalraise y break parece que cumplen el mismo cometido
    453   bind $tv.frameTree.t <Double-1> $newBind
    454  
    455   set prevBind [bind $tv.frameTree.t <KeyPress-Return>]
    456   set newBind "[lrange $prevBind 0 [expr [llength $prevBind]-3]] ; ::TolProject::OpenNodeIfTerminal $this ; break"
    457   bind $tv.frameTree.t <KeyPress-Return> $newBind   
    458 
    459   bind $tv.frameTree.t <KeyPress-space>  +[list ::TolProject::NodeActiveAttributes $this]
    460   bind $tv.frameTree.t <KeyPress-Delete> +[list ::TolProject::DeleteActiveNode     $this]
    461   bind $tv.frameTree.t <KeyPress-F9>     "::TolProject::CompileActiveNode    $this ; break"
    462   bind $tv.frameTree.t <KeyPress-F8>     "::TolProject::DecompileActiveNode  $this ; break" 
     443  bind $tv <Control-KeyRelease> [list ::TolProject::OnControlKey $this %K %k]
     444  bind $tv <Button-1> "::focus $tv"
     445  bind $tv <Button-3> +[list ::TolProject::PostVariable $this %X %Y]
     446
     447  bind $tv <Double-1> "mdidoc disableglobalraise ; ::TolProject::OpenNodeIfTerminal $this"
     448  bind $tv <KeyPress-Return> "::TolProject::OpenNodeIfTerminal $this"
     449
     450  bind $tv <KeyPress-space>  +[list ::TolProject::NodeActiveAttributes $this]
     451  bind $tv <KeyPress-Delete> +[list ::TolProject::DeleteActiveNode     $this]
     452  bind $tv <KeyPress-F9>     "::TolProject::CompileActiveNode    $this ; break"
     453  bind $tv <KeyPress-F8>     "::TolProject::DecompileActiveNode  $this ; break" 
    463454 
    464455  set data(mainMenu) [menu $tv.m -tearoff 0]
  • tolbase/lib/wtree/wtree.tcl

    rffeacdc r6dc91d2  
    8080      -default "" -configuremethod "_conf-columnfilter"
    8181
     82  option -bindtags \
     83      -default "" -configuremethod "_conf-bindtags"     
     84
     85  option -selectcommand \
     86      -default "" -configuremethod "_conf-selectcommand"           
     87     
    8288  variable tree
    8389  variable vscrollbar
    … …  
    265271       
    266272        $t item sort root $order -column $column -dictionary
     273  }
     274 
     275  method focus { itemid } {
     276    if { $itemid eq "" } {
     277      $self item id active
     278    } else {
     279      $self activate $itemid
     280    }
    267281  }
    268282
    … …  
    314328        -showrootbutton no -showbuttons yes -showlines yes \
    315329        -scrollmargin 16 -xscrolldelay "500 50" -yscrolldelay "500 50"
     330   
     331    bindtags $tree [linsert [bindtags $tree] 0 $win Wtree]
    316332
    317333    $tree notify install <<ItemSelected>>
    … …  
    702718    }
    703719  }
     720 
     721  method _conf-bindtags { _ addtags } {
     722    set options(-bindtags) $addtags
     723    bindtags $self [concat $addtags [bindtags $self]]
     724        bindtags $tree [concat $addtags [bindtags $tree]]
     725  }
     726 
     727  method _conf-selectcommand { _ cmd } {
     728    set options(-selectcommand) $cmd
     729    if { $cmd eq "" } return
     730    $self notify bind $self <Selection> $cmd
     731  } 
    704732
    705733  #
    … …  
    742770      array set opts [ lrange $col_spec 1 end ]
    743771      set colID [ $tree column create \
    744                       -text [ msgcat::mc $opts(-label) ] \
     772                      -text $opts(-label) \
    745773                      -image $opts(-image) \
    746774                      -itembackground "\#e0e8f0 {}" \
Note: See TracChangeset for help on using the changeset viewer.