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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.