Tools__ViewTreeApplication.st
author ca
Fri, 23 Jan 2009 17:58:19 +0100
changeset 2454 4867f3e9dd43
parent 2451 cbda60900ced
child 2455 93aaf62a6b95
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
     1
"{ Package: 'stx:libtool2' }"
87bb1815460b initial checkin
ca
parents:
diff changeset
     2
87bb1815460b initial checkin
ca
parents:
diff changeset
     3
"{ NameSpace: Tools }"
87bb1815460b initial checkin
ca
parents:
diff changeset
     4
87bb1815460b initial checkin
ca
parents:
diff changeset
     5
ApplicationModel subclass:#ViewTreeApplication
87bb1815460b initial checkin
ca
parents:
diff changeset
     6
	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
87bb1815460b initial checkin
ca
parents:
diff changeset
     7
		motionAction infoChannel testModeChannel process
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
     8
		followFocusChannel showNamesHolder'
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
     9
	classVariableNames:''
87bb1815460b initial checkin
ca
parents:
diff changeset
    10
	poolDictionaries:''
87bb1815460b initial checkin
ca
parents:
diff changeset
    11
	category:'A-Views-Support'
87bb1815460b initial checkin
ca
parents:
diff changeset
    12
!
87bb1815460b initial checkin
ca
parents:
diff changeset
    13
87bb1815460b initial checkin
ca
parents:
diff changeset
    14
Object subclass:#MenuDesc
87bb1815460b initial checkin
ca
parents:
diff changeset
    15
	instanceVariableNames:'title value action'
87bb1815460b initial checkin
ca
parents:
diff changeset
    16
	classVariableNames:''
87bb1815460b initial checkin
ca
parents:
diff changeset
    17
	poolDictionaries:''
87bb1815460b initial checkin
ca
parents:
diff changeset
    18
	privateIn:ViewTreeApplication
87bb1815460b initial checkin
ca
parents:
diff changeset
    19
!
87bb1815460b initial checkin
ca
parents:
diff changeset
    20
87bb1815460b initial checkin
ca
parents:
diff changeset
    21
!ViewTreeApplication class methodsFor:'documentation'!
87bb1815460b initial checkin
ca
parents:
diff changeset
    22
87bb1815460b initial checkin
ca
parents:
diff changeset
    23
documentation
87bb1815460b initial checkin
ca
parents:
diff changeset
    24
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    25
     Small application showing a ViewTreeModel use.
87bb1815460b initial checkin
ca
parents:
diff changeset
    26
87bb1815460b initial checkin
ca
parents:
diff changeset
    27
     It displays a hierarchical list of a selected TopView and
87bb1815460b initial checkin
ca
parents:
diff changeset
    28
     all its contained subViews.
87bb1815460b initial checkin
ca
parents:
diff changeset
    29
     Useful to have a look at subcomponents - to see how views
87bb1815460b initial checkin
ca
parents:
diff changeset
    30
     are structured.
87bb1815460b initial checkin
ca
parents:
diff changeset
    31
87bb1815460b initial checkin
ca
parents:
diff changeset
    32
87bb1815460b initial checkin
ca
parents:
diff changeset
    33
    [Instance variables:]
87bb1815460b initial checkin
ca
parents:
diff changeset
    34
        model           <ViewTreeModel>      the used ViewTreeModel
87bb1815460b initial checkin
ca
parents:
diff changeset
    35
        clickedItem     <ViewTreeItem>       item under the clickedPoint (motion action)
87bb1815460b initial checkin
ca
parents:
diff changeset
    36
        clickedPoint    <Point>              point where the motion action started from.
87bb1815460b initial checkin
ca
parents:
diff changeset
    37
        motionAction    <Action>             (oneArg-) action called durring buttonMotion.
87bb1815460b initial checkin
ca
parents:
diff changeset
    38
87bb1815460b initial checkin
ca
parents:
diff changeset
    39
87bb1815460b initial checkin
ca
parents:
diff changeset
    40
    [author:]
87bb1815460b initial checkin
ca
parents:
diff changeset
    41
        Claus Atzkern
87bb1815460b initial checkin
ca
parents:
diff changeset
    42
87bb1815460b initial checkin
ca
parents:
diff changeset
    43
    [see also:]
87bb1815460b initial checkin
ca
parents:
diff changeset
    44
        ViewTreeModel
87bb1815460b initial checkin
ca
parents:
diff changeset
    45
        ViewTreeItem
87bb1815460b initial checkin
ca
parents:
diff changeset
    46
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    47
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
    48
87bb1815460b initial checkin
ca
parents:
diff changeset
    49
!ViewTreeApplication class methodsFor:'initialization'!
87bb1815460b initial checkin
ca
parents:
diff changeset
    50
87bb1815460b initial checkin
ca
parents:
diff changeset
    51
initialize
87bb1815460b initial checkin
ca
parents:
diff changeset
    52
    "add myself to the launcher menu
87bb1815460b initial checkin
ca
parents:
diff changeset
    53
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
    54
    self installInLauncher.
87bb1815460b initial checkin
ca
parents:
diff changeset
    55
!
87bb1815460b initial checkin
ca
parents:
diff changeset
    56
87bb1815460b initial checkin
ca
parents:
diff changeset
    57
installInLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    58
    "add myself to the launcher menu
87bb1815460b initial checkin
ca
parents:
diff changeset
    59
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
    60
    |menuItem icon|
87bb1815460b initial checkin
ca
parents:
diff changeset
    61
87bb1815460b initial checkin
ca
parents:
diff changeset
    62
    NewLauncher isNil ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
    63
87bb1815460b initial checkin
ca
parents:
diff changeset
    64
    icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
87bb1815460b initial checkin
ca
parents:
diff changeset
    65
87bb1815460b initial checkin
ca
parents:
diff changeset
    66
    menuItem := MenuItem new 
87bb1815460b initial checkin
ca
parents:
diff changeset
    67
                    label: 'View Inspector';
87bb1815460b initial checkin
ca
parents:
diff changeset
    68
                    value: [ ViewTreeApplication open];
87bb1815460b initial checkin
ca
parents:
diff changeset
    69
                    isButton: true;
87bb1815460b initial checkin
ca
parents:
diff changeset
    70
                    icon: icon;
87bb1815460b initial checkin
ca
parents:
diff changeset
    71
                    nameKey: #viewInspect.
87bb1815460b initial checkin
ca
parents:
diff changeset
    72
87bb1815460b initial checkin
ca
parents:
diff changeset
    73
    menuItem startGroup:#right.
87bb1815460b initial checkin
ca
parents:
diff changeset
    74
    NewLauncher addMenuItem:menuItem in:'toolbar'
87bb1815460b initial checkin
ca
parents:
diff changeset
    75
                   position:#( #before #help)
87bb1815460b initial checkin
ca
parents:
diff changeset
    76
                      space:false.
87bb1815460b initial checkin
ca
parents:
diff changeset
    77
87bb1815460b initial checkin
ca
parents:
diff changeset
    78
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    79
self installInLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    80
self removeFromLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    81
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    82
!
87bb1815460b initial checkin
ca
parents:
diff changeset
    83
87bb1815460b initial checkin
ca
parents:
diff changeset
    84
postAutoload
87bb1815460b initial checkin
ca
parents:
diff changeset
    85
    "add myself to the launcher menu
87bb1815460b initial checkin
ca
parents:
diff changeset
    86
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
    87
    self installInLauncher.
87bb1815460b initial checkin
ca
parents:
diff changeset
    88
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    89
self installInLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    90
self removeFromLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    91
"
87bb1815460b initial checkin
ca
parents:
diff changeset
    92
!
87bb1815460b initial checkin
ca
parents:
diff changeset
    93
87bb1815460b initial checkin
ca
parents:
diff changeset
    94
removeFromLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
    95
    "remove myself from the launcher menu
87bb1815460b initial checkin
ca
parents:
diff changeset
    96
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
    97
    NewLauncher isNil ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
    98
    NewLauncher removeUserTool:#viewInspect
87bb1815460b initial checkin
ca
parents:
diff changeset
    99
87bb1815460b initial checkin
ca
parents:
diff changeset
   100
"
87bb1815460b initial checkin
ca
parents:
diff changeset
   101
self installInLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
   102
self removeFromLauncher
87bb1815460b initial checkin
ca
parents:
diff changeset
   103
"
87bb1815460b initial checkin
ca
parents:
diff changeset
   104
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   105
87bb1815460b initial checkin
ca
parents:
diff changeset
   106
unload
87bb1815460b initial checkin
ca
parents:
diff changeset
   107
    "class is about to be unloaded - remove myself from the launcher menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   108
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   109
    self removeFromLauncher.
87bb1815460b initial checkin
ca
parents:
diff changeset
   110
    super unload.
87bb1815460b initial checkin
ca
parents:
diff changeset
   111
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   112
87bb1815460b initial checkin
ca
parents:
diff changeset
   113
!ViewTreeApplication class methodsFor:'interface specs'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   114
87bb1815460b initial checkin
ca
parents:
diff changeset
   115
windowSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   116
    "This resource specification was automatically generated
87bb1815460b initial checkin
ca
parents:
diff changeset
   117
     by the UIPainter of ST/X."
87bb1815460b initial checkin
ca
parents:
diff changeset
   118
87bb1815460b initial checkin
ca
parents:
diff changeset
   119
    "Do not manually edit this!! If it is corrupted,
87bb1815460b initial checkin
ca
parents:
diff changeset
   120
     the UIPainter may not be able to read the specification."
87bb1815460b initial checkin
ca
parents:
diff changeset
   121
87bb1815460b initial checkin
ca
parents:
diff changeset
   122
    "
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   123
     UIPainter new openOnClass:Tools::ViewTreeApplication andSelector:#windowSpec
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   124
     Tools::ViewTreeApplication new openInterface:#windowSpec
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   125
     Tools::ViewTreeApplication open
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   126
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   127
87bb1815460b initial checkin
ca
parents:
diff changeset
   128
    <resource: #canvas>
87bb1815460b initial checkin
ca
parents:
diff changeset
   129
87bb1815460b initial checkin
ca
parents:
diff changeset
   130
    ^ 
87bb1815460b initial checkin
ca
parents:
diff changeset
   131
     #(FullSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   132
        name: windowSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   133
        window: 
87bb1815460b initial checkin
ca
parents:
diff changeset
   134
       (WindowSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   135
          label: 'ViewTreeInspector'
87bb1815460b initial checkin
ca
parents:
diff changeset
   136
          name: 'ViewTreeInspector'
87bb1815460b initial checkin
ca
parents:
diff changeset
   137
          min: (Point 10 10)
87bb1815460b initial checkin
ca
parents:
diff changeset
   138
          max: (Point 1024 9999)
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   139
          bounds: (Rectangle 0 0 381 654)
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   140
          menu: menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   141
        )
87bb1815460b initial checkin
ca
parents:
diff changeset
   142
        component: 
87bb1815460b initial checkin
ca
parents:
diff changeset
   143
       (SpecCollection
87bb1815460b initial checkin
ca
parents:
diff changeset
   144
          collection: (
87bb1815460b initial checkin
ca
parents:
diff changeset
   145
           (MenuPanelSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   146
              name: 'toolbarMenu'
87bb1815460b initial checkin
ca
parents:
diff changeset
   147
              layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
87bb1815460b initial checkin
ca
parents:
diff changeset
   148
              menu: toolbarMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   149
              textDefault: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   150
            )
87bb1815460b initial checkin
ca
parents:
diff changeset
   151
           (HierarchicalListViewSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   152
              name: 'List'
87bb1815460b initial checkin
ca
parents:
diff changeset
   153
              layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 -24 1.0)
87bb1815460b initial checkin
ca
parents:
diff changeset
   154
              level: 1
87bb1815460b initial checkin
ca
parents:
diff changeset
   155
              model: model
87bb1815460b initial checkin
ca
parents:
diff changeset
   156
              menu: middleButtonMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   157
              hasHorizontalScrollBar: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   158
              hasVerticalScrollBar: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   159
              miniScrollerHorizontal: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   160
              miniScrollerVertical: false
87bb1815460b initial checkin
ca
parents:
diff changeset
   161
              backgroundColor: (Color 49.999237048905 49.999237048905 100.0)
87bb1815460b initial checkin
ca
parents:
diff changeset
   162
              listModel: listOfItems
87bb1815460b initial checkin
ca
parents:
diff changeset
   163
              multipleSelectOk: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   164
              useIndex: false
87bb1815460b initial checkin
ca
parents:
diff changeset
   165
              highlightMode: label
87bb1815460b initial checkin
ca
parents:
diff changeset
   166
              doubleClickSelector: doubleClicked:
87bb1815460b initial checkin
ca
parents:
diff changeset
   167
              valueChangeSelector: selectionChanged
87bb1815460b initial checkin
ca
parents:
diff changeset
   168
              showLeftIndicators: false
87bb1815460b initial checkin
ca
parents:
diff changeset
   169
              indicatorSelector: indicatorClicked:
87bb1815460b initial checkin
ca
parents:
diff changeset
   170
              useDefaultIcons: false
87bb1815460b initial checkin
ca
parents:
diff changeset
   171
              postBuildCallback: postBuildTree:
87bb1815460b initial checkin
ca
parents:
diff changeset
   172
            )
87bb1815460b initial checkin
ca
parents:
diff changeset
   173
           (LabelSpec
87bb1815460b initial checkin
ca
parents:
diff changeset
   174
              name: 'infoChannel'
87bb1815460b initial checkin
ca
parents:
diff changeset
   175
              layout: (LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
87bb1815460b initial checkin
ca
parents:
diff changeset
   176
              level: 1
87bb1815460b initial checkin
ca
parents:
diff changeset
   177
              translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   178
              labelChannel: infoChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   179
              adjust: left
87bb1815460b initial checkin
ca
parents:
diff changeset
   180
            )
87bb1815460b initial checkin
ca
parents:
diff changeset
   181
           )
87bb1815460b initial checkin
ca
parents:
diff changeset
   182
         
87bb1815460b initial checkin
ca
parents:
diff changeset
   183
        )
87bb1815460b initial checkin
ca
parents:
diff changeset
   184
      )
87bb1815460b initial checkin
ca
parents:
diff changeset
   185
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   186
87bb1815460b initial checkin
ca
parents:
diff changeset
   187
!ViewTreeApplication class methodsFor:'menu specs'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   188
87bb1815460b initial checkin
ca
parents:
diff changeset
   189
menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   190
    "This resource specification was automatically generated
87bb1815460b initial checkin
ca
parents:
diff changeset
   191
     by the MenuEditor of ST/X."
87bb1815460b initial checkin
ca
parents:
diff changeset
   192
87bb1815460b initial checkin
ca
parents:
diff changeset
   193
    "Do not manually edit this!! If it is corrupted,
87bb1815460b initial checkin
ca
parents:
diff changeset
   194
     the MenuEditor may not be able to read the specification."
87bb1815460b initial checkin
ca
parents:
diff changeset
   195
87bb1815460b initial checkin
ca
parents:
diff changeset
   196
    "
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   197
     MenuEditor new openOnClass:Tools::ViewTreeApplication andSelector:#menu
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   198
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeApplication menu)) startUp
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   199
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   200
87bb1815460b initial checkin
ca
parents:
diff changeset
   201
    <resource: #menu>
87bb1815460b initial checkin
ca
parents:
diff changeset
   202
87bb1815460b initial checkin
ca
parents:
diff changeset
   203
    ^ 
87bb1815460b initial checkin
ca
parents:
diff changeset
   204
     #(Menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   205
        (
87bb1815460b initial checkin
ca
parents:
diff changeset
   206
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   207
            label: 'File'
87bb1815460b initial checkin
ca
parents:
diff changeset
   208
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   209
            submenu: 
87bb1815460b initial checkin
ca
parents:
diff changeset
   210
           (Menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   211
              (
87bb1815460b initial checkin
ca
parents:
diff changeset
   212
               (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   213
                  label: 'Pick a View'
87bb1815460b initial checkin
ca
parents:
diff changeset
   214
                  itemValue: doPickViews
87bb1815460b initial checkin
ca
parents:
diff changeset
   215
                  translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   216
                )
87bb1815460b initial checkin
ca
parents:
diff changeset
   217
               (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   218
                  enabled: hasPickedView
87bb1815460b initial checkin
ca
parents:
diff changeset
   219
                  label: 'Release Picked View'
87bb1815460b initial checkin
ca
parents:
diff changeset
   220
                  itemValue: doUnpick
87bb1815460b initial checkin
ca
parents:
diff changeset
   221
                  translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   222
                )
87bb1815460b initial checkin
ca
parents:
diff changeset
   223
               (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   224
                  label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   225
                )
87bb1815460b initial checkin
ca
parents:
diff changeset
   226
               (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   227
                  label: 'Exit'
87bb1815460b initial checkin
ca
parents:
diff changeset
   228
                  itemValue: closeRequest
87bb1815460b initial checkin
ca
parents:
diff changeset
   229
                  translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   230
                )
87bb1815460b initial checkin
ca
parents:
diff changeset
   231
               )
87bb1815460b initial checkin
ca
parents:
diff changeset
   232
              nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   233
              nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   234
            )
87bb1815460b initial checkin
ca
parents:
diff changeset
   235
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   236
         (MenuItem
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   237
            label: 'Settings'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   238
            translateLabel: true
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   239
            submenu: 
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   240
           (Menu
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   241
              (
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   242
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   243
                  label: 'Test Mode'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   244
                  translateLabel: true
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   245
                  hideMenuOnActivated: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   246
                  indication: testModeChannel
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   247
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   248
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   249
                  enabled: testModeChannel
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   250
                  label: 'Follow Focus'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   251
                  translateLabel: true
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   252
                  hideMenuOnActivated: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   253
                  indication: followFocusChannel
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   254
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   255
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   256
                  label: '-'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   257
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   258
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   259
                  label: 'Select on Click'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   260
                  translateLabel: true
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   261
                  hideMenuOnActivated: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   262
                  indication: selectOnClickHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   263
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   264
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   265
                  label: '-'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   266
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   267
               (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   268
                  label: 'Show Name of Widgets'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   269
                  translateLabel: true
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   270
                  hideMenuOnActivated: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   271
                  indication: showNamesHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   272
                )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   273
               )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   274
              nil
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   275
              nil
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   276
            )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   277
          )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   278
         (MenuItem
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   279
            label: ''
87bb1815460b initial checkin
ca
parents:
diff changeset
   280
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   281
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   282
            enabled: hasSingleSelectionHolder
87bb1815460b initial checkin
ca
parents:
diff changeset
   283
            label: 'Menu'
87bb1815460b initial checkin
ca
parents:
diff changeset
   284
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   285
            submenuChannel: middleButtonMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   286
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   287
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   288
            label: 'Components'
87bb1815460b initial checkin
ca
parents:
diff changeset
   289
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   290
            startGroup: right
87bb1815460b initial checkin
ca
parents:
diff changeset
   291
            submenuChannel: submenuComponents:
87bb1815460b initial checkin
ca
parents:
diff changeset
   292
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   293
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   294
            label: 'Applications'
87bb1815460b initial checkin
ca
parents:
diff changeset
   295
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   296
            submenuChannel: submenuApplications:
87bb1815460b initial checkin
ca
parents:
diff changeset
   297
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   298
         )
87bb1815460b initial checkin
ca
parents:
diff changeset
   299
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   300
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   301
      )
87bb1815460b initial checkin
ca
parents:
diff changeset
   302
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   303
87bb1815460b initial checkin
ca
parents:
diff changeset
   304
middleButtonMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   305
    "This resource specification was automatically generated
87bb1815460b initial checkin
ca
parents:
diff changeset
   306
     by the MenuEditor of ST/X."
87bb1815460b initial checkin
ca
parents:
diff changeset
   307
87bb1815460b initial checkin
ca
parents:
diff changeset
   308
    "Do not manually edit this!! If it is corrupted,
87bb1815460b initial checkin
ca
parents:
diff changeset
   309
     the MenuEditor may not be able to read the specification."
87bb1815460b initial checkin
ca
parents:
diff changeset
   310
87bb1815460b initial checkin
ca
parents:
diff changeset
   311
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   312
     MenuEditor new openOnClass:ViewTreeApplication andSelector:#middleButtonMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   313
     (Menu new fromLiteralArrayEncoding:(ViewTreeApplication middleButtonMenu)) startUp
87bb1815460b initial checkin
ca
parents:
diff changeset
   314
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   315
87bb1815460b initial checkin
ca
parents:
diff changeset
   316
    <resource: #menu>
87bb1815460b initial checkin
ca
parents:
diff changeset
   317
87bb1815460b initial checkin
ca
parents:
diff changeset
   318
    ^ 
87bb1815460b initial checkin
ca
parents:
diff changeset
   319
     #(Menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   320
        (
87bb1815460b initial checkin
ca
parents:
diff changeset
   321
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   322
            label: 'Geometry'
87bb1815460b initial checkin
ca
parents:
diff changeset
   323
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   324
            submenuChannel: submenuGeometry:
87bb1815460b initial checkin
ca
parents:
diff changeset
   325
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   326
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   327
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   328
            label: 'Interface'
87bb1815460b initial checkin
ca
parents:
diff changeset
   329
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   330
            submenuChannel: submenuInterface:
87bb1815460b initial checkin
ca
parents:
diff changeset
   331
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   332
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   333
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   334
            label: 'Visibility'
87bb1815460b initial checkin
ca
parents:
diff changeset
   335
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   336
            submenuChannel: submenuVisibility:
87bb1815460b initial checkin
ca
parents:
diff changeset
   337
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   338
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   339
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   340
            label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   341
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   342
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   343
            label: 'Browse View Class'
87bb1815460b initial checkin
ca
parents:
diff changeset
   344
            itemValue: doBrowse:
87bb1815460b initial checkin
ca
parents:
diff changeset
   345
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   346
            argument: view
87bb1815460b initial checkin
ca
parents:
diff changeset
   347
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   348
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   349
            label: 'Browse Model Class'
87bb1815460b initial checkin
ca
parents:
diff changeset
   350
            itemValue: doBrowse:
87bb1815460b initial checkin
ca
parents:
diff changeset
   351
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   352
            isVisible: hasModel
87bb1815460b initial checkin
ca
parents:
diff changeset
   353
            argument: model
87bb1815460b initial checkin
ca
parents:
diff changeset
   354
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   355
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   356
            label: 'Browse Application Class'
87bb1815460b initial checkin
ca
parents:
diff changeset
   357
            itemValue: doBrowse:
87bb1815460b initial checkin
ca
parents:
diff changeset
   358
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   359
            isVisible: hasApplication
87bb1815460b initial checkin
ca
parents:
diff changeset
   360
            argument: application
87bb1815460b initial checkin
ca
parents:
diff changeset
   361
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   362
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   363
            label: 'Browse Controller Class'
87bb1815460b initial checkin
ca
parents:
diff changeset
   364
            itemValue: doBrowse:
87bb1815460b initial checkin
ca
parents:
diff changeset
   365
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   366
            isVisible: hasController
87bb1815460b initial checkin
ca
parents:
diff changeset
   367
            argument: controller
87bb1815460b initial checkin
ca
parents:
diff changeset
   368
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   369
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   370
            label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   371
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   372
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   373
            label: 'Inspect View'
87bb1815460b initial checkin
ca
parents:
diff changeset
   374
            itemValue: doInspect:
87bb1815460b initial checkin
ca
parents:
diff changeset
   375
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   376
            argument: view
87bb1815460b initial checkin
ca
parents:
diff changeset
   377
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   378
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   379
            label: 'Inspect Window Group'
87bb1815460b initial checkin
ca
parents:
diff changeset
   380
            itemValue: doInspect:
87bb1815460b initial checkin
ca
parents:
diff changeset
   381
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   382
            argument: group
87bb1815460b initial checkin
ca
parents:
diff changeset
   383
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   384
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   385
            label: 'Inspect Model'
87bb1815460b initial checkin
ca
parents:
diff changeset
   386
            itemValue: doInspect:
87bb1815460b initial checkin
ca
parents:
diff changeset
   387
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   388
            isVisible: hasModel
87bb1815460b initial checkin
ca
parents:
diff changeset
   389
            argument: model
87bb1815460b initial checkin
ca
parents:
diff changeset
   390
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   391
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   392
            label: 'Inspect Application'
87bb1815460b initial checkin
ca
parents:
diff changeset
   393
            itemValue: doInspect:
87bb1815460b initial checkin
ca
parents:
diff changeset
   394
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   395
            isVisible: hasApplication
87bb1815460b initial checkin
ca
parents:
diff changeset
   396
            argument: application
87bb1815460b initial checkin
ca
parents:
diff changeset
   397
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   398
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   399
            label: 'Inspect Controller'
87bb1815460b initial checkin
ca
parents:
diff changeset
   400
            itemValue: doInspect:
87bb1815460b initial checkin
ca
parents:
diff changeset
   401
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   402
            isVisible: hasController
87bb1815460b initial checkin
ca
parents:
diff changeset
   403
            argument: controller
87bb1815460b initial checkin
ca
parents:
diff changeset
   404
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   405
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   406
            label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   407
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   408
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   409
            label: 'Flash'
87bb1815460b initial checkin
ca
parents:
diff changeset
   410
            itemValue: doFlash
87bb1815460b initial checkin
ca
parents:
diff changeset
   411
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   412
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   413
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   414
            label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   415
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   416
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   417
            label: 'Destroy'
87bb1815460b initial checkin
ca
parents:
diff changeset
   418
            itemValue: doDestroy
87bb1815460b initial checkin
ca
parents:
diff changeset
   419
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   420
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   421
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   422
            label: '-'
87bb1815460b initial checkin
ca
parents:
diff changeset
   423
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   424
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   425
            label: 'Instance Variables'
87bb1815460b initial checkin
ca
parents:
diff changeset
   426
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   427
            submenuChannel: submenuInspector:
87bb1815460b initial checkin
ca
parents:
diff changeset
   428
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   429
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   430
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   431
            label: '='
87bb1815460b initial checkin
ca
parents:
diff changeset
   432
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   433
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   434
            label: ''
87bb1815460b initial checkin
ca
parents:
diff changeset
   435
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   436
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   437
            enabled: selectedComponentHasChildren
87bb1815460b initial checkin
ca
parents:
diff changeset
   438
            label: 'Applications'
87bb1815460b initial checkin
ca
parents:
diff changeset
   439
            nameKey: single
87bb1815460b initial checkin
ca
parents:
diff changeset
   440
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   441
            submenuChannel: submenuApplications:
87bb1815460b initial checkin
ca
parents:
diff changeset
   442
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   443
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   444
         (MenuItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   445
            enabled: selectedComponentHasChildren
87bb1815460b initial checkin
ca
parents:
diff changeset
   446
            label: 'Components'
87bb1815460b initial checkin
ca
parents:
diff changeset
   447
            nameKey: single
87bb1815460b initial checkin
ca
parents:
diff changeset
   448
            translateLabel: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   449
            submenuChannel: submenuComponents:
87bb1815460b initial checkin
ca
parents:
diff changeset
   450
            keepLinkedMenu: true
87bb1815460b initial checkin
ca
parents:
diff changeset
   451
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   452
         )
87bb1815460b initial checkin
ca
parents:
diff changeset
   453
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   454
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   455
      )
87bb1815460b initial checkin
ca
parents:
diff changeset
   456
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   457
87bb1815460b initial checkin
ca
parents:
diff changeset
   458
toolbarMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   459
    "This resource specification was automatically generated
87bb1815460b initial checkin
ca
parents:
diff changeset
   460
     by the MenuEditor of ST/X."
87bb1815460b initial checkin
ca
parents:
diff changeset
   461
87bb1815460b initial checkin
ca
parents:
diff changeset
   462
    "Do not manually edit this!! If it is corrupted,
87bb1815460b initial checkin
ca
parents:
diff changeset
   463
     the MenuEditor may not be able to read the specification."
87bb1815460b initial checkin
ca
parents:
diff changeset
   464
87bb1815460b initial checkin
ca
parents:
diff changeset
   465
    "
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   466
     MenuEditor new openOnClass:Tools::ViewTreeApplication andSelector:#toolbarMenu
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   467
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeApplication toolbarMenu)) startUp
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   468
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   469
87bb1815460b initial checkin
ca
parents:
diff changeset
   470
    <resource: #menu>
87bb1815460b initial checkin
ca
parents:
diff changeset
   471
87bb1815460b initial checkin
ca
parents:
diff changeset
   472
    ^ 
87bb1815460b initial checkin
ca
parents:
diff changeset
   473
     #(Menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   474
        (
87bb1815460b initial checkin
ca
parents:
diff changeset
   475
         (MenuItem
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   476
            enabled: hasSingleSelectionHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   477
            label: 'Application'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   478
            itemValue: doBrowse:
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   479
            translateLabel: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   480
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   481
            argument: application
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   482
          )
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   483
         (MenuItem
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   484
            enabled: hasSingleSelectionHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   485
            label: 'Application'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   486
            itemValue: doInspect:
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   487
            translateLabel: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   488
            labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon 'Application')
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   489
            argument: application
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   490
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   491
         (MenuItem
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   492
            label: '-'
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   493
          )
87bb1815460b initial checkin
ca
parents:
diff changeset
   494
         (MenuItem
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   495
            enabled: hasSingleSelectionHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   496
            label: 'Widget'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   497
            itemValue: doBrowse:
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   498
            translateLabel: false
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   499
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   500
            argument: view
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   501
          )
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   502
         (MenuItem
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   503
            enabled: hasSingleSelectionHolder
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   504
            label: 'Widget'
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   505
            itemValue: doInspect:
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   506
            translateLabel: true
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   507
            labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon 'Widget')
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   508
            argument: view
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   509
          )
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   510
         )
87bb1815460b initial checkin
ca
parents:
diff changeset
   511
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   512
        nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   513
      )
87bb1815460b initial checkin
ca
parents:
diff changeset
   514
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   515
87bb1815460b initial checkin
ca
parents:
diff changeset
   516
!ViewTreeApplication methodsFor:'actions'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   517
87bb1815460b initial checkin
ca
parents:
diff changeset
   518
doubleClicked:anIndex
87bb1815460b initial checkin
ca
parents:
diff changeset
   519
    self doInspect:#view.
87bb1815460b initial checkin
ca
parents:
diff changeset
   520
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   521
87bb1815460b initial checkin
ca
parents:
diff changeset
   522
indicatorClicked:anIndex
87bb1815460b initial checkin
ca
parents:
diff changeset
   523
    |item sensor|
87bb1815460b initial checkin
ca
parents:
diff changeset
   524
87bb1815460b initial checkin
ca
parents:
diff changeset
   525
    item := model listOfItems at:anIndex ifAbsent:nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   526
87bb1815460b initial checkin
ca
parents:
diff changeset
   527
    item notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   528
        (     (sensor := self window sensor) notNil
87bb1815460b initial checkin
ca
parents:
diff changeset
   529
         and:[(sensor ctrlDown or:[sensor shiftDown])]
87bb1815460b initial checkin
ca
parents:
diff changeset
   530
        ) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   531
            item recursiveToggleExpand
87bb1815460b initial checkin
ca
parents:
diff changeset
   532
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   533
            item toggleExpand
87bb1815460b initial checkin
ca
parents:
diff changeset
   534
        ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   535
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   536
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   537
87bb1815460b initial checkin
ca
parents:
diff changeset
   538
!ViewTreeApplication methodsFor:'aspects'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   539
87bb1815460b initial checkin
ca
parents:
diff changeset
   540
followFocusChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   541
    "boolean holder, which indicates whether selection changed dependend on the focus view
87bb1815460b initial checkin
ca
parents:
diff changeset
   542
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   543
    ^ followFocusChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   544
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   545
87bb1815460b initial checkin
ca
parents:
diff changeset
   546
hasSingleSelectionHolder
87bb1815460b initial checkin
ca
parents:
diff changeset
   547
    "boolean holder, true if one item is selected
87bb1815460b initial checkin
ca
parents:
diff changeset
   548
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   549
    ^ hasSingleSelectionHolder
87bb1815460b initial checkin
ca
parents:
diff changeset
   550
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   551
87bb1815460b initial checkin
ca
parents:
diff changeset
   552
infoChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   553
    "channel, which keeps a printable information
87bb1815460b initial checkin
ca
parents:
diff changeset
   554
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   555
    ^ infoChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   556
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   557
87bb1815460b initial checkin
ca
parents:
diff changeset
   558
listOfItems
87bb1815460b initial checkin
ca
parents:
diff changeset
   559
    "returns the hierarchical list of items
87bb1815460b initial checkin
ca
parents:
diff changeset
   560
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   561
    ^ model listOfItems
87bb1815460b initial checkin
ca
parents:
diff changeset
   562
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   563
87bb1815460b initial checkin
ca
parents:
diff changeset
   564
model
87bb1815460b initial checkin
ca
parents:
diff changeset
   565
    "returns my selection model, a ViewTreeModel
87bb1815460b initial checkin
ca
parents:
diff changeset
   566
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   567
    ^ model
87bb1815460b initial checkin
ca
parents:
diff changeset
   568
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   569
87bb1815460b initial checkin
ca
parents:
diff changeset
   570
selectOnClickHolder
87bb1815460b initial checkin
ca
parents:
diff changeset
   571
    "boolean holder, which indicates whether the selection will change on click
87bb1815460b initial checkin
ca
parents:
diff changeset
   572
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   573
    ^ model selectOnClickHolder
87bb1815460b initial checkin
ca
parents:
diff changeset
   574
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   575
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   576
showNamesHolder
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   577
    "boolean holder, which indicates whether application names or widget names
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   578
     as additional text are shown for the items
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   579
    "
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   580
    ^ showNamesHolder
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   581
!
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   582
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   583
testModeChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   584
    "boolean holder, which indicates whether running in test or edit mode (eat input events)
87bb1815460b initial checkin
ca
parents:
diff changeset
   585
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   586
    ^ testModeChannel
87bb1815460b initial checkin
ca
parents:
diff changeset
   587
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   588
87bb1815460b initial checkin
ca
parents:
diff changeset
   589
!ViewTreeApplication methodsFor:'change & update'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   590
87bb1815460b initial checkin
ca
parents:
diff changeset
   591
selectionChanged
87bb1815460b initial checkin
ca
parents:
diff changeset
   592
    "called if the selection changed
87bb1815460b initial checkin
ca
parents:
diff changeset
   593
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   594
    |info view item|
87bb1815460b initial checkin
ca
parents:
diff changeset
   595
87bb1815460b initial checkin
ca
parents:
diff changeset
   596
    item := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
   597
87bb1815460b initial checkin
ca
parents:
diff changeset
   598
    item notNil ifTrue:[ |state|
87bb1815460b initial checkin
ca
parents:
diff changeset
   599
        view := item widget.
87bb1815460b initial checkin
ca
parents:
diff changeset
   600
87bb1815460b initial checkin
ca
parents:
diff changeset
   601
        view id isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   602
            state := 'no ID'.
87bb1815460b initial checkin
ca
parents:
diff changeset
   603
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   604
            view shown ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   605
                state := 'visible'.
87bb1815460b initial checkin
ca
parents:
diff changeset
   606
            ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   607
                state := 'invisible'
87bb1815460b initial checkin
ca
parents:
diff changeset
   608
            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   609
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   610
        info := '%1 [%2] - %3' bindWith:(view class name)
87bb1815460b initial checkin
ca
parents:
diff changeset
   611
                                   with:(view name ? '') with:state allBold.
87bb1815460b initial checkin
ca
parents:
diff changeset
   612
87bb1815460b initial checkin
ca
parents:
diff changeset
   613
    ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   614
        info := ''
87bb1815460b initial checkin
ca
parents:
diff changeset
   615
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   616
    hasSingleSelectionHolder value:(view notNil).
87bb1815460b initial checkin
ca
parents:
diff changeset
   617
    infoChannel value:info.
87bb1815460b initial checkin
ca
parents:
diff changeset
   618
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   619
87bb1815460b initial checkin
ca
parents:
diff changeset
   620
update:something with:someArgument from:aModel
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   621
    |oldSelection|
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   622
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   623
    oldSelection := model selectedItem.
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   624
87bb1815460b initial checkin
ca
parents:
diff changeset
   625
    aModel == testModeChannel ifTrue:[
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   626
        model selectedItem:nil.
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   627
        model testMode:(testModeChannel value).
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   628
        model selectedItem:oldSelection.
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   629
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
   630
    ].
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   631
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   632
    aModel == showNamesHolder ifTrue:[
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   633
        model selectedItem:nil.
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   634
        self listOfItems showWidgetNames:(aModel value).
2454
4867f3e9dd43 *** empty log message ***
ca
parents: 2451
diff changeset
   635
        model selectedItem:oldSelection.
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   636
        ^ self
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   637
    ].
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   638
    super update:something with:someArgument from:aModel.
87bb1815460b initial checkin
ca
parents:
diff changeset
   639
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   640
87bb1815460b initial checkin
ca
parents:
diff changeset
   641
!ViewTreeApplication methodsFor:'event processing'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   642
87bb1815460b initial checkin
ca
parents:
diff changeset
   643
processButtonMotionEvent:ev
87bb1815460b initial checkin
ca
parents:
diff changeset
   644
    "handle a button motion event
87bb1815460b initial checkin
ca
parents:
diff changeset
   645
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   646
    |click|
87bb1815460b initial checkin
ca
parents:
diff changeset
   647
87bb1815460b initial checkin
ca
parents:
diff changeset
   648
    motionAction notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   649
        click := ev view sensor mousePoint.
87bb1815460b initial checkin
ca
parents:
diff changeset
   650
87bb1815460b initial checkin
ca
parents:
diff changeset
   651
        click = clickedPoint ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   652
            (clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   653
                motionAction value:click
87bb1815460b initial checkin
ca
parents:
diff changeset
   654
            ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   655
        ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   656
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   657
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   658
87bb1815460b initial checkin
ca
parents:
diff changeset
   659
processButtonPressEvent:ev
87bb1815460b initial checkin
ca
parents:
diff changeset
   660
    "handle a buttopn press event
87bb1815460b initial checkin
ca
parents:
diff changeset
   661
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   662
    |sensor lastRectangle|
87bb1815460b initial checkin
ca
parents:
diff changeset
   663
87bb1815460b initial checkin
ca
parents:
diff changeset
   664
    sensor      := model rootView sensor.
87bb1815460b initial checkin
ca
parents:
diff changeset
   665
    clickedItem := model listOfItems detectItemRespondsToView:(ev view).
87bb1815460b initial checkin
ca
parents:
diff changeset
   666
87bb1815460b initial checkin
ca
parents:
diff changeset
   667
    (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   668
        clickedItem notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   669
            self selectOnClickHolder value ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   670
                model toggleSelectItem:clickedItem
87bb1815460b initial checkin
ca
parents:
diff changeset
   671
            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   672
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   673
        clickedItem := motionAction := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   674
    ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   675
        clickedPoint  := ev view sensor mousePoint.
87bb1815460b initial checkin
ca
parents:
diff changeset
   676
        lastRectangle := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   677
87bb1815460b initial checkin
ca
parents:
diff changeset
   678
        motionAction :=[:p| |rootView|
87bb1815460b initial checkin
ca
parents:
diff changeset
   679
            rootView    := model rootView device rootView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   680
            clickedItem := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   681
87bb1815460b initial checkin
ca
parents:
diff changeset
   682
            rootView xoring:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   683
                lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   684
                                    ifFalse:[ rootView clippedByChildren:false ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   685
87bb1815460b initial checkin
ca
parents:
diff changeset
   686
                p isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   687
                    rootView clippedByChildren:true.
87bb1815460b initial checkin
ca
parents:
diff changeset
   688
                    motionAction := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   689
                ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   690
                    lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
87bb1815460b initial checkin
ca
parents:
diff changeset
   691
                    rootView displayRectangle:lastRectangle.
87bb1815460b initial checkin
ca
parents:
diff changeset
   692
                ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   693
                rootView flush.
87bb1815460b initial checkin
ca
parents:
diff changeset
   694
            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   695
            lastRectangle
87bb1815460b initial checkin
ca
parents:
diff changeset
   696
        ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   697
    ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   698
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   699
87bb1815460b initial checkin
ca
parents:
diff changeset
   700
processButtonReleaseEvent:anEvent
87bb1815460b initial checkin
ca
parents:
diff changeset
   701
    "handle a button release event
87bb1815460b initial checkin
ca
parents:
diff changeset
   702
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   703
    |rootView rectangle newItems widget origin|
87bb1815460b initial checkin
ca
parents:
diff changeset
   704
87bb1815460b initial checkin
ca
parents:
diff changeset
   705
    motionAction isNil ifTrue:[ ^ self ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   706
    clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   707
87bb1815460b initial checkin
ca
parents:
diff changeset
   708
    (rectangle := motionAction value:nil) notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   709
        rootView  := model rootView device rootView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   710
        newItems := OrderedCollection new.
87bb1815460b initial checkin
ca
parents:
diff changeset
   711
87bb1815460b initial checkin
ca
parents:
diff changeset
   712
        model rootItem recursiveDo:[:anItem|
87bb1815460b initial checkin
ca
parents:
diff changeset
   713
            widget := anItem widget.
87bb1815460b initial checkin
ca
parents:
diff changeset
   714
            origin := widget originRelativeTo:rootView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   715
87bb1815460b initial checkin
ca
parents:
diff changeset
   716
            (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   717
                newItems add:anItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
   718
            ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   719
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   720
        model value:newItems.
87bb1815460b initial checkin
ca
parents:
diff changeset
   721
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   722
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   723
87bb1815460b initial checkin
ca
parents:
diff changeset
   724
processEvent:anEvent
87bb1815460b initial checkin
ca
parents:
diff changeset
   725
    "process an event
87bb1815460b initial checkin
ca
parents:
diff changeset
   726
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   727
    |button menu|
87bb1815460b initial checkin
ca
parents:
diff changeset
   728
87bb1815460b initial checkin
ca
parents:
diff changeset
   729
    anEvent isKeyPressEvent ifTrue:[ ^ self processKeyPressEvent:anEvent ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   730
    anEvent isButtonEvent  ifFalse:[ ^ self ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   731
87bb1815460b initial checkin
ca
parents:
diff changeset
   732
    button := anEvent button.
87bb1815460b initial checkin
ca
parents:
diff changeset
   733
87bb1815460b initial checkin
ca
parents:
diff changeset
   734
    (button == 2 or:[button == #menu]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   735
        motionAction isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   736
            anEvent isButtonPressEvent ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   737
                self selectOnClickHolder value ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   738
                    menu := self middleButtonMenu value.
87bb1815460b initial checkin
ca
parents:
diff changeset
   739
                    menu notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   740
                        menu := MenuPanel menu:(Menu new fromLiteralArrayEncoding:menu)
87bb1815460b initial checkin
ca
parents:
diff changeset
   741
                                      receiver:self.
87bb1815460b initial checkin
ca
parents:
diff changeset
   742
                        menu startUp.
87bb1815460b initial checkin
ca
parents:
diff changeset
   743
                    ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   744
                ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   745
            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   746
            clickedItem := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   747
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   748
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
   749
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   750
87bb1815460b initial checkin
ca
parents:
diff changeset
   751
    anEvent isButtonPressEvent  ifTrue:[ ^ self processButtonPressEvent:anEvent  ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   752
    anEvent isButtonMotionEvent ifTrue:[ ^ self processButtonMotionEvent:anEvent ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   753
87bb1815460b initial checkin
ca
parents:
diff changeset
   754
    anEvent isButtonReleaseEvent ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   755
        self selectOnClickHolder value ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   756
            self processButtonReleaseEvent:anEvent
87bb1815460b initial checkin
ca
parents:
diff changeset
   757
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   758
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   759
    clickedItem := motionAction := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   760
87bb1815460b initial checkin
ca
parents:
diff changeset
   761
    anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   762
        self selectOnClickHolder value ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   763
            self doInspect:#view.
87bb1815460b initial checkin
ca
parents:
diff changeset
   764
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   765
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   766
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   767
87bb1815460b initial checkin
ca
parents:
diff changeset
   768
processKeyPressEvent:anEvent
87bb1815460b initial checkin
ca
parents:
diff changeset
   769
    "process an key press event
87bb1815460b initial checkin
ca
parents:
diff changeset
   770
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   771
    |item prnt idx key max next|
87bb1815460b initial checkin
ca
parents:
diff changeset
   772
87bb1815460b initial checkin
ca
parents:
diff changeset
   773
    key := anEvent key.
87bb1815460b initial checkin
ca
parents:
diff changeset
   774
    key isSymbol ifFalse:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
   775
87bb1815460b initial checkin
ca
parents:
diff changeset
   776
    key == #Delete    ifTrue:[ ^ self doDestroy ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   777
    key == #InspectIt ifTrue:[ ^ self doInspect:#view ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   778
87bb1815460b initial checkin
ca
parents:
diff changeset
   779
    (   key == #CursorUp
87bb1815460b initial checkin
ca
parents:
diff changeset
   780
    or:[key == #CursorDown
87bb1815460b initial checkin
ca
parents:
diff changeset
   781
    or:[key == #CursorLeft
87bb1815460b initial checkin
ca
parents:
diff changeset
   782
    or:[key == #CursorRight]]]
87bb1815460b initial checkin
ca
parents:
diff changeset
   783
    ) ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   784
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
   785
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   786
    item := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
   787
87bb1815460b initial checkin
ca
parents:
diff changeset
   788
    item isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   789
        ^ model selectedItem:(model first ? model rootItem)
87bb1815460b initial checkin
ca
parents:
diff changeset
   790
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   791
87bb1815460b initial checkin
ca
parents:
diff changeset
   792
    prnt := item parent.
87bb1815460b initial checkin
ca
parents:
diff changeset
   793
    prnt isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   794
        "/ is the root item
87bb1815460b initial checkin
ca
parents:
diff changeset
   795
        (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
87bb1815460b initial checkin
ca
parents:
diff changeset
   796
                                                  ifFalse:[item := item at:1 ifAbsent:item].
87bb1815460b initial checkin
ca
parents:
diff changeset
   797
87bb1815460b initial checkin
ca
parents:
diff changeset
   798
      ^ model selectedItem:item
87bb1815460b initial checkin
ca
parents:
diff changeset
   799
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   800
    key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   801
87bb1815460b initial checkin
ca
parents:
diff changeset
   802
    key == #CursorRight ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   803
        next := item at:1 ifAbsent:nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   804
        next notNil ifTrue:[ model selectedItem:next ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   805
      ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
   806
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   807
87bb1815460b initial checkin
ca
parents:
diff changeset
   808
    max := prnt size.
87bb1815460b initial checkin
ca
parents:
diff changeset
   809
87bb1815460b initial checkin
ca
parents:
diff changeset
   810
    key == #CursorUp ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   811
        idx := prnt identityIndexOf:item.
87bb1815460b initial checkin
ca
parents:
diff changeset
   812
        idx == 1 ifTrue:[idx := max + 1].
87bb1815460b initial checkin
ca
parents:
diff changeset
   813
        model selectedItem:(prnt at:idx - 1).
87bb1815460b initial checkin
ca
parents:
diff changeset
   814
      ^ self.
87bb1815460b initial checkin
ca
parents:
diff changeset
   815
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   816
87bb1815460b initial checkin
ca
parents:
diff changeset
   817
    key == #CursorDown ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   818
        idx := prnt identityIndexOf:item.
87bb1815460b initial checkin
ca
parents:
diff changeset
   819
        idx == max ifTrue:[idx := 0].
87bb1815460b initial checkin
ca
parents:
diff changeset
   820
        model selectedItem:(prnt at:idx + 1).
87bb1815460b initial checkin
ca
parents:
diff changeset
   821
      ^ self.
87bb1815460b initial checkin
ca
parents:
diff changeset
   822
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   823
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   824
87bb1815460b initial checkin
ca
parents:
diff changeset
   825
processMappedView:aView
87bb1815460b initial checkin
ca
parents:
diff changeset
   826
    "process a mapped event
87bb1815460b initial checkin
ca
parents:
diff changeset
   827
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   828
    |parent anchor|
87bb1815460b initial checkin
ca
parents:
diff changeset
   829
87bb1815460b initial checkin
ca
parents:
diff changeset
   830
    parent := self listOfItems detectItemRespondsToView:aView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   831
    parent isNil ifTrue:[ ^ self ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   832
87bb1815460b initial checkin
ca
parents:
diff changeset
   833
    NotFoundSignal handle:[:ex|
87bb1815460b initial checkin
ca
parents:
diff changeset
   834
        "contained subvies used by spec are not yet created;
87bb1815460b initial checkin
ca
parents:
diff changeset
   835
         thus we have to wait until last used subview is build
87bb1815460b initial checkin
ca
parents:
diff changeset
   836
        "
87bb1815460b initial checkin
ca
parents:
diff changeset
   837
        anchor := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   838
    ] do:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   839
        anchor := parent class buildViewsFrom:(parent widget).
87bb1815460b initial checkin
ca
parents:
diff changeset
   840
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   841
    anchor notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   842
        parent updateFromChildren:anchor children.
87bb1815460b initial checkin
ca
parents:
diff changeset
   843
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   844
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   845
87bb1815460b initial checkin
ca
parents:
diff changeset
   846
!ViewTreeApplication methodsFor:'initialization & release'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   847
87bb1815460b initial checkin
ca
parents:
diff changeset
   848
closeDownViews
87bb1815460b initial checkin
ca
parents:
diff changeset
   849
    "release the grapped application
87bb1815460b initial checkin
ca
parents:
diff changeset
   850
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   851
    process := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
   852
    super closeDownViews.
87bb1815460b initial checkin
ca
parents:
diff changeset
   853
    self doUnpick.
87bb1815460b initial checkin
ca
parents:
diff changeset
   854
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   855
87bb1815460b initial checkin
ca
parents:
diff changeset
   856
initialize
87bb1815460b initial checkin
ca
parents:
diff changeset
   857
    "setup my model and channels
87bb1815460b initial checkin
ca
parents:
diff changeset
   858
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   859
    super initialize.
87bb1815460b initial checkin
ca
parents:
diff changeset
   860
87bb1815460b initial checkin
ca
parents:
diff changeset
   861
    infoChannel              := ''    asValue.
87bb1815460b initial checkin
ca
parents:
diff changeset
   862
    hasSingleSelectionHolder := false asValue.
87bb1815460b initial checkin
ca
parents:
diff changeset
   863
    followFocusChannel       := false asValue.
87bb1815460b initial checkin
ca
parents:
diff changeset
   864
87bb1815460b initial checkin
ca
parents:
diff changeset
   865
    model := ViewTreeModel new.
87bb1815460b initial checkin
ca
parents:
diff changeset
   866
    model inputEventAction:[:ev| self processEvent:ev ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   867
    model mappedViewAction:[:vw| self processMappedView:vw ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   868
    model application:self.
87bb1815460b initial checkin
ca
parents:
diff changeset
   869
87bb1815460b initial checkin
ca
parents:
diff changeset
   870
    testModeChannel := model testMode asValue.
87bb1815460b initial checkin
ca
parents:
diff changeset
   871
    testModeChannel addDependent:self.
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   872
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   873
    showNamesHolder := false asValue.
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   874
    showNamesHolder addDependent:self.
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   875
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   876
87bb1815460b initial checkin
ca
parents:
diff changeset
   877
postBuildTree:aTree
87bb1815460b initial checkin
ca
parents:
diff changeset
   878
    treeView := aTree scrolledView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   879
    treeView hasConstantHeight:true.
87bb1815460b initial checkin
ca
parents:
diff changeset
   880
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   881
2451
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   882
!ViewTreeApplication methodsFor:'menu actions'!
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   883
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   884
doShowNames
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   885
    "automatically generated by UIEditor ..."
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   886
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   887
    "*** the code below performs no action"
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   888
    "*** (except for some feedback on the Transcript)"
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   889
    "*** Please change as required and accept in the browser."
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   890
    "*** (and replace this comment by something more useful ;-)"
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   891
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   892
    "action to be added ..."
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   893
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   894
    Transcript showCR:self class name, ': action for #doShowNames ...'.
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   895
! !
cbda60900ced *** empty log message ***
ca
parents: 2177
diff changeset
   896
2177
87bb1815460b initial checkin
ca
parents:
diff changeset
   897
!ViewTreeApplication methodsFor:'menu queries'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   898
87bb1815460b initial checkin
ca
parents:
diff changeset
   899
hasApplication
87bb1815460b initial checkin
ca
parents:
diff changeset
   900
    "returns true if the current selected view has an application
87bb1815460b initial checkin
ca
parents:
diff changeset
   901
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   902
    |view|
87bb1815460b initial checkin
ca
parents:
diff changeset
   903
87bb1815460b initial checkin
ca
parents:
diff changeset
   904
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   905
  ^ (view notNil and:[view application notNil])
87bb1815460b initial checkin
ca
parents:
diff changeset
   906
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   907
87bb1815460b initial checkin
ca
parents:
diff changeset
   908
hasController
87bb1815460b initial checkin
ca
parents:
diff changeset
   909
    "returns true if the current selected item's view has a controller
87bb1815460b initial checkin
ca
parents:
diff changeset
   910
     other than nil or the view itself
87bb1815460b initial checkin
ca
parents:
diff changeset
   911
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   912
    |view controller|
87bb1815460b initial checkin
ca
parents:
diff changeset
   913
87bb1815460b initial checkin
ca
parents:
diff changeset
   914
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   915
87bb1815460b initial checkin
ca
parents:
diff changeset
   916
    view notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   917
        controller := view controller.
87bb1815460b initial checkin
ca
parents:
diff changeset
   918
      ^ (controller notNil and:[controller ~~ view])
87bb1815460b initial checkin
ca
parents:
diff changeset
   919
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   920
    ^ false
87bb1815460b initial checkin
ca
parents:
diff changeset
   921
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   922
87bb1815460b initial checkin
ca
parents:
diff changeset
   923
hasModel
87bb1815460b initial checkin
ca
parents:
diff changeset
   924
    "returns true if the current selected view has a model
87bb1815460b initial checkin
ca
parents:
diff changeset
   925
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   926
    |view|
87bb1815460b initial checkin
ca
parents:
diff changeset
   927
87bb1815460b initial checkin
ca
parents:
diff changeset
   928
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
   929
  ^ (view notNil and:[view model notNil])
87bb1815460b initial checkin
ca
parents:
diff changeset
   930
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   931
87bb1815460b initial checkin
ca
parents:
diff changeset
   932
hasPickedView
87bb1815460b initial checkin
ca
parents:
diff changeset
   933
    "returns true if a view is picked
87bb1815460b initial checkin
ca
parents:
diff changeset
   934
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   935
    ^ model rootItem notNil
87bb1815460b initial checkin
ca
parents:
diff changeset
   936
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
   937
87bb1815460b initial checkin
ca
parents:
diff changeset
   938
!ViewTreeApplication methodsFor:'menu specs'!
87bb1815460b initial checkin
ca
parents:
diff changeset
   939
87bb1815460b initial checkin
ca
parents:
diff changeset
   940
middleButtonMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   941
    "returns the middleButton menu for the single selected item or nil
87bb1815460b initial checkin
ca
parents:
diff changeset
   942
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
   943
    ^ [ model selectedItem notNil ifTrue:[self class middleButtonMenu]
87bb1815460b initial checkin
ca
parents:
diff changeset
   944
                                 ifFalse:[nil]
87bb1815460b initial checkin
ca
parents:
diff changeset
   945
      ]
87bb1815460b initial checkin
ca
parents:
diff changeset
   946
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   947
87bb1815460b initial checkin
ca
parents:
diff changeset
   948
submenuApplications:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   949
    |applications menu item list addBlock|
87bb1815460b initial checkin
ca
parents:
diff changeset
   950
87bb1815460b initial checkin
ca
parents:
diff changeset
   951
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
87bb1815460b initial checkin
ca
parents:
diff changeset
   952
                                              ifFalse:[model rootItem].
87bb1815460b initial checkin
ca
parents:
diff changeset
   953
    item isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
   954
87bb1815460b initial checkin
ca
parents:
diff changeset
   955
    applications := IdentityDictionary new.
87bb1815460b initial checkin
ca
parents:
diff changeset
   956
87bb1815460b initial checkin
ca
parents:
diff changeset
   957
    addBlock := [:el| |cls ctr|
87bb1815460b initial checkin
ca
parents:
diff changeset
   958
        cls := self resolveApplicationClassFor:el.
87bb1815460b initial checkin
ca
parents:
diff changeset
   959
87bb1815460b initial checkin
ca
parents:
diff changeset
   960
        cls notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   961
            ctr := applications at:cls ifAbsent:0.
87bb1815460b initial checkin
ca
parents:
diff changeset
   962
            applications at:cls put:(ctr + 1).
87bb1815460b initial checkin
ca
parents:
diff changeset
   963
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   964
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   965
    item recursiveDo:addBlock.
87bb1815460b initial checkin
ca
parents:
diff changeset
   966
    addBlock value:item.
87bb1815460b initial checkin
ca
parents:
diff changeset
   967
87bb1815460b initial checkin
ca
parents:
diff changeset
   968
    applications isEmpty ifTrue:[^ nil ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   969
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   970
87bb1815460b initial checkin
ca
parents:
diff changeset
   971
    applications keysAndValuesDo:[:cls :ctr|
87bb1815460b initial checkin
ca
parents:
diff changeset
   972
       list add:(MenuDesc title:(cls name)
87bb1815460b initial checkin
ca
parents:
diff changeset
   973
                          value:(ctr printString)
87bb1815460b initial checkin
ca
parents:
diff changeset
   974
                         action:[self doSelectNextOfApplicationClass:cls startingIn:item]
87bb1815460b initial checkin
ca
parents:
diff changeset
   975
                 ).
87bb1815460b initial checkin
ca
parents:
diff changeset
   976
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   977
87bb1815460b initial checkin
ca
parents:
diff changeset
   978
    menu := MenuDesc buildFromList:list onGC:aMenu.
87bb1815460b initial checkin
ca
parents:
diff changeset
   979
    menu do:[:el|
87bb1815460b initial checkin
ca
parents:
diff changeset
   980
        el hideMenuOnActivated:false
87bb1815460b initial checkin
ca
parents:
diff changeset
   981
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
   982
    ^ menu
87bb1815460b initial checkin
ca
parents:
diff changeset
   983
!
87bb1815460b initial checkin
ca
parents:
diff changeset
   984
87bb1815460b initial checkin
ca
parents:
diff changeset
   985
submenuComponents:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
   986
    |widgets list total menu item|
87bb1815460b initial checkin
ca
parents:
diff changeset
   987
87bb1815460b initial checkin
ca
parents:
diff changeset
   988
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
87bb1815460b initial checkin
ca
parents:
diff changeset
   989
                                              ifFalse:[model rootItem].
87bb1815460b initial checkin
ca
parents:
diff changeset
   990
    item isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
   991
87bb1815460b initial checkin
ca
parents:
diff changeset
   992
    widgets := IdentityDictionary new.
87bb1815460b initial checkin
ca
parents:
diff changeset
   993
    total   := 0.
87bb1815460b initial checkin
ca
parents:
diff changeset
   994
87bb1815460b initial checkin
ca
parents:
diff changeset
   995
    item recursiveDo:[:el| |cls ctr|
87bb1815460b initial checkin
ca
parents:
diff changeset
   996
        cls := el widget.
87bb1815460b initial checkin
ca
parents:
diff changeset
   997
87bb1815460b initial checkin
ca
parents:
diff changeset
   998
        cls notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
   999
            cls := cls class.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1000
            ctr := widgets at:cls ifAbsent:0.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1001
            widgets at:cls put:(ctr + 1).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1002
            total := total + 1.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1003
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1004
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1005
    total == 0 ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1006
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1007
87bb1815460b initial checkin
ca
parents:
diff changeset
  1008
    widgets keysAndValuesDo:[:cls :ctr|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1009
        list add:(MenuDesc title:(cls name)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1010
                           value:(ctr printString)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1011
                          action:[self doSelectNextOfClass:cls startingIn:item]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1012
                 ).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1013
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1014
    list := list asOrderedCollection.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1015
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1016
    list add:(MenuDesc title:'Total' value:(total printString)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1017
    menu := MenuDesc buildFromList:list onGC:aMenu.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1018
    menu do:[:el|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1019
        el hideMenuOnActivated:false
87bb1815460b initial checkin
ca
parents:
diff changeset
  1020
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1021
    ^ menu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1022
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1023
87bb1815460b initial checkin
ca
parents:
diff changeset
  1024
submenuGeometry:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1025
    "builds and returns the geometry submenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1026
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1027
    |view point inst list x y|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1028
87bb1815460b initial checkin
ca
parents:
diff changeset
  1029
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1030
    view isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1031
87bb1815460b initial checkin
ca
parents:
diff changeset
  1032
    list := OrderedCollection new.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1033
87bb1815460b initial checkin
ca
parents:
diff changeset
  1034
    "/ origin
87bb1815460b initial checkin
ca
parents:
diff changeset
  1035
    point := view relativeOrigin.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1036
    point isNil ifTrue:[ point := view origin ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1037
87bb1815460b initial checkin
ca
parents:
diff changeset
  1038
    x := view left.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1039
    y := view top.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1040
87bb1815460b initial checkin
ca
parents:
diff changeset
  1041
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1042
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1043
87bb1815460b initial checkin
ca
parents:
diff changeset
  1044
    list add:(MenuDesc title:'origin' value:inst).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1045
87bb1815460b initial checkin
ca
parents:
diff changeset
  1046
    "/ corner
87bb1815460b initial checkin
ca
parents:
diff changeset
  1047
    point := view relativeCorner.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1048
    point isNil ifTrue:[ point := view corner ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1049
87bb1815460b initial checkin
ca
parents:
diff changeset
  1050
    x := view right.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1051
    y := view bottom.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1052
87bb1815460b initial checkin
ca
parents:
diff changeset
  1053
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1054
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1055
87bb1815460b initial checkin
ca
parents:
diff changeset
  1056
    list add:(MenuDesc title:'corner' value:inst).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1057
87bb1815460b initial checkin
ca
parents:
diff changeset
  1058
    "/ extent
87bb1815460b initial checkin
ca
parents:
diff changeset
  1059
    (point := view relativeExtent) isNil ifTrue:[point := view extent].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1060
    list add:(MenuDesc title:'extent' value:point).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1061
87bb1815460b initial checkin
ca
parents:
diff changeset
  1062
    "/ preferred extent
87bb1815460b initial checkin
ca
parents:
diff changeset
  1063
    list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1064
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1065
87bb1815460b initial checkin
ca
parents:
diff changeset
  1066
    "/ view insets
87bb1815460b initial checkin
ca
parents:
diff changeset
  1067
    inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1068
                                         with:(view rightInset)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1069
                                         with:(view topInset)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1070
                                         with:(view bottomInset).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1071
87bb1815460b initial checkin
ca
parents:
diff changeset
  1072
    list add:(MenuDesc title:'insets'      value:inst).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1073
    list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1074
    list add:(MenuDesc title:'level'       value:(view level)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1075
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1076
87bb1815460b initial checkin
ca
parents:
diff changeset
  1077
    (inst := view layout) notNil ifTrue:[ inst := inst displayString ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1078
    list add:(MenuDesc title:'layout' value:inst).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1079
87bb1815460b initial checkin
ca
parents:
diff changeset
  1080
    (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1081
    list add:(MenuDesc title:'transformation' value:inst).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1082
87bb1815460b initial checkin
ca
parents:
diff changeset
  1083
  ^ MenuDesc buildFromList:list onGC:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1084
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1085
87bb1815460b initial checkin
ca
parents:
diff changeset
  1086
submenuInspector:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1087
    "builds and returns the inspector submenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1088
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1089
    |view list n names label value|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1090
87bb1815460b initial checkin
ca
parents:
diff changeset
  1091
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1092
    view isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1093
87bb1815460b initial checkin
ca
parents:
diff changeset
  1094
    n := view class instSize.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1095
    n > 0 ifFalse:[^ nil ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1096
87bb1815460b initial checkin
ca
parents:
diff changeset
  1097
    list  := OrderedCollection new:n.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1098
    names := view class allInstVarNames.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1099
87bb1815460b initial checkin
ca
parents:
diff changeset
  1100
    1 to:n do:[:i| |action|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1101
        label := (names at:i) printString.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1102
        value := view instVarAt:i.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1103
        value isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1104
            value  := '------'.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1105
            action := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1106
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1107
            value  := value displayString contractAtEndTo:40.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1108
            action := [(view instVarAt:i) inspect].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1109
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1110
        list add:(MenuDesc title:label value:value action:action).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1111
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1112
87bb1815460b initial checkin
ca
parents:
diff changeset
  1113
    ^ MenuDesc buildFromList:list onGC:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1114
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1115
87bb1815460b initial checkin
ca
parents:
diff changeset
  1116
submenuInterface:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1117
    "builds and returns the interface submenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1118
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1119
    |view label inst value list|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1120
87bb1815460b initial checkin
ca
parents:
diff changeset
  1121
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1122
    view isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1123
87bb1815460b initial checkin
ca
parents:
diff changeset
  1124
    list := OrderedCollection new.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1125
87bb1815460b initial checkin
ca
parents:
diff changeset
  1126
    inst  := view controller.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1127
    value := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1128
87bb1815460b initial checkin
ca
parents:
diff changeset
  1129
    inst isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1130
        label := nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1131
    ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1132
        inst == view ifTrue:[ label := '== view itself' ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1133
                    ifFalse:[ label := inst displayString.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1134
                              value := [view controller inspect].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1135
                            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1136
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1137
    list add:(MenuDesc title:'controller' value:label action:value).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1138
87bb1815460b initial checkin
ca
parents:
diff changeset
  1139
    inst := view delegate.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1140
    inst notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1141
        list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1142
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1143
87bb1815460b initial checkin
ca
parents:
diff changeset
  1144
    inst := view application.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1145
87bb1815460b initial checkin
ca
parents:
diff changeset
  1146
    inst notNil ifTrue:[ |topAppl|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1147
        list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1148
87bb1815460b initial checkin
ca
parents:
diff changeset
  1149
        topAppl := inst topApplication.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1150
87bb1815460b initial checkin
ca
parents:
diff changeset
  1151
        (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1152
            list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1153
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1154
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1155
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1156
87bb1815460b initial checkin
ca
parents:
diff changeset
  1157
    (view respondsTo:#'model:') ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1158
        inst := model.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1159
87bb1815460b initial checkin
ca
parents:
diff changeset
  1160
        inst isNil ifTrue:[ label := value := nil ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1161
                  ifFalse:[ label := inst displayString.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1162
                            value := [ view model inspect ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1163
                          ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1164
87bb1815460b initial checkin
ca
parents:
diff changeset
  1165
        list add:(MenuDesc title:'model' value:label action:value).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1166
87bb1815460b initial checkin
ca
parents:
diff changeset
  1167
        (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1168
            view modelInterface keysAndValuesDo:[:key : val|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1169
                val isNil ifTrue:[ label := nil ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1170
                         ifFalse:[ label := val displayString ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1171
87bb1815460b initial checkin
ca
parents:
diff changeset
  1172
                list add:(MenuDesc title:('      - ', key) value:label ).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1173
            ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1174
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1175
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1176
87bb1815460b initial checkin
ca
parents:
diff changeset
  1177
    (view respondsTo:#enableChannel) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1178
        inst := view enableChannel.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1179
87bb1815460b initial checkin
ca
parents:
diff changeset
  1180
        inst isNil ifTrue:[ label := value := nil ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1181
                  ifFalse:[ label := inst displayString.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1182
                            value := [ view enableChannel inspect ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1183
                          ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1184
87bb1815460b initial checkin
ca
parents:
diff changeset
  1185
        list add:(MenuDesc title:'enableChannel' value:label action:value).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1186
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1187
87bb1815460b initial checkin
ca
parents:
diff changeset
  1188
    list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1189
87bb1815460b initial checkin
ca
parents:
diff changeset
  1190
    (view respondsTo:#listHolder) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1191
        inst := view listHolder.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1192
87bb1815460b initial checkin
ca
parents:
diff changeset
  1193
        inst isNil ifTrue:[ label := value := nil ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1194
                  ifFalse:[ label := inst class printString.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1195
                            value := [ view listHolder inspect ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1196
                          ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1197
        list add:(MenuDesc title:'listHolder' value:label action:value).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1198
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1199
87bb1815460b initial checkin
ca
parents:
diff changeset
  1200
    (view respondsTo:#list) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1201
        inst := view list.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1202
87bb1815460b initial checkin
ca
parents:
diff changeset
  1203
        inst isNil ifTrue:[ label := value := nil ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1204
                  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1205
                            value := [ view list inspect ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1206
                          ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1207
87bb1815460b initial checkin
ca
parents:
diff changeset
  1208
        list add:(MenuDesc title:'list' value:label action:value).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1209
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1210
87bb1815460b initial checkin
ca
parents:
diff changeset
  1211
    list last isSeparator ifTrue:[ list removeLast ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1212
  ^ MenuDesc buildFromList:list onGC:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1213
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1214
87bb1815460b initial checkin
ca
parents:
diff changeset
  1215
submenuVisibility:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1216
    "builds and returns the geometry submenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1217
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1218
    |view list value|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1219
87bb1815460b initial checkin
ca
parents:
diff changeset
  1220
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1221
    view isNil ifTrue:[^ nil].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1222
87bb1815460b initial checkin
ca
parents:
diff changeset
  1223
    list := OrderedCollection new.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1224
87bb1815460b initial checkin
ca
parents:
diff changeset
  1225
    list add:(MenuDesc title:'device'     value:(view device printString)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1226
    list add:(MenuDesc title:'drawableId' value:(view id)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1227
    list add:(MenuDesc title:'gcId'       value:(view gcId)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1228
87bb1815460b initial checkin
ca
parents:
diff changeset
  1229
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1230
87bb1815460b initial checkin
ca
parents:
diff changeset
  1231
    list add:(MenuDesc title:'shown'    value:(view shown)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1232
    list add:(MenuDesc title:'realized' value:(view realized)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1233
87bb1815460b initial checkin
ca
parents:
diff changeset
  1234
    list add:(MenuDesc separator).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1235
87bb1815460b initial checkin
ca
parents:
diff changeset
  1236
    list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1237
87bb1815460b initial checkin
ca
parents:
diff changeset
  1238
    (value := view visibilityChannel) isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1239
        list add:(MenuDesc title:'visibilityChannel' value:'------').
87bb1815460b initial checkin
ca
parents:
diff changeset
  1240
    ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1241
        list add:(MenuDesc title:'visibilityChannel'
87bb1815460b initial checkin
ca
parents:
diff changeset
  1242
                           value:(value displayString)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1243
                          action:[view visibilityChannel inspect]).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1244
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1245
87bb1815460b initial checkin
ca
parents:
diff changeset
  1246
        
87bb1815460b initial checkin
ca
parents:
diff changeset
  1247
  ^ MenuDesc buildFromList:list onGC:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1248
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1249
87bb1815460b initial checkin
ca
parents:
diff changeset
  1250
!ViewTreeApplication methodsFor:'private'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1251
87bb1815460b initial checkin
ca
parents:
diff changeset
  1252
selectFocusView
87bb1815460b initial checkin
ca
parents:
diff changeset
  1253
    |rootView focusItem focusView|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1254
87bb1815460b initial checkin
ca
parents:
diff changeset
  1255
    rootView := model rootView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1256
87bb1815460b initial checkin
ca
parents:
diff changeset
  1257
    (rootView notNil and:[rootView shown]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1258
        focusView := rootView windowGroup focusView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1259
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1260
    focusView isNil ifTrue:[^ self ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1261
87bb1815460b initial checkin
ca
parents:
diff changeset
  1262
    focusItem := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1263
87bb1815460b initial checkin
ca
parents:
diff changeset
  1264
    (focusItem notNil and:[focusItem widget == focusView]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1265
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
  1266
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1267
    focusItem := model listOfItems recursiveDetect:[:el| el widget == focusView ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1268
87bb1815460b initial checkin
ca
parents:
diff changeset
  1269
    focusItem notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1270
        model selectItem:focusItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1271
    ].        
87bb1815460b initial checkin
ca
parents:
diff changeset
  1272
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1273
87bb1815460b initial checkin
ca
parents:
diff changeset
  1274
setRootItem:aRootItemOrNil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1275
    |theProcess|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1276
87bb1815460b initial checkin
ca
parents:
diff changeset
  1277
    aRootItemOrNil isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1278
        process := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1279
    ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1280
        "/ expand tree to level 3
87bb1815460b initial checkin
ca
parents:
diff changeset
  1281
        aRootItemOrNil do:[:aRootChild|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1282
            aRootChild do:[:aSubChild| aSubChild expand ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1283
            aRootChild expand.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1284
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1285
        aRootItemOrNil expand.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1286
87bb1815460b initial checkin
ca
parents:
diff changeset
  1287
        process isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1288
            theProcess := process :=
87bb1815460b initial checkin
ca
parents:
diff changeset
  1289
                Process for:[   |update|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1290
87bb1815460b initial checkin
ca
parents:
diff changeset
  1291
                                update := false.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1292
87bb1815460b initial checkin
ca
parents:
diff changeset
  1293
                               [process == theProcess] whileTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1294
                                    Delay waitForSeconds:0.5.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1295
87bb1815460b initial checkin
ca
parents:
diff changeset
  1296
                                    (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1297
                                        (self isInTestmode and:[followFocusChannel value == true]) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1298
                                            self selectFocusView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1299
                                        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1300
                                        update ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1301
                                            self updateShownStatus.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1302
                                        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1303
                                        update := update not.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1304
                                    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1305
                                ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1306
87bb1815460b initial checkin
ca
parents:
diff changeset
  1307
                             ] priority:8.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1308
            theProcess name:'ViewTreeApplication::Follow Focus'.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1309
            theProcess resume.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1310
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1311
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1312
    model rootItem:aRootItemOrNil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1313
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1314
87bb1815460b initial checkin
ca
parents:
diff changeset
  1315
updateShownStatus
87bb1815460b initial checkin
ca
parents:
diff changeset
  1316
    |rootItem min max visState listIdx visY0 visY1 height damage|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1317
87bb1815460b initial checkin
ca
parents:
diff changeset
  1318
    rootItem := model rootItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1319
    (rootItem notNil and:[rootItem widget shown]) ifFalse:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1320
87bb1815460b initial checkin
ca
parents:
diff changeset
  1321
    max := 0.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1322
    min := 9999999.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1323
87bb1815460b initial checkin
ca
parents:
diff changeset
  1324
    rootItem recursiveEachVisibleItemDo:[:anItem|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1325
        visState := (anItem widget shown).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1326
87bb1815460b initial checkin
ca
parents:
diff changeset
  1327
        visState ~~ anItem isDrawnShown ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1328
            anItem isDrawnShown:visState.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1329
            listIdx := treeView identityIndexOf:anItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1330
87bb1815460b initial checkin
ca
parents:
diff changeset
  1331
            listIdx > 0 ifTrue:[    
87bb1815460b initial checkin
ca
parents:
diff changeset
  1332
                max := max max:listIdx.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1333
                min := min min:listIdx.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1334
            ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1335
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1336
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1337
    max < min ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1338
    max := max + 1.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1339
87bb1815460b initial checkin
ca
parents:
diff changeset
  1340
    visY0  := (treeView yVisibleOfLine:min) max:0.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1341
    visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1342
    height := visY1 - visY0.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1343
    
87bb1815460b initial checkin
ca
parents:
diff changeset
  1344
    height > 2 ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1345
        treeView shown ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1346
            damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1347
            treeView invalidateDeviceRectangle:damage repairNow:false.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1348
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1349
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1350
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1351
87bb1815460b initial checkin
ca
parents:
diff changeset
  1352
!ViewTreeApplication methodsFor:'queries'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1353
87bb1815460b initial checkin
ca
parents:
diff changeset
  1354
isInTestmode
87bb1815460b initial checkin
ca
parents:
diff changeset
  1355
    "returns true if running in test mode - no events eaten
87bb1815460b initial checkin
ca
parents:
diff changeset
  1356
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1357
    ^ testModeChannel value == true
87bb1815460b initial checkin
ca
parents:
diff changeset
  1358
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1359
87bb1815460b initial checkin
ca
parents:
diff changeset
  1360
!ViewTreeApplication methodsFor:'selection'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1361
87bb1815460b initial checkin
ca
parents:
diff changeset
  1362
selectedView
87bb1815460b initial checkin
ca
parents:
diff changeset
  1363
    "returns the selected view or nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1364
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1365
    |item|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1366
87bb1815460b initial checkin
ca
parents:
diff changeset
  1367
    item := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1368
    item notNil ifTrue:[ ^ item widget ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1369
  ^ nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1370
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1371
87bb1815460b initial checkin
ca
parents:
diff changeset
  1372
!ViewTreeApplication methodsFor:'testing'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1373
87bb1815460b initial checkin
ca
parents:
diff changeset
  1374
resolveApplicationClassFor:aTreeItem
87bb1815460b initial checkin
ca
parents:
diff changeset
  1375
    aTreeItem isApplicationClass ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1376
       ^ aTreeItem applicationClass
87bb1815460b initial checkin
ca
parents:
diff changeset
  1377
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1378
    ^ nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1379
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1380
87bb1815460b initial checkin
ca
parents:
diff changeset
  1381
selectedComponentHasChildren
87bb1815460b initial checkin
ca
parents:
diff changeset
  1382
    |item|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1383
87bb1815460b initial checkin
ca
parents:
diff changeset
  1384
    item := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1385
    ^ (item notNil and:[item hasChildren])
87bb1815460b initial checkin
ca
parents:
diff changeset
  1386
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1387
87bb1815460b initial checkin
ca
parents:
diff changeset
  1388
!ViewTreeApplication methodsFor:'user operations'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1389
87bb1815460b initial checkin
ca
parents:
diff changeset
  1390
doBrowse:what
87bb1815460b initial checkin
ca
parents:
diff changeset
  1391
    "open browser on:
87bb1815460b initial checkin
ca
parents:
diff changeset
  1392
        #view           browse class
87bb1815460b initial checkin
ca
parents:
diff changeset
  1393
        #model          browse model class
87bb1815460b initial checkin
ca
parents:
diff changeset
  1394
        #application    browse application class
87bb1815460b initial checkin
ca
parents:
diff changeset
  1395
        #controller     browse controller class
87bb1815460b initial checkin
ca
parents:
diff changeset
  1396
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1397
    |view inst|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1398
87bb1815460b initial checkin
ca
parents:
diff changeset
  1399
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1400
    view isNil ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1401
87bb1815460b initial checkin
ca
parents:
diff changeset
  1402
             what == #view        ifTrue:[ inst := view ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1403
    ifFalse:[what == #model       ifTrue:[ inst := view model ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1404
    ifFalse:[what == #application ifTrue:[ inst := view application ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1405
    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1406
    ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1407
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
  1408
    ]]]].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1409
87bb1815460b initial checkin
ca
parents:
diff changeset
  1410
    inst notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1411
        inst class browserClass openInClass:(inst class) selector:nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1412
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1413
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1414
87bb1815460b initial checkin
ca
parents:
diff changeset
  1415
doDestroy
87bb1815460b initial checkin
ca
parents:
diff changeset
  1416
    "destroy the current selected view
87bb1815460b initial checkin
ca
parents:
diff changeset
  1417
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1418
    |item parent|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1419
87bb1815460b initial checkin
ca
parents:
diff changeset
  1420
    item := model selectedItem.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1421
    item isNil ifTrue:[ ^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1422
87bb1815460b initial checkin
ca
parents:
diff changeset
  1423
    parent := item parent.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1424
87bb1815460b initial checkin
ca
parents:
diff changeset
  1425
    parent isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1426
        "/ the root
87bb1815460b initial checkin
ca
parents:
diff changeset
  1427
        model withSelectionHiddenDo:[item deleteAll].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1428
      ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
  1429
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1430
87bb1815460b initial checkin
ca
parents:
diff changeset
  1431
    model withSelectionHiddenDo:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1432
        |idx nsel|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1433
87bb1815460b initial checkin
ca
parents:
diff changeset
  1434
        idx := parent identityIndexOf:item.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1435
87bb1815460b initial checkin
ca
parents:
diff changeset
  1436
        idx == parent size ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1437
            nsel := parent at:(idx - 1) ifAbsent:parent
87bb1815460b initial checkin
ca
parents:
diff changeset
  1438
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1439
            nsel := parent at:(idx + 1)
87bb1815460b initial checkin
ca
parents:
diff changeset
  1440
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1441
        model setValue:nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1442
        item delete.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1443
87bb1815460b initial checkin
ca
parents:
diff changeset
  1444
        parent isLayoutContainer ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1445
            parent widget sizeChanged:nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1446
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1447
        model value:nsel.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1448
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1449
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1450
87bb1815460b initial checkin
ca
parents:
diff changeset
  1451
doFlash
87bb1815460b initial checkin
ca
parents:
diff changeset
  1452
    "flash the selected view
87bb1815460b initial checkin
ca
parents:
diff changeset
  1453
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1454
    |view|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1455
87bb1815460b initial checkin
ca
parents:
diff changeset
  1456
    view := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1457
    view isNil ifTrue:[ ^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1458
87bb1815460b initial checkin
ca
parents:
diff changeset
  1459
    view shown ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1460
        model withSelectionHiddenDo:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1461
            view perform:#flash ifNotUnderstood:nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1462
        ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1463
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1464
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1465
87bb1815460b initial checkin
ca
parents:
diff changeset
  1466
doInspect:what
87bb1815460b initial checkin
ca
parents:
diff changeset
  1467
    "open inspector on:
87bb1815460b initial checkin
ca
parents:
diff changeset
  1468
        #view           inspect class
87bb1815460b initial checkin
ca
parents:
diff changeset
  1469
        #group          inspect windowGroup
87bb1815460b initial checkin
ca
parents:
diff changeset
  1470
        #model          inspect model
87bb1815460b initial checkin
ca
parents:
diff changeset
  1471
        #application    inspect application
87bb1815460b initial checkin
ca
parents:
diff changeset
  1472
        #controller     inspect controller
87bb1815460b initial checkin
ca
parents:
diff changeset
  1473
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1474
    |inst|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1475
87bb1815460b initial checkin
ca
parents:
diff changeset
  1476
    inst := self selectedView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1477
    inst isNil ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1478
87bb1815460b initial checkin
ca
parents:
diff changeset
  1479
             what == #group       ifTrue:[ inst := inst windowGroup ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1480
    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1481
    ifFalse:[what == #application ifTrue:[ inst := inst application ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1482
    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]]]].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1483
87bb1815460b initial checkin
ca
parents:
diff changeset
  1484
    inst notNil ifTrue:[ inst inspect ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1485
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1486
87bb1815460b initial checkin
ca
parents:
diff changeset
  1487
doPickViews
87bb1815460b initial checkin
ca
parents:
diff changeset
  1488
    "pick a window's topView
87bb1815460b initial checkin
ca
parents:
diff changeset
  1489
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1490
    |window|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1491
87bb1815460b initial checkin
ca
parents:
diff changeset
  1492
    self doUnpick.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1493
87bb1815460b initial checkin
ca
parents:
diff changeset
  1494
    window := Screen current viewFromUser.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1495
    window isNil ifTrue:[^ self].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1496
87bb1815460b initial checkin
ca
parents:
diff changeset
  1497
    window := window topView.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1498
87bb1815460b initial checkin
ca
parents:
diff changeset
  1499
    (    window == Screen current rootView
87bb1815460b initial checkin
ca
parents:
diff changeset
  1500
     or:[window == self window topView]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1501
    ) ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1502
        ^ self
87bb1815460b initial checkin
ca
parents:
diff changeset
  1503
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1504
    self setRootItem:(ViewTreeItem buildViewsFrom:window).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1505
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1506
87bb1815460b initial checkin
ca
parents:
diff changeset
  1507
doSelectNextOfApplicationClass:aClass startingIn:anItem
87bb1815460b initial checkin
ca
parents:
diff changeset
  1508
    |startItem firstFound searchNext|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1509
87bb1815460b initial checkin
ca
parents:
diff changeset
  1510
    startItem  := model last.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1511
    searchNext := startItem notNil.        
87bb1815460b initial checkin
ca
parents:
diff changeset
  1512
    firstFound := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1513
87bb1815460b initial checkin
ca
parents:
diff changeset
  1514
    anItem recursiveDo:[:el|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1515
        el == startItem ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1516
            searchNext := false
87bb1815460b initial checkin
ca
parents:
diff changeset
  1517
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1518
            (self resolveApplicationClassFor:el) == aClass ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1519
                searchNext ifFalse:[^ model selectItem:el].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1520
87bb1815460b initial checkin
ca
parents:
diff changeset
  1521
                firstFound isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1522
                    firstFound := el
87bb1815460b initial checkin
ca
parents:
diff changeset
  1523
                ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1524
            ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1525
        ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1526
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1527
    firstFound notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1528
        self window beep.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1529
        model selectItem:firstFound
87bb1815460b initial checkin
ca
parents:
diff changeset
  1530
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1531
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1532
87bb1815460b initial checkin
ca
parents:
diff changeset
  1533
doSelectNextOfClass:aClass startingIn:anItem
87bb1815460b initial checkin
ca
parents:
diff changeset
  1534
    |startItem firstFound searchNext|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1535
87bb1815460b initial checkin
ca
parents:
diff changeset
  1536
    startItem  := model last.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1537
    searchNext := startItem notNil.        
87bb1815460b initial checkin
ca
parents:
diff changeset
  1538
    firstFound := nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1539
87bb1815460b initial checkin
ca
parents:
diff changeset
  1540
    anItem recursiveDo:[:el|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1541
        el == startItem ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1542
            searchNext := false
87bb1815460b initial checkin
ca
parents:
diff changeset
  1543
        ] ifFalse:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1544
            el widget class == aClass ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1545
                searchNext ifFalse:[^ model selectItem:el].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1546
87bb1815460b initial checkin
ca
parents:
diff changeset
  1547
                firstFound isNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1548
                    firstFound := el
87bb1815460b initial checkin
ca
parents:
diff changeset
  1549
                ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1550
            ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1551
        ]
87bb1815460b initial checkin
ca
parents:
diff changeset
  1552
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1553
    firstFound notNil ifTrue:[
87bb1815460b initial checkin
ca
parents:
diff changeset
  1554
        self window beep.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1555
        model selectItem:firstFound
87bb1815460b initial checkin
ca
parents:
diff changeset
  1556
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1557
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1558
87bb1815460b initial checkin
ca
parents:
diff changeset
  1559
doUnpick
87bb1815460b initial checkin
ca
parents:
diff changeset
  1560
    "release current picked window and contained subwindows
87bb1815460b initial checkin
ca
parents:
diff changeset
  1561
    "
87bb1815460b initial checkin
ca
parents:
diff changeset
  1562
    self setRootItem:nil.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1563
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1564
87bb1815460b initial checkin
ca
parents:
diff changeset
  1565
!ViewTreeApplication::MenuDesc class methodsFor:'building'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1566
87bb1815460b initial checkin
ca
parents:
diff changeset
  1567
buildFromList:aList onGC:aMenu
87bb1815460b initial checkin
ca
parents:
diff changeset
  1568
    |tabSpec menu w menuPanel|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1569
87bb1815460b initial checkin
ca
parents:
diff changeset
  1570
    w := 0.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1571
    aList do:[:el| w := w max:(el widthOn:aMenu) ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1572
87bb1815460b initial checkin
ca
parents:
diff changeset
  1573
    tabSpec := TabulatorSpecification new.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1574
    tabSpec unit:#pixel.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1575
    tabSpec positions:#(0     1.5 ).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1576
    tabSpec align:#(#left #left).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1577
87bb1815460b initial checkin
ca
parents:
diff changeset
  1578
    w := w + 15.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1579
    tabSpec positions:(Array with:0 with:w).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1580
87bb1815460b initial checkin
ca
parents:
diff changeset
  1581
    menu := Menu new.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1582
87bb1815460b initial checkin
ca
parents:
diff changeset
  1583
    aList do:[:el|
87bb1815460b initial checkin
ca
parents:
diff changeset
  1584
        menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
87bb1815460b initial checkin
ca
parents:
diff changeset
  1585
    ].
87bb1815460b initial checkin
ca
parents:
diff changeset
  1586
    menuPanel := MenuPanel menu:menu.
87bb1815460b initial checkin
ca
parents:
diff changeset
  1587
    ^ menuPanel
87bb1815460b initial checkin
ca
parents:
diff changeset
  1588
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1589
87bb1815460b initial checkin
ca
parents:
diff changeset
  1590
!ViewTreeApplication::MenuDesc class methodsFor:'instance creation'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1591
87bb1815460b initial checkin
ca
parents:
diff changeset
  1592
separator
87bb1815460b initial checkin
ca
parents:
diff changeset
  1593
    ^ self new
87bb1815460b initial checkin
ca
parents:
diff changeset
  1594
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1595
87bb1815460b initial checkin
ca
parents:
diff changeset
  1596
title:aTitle value:aValue
87bb1815460b initial checkin
ca
parents:
diff changeset
  1597
    ^ self title:aTitle value:aValue action:nil
87bb1815460b initial checkin
ca
parents:
diff changeset
  1598
!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1599
87bb1815460b initial checkin
ca
parents:
diff changeset
  1600
title:aTitle value:aValue action:anAction
87bb1815460b initial checkin
ca
parents:
diff changeset
  1601
    ^ self new title:aTitle value:aValue action:anAction
87bb1815460b initial checkin
ca
parents:
diff changeset
  1602
! !
87bb1815460b initial checkin
ca
parents:
diff changeset
  1603
87bb1815460b initial checkin
ca
parents:
diff changeset
  1604
!ViewTreeApplication::MenuDesc methodsFor:'accessing'!
87bb1815460b initial checkin
ca
parents:
diff changeset
  1605
87bb1815460b initial checkin
ca
parents:
diff changeset
  1606
title
87bb1815460b initial checkin
ca
parents:
diff changeset
<