Unnamed Fossil Project

Check-in [cfbbd6aa79]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:new code for treeview
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cfbbd6aa79dcc454ed4045a159db6014d28e7d0b
User & Date: arnulf 2013-09-15 11:56:58
Context
2013-09-15
13:53
initial version check-in: 57098b6804 user: arnulf tags: trunk
11:56
new code for treeview check-in: cfbbd6aa79 user: arnulf tags: trunk
09:24
a lot of new code and fixes for treeview check-in: 4563a23aa9 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/ntkImageElement.tcl.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
56
57
58
59
60
61
62

63
64
65
66
67
68
69
}

#================================ InitializeOptionValues ===================
#     
#=========================================================================

::itcl::body ImageElement::InitializeOptionValues {styleName tkwin state} {
puts stderr "ImageElement INIT"
    InitializeOptionValuesBase $styleName $tkwin $state
}

#================================ imageElementConfigure ============================
#     
#=========================================================================

................................................................................
#=========================================================================

::itcl::body ImageElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding


    # FIX ME !!
    set width 0
    set height 0
}

#================================ ElementDraw ============================
#     







|







 







>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}

#================================ InitializeOptionValues ===================
#     
#=========================================================================

::itcl::body ImageElement::InitializeOptionValues {styleName tkwin state} {
#puts stderr "ImageElement INIT"
    InitializeOptionValuesBase $styleName $tkwin $state
}

#================================ imageElementConfigure ============================
#     
#=========================================================================

................................................................................
#=========================================================================

::itcl::body ImageElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding

puts stderr "ImageElement::ELementSize"
    # FIX ME !!
    set width 0
    set height 0
}

#================================ ElementDraw ============================
#     

Changes to library/ntkScroll.tcl.

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
#
# @(#) $Id: ntkScroll.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk::classes {

::itcl::extendedclass scroll {
   public proc CreateScrollHandle {args}

}





::itcl::body scroll::CreateScrollHandle {corePtr scrollVar} {
    upvar $scrollVar scrollable
puts stderr "scroll CreateScrollHandle!"
    set scrollable [dict create]
    dict set scrollable first 0
    dict set scrollable last 1
    dict set scrollable total 1
    set scrollHandle [dict create]
    dict set scrollHandle flags ""
    dict set scrollHandle core $corePtr
    dict set scrollHandle scrollPtr $scrollable

    return $scrollable









































}

} ; # end namespace ::ntk::classes








|
>

>
>
>
>



|









|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




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
#
# @(#) $Id: ntkScroll.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk::classes {

::itcl::extendedclass scroll {
   public proc CreateScrollHandle {corePtr scrollVar}
   public proc Scrolled {handle first last total}
}

#================================ CreateScrollHandle ============================
#     
#=========================================================================

::itcl::body scroll::CreateScrollHandle {corePtr scrollVar} {
    upvar $scrollVar scrollable
#puts stderr "scroll::CreateScrollHandle!"
    set scrollable [dict create]
    dict set scrollable first 0
    dict set scrollable last 1
    dict set scrollable total 1
    set scrollHandle [dict create]
    dict set scrollHandle flags ""
    dict set scrollHandle core $corePtr
    dict set scrollHandle scrollPtr $scrollable

    return $scrollHandle

}

#================================ Scrolled ============================
# Scrolled --
#     Update scroll info, schedule scrollbar update.
#=========================================================================

::itcl::body scroll::Scrolled {handle first last total} {
#puts stderr "scroll::Scrolled!"
    set scrollable [dict get $handle scrollPtr]

    # Sanity-check inputs:
 
    if {$total <= 0} {
        set first 0
        set last  1
        set total 1
    }

    if {$last > $total} {
        set first [expr {$first - ($last - $total)}]
        if {$first < 0} {
            set first 0
        }
        set last $total
    }

    if {[dict get $scrollable first] != $first ||
        [dict get $scrollable last] != $last ||
        [dict get $scrollable total] != $total ||
        ([lsearch [dict get $handle flags] scrollUpdateRequired] >= 0)} {
        dict set scrollable first $first
        dict set $scrollable last $last
        dict set $scrollable total $total

        if {[lsearch [dict get $handle flags] scrollUpdatePending] >= 0} {
            # DoWhenIdle UpdateScrollbarBG $handle
	    dict lappend handle flags scrollUpdatePending
	}
    }
}

} ; # end namespace ::ntk::classes

Changes to library/ntkTTreeview.tcl.

41
42
43
44
45
46
47









48
49
50
51
52
53
54
...
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
279
280
281
282
283
284
285
286



287



288
289
290
291
292
293
294
...
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
...
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
...
441
442
443
444
445
446
447
448

















































































































































































449


450




451
452
453
454




































455
456
457
458
459
460
461
    private method RecomputeSlack {recordPtr}
    public method TreeviewConfigure {args}
    public method TreeviewPostConfigure {recordPtr mask}
    private method NewItem {}
    private method GetSublayout {theme parentLayout layoutName optionTable layoutVar}
    public method TreeviewGetLayout {theme recordPtr}
    public method TreeviewSize {recordPtr widthVar heightVar}









    public method TreeviewDoLayout {recordPtr}
    public method TreeviewDisplay {}

    public method TreeviewBBoxCommand {args} 
    public method TreeviewChildrenCommand {args} 
    public method TreeviewColumnCommand {args} 
    public method TreeviewDeleteCommand {args} 
................................................................................

#================================ InitColumn ============================
# 
#=========================================================================

::itcl::body treeview::InitColumn {columnVar} {
    upvar $columnVar column

puts stderr "InitColumn!"
    set column [dict create]
    dict set column width 200
    dict set column minWidth 20
    dict set column stretch 1
    dict set column idObj ""
    dict set column anchorObj ""

................................................................................

#================================ NewItem ============================
# NewItem --
#     Allocate a new, uninitialized, unlinked item
#=========================================================================

::itcl::body treeview::NewItem {} {
puts stderr "NewItem!"
set item [dict create]
    dict set item entryPtr 0
    dict set item parent ""
    dict set item children ""
    dict set item next ""
    dict set item prev ""

    dict set item state  0
................................................................................
}

#================================ TreeviewInitialize ============================
#     Initialization hooks.
#=========================================================================

::itcl::body treeview::TreeviewInitialize {recordPtr} {
puts stderr "TreeviewInitialize!"
#    tv->tree.itemOptionTable = Tk_CreateOptionTable(interp, ItemOptionSpecs);
#    tv->tree.columnOptionTable = Tk_CreateOptionTable(interp, ColumnOptionSpecs);
#    tv->tree.headingOptionTable = Tk_CreateOptionTable(interp, HeadingOptionSpecs);
#    tv->tree.tagOptionTable = Tk_CreateOptionTable(interp, TagOptionSpecs);
     dict set tree itemOptionTable [dict create]
     dict set tree columnOptionTable [dict create]
     dict set tree headingOptionTable [dict create]
................................................................................
    dict set tree xscrollHandle [CreateScrollHandle $core xscroll]
    dict set tree xscrollHandle xscroll $xscroll
    dict set tree yscrollHandle [CreateScrollHandle $core yscroll]
    dict set tree yscrollHandle yscroll $yscroll

    # Size parameters:

    dict set tree treeArea [list 0 0 0 0]



    dict set tree headingArea [list 0 0 0 0]



    dict set tree slack 0

}

#================================ TreeviewCleanup ============================
#     Cleanup hooks.
#=========================================================================
................................................................................
#     Configuration widget hook.
# 
#     BUG: If user sets -columns and -displaycolumns, but -displaycolumns
#     has an error, the widget is left in an inconsistent state.
#=========================================================================

::itcl::body treeview::TreeviewConfigure {recordPtr mask} {
puts stderr "TreeviewConfigure!$mask!"

    set showFlags [dict get $tree showFlags]
    if {[lsearch $mask columnsChanged] >= 0} {
        if {[TreeviewInitColumns] != TCL_OK} {
            return TCL_ERROR;
        }
        lappend mask dcolumnsChanged
................................................................................
#================================ GetSublayout ============================
# GetSublayout --
#     Utility routine; acquires a sublayout for items, cells, etc.
#=========================================================================

::itcl::body treeview::GetSublayout {theme parentLayout layoutName optionTable layoutVar} {
    upvar $layoutVar layout
puts stderr "GetSublayout!"
    set newLayout [::ntk::classes::layout::CreateSubLayout $theme $parentLayout $core $layoutName $optionTable]
    if {$newLayout ne ""} {
        set layout $newLayout
    }
    return $newLayout
}

#================================ TreeviewGetLayout ============================
# Layout management hooks.
#=========================================================================

::itcl::body treeview::TreeviewGetLayout {theme recordPtr} {
puts stderr "TreeviewGetLayout!$theme!"
    set treeLayout [WidgetGetLayout $theme $recordPtr]
    if {$treeLayout eq ""} {
        return 0
    }
    set tagOptionTable [dict get $tree tagOptionTable]
    set itemLayout [dict get $tree itemLayout]
    if {[GetSublayout $theme $treeLayout ".Item" $tagOptionTable itemLayout] eq ""} {
................................................................................

::itcl::body treeview::TreeviewSize {recordPtr widthVar heightVar} {
    upvar $widthVar width
    upvar $heightVar height
#puts stderr "TreeviewSize!"
puts stderr "TreeviewSize END!$width!$height!"
}


















































































































































































#================================ TreeviewDoLayout ============================


#     




#=========================================================================

::itcl::body treeview::TreeviewDoLayout {recordPtr} {
puts stderr "TreeviewDoLayout!"




































}

#================================ TreeviewDisplay ============================
#     
#=========================================================================

::itcl::body treeview::TreeviewDisplay {} {







>
>
>
>
>
>
>
>
>







 







>
|







 







|
|







 







|







 







|
>
>
>
|
>
>
>







 







|







 







|












|







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
|
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
...
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
...
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
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
    private method RecomputeSlack {recordPtr}
    public method TreeviewConfigure {args}
    public method TreeviewPostConfigure {recordPtr mask}
    private method NewItem {}
    private method GetSublayout {theme parentLayout layoutName optionTable layoutVar}
    public method TreeviewGetLayout {theme recordPtr}
    public method TreeviewSize {recordPtr widthVar heightVar}
    private method FirstColumn {}
    private method Stretch {col n}
    private method ShoveLeft {index n}
    private method DistributeWidth {newWidth}
    private method PickupSlack {extra}
    private method DepositSlack {extra}
    private method ResizeColumns {newWidth}
    private method TreeWidth {}
    private method CountRows {item}
    public method TreeviewDoLayout {recordPtr}
    public method TreeviewDisplay {}

    public method TreeviewBBoxCommand {args} 
    public method TreeviewChildrenCommand {args} 
    public method TreeviewColumnCommand {args} 
    public method TreeviewDeleteCommand {args} 
................................................................................

#================================ InitColumn ============================
# 
#=========================================================================

::itcl::body treeview::InitColumn {columnVar} {
    upvar $columnVar column

#puts stderr "InitColumn!"
    set column [dict create]
    dict set column width 200
    dict set column minWidth 20
    dict set column stretch 1
    dict set column idObj ""
    dict set column anchorObj ""

................................................................................

#================================ NewItem ============================
# NewItem --
#     Allocate a new, uninitialized, unlinked item
#=========================================================================

::itcl::body treeview::NewItem {} {
#puts stderr "NewItem!"
    set item [dict create]
    dict set item entryPtr 0
    dict set item parent ""
    dict set item children ""
    dict set item next ""
    dict set item prev ""

    dict set item state  0
................................................................................
}

#================================ TreeviewInitialize ============================
#     Initialization hooks.
#=========================================================================

::itcl::body treeview::TreeviewInitialize {recordPtr} {
#puts stderr "TreeviewInitialize!"
#    tv->tree.itemOptionTable = Tk_CreateOptionTable(interp, ItemOptionSpecs);
#    tv->tree.columnOptionTable = Tk_CreateOptionTable(interp, ColumnOptionSpecs);
#    tv->tree.headingOptionTable = Tk_CreateOptionTable(interp, HeadingOptionSpecs);
#    tv->tree.tagOptionTable = Tk_CreateOptionTable(interp, TagOptionSpecs);
     dict set tree itemOptionTable [dict create]
     dict set tree columnOptionTable [dict create]
     dict set tree headingOptionTable [dict create]
................................................................................
    dict set tree xscrollHandle [CreateScrollHandle $core xscroll]
    dict set tree xscrollHandle xscroll $xscroll
    dict set tree yscrollHandle [CreateScrollHandle $core yscroll]
    dict set tree yscrollHandle yscroll $yscroll

    # Size parameters:

    dict set tree treeArea x 0
    dict set tree treeArea y 0
    dict set tree treeArea width 0
    dict set tree treeArea height 0
    dict set tree headingArea x 0
    dict set tree headingArea y 0
    dict set tree headingArea width 0
    dict set tree headingArea height 0
    dict set tree slack 0

}

#================================ TreeviewCleanup ============================
#     Cleanup hooks.
#=========================================================================
................................................................................
#     Configuration widget hook.
# 
#     BUG: If user sets -columns and -displaycolumns, but -displaycolumns
#     has an error, the widget is left in an inconsistent state.
#=========================================================================

::itcl::body treeview::TreeviewConfigure {recordPtr mask} {
#puts stderr "TreeviewConfigure!$mask!"

    set showFlags [dict get $tree showFlags]
    if {[lsearch $mask columnsChanged] >= 0} {
        if {[TreeviewInitColumns] != TCL_OK} {
            return TCL_ERROR;
        }
        lappend mask dcolumnsChanged
................................................................................
#================================ GetSublayout ============================
# GetSublayout --
#     Utility routine; acquires a sublayout for items, cells, etc.
#=========================================================================

::itcl::body treeview::GetSublayout {theme parentLayout layoutName optionTable layoutVar} {
    upvar $layoutVar layout
#puts stderr "GetSublayout!"
    set newLayout [::ntk::classes::layout::CreateSubLayout $theme $parentLayout $core $layoutName $optionTable]
    if {$newLayout ne ""} {
        set layout $newLayout
    }
    return $newLayout
}

#================================ TreeviewGetLayout ============================
# Layout management hooks.
#=========================================================================

::itcl::body treeview::TreeviewGetLayout {theme recordPtr} {
#puts stderr "TreeviewGetLayout!$theme!"
    set treeLayout [WidgetGetLayout $theme $recordPtr]
    if {$treeLayout eq ""} {
        return 0
    }
    set tagOptionTable [dict get $tree tagOptionTable]
    set itemLayout [dict get $tree itemLayout]
    if {[GetSublayout $theme $treeLayout ".Item" $tagOptionTable itemLayout] eq ""} {
................................................................................

::itcl::body treeview::TreeviewSize {recordPtr widthVar heightVar} {
    upvar $widthVar width
    upvar $heightVar height
#puts stderr "TreeviewSize!"
puts stderr "TreeviewSize END!$width!$height!"
}

#================================ FirstColumn ============================
#
#=========================================================================

::itcl::body treeview::FirstColumn {} {
#puts stderr "FirstColumn!"
    set flags [dict get $tree showFlags]
    if {[lsearch $flags showTree] >= 0} {
        return 0
    } else {
        return 1
    }
}

#================================ Stretch ============================
# Stretch --
#     Adjust width of column by N pixels, down to minimum width.
#     Returns: #pixels actually moved.
#=========================================================================

::itcl::body treeview::Stretch {col n} {
#puts stderr "Stretch!"
    set newWidth [expr {$n + [dict get $col width]}]
    if {$newWidth < [dict get $col minWidth]} {
        set n [expr {[dict get $col minWidth] - [dict get $col width]}]
        dict set col width [dict get $col minWidth]
    } else {
        dict set col width $newWidth
    }
    return $n
}

#================================ ShoveLeft ============================
# ShoveLeft --
#     Adjust width of (stretchable) columns to the left by N pixels.
#     Returns: leftover slack.
#=========================================================================

::itcl::body treeview::ShoveLeft {index n} {
#puts stderr "ShoveLeft!"
    set first [FirstColumn]
    while {$n != 0 && $index >= $first} {
        set c [lindex [dict get $tree displayColumns] $index]
        if {[dict get $c stretch]} {
            set n [expr {$n - [Stretch $c $n]}]
        }
        incr index -1
    }
    return $n
}

#================================ DistributeWidth ============================
# DistributeWidth --
#     Distribute n pixels evenly across all stretchable display columns.
#     Returns: leftover slack.
# Notes:
#     The "((++w % m) < r)" term is there so that the remainder r = n % m
#     is distributed round-robin.
#=========================================================================

::itcl::body treeview::DistributeWidth {newWidth} {
#puts stderr "DistributeWidth!"
    set w [TreeWidth]
    set m 0

    set i [FirstColumn]
    while {$i < [dict get $tree nDisplayColumns]} {
        if {[dict get [lindex [dict get $tree displayColumns] $i] stretch]} {
            incr m
        }
        incr i
    }
    if {$m == 0} {
        return $newWidth;
    }

    set d [expr {$newWidth / $m}]
    set r [expr {$newWidth % $m}]
    if {$r < 0} {
        set r [expr {$r + $m}]
        incr d -1
    }

    set i [FirstColumn]
    while  {$i < [dict get $tree nDisplayColumns]} {
        set c [lindex [dict get $tree displayColumns] $i]
        if {[dict get $c stretch]} {
            incr w
            set newWidth [expr {$newWidth - [Stretch $c [expr {$d + (($w % $m) < $r)}]]}]
        }
        incr i
    }
    return $newWidth
}

#================================ PickupSlack ============================
# PickupSlack/DepositSlack --
#     When resizing columns, distribute extra space to 'slack' first,
#     and only adjust column widths if 'slack' goes to zero.
#     That is, don't bother changing column widths if the tree
#     is already scrolled or short.
#=========================================================================

::itcl::body treeview::PickupSlack {extra} {
#puts stderr "PickupSlack!"
   set newSlack [expr {[dict get $tree slack] + $extra}]

    if {($newSlack < 0 && [dict get $tree slack] >= 0) ||
        ($newSlack > 0 && [dict get $tree slack] <= 0)} {
        dict set tree slack 0
        return $newSlack;
    } else {
        dict set tree slack $newSlack
        return 0
    }
}

#================================ DepositSlack ============================
#
#=========================================================================

::itcl::body treeview::DepositSlack {extra} {
#puts stderr "DepositSlack!"
    dict set tree slack [expr {[dict get $tree slack] + $extra}]
}

#================================ ResizeColumns ============================
# ResizeColumns --
#     Recompute column widths based on available width.
#     Pick up slack first;
#     Distribute the remainder evenly across stretchable columns;
#     If any is still left over due to minwidth constraints, shove left.
#=========================================================================

::itcl::body treeview::ResizeColumns {newWidth} {
#puts stderr "ResizeColumns!$newWidth!"
    set delta [expr {$newWidth - [TreeWidth] + [dict get $tree slack]}]
    DepositSlack [ShoveLeft [expr {[dict get $tree nDisplayColumns] - 1}] \
            [DistributeWidth [PickupSlack $delta]]]
}

#================================ TreeWidth ============================
# TreeWidth --
#     Compute the requested tree width from the sum of visible column widths.
#=========================================================================

::itcl::body treeview::TreeWidth {} {
#puts stderr "TreeWidth!"
    set i [FirstColumn]
    set width  0

    while {$i < [dict get $tree nDisplayColumns]} {
        set width [expr {$width + [dict get [lindex [dict get $tree displayColumns] $i] width]}]
        incr i
    }
    return $width;
}

#================================ CountRows ============================
# CountRows --
#     Returns the number of viewable rows rooted at item
#=========================================================================

::itcl::body treeview::CountRows {item} {
#puts stderr "CountRows!"
    set rows 1

    if {[lsearch [dict get $item state] stateOpen] >= 0} {
        set child [dict get $item children]
        while {$child ne ""} {
            set rows [expr {$rows + [CountRows $child]}]
            set child [dict get $child next]
        }
    }
    return $rows
}

#================================ TreeviewDoLayout ============================
# TreeviewDoLayout --
#     DoLayout() widget hook.  Computes widget layout.
# 
# Side effects:
#     Computes headingArea and treeArea.
#     Computes subtree height.
#     Invokes scroll callbacks.
#=========================================================================

::itcl::body treeview::TreeviewDoLayout {recordPtr} {
puts stderr "TreeviewDoLayout!"
    # ASSERT: SLACKINVARIANT 

    set layout [dict get $core layout]
    set box [list 0 0 0 0]
    ::ntk::classes::layout::PlaceLayout layout [dict get $core state] $box
    dict set core layout $layout
    set box [::ntk::classes::layout::ClientRegion [dict get $core layout] "treearea"]
puts stderr "BOX!$box!"
    lassign $box x y width height
    dict set tree treeArea x $x
    dict set tree treeArea y $y
    dict set tree treeArea width $width
    dict set tree treeArea height $height

    ResizeColumns [dict get $tree treeArea width]
    # ASSERT: SLACKINVARIANT

    set start [dict get $tree xscrollHandle xscroll first]
    set end [expr {[dict get $tree xscrollHandle xscroll first] + [dict get $tree treeArea width]}]
    Scrolled [dict get $tree xscrollHandle] $start $end [TreeWidth]

    if {[lsearch [dict get $tree showFlags] showHeadings] >= 0} {
        set box [list [dict get $tree treeArea x] [dict get $tree treeArea y] [dict get $tree treeArea width] [dict get $tree treeArea height] ]
        dict set tree headingArea [::ntk::classes::layout::PackBox $box 1 [dict get $tree headingHeight] side_top]
    } else {
        dict set tree headingArea x 0
        dict set tree headingArea y 0
        dict set tree headingArea width 0
        dict set tree headingArea height 0
    }
    set visibleRows [expr {[dict get $tree treeArea height] / [dict get $tree rowHeight]}]
    dict lappend tree root state stateOpen
    set start [dict get $tree yscrollHandle yscroll first]
    set end [expr {[dict get $tree yscrollHandle yscroll first] + $visibleRows}]
    Scrolled [dict get $tree yscrollHandle] $start $end [expr {[CountRows [dict get $tree root]] - 1}]

}

#================================ TreeviewDisplay ============================
#     
#=========================================================================

::itcl::body treeview::TreeviewDisplay {} {

Changes to library/ntkTextElement.tcl.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89


#================================ InitializeOptionValues ==================
#     
#=========================================================================

::itcl::body TextElement::InitializeOptionValues {styleName tkwin state} {
puts stderr "TextElement INIT"
    InitializeOptionValuesBase $styleName $tkwin $state
}

#================================ textElementConfigure ==================
#     
#=========================================================================

................................................................................
#     
#=========================================================================

::itcl::body TextElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding
puts stderr "Textelem!$itcl_options(-text)!"

    set width 72
    set height 16
}

#================================ ElementDraw ==================
#     







|







 







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89


#================================ InitializeOptionValues ==================
#     
#=========================================================================

::itcl::body TextElement::InitializeOptionValues {styleName tkwin state} {
#puts stderr "TextElement INIT"
    InitializeOptionValuesBase $styleName $tkwin $state
}

#================================ textElementConfigure ==================
#     
#=========================================================================

................................................................................
#     
#=========================================================================

::itcl::body TextElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding
puts stderr "TextElement::Size!"

    set width 72
    set height 16
}

#================================ ElementDraw ==================
#     

Changes to library/tclIndex.

74
75
76
77
78
79
80









81
82
83
84
85
86
87
...
273
274
275
276
277
278
279

280

281
282
283
284
285
286
287
set auto_index(::ntk::treeview::ScrollbarUpdateRequired) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::RecomputeSlack) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewConfigure) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewPostConfigure) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::GetSublayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewGetLayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewSize) [list source [file join $dir ntkTTreeview.tcl]]









set auto_index(::ntk::treeview::TreeviewDoLayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDisplay) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewBBoxCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewChildrenCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewColumnCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDeleteCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDetachCommand) [list source [file join $dir ntkTTreeview.tcl]]
................................................................................
set auto_index(::ntk::classes::utils::GetDiamondPositions) [list source [file join $dir ntkUtils.tcl]]
set auto_index(::ntk::classes::utils::BuildVertexInfo) [list source [file join $dir ntkUtils.tcl]]
set auto_index(::ntk::classes::image) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::image::Image_Init) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::image::Image_Init) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::scroll) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::scroll::CreateScrollHandle) [list source [file join $dir ntkScroll.tcl]]

set auto_index(::ntk::classes::scroll::CreateScrollHandle) [list source [file join $dir ntkScroll.tcl]]

set auto_index(::ntk::classes::FocusElement) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::InitializeOptionValues) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::focusElementConfigure) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::ElementSize) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::ElementDraw) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::altTheme) [list source [file join $dir ntkAltTheme.tcl]]
set auto_index(::ntk::classes::altTheme::AltTheme_Init) [list source [file join $dir ntkAltTheme.tcl]]







>
>
>
>
>
>
>
>
>







 







>

>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
set auto_index(::ntk::treeview::ScrollbarUpdateRequired) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::RecomputeSlack) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewConfigure) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewPostConfigure) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::GetSublayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewGetLayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewSize) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::FirstColumn) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::Stretch) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::ShoveLeft) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::DistributeWidth) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::PickupSlack) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::DepositSlack) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::ResizeColumns) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeWidth) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::CountRows) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDoLayout) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDisplay) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewBBoxCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewChildrenCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewColumnCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDeleteCommand) [list source [file join $dir ntkTTreeview.tcl]]
set auto_index(::ntk::treeview::TreeviewDetachCommand) [list source [file join $dir ntkTTreeview.tcl]]
................................................................................
set auto_index(::ntk::classes::utils::GetDiamondPositions) [list source [file join $dir ntkUtils.tcl]]
set auto_index(::ntk::classes::utils::BuildVertexInfo) [list source [file join $dir ntkUtils.tcl]]
set auto_index(::ntk::classes::image) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::image::Image_Init) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::image::Image_Init) [list source [file join $dir ntkImage.tcl]]
set auto_index(::ntk::classes::scroll) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::scroll::CreateScrollHandle) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::scroll::Scrolled) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::scroll::CreateScrollHandle) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::scroll::Scrolled) [list source [file join $dir ntkScroll.tcl]]
set auto_index(::ntk::classes::FocusElement) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::InitializeOptionValues) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::focusElementConfigure) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::ElementSize) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::FocusElement::ElementDraw) [list source [file join $dir ntkFocusElement.tcl]]
set auto_index(::ntk::classes::altTheme) [list source [file join $dir ntkAltTheme.tcl]]
set auto_index(::ntk::classes::altTheme::AltTheme_Init) [list source [file join $dir ntkAltTheme.tcl]]