180 lines
4.1 KiB
Smalltalk
180 lines
4.1 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioPerspective,
|
|
#superclass : #SpPresenter,
|
|
#instVars : [
|
|
'toolbar',
|
|
'viewport'
|
|
],
|
|
#category : #'Grafoscopio-New-UI'
|
|
}
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPerspective class >> defaultPerspective [
|
|
^ GrafoscopioDocumentEditionPerspective
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPerspective class >> defaultSpec [
|
|
^ SpBoxLayout newVertical
|
|
add: #toolbar height: self toolbarHeight;
|
|
add: #viewport;
|
|
yourself
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPerspective class >> isAbstract [
|
|
^ self = GrafoscopioPerspective
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPerspective class >> perspectives [
|
|
^ self allSubclasses select: [ : c | c isAbstract not ]
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> aboutToBeUninstalledFrom: aTreeNotebook [
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> addItemTo: aGroup [
|
|
aGroup
|
|
addItem: [ :item |
|
|
item
|
|
name: 'Dynamic';
|
|
icon: (self iconNamed: #delete);
|
|
action: [ aGroup menuItems remove: item.
|
|
self needRebuild: false.
|
|
self buildWithSpec ] ].
|
|
self needRebuild: false.
|
|
self buildWithSpec
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> addingMenu [
|
|
| menu |
|
|
menu := self newMenu.
|
|
GrafoscopioAbstractNode allSubclasses
|
|
select: [ :c | c showInMenu ]
|
|
thenDo: [ :n |
|
|
menu
|
|
addItem: [ :item |
|
|
item
|
|
name: n nameForSelection;
|
|
icon: n icon;
|
|
action: [ self addNewNodeOfClass: n ] ] ].
|
|
^ menu
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> createToolbar [
|
|
| aMenu |
|
|
aMenu := self newMenuBar
|
|
addGroup: [ :group |
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: 'File';
|
|
icon: (self iconNamed: #openIcon);
|
|
subMenu: self subMenu ].
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Open file';
|
|
icon: (self iconNamed: #openIcon);
|
|
action: [ self inform: 'Open File' ] ].
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Save File';
|
|
icon: (self iconNamed: #smallSaveIcon);
|
|
action: [ self inform: 'Save File' ] ].
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Print file';
|
|
icon: (self iconNamed: #smallPrintIcon);
|
|
action: [ self inform: 'Print file' ] ] ];
|
|
addGroup: [ :group |
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Undo';
|
|
icon: (self iconNamed: #smallUndoIcon);
|
|
action: [ self inform: 'Undo' ] ].
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Redo';
|
|
icon: (self iconNamed: #smallRedoIcon);
|
|
action: [ self inform: 'Redo' ] ].
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: '';
|
|
icon: (self iconNamed: #add);
|
|
subMenu: self addingMenu ].
|
|
|
|
];
|
|
addGroup: [ :group |
|
|
group
|
|
addItem: [ :item |
|
|
item
|
|
name: nil;
|
|
description: 'Add menu item';
|
|
icon: (self iconNamed: #add);
|
|
action: [ self addItemTo: group ] ] ].
|
|
aMenu color: Color transparent.
|
|
^ aMenu
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> createViewport [
|
|
self subclassResponsibility
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> initializeWidgets [
|
|
super initializeWidgets.
|
|
toolbar := self createToolbar.
|
|
viewport := self createViewport
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPerspective >> subMenu [
|
|
^ self newMenu
|
|
addItem: [ :item |
|
|
item
|
|
name: 'Open';
|
|
icon: (self iconNamed: #openIcon);
|
|
shortcut: $o meta;
|
|
action: [ self inform: 'Open' ] ];
|
|
addItem: [ :item |
|
|
item
|
|
name: 'Save';
|
|
icon: (self iconNamed: #smallSaveIcon);
|
|
shortcut: $s meta;
|
|
action: [ self inform: 'Save' ] ];
|
|
addItem: [ :item |
|
|
item
|
|
name: 'Print';
|
|
shortcut: $p meta;
|
|
icon: (self iconNamed: #smallPrintIcon);
|
|
action: [ self inform: 'Print' ] ];
|
|
addItem: [ :item |
|
|
item
|
|
name: 'Close';
|
|
shortcut: $c meta;
|
|
icon: (self iconNamed: #smallCancelIcon);
|
|
action: [ self inform: 'Kill' ] ];
|
|
yourself
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPerspective >> updateModel: aModel [
|
|
]
|