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