Overview
| Artifact ID: | 57fac2b722ffd441b038b0fd76e955939ec32a3d |
|---|---|
| Ticket: | 586720ffffffffffffffffffffffffffffffffff |
| Date: | 2002-07-26 04:20:13 |
| User: | ashalagi |
| Artifact Attached: | 616d7a2c099c5b7c1036249f24c6b64264d59b80 |
| Filename: | changes.txt |
| Description: | diff of our changes with respect to cvs head. |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 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 418 419 420 421 422 423 424 425 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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 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 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 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602Common subdirectories: ./CVS and ../mclistbox_submit/CVS Only in .: changes.txt diff -c ./example.tcl ../mclistbox_submit/example.tcl *** ./example.tcl Tue Aug 3 16:24:22 1999 --- ../mclistbox_submit/example.tcl Wed Jul 24 12:03:21 2002 *************** *** 28,50 **** # we will purposefully make the width less than the sum of the # columns so that the scrollbars will be functional right off # the bat. mclistbox .listbox \ -bd 0 \ -height 10 \ -width 60 \ -columnrelief flat \ -labelanchor w \ -columnborderwidth 0 \ -selectcommand "showSelection" \ ! -selectmode extended \ -labelborderwidth 2 \ -fillcolumn name \ -xscrollcommand [list .hsb set] \ ! -yscrollcommand [list .vsb set] # add the columns we want to see .listbox column add name -label "Name" -width 40 ! .listbox column add size -label "Size" -width 12 .listbox column add mod -label "Last Modified" -width 18 # set up bindings to sort the columns. --- 28,54 ---- # we will purposefully make the width less than the sum of the # columns so that the scrollbars will be functional right off # the bat. + set sample_font [font create Fixed -family Courier -size 10 -weight normal -slant roman] mclistbox .listbox \ -bd 0 \ -height 10 \ + -font $sample_font \ -width 60 \ -columnrelief flat \ -labelanchor w \ + -selectcolumn 1 \ -columnborderwidth 0 \ -selectcommand "showSelection" \ ! -selectmode single \ -labelborderwidth 2 \ -fillcolumn name \ -xscrollcommand [list .hsb set] \ ! -yscrollcommand [list .vsb set] \ ! -usecolumnxscroll 1 # add the columns we want to see .listbox column add name -label "Name" -width 40 ! .listbox column add size -label "Size" -width 12 .listbox column add mod -label "Last Modified" -width 18 # set up bindings to sort the columns. diff -c ./mclistbox.html ../mclistbox_submit/mclistbox.html *** ./mclistbox.html Tue May 30 19:46:13 2000 --- ../mclistbox_submit/mclistbox.html Tue Jul 23 15:31:46 2002 *************** *** 235,240 **** --- 235,251 ---- A boolean value which determines whether column labels are shown or not. <P> + Command-Line Name: <STRONG>-selectcolumn</STRONG> <EM>command</EM> <br> + Database Name: <STRONG>selectColumn</STRONG><br> + Database Class: <STRONG>SelectColumn</STRONG> + + + <P> + Specifies behavior of selection. If -selectcolumn is set to 1 and -selectmode is set to single, + then only one cell instead of hole line is highlighted upon click. Default value is 0. + + + <P> Command-Line Name: <STRONG>-selectcommand</STRONG> <EM>command</EM> <br> Database Name: <STRONG>selectCommand</STRONG><br> Database Class: <STRONG>Command</STRONG> *************** *** 269,274 **** --- 280,300 ---- of the option may be arbitrary, but the default bindings expect it to be either <STRONG>single</STRONG>, <STRONG>browse</STRONG>, <STRONG>multiple</STRONG>, or <STRONG>extended</STRONG>; the default value is browse. + + <P> + Command-Line Name: <STRONG>-usecolumnxscroll</STRONG> <br> + Database Name: <STRONG>usecolumnXscroll</STRONG><br> + Database Class: <STRONG>UseColumnXscroll</STRONG> + + + <P> + Specifies whether xscrollbars appear on bottom of columns. + If set to 1, then xscrollbars are added to the bottom of each column. + An xscrollbar of a column is visible if corresponding column option -usexscroll is set to 1 + (default value), otherwise it is invisible. Default is 0. + + + <P> <H2><A NAME="DESCRIPTION">DESCRIPTION</A></H2> <P> *************** *** 415,420 **** --- 441,452 ---- the desired width for the window is made just large enough to hold all the elements in the listbox. + <P><DT><STRONG><A NAME="item__usexscroll">-usexscroll</A></STRONG><DD> + <P> + Specifies whether corresponding xscrollbar is visible. + This option works only if -usecolumnxscroll is set to 1. If the value is 1, + it makes corresponding xscrollbar visible. Default value is 1. + </DL> <P><DT><STRONG>pathName column delete name</STRONG><DD> <P> *************** *** 454,464 **** --- 486,506 ---- to fill all of the columns, blank values will be used to fill in the missing columns. + <P><DT><STRONG>pathName itemconfigure index column list ?list ...?</STRONG><DD> + <P> + Allows one to configure any given cell of a mclistbox. The arguments index and column specify a cell to be configures. + <EM>list</EM> argument is a set of option-value pairs as in the listbox command itemconfigure. + <P><DT><STRONG>pathName label bind name sequence command</STRONG><DD> <P> This command associates <EM>command</EM> with a column label such that whenever the event sequence given by <EM>sequence</EM> occurs over the label for the column named <EM>name</EM> the <EM>command</EM> will be invoked. This widget command is similar to the bind command except that it operates on column labels rather than the entire widget. See the bind manual entry for complete details on the syntax of <EM>sequence</EM> and the substitutions performed on <EM>command</EM> before invoking it. + + <P><DT><STRONG>::mclistbox::ResizeColumnsOfAllListboxes</STRONG><DD> + <P> + This command adjusts widths of columns according to set fonts of all mclistboxes in active an application. This function is supposed to be called after any font change. + </DL> <P> diff -c ./mclistbox.tcl ../mclistbox_submit/mclistbox.tcl *** ./mclistbox.tcl Fri Sep 7 12:59:48 2001 --- ../mclistbox_submit/mclistbox.tcl Thu Jul 25 15:33:16 2002 *************** *** 47,52 **** --- 47,55 ---- variable widgetCommands variable columnCommands variable labelCommands + + # this is a list of existed listboxes + variable listboxesList } # ::mclistbox::Init -- *************** *** 111,116 **** --- 114,120 ---- -resizablecolumns {resizableColumns ResizableColumns} \ -selectbackground {selectBackground Foreground} \ -selectborderwidth {selectBorderWidth BorderWidth} \ + -selectcolumn {selectColumn SelectColumn} \ -selectcommand {selectCommand Command} \ -selectforeground {selectForeground Background} \ -selectmode {selectMode SelectMode} \ *************** *** 120,125 **** --- 124,130 ---- -width {width Width} \ -xscrollcommand {xScrollCommand ScrollCommand} \ -yscrollcommand {yScrollCommand ScrollCommand} \ + -usecolumnxscroll {usecolumnXscroll UseColumnXscroll} \ -iseditableindexcommand \ {isEditableIndexCommand IsEditableIndexCommand} \ ] *************** *** 155,160 **** --- 160,166 ---- -editable {editable Editable} \ -editcommand {editcommand Editcommand} \ -listvar {listvar Listvar} \ + -usexscroll {usexscroll UseXscroll} \ ] # this defines the valid widget commands. It's important to *************** *** 164,170 **** activate bbox cget column configure \ curselection delete edit editcombo get index \ insert label nearest scan see \ ! selection size xview yview ] set columnCommands [list add cget configure delete names nearest x] --- 170,176 ---- activate bbox cget column configure \ curselection delete edit editcombo get index \ insert label nearest scan see \ ! selection size xview yview itemconfigure ] set columnCommands [list add cget configure delete names nearest x] *************** *** 235,240 **** --- 241,248 ---- option add *Mclistbox.fillcolumn {} widgetDefault option add *Mclistbox.iseditableindexcommand {} widgetDefault option add *Mclistbox.state normal widgetDefault + option add *Mclistbox.usecolumnXscroll 0 widgetDefault + option add *Mclistbox.selectColumn 0 widgetDefault # Bwidget stuff option add *Mclistbox.dragEndCmd {} widgetDefault *************** *** 260,265 **** --- 268,274 ---- 0 widgetDefault option add *Mclistbox*MclistboxColumn.editcommand \ "" widgetDefault + option add *Mclistbox*MclistboxColumn.usexscroll 1 widgetDefault } ###################################################################### *************** *** 290,295 **** --- 299,305 ---- proc ::mclistbox::mclistbox {args} { variable widgetOptions + variable listboxesList # perform a one time initialization if {![info exists widgetOptions]} { *************** *** 314,319 **** --- 324,331 ---- # build it... set w [eval Build $args] + # register the widget in the listboxes list + lappend listboxesList $w # set some bindings... SetBindings $w *************** *** 748,753 **** --- 760,770 ---- -class MclistboxColumn \ -background $options(-background) \ ] + scrollbar $frame.xscroll -orient horizontal + set misc(columnxscroll_args) [ list -elementborderwidth -relief -highlightbackground -highlightcolor -activebackground ] + foreach name $misc(columnxscroll_args) { + set misc(columnxscroll,$name) [ $frame.xscroll cget $name ] + } set label \ [label $frame.label \ *************** *** 819,831 **** # geometry propagation must be off so we can control the size # of the listbox by setting the size of the containing frame pack propagate $frame off ! pack $label -side top -fill x -expand n pack $listbox -side top -fill both -expand y -pady 2 # any events that happen in the listbox gets handled by the class # bindings. This has the unfortunate side effect ! bindtags $listbox [list $w Mclistbox all] # Make the listbox a bwidget drag and drop site, if we have bwidgets if { $::mclistbox::bwidget } { if { $options(-dragenabled) } { --- 836,851 ---- # geometry propagation must be off so we can control the size # of the listbox by setting the size of the containing frame pack propagate $frame off ! if { $options(-usecolumnxscroll) } { ! pack $frame.xscroll -side bottom -fill x -expand 0 -anchor s ! } pack $label -side top -fill x -expand n pack $listbox -side top -fill both -expand y -pady 2 # any events that happen in the listbox gets handled by the class # bindings. This has the unfortunate side effect ! bind $listbox <ButtonPress-1> [ list ::mclistbox::Set_Selected_Column %W $id ] ! bindtags $listbox [list $listbox $w Mclistbox all] # Make the listbox a bwidget drag and drop site, if we have bwidgets if { $::mclistbox::bwidget } { if { $options(-dragenabled) } { *************** *** 847,852 **** --- 867,883 ---- return [list $frame $listbox $label $button] } + proc ::mclistbox::Set_Selected_Column { column_listbox column_id } { + + set w [ ::mclistbox::convert $column_listbox -W ] + + upvar ::mclistbox::${w}::misc misc + + set misc(selected_column_widget) $column_listbox + set misc(selected_column_id) $column_id + } + + # ::mclistbox::Column-add -- # # Implements the "column add" widget command *************** *** 895,900 **** --- 926,932 ---- set opts(-editable) 0 set opts(-editcommand) "" set opts(-listvar) "" + set opts(-usexscroll) 1 if {[expr {[llength $args]%2}] == 1} { # hmmm. An odd number of elements in args *************** *** 1050,1055 **** --- 1082,1088 ---- } -width { + set widgets(width$id) $value set font [$listbox cget -font] set factor [font measure $options(-font) "0"] set width [expr {$value * $factor}] *************** *** 1163,1168 **** --- 1196,1227 ---- # Set the list variable for the column $listbox configure $option $value } + + -usexscroll { + if { $options(-usecolumnxscroll) } { + set xscrollbar [ winfo parent $listbox ].xscroll + if [ winfo exists $xscrollbar ] { + if { $value } { + $listbox configure -xscrollcommand [ list $xscrollbar set ] + set cfg_args "-command \"$listbox xview\"" + foreach name $misc(columnxscroll_args) { + append cfg_args " $name \"$misc(columnxscroll,$name)\"" + } + eval $xscrollbar configure $cfg_args + } else { + set xscrol_color [ $xscrollbar cget -background ] + $listbox configure -xscrollcommand "" + $xscrollbar configure \ + -elementborderwidth 0 \ + -relief groove \ + -highlightbackground $xscrol_color \ + -highlightcolor $xscrol_color \ + -activebackground $xscrol_color \ + -command "" + } + } + } + } } } } *************** *** 1183,1188 **** --- 1242,1249 ---- proc ::mclistbox::DestroyHandler {w} { + variable listboxesList + # kill off any idle event we might have pending if {[info exists ::mclistbox::${w}::misc(afterid)]} { catch { *************** *** 1197,1202 **** --- 1258,1267 ---- # brings tears to my eyes. if {[string compare [winfo class $w] "Mclistbox"] == 0} { namespace delete ::mclistbox::$w + set idx [lsearch -exact $listboxesList $w] + if { $idx != -1 } { + set listboxesList [lreplace $listboxesList $idx $idx] + } rename $w {} } *************** *** 1466,1471 **** --- 1531,1537 ---- unset widgets(listbox$id) unset widgets(label$id) unset widgets(editbutton$id) + unset widgets(width$id) } InvalidateScrollbars $w set result "" *************** *** 1535,1540 **** --- 1601,1611 ---- set result [$widgets(listbox$id) curselection] } + itemconfigure { + set result [eval ::mclistbox::Itemconfigure {$w} $args] + } + + delete { if {[llength $args] < 1 || [llength $args] > 2} { error "wrong \# of args: should be $w delete first ?last?" *************** *** 1764,1769 **** --- 1835,1843 ---- } if {$index1 != ""} { foreach id $misc(columns) { + if { $options(-selectcolumn) && \ + [ info exists misc(selected_column_id) ] && \ + $id != $misc(selected_column_id) } continue eval {$widgets(listbox$id)} selection set \ $index1 $index2 } *************** *** 2222,2227 **** --- 2296,2304 ---- set opts($name) $value } + # If we want to select inside separate column we must use "single" selectmode + if { [ info exists opts(-selectmode) ] && $opts(-selectmode) != "single" } { set opts(-selectcolumn) 0 } + # process all of the configuration options foreach option [array names opts] { *************** *** 2379,2384 **** --- 2456,2462 ---- $listboxoption] } + -selectcolumn - -resizablecolumns { if {$newValue} { set options($option) 1 *************** *** 2386,2392 **** set options($option) 0 } } ! -labelimage - -labelheight - -labelrelief - --- 2464,2477 ---- set options($option) 0 } } ! -usecolumnxscroll { ! if {$newValue} { ! set options($option) 1 ! } else { ! set options($option) 0 ! } ! ::mclistbox::UpdateColumnXScrollbars $w ! } -labelimage - -labelheight - -labelrelief - *************** *** 2453,2458 **** --- 2538,2559 ---- } } + proc ::mclistbox::UpdateColumnXScrollbars { w } { + + upvar ::mclistbox::${w}::widgets widgets + upvar ::mclistbox::${w}::options options + upvar ::mclistbox::${w}::misc misc + + foreach id $misc(columns) { + set column_xscroller $widgets(frame$id).xscroll + if { $options(-usecolumnxscroll) } { + catch { pack $column_xscroller -side bottom -fill x } + } else { + catch { pack forget $column_xscroller } + } + } + } + # ::mclistbox::UpdateScrollbars -- # # This proc does the work of actually update the scrollbars to *************** *** 2942,2947 **** --- 3043,3118 ---- $widgets(label$id) configure -cursor $options(-cursor) } + } + } + + + # ::mclistbox::Itemconfigure -- + # + # This implements the "itemconfigure" widget command; it configures specified row of the listbox + # + # Arguments: + # + # w widget pathname + # index a valid listbox index of a row to be configured + # column a column name + # args pairs of parameter names parameter values. For example: + # -foreground black -selectforeground white + # + # Results: + # + # Configures one specified cell in the listbox + + proc ::mclistbox::Itemconfigure {w index column args} { + upvar ::mclistbox::${w}::widgets widgets + upvar ::mclistbox::${w}::misc misc + if {[lsearch -exact $misc(columns) $column] == -1} { + error "unknown column $column ; must be one of: $misc(columns) " + } + set result [eval {$widgets(listbox$column)} itemconfigure $index $args ] + return $result + } + + + # ::mclistbox::ResizeColumns -- + # + # Adjusts widths of columns of a specified mclistbox according to currently set font. + # + # + # Arguments: w widget pathname + # + # Results: + # Changes widths of columns of a specified mclistbox. + + proc ::mclistbox::ResizeColumns { w } { + upvar ::mclistbox::${w}::widgets widgets + upvar ::mclistbox::${w}::options options + upvar ::mclistbox::${w}::misc misc + foreach id $misc(columns) { + set width $widgets(width$id) + set frame $widgets(frame$id) + set listbox $widgets(listbox$id) + set font [$w column cget $id -font] + set factor [font measure $options(-font) "0"] + set pixels [expr {$width * $factor}] + $widgets(frame$id) configure -width $pixels + set misc(min-$widgets(frame$id)) $pixels + AdjustColumns $w + } + } + + # ::mclistbox::ResizeColumnsOfAllListboxes -- + # + # Adjusts widths of columns of all mclistboxes according to currently set font. + # + # Results: + # Changes widths of columns of all mclistboxes currently registered in an application. + + + proc ::mclistbox::ResizeColumnsOfAllListboxes { } { + variable listboxesList + foreach w $listboxesList { + ::mclistbox::ResizeColumns $w } } Only in ../mclistbox_submit/: mclistbox.tcl.my Only in ../mclistbox_submit/: mclistbox.tcl.orig Only in ../mclistbox_submit/: mclistbox.tcl.rej diff -c ./test.tcl ../mclistbox_submit/test.tcl *** ./test.tcl Tue Nov 23 21:17:01 1999 --- ../mclistbox_submit/test.tcl Tue Jul 23 17:00:37 2002 *************** *** 16,22 **** set ::foo [::mclistbox::mclistbox .container.foo \ -yscrollcommand [list .container.vsb set] \ -xscrollcommand [list .container.hsb set] \ ! -selectmode extended \ -borderwidth 0 \ -width 60 \ -height 20 ] --- 16,22 ---- set ::foo [::mclistbox::mclistbox .container.foo \ -yscrollcommand [list .container.vsb set] \ -xscrollcommand [list .container.hsb set] \ ! -selectmode single \ -borderwidth 0 \ -width 60 \ -height 20 ]
