MultiViewToolApplication.st
author Claus Gittinger <cg@exept.de>
Wed, 25 Oct 2006 15:03:36 +0200
changeset 7475 54b889153fc7
parent 6863 4e2e267622eb
child 7650 12fcca896ba0
permissions -rw-r--r--
refactored to allow for standAlone multiTab editors
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6179
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     1
"
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     3
              All Rights Reserved
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     4
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     5
 This software is furnished under a license and may be used
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     6
 only in accordance with the terms of that license and with the
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     8
 be provided or otherwise made available to, or used by, any
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
     9
 other person.  No title to or ownership of the software is
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    10
 hereby transferred.
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    11
"
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ToolApplicationModel subclass:#MultiViewToolApplication
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'workspaces tabList selectedWorkspaceIndexHolder workspaceHolder'
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Interface-Smalltalk'
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!MultiViewToolApplication class methodsFor:'documentation'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
6179
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    23
copyright
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    24
"
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    25
 COPYRIGHT (c) 2004 by eXept Software AG
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    26
              All Rights Reserved
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    27
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    28
 This software is furnished under a license and may be used
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    29
 only in accordance with the terms of that license and with the
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    31
 be provided or otherwise made available to, or used by, any
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    32
 other person.  No title to or ownership of the software is
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    33
 hereby transferred.
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    34
"
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    35
!
182d948dcf05 copyright
Claus Gittinger <cg@exept.de>
parents: 5303
diff changeset
    36
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    Common code for multiView applications (Workspace and Terminal app)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    [author:]
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        Claus Gittinger
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
!MultiViewToolApplication class methodsFor:'interface specs'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
windowSpec
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    49
    "This resource specification was automatically generated
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    50
     by the UIPainter of ST/X."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    51
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    52
    "Do not manually edit this!! If it is corrupted,
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    53
     the UIPainter may not be able to read the specification."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    54
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    55
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    56
     UIPainter new openOnClass:WorkspaceApplication andSelector:#windowSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    57
     WorkspaceApplication new openInterface:#windowSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    58
     WorkspaceApplication open
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    59
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    60
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    61
    <resource: #canvas>
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    63
    ^ 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    64
     #(FullSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    65
        name: windowSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    66
        window: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    67
       (WindowSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    68
          label: 'Workspace'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    69
          name: 'Workspace'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    70
          min: (Point 10 10)
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    71
          bounds: (Rectangle 0 0 432 241)
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    72
          menu: mainMenu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    73
        )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    74
        component: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    75
       (SpecCollection
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    76
          collection: (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    77
           (NoteBookViewSpec
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    78
              name: 'NoteBook1'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    79
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    80
              model: selectedWorkspaceIndexHolder
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    81
              menu: tabList
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    82
              useIndex: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    83
              accessTabMenuAction: tabMenuAt:
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    84
              destroyTabAction: destroyTab:
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    85
              canvas: workspaceHolder
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    86
              canvasInset: 0
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    87
              keepCanvasAlive: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    88
              tabLevel: 1
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    89
            )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    90
           )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    91
         
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    92
        )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    93
      )
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
!MultiViewToolApplication class methodsFor:'menu specs'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
mainMenu
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
    99
    "This resource specification was automatically generated
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   100
     by the MenuEditor of ST/X."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   101
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   102
    "Do not manually edit this!! If it is corrupted,
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   103
     the MenuEditor may not be able to read the specification."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   104
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   105
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   106
     MenuEditor new openOnClass:MultiViewToolApplication andSelector:#mainMenu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   107
     (Menu new fromLiteralArrayEncoding:(MultiViewToolApplication mainMenu)) startUp
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   108
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   109
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   110
    <resource: #menu>
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   112
    ^ 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   113
     #(Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   114
        (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   115
         (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   116
            label: 'File'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   117
            translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   118
            submenu: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   119
           (Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   120
              (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   121
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   122
                  label: 'New Editor'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   123
                  itemValue: newWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   124
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   125
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   126
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   127
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   128
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   129
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   130
                  label: 'Load File...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   131
                  itemValue: menuLoad
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   132
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   133
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   134
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   135
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   136
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   137
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   138
                  label: 'Save As...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   139
                  itemValue: menuSaveAs
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   140
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   141
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   142
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   143
                  enabled: hasMultipleBuffersHolder
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   144
                  label: 'Save all As...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   145
                  itemValue: menuSaveAllAs
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   146
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   147
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   148
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   149
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   150
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   151
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   152
                  label: 'Print...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   153
                  itemValue: menuPrint
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   154
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   155
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   156
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   157
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   158
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   159
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   160
                  label: 'Exit'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   161
                  itemValue: closeRequest
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   162
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   163
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   164
               )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   165
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   166
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   167
            )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   168
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   169
         (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   170
            label: 'Buffers'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   171
            nameKey: Buffer
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   172
            translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   173
            submenu: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   174
           (Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   175
              (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   176
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   177
                  label: 'Add Buffer'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   178
                  itemValue: addWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   179
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   180
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   181
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   182
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   183
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   184
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   185
                  label: 'Rename...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   186
                  itemValue: renameWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   187
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   188
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   189
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   190
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   191
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   192
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   193
                  enabled: canRemoveWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   194
                  label: 'Remove Buffer'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   195
                  itemValue: removeWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   196
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   197
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   198
               )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   199
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   200
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   201
            )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   202
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   203
         (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   204
            label: 'Edit'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   205
            translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   206
            submenu: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   207
           (Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   208
              (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   209
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   210
                  enabled: hasSelectionInActiveWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   211
                  label: 'Cut'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   212
                  itemValue: cutSelection
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   213
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   214
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   215
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   216
                  enabled: hasSelectionInActiveWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   217
                  label: 'Copy'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   218
                  itemValue: copySelection
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   219
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   220
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   221
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   222
                  label: 'Paste'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   223
                  itemValue: paste
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   224
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   225
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   226
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   227
                  label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   228
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   229
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   230
                  label: 'Select All'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   231
                  itemValue: selectAll
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   232
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   233
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   234
               )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   235
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   236
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   237
            )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   238
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   239
         (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   240
            label: 'MENU_Help'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   241
            translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   242
            startGroup: conditionalRight
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   243
            submenu: 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   244
           (Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   245
              (
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   246
               (MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   247
                  label: 'About this Application...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   248
                  itemValue: openAboutThisApplication
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   249
                  translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   250
                )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   251
               )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   252
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   253
              nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   254
            )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   255
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   256
         )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   257
        nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   258
        nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   259
      )
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
tabMenu
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   263
    "This resource specification was automatically generated
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   264
     by the MenuEditor of ST/X."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   265
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   266
    "Do not manually edit this!! If it is corrupted,
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   267
     the MenuEditor may not be able to read the specification."
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   268
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   269
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   270
     MenuEditor new openOnClass:WorkspaceApplication andSelector:#tabMenu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   271
     (Menu new fromLiteralArrayEncoding:(WorkspaceApplication tabMenu)) startUp
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   272
    "
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   273
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   274
    <resource: #menu>
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   276
    ^
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   277
     #(#Menu
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   278
        #(
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   279
         #(#MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   280
            #label: 'Add Tab'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   281
            #translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   282
            "/ #triggerOnDown: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   283
            #value: #addWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   284
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   285
         #(#MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   286
            #label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   287
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   288
         #(#MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   289
            #label: 'Remove Tab'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   290
            #translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   291
            "/ #triggerOnDown: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   292
            #value: #removeWorkspace:
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   293
            #enabled: #canRemoveWorkspace:
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   294
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   295
         #(#MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   296
            #label: '-'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   297
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   298
         #(#MenuItem
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   299
            #label: 'Rename...'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   300
            #translateLabel: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   301
            "/ #triggerOnDown: true
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   302
            #value: #renameWorkspace:
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   303
          )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   304
         )
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   305
        nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   306
        nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   307
      )
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
!MultiViewToolApplication class methodsFor:'queries'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
isVisualStartable
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    "return true, if this application can be started via #open.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
     (to allow start of a change browser via double-click in the browser)"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
5303
fe0d2165b716 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5302
diff changeset
   316
    self == MultiViewToolApplication ifTrue:[^false].
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    ^ super isVisualStartable
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!MultiViewToolApplication methodsFor:'accessing'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
selectedWorkspace
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    |wsIndex|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
    workspaces isNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
        workspaces := OrderedCollection new.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
    wsIndex := self selectedWorkspaceIndexHolder value.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    wsIndex == 0 ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
        ^ nil
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
    workspaces size < wsIndex ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
        workspaces grow:wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
        workspaces at:wsIndex put:(self createWorkspace).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
    ^ workspaces at:wsIndex
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
tabMenuAt:index
6244
548f6707f59c *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 6179
diff changeset
   341
    <resource: #programMenu>
548f6707f59c *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 6179
diff changeset
   342
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
    |m i ws|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    m := self class tabMenu.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    m := m decodeAsLiteralArray.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
    i := m detectItem:[:item | item value == #removeWorkspace:] ifNone:nil.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    i notNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
        i argument:index.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
        index ~~ self selectedWorkspaceIndexHolder value ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
            "/ for now: if that buffer is modified,
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
            "/ do not allow removing.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
            "/ (must be brought to front, in order for check-for-modification to work)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
            ws := workspaces at:index.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
            (ws isKindOf:ScrollableView) ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
                ws := ws scrolledView
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
            ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
            ((ws isKindOf:TextView) not
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
            or:[ ws modified ])
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
            ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
                i disable
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
            ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
        ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    i := m detectItem:[:item | item value == #renameWorkspace:] ifNone:nil.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
    i notNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
        i argument:index.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    m findGuiResourcesIn:self.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
    ^ m
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
workspaceHolder
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
    workspaceHolder isNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
        workspaceHolder := ValueHolder with:(self selectedWorkspace).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    ^ workspaceHolder
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
!MultiViewToolApplication methodsFor:'aspects'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
selectedWorkspaceIndexHolder
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
    selectedWorkspaceIndexHolder isNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
        selectedWorkspaceIndexHolder := 1 asValue.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
        selectedWorkspaceIndexHolder onChangeSend:#workspaceSelectionChanged to:self.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
    ^ selectedWorkspaceIndexHolder.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
tabList
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
    tabList isNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
        tabList := List new.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
    ^ tabList.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
!MultiViewToolApplication methodsFor:'aspects-queries'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
canRemoveWorkspace
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
    ^ self canRemoveWorkspace:(self selectedWorkspaceIndexHolder value)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
canRemoveWorkspace:idx
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
    ^ self tabList size > 1
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
"/       and:[ (self workspacesTextViewAt:(self selectedWorkspaceIndexHolder value))
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
hasMultipleBuffersHolder
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
    ^ [ workspaces size > 1 ]
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
hasSelectionInActiveWorkspace
6424
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   414
    |v|
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   415
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   416
    v := self selectedWorkspacesTextView.
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   417
    ^ v notNil and:[v selectionAsString size > 0]
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   420
!MultiViewToolApplication methodsFor:'defaults'!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   421
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   422
defaultFileNameForLoad
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   423
   ^ 'file.txt'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   424
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   425
    "Created: / 25-10-2006 / 14:56:19 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   426
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   427
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   428
defaultFileNameForSave
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   429
    ^ 'file.txt'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   430
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   431
    "Modified: / 25-10-2006 / 14:54:13 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   432
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   433
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   434
defaultFileNameForSaveAll
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   435
   ^ 'file.txt'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   436
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   437
    "Modified: / 25-10-2006 / 14:55:50 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   438
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   439
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   440
defaultPatternLoad
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   441
   ^ '*.txt'
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   442
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   443
    "Created: / 25-10-2006 / 14:57:18 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   444
! !
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   445
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
!MultiViewToolApplication methodsFor:'menu-actions'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
addWindow:aWindow named:name
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    ^ self addWindow:aWindow named:name asFirst:false
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
addWindow:aWindow named:name asFirst:asFirst
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    |tabList wsIndex newSelectedIndex|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
    tabList := self tabList.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
    wsIndex := tabList size + 1.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    wsIndex == 1 ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
        "/ first - add a name for the first tab
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
        tabList add:(self window label). "/ 'Workspace'.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
        wsIndex := wsIndex + 1.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
    workspaces grow:wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
    asFirst ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
        tabList addFirst:(name bindWith:wsIndex).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
        workspaces replaceFrom:2 to:wsIndex with:workspaces startingAt:1.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
        newSelectedIndex := 1.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    ] ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
        tabList addLast:(name bindWith:wsIndex).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
        newSelectedIndex := wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
    workspaces at:newSelectedIndex put:aWindow.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    self selectedWorkspaceIndexHolder value:newSelectedIndex.   
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
"/    workspaceHolder value:aWindow.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   477
addWorkspace
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   478
    self addWindow:(self createWorkspace) named:'Workspace%1'
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   479
!
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   480
6458
abf7db73fa79 destroy tabs
Claus Gittinger <cg@exept.de>
parents: 6424
diff changeset
   481
destroyTab:tabIndex
abf7db73fa79 destroy tabs
Claus Gittinger <cg@exept.de>
parents: 6424
diff changeset
   482
    self removeWorkspace:tabIndex
abf7db73fa79 destroy tabs
Claus Gittinger <cg@exept.de>
parents: 6424
diff changeset
   483
!
abf7db73fa79 destroy tabs
Claus Gittinger <cg@exept.de>
parents: 6424
diff changeset
   484
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   485
loadFile:aFileName 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   486
    self loadFile:aFileName encoding:nil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   487
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   488
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   489
loadFile:aFileName encoding:encodingSymbolOrNil
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   490
    |lbl|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   491
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   492
    lbl := aFileName asFilename withoutSuffix baseName.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   493
    self loadFile:aFileName encoding:encodingSymbolOrNil label:lbl.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   494
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   495
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   496
loadFile:aFileName encoding:encodingSymbolOrNil label:label
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   497
    |file ws|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   498
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   499
    file := aFileName asFilename.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   500
    ws := self selectedWorkspacesTextView.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   501
    [
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   502
        |contents|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   503
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   504
        contents := file contents.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   505
        encodingSymbolOrNil notNil ifTrue:[
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   506
            contents := contents encodeFrom:encodingSymbolOrNil into:#'unicode'.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   507
            ws externalEncoding:encodingSymbolOrNil.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   508
        ].
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   509
        ws contents:contents.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   510
        ws defaultFileNameForFileDialog:file pathName.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   511
    ] on:StreamError do:[:ex|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   512
        Dialog warn:(resources string:'Cannot open %1: %2' with:file asString with:ex description).
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   513
        ^ self
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   514
    ].
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   515
    ws modified:false.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   516
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   517
    tabList size <= 1 ifTrue:[
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   518
        self window label:label.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   519
    ] ifFalse:[
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   520
        tabList at:self selectedWorkspaceIndexHolder value put:label
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   521
    ]
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   522
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   523
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   524
menuLoad
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   525
    |file|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   526
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   527
    (self askIfModified:'Text was modified. Load anyway ?' yesButton:'Load') ifFalse:[ ^ self].
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   528
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   529
    file := Dialog 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   530
                requestFileName:(resources string:'Load file') 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   531
                default:(self defaultFileNameForLoad) 
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   532
                pattern:(self defaultPatternLoad).
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   533
    file size ~~ 0 ifTrue:[
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   534
        self loadFile:file
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   535
    ]
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   536
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   537
    "Modified: / 25-10-2006 / 14:57:34 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   538
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   539
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   540
menuPrint
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   541
    |ws|
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   542
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   543
    ws := self selectedWorkspacesTextView.
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   544
    ws doPrint
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   545
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   546
    "Created: / 25-10-2006 / 15:01:51 / cg"
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   547
!
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   548
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
menuSaveAllAs
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
    self 
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
        askForFile:'Save all Buffers into:' 
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   552
        default:(self defaultFilenameForSaveAll)
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
        thenDo:[:file :doAppend |
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
            |ws append|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
            append := doAppend.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
            workspaces do:[:subView |
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
                |ws|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
                ws := self workspaceViewOfView:subView.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
                ws notNil ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
                    ws saveAs:file doAppend:append.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
                    ws modified:false.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
                ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
                append := true.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
            ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
        ]
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
menuSaveAs
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
    self 
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   572
        askForFile:'Save Buffer into:'
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   573
        default:(self defaultFileNameForSave)
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
        thenDo:[:file :doAppend |
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
            |ws|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
            ws := self selectedWorkspacesTextView.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
            ws saveAs:file doAppend:doAppend.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
            ws modified:false.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
        ]
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
newWorkspace
6863
4e2e267622eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6634
diff changeset
   584
    self class new openWithExtent:(self builder window extent).
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   585
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   586
    "Modified: / 25-10-2006 / 14:39:15 / cg"
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
removeWorkspace
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    self removeWorkspace:(self selectedWorkspaceIndexHolder value)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
removeWorkspace:wsIndex
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
    |tabList newWsIndex|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
    wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[
6509
bcaae26df254 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
   597
        (self askIfModified:'Text was modified. Remove buffer anyway ?' yesButton:'Remove Buffer') ifFalse:[
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
            ^ self
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
        ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
    tabList := self tabList.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
    wsIndex == tabList size ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
        newWsIndex := wsIndex - 1.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
    ] ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
        newWsIndex := wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
    tabList removeIndex:wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
    (workspaces at:wsIndex) destroy.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    workspaces removeIndex:wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
    tabList size == 1 ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
        self window label:(tabList at:1).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
        tabList removeIndex:1
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
    workspaceHolder value:(workspaces at:newWsIndex).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
    self selectedWorkspaceIndexHolder value:newWsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
    "/ to force change (update workspaceHolder - even if same index)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
    self selectedWorkspaceIndexHolder changed:#value.   
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
renameWorkspace
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
    self renameWorkspace:(self selectedWorkspaceIndexHolder value)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
renameWorkspace:wsIndex
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
    |tabList oldName newName|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
    tabList := self tabList.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
    tabList isEmpty ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
        oldName := self window label
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
    ] ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
        oldName := tabList at:wsIndex.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
    newName := Dialog request:(resources string:'New Name for %1:' with:oldName) initialAnswer:oldName.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
    newName size == 0 ifTrue:[ ^ self].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
    self renameWorkspace:wsIndex to:newName.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
renameWorkspace:wsIndex to:newName
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
    |tabList|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    tabList := self tabList.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
    tabList notEmpty ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
        tabList at:wsIndex put:newName.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
    wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
        self window label:newName.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
!MultiViewToolApplication methodsFor:'menu-actions-editing'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
copySelection
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
    self selectedWorkspacesTextView copySelection
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
cutSelection
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
    self selectedWorkspacesTextView cutSelection
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
paste
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
    self selectedWorkspacesTextView paste
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
paste:aString
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
    self selectedWorkspacesTextView paste:aString.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
selectAll
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
    self selectedWorkspacesTextView selectAll.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
!MultiViewToolApplication methodsFor:'private'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   680
askForFile:question default:defaultFilename thenDo:aBlock
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
    Dialog
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
        requestSaveFileName:(resources string:question) 
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   683
        default:defaultFilename 
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
        fromDirectory:nil 
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
        action:[:fileName | aBlock value:fileName value:false] 
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
        appendAction:[:fileName | aBlock value:fileName value:true]
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
"/    |file doAppend|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
"/
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
"/    doAppend := false.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
"/    Dialog aboutToOpenBoxNotificationSignal handle:[:n |
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
"/        |box|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
"/
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
"/        box := n parameter.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
"/        box addButton:(Button label:'Append' action:[doAppend := true. box okPressed]).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
"/        n proceed.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
"/    ] do:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
"/        file := Dialog requestFileName:question default:'file.wsp'. 
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
"/    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
"/    file isEmptyOrNil ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
"/        aBlock value:file value:doAppend
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
"/    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
6408
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   705
askForFile:question thenDo:aBlock
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   706
    ^ self
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   707
        askForFile:question default:'file.wsp' thenDo:aBlock
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   708
!
e0f701a20cae remember last-saved fileName for next default
Claus Gittinger <cg@exept.de>
parents: 6354
diff changeset
   709
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
askIfAnyModified:arg1 yesButton:arg2 
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
    "raise an error: must be redefined in concrete subclass(es)"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
    ^ self subclassResponsibility
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
askIfModified:question yesButton:yesButtonText
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
    "tell user, that code has been modified - let her confirm"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
    |textView|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
    textView := self selectedWorkspace.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
    (self isModifiedWorkspace:textView) ifFalse:[^ true].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
    (Dialog 
6354
08a483e3beda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6244
diff changeset
   725
        confirm:(resources stringWithCRs:question)
6634
a94d8a07247d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6509
diff changeset
   726
        yesLabel:(resources string:yesButtonText)
a94d8a07247d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6509
diff changeset
   727
        noLabel:(resources string:'Cancel'))
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
    ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
        "/ reset modified flag so question is asked only once
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
        textView modified:false.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
        ^ true
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    ^ false
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
    "Modified: 2.10.1997 / 14:23:47 / stefan"
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
createWorkspace
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   739
    |ws|
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   741
    ws := (HVScrollableView for:EditTextView).
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   742
    ^ ws
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   743
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   744
    "Modified: / 25-10-2006 / 14:34:19 / cg"
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
isModifiedWorkspace:aView
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
    self subclassResponsibility
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
selectedWorkspacesTextView
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
    ^ self workspaceViewOfView:(self selectedWorkspace)
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
workspaceSelectionChanged
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
    |wsIndex windowLabel v|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
    "/ self selected
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
    self workspaceHolder value:(v := self selectedWorkspace).
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
    wsIndex := self selectedWorkspaceIndexHolder value.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
    wsIndex ~~ 0 ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
        windowLabel := tabList at:wsIndex ifAbsent:nil.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
        windowLabel notNil ifTrue:[self window label:windowLabel].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
workspaceViewOfView:aView
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
    |view|
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
    view := aView.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
    (view isScrollWrapper) ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
        view := view scrolledView.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
        view isNil ifTrue:[^ nil].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
    ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
    (view isTextView) ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
        (view isKindOf:InspectorView) ifFalse:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
            ^ nil
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
        ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
        view := view workspace.
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
        (view isScrollWrapper) ifTrue:[
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
            view := view scrolledView
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
        ].
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
    ].
6424
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   785
    (view isTextView) ifFalse:[
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   786
        ^ nil
57dbbc6ff912 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6408
diff changeset
   787
    ].
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
    ^ view
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
! !
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
!MultiViewToolApplication class methodsFor:'documentation'!
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
version
7475
54b889153fc7 refactored to allow for standAlone multiTab editors
Claus Gittinger <cg@exept.de>
parents: 6863
diff changeset
   794
    ^ '$Header: /cvs/stx/stx/libtool/MultiViewToolApplication.st,v 1.12 2006-10-25 13:03:36 cg Exp $'
5302
615a0020e15c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
! !