Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | * scripts/*.tcl: Support for interactive cell editing with the aid of the ctext widget; added the "canceledediting" subcommand; sped up the "selection" and "cellselection" subcommands by orders of magnitude; significally reduced the performance penalty imposed by the "-(select)background" and "-(select)foreground options at column, row, and cell levels; improved the keyboard traversal during interactive cell editing; using the "-data" option for most virtual events; improvements related to the selection mode "extended"; further code improvements; eliminated a regression introduced in Tablelist 5.6, related to vertical scrolling under Tk 8.5 or later in the presence of embedded images or windows. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3661737db3a1479be218720ffeb35a07 |
User & Date: | csaba 2013-04-13 18:34:57 |
Context
2013-04-13
| ||
18:35 | * scripts/tclIndex: Newly generated. check-in: 1e3b14655e user: csaba tags: trunk | |
18:34 | * scripts/*.tcl: Support for interactive cell editing with the aid of the ctext widget; added the "canceledediting" subcommand; sped up the "selection" and "cellselection" subcommands by orders of magnitude; significally reduced the performance penalty imposed by the "-(select)background" and "-(select)foreground options at column, row, and cell levels; improved the keyboard traversal during interactive cell editing; using the "-data" option for most virtual events; improvements related to the selection mode "extended"; further code improvements; eliminated a regression introduced in Tablelist 5.6, related to vertical scrolling under Tk 8.5 or later in the presence of embedded images or windows. check-in: 3661737db3 user: csaba tags: trunk | |
18:33 | * *.tcl: Bumped the version number to 5.8. * COPYRIGHT.txt: * README.txt: check-in: 3a0c83b46d user: csaba tags: trunk | |
Changes
Changes to modules/tablelist/scripts/mwutil.tcl.
1 2 3 4 5 6 7 | #============================================================================== # Contains utility procedures for mega-widgets. # # Structure of the module: # - Namespace initialization # - Public utility procedures # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #============================================================================== # Contains utility procedures for mega-widgets. # # Structure of the module: # - Namespace initialization # - Public utility procedures # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tcl 8 package require Tk 8 # # Namespace initialization |
︙ | ︙ |
Changes to modules/tablelist/scripts/repair.tcl.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # "tablelistSort.tcl", and "tablelistUtil.tcl" by defining the procedure # "arrElemExists" and replacing all invocations of "[info exists # <array>(<name>)]" with "[arrElemExists <array> <name>]". This works around a # bug in Tcl versions 8.2, 8.3.0 - 8.3.2, and 8.4a1 (fixed in Tcl 8.3.3 and # 8.4a2), which causes excessive memory use when calling "info exists" on # non-existent array elements. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # "tablelistSort.tcl", and "tablelistUtil.tcl" by defining the procedure # "arrElemExists" and replacing all invocations of "[info exists # <array>(<name>)]" with "[arrElemExists <array> <name>]". This works around a # bug in Tcl versions 8.2, 8.3.0 - 8.3.2, and 8.4a1 (fixed in Tcl 8.3.3 and # 8.4a2), which causes excessive memory use when calling "info exists" on # non-existent array elements. # # Copyright (c) 2001-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== set procDef { # # The following procedure returns 1 if arrName($name) exists and # 0 otherwise. It is a (partial) replacement for [info exists # arrName($name)], which -- due to a bug in Tcl versions 8.2, |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistBind.tcl.
1 2 3 4 5 6 7 8 9 10 | #============================================================================== # Contains public and private procedures used in tablelist bindings. # # Structure of the module: # - Public helper procedures # - Binding tag Tablelist # - Binding tag TablelistWindow # - Binding tag TablelistBody # - Binding tags TablelistLabel, TablelistSubLabel, and TablelistArrow # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #============================================================================== # Contains public and private procedures used in tablelist bindings. # # Structure of the module: # - Public helper procedures # - Binding tag Tablelist # - Binding tag TablelistWindow # - Binding tag TablelistBody # - Binding tags TablelistLabel, TablelistSubLabel, and TablelistArrow # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Public helper procedures # ======================== # |
︙ | ︙ | |||
776 777 778 779 780 781 782 | # # Conditionally deactivate the previously activated expand/collapse control # variable priv set prevCellIdx $priv(prevActExpCollCtrlCell) if {[string compare $prevCellIdx ""] != 0 && [info exists data($prevCellIdx-indent)] && | | > | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | # # Conditionally deactivate the previously activated expand/collapse control # variable priv set prevCellIdx $priv(prevActExpCollCtrlCell) if {[string compare $prevCellIdx ""] != 0 && [info exists data($prevCellIdx-indent)] && (!$inExpCollCtrl || [string compare $prevCellIdx $key,$col] != 0) && [winfo exists $data(body).ind_$prevCellIdx]} { set data($prevCellIdx-indent) \ [strMap {"Act" ""} $data($prevCellIdx-indent)] $data(body).ind_$prevCellIdx configure -image $data($prevCellIdx-indent) set priv(prevActExpCollCtrlCell) "" } if {!$inExpCollCtrl || [string compare $prevCellIdx $key,$col] == 0} { return "" } # # Activate the expand/collapse control under the mouse pointer # variable ${treeStyle}_collapsedActImg if {[info exists ${treeStyle}_collapsedActImg]} { set data($key,$col-indent) [strMap {"expanded" "expandedAct" "collapsed" "collapsedAct"} $data($key,$col-indent)] $indentLabel configure -image $data($key,$col-indent) set priv(prevActExpCollCtrlCell) $key,$col } } #------------------------------------------------------------------------------ # tablelist::wasExpCollCtrlClicked # |
︙ | ︙ | |||
1136 1137 1138 1139 1140 1141 1142 | browse { ::$win selection clear 0 end ::$win selection set $row set priv(prevRow) $row event generate $win <<TablelistSelect>> } extended { | > | > | > > > | > > > > > > > | | > > | < > > > > | > > > > > > | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 | browse { ::$win selection clear 0 end ::$win selection set $row set priv(prevRow) $row event generate $win <<TablelistSelect>> } extended { set prevRow $priv(prevRow) if {[string compare $prevRow ""] == 0} { set prevRow $row ::$win selection set $row } if {[::$win selection includes anchor]} { ::$win selection clear $prevRow $row ::$win selection set anchor $row } else { ::$win selection set $prevRow $row ::$win selection clear anchor $row } set priv(prevRow) $row event generate $win <<TablelistSelect>> } } } cell { if {$row == $priv(prevRow) && $col == $priv(prevCol)} { return "" } switch -- $data(-selectmode) { browse { ::$win cellselection clear 0,0 end ::$win cellselection set $row,$col set priv(prevRow) $row set priv(prevCol) $col event generate $win <<TablelistSelect>> } extended { set prevRow $priv(prevRow) set prevCol $priv(prevCol) if {[string compare $prevRow ""] == 0 || [string compare $prevCol ""] == 0} { set prevRow $row set prevcol $col ::$win cellselection set $row,$col } if {[::$win cellselection includes anchor]} { ::$win cellselection clear \ $prevRow,$priv(prevCol) $row,$col ::$win cellselection set anchor $row,$col } else { ::$win cellselection set \ $prevRow,$priv(prevCol) $row,$col ::$win cellselection clear anchor $row,$col } set priv(prevRow) $row set priv(prevCol) $col event generate $win <<TablelistSelect>> } } } } |
︙ | ︙ | |||
1306 1307 1308 1309 1310 1311 1312 | variable priv if {$priv(clickedInEditWin) && $priv(releasedInEditWin)} { return "" } upvar ::tablelist::ns${win}::data data if {[info exists data(sourceRow)]} { | | > > > | | > > | > > > > > | | | | | | | > > > > | < < | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | variable priv if {$priv(clickedInEditWin) && $priv(releasedInEditWin)} { return "" } upvar ::tablelist::ns${win}::data data if {[info exists data(sourceRow)]} { set sourceRow $data(sourceRow) unset data(sourceRow) unset data(sourceEndRow) unset data(sourceDescCount) unset data(sourceParentKey) unset data(sourceParentRow) unset data(sourceParentEndRow) bind [winfo toplevel $win] <Escape> $data(topEscBinding) $data(body) configure -cursor $data(-cursor) place forget $data(rowGap) if {[info exists data(targetRow)]} { set targetRow $data(targetRow) unset data(targetRow) if {$targetRow > $data(lastRow)} { if {[catch {::$win move $sourceRow $targetRow}] == 0} { set targetParentNodeIdx [::$win parentkey $sourceRow] } else { ::$win move $sourceRow root end set targetParentNodeIdx root } set targetChildIdx [::$win childcount $targetParentNodeIdx] } else { set targetChildIdx $data(targetChildIdx) unset data(targetChildIdx) if {$targetChildIdx == 0} { set targetParentNodeIdx $targetRow # # The first expand invocation below is necessary in # case the target node has already children, while # the second one is needed in the opposite case. # ::$win expand $targetParentNodeIdx -partly ::$win move $sourceRow $targetParentNodeIdx $targetChildIdx ::$win expand $targetParentNodeIdx -partly } else { set targetParentNodeIdx [::$win parentkey $targetRow] set targetChildIdx [::$win childindex $targetRow] ::$win move $sourceRow $targetParentNodeIdx $targetChildIdx } } if {[string compare $targetParentNodeIdx "root"] != 0} { set targetParentNodeIdx [::$win index $targetParentNodeIdx] } set userData [list $sourceRow $targetParentNodeIdx $targetChildIdx] genVirtualEvent $win <<TablelistRowMoved>> $userData } else { switch $data(-selecttype) { row { ::$win activate $row } cell { ::$win activatecell $row,$col } } } } else { |
︙ | ︙ | |||
2785 2786 2787 2788 2789 2790 2791 | $data(body) tag configure visibleLines -tabs {} if {$data(colResized)} { redisplayCol $win $col 0 end adjustColumns $win {} 0 stretchColumns $win $col updateColors $win | > | | 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 | $data(body) tag configure visibleLines -tabs {} if {$data(colResized)} { redisplayCol $win $col 0 end adjustColumns $win {} 0 stretchColumns $win $col updateColors $win genVirtualEvent $win <<TablelistColumnResized>> $col } } else { if {[info exists data(X)]} { unset data(X) after cancel $data(afterId) set data(afterId) "" } |
︙ | ︙ | |||
2820 2821 2822 2823 2824 2825 2826 | uplevel #0 $data(-labelcommand) [list $win $col] } } } elseif {$data(-movablecolumns)} { $data(hdrTxtFrCanv)$col configure -cursor $data(-cursor) if {[info exists data(targetCol)]} { moveCol $win $col $data(targetCol) | > > | | | > | 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 | uplevel #0 $data(-labelcommand) [list $win $col] } } } elseif {$data(-movablecolumns)} { $data(hdrTxtFrCanv)$col configure -cursor $data(-cursor) if {[info exists data(targetCol)]} { moveCol $win $col $data(targetCol) set userData [list $col $data(targetCol)] genVirtualEvent $win <<TablelistColumnMoved>> $userData unset data(targetCol) } } } set data(labelClicked) 0 } #------------------------------------------------------------------------------ |
︙ | ︙ | |||
2848 2849 2850 2851 2852 2853 2854 | if {!$data(isDisabled) && $data(-resizablecolumns) && $data($col-resizable)} { if {$shiftPressed} { doColConfig $col $win -width -$data($col-lastStaticWidth) } else { doColConfig $col $win -width 0 } | > | > | | 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 | if {!$data(isDisabled) && $data(-resizablecolumns) && $data($col-resizable)} { if {$shiftPressed} { doColConfig $col $win -width -$data($col-lastStaticWidth) } else { doColConfig $col $win -width 0 } genVirtualEvent $win <<TablelistColumnResized>> $col } } #------------------------------------------------------------------------------ # tablelist::labelDblB1 # # This procedure is invoked when the header label w of a tablelist widget is # double-clicked. If the pointer is on the right border of the label then the # procedure performs the same action as labelB3Down. #------------------------------------------------------------------------------ proc tablelist::labelDblB1 {w x shiftPressed} { parseLabelPath $w win col upvar ::tablelist::ns${win}::data data if {!$data(isDisabled) && [inResizeArea $w $x col] && $data(-resizablecolumns) && $data($col-resizable)} { if {$shiftPressed} { doColConfig $col $win -width -$data($col-lastStaticWidth) } else { doColConfig $col $win -width 0 } genVirtualEvent $win <<TablelistColumnResized>> $col } } #------------------------------------------------------------------------------ # tablelist::escape # # This procedure is invoked to process <Escape> events in the top-level window |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistConfig.tcl.
1 2 3 | #============================================================================== # Contains private configuration procedures for tablelist widgets. # | | | 1 2 3 4 5 6 7 8 9 10 11 | #============================================================================== # Contains private configuration procedures for tablelist widgets. # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== #------------------------------------------------------------------------------ # tablelist::extendConfigSpecs # # Extends the elements of the array configSpecs. #------------------------------------------------------------------------------ |
︙ | ︙ | |||
1214 1215 1216 1217 1218 1219 1220 | } -background - -foreground { set w $data(body) set name $col$opt | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | } -background - -foreground { set w $data(body) set name $col$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag col$opt-$val in the body text widget # set tag col$opt-$val $w tag configure $tag $opt $val $w tag lower $tag # # Save val in data($name) # set data($name) $val } if {!$data(isDisabled)} { updateColorsWhenIdle $win } } -changesnipside - -wrap { # # Save the boolean value specified by val in data($col$opt) and # make sure the given column will be redisplayed at idle time |
︙ | ︙ | |||
1427 1428 1429 1430 1431 1432 1433 | [string compare $data(-selecttype) "row"] == 0} { foreach row [curSelection $win] { rowSelection $win set $row $row } } } updateViewWhenIdle $win | > | | 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 | [string compare $data(-selecttype) "row"] == 0} { foreach row [curSelection $win] { rowSelection $win set $row $row } } } updateViewWhenIdle $win genVirtualEvent $win <<TablelistColHiddenStateChanged>> $col } } -labelalign { if {[string compare $val ""] == 0} { # # Unset data($col$opt) |
︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 | } -selectbackground - -selectforeground { set w $data(body) set name $col$opt | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 | } -selectbackground - -selectforeground { set w $data(body) set name $col$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag col$opt-$val in the body text widget # set tag col$opt-$val set optTail [string range $opt 7 end] ;# remove the -select $w tag configure $tag -$optTail $val $w tag raise $tag select # # Save val in data($name) # set data($name) $val } if {!$data(isDisabled)} { |
︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 | switch -- $opt { -background - -foreground { set key [lindex $data(keyList) $row] set name $key$opt | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < | 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 | switch -- $opt { -background - -foreground { set key [lindex $data(keyList) $row] set name $key$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag row$opt-$val in the body text widget # set tag row$opt-$val $w tag configure $tag $opt $val $w tag lower $tag active # # Save val in data($name) # set data($name) $val } if {!$data(isDisabled)} { updateColorsWhenIdle $win } } |
︙ | ︙ | |||
2090 2091 2092 2093 2094 2095 2096 2097 | # set colWidthsChanged 0 set colIdxList {} set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } set col 0 | > > > < | | 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 | # set colWidthsChanged 0 set colIdxList {} set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } if {[string match "*\t*" $displayedItem]} { set displayedItem [mapTabs $displayedItem] } set col 0 foreach text $displayedItem {pixels alignment} $data(colList) { if {($data($col-hide) && !$canElide) || $pixels != 0} { incr col continue } getAuxData $win $key $col auxType auxWidth getIndentData $win $key $col indentWidth |
︙ | ︙ | |||
2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 | set data($name) $val } set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } set colWidthsChanged 0 set colIdxList {} set line [expr {$row + 1}] set textIdx1 $line.1 set col 0 | > > > < | | 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 | set data($name) $val } set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } if {[string match "*\t*" $displayedItem]} { set displayedItem [mapTabs $displayedItem] } set colWidthsChanged 0 set colIdxList {} set line [expr {$row + 1}] set textIdx1 $line.1 set col 0 foreach text $displayedItem {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } # # Adjust the cell text and the image or window width |
︙ | ︙ | |||
2391 2392 2393 2394 2395 2396 2397 2398 | # set colWidthsChanged 0 set colIdxList {} set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } set col 0 | > > > < | | 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | # set colWidthsChanged 0 set colIdxList {} set displayedItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $displayedItem] } if {[string match "*\t*" $displayedItem]} { set displayedItem [mapTabs $displayedItem] } set col 0 foreach text $displayedItem {pixels alignment} $data(colList) { if {($data($col-hide) && !$canElide) || $pixels != 0} { incr col continue } getAuxData $win $key $col auxType auxWidth getIndentData $win $key $col indentWidth |
︙ | ︙ | |||
2445 2446 2447 2448 2449 2450 2451 | # is configureWidget, in order to make sure that only # one event per caller proc invocation will be generated # if {[string match "*configureWidget" $callerProc]} { makeStripesWhenIdle $win showLineNumbersWhenIdle $win updateViewWhenIdle $win | > | | 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 | # is configureWidget, in order to make sure that only # one event per caller proc invocation will be generated # if {[string match "*configureWidget" $callerProc]} { makeStripesWhenIdle $win showLineNumbersWhenIdle $win updateViewWhenIdle $win genVirtualEvent $win <<TablelistRowHiddenStateChanged>> $row } } } -name { set key [lindex $data(keyList) $row] if {[string compare $val ""] == 0} { |
︙ | ︙ | |||
2483 2484 2485 2486 2487 2488 2489 | } -selectbackground - -selectforeground { set key [lindex $data(keyList) $row] set name $key$opt | < < < < < < < < < < < < < < < < | 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 | } -selectbackground - -selectforeground { set key [lindex $data(keyList) $row] set name $key$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag row$opt-$val in the body text widget # set tag row$opt-$val set optTail [string range $opt 7 end] ;# remove the -select $w tag configure $tag -$optTail $val $w tag lower $tag active # # Save val in data($name) # set data($name) [$w tag cget $tag -$optTail] } |
︙ | ︙ | |||
2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | set key [lindex $oldItem end] set newItem [adjustItem $val $data(colCount)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $newItem] } else { set displayedItem $newItem } set line [expr {$row + 1}] set textIdx1 $line.1 set col 0 | > > > < | | 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 | set key [lindex $oldItem end] set newItem [adjustItem $val $data(colCount)] if {$data(hasFmtCmds)} { set displayedItem [formatItem $win $key $row $newItem] } else { set displayedItem $newItem } if {[string match "*\t*" $displayedItem]} { set displayedItem [mapTabs $displayedItem] } set line [expr {$row + 1}] set textIdx1 $line.1 set col 0 foreach text $displayedItem] {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } # # Adjust the cell text and the image or window width |
︙ | ︙ | |||
2635 2636 2637 2638 2639 2640 2641 | } } else { set oldText [lindex $oldItem $col] if {[lindex $data(fmtCmdFlagList) $col]} { set oldText \ [formatElem $win $key $row $col $oldText] } | > | > | 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 | } } else { set oldText [lindex $oldItem $col] if {[lindex $data(fmtCmdFlagList) $col]} { set oldText \ [formatElem $win $key $row $col $oldText] } if {[string match "*\t*" $oldText]} { set oldText [mapTabs $oldText] } set oldElemWidth [getElemWidth $win $oldText $auxWidth \ $indentWidth $cellFont] if {$oldElemWidth < $data($col-elemWidth) && $newElemWidth == $data($col-elemWidth)} { incr data($col-widestCount) } elseif {$oldElemWidth == $data($col-elemWidth) && $newElemWidth < $oldElemWidth && |
︙ | ︙ | |||
2750 2751 2752 2753 2754 2755 2756 | switch -- $opt { -background - -foreground { set key [lindex $data(keyList) $row] set name $key,$col$opt | < < < < < < < < < < < < < < < < < < < < < < < | 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 | switch -- $opt { -background - -foreground { set key [lindex $data(keyList) $row] set name $key,$col$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag cell$opt-$val in the body text widget # set tag cell$opt-$val $w tag configure $tag $opt $val $w tag lower $tag disabled # # Save val in data($name) # set data($name) $val } if {!$data(isDisabled)} { updateColorsWhenIdle $win } } |
︙ | ︙ | |||
2870 2871 2872 2873 2874 2875 2876 | # # Adjust the cell text and the image or window width # set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } | > | > | 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 | # # Adjust the cell text and the image or window width # set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels if {$pixels == 0} { ;# convention: dynamic width set textSav $text getAuxData $win $key $col auxType auxWidthSav |
︙ | ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } | > | > | 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set oldText $text set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] if {$pixels == 0} { ;# convention: dynamic width set textSav $text getAuxData $win $key $col auxType auxWidthSav getIndentData $win $key $col indentWidthSav |
︙ | ︙ | |||
3160 3161 3162 3163 3164 3165 3166 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } | > | > | 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set oldText $text set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] if {$pixels == 0} { ;# convention: dynamic width set textSav $text getAuxData $win $key $col auxType auxWidthSav getIndentData $win $key $col indentWidthSav |
︙ | ︙ | |||
3264 3265 3266 3267 3268 3269 3270 | } -selectbackground - -selectforeground { set key [lindex $data(keyList) $row] set name $key,$col$opt | < < < < < < < < < < < < < < < < < < < | 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 | } -selectbackground - -selectforeground { set key [lindex $data(keyList) $row] set name $key,$col$opt if {[string compare $val ""] == 0} { if {[info exists data($name)]} { unset data($name) } } else { # # Configure the tag cell$opt-$val in the body text widget # set tag cell$opt-$val set optTail [string range $opt 7 end] ;# remove the -select $w tag configure $tag -$optTail $val $w tag lower $tag disabled # # Save val in data($name) # set data($name) $val } if {!$data(isDisabled)} { |
︙ | ︙ | |||
3330 3331 3332 3333 3334 3335 3336 | } set pixels [lindex $data(colList) [expr {2*$col}]] set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } | > | > | 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 | } set pixels [lindex $data(colList) [expr {2*$col}]] set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] if {$pixels == 0} { ;# convention: dynamic width if {$data($col-maxPixels) > 0} { if {$data($col-reqPixels) > $data($col-maxPixels)} { set pixels $data($col-maxPixels) } |
︙ | ︙ | |||
3408 3409 3410 3411 3412 3413 3414 | set text $val set oldItem [lindex $data(itemList) $row] set key [lindex $oldItem end] set fmtCmdFlag [lindex $data(fmtCmdFlagList) $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } | > | > | 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 | set text $val set oldItem [lindex $data(itemList) $row] set key [lindex $oldItem end] set fmtCmdFlag [lindex $data(fmtCmdFlagList) $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set textSav $text set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] if {$pixels == 0} { ;# convention: dynamic width getAuxData $win $key $col auxType auxWidthSav getIndentData $win $key $col indentWidthSav |
︙ | ︙ | |||
3514 3515 3516 3517 3518 3519 3520 | adjustColumns $win {} 1 } } else { set oldText [lindex $oldItem $col] if {$fmtCmdFlag} { set oldText [formatElem $win $key $row $col $oldText] } | > | > | 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 | adjustColumns $win {} 1 } } else { set oldText [lindex $oldItem $col] if {$fmtCmdFlag} { set oldText [formatElem $win $key $row $col $oldText] } if {[string match "*\t*" $oldText]} { set oldText [mapTabs $oldText] } set oldElemWidth [getElemWidth $win $oldText $auxWidth \ $indentWidth $cellFont] if {$oldElemWidth < $data($col-elemWidth) && $newElemWidth == $data($col-elemWidth)} { incr data($col-widestCount) } elseif {$oldElemWidth == $data($col-elemWidth) && $newElemWidth < $oldElemWidth && |
︙ | ︙ | |||
3618 3619 3620 3621 3622 3623 3624 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } | > | > | 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 | # set pixels [lindex $data(colList) [expr {2*$col}]] set workPixels $pixels set text [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set oldText $text set multiline [string match "*\n*" $text] set cellFont [getCellFont $win $key $col] if {$pixels == 0} { ;# convention: dynamic width set textSav $text getAuxData $win $key $col auxType auxWidthSav getIndentData $win $key $col indentWidthSav |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistEdit.tcl.
1 2 3 4 5 6 7 8 9 | #============================================================================== # Contains the implementation of interactive cell editing in tablelist widgets. # # Structure of the module: # - Namespace initialization # - Public procedures related to interactive cell editing # - Private procedures implementing the interactive cell editing # - Private procedures used in bindings related to interactive cell editing # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #============================================================================== # Contains the implementation of interactive cell editing in tablelist widgets. # # Structure of the module: # - Namespace initialization # - Public procedures related to interactive cell editing # - Private procedures implementing the interactive cell editing # - Private procedures used in bindings related to interactive cell editing # # Copyright (c) 2003-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
535 536 537 538 539 540 541 542 543 544 545 546 547 548 | $name-isEntryLike 1 \ $name-focusWin {[%W component entry]} \ $name-reservedKeys {Left Right Up Down Control-p Control-n} \ ] return $name } #------------------------------------------------------------------------------ # tablelist::addOakleyCombobox # # Registers Bryan Oakley's combobox widget for interactive cell editing. #------------------------------------------------------------------------------ proc tablelist::addOakleyCombobox {{name combobox}} { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | $name-isEntryLike 1 \ $name-focusWin {[%W component entry]} \ $name-reservedKeys {Left Right Up Down Control-p Control-n} \ ] return $name } #------------------------------------------------------------------------------ # tablelist::addCtext # # Registers the ctext widget for interactive cell editing. #------------------------------------------------------------------------------ proc tablelist::addCtext {{name ctext}} { checkEditWinName $name array set ::tablelist::editWin [list \ $name-creationCmd "ctext %W -padx 2 -pady 2 -wrap none" \ $name-putValueCmd "%W delete 1.0 end; %W insert 1.0 %T" \ $name-getValueCmd "%W get 1.0 end-1c" \ $name-putTextCmd "%W delete 1.0 end; %W insert 1.0 %T" \ $name-getTextCmd "%W get 1.0 end-1c" \ $name-putListCmd "" \ $name-getListCmd "" \ $name-selectCmd "" \ $name-invokeCmd "" \ $name-fontOpt -font \ $name-useFormat 1 \ $name-useReqWidth 0 \ $name-usePadX 0 \ $name-isEntryLike 1 \ $name-focusWin %W.t \ $name-reservedKeys {Left Right Up Down Prior Next Control-Home Control-End Meta-b Meta-f Control-p Control-n Meta-less Meta-greater} \ ] return $name } #------------------------------------------------------------------------------ # tablelist::addOakleyCombobox # # Registers Bryan Oakley's combobox widget for interactive cell editing. #------------------------------------------------------------------------------ proc tablelist::addOakleyCombobox {{name combobox}} { |
︙ | ︙ | |||
857 858 859 860 861 862 863 | # of digits after the decimal point, with or without the -comma option, for # interactive cell editing. #------------------------------------------------------------------------------ proc tablelist::addFixedPointMentry {cnt1 cnt2 args} { # # Check the arguments cnt1 and cnt2 # | | | | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | # of digits after the decimal point, with or without the -comma option, for # interactive cell editing. #------------------------------------------------------------------------------ proc tablelist::addFixedPointMentry {cnt1 cnt2 args} { # # Check the arguments cnt1 and cnt2 # if {![isInteger $cnt1] || $cnt1 <= 0} { return -code error "expected positive integer but got \"$cnt1\"" } if {![isInteger $cnt2] || $cnt2 <= 0} { return -code error "expected positive integer but got \"$cnt2\"" } # # Parse the remaining arguments (if any) # switch [llength $args] { |
︙ | ︙ | |||
1583 1584 1585 1586 1587 1588 1589 | return -code error $result } catch {$w configure -highlightthickness 0} clearTakefocusOpt $w set class [winfo class $w] set isCheckbtn [string match "*Checkbutton" $class] set isMenubtn [string match "*Menubutton" $class] | | > | 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 | return -code error $result } catch {$w configure -highlightthickness 0} clearTakefocusOpt $w set class [winfo class $w] set isCheckbtn [string match "*Checkbutton" $class] set isMenubtn [string match "*Menubutton" $class] set isText [expr {[string compare $class "Text"] == 0 || [string compare $class "Ctext"] == 0}] set isMentry [expr {[string compare $class "Mentry"] == 0}] if {!$isCheckbtn && !$isMenubtn} { catch {$w configure -relief ridge} catch {$w configure -borderwidth 2} } if {$isText && $data($col-wrap) && $::tk_version >= 8.5} { $w configure -wrap word |
︙ | ︙ | |||
1786 1787 1788 1789 1790 1791 1792 | # # Adjust the frame's height # if {$isText} { if {[string compare [$w cget -wrap] "none"] == 0 || $::tk_version < 8.5} { | | > > > > | 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 | # # Adjust the frame's height # if {$isText} { if {[string compare [$w cget -wrap] "none"] == 0 || $::tk_version < 8.5} { set numLines [expr {int([$w index end-1c])}] $w configure -height $numLines update idletasks ;# needed for ctext if {![array exists ::tablelist::ns${win}::data]} { return "" } $f configure -height [winfo reqheight $w] } else { bind $w <Configure> { %W configure -height [%W count -displaylines 1.0 end] [winfo parent %W] configure -height [winfo reqheight %W] } } |
︙ | ︙ | |||
1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 | return "" } set col $data(editCol) # # Invoke the command specified by the -editendcommand option if needed # if {$data(-forceeditendcommand) && [string compare $data(-editendcommand) ""] != 0} { uplevel #0 $data(-editendcommand) \ [list $win $row $col $data(origEditText)] } if {[winfo exists $data(bodyFr)]} { destroy $data(bodyFr) set item [lindex $data(itemList) $row] set key [lindex $item end] foreach opt {-window -image} { if {[info exists data($key,$col$opt)]} { doCellConfig $row $col $win $opt $data($key,$col$opt) break } } doCellConfig $row $col $win -text [lindex $item $col] } focus $data(body) | > | > | | 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | return "" } set col $data(editCol) # # Invoke the command specified by the -editendcommand option if needed # set data(canceled) 1 if {$data(-forceeditendcommand) && [string compare $data(-editendcommand) ""] != 0} { uplevel #0 $data(-editendcommand) \ [list $win $row $col $data(origEditText)] } if {[winfo exists $data(bodyFr)]} { destroy $data(bodyFr) set item [lindex $data(itemList) $row] set key [lindex $item end] foreach opt {-window -image} { if {[info exists data($key,$col$opt)]} { doCellConfig $row $col $win $opt $data($key,$col$opt) break } } doCellConfig $row $col $win -text [lindex $item $col] } focus $data(body) set userData [list $row $col] genVirtualEvent $win <<TablelistCellRestored>> $userData updateViewWhenIdle $win return "" } #------------------------------------------------------------------------------ # tablelist::doFinishEditing |
︙ | ︙ | |||
1939 1940 1941 1942 1943 1944 1945 | doCellConfig $row $col $win -text $text set result 1 } else { set result 0 } focus $data(body) | > > | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | doCellConfig $row $col $win -text $text set result 1 } else { set result 0 } focus $data(body) set userData [list $row $col] genVirtualEvent $win <<TablelistCellUpdated>> $userData } updateViewWhenIdle $win return $result } #------------------------------------------------------------------------------ |
︙ | ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | } } #------------------------------------------------------------------------------ # tablelist::adjustTextHeight # # This procedure is an after-insert and after-delete callback asociated with a | | | | 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | } } #------------------------------------------------------------------------------ # tablelist::adjustTextHeight # # This procedure is an after-insert and after-delete callback asociated with a # (c)text widget used for interactive cell editing. It sets the height of the # edit window to the number of lines currently contained in it. #------------------------------------------------------------------------------ proc tablelist::adjustTextHeight {w args} { if {$::tk_version >= 8.5} { # # Count the display lines (taking into account the line wraps) # set numLines [$w count -displaylines 1.0 end] } else { # # We can only count the logical lines (irrespective of wrapping) # set numLines [expr {int([$w index end-1c])}] } $w configure -height $numLines set path [wcb::pathname $w] [winfo parent $path] configure -height [winfo reqheight $path] } |
︙ | ︙ | |||
2160 2161 2162 2163 2164 2165 2166 | # Saves some data of the edit window associated with the tablelist widget win. #------------------------------------------------------------------------------ proc tablelist::saveEditData win { upvar ::tablelist::ns${win}::data data set w $data(bodyFrEd) set entry $data(editFocus) set class [winfo class $w] | | > | 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 | # Saves some data of the edit window associated with the tablelist widget win. #------------------------------------------------------------------------------ proc tablelist::saveEditData win { upvar ::tablelist::ns${win}::data data set w $data(bodyFrEd) set entry $data(editFocus) set class [winfo class $w] set isText [expr {[string compare $class "Text"] == 0 || [string compare $class "Ctext"] == 0}] set isMentry [expr {[string compare $class "Mentry"] == 0}] # # Miscellaneous data # set name [getEditWindow $win $data(editRow) $data(editCol)] variable editWin |
︙ | ︙ | |||
2267 2268 2269 2270 2271 2272 2273 | # win. #------------------------------------------------------------------------------ proc tablelist::restoreEditData win { upvar ::tablelist::ns${win}::data data set w $data(bodyFrEd) set entry $data(editFocus) set class [winfo class $w] | | > | 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | # win. #------------------------------------------------------------------------------ proc tablelist::restoreEditData win { upvar ::tablelist::ns${win}::data data set w $data(bodyFrEd) set entry $data(editFocus) set class [winfo class $w] set isText [expr {[string compare $class "Text"] == 0 || [string compare $class "Ctext"] == 0}] set isMentry [expr {[string compare $class "Mentry"] == 0}] set isIncrDateTimeWidget [regexp {^(Date.+|Time.+)$} $class] # # Miscellaneous data # set name [getEditWindow $win $data(editRow) $data(editCol)] |
︙ | ︙ | |||
2446 2447 2448 2449 2450 2451 2452 | } } bind TablelistEdit <Control-i> { tablelist::insertChar %W "\t" } bind TablelistEdit <Control-j> { tablelist::insertChar %W "\n" } bind TablelistEdit <Escape> { tablelist::cancelEditing %W } foreach key {Return KP_Enter} { bind TablelistEdit <$key> { | | > | 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | } } bind TablelistEdit <Control-i> { tablelist::insertChar %W "\t" } bind TablelistEdit <Control-j> { tablelist::insertChar %W "\n" } bind TablelistEdit <Escape> { tablelist::cancelEditing %W } foreach key {Return KP_Enter} { bind TablelistEdit <$key> { if {[string compare [winfo class %W] "Text"] == 0 || [string compare [winfo class %W] "Ctext"] == 0} { tablelist::insertChar %W "\n" } else { tablelist::finishEditing %W } } bind TablelistEdit <Control-$key> { tablelist::finishEditing %W |
︙ | ︙ | |||
2599 2600 2601 2602 2603 2604 2605 | # tablelist::insertChar # # Inserts the string str ("\t" or "\n") into the entry-like widget w at the # point of the insertion cursor. #------------------------------------------------------------------------------ proc tablelist::insertChar {w str} { set class [winfo class $w] | | > | 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 | # tablelist::insertChar # # Inserts the string str ("\t" or "\n") into the entry-like widget w at the # point of the insertion cursor. #------------------------------------------------------------------------------ proc tablelist::insertChar {w str} { set class [winfo class $w] if {[string compare $class "Text"] == 0 || [string compare $class "Ctext"] == 0} { if {[string compare $str "\n"] == 0} { eval [strMap {"%W" "$w"} [bind Text <Return>]] } else { eval [strMap {"%W" "$w"} [bind Text <Control-i>]] } return -code break "" } elseif {[regexp {^(T?Entry|TCombobox|T?Spinbox)$} $class]} { |
︙ | ︙ | |||
2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 | set row $data(editRow) set col $data(editCol) set cmd condChangeSelection } else { foreach {row col} $args {} set cmd changeSelection } set oldRow $row set oldCol $col while 1 { incr col $amount if {$col < 0} { | > > > > | 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 | set row $data(editRow) set col $data(editCol) set cmd condChangeSelection } else { foreach {row col} $args {} set cmd changeSelection } if {![doFinishEditing $win]} { return "" } set oldRow $row set oldCol $col while 1 { incr col $amount if {$col < 0} { |
︙ | ︙ | |||
2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | } set win [getTablelistPath $w] upvar ::tablelist::ns${win}::data data set row $data(editRow) set col $data(editCol) while 1 { incr col $amount if {$col < 0 || $col > $data(lastCol)} { return -code break "" } elseif {!$data($col-hide) && [isCellEditable $win $row $col]} { doEditCell $win $row $col 0 condChangeSelection | > > > > | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 | } set win [getTablelistPath $w] upvar ::tablelist::ns${win}::data data set row $data(editRow) set col $data(editCol) if {![doFinishEditing $win]} { return "" } while 1 { incr col $amount if {$col < 0 || $col > $data(lastCol)} { return -code break "" } elseif {!$data($col-hide) && [isCellEditable $win $row $col]} { doEditCell $win $row $col 0 condChangeSelection |
︙ | ︙ | |||
2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | # Moves the edit window into the last or first editable cell that is located in # the specified column and has a row index less/greater than the given one, if # there is such a cell. #------------------------------------------------------------------------------ proc tablelist::goToPrevNextLine {w amount row col cmd} { set win [getTablelistPath $w] upvar ::tablelist::ns${win}::data data while 1 { incr row $amount if {$row < 0 || $row > $data(lastRow)} { return 0 } elseif {[isRowViewable $win $row] && [isCellEditable $win $row $col]} { | > > > > | 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 | # Moves the edit window into the last or first editable cell that is located in # the specified column and has a row index less/greater than the given one, if # there is such a cell. #------------------------------------------------------------------------------ proc tablelist::goToPrevNextLine {w amount row col cmd} { set win [getTablelistPath $w] upvar ::tablelist::ns${win}::data data if {![doFinishEditing $win]} { return "" } while 1 { incr row $amount if {$row < 0 || $row > $data(lastRow)} { return 0 } elseif {[isRowViewable $win $row] && [isCellEditable $win $row $col]} { |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistImages.tcl.
1 2 3 4 5 | #============================================================================== # Contains procedures that create various bitmap and photo images. The # argument w specifies a canvas displaying a sort arrow, while the argument win # stands for a tablelist widget. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #============================================================================== # Contains procedures that create various bitmap and photo images. The # argument w specifies a canvas displaying a sort arrow, while the argument win # stands for a tablelist widget. # # Copyright (c) 2006-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== #------------------------------------------------------------------------------ # tablelist::flat6x4Arrows #------------------------------------------------------------------------------ proc tablelist::flat6x4Arrows w { image create bitmap triangleUp$w -data " |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistMove.tcl.
1 2 3 | #============================================================================== # Contains the implementation of the tablelist move and movecolumn subcommands. # | | | 1 2 3 4 5 6 7 8 9 10 11 | #============================================================================== # Contains the implementation of the tablelist move and movecolumn subcommands. # # Copyright (c) 2003-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== #------------------------------------------------------------------------------ # tablelist::moveRow # # Processes the 1st form of the tablelist move subcommand. #------------------------------------------------------------------------------ |
︙ | ︙ | |||
155 156 157 158 159 160 161 162 | set targetLine [expr {$target1 + 1}] $w insert $targetLine.0 "\n" set snipStr $data(-snipstring) set dispItem [lrange $sourceItem 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $sourceKey $source $dispItem] } set col 0 | > > > < | < | | < < | < | < | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | set targetLine [expr {$target1 + 1}] $w insert $targetLine.0 "\n" set snipStr $data(-snipstring) set dispItem [lrange $sourceItem 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $sourceKey $source $dispItem] } if {[string match "*\t*" $dispItem]} { set dispItem [mapTabs $dispItem] } set col 0 foreach text $dispItem colTags $data(colTagsList) \ {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } # # Build the list of tags to be applied to the cell # set cellFont [getCellFont $win $sourceKey $col] set cellTags $colTags if {[info exists data($sourceKey,$col-font)]} { lappend cellTags cell-font-$data($sourceKey,$col-font) } # # Append the text and the labels or window (if # any) to the target line of the body text widget # appendComplexElem $win $sourceKey $source $col $text $pixels \ $alignment $snipStr $cellFont $cellTags $targetLine incr col } if {[info exists data($sourceKey-font)]} { $w tag add row-font-$data($sourceKey-font) $targetLine.0 $targetLine.end } if {[info exists data($sourceKey-elide)]} { $w tag add elidedRow $targetLine.0 $targetLine.end+1c } if {[info exists data($sourceKey-hide)]} { $w tag add hiddenRow $targetLine.0 $targetLine.end+1c } |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistSort.tcl.
1 2 3 4 5 6 7 8 9 | #============================================================================== # Contains the implementation of the tablelist::sortByColumn and # tablelist::addToSortColumns commands, as well as of the tablelist sort, # sortbycolumn, and sortbycolumnlist subcommands. # # Structure of the module: # - Public procedures related to sorting # - Private procedures implementing the sorting # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #============================================================================== # Contains the implementation of the tablelist::sortByColumn and # tablelist::addToSortColumns commands, as well as of the tablelist sort, # sortbycolumn, and sortbycolumnlist subcommands. # # Structure of the module: # - Public procedures related to sorting # - Private procedures implementing the sorting # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Public procedures related to sorting # ==================================== # |
︙ | ︙ | |||
53 54 55 56 57 58 59 | set sortOrder increasing } # # Sort the widget's contents based on the given column # if {[catch {::$win sortbycolumn $col -$sortOrder} result] == 0} { | > | > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | set sortOrder increasing } # # Sort the widget's contents based on the given column # if {[catch {::$win sortbycolumn $col -$sortOrder} result] == 0} { set userData [list $col $sortOrder] genVirtualEvent $win <<TablelistColumnSorted>> $userData return $sortOrder } else { return -code error $result } } #------------------------------------------------------------------------------ |
︙ | ︙ | |||
112 113 114 115 116 117 118 | # # Sort the widget's contents according to the # modified lists of sort columns and orders # if {[catch {::$win sortbycolumnlist $sortColList $sortOrderList} result] == 0} { | > | > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | # # Sort the widget's contents according to the # modified lists of sort columns and orders # if {[catch {::$win sortbycolumnlist $sortColList $sortOrderList} result] == 0} { set userData [list $sortColList $sortOrderList] genVirtualEvent $win <<TablelistColumnsSorted>> $userData return $sortOrder } else { return -code error $result } } # |
︙ | ︙ | |||
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | set key [lindex $item end] lappend descKeyList $key set data($key-row) $row set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } # # Clip the elements if necessary and # insert them with the corresponding tags # if {$rowTagRefCount == 0} { set hasRowFont 0 } else { set hasRowFont [info exists data($key-font)] } set col 0 if {$isSimple} { set insertArgs {} set multilineData {} | > > > | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | set key [lindex $item end] lappend descKeyList $key set data($key-row) $row set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } if {[string match "*\t*" $dispItem]} { set dispItem [mapTabs $dispItem] } # # Clip the elements if necessary and # insert them with the corresponding tags # if {$rowTagRefCount == 0} { set hasRowFont 0 } else { set hasRowFont [info exists data($key-font)] } set col 0 if {$isSimple} { set insertArgs {} set multilineData {} foreach text $dispItem \ colFont $data(colFontList) \ colTags $data(colTagsList) \ {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } |
︙ | ︙ | |||
418 419 420 421 422 423 424 | set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) | < < < < < | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) } } # # Clip the element if necessary # set multiline [string match "*\n*" $text] |
︙ | ︙ | |||
486 487 488 489 490 491 492 | findTabs $win $line $col $col tabIdx1 tabIdx2 set msgScript [list ::tablelist::displayText $win $key \ $col $text $font $pixels $alignment] $w window create $tabIdx2 -pady $padY -create $msgScript } } else { | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | findTabs $win $line $col $col tabIdx1 tabIdx2 set msgScript [list ::tablelist::displayText $win $key \ $col $text $font $pixels $alignment] $w window create $tabIdx2 -pady $padY -create $msgScript } } else { foreach text $dispItem \ colFont $data(colFontList) \ colTags $data(colTagsList) \ {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } |
︙ | ︙ | |||
508 509 510 511 512 513 514 | set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) | < < < < < < | | < | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) } } # # Insert the text and the label or window # (if any) into the body text widget # appendComplexElem $win $key $row $col $text $pixels \ $alignment $snipStr $cellFont $cellTags $line incr col } } if {$rowTagRefCount != 0} { if {[info exists data($key-font)]} { $w tag add row-font-$data($key-font) $line.0 $line.end } } if {[info exists data($key-elide)]} { $w tag add elidedRow $line.0 $line.end+1c } if {[info exists data($key-hide)]} { |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistThemes.tcl.
1 2 3 4 5 6 7 8 9 10 | #============================================================================== # Contains procedures that populate the array themeDefaults with theme-specific # default values of some tablelist configuration options. # # Structure of the module: # - Public procedures related to tile themes # - Private procedures related to tile themes # - Private procedures performing RGB <-> HSV conversions # - Private procedures related to global KDE configuration options # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #============================================================================== # Contains procedures that populate the array themeDefaults with theme-specific # default values of some tablelist configuration options. # # Structure of the module: # - Public procedures related to tile themes # - Private procedures related to tile themes # - Private procedures performing RGB <-> HSV conversions # - Private procedures related to global KDE configuration options # # Copyright (c) 2005-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Public procedures related to tile themes # ======================================== # |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistUtil.tcl.
1 2 3 4 5 6 7 | #============================================================================== # Contains private utility procedures for tablelist widgets. # # Structure of the module: # - Namespace initialization # - Private utility procedures # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #============================================================================== # Contains private utility procedures for tablelist widgets. # # Structure of the module: # - Namespace initialization # - Private utility procedures # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
64 65 66 67 68 69 70 | # tablelist. checkRange must be a boolean value: if true, it is additionally # checked whether the numerical value corresponding to idx is within the # allowed range. #------------------------------------------------------------------------------ proc tablelist::rowIndex {win idx endIsSize {checkRange 0}} { upvar ::tablelist::ns${win}::data data | | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | # tablelist. checkRange must be a boolean value: if true, it is additionally # checked whether the numerical value corresponding to idx is within the # allowed range. #------------------------------------------------------------------------------ proc tablelist::rowIndex {win idx endIsSize {checkRange 0}} { upvar ::tablelist::ns${win}::data data if {[isInteger $idx]} { set index [expr {int($idx)}] } elseif {[string first $idx "end"] == 0} { if {$endIsSize} { set index $data(itemCount) } else { set index $data(lastRow) } } elseif {[string first $idx "top"] == 0} { |
︙ | ︙ | |||
127 128 129 130 131 132 133 | # error. checkRange must be a boolean value: if true, it is additionally # checked whether the numerical value corresponding to idx is within the # allowed range. #------------------------------------------------------------------------------ proc tablelist::colIndex {win idx checkRange {decrX 1}} { upvar ::tablelist::ns${win}::data data | | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | # error. checkRange must be a boolean value: if true, it is additionally # checked whether the numerical value corresponding to idx is within the # allowed range. #------------------------------------------------------------------------------ proc tablelist::colIndex {win idx checkRange {decrX 1}} { upvar ::tablelist::ns${win}::data data if {[isInteger $idx]} { set index [expr {int($idx)}] } elseif {[string first $idx "end"] == 0} { set index $data(lastCol) } elseif {[string first $idx "left"] == 0} { return [colIndex $win @0,0 $checkRange 0] } elseif {[string first $idx "right"] == 0} { return [colIndex $win @$data(rightX),0 $checkRange 0] } elseif {[string first $idx "active"] == 0 && [string length $idx] >= 2} { |
︙ | ︙ | |||
410 411 412 413 414 415 416 | # # Returns the row of the child item identified by childIdx of the node given by # parentKey within the tablelist widget win. #------------------------------------------------------------------------------ proc tablelist::nodeRow {win parentKey childIdx} { upvar ::tablelist::ns${win}::data data | | | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | # # Returns the row of the child item identified by childIdx of the node given by # parentKey within the tablelist widget win. #------------------------------------------------------------------------------ proc tablelist::nodeRow {win parentKey childIdx} { upvar ::tablelist::ns${win}::data data if {[isInteger $childIdx]} { if {$childIdx < [llength $data($parentKey-children)]} { set childKey [lindex $data($parentKey-children) $childIdx] return [keyToRow $win $childKey] } else { return [expr {[keyToRow $win $parentKey] + [descCount $win $parentKey] + 1}] } } elseif {[string first $childIdx "end"] == 0} { return [expr {[keyToRow $win $parentKey] + |
︙ | ︙ | |||
597 598 599 600 601 602 603 | } # # Remove the elements with names of the form k*,$col-* # foreach name [array names data k*,$col-*] { unset data($name) | | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | } # # Remove the elements with names of the form k*,$col-* # foreach name [array names data k*,$col-*] { unset data($name) if {[string match "k*,$col-font" $name]} { incr data(cellTagRefCount) -1 } elseif {[string match "k*,$col-image" $name]} { incr data(imgCount) -1 } elseif {[string match "k*,$col-window" $name]} { incr data(winCount) -1 } elseif {[string match "k*,$col-indent" $name]} { incr data(indentCount) -1 |
︙ | ︙ | |||
1898 1899 1900 1901 1902 1903 1904 | lappend data(colFontList) $data($col-font) lappend tagNames col-font-$data($col-font) set data(hasColTags) 1 } else { lappend data(colFontList) $widgetFont } | < < < < < < < | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 | lappend data(colFontList) $data($col-font) lappend tagNames col-font-$data($col-font) set data(hasColTags) 1 } else { lappend data(colFontList) $widgetFont } if {$viewable && $data($col-hide) && $canElide} { lappend tagNames hiddenCol set data(hasColTags) 1 } lappend data(colTagsList) $tagNames } |
︙ | ︙ | |||
2014 2015 2016 2017 2018 2019 2020 | # # Get the column alignment # set alignment left if {[incr n] < $argCount} { set next [lindex $columns $n] | | | 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 | # # Get the column alignment # set alignment left if {[incr n] < $argCount} { set next [lindex $columns $n] if {[isInteger $next]} { incr n -1 } else { set alignment [mwutil::fullOpt "alignment" $next $alignments] } } # |
︙ | ︙ | |||
2858 2859 2860 2861 2862 2863 2864 | continue } set text [lindex $item $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } | > | > | 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 | continue } set text [lindex $item $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } getAuxData $win $key $col auxType auxWidth getIndentData $win $key $col indentWidth set cellFont [getCellFont $win $key $col] set elemWidth [getElemWidth $win $text $auxWidth $indentWidth $cellFont] if {$elemWidth == $data($col-elemWidth)} { incr data($col-widestCount) } elseif {$elemWidth > $data($col-elemWidth)} { |
︙ | ︙ | |||
3175 3176 3177 3178 3179 3180 3181 | set updateAll 0 } if {$data(itemCount) == 0 || $data(colCount) == 0} { return "" } | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 | set updateAll 0 } if {$data(itemCount) == 0 || $data(colCount) == 0} { return "" } if {$updateAll} { if {$data(isDisabled)} { $w tag add disabled $fromTextIdx $toTextIdx } set topLine [expr {int([$w index @0,0])}] set btmLine [expr {int([$w index @0,$data(btmY)])}] for {set line $topLine; set row [expr {$line - 1}]} \ {$line <= $btmLine} {set row $line; incr line} { set key [lindex $data(keyList) $row] if {[info exists data($key-elide)] || [info exists data($key-hide)]} { continue } # # Handle the -(select)background and -(select)foreground # column, row, and cell configuration options in this row # set textIdx1 $line.0 for {set col 0} {$col < $data(colCount)} {incr col} { if {$data($col-hide) && !$canElide} { continue } set tabIdx2 [$w search -elide "\t" $textIdx1+1c $line.end] set selected [expr \ {[lsearch -exact [$w tag names $tabIdx2] select] >= 0}] set textIdx2 $tabIdx2+1c foreach optTail {background foreground} { set normalOpt -$optTail set selectOpt -select$optTail foreach level [list col row cell] \ normalName [list $col$normalOpt $key$normalOpt \ $key,$col$normalOpt] \ selectName [list $col$selectOpt $key$selectOpt \ $key,$col$selectOpt] { if {$selected} { if {[info exists data($normalName)]} { $w tag remove \ $level$normalOpt-$data($normalName) \ $textIdx1 $textIdx2 } if {[info exists data($selectName)]} { $w tag add \ $level$selectOpt-$data($selectName) \ $textIdx1 $textIdx2 } } else { if {[info exists data($selectName)]} { $w tag remove \ $level$selectOpt-$data($selectName) \ $textIdx1 $textIdx2 } if {[info exists data($normalName)]} { $w tag add \ $level$normalOpt-$data($normalName) \ $textIdx1 $textIdx2 } } } } set textIdx1 $textIdx2 } } } set hasExpCollCtrlSelImgs [expr {$::tk_version >= 8.3 && [info exists tablelist::$data(-treestyle)_collapsedSelImg]}] foreach {dummy path textIdx} [$w dump -window $fromTextIdx $toTextIdx] { if {[string compare $path ""] == 0} { |
︙ | ︙ | |||
3806 3807 3808 3809 3810 3811 3812 | incr col continue } if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } | > | > < < < < < | 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 | incr col continue } if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } # # Build the list of tags to be applied to the cell # if {$hasRowFont} { set cellFont $data($key-font) } else { set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) } } # # Clip the element if necessary # set multiline [string match "*\n*" $text] |
︙ | ︙ | |||
3909 3910 3911 3912 3913 3914 3915 | incr col continue } if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } | > | > < < < < < < | | < | 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 | incr col continue } if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } # # Build the list of tags to be applied to the cell # if {$hasRowFont} { set cellFont $data($key-font) } else { set cellFont $colFont } set cellTags $colTags if {$cellTagRefCount != 0} { if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) lappend cellTags cell-font-$data($key,$col-font) } } # # Insert the text and the label or window # (if any) into the body text widget # appendComplexElem $win $key $row $col $text $pixels \ $alignment $snipStr $cellFont $cellTags $line incr col } } if {$rowTagRefCount != 0} { if {[info exists data($key-font)]} { $w tag add row-font-$data($key-font) $line.0 $line.end } } if {[info exists data($key-elide)]} { $w tag add elidedRow $line.0 $line.end+1c } if {[info exists data($key-hide)]} { |
︙ | ︙ | |||
4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 | # # Format the item # set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } set tabIdx1 $line.0 set col 0 | > > > | > > > > > > > > > > > > > > | < | 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 | # # Format the item # set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } if {[string match "*\t*" $dispItem]} { set dispItem [mapTabs $dispItem] } set tabIdx1 $line.0 set col 0 foreach text $dispItem \ colFont $data(colFontList) \ colTags $data(colTagsList) \ {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } set tabIdx2 [$w search $elide "\t" $tabIdx1+1c $line.end] # # Nothing to do if the text is empty or is already displayed, # or if interactive editing for this cell is in progress # if {[string compare $text ""] == 0 || [string compare [$w get $tabIdx1+1c $tabIdx2] ""] != 0 || ($row == $data(editRow) && $col == $data(editCol))} { set tabIdx1 [$w index $tabIdx2+1c] incr col continue } if {$pixels == 0} { ;# convention: dynamic width if {$data($col-maxPixels) > 0} { if {$data($col-reqPixels) > $data($col-maxPixels)} { set pixels $data($col-maxPixels) } } } if {$pixels != 0} { incr pixels $data($col-delta) } # # Nothing to do if the cell has an image or window # set aux [getAuxData $win $key $col auxType auxWidth $pixels] if {$auxWidth != 0} { set tabIdx1 [$w index $tabIdx2+1c] incr col continue } # # Adjust the cell text # set multiline [string match "*\n*" $text] set indent [getIndentData $win $key $col indentWidth] set maxTextWidth $pixels if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) } elseif {[info exists data($key-font)]} { set cellFont $data($key-font) } else { |
︙ | ︙ | |||
4199 4200 4201 4202 4203 4204 4205 | # # Adjust the cell text and the image or window width # set text [lindex $item $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } | > | > | 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 | # # Adjust the cell text and the image or window width # set text [lindex $item $col] if {$fmtCmdFlag} { set text [formatElem $win $key $row $col $text] } if {[string match "*\t*" $text]} { set text [mapTabs $text] } set multiline [string match "*\n*" $text] set aux [getAuxData $win $key $col auxType auxWidth $pixels] set indent [getIndentData $win $key $col indentWidth] set maxTextWidth $pixels if {[info exists data($key,$col-font)]} { set cellFont $data($key,$col-font) } elseif {[info exists data($key-font)]} { |
︙ | ︙ |
Changes to modules/tablelist/scripts/tablelistWidget.tcl.
1 2 3 4 5 6 7 8 9 10 | #============================================================================== # Contains the implementation of the tablelist widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedure creating a new tablelist widget # - Private procedures implementing the tablelist widget command # - Private callback procedures # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #============================================================================== # Contains the implementation of the tablelist widget. # # Structure of the module: # - Namespace initialization # - Private procedure creating the default bindings # - Public procedure creating a new tablelist widget # - Private procedures implementing the tablelist widget command # - Private callback procedures # # Copyright (c) 2000-2013 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Namespace initialization # ======================== # |
︙ | ︙ | |||
345 346 347 348 349 350 351 | lappend cellConfigSpecs(-stretchwindow) - 0 # # Use a list to facilitate the handling of the command options # variable cmdOpts [list \ activate activatecell applysorting attrib bbox bodypath bodytag \ | | | | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | lappend cellConfigSpecs(-stretchwindow) - 0 # # Use a list to facilitate the handling of the command options # variable cmdOpts [list \ activate activatecell applysorting attrib bbox bodypath bodytag \ canceledediting cancelediting cellattrib cellbbox cellcget \ cellconfigure cellindex cellselection cget childcount childindex \ childkeys collapse collapseall columnattrib columncget columnconfigure \ columncount columnindex columnwidth config configcelllist configcells \ configcolumnlist configcolumns configrowlist configrows configure \ containing containingcell containingcolumn cornerlabelpath cornerpath \ curcellselection curselection depth delete deletecolumns \ descendantcount editcell editinfo editwinpath editwintag entrypath \ expand expandall expandedkeys fillcolumn finishediting formatinfo get \ getcells getcolumns getformatted getformattedcells \ getformattedcolumns getfullkeys getkeys hasattrib hascellattrib \ |
︙ | ︙ | |||
426 427 428 429 430 431 432 | # # The array maxIndentDepths holds the current max. # indentation depth for every tree style in use # variable maxIndentDepths # | | | | | < < | < < < < < | | < | < < < > > > > > > > > > > > > > > > > > > > > > | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | # # The array maxIndentDepths holds the current max. # indentation depth for every tree style in use # variable maxIndentDepths # # Define the command mapTabs, which returns the string obtained by # replacing all \t characters in its argument with \\t, as well as # the commands strMap and isInteger, needed because the "string map" # and "string is" commands were not available in Tcl 8.0 and 8.1.0 # if {[catch {string map {} ""}] == 0} { interp alias {} ::tablelist::mapTabs {} string map {"\t" "\\t"} interp alias {} ::tablelist::strMap {} string map } else { proc mapTabs str { return [regsub -all "\t" $str "\\t"] } proc strMap {charMap str} { foreach {key val} $charMap { # # We will only need this for noncritical key and str values # regsub -all $key $str $val str } return $str } } if {[catch {string is integer "0"}] == 0} { interp alias {} ::tablelist::isInteger {} string is integer -strict } else { proc isInteger str { return [expr {[catch {format "%d" $str}] == 0}] } } # # Define the command genVirtualEvent, needed because the -data option of the # "event generate" command was not available in Tk versions earlier than 8.5 # if {[catch {event generate . <<__>> -data ""}] == 0} { proc genVirtualEvent {win event userData} { event generate $win $event -data $userData } } else { proc genVirtualEvent {win event userData} { event generate $win $event } } interp alias {} ::tablelist::configSubCmd \ {} ::tablelist::configureSubCmd interp alias {} ::tablelist::insertchildSubCmd \ {} ::tablelist::insertchildrenSubCmd } |
︙ | ︙ | |||
642 643 644 645 646 647 648 649 650 651 652 653 654 655 | labelClicked 0 arrowColList {} sortColList {} sortOrder "" editKey "" editRow -1 editCol -1 fmtKey "" fmtRow -1 fmtCol -1 prevCell "" prevCol -1 forceAdjust 0 fmtCmdFlagList {} | > | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | labelClicked 0 arrowColList {} sortColList {} sortOrder "" editKey "" editRow -1 editCol -1 canceled 0 fmtKey "" fmtRow -1 fmtCol -1 prevCell "" prevCol -1 forceAdjust 0 fmtCmdFlagList {} |
︙ | ︙ | |||
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | if {[llength $argList] != 0} { mwutil::wrongNumArgs "$win bodytag" } upvar ::tablelist::ns${win}::data data return $data(bodyTag) } #------------------------------------------------------------------------------ # tablelist::canceleditingSubCmd #------------------------------------------------------------------------------ proc tablelist::canceleditingSubCmd {win argList} { if {[llength $argList] != 0} { mwutil::wrongNumArgs "$win cancelediting" | > > > > > > > > > > > > | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | if {[llength $argList] != 0} { mwutil::wrongNumArgs "$win bodytag" } upvar ::tablelist::ns${win}::data data return $data(bodyTag) } #------------------------------------------------------------------------------ # tablelist::cancelededitingSubCmd #------------------------------------------------------------------------------ proc tablelist::cancelededitingSubCmd {win argList} { if {[llength $argList] != 0} { mwutil::wrongNumArgs "$win canceledediting" } upvar ::tablelist::ns${win}::data data return $data(canceled) } #------------------------------------------------------------------------------ # tablelist::canceleditingSubCmd #------------------------------------------------------------------------------ proc tablelist::canceleditingSubCmd {win argList} { if {[llength $argList] != 0} { mwutil::wrongNumArgs "$win cancelediting" |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win | < < | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win } return "" } #------------------------------------------------------------------------------ # tablelist::collapseallSubCmd |
︙ | ︙ | |||
1473 1474 1475 1476 1477 1478 1479 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win | < | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win return "" } #------------------------------------------------------------------------------ # tablelist::columnattribSubCmd #------------------------------------------------------------------------------ proc tablelist::columnattribSubCmd {win argList} { |
︙ | ︙ | |||
2088 2089 2090 2091 2092 2093 2094 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win | < | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win } return "" } #------------------------------------------------------------------------------ # tablelist::expandallSubCmd |
︙ | ︙ | |||
2166 2167 2168 2169 2170 2171 2172 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win | < | 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 | makeStripes $win showLineNumbersWhenIdle $win adjustElidedText $win redisplayVisibleItems $win updateColorsWhenIdle $win adjustSepsWhenIdle $win updateVScrlbarWhenIdle $win return "" } #------------------------------------------------------------------------------ # tablelist::expandedkeysSubCmd #------------------------------------------------------------------------------ proc tablelist::expandedkeysSubCmd {win argList} { |
︙ | ︙ | |||
2985 2986 2987 2988 2989 2990 2991 | upvar ::tablelist::ns${win}::data data set item [lindex $data(itemList) $row] set key [lindex $item end] set fullText [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set fullText [formatElem $win $key $row $col $fullText] } | > | > | 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 | upvar ::tablelist::ns${win}::data data set item [lindex $data(itemList) $row] set key [lindex $item end] set fullText [lindex $item $col] if {[lindex $data(fmtCmdFlagList) $col]} { set fullText [formatElem $win $key $row $col $fullText] } if {[string match "*\t*" $fullText]} { set fullText [mapTabs $fullText] } set pixels [lindex $data(colList) [expr {2*$col}]] if {$pixels == 0} { ;# convention: dynamic width if {$data($col-maxPixels) > 0 && $data($col-reqPixels) > $data($col-maxPixels)} { set pixels $data($col-maxPixels) } |
︙ | ︙ | |||
3934 3935 3936 3937 3938 3939 3940 | if {[string compare $data(-selecttype) "row"] == 0} { foreach row [curSelection $win] { rowSelection $win set $row $row } } updateViewWhenIdle $win | | > > > | | 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | if {[string compare $data(-selecttype) "row"] == 0} { foreach row [curSelection $win] { rowSelection $win set $row $row } } updateViewWhenIdle $win genVirtualEvent $win <<TablelistColHiddenStateChanged>> $colIdxList return "" } #------------------------------------------------------------------------------ # tablelist::togglerowhideSubCmd #------------------------------------------------------------------------------ proc tablelist::togglerowhideSubCmd {win argList} { set argCount [llength $argList] if {$argCount < 1 || $argCount > 2} { mwutil::wrongNumArgs "$win togglerowhide firstIndex lastIndex" \ "$win togglerowhide indexList" } synchronize $win displayItems $win set first [lindex $argList 0] # # Toggle the value of the -hide option of the specified rows # set rowIdxList {} set count 0 if {$argCount == 1} { foreach elem $first { set row [rowIndex $win $elem 0 1] doRowConfig $row $win -hide [expr {![doRowCget $row $win -hide]}] incr count lappend rowIdxList $row } } else { set firstRow [rowIndex $win $first 0 1] set lastRow [rowIndex $win [lindex $argList 1] 0 1] for {set row $firstRow} {$row <= $lastRow} {incr row} { doRowConfig $row $win -hide [expr {![doRowCget $row $win -hide]}] incr count lappend rowIdxList $row } } if {$count != 0} { makeStripesWhenIdle $win showLineNumbersWhenIdle $win updateViewWhenIdle $win genVirtualEvent $win <<TablelistRowHiddenStateChanged>> $rowIdxList } return "" } #------------------------------------------------------------------------------ # tablelist::toplevelkeySubCmd |
︙ | ︙ | |||
4374 4375 4376 4377 4378 4379 4380 | } if {$lastCol < $firstCol} { set tmp $firstCol set firstCol $lastCol set lastCol $tmp } | | | | | | | < < < < < < < < < < < < < < < < < < < < | | 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 | } if {$lastCol < $firstCol} { set tmp $firstCol set firstCol $lastCol set lastCol $tmp } set fromTextIdx [expr {$firstRow + 1}].0 set toTextIdx [expr {$lastRow + 1}].end # # Find the (partly) selected lines of the body text widget # in the text range specified by the two cell indices # set w $data(body) variable canElide variable elide set selRange [$w tag nextrange select $fromTextIdx $toTextIdx] while {[llength $selRange] != 0} { set selStart [lindex $selRange 0] set line [expr {int($selStart)}] set row [expr {$line - 1}] set key [lindex $data(keyList) $row] # # Deselect the relevant elements of the row # findTabs $win $line $firstCol $lastCol firstTabIdx lastTabIdx set textIdx1 $firstTabIdx for {set col $firstCol} {$col <= $lastCol} {incr col} { if {$data($col-hide) && !$canElide} { continue } set textIdx2 \ [$w search $elide "\t" $textIdx1+1c $lastTabIdx+1c]+1c $w tag remove select $textIdx1 $textIdx2 set textIdx1 $textIdx2 } set selRange \ [$w tag nextrange select "$selStart lineend" $toTextIdx] } updateColorsWhenIdle $win return "" } includes { |
︙ | ︙ | |||
4493 4494 4495 4496 4497 4498 4499 | # set key [lindex $data(keyList) $row] if {[info exists data($key-selectable)]} { continue } # | | < < < < < < < < < < < < < < < < < < < < < | 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 | # set key [lindex $data(keyList) $row] if {[info exists data($key-selectable)]} { continue } # # Select the relevant elements of the row # findTabs $win $line $firstCol $lastCol firstTabIdx lastTabIdx set textIdx1 $firstTabIdx for {set col $firstCol} {$col <= $lastCol} {incr col} { if {$data($col-hide) && !$canElide} { continue } set textIdx2 \ [$w search $elide "\t" $textIdx1+1c $lastTabIdx+1c]+1c $w tag add select $textIdx1 $textIdx2 set textIdx1 $textIdx2 } } # # If the selection is exported and there are any selected # cells in the widget then make win the new owner of the |
︙ | ︙ | |||
4778 4779 4780 4781 4782 4783 4784 | # Format the item # set key [lindex $item end] set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } | > > | > < | | 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 | # Format the item # set key [lindex $item end] set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } if {[string match "*\t*" $dispItem]} { set dispItem [mapTabs $dispItem] } set col 0 foreach text $dispItem {pixels alignment} $data(colList) { if {($data($col-hide) && !$canElide) || $pixels != 0} { incr col continue } getAuxData $win $key $col auxType auxWidth getIndentData $win $key $col indentWidth |
︙ | ︙ | |||
4839 4840 4841 4842 4843 4844 4845 | if {$count != $data(itemCount)} { lappend data(freeKeyList) $key } foreach opt {-background -foreground -font} { if {[info exists data($key$opt)]} { unset data($key$opt) | > | > | 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 | if {$count != $data(itemCount)} { lappend data(freeKeyList) $key } foreach opt {-background -foreground -font} { if {[info exists data($key$opt)]} { unset data($key$opt) if {[string compare $opt "-font"] == 0} { incr data(rowTagRefCount) -1 } } } set isElided [info exists data($key-elide)] set isHidden [info exists data($key-hide)] if {$isElided && $isHidden} { unset data($key-elide) unset data($key-hide) |
︙ | ︙ | |||
4902 4903 4904 4905 4906 4907 4908 | unset attribs($name) } for {set col 0} {$col < $data(colCount)} {incr col} { foreach opt {-background -foreground -font} { if {[info exists data($key,$col$opt)]} { unset data($key,$col$opt) | > | > | 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 | unset attribs($name) } for {set col 0} {$col < $data(colCount)} {incr col} { foreach opt {-background -foreground -font} { if {[info exists data($key,$col$opt)]} { unset data($key,$col$opt) if {[string compare $opt "-font"] == 0} { incr data(cellTagRefCount) -1 } } } foreach opt {-editable -editwindow -selectbackground -selectforeground -windowdestroy -windowupdate} { if {[info exists data($key,$col$opt)]} { unset data($key,$col$opt) } |
︙ | ︙ | |||
5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 | # # Format the item # set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } if {$isEmpty} { set isEmpty 0 } else { $w insert $line.0 "\n" } if {$data(nonViewableRowCount) != 0} { $w tag remove elidedRow $line.0 $w tag remove hiddenRow $line.0 } set multilineData {} set col 0 if {$data(hasColTags)} { set insertArgs {} | > > > | | 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 | # # Format the item # set dispItem [lrange $item 0 $data(lastCol)] if {$data(hasFmtCmds)} { set dispItem [formatItem $win $key $row $dispItem] } if {[string match "*\t*" $dispItem]} { set dispItem [mapTabs $dispItem] } if {$isEmpty} { set isEmpty 0 } else { $w insert $line.0 "\n" } if {$data(nonViewableRowCount) != 0} { $w tag remove elidedRow $line.0 $w tag remove hiddenRow $line.0 } set multilineData {} set col 0 if {$data(hasColTags)} { set insertArgs {} foreach text $dispItem \ colFont $data(colFontList) \ colTags $data(colTagsList) \ {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } |
︙ | ︙ | |||
5391 5392 5393 5394 5395 5396 5397 | # if {[llength $insertArgs] != 0} { eval [list $w insert $line.0] $insertArgs } } else { set insertStr "" | < | | 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 | # if {[llength $insertArgs] != 0} { eval [list $w insert $line.0] $insertArgs } } else { set insertStr "" foreach text $dispItem {pixels alignment} $data(colList) { if {$data($col-hide) && !$canElide} { incr col continue } # # Update the column width or clip the element if necessary |
︙ | ︙ | |||
5553 5554 5555 5556 5557 5558 5559 | # # Check the column alignment # set alignment left if {[incr n] < $argCount} { set next [lindex $argList $n] | | | 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 | # # Check the column alignment # set alignment left if {[incr n] < $argCount} { set next [lindex $argList $n] if {[isInteger $next]} { incr n -1 } else { mwutil::fullOpt "alignment" $next $alignments } } incr count |
︙ | ︙ | |||
6039 6040 6041 6042 6043 6044 6045 | # if {$last < $first} { set tmp $first set first $last set last $tmp } | | | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < < < < | 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 | # if {$last < $first} { set tmp $first set first $last set last $tmp } set fromTextIdx [expr {$first + 1}].0 set toTextIdx [expr {$last + 1}].end $data(body) tag remove select $fromTextIdx $toTextIdx updateColorsWhenIdle $win return "" } includes { set w $data(body) set line [expr {$first + 1}] set selRange [$w tag nextrange select $line.0 $line.end] return [expr {[llength $selRange] > 0}] } set { # # Swap the indices if necessary and adjust # the range to fit within the existing items # |
︙ | ︙ | |||
6135 6136 6137 6138 6139 6140 6141 | variable elide for {set row $first; set line [expr {$first + 1}]} \ {$row <= $last} {set row $line; incr line} { # # Check whether the row is selectable # set key [lindex $data(keyList) $row] | | < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < | 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 | variable elide for {set row $first; set line [expr {$first + 1}]} \ {$row <= $last} {set row $line; incr line} { # # Check whether the row is selectable # set key [lindex $data(keyList) $row] if {![info exists data($key-selectable)]} { $w tag add select $line.0 $line.end } } # # If the selection is exported and there are any selected # cells in the widget then make win the new owner of the # PRIMARY selection and register a callback to be invoked |
︙ | ︙ |