>From 037cfb40ad5084aeabc5b0da33da6b3a3051d7d6 Mon Sep 17 00:00:00 2001 From: Gwenael Casaccio Date: Wed, 4 Dec 2013 09:23:46 +0100 Subject: [PATCH] Migrate to new UI framework first step done: - introduce new UI; - remove most of the mainWidget calls; - more rationale in widget initialization; - less Gtk dependant. --- packages/visualgst/ChangeLog | 75 ++++ .../Commands/WorkspaceMenus/DeleteItemCommand.st | 2 +- .../Commands/WorkspaceMenus/InspectItemCommand.st | 2 +- packages/visualgst/Debugger/Extensions.st | 3 +- packages/visualgst/Debugger/GtkContextWidget.st | 38 +- packages/visualgst/Debugger/GtkDebugger.st | 8 +- packages/visualgst/Debugger/GtkStackInspector.st | 2 +- .../visualgst/Debugger/GtkStackInspectorView.st | 3 +- packages/visualgst/Extensions.st | 6 + packages/visualgst/Gtk/GtkListModel.st | 133 +++++++ packages/visualgst/Gtk/GtkScrollTreeWidget.st | 83 ++++ packages/visualgst/Gtk/GtkTreeModel.st | 176 +++++++++ packages/visualgst/GtkClassSUnitWidget.st | 99 ----- packages/visualgst/GtkConcreteWidget.st | 15 +- packages/visualgst/GtkEntryDialog.st | 10 +- packages/visualgst/GtkEntryWidget.st | 2 +- packages/visualgst/GtkHSidebarWidget.st | 42 -- packages/visualgst/GtkHistoryWidget.st | 59 +-- packages/visualgst/GtkLauncher.st | 85 ++-- packages/visualgst/GtkListModel.st | 133 ------- packages/visualgst/GtkMainWindow.st | 311 --------------- packages/visualgst/GtkMethodSUnitWidget.st | 51 --- packages/visualgst/GtkNotebookWidget.st | 187 --------- packages/visualgst/GtkScrollTreeWidget.st | 83 ---- packages/visualgst/GtkSidebarWidget.st | 130 ------ packages/visualgst/GtkTranscriptWidget.st | 2 +- packages/visualgst/GtkTreeModel.st | 176 --------- packages/visualgst/GtkVSidebarWidget.st | 42 -- packages/visualgst/GtkVariableTrackerWidget.st | 29 +- packages/visualgst/GtkVisualGSTTool.st | 2 +- packages/visualgst/GtkWorkspaceWidget.st | 13 +- packages/visualgst/Image/GtkImageWidget.st | 53 ++- .../Implementors/GtkImageResultsWidget.st | 23 +- .../Implementors/GtkImplementorResultsWidget.st | 11 +- .../Implementors/GtkSenderResultsWidget.st | 11 +- .../Inspector/GtkCharacterInspectorView.st | 62 --- .../Inspector/GtkCompiledBlockInspectorView.st | 124 ------ .../Inspector/GtkCompiledMethodInspectorView.st | 133 ------- .../visualgst/Inspector/GtkContextInspectorView.st | 58 --- .../Inspector/GtkDictionaryInspectorView.st | 53 --- .../visualgst/Inspector/GtkFloatInspectorView.st | 51 --- packages/visualgst/Inspector/GtkInspector.st | 29 +- .../Inspector/GtkInspectorBrowserWidget.st | 39 +- packages/visualgst/Inspector/GtkInspectorWidget.st | 38 +- .../visualgst/Inspector/GtkIntegerInspectorView.st | 62 --- .../visualgst/Inspector/GtkObjectInspectorView.st | 88 ----- .../GtkSequenceableCollectionInspectorView.st | 51 --- .../visualgst/Inspector/GtkSetInspectorView.st | 53 --- .../Inspector/View/GtkCharacterInspectorView.st | 62 +++ .../View/GtkCompiledBlockInspectorView.st | 124 ++++++ .../View/GtkCompiledMethodInspectorView.st | 133 +++++++ .../Inspector/View/GtkContextInspectorView.st | 58 +++ .../Inspector/View/GtkDictionaryInspectorView.st | 53 +++ .../Inspector/View/GtkFloatInspectorView.st | 51 +++ .../Inspector/View/GtkIntegerInspectorView.st | 62 +++ .../Inspector/View/GtkObjectInspectorView.st | 88 +++++ .../View/GtkSequenceableCollectionInspectorView.st | 51 +++ .../Inspector/View/GtkSetInspectorView.st | 53 +++ packages/visualgst/Menus/HistorySelectionMenus.st | 43 ++ packages/visualgst/SUnit/GtkClassSUnitWidget.st | 106 +++++ packages/visualgst/SUnit/GtkMethodSUnitWidget.st | 51 +++ packages/visualgst/SUnit/GtkSUnit.st | 60 +-- packages/visualgst/SUnit/GtkSUnitResultWidget.st | 52 +-- .../StBrowser/GtkCategorizedClassWidget.st | 69 ++-- .../StBrowser/GtkCategorizedNamespaceWidget.st | 51 ++- packages/visualgst/StBrowser/GtkCategoryWidget.st | 64 ++- .../visualgst/StBrowser/GtkClassBrowserWidget.st | 68 ++-- .../visualgst/StBrowser/GtkClassHierarchyWidget.st | 42 +- packages/visualgst/StBrowser/GtkMethodWidget.st | 42 +- packages/visualgst/Tetris/Tetris.st | 2 +- packages/visualgst/Text/GtkFindWidget.st | 125 ------ packages/visualgst/Text/GtkReplaceWidget.st | 103 ----- packages/visualgst/Text/GtkSaveTextWidget.st | 89 ----- packages/visualgst/Text/GtkSourceCodeWidget.st | 287 -------------- packages/visualgst/Text/GtkTextPluginWidget.st | 90 ----- packages/visualgst/Text/GtkTextWidget.st | 435 --------------------- packages/visualgst/package.xml | 98 ++--- 77 files changed, 1825 insertions(+), 3728 deletions(-) create mode 100644 packages/visualgst/Gtk/GtkListModel.st create mode 100644 packages/visualgst/Gtk/GtkScrollTreeWidget.st create mode 100644 packages/visualgst/Gtk/GtkTreeModel.st delete mode 100644 packages/visualgst/GtkClassSUnitWidget.st delete mode 100644 packages/visualgst/GtkHSidebarWidget.st delete mode 100644 packages/visualgst/GtkListModel.st delete mode 100644 packages/visualgst/GtkMainWindow.st delete mode 100644 packages/visualgst/GtkMethodSUnitWidget.st delete mode 100644 packages/visualgst/GtkNotebookWidget.st delete mode 100644 packages/visualgst/GtkScrollTreeWidget.st delete mode 100644 packages/visualgst/GtkSidebarWidget.st delete mode 100644 packages/visualgst/GtkTreeModel.st delete mode 100644 packages/visualgst/GtkVSidebarWidget.st delete mode 100644 packages/visualgst/Inspector/GtkCharacterInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkContextInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkDictionaryInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkFloatInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkIntegerInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkObjectInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st delete mode 100644 packages/visualgst/Inspector/GtkSetInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkCharacterInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkCompiledBlockInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkCompiledMethodInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkContextInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkDictionaryInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkFloatInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkIntegerInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkObjectInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkSequenceableCollectionInspectorView.st create mode 100644 packages/visualgst/Inspector/View/GtkSetInspectorView.st create mode 100644 packages/visualgst/Menus/HistorySelectionMenus.st create mode 100644 packages/visualgst/SUnit/GtkClassSUnitWidget.st create mode 100644 packages/visualgst/SUnit/GtkMethodSUnitWidget.st delete mode 100644 packages/visualgst/Text/GtkFindWidget.st delete mode 100644 packages/visualgst/Text/GtkReplaceWidget.st delete mode 100644 packages/visualgst/Text/GtkSaveTextWidget.st delete mode 100644 packages/visualgst/Text/GtkSourceCodeWidget.st delete mode 100644 packages/visualgst/Text/GtkTextPluginWidget.st delete mode 100644 packages/visualgst/Text/GtkTextWidget.st diff --git a/packages/visualgst/ChangeLog b/packages/visualgst/ChangeLog index ed475dd..8bc960c 100644 --- a/packages/visualgst/ChangeLog +++ b/packages/visualgst/ChangeLog @@ -1,5 +1,80 @@ 2013-12-02 Gwenael Casaccio + * Commands/WorkspaceMenus/DeleteItemCommand.st: New UI support. + * Commands/WorkspaceMenus/InspectItemCommand.st: New UI support. + * Debugger/Extensions.st: Disable the debugger. + * Debugger/GtkContextWidget.st: Migration to new UI. + * Debugger/GtkDebugger.st: Migration to new UI. + * Debugger/GtkStackInspector.st: Migration to new UI. + * Debugger/GtkStackInspectorView.st: Migration to new UI. + * Extensions.st: Migration to new UI. + * Gtk/GtkListModel.st: Move to Gtk. + * Gtk/GtkScrollTreeWidget.st: Move to Gtk. + * Gtk/GtkTreeModel.st: Move to Gtk. + * GtkConcreteWidget.st: Update to new UI. + * GtkEntryDialog.st: Update to new UI. + * GtkEntryWidget.st: Update to new UI. + * GtkHistoryWidget.st: Update to new UI. + * GtkLauncher.st: Update to new UI. + * GtkTranscriptWidget.st: Update to new UI. + * GtkVariableTrackerWidget.st: Update to new UI. + * GtkVisualGSTTool.st: Update to new UI. + * GtkWorkspaceWidget.st: Update to new UI. + * Image/GtkImageWidget.st: Update to new UI. + * Implementors/GtkImageResultsWidget.st: Update to new UI. + * Implementors/GtkImplementorResultsWidget.st: Update to new UI. + * Implementors/GtkSenderResultsWidget.st: Update to new UI. + * Inspector/GtkInspector.st: Update to new UI. + * Inspector/GtkInspectorBrowserWidget.st: Update to new UI. + * Inspector/GtkInspectorWidget.st: Update to new UI. + * Inspector/View/GtkCharacterInspectorView.st: Move inspector view. + * Inspector/View/GtkCompiledBlockInspectorView.st: Move inspector view. + * Inspector/View/GtkCompiledMethodInspectorView.st: Move inspector view. + * Inspector/View/GtkContextInspectorView.st: Move inspector view. + * Inspector/View/GtkDictionaryInspectorView.st: Move inspector view. + * Inspector/View/GtkFloatInspectorView.st: Move inspector view. + * Inspector/View/GtkIntegerInspectorView.st: Move inspector view. + * Inspector/View/GtkObjectInspectorView.st: Move inspector view. + * Inspector/View/GtkSequenceableCollectionInspectorView.st: Move inspector view. + * Inspector/View/GtkSetInspectorView.st: Move inspector view. + * Menus/HistorySelectionMenus.st: New history popup menu. + * SUnit/GtkClassSUnitWidget.st: Update to new UI. + * SUnit/GtkMethodSUnitWidget.st: Update to new UI. + * SUnit/GtkSUnit.st: Update to new UI. + * SUnit/GtkSUnitResultWidget.st: Update to new UI. + * StBrowser/GtkCategorizedClassWidget.st: Update to new UI. + * StBrowser/GtkCategorizedNamespaceWidget.st: Update to new UI. + * StBrowser/GtkCategoryWidget.st: Update to new UI. + * StBrowser/GtkClassBrowserWidget.st: Update to new UI. + * StBrowser/GtkClassHierarchyWidget.st: Update to new UI. + * StBrowser/GtkMethodWidget.st: Update to new UI. + * Tetris/Tetris.st: Update to new UI. + * Widget/Box.st: Box widget. + * Widget/Compoment.st: Compoment. + * Widget/Entry.st: Entry widget. + * Widget/HBox.st: Horizontal box widget. + * Widget/HPaned.st: Horizontal paned widget. + * Widget/HSidebar.st: Horizontal sidebar widget. + * Widget/Label.st: Label widget. + * Widget/List.st: List widget. + * Widget/Notebook.st: Notebook widget. + * Widget/Paned.st: Paned widget. + * Widget/Sidebar.st: Sidebar widget. + * Widget/Text/GtkFindWidget.st: Find text widget. + * Widget/Text/GtkReplaceWidget.st: Replace text widget. + * Widget/Text/GtkSaveTextWidget.st: Save source warning widget. + * Widget/Text/GtkSourceCodeWidget.st: Smalltalk source widget. + * Widget/Text/GtkTextPluginWidget.st: Text widget plugin. + * Widget/Text/GtkTextWidget.st: Text widget + * Widget/Tree.st: Tree widget. + * Widget/VBox.st: Vertical box widget. + * Widget/VPaned.st: Vertical paned widget. + * Widget/VSidebar.st: Vertical sidebar widget. + * Widget/Widget.st: Widget. + * Widget/Window.st: Window widget. + +2013-12-02 Gwenael Casaccio + * GtkConcreteWidget.st: Object is the superclass. * GtkAbstractConcreteWidget.st: Remove it. * GtkSidebarWidget.st: Doesn't rely on GtkAbstractConcreteWidget. diff --git a/packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st b/packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st index c0433ad..2a0a63c 100644 --- a/packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st +++ b/packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st @@ -43,7 +43,7 @@ Command subclass: DeleteItemCommand [ valid [ - ^ target hasSelectedItem + ^ target hasSelection ] execute [ diff --git a/packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st b/packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st index 2d9cf5d..2b7dd88 100644 --- a/packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st +++ b/packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st @@ -43,7 +43,7 @@ InspectItCommand subclass: InspectItemCommand [ valid [ - ^ target hasSelectedValue + ^ target hasSelection ] ] diff --git a/packages/visualgst/Debugger/Extensions.st b/packages/visualgst/Debugger/Extensions.st index 5d011b6..3895161 100644 --- a/packages/visualgst/Debugger/Extensions.st +++ b/packages/visualgst/Debugger/Extensions.st @@ -38,7 +38,8 @@ Behavior extend [ debuggerClass [ - ^ VisualGST.GtkDebugger + ^ nil +" ^ VisualGST.GtkDebugger" ] ] diff --git a/packages/visualgst/Debugger/GtkContextWidget.st b/packages/visualgst/Debugger/GtkContextWidget.st index 902f6c5..50fa75e 100644 --- a/packages/visualgst/Debugger/GtkContextWidget.st +++ b/packages/visualgst/Debugger/GtkContextWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkContextWidget [ - | column contextTree model context contextList | +Compoment subclass: GtkContextWidget [ + + | context contextList | GtkContextWidget class >> on: aContext [ - ^ (self new) - initialize; + ^ self new context: aContext; yourself ] @@ -48,14 +48,14 @@ GtkConcreteWidget subclass: GtkContextWidget [ initialize [ - self mainWidget: self buildTreeView + self buildTreeView ] context: aContext [ context := aContext. - model + widget item: self buildListOfContexts; refresh ] @@ -74,20 +74,16 @@ GtkConcreteWidget subclass: GtkContextWidget [ buildTreeView [ - - contextTree := GtkScrollTreeWidget createListWithModel: {{GtkColumnTextType title: 'Contexts'}}. - contextTree connectToWhenPopupMenu: (ContextMenus on: self). - contextTree treeView getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkListModel on: contextTree treeView getModel) - contentsBlock: [ :each | {each printString} ]. - ^ contextTree mainWidget + + self widget: (List column: {{GtkColumnTextType title: 'Contexts'}} contents: [ :each | {each printString} ]). + widget popupMenu: (ContextMenus on: self). + widget singleSelection. ] whenSelectionChangedSend: aSelector to: anObject [ - contextTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector userData: nil + widget whenSelectionChangedSend: aSelector to: anObject ] isLastContextSelected [ @@ -99,19 +95,19 @@ GtkConcreteWidget subclass: GtkContextWidget [ selectLastContext [ - contextTree treeView selectLastItem + widget selectLastItem ] selectFirstContext [ - contextTree treeView selectFirstItem + widget selectFirstItem ] hasSelectedContext [ - ^ contextTree treeView hasSelectedItem + ^ widget hasSelection ] selectedContext [ @@ -119,15 +115,15 @@ GtkConcreteWidget subclass: GtkContextWidget [ self hasSelectedContext ifFalse: [ self error: 'Nothing is selected' ]. - ^ contextTree treeView selection + ^ widget selection ] state [ "TODO: add ContextState." - contextTree treeView hasSelectedItem ifTrue: [ - ^MethodState with: contextTree treeView selection method method ]. + widget treeView hasSelectedItem ifTrue: [ + ^MethodState with: self selection method ]. ^BrowserState new ] diff --git a/packages/visualgst/Debugger/GtkDebugger.st b/packages/visualgst/Debugger/GtkDebugger.st index 4287fdd..7576bb0 100644 --- a/packages/visualgst/Debugger/GtkDebugger.st +++ b/packages/visualgst/Debugger/GtkDebugger.st @@ -117,25 +117,25 @@ GtkBrowsingTool subclass: GtkDebugger [ ^ (stackInspectorWidget := GtkStackInspector new) parentWindow: window; initialize; - mainWidget + yourself ] buildInspectorsWidget [ - ^ GTK.GtkHPaned addAll: {self buildInspectorWidget mainWidget. self buildStackInspectorWidget} + ^ HPaned addAll: {self buildInspectorWidget. self buildStackInspectorWidget} ] buildCodeAndStateWidget [ - ^ GTK.GtkVPaned addAll: {self buildSourceWidget mainWidget. self buildInspectorsWidget} + ^ VPaned addAll: {self buildSourceWidget. self buildInspectorsWidget} ] buildCentralWidget [ - ^ GTK.GtkVPaned addAll: {self buildContextWidget mainWidget. self buildCodeAndStateWidget} + ^ VPaned addAll: {self buildContextWidget. self buildCodeAndStateWidget} ] createExecuteMenus [ diff --git a/packages/visualgst/Debugger/GtkStackInspector.st b/packages/visualgst/Debugger/GtkStackInspector.st index fa2f1c7..3bb1e87 100644 --- a/packages/visualgst/Debugger/GtkStackInspector.st +++ b/packages/visualgst/Debugger/GtkStackInspector.st @@ -40,7 +40,7 @@ GtkInspectorWidget subclass: GtkStackInspector [ object := aContext. objectView := object stackInspectorView openOn: self object. - model + inspectorTree item: objectView; refresh ] diff --git a/packages/visualgst/Debugger/GtkStackInspectorView.st b/packages/visualgst/Debugger/GtkStackInspectorView.st index 19355ab..b8ea3ee 100644 --- a/packages/visualgst/Debugger/GtkStackInspectorView.st +++ b/packages/visualgst/Debugger/GtkStackInspectorView.st @@ -33,7 +33,8 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkStackInspectorView [ +Object subclass: GtkStackInspectorView [ + | object args temps | GtkStackInspectorView class >> openOn: aContext [ diff --git a/packages/visualgst/Extensions.st b/packages/visualgst/Extensions.st index 0661d7d..9a36b20 100644 --- a/packages/visualgst/Extensions.st +++ b/packages/visualgst/Extensions.st @@ -518,6 +518,12 @@ GTK.GtkTreeView extend [ ^ model ] + unselectAll [ + + + self getSelection unselectAll. + ] + selection [ diff --git a/packages/visualgst/Gtk/GtkListModel.st b/packages/visualgst/Gtk/GtkListModel.st new file mode 100644 index 0000000..c39925c --- /dev/null +++ b/packages/visualgst/Gtk/GtkListModel.st @@ -0,0 +1,133 @@ +"====================================================================== +| +| GtkListModel class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +Object subclass: GtkListModel [ + + GtkListModel class >> on: aGtkListStore [ + + + ^ super new + initialize; + gtkModel: aGtkListStore; + yourself + ] + + | contentsBlock item model | + + initialize [ + + + ] + + gtkModel: aGtkListStore [ + + + model := aGtkListStore + ] + + item: anObject [ + + + item := anObject + ] + + item [ + + + ^ item + ] + + contentsBlock: aBlock [ + + + contentsBlock := aBlock + ] + + contentsBlock [ + + + ^ contentsBlock + ] + + append: anItem [ + + + model appendItem: ((self contentsBlock value: anItem) copyWith: anItem) + ] + + remove: anObject [ + + + | iter | + (iter := self findIter: anObject) ifNil: [ self error: 'item not found' ]. + model remove: iter + ] + + clear [ + + + model clear + ] + + refresh [ + + + self clear. + self item ifNil: [ ^ self ]. + self item do: [ :each | self append: each ] + ] + + hasItem: anObject [ + + + self findIter: anObject ifAbsent: [ ^ false ]. + ^ true + ] + + findIter: anObject ifAbsent: aBlock [ + + + model do: [ :elem :iter | + elem last = anObject ifTrue: [ ^ iter ] ]. + aBlock value + ] + + findIter: anObject [ + + + ^ self findIter: anObject ifAbsent: [ self error: 'Item not found' ] + ] +] + diff --git a/packages/visualgst/Gtk/GtkScrollTreeWidget.st b/packages/visualgst/Gtk/GtkScrollTreeWidget.st new file mode 100644 index 0000000..2bd9c4a --- /dev/null +++ b/packages/visualgst/Gtk/GtkScrollTreeWidget.st @@ -0,0 +1,83 @@ +"====================================================================== +| +| GtkScrollTreeWidget class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkConcreteWidget subclass: GtkScrollTreeWidget [ + + GtkScrollTreeWidget class >> createListWithModel: anObject [ + + + ^ self basicNew + treeView: (GTK.GtkTreeView createListWithModel: anObject); + initialize; + yourself + ] + + GtkScrollTreeWidget class >> createTreeWithModel: anObject [ + + + ^ self basicNew + treeView: (GTK.GtkTreeView createTreeWithModel: anObject); + initialize; + yourself + ] + + | treeView | + + initialize [ + + + popupMenu := [ :value | ]. + self buildTreeView. + self mainWidget: (GTK.GtkScrolledWindow withChild: self treeView) + ] + + buildTreeView [ + + + ] + + treeView: aGtkTreeView [ + + + treeView := aGtkTreeView. + ] + + treeView [ + + + ^ treeView + ] +] + diff --git a/packages/visualgst/Gtk/GtkTreeModel.st b/packages/visualgst/Gtk/GtkTreeModel.st new file mode 100644 index 0000000..7734f09 --- /dev/null +++ b/packages/visualgst/Gtk/GtkTreeModel.st @@ -0,0 +1,176 @@ +"====================================================================== +| +| GtkTreeModel class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +Object subclass: GtkTreeModel [ + + GtkTreeModel class >> on: aGtkTreeStore [ + + + ^ super new + initialize; + gtkModel: aGtkTreeStore; + yourself + ] + + | childrenBlock contentsBlock item model | + + initialize [ + + + ] + + gtkModel: aGtkTreeStore [ + + + model := aGtkTreeStore + ] + + connectSignal: aString to: anObject selector: aSymbol [ + + + ^ model connectSignal: aString to: anObject selector: aSymbol + ] + + item: anObject [ + + + item := anObject + ] + + item [ + + + ^ item + ] + + childrenBlock: aBlock [ + + + childrenBlock := aBlock + ] + + childrenBlock [ + + + ^ childrenBlock + ] + + contentsBlock: aBlock [ + + + contentsBlock := aBlock + ] + + contentsBlock [ + + + ^ contentsBlock + ] + + append: anObject [ + + + self append: anObject with: nil + ] + + append: anObject parent: aParentObject [ + + + self append: anObject with: (self findIter: aParentObject) + ] + + append: anItem with: aParentIter [ + + + | iter | + iter := model append: aParentIter item: ((self contentsBlock value: anItem) copyWith: anItem). + (self childrenBlock value: anItem) do: [ :each | self append: each with: iter ] + ] + + remove: anObject ifAbsent: aBlock [ + + + | iter | + iter := self findIter: anObject ifAbsent: [ ^ aBlock value ]. + model remove: iter + ] + + remove: anObject [ + + + self remove: anObject ifAbsent: [ self error: 'item not found' ] + ] + + clear [ + + + model clear + ] + + refresh [ + + + self clear. + self item ifNil: [ ^ self ]. + (self childrenBlock value: self item) do: [ :each | self append: each with: nil ] + ] + + hasItem: anObject [ + + + self findIter: anObject ifAbsent: [ ^ false ]. + ^ true + ] + + findIter: anObject ifAbsent: aBlock [ + + + model do: [ :elem :iter | + elem last = anObject ifTrue: [ ^ iter ] ]. + aBlock value + ] + + findIter: anObject [ + + + ^ self findIter: anObject ifAbsent: [ self error: 'Item not found' ] + ] + + includes: anObject [ + self findIter: anObject ifAbsent: [ ^ false ]. + ^ true + ] +] + diff --git a/packages/visualgst/GtkClassSUnitWidget.st b/packages/visualgst/GtkClassSUnitWidget.st deleted file mode 100644 index 24cde2e..0000000 --- a/packages/visualgst/GtkClassSUnitWidget.st +++ /dev/null @@ -1,99 +0,0 @@ -"====================================================================== -| -| GtkClassSUnitWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkCategorizedClassWidget subclass: GtkClassSUnitWidget [ - - addToModel: aClass [ - - (aClass superclass environment == self namespace and: [ (aClass superclass category = self category or: [ self category isEmpty ]) and: [ aClass superclass ~~ Smalltalk.TestCase ] ]) - ifFalse: [ model append: aClass class ] - ifTrue: [ model append: aClass class parent: aClass superclass class ] - ] - - root [ - - - ^ Smalltalk.TestCase - ] - - selectionMode [ - - - ^ GTK.Gtk gtkSelectionMultiple - ] - - allClassNames [ - - - | classes names | - classes := self selectedClasses. - names := classes collect: [ :each | each name asString ]. - ^ names fold: [ :a :b | a, ', ', b ] - ] - - hasSelectedClass [ - - - ^ (classesTree treeView getSelection getSelectedRows: nil) ~= nil - ] - - selectedClass [ - - - ^ self selectedClasses first - ] - - selectedClasses [ - - - self hasSelectedClass ifFalse: [ self error: 'Nothing is selected' ]. - ^ classesTree treeView selections collect: [:each| each asClass] - ] - - recategorizedEvent: anEvent [ - - - (anEvent item inheritsFrom: TestCase) ifFalse: [ ^ self ]. - super recategorizedEvent: anEvent - ] - - addEvent: anEvent [ - - - (anEvent item inheritsFrom: TestCase) ifFalse: [ ^ self ]. - super addEvent: anEvent - ] -] - diff --git a/packages/visualgst/GtkConcreteWidget.st b/packages/visualgst/GtkConcreteWidget.st index 26973ec..4a54d29 100644 --- a/packages/visualgst/GtkConcreteWidget.st +++ b/packages/visualgst/GtkConcreteWidget.st @@ -34,7 +34,8 @@ ======================================================================" Object subclass: GtkConcreteWidget [ - | child parentWindow popupMenu | + + | child parent parentWindow popupMenu | GtkConcreteWidget class >> parentWindow: aGtkWindow [ @@ -59,6 +60,18 @@ Object subclass: GtkConcreteWidget [ ] + parent: aWidget [ + + + parent := aWidget + ] + + parent [ + + + ^ parent + ] + parentWindow: aGtkWindow [ diff --git a/packages/visualgst/GtkEntryDialog.st b/packages/visualgst/GtkEntryDialog.st index c4f1d6d..60c2079 100644 --- a/packages/visualgst/GtkEntryDialog.st +++ b/packages/visualgst/GtkEntryDialog.st @@ -74,7 +74,7 @@ Object subclass: GtkEntryDialog [ result [ - ^ entryWidget getText + ^ entryWidget text ] buildCentralWidget: aString on: aGtkDialog [ @@ -88,12 +88,12 @@ Object subclass: GtkEntryDialog [ defaultButton := GTK.Gtk perform: buttons first second. aGtkDialog setDefaultResponse: defaultButton. hbox := GTK.GtkHBox new: true spacing: 0. - labelWidget := GTK.GtkLabel new: aString. - entryWidget := GTK.GtkEntry new. + labelWidget := Label text: aString. + entryWidget := Entry new. entryWidget setActivatesDefault: true. hbox - add: labelWidget; - add: entryWidget; + add: labelWidget mainWidget; + add: entryWidget mainWidget; showAll. aGtkDialog getVBox add: hbox ] diff --git a/packages/visualgst/GtkEntryWidget.st b/packages/visualgst/GtkEntryWidget.st index 4b21e3a..ed2fc4f 100644 --- a/packages/visualgst/GtkEntryWidget.st +++ b/packages/visualgst/GtkEntryWidget.st @@ -57,7 +57,7 @@ GtkConcreteWidget subclass: GtkEntryWidget [ entry := GTK.GtkEntry new. ^ (GTK.GtkHBox new: true spacing: 3) - add: (GTK.GtkLabel new: label); + add: (Label text: label) mainWidget; add: entry; yourself ] diff --git a/packages/visualgst/GtkHSidebarWidget.st b/packages/visualgst/GtkHSidebarWidget.st deleted file mode 100644 index daa86e2..0000000 --- a/packages/visualgst/GtkHSidebarWidget.st +++ /dev/null @@ -1,42 +0,0 @@ -"====================================================================== -| -| GtkHSideBarWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkSidebarWidget subclass: GtkHSidebarWidget [ - - panedOrientation [ - ^ GTK.GtkHPaned - ] -] - diff --git a/packages/visualgst/GtkHistoryWidget.st b/packages/visualgst/GtkHistoryWidget.st index 106f1f4..0a297e4 100644 --- a/packages/visualgst/GtkHistoryWidget.st +++ b/packages/visualgst/GtkHistoryWidget.st @@ -33,21 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkHistoryWidget [ - | browser model widget | +Compoment subclass: GtkHistoryWidget [ - GtkHistoryWidget class >> new [ - - - ^ super new - initialize; - yourself - ] + | browser stack | initialize [ - self mainWidget: self buildListView + self buildListView. ] browser: aBrowser [ @@ -59,40 +52,22 @@ GtkConcreteWidget subclass: GtkHistoryWidget [ buildListView [ - widget := (GTK.GtkTreeView createListWithModel: {{GtkColumnTextType title: 'History'}}) - connectSignal: 'button-press-event' to: self selector: #'onPress:event:'; - yourself. - widget getSelection setMode: GTK.Gtk gtkSelectionBrowse. - widget getSelection connectSignal: 'changed' to: self selector: #onSelectionChanged. - (model := GtkListModel on: widget getModel) - contentsBlock: [ :each | {each name displayString} ]. - ^ GTK.GtkScrolledWindow withChild: widget + self widget: (List column: {{GtkColumnTextType title: 'History'}} contents: [ :each | {each name displayString} ]). + widget popupMenu: (HistorySelectionMenus on: self) "{{'Inspect a class'. self. #inspectClass}. + {'Open in new tab'. self. #browseTabbedClass}. + {'Open in new window'. self. #browseClass}}". + widget singleSelection. + widget whenSelectionChangedSend: #onSelectionChanged to: self. ] refresh: historyStack [ - model - item: historyStack; + widget + item: (stack := historyStack); refresh. - widget selectNth: historyStack selectedIndex. - ] - - onPress: aGtkWidget event: aGdkEvent [ - - - | menu aGdkButtonEvent | - aGdkButtonEvent := aGdkEvent castTo: GTK.GdkEventButton type. - aGdkButtonEvent button value = 3 ifFalse: [ ^ false ]. - menu := GTK.GtkMenu new. - menu appendMenuItems: {{'Inspect a class'. self. #inspectClass}. - {'Open in new tab'. self. #browseTabbedClass}. - "{'Open in new window'. self. #browseClass}"}. - menu attachToWidget: widget detacher: nil. - menu popup: nil parentMenuItem: nil func: nil data: nil button: 3 activateTime: aGdkButtonEvent time value. - menu showAll. - ^ true + widget selectAt: historyStack selectedIndex. ] targetObject [ @@ -125,9 +100,9 @@ GtkConcreteWidget subclass: GtkHistoryWidget [ onSelectionChanged [ - widget hasSelectedItem ifFalse: [ ^ self ]. - model item selectedIndex = widget selectedIndex ifTrue: [^self]. - model item selectItem: widget selectedIndex. + widget hasSelection ifFalse: [ ^ self ]. + stack selectedIndex = widget selectionIndex ifTrue: [^self]. + stack selectItem: widget selectionIndex. ] browseTabbedClass [ @@ -135,14 +110,14 @@ GtkConcreteWidget subclass: GtkHistoryWidget [ "TODO: should reuse OpenTabbedBrowserCommand by giving a state to GtkHistoryWidget." - widget hasSelectedItem ifFalse: [ ^ self ]. + widget hasSelection ifFalse: [ ^ self ]. self updateBrowser: GtkLauncher uniqueInstance classBrowser ] state [ - ^model item current + ^ stack current ] ] diff --git a/packages/visualgst/GtkLauncher.st b/packages/visualgst/GtkLauncher.st index 5383b34..2ae1bf0 100644 --- a/packages/visualgst/GtkLauncher.st +++ b/packages/visualgst/GtkLauncher.st @@ -36,7 +36,7 @@ GtkVisualGSTTool subclass: GtkLauncher [ GtkLauncher class [ | uniqueInstance | ] - | leftSidebar rightSidebar topSidebar packageBuilderWidget implementorResultWidget senderResultWidget senderWidget implementorWidget historyWidget browsers outputs saved imageName transcriptWidget windowsMenu systemChangeNotifier | + | leftSidebarP leftSidebar rightSidebar topSidebarP topSidebar packageBuilderWidget implementorResultWidget senderResultWidget senderWidget implementorWidget historyWidget browsers outputs saved imageName transcriptWidget windowsMenu systemChangeNotifier | GtkLauncher class >> uniqueInstance [ @@ -130,7 +130,7 @@ GtkVisualGSTTool subclass: GtkLauncher [ | widget | - browsers addWidget: (widget := self buildClassBrowserWidget) labeled: 'Browser'. + browsers addWidget: (widget := self buildClassBrowserWidget) label: 'Browser'. browsers showLastPage. widget postInitialize. ^ widget @@ -146,9 +146,9 @@ GtkVisualGSTTool subclass: GtkLauncher [ | widget | - widget := self buildWorkspaceWidget showAll. + widget := self buildWorkspaceWidget. widget postInitialize. - outputs addWidget: widget labeled: aString. + outputs addWidget: widget label: aString. outputs showLastPage. ^widget ] @@ -310,10 +310,10 @@ GtkVisualGSTTool subclass: GtkLauncher [ subscribe [ - GtkAnnouncer current on: GtkNamespaceSelectionChanged do: [ :ann | + "GtkAnnouncer current on: GtkNamespaceSelectionChanged do: [ :ann | browsers updateWidget: browsers currentWidget withLabel: ann selectedNamespace name asString]. GtkAnnouncer current on: GtkClassSelectionChanged do: [ :ann | - browsers updateWidget: browsers currentWidget withLabel: ann selectedClass printString] + browsers updateWidget: browsers currentWidget withLabel: ann selectedClass printString]" ] windowTitle [ @@ -338,26 +338,21 @@ GtkVisualGSTTool subclass: GtkLauncher [ super postInitialize. self browserPostInitialize. 1 to: 2 do: [ :i | (outputs widgetAt: i) postInitialize ]. - leftSidebar mainWidget getParent setPosition: 270. - topSidebar mainWidget getParent setPosition: 100. - leftSidebar postInitialize. - topSidebar postInitialize. - rightSidebar postInitialize. - window - connectSignal: 'key-press-event' to: self selector: #'keyPressedOn:keyEvent:' + self hideSidebars. + leftSidebarP position: 150. + topSidebarP position: 100. + window connectSignal: 'key-press-event' to: self selector: #'keyPressedOn:keyEvent:' ] buildNotebookWorkspaceWidget [ - outputs := GtkNotebookWidget new - initialize; + outputs := Notebook new parentWindow: window; - showAll; yourself. ^ outputs - addPermanentWidget: (transcriptWidget := self buildTranscriptWidget) labeled: 'Transcript'; - addWidget: self buildWorkspaceWidget labeled: 'Workspace'; + addPermanentWidget: (transcriptWidget := self buildTranscriptWidget) label: 'Transcript'; + addWidget: self buildWorkspaceWidget label: 'Workspace'; yourself ] @@ -370,81 +365,71 @@ GtkVisualGSTTool subclass: GtkLauncher [ buildImplementorPaned [ - leftSidebar := GtkHSidebarWidget new - initialize; + leftSidebar := HSidebar new addAll: {self buildImplementorView -> 'Implementor'. self buildSenderView -> 'Sender'. self buildHistoryView -> 'History'}; yourself. self registerLeftPaneEvents. - ^ leftSidebar mainWidget + ^ leftSidebar ] buildPackageBuilderView [ - packageBuilderWidget := GtkPackageBuilderWidget new + ^ packageBuilderWidget := GtkPackageBuilderWidget new initialize; yourself. - ^ packageBuilderWidget mainWidget ] buildRightSidebarPaned [ - rightSidebar := GtkHSidebarWidget new - initialize; + ^ rightSidebar := HSidebar new addAll: {self buildPackageBuilderView -> 'Package Builder'}; yourself. - ^ rightSidebar mainWidget ] buildBrowserAndWorkspaceWidget [ - ^ GTK.GtkVPaned addAll: { - GTK.GtkHPaned addAll: {self buildImplementorPaned. self buildBottomPanedAndClassBrowser. self buildRightSidebarPaned}. - self buildNotebookWorkspaceWidget mainWidget} + ^ VPaned addAll: + { leftSidebarP := HPaned addAll: { self buildImplementorPaned. self buildBottomPanedAndClassBrowser. self buildRightSidebarPaned }. + self buildNotebookWorkspaceWidget } ] buildImplementorView [ - implementorWidget := self buildImageView + ^ implementorWidget := self buildImageView whenSelectionChangedSend: #implementorSelected to: self; yourself. - ^ implementorWidget mainWidget ] buildSenderView [ - senderWidget := self buildImageView + ^ senderWidget := self buildImageView whenSelectionChangedSend: #senderSelected to: self; yourself. - ^ senderWidget mainWidget ] buildImageView [ ^ GtkImageWidget new - initialize; - yourself ] buildHistoryView [ - historyWidget := GtkHistoryWidget new + ^ historyWidget := GtkHistoryWidget new browser: self; yourself. - ^ historyWidget mainWidget ] buildImplementorResultList [ ^ implementorResultWidget := GtkImplementorResultsWidget new - initialize; whenSelectionChangedSend: #resultImplementorSelected to: self; yourself ] @@ -453,7 +438,6 @@ GtkVisualGSTTool subclass: GtkLauncher [ ^ senderResultWidget := GtkSenderResultsWidget new - initialize; whenSelectionChangedSend: #resultSenderSelected to: self; yourself ] @@ -461,27 +445,24 @@ GtkVisualGSTTool subclass: GtkLauncher [ buildTopSidebar [ - topSidebar := GtkHSidebarWidget new - initialize; - addAll: {self buildImplementorResultList mainWidget -> ''. self buildSenderResultList mainWidget -> ''}; + ^ topSidebar := HSidebar new + addAll: {self buildImplementorResultList -> ''. self buildSenderResultList -> ''}; hideTabs; yourself. - ^ topSidebar mainWidget ] buildBottomPanedAndClassBrowser [ - ^ GTK.GtkVPaned addAll: {self buildTopSidebar. self buildClassBrowserTabbedWidget mainWidget} + ^ topSidebarP := VPaned addAll: {self buildTopSidebar. self buildClassBrowserTabbedWidget} ] buildClassBrowserTabbedWidget [ - ^ (browsers := GtkNotebookWidget parentWindow: window) - showAll; + ^ (browsers := Notebook parentWindow: window) whenSelectionChangedSend: #historyChanged to: self; - addWidget: self buildClassBrowserWidget labeled: 'Browser'; + addWidget: self buildClassBrowserWidget label: 'Browser'; yourself ] @@ -509,9 +490,9 @@ GtkVisualGSTTool subclass: GtkLauncher [ leftSidebar - whenWidgetIsVisible: implementorWidget mainWidget send: #switchToImplementor to: self; - whenWidgetIsVisible: senderWidget mainWidget send: #switchToSender to: self; - whenWidgetIsVisible: historyWidget mainWidget send: #switchToHistory to: self. + whenWidgetIsVisible: implementorWidget send: #switchToImplementor to: self; + whenWidgetIsVisible: senderWidget send: #switchToSender to: self; + whenWidgetIsVisible: historyWidget send: #switchToHistory to: self. ] createEditMenus [ @@ -818,8 +799,8 @@ GtkVisualGSTTool subclass: GtkLauncher [ | isVisible | isVisible := aGtkWidget isVisible. - leftSidebar mainWidget getParent getPosition = 0 ifTrue: [ isVisible := false. leftSidebar mainWidget getParent setPosition: 270 ]. - topSidebar mainWidget getParent getPosition = 0 ifTrue: [ isVisible := false. topSidebar mainWidget getParent setPosition: 100 ]. + leftSidebarP position = 0 ifTrue: [ isVisible := false. leftSidebarP position: 150 ]. + topSidebarP position = 0 ifTrue: [ isVisible := false. topSidebarP position: 100 ]. self hideSidebars. isVisible ifFalse: [ diff --git a/packages/visualgst/GtkListModel.st b/packages/visualgst/GtkListModel.st deleted file mode 100644 index c39925c..0000000 --- a/packages/visualgst/GtkListModel.st +++ /dev/null @@ -1,133 +0,0 @@ -"====================================================================== -| -| GtkListModel class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -Object subclass: GtkListModel [ - - GtkListModel class >> on: aGtkListStore [ - - - ^ super new - initialize; - gtkModel: aGtkListStore; - yourself - ] - - | contentsBlock item model | - - initialize [ - - - ] - - gtkModel: aGtkListStore [ - - - model := aGtkListStore - ] - - item: anObject [ - - - item := anObject - ] - - item [ - - - ^ item - ] - - contentsBlock: aBlock [ - - - contentsBlock := aBlock - ] - - contentsBlock [ - - - ^ contentsBlock - ] - - append: anItem [ - - - model appendItem: ((self contentsBlock value: anItem) copyWith: anItem) - ] - - remove: anObject [ - - - | iter | - (iter := self findIter: anObject) ifNil: [ self error: 'item not found' ]. - model remove: iter - ] - - clear [ - - - model clear - ] - - refresh [ - - - self clear. - self item ifNil: [ ^ self ]. - self item do: [ :each | self append: each ] - ] - - hasItem: anObject [ - - - self findIter: anObject ifAbsent: [ ^ false ]. - ^ true - ] - - findIter: anObject ifAbsent: aBlock [ - - - model do: [ :elem :iter | - elem last = anObject ifTrue: [ ^ iter ] ]. - aBlock value - ] - - findIter: anObject [ - - - ^ self findIter: anObject ifAbsent: [ self error: 'Item not found' ] - ] -] - diff --git a/packages/visualgst/GtkMainWindow.st b/packages/visualgst/GtkMainWindow.st deleted file mode 100644 index 98b8c12..0000000 --- a/packages/visualgst/GtkMainWindow.st +++ /dev/null @@ -1,311 +0,0 @@ -"====================================================================== -| -| GtkMainWindow class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -Smalltalk.Object subclass: GtkMainWindow [ - | window container menuBar toolBar centralWidget statusBar accelGroup | - - GtkMainWindow class >> open [ - - - ^ (self new) - initialize; - showAll; - postInitialize; - yourself - ] - - GtkMainWindow class >> openSized: aPoint [ - - - ^ (self new) - initialize; - resize: aPoint; - showAll; - postInitialize; - yourself - ] - - centralWidget [ - - - ^ centralWidget - ] - - centralWidget: aGtkWidget [ - - - centralWidget := aGtkWidget - ] - - container [ - - - ^ container ifNil: [ container := GTK.GtkVBox new: false spacing: 0 ] - ] - - accelGroup [ - - - ^ accelGroup ifNil: [ accelGroup := GTK.GtkAccelGroup new ] - ] - - menuBar [ - - - ^ menuBar ifNil: [ menuBar := GTK.GtkMenuBar new ] - ] - - menuBar: aGtkMenuBar [ - - - menuBar := aGtkMenuBar - ] - - statusBar [ - - - ^ statusBar ifNil: [ statusBar := GTK.GtkStatusbar new ] - ] - - statusBar: aGtkStatusBar [ - - - statusBar := aGtkStatusBar - ] - - title [ - - - ^ window title - ] - - title: aString [ - - - window setTitle: aString - ] - - toolBar [ - - - ^ toolBar ifNil: [ toolBar := GTK.GtkToolbar new ] - ] - - toolBar: aGtkToolBar [ - - - toolBar := aGtkToolBar - ] - - aboutGst [ - - - (GTK.GtkAboutDialog new) - setProgramName: 'GNU Smalltalk'; - setVersion: (Smalltalk version =~ 'version (.*)' at: 1); - setLicense: 'GNU Smalltalk is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later version. - -GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU Smalltalk; see the file COPYING. If not, write to the Free Software -Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -Please consult the GNU Smalltalk source code for additional permissions -that are specific to this version of GNU Smalltalk.'; - setWebsite: 'http://smalltalk.gnu.org/'; - showModalDestroy - ] - - close [ - - - window hideAll - ] - - initialize [ - - - window := GTK.GtkWindow new: GTK.Gtk gtkWindowToplevel. - window addAccelGroup: self accelGroup. - self - title: self windowTitle; - createMenus; - createToolbar; - createStatusBar; - centralWidget: self buildCentralWidget. - ] - - buildCentralWidget [ - - ^nil - ] - - createStatusBar [ - - - self statusMessage: self windowTitle - ] - - windowTitle [ - - ^self class name - ] - - createToolbar [ - - ] - - createMenus [ - - ] - - postInitialize [ - - - window - connectSignal: 'delete-event' to: self selector: #'onDelete:event:' - ] - - onDelete: aGtkWidget event: aGdkEvent [ - - - window hideAll. - ^ true - ] - - addMenuItem: aString [ - - - self menuBar append: (GTK.GtkMenuItem newWithLabel: aString) - ] - - addMenuItem: aString withSubmenu: aGtkMenuItemArray [ - - - self menuBar append: - ((GTK.GtkMenuItem newWithLabel: aString) - setSubmenu: (self createNewMenuEntry: aGtkMenuItemArray)) - ] - - createMainMenu: anArray [ - - - anArray do: [ :each | - self addMenuItem: each first withSubmenu: (self perform: each second) ] - ] - - createNewMenuEntry: anArray [ - - - | menu | - menu := (GTK.GtkMenu new) - setAccelGroup: self accelGroup; - yourself. - anArray do: [ :each | - menu append: each ]. - ^ menu - ] - - statusMessage: aString [ - - - self statusBar - push: 0 text: aString - ] - - appendSeparator [ - - - self appendToolItem: GTK.GtkSeparatorToolItem new - ] - - appendToolItem: aGtkToolItem [ - - - self toolBar insert: aGtkToolItem pos: -1 - ] - - appendWidget: aGtkWidget [ - - - self appendToolItem: ((GTK.GtkToolItem new) add: aGtkWidget) - ] - - resize: aPoint [ - - - window resize: aPoint x height: aPoint y - ] - - showAll [ - {menuBar->false. toolBar->false. centralWidget->true. statusBar->false} do: [ :each | - each key ifNotNil: [ self container - packStart: each key expand: each value fill: true padding: 0 ] ]. - - window - add: self container; - showAll - ] - - focusedWidget [ - - - self subclassResponsibility - ] - - onFocusPerform: aSymbol [ - - - | widget | - widget := self focusedWidget. - widget isNil ifTrue: [ ^ self ]. - ^ widget perform: aSymbol - ] - - onFocusPerform: aSymbol with: anObject [ - - - | widget | - widget := self focusedWidget. - widget isNil ifTrue: [ ^ self ]. - ^ widget perform: aSymbol with: anObject - ] -] diff --git a/packages/visualgst/GtkMethodSUnitWidget.st b/packages/visualgst/GtkMethodSUnitWidget.st deleted file mode 100644 index a3d6a38..0000000 --- a/packages/visualgst/GtkMethodSUnitWidget.st +++ /dev/null @@ -1,51 +0,0 @@ -"====================================================================== -| -| GtkMethodSUnitWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkMethodWidget subclass: GtkMethodSUnitWidget [ - - category: aString [ - - - category := aString. - self classOrMeta methodDictionary ifNil: [ - model clear. - ^ self]. - model - item: ((self classOrMeta methodDictionary select: [ :each | self category = '*' or: [ each methodCategory = self category and: [ each selector matchRegex: 'test' from: 1 to: 4 ] ] ]) - asArray sort: [ :a :b | a selector <= b selector ]); - refresh - ] -] - diff --git a/packages/visualgst/GtkNotebookWidget.st b/packages/visualgst/GtkNotebookWidget.st deleted file mode 100644 index cb280b5..0000000 --- a/packages/visualgst/GtkNotebookWidget.st +++ /dev/null @@ -1,187 +0,0 @@ -"====================================================================== -| -| GtkNotebookWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkConcreteWidget subclass: GtkNotebookWidget [ - | currentWidget selectMessage notebook pages labels | - - initialize [ - - - labels := OrderedCollection new. - pages := OrderedCollection new. - self mainWidget: self buildNotebookWidget - ] - - buildNotebookWidget [ - - - ^ notebook := GTK.GtkNotebook new - connectSignal: 'switch-page' - to: self - selector: #'switchPageOn:page:number:' - userData: nil; - setShowTabs: false; - yourself - ] - - whenSelectionChangedSend: aSymbol to: anObject [ - selectMessage := DirectedMessage receiver: anObject selector: aSymbol arguments: #() - ] - - addWidget: aWidget labeled: aString [ - - - self addWidget: aWidget labelWidget: (self buildLabelWidget: aString withIcon: GTK.Gtk gtkStockClose at: aWidget) - ] - - - updateWidget: aWidget withLabel: aString [ - - - notebook setTabLabel: aWidget mainWidget tabLabel: (self buildLabelWidget: aString withIcon: GTK.Gtk gtkStockClose at: aWidget) - ] - - addPermanentWidget: aWidget labeled: aString [ - - - self addWidget: aWidget labelWidget: (labels add: (GTK.GtkLabel new: aString)) - ] - - addWidget: aWidget labelWidget: aLabelWidget [ - - - currentWidget ifNil: [ currentWidget := aWidget ]. - pages addLast: aWidget. - notebook - appendPage: aWidget mainWidget tabLabel: aLabelWidget. - pages size > 1 ifTrue: [ notebook setShowTabs: true ] - ] - - buildLabelWidget: aString withIcon: aStockString at: aSmallInteger [ - - - | image close | - image := GTK.GtkImage newFromStock: aStockString size: GTK.Gtk gtkIconSizeMenu. - close := (GTK.GtkButton new) - setImage: image; - setRelief: GTK.Gtk gtkReliefNone; - connectSignal: 'pressed' to: self selector: #'closeIt:at:' userData: aSmallInteger; - yourself. - ^ (GTK.GtkHBox new: false spacing: 0) - add: (labels add: (GTK.GtkLabel new: aString)); - add: close; - showAll; - yourself - ] - - switchPageOn: aGtkNotebook page: aGtkNotebookPage number: anInteger [ - - - currentWidget := pages at: anInteger + 1. - selectMessage ifNotNil: [ selectMessage send ] - ] - - closeIt: aGtkButton at: aGtkConcreteWidget [ - - - | pageNb | - pageNb := notebook pageNum: aGtkConcreteWidget mainWidget. - aGtkConcreteWidget close. - pages removeAtIndex: pageNb + 1. - labels removeAtIndex: pageNb + 1. - notebook removePage: pageNb. - pages size = 1 ifTrue: [ notebook setShowTabs: false ] - ] - - widgetAt: anInteger [ - - - ^ pages at: anInteger - ] - - currentWidget [ - - - ^ currentWidget - ] - - focusedWidget [ - - - ^ currentWidget focusedWidget - ] - - currentPage [ - - - ^ notebook getCurrentPage - ] - - currentPage: aSmallInteger [ - - - notebook setCurrentPage: aSmallInteger - ] - - showLastPage [ - - - self currentPage: self numberOfPages - 1 - ] - - numberOfPages [ - - - ^ notebook getNPages - ] - - closeCurrentPage [ - - - self numberOfPages = 1 ifTrue: [ ^ self ]. - pages removeAtIndex: self currentPage + 1. - labels removeAtIndex: self currentPage + 1. - notebook removePage: self currentPage. - pages size = 1 ifTrue: [ notebook setShowTabs: false ] - ] - - showPane [ - - - notebook showAll. - pages do: [ :each | each postInitialize ] - ] -] - diff --git a/packages/visualgst/GtkScrollTreeWidget.st b/packages/visualgst/GtkScrollTreeWidget.st deleted file mode 100644 index 2bd9c4a..0000000 --- a/packages/visualgst/GtkScrollTreeWidget.st +++ /dev/null @@ -1,83 +0,0 @@ -"====================================================================== -| -| GtkScrollTreeWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkConcreteWidget subclass: GtkScrollTreeWidget [ - - GtkScrollTreeWidget class >> createListWithModel: anObject [ - - - ^ self basicNew - treeView: (GTK.GtkTreeView createListWithModel: anObject); - initialize; - yourself - ] - - GtkScrollTreeWidget class >> createTreeWithModel: anObject [ - - - ^ self basicNew - treeView: (GTK.GtkTreeView createTreeWithModel: anObject); - initialize; - yourself - ] - - | treeView | - - initialize [ - - - popupMenu := [ :value | ]. - self buildTreeView. - self mainWidget: (GTK.GtkScrolledWindow withChild: self treeView) - ] - - buildTreeView [ - - - ] - - treeView: aGtkTreeView [ - - - treeView := aGtkTreeView. - ] - - treeView [ - - - ^ treeView - ] -] - diff --git a/packages/visualgst/GtkSidebarWidget.st b/packages/visualgst/GtkSidebarWidget.st deleted file mode 100644 index 86e3592..0000000 --- a/packages/visualgst/GtkSidebarWidget.st +++ /dev/null @@ -1,130 +0,0 @@ -"====================================================================== -| -| GtkSidebarWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkConcreteWidget subclass: GtkSidebarWidget [ - | activeWidget widgets widgetEvents paned | - - initialize [ - - - paned := GTK.GtkNotebook new - setTabPos: GTK.Gtk gtkPosBottom; - connectSignal: 'switch-page' to: self selector: #'switchPageOn:page:number:'; - yourself. - self mainWidget: paned. - widgetEvents := Dictionary new. - widgets := OrderedCollection new - ] - - postInitialize [ - - - self hideAll - ] - - add: aGtkWidget labeled: aString [ - - - paned - appendPage: aGtkWidget tabLabel: (GTK.GtkLabel new: aString). - widgets add: aGtkWidget - ] - - addAll: anArray [ - - - anArray do: [ :each | self add: each key labeled: each value ] - ] - - show: anIndex [ - - - activeWidget ifNotNil: [ :aWidget | aWidget hideAll ]. - self mainWidget showAll. - self mainWidget setCurrentPage: anIndex - 1. - activeWidget := (widgets at: anIndex) - showAll; - yourself - ] - - showAll [ - - - self mainWidget show - ] - - hideTabs [ - - - self mainWidget setShowTabs: false - ] - - hide [ - - - self hideMainPained - ] - - hideAll [ - - - self hideMainPained - ] - - hideMainPained [ - - - self mainWidget hideAll - ] - - panedOrientation [ - - - ^ self subclassResponsibility - ] - - switchPageOn: aGtkNotebook page: aGtkNotebookPage number: anInteger [ - - - widgetEvents at: (aGtkNotebook getNthPage: anInteger) ifPresent: [ :msg | msg value ] - ] - - whenWidgetIsVisible: aGtkWidget send: aSymbol to: anObject [ - - - widgetEvents at: aGtkWidget put: (DirectedMessage receiver: anObject selector: aSymbol arguments: #()) - ] -] - diff --git a/packages/visualgst/GtkTranscriptWidget.st b/packages/visualgst/GtkTranscriptWidget.st index d724e07..65a308b 100644 --- a/packages/visualgst/GtkTranscriptWidget.st +++ b/packages/visualgst/GtkTranscriptWidget.st @@ -38,7 +38,7 @@ GtkWorkspaceWidget subclass: GtkTranscriptWidget [ initialize [ - Transcript message: self->#update:. + "Transcript message: self->#update:." super initialize ] diff --git a/packages/visualgst/GtkTreeModel.st b/packages/visualgst/GtkTreeModel.st deleted file mode 100644 index 7734f09..0000000 --- a/packages/visualgst/GtkTreeModel.st +++ /dev/null @@ -1,176 +0,0 @@ -"====================================================================== -| -| GtkTreeModel class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -Object subclass: GtkTreeModel [ - - GtkTreeModel class >> on: aGtkTreeStore [ - - - ^ super new - initialize; - gtkModel: aGtkTreeStore; - yourself - ] - - | childrenBlock contentsBlock item model | - - initialize [ - - - ] - - gtkModel: aGtkTreeStore [ - - - model := aGtkTreeStore - ] - - connectSignal: aString to: anObject selector: aSymbol [ - - - ^ model connectSignal: aString to: anObject selector: aSymbol - ] - - item: anObject [ - - - item := anObject - ] - - item [ - - - ^ item - ] - - childrenBlock: aBlock [ - - - childrenBlock := aBlock - ] - - childrenBlock [ - - - ^ childrenBlock - ] - - contentsBlock: aBlock [ - - - contentsBlock := aBlock - ] - - contentsBlock [ - - - ^ contentsBlock - ] - - append: anObject [ - - - self append: anObject with: nil - ] - - append: anObject parent: aParentObject [ - - - self append: anObject with: (self findIter: aParentObject) - ] - - append: anItem with: aParentIter [ - - - | iter | - iter := model append: aParentIter item: ((self contentsBlock value: anItem) copyWith: anItem). - (self childrenBlock value: anItem) do: [ :each | self append: each with: iter ] - ] - - remove: anObject ifAbsent: aBlock [ - - - | iter | - iter := self findIter: anObject ifAbsent: [ ^ aBlock value ]. - model remove: iter - ] - - remove: anObject [ - - - self remove: anObject ifAbsent: [ self error: 'item not found' ] - ] - - clear [ - - - model clear - ] - - refresh [ - - - self clear. - self item ifNil: [ ^ self ]. - (self childrenBlock value: self item) do: [ :each | self append: each with: nil ] - ] - - hasItem: anObject [ - - - self findIter: anObject ifAbsent: [ ^ false ]. - ^ true - ] - - findIter: anObject ifAbsent: aBlock [ - - - model do: [ :elem :iter | - elem last = anObject ifTrue: [ ^ iter ] ]. - aBlock value - ] - - findIter: anObject [ - - - ^ self findIter: anObject ifAbsent: [ self error: 'Item not found' ] - ] - - includes: anObject [ - self findIter: anObject ifAbsent: [ ^ false ]. - ^ true - ] -] - diff --git a/packages/visualgst/GtkVSidebarWidget.st b/packages/visualgst/GtkVSidebarWidget.st deleted file mode 100644 index f633039..0000000 --- a/packages/visualgst/GtkVSidebarWidget.st +++ /dev/null @@ -1,42 +0,0 @@ -"====================================================================== -| -| GtkVSidebarWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkSidebarWidget subclass: GtkVSidebarWidget [ - - panedOrientation [ - ^ GTK.GtkVPaned - ] -] - diff --git a/packages/visualgst/GtkVariableTrackerWidget.st b/packages/visualgst/GtkVariableTrackerWidget.st index 52e8642..6b295fe 100644 --- a/packages/visualgst/GtkVariableTrackerWidget.st +++ b/packages/visualgst/GtkVariableTrackerWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkVariableTrackerWidget [ - | model object widget | +Compoment subclass: GtkVariableTrackerWidget [ + + | object | GtkVariableTrackerWidget class >> on: anObject [ ^ self new - initialize; object: anObject; yourself ] @@ -48,7 +48,7 @@ GtkConcreteWidget subclass: GtkVariableTrackerWidget [ initialize [ - self mainWidget: self buildListView + self buildListView. ] object: anObject [ @@ -61,18 +61,15 @@ GtkConcreteWidget subclass: GtkVariableTrackerWidget [ buildListView [ - widget := GtkScrollTreeWidget createListWithModel: {{GtkColumnTextType title: 'Variable'}. {GtkColumnTextType title: 'Value'}}. - widget connectToWhenPopupMenu: (WorkspaceVariableMenus on: self). - widget treeView getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkListModel on: widget treeView getModel) - contentsBlock: [ :each | {each asString. (object instVarNamed: each) displayString} ]. - ^ widget mainWidget + self widget: (List column: {{GtkColumnTextType title: 'Variable'}. {GtkColumnTextType title: 'Value'}} contents: [ :each | {each asString. (object instVarNamed: each) displayString} ]). + widget popupMenu: (WorkspaceVariableMenus on: self). + widget singleSelection. ] refresh [ - model + widget item: object class allInstVarNames; refresh ] @@ -83,16 +80,16 @@ GtkConcreteWidget subclass: GtkVariableTrackerWidget [ ^ object instVarNamed: self selectedValue ] - hasSelectedValue [ + hasSelection [ - ^widget treeView hasSelectedValue + ^ widget hasSelection ] selectedValue [ - ^widget treeView selection + ^ widget selection ] inspectIt: anObject [ @@ -105,10 +102,10 @@ GtkConcreteWidget subclass: GtkVariableTrackerWidget [ | ivar | - widget treeView hasSelectedValue ifFalse: [ ^ self ]. + widget hasSelection ifFalse: [ ^ self ]. ivar := self selectedValue. - model remove: ivar. object class removeInstVarName: ivar. + widget refresh ] ] diff --git a/packages/visualgst/GtkVisualGSTTool.st b/packages/visualgst/GtkVisualGSTTool.st index fa85181..17c6e5f 100644 --- a/packages/visualgst/GtkVisualGSTTool.st +++ b/packages/visualgst/GtkVisualGSTTool.st @@ -33,7 +33,7 @@ | ======================================================================" -GtkMainWindow subclass: GtkVisualGSTTool [ +Window subclass: GtkVisualGSTTool [ GtkVisualGSTTool class >> version [ diff --git a/packages/visualgst/GtkWorkspaceWidget.st b/packages/visualgst/GtkWorkspaceWidget.st index fa55a3f..6729eca 100644 --- a/packages/visualgst/GtkWorkspaceWidget.st +++ b/packages/visualgst/GtkWorkspaceWidget.st @@ -58,10 +58,13 @@ GtkTextWidget subclass: GtkWorkspaceWidget [ buildWidget [ - ^ (GTK.GtkHPaned new) - add1: (variableWidget := GtkVariableTrackerWidget on: object) mainWidget; - add2: super buildWidget; - yourself + | root | + super buildWidget. + root := child. + child := GTK.GtkHPaned new. + child + add1: (variableWidget := GtkVariableTrackerWidget on: object) mainWidget; + add2: root ] object: anObject [ @@ -120,7 +123,7 @@ GtkTextWidget subclass: GtkWorkspaceWidget [ showIVar [ - variableWidget mainWidget getVisible + variableWidget isVisible ifFalse: [ variableWidget showAll ] ifTrue: [ variableWidget hideAll ]. ] diff --git a/packages/visualgst/Image/GtkImageWidget.st b/packages/visualgst/Image/GtkImageWidget.st index 506752d..15c8782 100644 --- a/packages/visualgst/Image/GtkImageWidget.st +++ b/packages/visualgst/Image/GtkImageWidget.st @@ -33,55 +33,50 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkImageWidget [ - - | imageTree image model searchEntry | +Compoment subclass: GtkImageWidget [ + | imageTree image searchEntry | initialize [ - self mainWidget: self buildMainWidget + self buildMainWidget ] buildMainWidget [ - ^ GTK.GtkVPaned new - add1: self buildFinderEntry; - add2: self buildClassAndMethodList; - yourself + self widget: + (VBox new + add: self buildFinderEntry; + add: self buildClassAndMethodList expand: true) ] buildFinderEntry [ - searchEntry := GTK.GtkEntry new - connectSignal: 'activate' to: self selector: #searchValidate; + searchEntry := Entry new + whenTextChangedSend: #searchValidate to: self; yourself. - ^ (GTK.GtkHBox new: true spacing: 3) - add: (GTK.GtkLabel new: 'Class or method :'); - add: searchEntry; - yourself + ^ HBox new + add: (Label text: 'Class or method :'); + add: searchEntry expand: true ] buildClassAndMethodList [ - imageTree := (GTK.GtkTreeView createListWithModel: {{GtkColumnTextType title: 'Methods and Classes'}}). - imageTree setSearchEntry: searchEntry. - [ (model := GtkListModel on: imageTree getModel) - item: (image := GtkImage new); - contentsBlock: [ :each | {each displayString} ]; - refresh ] fork. - ^ GTK.GtkScrolledWindow withChild: imageTree + imageTree := List column: {{GtkColumnTextType title: 'Methods and Classes'}} contents: [ :each | {each displayString} ]. + [ imageTree + item: (image := GtkImage new); + refresh ] fork. + ^ imageTree ] whenSelectionChangedSend: aSelector to: anObject [ - imageTree getSelection - connectSignal: 'changed' to: anObject selector: aSelector + imageTree whenSelectionChangedSend: aSelector to: anObject ] whenTextChangedSend: aSelector to: anObject [ @@ -99,22 +94,22 @@ GtkConcreteWidget subclass: GtkImageWidget [ text [ - ^ searchEntry getText + ^ searchEntry text ] searchValidate [ - searchEntry getText isEmpty - ifTrue: [ model item: image ] - ifFalse: [ model item: (image matchRegex: searchEntry getText) ]. - model refresh + searchEntry text isEmpty + ifTrue: [ imageTree item: image ] + ifFalse: [ imageTree item: (image matchRegex: searchEntry text) ]. + imageTree refresh ] hasSelection [ - ^ imageTree hasSelectedItem + ^ imageTree hasSelection ] selection [ diff --git a/packages/visualgst/Implementors/GtkImageResultsWidget.st b/packages/visualgst/Implementors/GtkImageResultsWidget.st index 986904c..c8ac273 100644 --- a/packages/visualgst/Implementors/GtkImageResultsWidget.st +++ b/packages/visualgst/Implementors/GtkImageResultsWidget.st @@ -33,49 +33,46 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkImageResultsWidget [ - | result resultTree model | +Compoment subclass: GtkImageResultsWidget [ + + | result | initialize [ - self mainWidget: self buildTreeView + self buildTreeView ] buildTreeView [ - resultTree := GTK.GtkTreeView createListWithModel: {{GtkColumnTextType title: 'Methods and Classes'}}. - resultTree getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkListModel on: resultTree getModel) - contentsBlock: [ :each | {each asString} ]. - ^ GTK.GtkScrolledWindow withChild: resultTree + self widget: (List column: {{GtkColumnTextType title: 'Methods and Classes'}} contents: [ :each | {each asString} ]). + widget singleSelection. ] whenSelectionChangedSend: aSelector to: anObject [ - resultTree getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] clear [ - model clear + widget clear ] hasSelectedResult [ - ^ resultTree hasSelectedItem + ^ widget hasSelection ] selectedResult [ self hasSelectedResult ifFalse: [ ^ self error: 'nothing is selected' ]. - ^ resultTree selection + ^ widget selection ] appendResults: aDictionary [ diff --git a/packages/visualgst/Implementors/GtkImplementorResultsWidget.st b/packages/visualgst/Implementors/GtkImplementorResultsWidget.st index dfc3883..8f1cd39 100644 --- a/packages/visualgst/Implementors/GtkImplementorResultsWidget.st +++ b/packages/visualgst/Implementors/GtkImplementorResultsWidget.st @@ -38,16 +38,16 @@ GtkImageResultsWidget subclass: GtkImplementorResultsWidget [ buildTreeView [ - | widget | - widget := super buildTreeView. - model contentsBlock: [ :each | {each key asString} ]. - ^ widget + super buildTreeView. + widget contents: [ :each | {each key asString} ]. ] appendImplementorResults: aDictionary [ self clear. - aDictionary associationsDo: [ :each | model append: each ] + widget + item: aDictionary associations; + refresh ] selectedResult: aBrowser [ @@ -55,6 +55,5 @@ GtkImageResultsWidget subclass: GtkImplementorResultsWidget [ self hasSelectedResult ifFalse: [ ^ self ]. self selectedResult value updateBrowser: aBrowser ] - ] diff --git a/packages/visualgst/Implementors/GtkSenderResultsWidget.st b/packages/visualgst/Implementors/GtkSenderResultsWidget.st index 41d817f..b081c96 100644 --- a/packages/visualgst/Implementors/GtkSenderResultsWidget.st +++ b/packages/visualgst/Implementors/GtkSenderResultsWidget.st @@ -55,10 +55,8 @@ GtkImageResultsWidget subclass: GtkSenderResultsWidget [ buildTreeView [ - | widget | - widget := super buildTreeView. - model contentsBlock: [ :each | {each displayString} ]. - ^ widget + super buildTreeView. + widget contents: [ :each | {each displayString} ]. ] appendSenderResults: aDictionary [ @@ -77,8 +75,9 @@ GtkImageResultsWidget subclass: GtkSenderResultsWidget [ findInMethod: anObject [ - (self literalsAndSpecialSelectors at: anObject displaySymbol ifAbsent: [ #() ] ) do: [ :each | - model append: each ]. + widget + item: (self literalsAndSpecialSelectors at: anObject displaySymbol ifAbsent: [ #() ] ) asArray; + refresh ] selectedResult: aBrowser [ diff --git a/packages/visualgst/Inspector/GtkCharacterInspectorView.st b/packages/visualgst/Inspector/GtkCharacterInspectorView.st deleted file mode 100644 index cc313e9..0000000 --- a/packages/visualgst/Inspector/GtkCharacterInspectorView.st +++ /dev/null @@ -1,62 +0,0 @@ -"====================================================================== -| -| GtkCharacterInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkCharacterInspectorView [ - - do: aBlock [ - super do: aBlock. - #('hexadecimal' 'octal' 'binary') do: aBlock - ] - - selectedValue: aString [ - - - | base | - base := 0. - aString = 'hexadecimal' ifTrue: [ base := 16 ]. - aString = 'octal' ifTrue: [ base := 8 ]. - aString = 'binary' ifTrue: [ base := 2 ]. - ^ base = 0 - ifTrue: [ super selectedValue: aString ] - ifFalse: [ self object asInteger printString: base ] - ] - - canDive [ - - - ^ false - ] -] - diff --git a/packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st b/packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st deleted file mode 100644 index 2cee85c..0000000 --- a/packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st +++ /dev/null @@ -1,124 +0,0 @@ -"====================================================================== -| -| GtkCompiledBlockINspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkCompiledBlockInspectorView [ - - GtkCompiledBlockInspectorView class [ | fields | ] - - GtkCompiledBlockInspectorView class >> fields [ - - - ^ fields ifNil: [ fields := Dictionary from: {'clean-ness flags'->#flags. - 'Number Of Arguments'->#arguments. - 'Number Of Temporaries'->#temporaries. - 'Number Of Literals'->#numLiterals. - 'Needed Stack Slots'->#stack. - 'Byte Codes'->#byte. - 'Source Code'->#source} ] - ] - - do: aBlock [ - - - super do: aBlock. - self class fields keys do: aBlock - ] - - selectedValue: anObject [ - - - ^ (self class fields includesKey: anObject) - ifFalse: [ super selectedValue: anObject ] - ifTrue: [ self perform: (self class fields at: anObject) ] - ] - - flags [ - - - ^ self object flags - ] - - arguments [ - - - ^ self object numArgs - ] - - temporaries [ - - - ^ self object numTemps - ] - - numLiterals [ - - - ^ self object numLiterals - ] - - stack [ - - - ^ self object stackDepth - ] - - literals [ - - - | stream | - stream := WriteStream on: String new. - 1 to: self numLiterals do: [ :i | - self object bytecodeIndex: i with: stream. - stream tab. - stream print: (self object literalAt: i) ]. - ^ stream contents - ] - - byte [ - - - | stream | - stream := WriteStream on: String new. - self object numBytecodes > 0 ifTrue: [ self object printByteCodesOn: stream ]. - ^ stream contents - ] - - source [ - - - ^ self object methodSourceString - ] -] - diff --git a/packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st b/packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st deleted file mode 100644 index acfaefd..0000000 --- a/packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st +++ /dev/null @@ -1,133 +0,0 @@ -"====================================================================== -| -| GtkCompiledMethodInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkCompiledMethodInspectorView [ - - GtkCompiledMethodInspectorView class [ | fields | ] - - GtkCompiledMethodInspectorView class >> fields [ - - - ^ fields ifNil: [ fields := Dictionary from: {'Flags'->#flags. - 'Primitive Index'->#primitive. - 'Number Of Arguments'->#arguments. - 'Number Of Temporaries'->#temporaries. - 'Number Of Literals'->#numLiterals. - 'Needed Stack Slots'->#stack. - 'Literals'->#literals. - 'Byte Codes'->#byte. - 'Source Code'->#source} ] - ] - - do: aBlock [ - - - super do: aBlock. - self class fields keys do: aBlock - ] - - selectedValue: anObject [ - - - ^ (self class fields includesKey: anObject) - ifFalse: [ super selectedValue: anObject ] - ifTrue: [ self perform: (self class fields at: anObject) ] - ] - - flags [ - - - ^ self object flags - ] - - primitive [ - - - self object flags = 4 ifTrue: [ VMPrimitives keyAtValue: self object primitive ifAbsent: [ 'unknown' ] ]. - ^ self object primitive - ] - - arguments [ - - - ^ self object numArgs - ] - - temporaries [ - - - ^ self object numTemps - ] - - numLiterals [ - - - ^ self object numLiterals - ] - - stack [ - - - ^ self object stackDepth - ] - - literals [ - - - | stream | - stream := WriteStream on: String new. - 1 to: self numLiterals do: [ :i | - self object bytecodeIndex: i with: stream. - stream tab. - stream print: (self object literalAt: i) ]. - ^ stream contents - ] - - byte [ - - - | stream | - stream := WriteStream on: String new. - self object numBytecodes > 0 ifTrue: [ self object printByteCodesOn: stream ]. - ^ stream contents - ] - - source [ - - - ^ self object methodSourceString - ] -] - diff --git a/packages/visualgst/Inspector/GtkContextInspectorView.st b/packages/visualgst/Inspector/GtkContextInspectorView.st deleted file mode 100644 index 46ab341..0000000 --- a/packages/visualgst/Inspector/GtkContextInspectorView.st +++ /dev/null @@ -1,58 +0,0 @@ -"====================================================================== -| -| GtkContextInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkContextInspectorView [ - - | args temps | - - do: aBlock [ - - - args := IdentitySet new. - temps := IdentitySet new. - super do: aBlock. - self object method arguments do: [ :each | aBlock value: (args add: each asString) ]. - self object method temporaries do: [ :each | aBlock value: (temps add: each asString) ]. - ] - - selectedValue: aString [ - - - ((args includes: aString) not and: [ (temps includes: aString) not ]) ifTrue: [ ^ super selectedValue: aString ]. - (args includes: aString) ifTrue: [ ^ (self object at: (self object method arguments indexOf: aString asSymbol)) displayString ]. - ^ (self object at: self object numArgs + (self object method temporaries indexOf: aString asSymbol)) displayString. - ] -] - diff --git a/packages/visualgst/Inspector/GtkDictionaryInspectorView.st b/packages/visualgst/Inspector/GtkDictionaryInspectorView.st deleted file mode 100644 index 89d7a57..0000000 --- a/packages/visualgst/Inspector/GtkDictionaryInspectorView.st +++ /dev/null @@ -1,53 +0,0 @@ -"====================================================================== -| -| GtkDictionaryInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkDictionaryInspectorView [ - - do: aBlock [ - - - super do: aBlock. - self object keys do: aBlock - ] - - selectedValue: anObject [ - - - ^ (self object includesKey: anObject) - ifFalse: [ super selectedValue: anObject ] - ifTrue: [ self object at: anObject ] - ] -] - diff --git a/packages/visualgst/Inspector/GtkFloatInspectorView.st b/packages/visualgst/Inspector/GtkFloatInspectorView.st deleted file mode 100644 index 5b36ce0..0000000 --- a/packages/visualgst/Inspector/GtkFloatInspectorView.st +++ /dev/null @@ -1,51 +0,0 @@ -"====================================================================== -| -| GtkFloatInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkFloatInspectorView [ - - do: aBlock [ - super do: aBlock. - 1 to: self object size do: [ :each | aBlock value: each ] - ] - - selectedValue: aString [ - - - ^ aString asNumber = 0 - ifTrue: [ super onVariableChanged ] - ifFalse: [ self object at: aString asNumber ] - ] -] - diff --git a/packages/visualgst/Inspector/GtkInspector.st b/packages/visualgst/Inspector/GtkInspector.st index b223372..3d864cc 100644 --- a/packages/visualgst/Inspector/GtkInspector.st +++ b/packages/visualgst/Inspector/GtkInspector.st @@ -86,25 +86,18 @@ GtkBrowsingTool subclass: GtkInspector [ buildCentralWidget [ - | trWidget wkWidget | - notebookWidget := GTK.GtkNotebook new. - trWidget := self buildInspectorView. - wkWidget := self buildBrowserWidget mainWidget. + notebookWidget := Notebook new. ^ notebookWidget - appendPage: trWidget tabLabel: (GTK.GtkLabel new: 'Basic'); - appendPage: wkWidget tabLabel: (GTK.GtkLabel new: 'Methods'); - showAll; - setCurrentPage: 0; - yourself + addPermanentWidget: self buildInspectorView label: 'Basic'; + addPermanentWidget: self buildBrowserWidget label: 'Methods'; + currentPage: 0; + yourself ] buildInspectorView [ - ^ GTK.GtkVPaned new - pack1: self buildInspectorWidget mainWidget resize: true shrink: false; - pack2: self buildWorkspaceWidget mainWidget resize: false shrink: true; - yourself + ^ VPaned with: self buildInspectorWidget with: self buildWorkspaceWidget ] buildInspectorWidget [ @@ -112,9 +105,7 @@ GtkBrowsingTool subclass: GtkInspector [ ^ inspectorWidget := (GtkInspectorWidget new) parentWindow: window; - initialize; inspector: self; - showAll; yourself ] @@ -123,8 +114,6 @@ GtkBrowsingTool subclass: GtkInspector [ ^ workspaceWidget := (GtkInspectorSourceWidget new) parentWindow: window; - initialize; - showAll; yourself ] @@ -133,8 +122,6 @@ GtkBrowsingTool subclass: GtkInspector [ ^ browserWidget := (GtkInspectorBrowserWidget new) parentWindow: window; - initialize; - showAll; yourself ] @@ -151,7 +138,7 @@ GtkBrowsingTool subclass: GtkInspector [ focusedWidget [ - ^notebookWidget getCurrentPage = 0 + ^ notebookWidget currentPage = 0 ifTrue: [ workspaceWidget focusedWidget ] ifFalse: [ browserWidget focusedWidget ] ] @@ -286,7 +273,7 @@ GtkBrowsingTool subclass: GtkInspector [ browserHasFocus [ - ^notebookWidget getCurrentPage = 1 + ^ notebookWidget currentPage = 1 ] sourceCodeWidgetHasFocus [ diff --git a/packages/visualgst/Inspector/GtkInspectorBrowserWidget.st b/packages/visualgst/Inspector/GtkInspectorBrowserWidget.st index 599cee3..98eb66a 100644 --- a/packages/visualgst/Inspector/GtkInspectorBrowserWidget.st +++ b/packages/visualgst/Inspector/GtkInspectorBrowserWidget.st @@ -33,7 +33,8 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkInspectorBrowserWidget [ +Compoment subclass: GtkInspectorBrowserWidget [ + | checkCode namespaceWidget classHierarchyWidget classHierarchyUpdate iCategoryWidget iMethodWidget cCategoryWidget cMethodWidget codeWidget state | GtkInspectorBrowserWidget class >> title [ @@ -50,69 +51,59 @@ GtkConcreteWidget subclass: GtkInspectorBrowserWidget [ buildBrowser [ - ^ GTK.GtkHPaned addAll: {self buildHierarchy. self buildProtocolAndMethod} + ^ HPaned addAll: {self buildHierarchy. self buildProtocolAndMethod} ] buildClassBrowser [ - ^ GTK.GtkHPaned addAll: {self buildClassMethodView} + ^ HPaned addAll: {self buildClassMethodView} ] buildInstanceBrowser [ - ^ GTK.GtkHPaned addAll: {self buildInstanceMethodView} + ^ HPaned addAll: {self buildInstanceMethodView} ] buildProtocolAndMethod [ - ^ (GTK.GtkNotebook new) - appendPage: self buildInstanceBrowser tabLabel: (GTK.GtkLabel new: 'Instance'); - appendPage: self buildClassBrowser tabLabel: (GTK.GtkLabel new: 'Class'); - showAll; - setCurrentPage: 0; - connectSignal: 'switch-page' to: self selector: #'classInstanceSwitchOn:page:number:' userData: nil; + ^ Notebook new + addPermanentWidget: self buildInstanceBrowser label: 'Instance'; + addPermanentWidget: self buildClassBrowser label: 'Class'; + currentPage: 0; + "connectSignal: 'switch-page' to: self selector: #'classInstanceSwitchOn:page:number:' userData: nil;" yourself ] buildCodeView [ - codeWidget := (GtkSourceCodeWidget parentWindow: self parentWindow) + ^ codeWidget := (GtkSourceCodeWidget parentWindow: self parentWindow) browser: self; - showAll; yourself. - - ^ codeWidget mainWidget ] buildHierarchy [ - classHierarchyWidget := GtkClassHierarchyWidget showAll + ^ classHierarchyWidget := GtkClassHierarchyWidget new whenSelectionChangedSend: #onClassHierarchyChanged to: self; yourself. - - ^ classHierarchyWidget mainWidget ] buildClassMethodView [ - cMethodWidget := GtkMethodWidget showAll + ^ cMethodWidget := GtkMethodWidget new whenSelectionChangedSend: #onClassSideMethodChanged to: self; yourself. - - ^ cMethodWidget mainWidget ] buildInstanceMethodView [ - iMethodWidget := GtkMethodWidget showAll + ^ iMethodWidget := GtkMethodWidget new whenSelectionChangedSend: #onInstanceSideMethodChanged to: self; yourself. - - ^ iMethodWidget mainWidget ] initialize [ @@ -121,7 +112,7 @@ GtkConcreteWidget subclass: GtkInspectorBrowserWidget [ classHierarchyUpdate := false. checkCode := true. state := NamespaceState on: self with: Smalltalk. - self mainWidget: (GTK.GtkVPaned addAll: {self buildBrowser. self buildCodeView}) + self widget: (VPaned addAll: {self buildBrowser. self buildCodeView}) ] classInstanceSwitchOn: aGtkNotebook page: aGtkNotebookPage number: aSmallInteger [ diff --git a/packages/visualgst/Inspector/GtkInspectorWidget.st b/packages/visualgst/Inspector/GtkInspectorWidget.st index 843b4bc..74f5342 100644 --- a/packages/visualgst/Inspector/GtkInspectorWidget.st +++ b/packages/visualgst/Inspector/GtkInspectorWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkInspectorWidget [ - | inspector model object inspectorTree workspaceWidget objectView stack | +Compoment subclass: GtkInspectorWidget [ + + | inspector object inspectorTree workspaceWidget objectView stack | GtkInspectorWidget >> openOn: anObject [ - ^ (super new) - initialize; + ^ self new object: anObject; yourself ] @@ -49,8 +49,8 @@ GtkConcreteWidget subclass: GtkInspectorWidget [ stack := OrderedCollection new. - self mainWidget: self buildView. - self whenSelectionChangedSend: #onVariableChanged to: self. + self buildView. + inspectorTree whenSelectionChangedSend: #onVariableChanged to: self. ] postInitialize [ @@ -78,7 +78,7 @@ GtkConcreteWidget subclass: GtkInspectorWidget [ objectView := object inspectorView openOn: anObject. workspaceWidget object: anObject. inspector isNil ifFalse: [ inspector object: anObject ]. - model + inspectorTree item: objectView; refresh ] @@ -86,11 +86,9 @@ GtkConcreteWidget subclass: GtkInspectorWidget [ buildTreeWidget [ - inspectorTree := GtkScrollTreeWidget createListWithModel: {{GtkColumnTextType title: 'Variables'}}. - inspectorTree connectToWhenPopupMenu: (InspectorMenus on: self). - (model := GtkListModel on: inspectorTree treeView getModel) - contentsBlock: [ :each | {each displayString} ]. - ^ inspectorTree mainWidget + inspectorTree := List column: {{GtkColumnTextType title: 'Variables'}} contents: [ :each | {each displayString} ]. + inspectorTree popupMenu: (InspectorMenus on: self). + ^ inspectorTree ] buildWorkspaceWidget [ @@ -105,23 +103,13 @@ GtkConcreteWidget subclass: GtkInspectorWidget [ buildView [ - ^ GTK.GtkHPaned new - pack1: self buildTreeWidget resize: true shrink: false; - pack2: self buildWorkspaceWidget mainWidget resize: true shrink: false; - yourself - ] - - whenSelectionChangedSend: aSelector to: anObject [ - - - inspectorTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector userData: nil + self widget: (HPaned with: self buildTreeWidget with: self buildWorkspaceWidget) ] hasSelectedValue [ - ^ inspectorTree treeView hasSelectedItem + ^ inspectorTree hasSelection ] onVariableChanged [ @@ -135,7 +123,7 @@ GtkConcreteWidget subclass: GtkInspectorWidget [ self hasSelectedValue ifFalse: [ self error: 'Nothing is selected' ]. - ^ inspectorTree treeView selection + ^ inspectorTree selection ] targetObject [ diff --git a/packages/visualgst/Inspector/GtkIntegerInspectorView.st b/packages/visualgst/Inspector/GtkIntegerInspectorView.st deleted file mode 100644 index f008f3f..0000000 --- a/packages/visualgst/Inspector/GtkIntegerInspectorView.st +++ /dev/null @@ -1,62 +0,0 @@ -"====================================================================== -| -| GtkInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkIntegerInspectorView [ - - do: aBlock [ - super do: aBlock. - #('hexadecimal' 'octal' 'binary') do: aBlock - ] - - selectedValue: aString [ - - - | base iter string instVar | - base := 0. - aString = 'hexadecimal' ifTrue: [ base := 16 ]. - aString = 'octal' ifTrue: [ base := 8 ]. - aString = 'binary' ifTrue: [ base := 2 ]. - ^ base = 0 - ifTrue: [ super selectedValue: aString ] - ifFalse: [ self object printString: base ] - ] - - canDive [ - - - ^ false - ] -] - diff --git a/packages/visualgst/Inspector/GtkObjectInspectorView.st b/packages/visualgst/Inspector/GtkObjectInspectorView.st deleted file mode 100644 index 1e34763..0000000 --- a/packages/visualgst/Inspector/GtkObjectInspectorView.st +++ /dev/null @@ -1,88 +0,0 @@ -"====================================================================== -| -| GtkObjectInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -Object subclass: GtkObjectInspectorView [ - | object model | - - GtkObjectInspectorView class >> openOn: anObject [ - - - ^ (super new) - object: anObject; - yourself - ] - - object [ - - - ^ object - ] - - object: anObject [ - - - object := anObject. - ] - - do: aBlock [ - - - aBlock value: 'self'. - self object class allInstVarNames do: aBlock - ] - - values [ - - - ^Array streamContents: [:s | self do: [:value | s nextPut: value]] - ] - - selectedValue: aString [ - - - | iter string instVar | - ^ aString = 'self' - ifTrue: [ self object ] - ifFalse: [ self object - instVarNamed: aString ] - ] - - canDive [ - - - ^ true - ] -] - diff --git a/packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st b/packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st deleted file mode 100644 index 9e92f05..0000000 --- a/packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st +++ /dev/null @@ -1,51 +0,0 @@ -"====================================================================== -| -| GtkSequenceableCollectionInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkSequenceableCollectionInspectorView [ - - do: aBlock [ - super do: aBlock. - 1 to: self object size do: [ :each | aBlock value: each ] - ] - - selectedValue: aString [ - - - ^ aString asNumber = 0 - ifTrue: [ super selectedValue: aString ] - ifFalse: [ self object at: aString asNumber ] - ] -] - diff --git a/packages/visualgst/Inspector/GtkSetInspectorView.st b/packages/visualgst/Inspector/GtkSetInspectorView.st deleted file mode 100644 index fdfef99..0000000 --- a/packages/visualgst/Inspector/GtkSetInspectorView.st +++ /dev/null @@ -1,53 +0,0 @@ -"====================================================================== -| -| GtkSetInspectorView class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkObjectInspectorView subclass: GtkSetInspectorView [ - - do: aBlock [ - - - super do: aBlock. - self object do: aBlock - ] - - selectedValue: anObject [ - - - ^ (self object includes: anObject) - ifFalse: [ super selectedValue: anObject ] - ifTrue: [ anObject ] - ] -] - diff --git a/packages/visualgst/Inspector/View/GtkCharacterInspectorView.st b/packages/visualgst/Inspector/View/GtkCharacterInspectorView.st new file mode 100644 index 0000000..cc313e9 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkCharacterInspectorView.st @@ -0,0 +1,62 @@ +"====================================================================== +| +| GtkCharacterInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkCharacterInspectorView [ + + do: aBlock [ + super do: aBlock. + #('hexadecimal' 'octal' 'binary') do: aBlock + ] + + selectedValue: aString [ + + + | base | + base := 0. + aString = 'hexadecimal' ifTrue: [ base := 16 ]. + aString = 'octal' ifTrue: [ base := 8 ]. + aString = 'binary' ifTrue: [ base := 2 ]. + ^ base = 0 + ifTrue: [ super selectedValue: aString ] + ifFalse: [ self object asInteger printString: base ] + ] + + canDive [ + + + ^ false + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkCompiledBlockInspectorView.st b/packages/visualgst/Inspector/View/GtkCompiledBlockInspectorView.st new file mode 100644 index 0000000..2cee85c --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkCompiledBlockInspectorView.st @@ -0,0 +1,124 @@ +"====================================================================== +| +| GtkCompiledBlockINspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkCompiledBlockInspectorView [ + + GtkCompiledBlockInspectorView class [ | fields | ] + + GtkCompiledBlockInspectorView class >> fields [ + + + ^ fields ifNil: [ fields := Dictionary from: {'clean-ness flags'->#flags. + 'Number Of Arguments'->#arguments. + 'Number Of Temporaries'->#temporaries. + 'Number Of Literals'->#numLiterals. + 'Needed Stack Slots'->#stack. + 'Byte Codes'->#byte. + 'Source Code'->#source} ] + ] + + do: aBlock [ + + + super do: aBlock. + self class fields keys do: aBlock + ] + + selectedValue: anObject [ + + + ^ (self class fields includesKey: anObject) + ifFalse: [ super selectedValue: anObject ] + ifTrue: [ self perform: (self class fields at: anObject) ] + ] + + flags [ + + + ^ self object flags + ] + + arguments [ + + + ^ self object numArgs + ] + + temporaries [ + + + ^ self object numTemps + ] + + numLiterals [ + + + ^ self object numLiterals + ] + + stack [ + + + ^ self object stackDepth + ] + + literals [ + + + | stream | + stream := WriteStream on: String new. + 1 to: self numLiterals do: [ :i | + self object bytecodeIndex: i with: stream. + stream tab. + stream print: (self object literalAt: i) ]. + ^ stream contents + ] + + byte [ + + + | stream | + stream := WriteStream on: String new. + self object numBytecodes > 0 ifTrue: [ self object printByteCodesOn: stream ]. + ^ stream contents + ] + + source [ + + + ^ self object methodSourceString + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkCompiledMethodInspectorView.st b/packages/visualgst/Inspector/View/GtkCompiledMethodInspectorView.st new file mode 100644 index 0000000..acfaefd --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkCompiledMethodInspectorView.st @@ -0,0 +1,133 @@ +"====================================================================== +| +| GtkCompiledMethodInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkCompiledMethodInspectorView [ + + GtkCompiledMethodInspectorView class [ | fields | ] + + GtkCompiledMethodInspectorView class >> fields [ + + + ^ fields ifNil: [ fields := Dictionary from: {'Flags'->#flags. + 'Primitive Index'->#primitive. + 'Number Of Arguments'->#arguments. + 'Number Of Temporaries'->#temporaries. + 'Number Of Literals'->#numLiterals. + 'Needed Stack Slots'->#stack. + 'Literals'->#literals. + 'Byte Codes'->#byte. + 'Source Code'->#source} ] + ] + + do: aBlock [ + + + super do: aBlock. + self class fields keys do: aBlock + ] + + selectedValue: anObject [ + + + ^ (self class fields includesKey: anObject) + ifFalse: [ super selectedValue: anObject ] + ifTrue: [ self perform: (self class fields at: anObject) ] + ] + + flags [ + + + ^ self object flags + ] + + primitive [ + + + self object flags = 4 ifTrue: [ VMPrimitives keyAtValue: self object primitive ifAbsent: [ 'unknown' ] ]. + ^ self object primitive + ] + + arguments [ + + + ^ self object numArgs + ] + + temporaries [ + + + ^ self object numTemps + ] + + numLiterals [ + + + ^ self object numLiterals + ] + + stack [ + + + ^ self object stackDepth + ] + + literals [ + + + | stream | + stream := WriteStream on: String new. + 1 to: self numLiterals do: [ :i | + self object bytecodeIndex: i with: stream. + stream tab. + stream print: (self object literalAt: i) ]. + ^ stream contents + ] + + byte [ + + + | stream | + stream := WriteStream on: String new. + self object numBytecodes > 0 ifTrue: [ self object printByteCodesOn: stream ]. + ^ stream contents + ] + + source [ + + + ^ self object methodSourceString + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkContextInspectorView.st b/packages/visualgst/Inspector/View/GtkContextInspectorView.st new file mode 100644 index 0000000..46ab341 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkContextInspectorView.st @@ -0,0 +1,58 @@ +"====================================================================== +| +| GtkContextInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkContextInspectorView [ + + | args temps | + + do: aBlock [ + + + args := IdentitySet new. + temps := IdentitySet new. + super do: aBlock. + self object method arguments do: [ :each | aBlock value: (args add: each asString) ]. + self object method temporaries do: [ :each | aBlock value: (temps add: each asString) ]. + ] + + selectedValue: aString [ + + + ((args includes: aString) not and: [ (temps includes: aString) not ]) ifTrue: [ ^ super selectedValue: aString ]. + (args includes: aString) ifTrue: [ ^ (self object at: (self object method arguments indexOf: aString asSymbol)) displayString ]. + ^ (self object at: self object numArgs + (self object method temporaries indexOf: aString asSymbol)) displayString. + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkDictionaryInspectorView.st b/packages/visualgst/Inspector/View/GtkDictionaryInspectorView.st new file mode 100644 index 0000000..89d7a57 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkDictionaryInspectorView.st @@ -0,0 +1,53 @@ +"====================================================================== +| +| GtkDictionaryInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkDictionaryInspectorView [ + + do: aBlock [ + + + super do: aBlock. + self object keys do: aBlock + ] + + selectedValue: anObject [ + + + ^ (self object includesKey: anObject) + ifFalse: [ super selectedValue: anObject ] + ifTrue: [ self object at: anObject ] + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkFloatInspectorView.st b/packages/visualgst/Inspector/View/GtkFloatInspectorView.st new file mode 100644 index 0000000..5b36ce0 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkFloatInspectorView.st @@ -0,0 +1,51 @@ +"====================================================================== +| +| GtkFloatInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkFloatInspectorView [ + + do: aBlock [ + super do: aBlock. + 1 to: self object size do: [ :each | aBlock value: each ] + ] + + selectedValue: aString [ + + + ^ aString asNumber = 0 + ifTrue: [ super onVariableChanged ] + ifFalse: [ self object at: aString asNumber ] + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkIntegerInspectorView.st b/packages/visualgst/Inspector/View/GtkIntegerInspectorView.st new file mode 100644 index 0000000..f008f3f --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkIntegerInspectorView.st @@ -0,0 +1,62 @@ +"====================================================================== +| +| GtkInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkIntegerInspectorView [ + + do: aBlock [ + super do: aBlock. + #('hexadecimal' 'octal' 'binary') do: aBlock + ] + + selectedValue: aString [ + + + | base iter string instVar | + base := 0. + aString = 'hexadecimal' ifTrue: [ base := 16 ]. + aString = 'octal' ifTrue: [ base := 8 ]. + aString = 'binary' ifTrue: [ base := 2 ]. + ^ base = 0 + ifTrue: [ super selectedValue: aString ] + ifFalse: [ self object printString: base ] + ] + + canDive [ + + + ^ false + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkObjectInspectorView.st b/packages/visualgst/Inspector/View/GtkObjectInspectorView.st new file mode 100644 index 0000000..1e34763 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkObjectInspectorView.st @@ -0,0 +1,88 @@ +"====================================================================== +| +| GtkObjectInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +Object subclass: GtkObjectInspectorView [ + | object model | + + GtkObjectInspectorView class >> openOn: anObject [ + + + ^ (super new) + object: anObject; + yourself + ] + + object [ + + + ^ object + ] + + object: anObject [ + + + object := anObject. + ] + + do: aBlock [ + + + aBlock value: 'self'. + self object class allInstVarNames do: aBlock + ] + + values [ + + + ^Array streamContents: [:s | self do: [:value | s nextPut: value]] + ] + + selectedValue: aString [ + + + | iter string instVar | + ^ aString = 'self' + ifTrue: [ self object ] + ifFalse: [ self object + instVarNamed: aString ] + ] + + canDive [ + + + ^ true + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkSequenceableCollectionInspectorView.st b/packages/visualgst/Inspector/View/GtkSequenceableCollectionInspectorView.st new file mode 100644 index 0000000..9e92f05 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkSequenceableCollectionInspectorView.st @@ -0,0 +1,51 @@ +"====================================================================== +| +| GtkSequenceableCollectionInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkSequenceableCollectionInspectorView [ + + do: aBlock [ + super do: aBlock. + 1 to: self object size do: [ :each | aBlock value: each ] + ] + + selectedValue: aString [ + + + ^ aString asNumber = 0 + ifTrue: [ super selectedValue: aString ] + ifFalse: [ self object at: aString asNumber ] + ] +] + diff --git a/packages/visualgst/Inspector/View/GtkSetInspectorView.st b/packages/visualgst/Inspector/View/GtkSetInspectorView.st new file mode 100644 index 0000000..fdfef99 --- /dev/null +++ b/packages/visualgst/Inspector/View/GtkSetInspectorView.st @@ -0,0 +1,53 @@ +"====================================================================== +| +| GtkSetInspectorView class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkObjectInspectorView subclass: GtkSetInspectorView [ + + do: aBlock [ + + + super do: aBlock. + self object do: aBlock + ] + + selectedValue: anObject [ + + + ^ (self object includes: anObject) + ifFalse: [ super selectedValue: anObject ] + ifTrue: [ anObject ] + ] +] + diff --git a/packages/visualgst/Menus/HistorySelectionMenus.st b/packages/visualgst/Menus/HistorySelectionMenus.st new file mode 100644 index 0000000..c786882 --- /dev/null +++ b/packages/visualgst/Menus/HistorySelectionMenus.st @@ -0,0 +1,43 @@ +"====================================================================== +| +| HistoryMenus class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +MenuBuilder subclass: HistorySelectionMenus [ + + HistorySelectionMenus class >> menus [ + + ^ { HistoryBackCommand. + HistoryForwardCommand } + ] +] diff --git a/packages/visualgst/SUnit/GtkClassSUnitWidget.st b/packages/visualgst/SUnit/GtkClassSUnitWidget.st new file mode 100644 index 0000000..587a054 --- /dev/null +++ b/packages/visualgst/SUnit/GtkClassSUnitWidget.st @@ -0,0 +1,106 @@ +"====================================================================== +| +| GtkClassSUnitWidget class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkCategorizedClassWidget subclass: GtkClassSUnitWidget [ + + buildTreeView [ + + + super buildTreeView. + widget multipleSelection. + ] + + addToModel: aClass [ + + "(aClass superclass environment == self namespace and: [ (aClass superclass category = self category or: [ self category isEmpty ]) and: [ aClass superclass ~~ Smalltalk.TestCase ] ]) + ifFalse: [ model append: aClass class ] + ifTrue: [ model append: aClass class parent: aClass superclass class ]" + ] + + root [ + + + ^ Smalltalk.TestCase + ] + + selectionMode [ + + + ^ GTK.Gtk gtkSelectionMultiple + ] + + allClassNames [ + + + | classes names | + classes := self selectedClasses. + names := classes collect: [ :each | each name asString ]. + ^ names fold: [ :a :b | a, ', ', b ] + ] + + hasSelectedClass [ + + + ^ widget hasSelection + ] + + selectedClass [ + + + ^ self selectedClasses first + ] + + selectedClasses [ + + + self hasSelectedClass ifFalse: [ self error: 'Nothing is selected' ]. + ^ widget selection collect: [:each| each asClass] + ] + + recategorizedEvent: anEvent [ + + + (anEvent item inheritsFrom: TestCase) ifFalse: [ ^ self ]. + super recategorizedEvent: anEvent + ] + + addEvent: anEvent [ + + + (anEvent item inheritsFrom: TestCase) ifFalse: [ ^ self ]. + super addEvent: anEvent + ] +] + diff --git a/packages/visualgst/SUnit/GtkMethodSUnitWidget.st b/packages/visualgst/SUnit/GtkMethodSUnitWidget.st new file mode 100644 index 0000000..bf1876d --- /dev/null +++ b/packages/visualgst/SUnit/GtkMethodSUnitWidget.st @@ -0,0 +1,51 @@ +"====================================================================== +| +| GtkMethodSUnitWidget class definition +| +======================================================================" + +"====================================================================== +| +| Copyright (c) 2013 +| Gwenael Casaccio , +| +| +| This file is part of VisualGST. +| +| Permission is hereby granted, free of charge, to any person obtaining +| a copy of this software and associated documentation files (the +| 'Software'), to deal in the Software without restriction, including +| without limitation the rights to use, copy, modify, merge, publish, +| distribute, sublicense, and/or sell copies of the Software, and to +| permit persons to whom the Software is furnished to do so, subject to +| the following conditions: +| +| The above copyright notice and this permission notice shall be +| included in all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +| +======================================================================" + +GtkMethodWidget subclass: GtkMethodSUnitWidget [ + + category: aString [ + + + category := aString. + self classOrMeta methodDictionary ifNil: [ + self clear. + ^ self]. + widget + item: ((self classOrMeta methodDictionary select: [ :each | self category = '*' or: [ each methodCategory = self category and: [ each selector matchRegex: 'test' from: 1 to: 4 ] ] ]) + asArray sort: [ :a :b | a selector <= b selector ]); + refresh + ] +] + diff --git a/packages/visualgst/SUnit/GtkSUnit.st b/packages/visualgst/SUnit/GtkSUnit.st index 1636b6b..4bd167a 100644 --- a/packages/visualgst/SUnit/GtkSUnit.st +++ b/packages/visualgst/SUnit/GtkSUnit.st @@ -34,6 +34,7 @@ ======================================================================" GtkBrowsingTool subclass: GtkSUnit [ + | namespaceWidget classWidget methodWidget sourceCodeWidget successfullWidget failedWidget errorWidget namespace class state | accelPath [ @@ -77,47 +78,35 @@ GtkBrowsingTool subclass: GtkSUnit [ buildNamespaceAndClassWidget [ - ^ (GTK.GtkHPaned new) - pack1: self buildNamespaceWidget resize: true shrink: false; - pack2: self buildClassWidget resize: true shrink: false; - yourself + ^ HPaned with:self buildNamespaceWidget with: self buildClassWidget ] buildNamespaceAndClassAndMethodWidget [ - ^ (GTK.GtkHPaned new) - pack1: self buildNamespaceAndClassWidget resize: true shrink: false; - pack2: self buildMethodWidget resize: true shrink: false; - yourself + ^ HPaned with: self buildNamespaceAndClassWidget with: self buildMethodWidget ] buildMiniBrowser [ - ^ (GTK.GtkVPaned new) - pack1: self buildNamespaceAndClassAndMethodWidget resize: true shrink: false; - pack2: self buildSourceCodeWidget resize: true shrink: false; - yourself + ^ VPaned with: self buildNamespaceAndClassAndMethodWidget with: self buildSourceCodeWidget ] buildResultWidget [ - ^ GTK.GtkNotebook new - appendPage: self buildSuccesfullWidget tabLabel: (GTK.GtkLabel new: 'Successful Tests'); - appendPage: self buildFailedWidget tabLabel: (GTK.GtkLabel new: 'Failed Tests'); - appendPage: self buildErrorWidget tabLabel: (GTK.GtkLabel new: 'Errors Tests'); + ^ Notebook new + addPermanentWidget: self buildSuccesfullWidget label: 'Successful Tests'; + addPermanentWidget: self buildFailedWidget label: 'Failed Tests'; + addPermanentWidget: self buildErrorWidget label: 'Errors Tests'; yourself ] buildCentralWidget [ - ^ (GTK.GtkVPaned new) - pack1: self buildMiniBrowser resize: true shrink: false; - pack2: self buildResultWidget resize: true shrink: false; - yourself + ^ VPaned with: self buildMiniBrowser with: self buildResultWidget ] initialize [ @@ -145,68 +134,53 @@ GtkBrowsingTool subclass: GtkSUnit [ buildNamespaceWidget [ - namespaceWidget := GtkCategorizedNamespaceWidget showAll + ^ namespaceWidget := GtkCategorizedNamespaceWidget new whenSelectionChangedSend: #onNamespaceChanged to: self; yourself. - ^ namespaceWidget mainWidget ] buildClassWidget [ - classWidget := GtkClassSUnitWidget showAll + ^ classWidget := GtkClassSUnitWidget new selectionMode: GTK.Gtk gtkSelectionMultiple; whenSelectionChangedSend: #onClassChanged to: self; yourself. - ^ classWidget mainWidget ] buildMethodWidget [ - methodWidget := GtkMethodSUnitWidget showAll + ^ methodWidget := GtkMethodSUnitWidget new whenSelectionChangedSend: #onMethodChanged to: self; yourself. - ^ methodWidget mainWidget ] buildSourceCodeWidget [ - sourceCodeWidget := GtkSourceCodeWidget showAll. + sourceCodeWidget := GtkSourceCodeWidget new. sourceCodeWidget parentWindow: window. sourceCodeWidget browser: self. - ^ sourceCodeWidget mainWidget + ^ sourceCodeWidget ] buildSuccesfullWidget [ - successfullWidget := GtkSUnitResult new - initialize; - yourself. - - ^ successfullWidget mainWidget + ^ successfullWidget := GtkSUnitResult new ] buildFailedWidget [ - failedWidget := GtkSUnitResult new - initialize; - yourself. - - ^ failedWidget mainWidget + ^ failedWidget := GtkSUnitResult new ] buildErrorWidget [ - errorWidget := GtkSUnitResult new - initialize; - yourself. - - ^ errorWidget mainWidget + ^ errorWidget := GtkSUnitResult new ] onNamespaceChanged [ diff --git a/packages/visualgst/SUnit/GtkSUnitResultWidget.st b/packages/visualgst/SUnit/GtkSUnitResultWidget.st index ba616e4..d6a9de3 100644 --- a/packages/visualgst/SUnit/GtkSUnitResultWidget.st +++ b/packages/visualgst/SUnit/GtkSUnitResultWidget.st @@ -33,43 +33,35 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkSUnitResult [ - | model resultTree results | +Compoment subclass: GtkSUnitResult [ + + | results | + initialize [ - self mainWidget: self buildTreeView + self buildTreeView ] buildTreeView [ - resultTree := (GTK.GtkTreeView newWithTextColumn: self model title: 'Results') - connectSignal: 'button-press-event' to: self selector: #'onPress:event:' userData: nil; - yourself. - ^ GTK.GtkScrolledWindow withChild: resultTree - ] - - model [ - - - ^ model ifNil: [ - model := GTK.GtkTreeStore new: 2 varargs: {GTK.GValue gTypeString. GLib.GType oopType} ] + self widget: (List column: {{GtkColumnTextType title: 'Results'}} contents: [ :each | { each displayString } ]). ] clearModel [ - self model clear + widget clear ] results: aSet [ - self clearModel. results := aSet. - results do: [ :each | - self model appendItem: {each displayString. each} ] + widget + item: aSet; + refresh ] popupMenuOn: aGtkWidget menu: aGtkMenu [ @@ -94,19 +86,6 @@ GtkConcreteWidget subclass: GtkSUnitResult [ aGtkMenu append: menuitem. ] - onPress: aGtkWidget event: aGdkEvent [ - - | aGdkButtonEvent menu | - aGdkButtonEvent := aGdkEvent castTo: GTK.GdkEventButton type. - aGdkButtonEvent button value = 3 ifFalse: [ ^ false ]. - menu := GTK.GtkMenu new. - self popupMenuOn: aGtkWidget menu: menu. - menu attachToWidget: resultTree detacher: nil. - menu showAll. - menu popup: nil parentMenuItem: nil func: nil data: nil button: 3 activateTime: aGdkButtonEvent time value. - ^ true - ] - debugTest [ @@ -116,14 +95,14 @@ GtkConcreteWidget subclass: GtkSUnitResult [ hasSelectedMethod [ - ^ resultTree hasSelectedItem + ^ widget hasSelection ] state [ - resultTree hasSelectedItem ifTrue: [ + widget hasSelection ifTrue: [ ^MethodState on: self selectedResult class >> self selectedResult selector ]. - ^BrowserState new + ^ BrowserState new ] selectedMethodSymbol [ @@ -142,9 +121,8 @@ GtkConcreteWidget subclass: GtkSUnitResult [ selectedResult [ - | iter | - (iter := resultTree selectedIter) ifNil: [ self error: 'Nothing is selected' ]. - ^ self model getOop: iter column: 1 + widget hasSelection ifNil: [ self error: 'Nothing is selected' ]. + ^ widget selection ] browseImplementors [ diff --git a/packages/visualgst/StBrowser/GtkCategorizedClassWidget.st b/packages/visualgst/StBrowser/GtkCategorizedClassWidget.st index d05d9dd..c1c3b6c 100644 --- a/packages/visualgst/StBrowser/GtkCategorizedClassWidget.st +++ b/packages/visualgst/StBrowser/GtkCategorizedClassWidget.st @@ -41,14 +41,14 @@ Smalltalk.String extend [ ] ] -GtkConcreteWidget subclass: GtkCategorizedClassWidget [ - | classesTree column model namespace category | +Compoment subclass: GtkCategorizedClassWidget [ + + | column namespace category | GtkCategorizedClassWidget >> on: aNamespace [ - ^ (self new) - initialize; + ^ self new namespace: aNamespace; yourself ] @@ -58,7 +58,7 @@ GtkConcreteWidget subclass: GtkCategorizedClassWidget [ self category: ''; - mainWidget: self buildTreeView; + buildTreeView; registerNotifier ] @@ -103,8 +103,8 @@ GtkConcreteWidget subclass: GtkCategorizedClassWidget [ self category: aString; namespace: aNamespace. - model refresh. - classesTree treeView expandAll + widget refresh. + widget expandAll ] appendClass: aClass to: anArray [ @@ -130,36 +130,35 @@ GtkConcreteWidget subclass: GtkCategorizedClassWidget [ clear [ - model clear + widget clear ] buildTreeView [ - classesTree := GtkScrollTreeWidget createTreeWithModel: {{GtkColumnTextType title: 'Classes'}}. - classesTree connectToWhenPopupMenu: (ClassMenus on: self). - classesTree treeView getSelection setMode: self selectionMode. - (model := GtkTreeModel on: classesTree treeView getModel) - item: self root; - childrenBlock: [ :each | | col | - col := SortedCollection sortBlock: [ :a :b | a asClass name <= b asClass name ]. - each subclassesDo: [ :subclasses | self appendClass: subclasses to: col ]. - col ]; - contentsBlock: [ :each | {each asClass name asString, ' '} ]. - ^ classesTree mainWidget + self widget: (Tree + column: {{GtkColumnTextType title: 'Classes'}} + children: [ :each | | col | + col := SortedCollection sortBlock: [ :a :b | a asClass name <= b asClass name ]. + each subclassesDo: [ :subclasses | self appendClass: subclasses to: col ]. + col ] + contents: [ :each | {each asClass name asString, ' '} ]). + widget + popupMenu: (ClassMenus on: self); + singleSelection; + item: self root. ] whenSelectionChangedSend: aSelector to: anObject [ - classesTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] selectionMode: aSelectionMode [ - classesTree treeView getSelection setMode: aSelectionMode. + "widget treeView getSelection setMode: aSelectionMode." ] selectedNamespace [ @@ -177,7 +176,7 @@ GtkConcreteWidget subclass: GtkCategorizedClassWidget [ hasSelectedClass [ - ^ classesTree treeView hasSelectedItem + ^ widget hasSelection ] state [ @@ -194,55 +193,55 @@ GtkConcreteWidget subclass: GtkCategorizedClassWidget [ self hasSelectedClass ifFalse: [ self error: 'nothing is selected' ]. - ^ classesTree treeView selection asClass + ^ widget selection asClass ] selectAClass: aClass [ - classesTree treeView select: aClass + widget select: aClass ] addToModel: aClass [ - (model includes: aClass class) ifTrue: [ ^ self ]. + "(model includes: aClass class) ifTrue: [ ^ self ]. (aClass superclass environment == self namespace and: [ aClass superclass category = self category or: [ self category isEmpty ] ]) ifFalse: [ model append: aClass class ] - ifTrue: [ model append: aClass class parent: aClass superclass class ] + ifTrue: [ model append: aClass class parent: aClass superclass class ]" ] addEvent: anEvent [ - anEvent item environment == self namespace ifFalse: [ ^ self ]. + "anEvent item environment == self namespace ifFalse: [ ^ self ]. (anEvent item category = self category or: [ self category isEmpty ]) ifFalse: [ ^ self ]. - self addToModel: anEvent item + self addToModel: anEvent item" ] removeEvent: anEvent [ - anEvent item environment == self namespace ifFalse: [ ^ self ]. + "anEvent item environment == self namespace ifFalse: [ ^ self ]. (anEvent item category = self category or: [ self category isEmpty ]) ifFalse: [ ^ self ]. - model remove: anEvent item class + model remove: anEvent item class" ] modificationEvent: anEvent [ - (anEvent item environment == self namespace or: [ anEvent isSuperclassModified not ]) ifFalse: [ ^ self ]. + "(anEvent item environment == self namespace or: [ anEvent isSuperclassModified not ]) ifFalse: [ ^ self ]. (anEvent oldItem category = self category or: [ anEvent oldItem category isNil and: [ self category isEmpty ] ]) ifTrue: [ model remove: anEvent item class ifAbsent: [ nil ] ]. (anEvent item category = self category or: [ anEvent item category isNil and: [ self category isEmpty ] ]) - ifTrue: [ self addToModel: anEvent item ] + ifTrue: [ self addToModel: anEvent item ]" ] recategorizedEvent: anEvent [ - anEvent item environment == self namespace ifFalse: [ ^ self ]. + "anEvent item environment == self namespace ifFalse: [ ^ self ]. (anEvent oldCategory = self category or: [ anEvent oldCategory isNil and: [ self category isEmpty and: [ model includes: anEvent item ] ] ]) ifTrue: [ model remove: anEvent item class ]. - (anEvent item category = self category or: [ anEvent item category isNil and: [ self category isEmpty ] ]) ifTrue: [ self addToModel: anEvent item ] + (anEvent item category = self category or: [ anEvent item category isNil and: [ self category isEmpty ] ]) ifTrue: [ self addToModel: anEvent item ]" ] ] diff --git a/packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st b/packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st index 0e57fe6..799ccda 100644 --- a/packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st +++ b/packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st @@ -33,13 +33,12 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkCategorizedNamespaceWidget [ - | namespaceTree model | +Compoment subclass: GtkCategorizedNamespaceWidget [ initialize [ - self mainWidget: self buildTreeView. + self buildTreeView. self registerNotifier ] @@ -55,52 +54,50 @@ GtkConcreteWidget subclass: GtkCategorizedNamespaceWidget [ buildTreeView [ - namespaceTree := GtkScrollTreeWidget createTreeWithModel: {{GtkColumnPixbufType visible. GtkColumnTextType title: 'Namespaces'}}. - namespaceTree connectToWhenPopupMenu: (NamespaceMenus on: self). - namespaceTree treeView getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkTreeModel on: namespaceTree treeView getModel) - item: FakeNamespace; - childrenBlock: [ :each | (each subspaces asArray sort: [ :a :b | a name <= b name ]), (each categories values sort: [ :a :b | a name <= b name ]) ]; - contentsBlock: [ :each | {each icon. each name asString} ]; - connectSignal: 'row-has-child-toggled' to: self selector: #'childToggled:path:iter:'; - refresh. - ^ namespaceTree mainWidget + self widget: (Tree + column: {{GtkColumnPixbufType visible. GtkColumnTextType title: 'Namespaces'}} + children: [ :each | (each subspaces asArray sort: [ :a :b | a name <= b name ])", (each categories values sort: [ :a :b | a name <= b name ])" ] + contents: [ :each | {each icon. each name asString} ]). + widget popupMenu: (NamespaceMenus on: self). + widget singleSelection. + widget item: FakeNamespace. + widget refresh. + "connectSignal: 'row-has-child-toggled' to: self selector: #'childToggled:path:iter:';" ] whenSelectionChangedSend: aSelector to: anObject [ - namespaceTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] selectANamespace: aNamespace [ (self hasSelectedNamespace and: [ self selectedNamespace == aNamespace ]) ifTrue: [ ^ self ]. - (namespaceTree treeView) - expandAll; - select: aNamespace + widget + expandAll; + select: aNamespace ] hasSelectedNamespace [ - ^ namespaceTree treeView hasSelectedItem + ^ widget hasSelection ] selectedNamespace [ self hasSelectedNamespace ifFalse: [ self error: 'nothing is selected' ]. - ^ namespaceTree treeView selection namespace + ^ widget selection namespace ] selectedCategory [ self hasSelectedNamespace ifFalse: [ self error: 'nothing is selected' ]. - ^ namespaceTree treeView selection category + ^ widget selection category ] state [ @@ -115,28 +112,28 @@ GtkConcreteWidget subclass: GtkCategorizedNamespaceWidget [ childToggled: model path: path iter: iter [ - namespaceTree treeView collapseRow: path. + "widget treeView collapseRow: path. ((model at: iter) at: 3) isNamespace ifTrue: [ ((model at: iter) at: 3) subspaces isEmpty ifFalse: [ - namespaceTree treeView expandRow: path openAll: false ] ] + widget treeView expandRow: path openAll: false ] ]" ] addEvent: anEvent [ - model append: anEvent item parent: anEvent item superspace + "model append: anEvent item parent: anEvent item superspace" ] removeEvent: anEvent [ - model remove: anEvent item + "model remove: anEvent item" ] classRecategorizedEvent: anEvent [ - | namespace root toAdd | + "| namespace root toAdd | namespace := anEvent item environment. (anEvent item category isNil or: [ anEvent item category size = 0 ]) ifTrue: [ ^ self ]. root := ClassCategory named: anEvent item category into: namespace. @@ -146,7 +143,7 @@ GtkConcreteWidget subclass: GtkCategorizedNamespaceWidget [ toAdd := root. root := root parent ]. root parent ifNil: [ root := namespace ]. - model append: toAdd parent: root + model append: toAdd parent: root" ] ] diff --git a/packages/visualgst/StBrowser/GtkCategoryWidget.st b/packages/visualgst/StBrowser/GtkCategoryWidget.st index f313b52..adbecce 100644 --- a/packages/visualgst/StBrowser/GtkCategoryWidget.st +++ b/packages/visualgst/StBrowser/GtkCategoryWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkCategoryWidget [ - | categoryTree categories model class | +Compoment subclass: GtkCategoryWidget [ + + | categories class | GtkCategoryWidget >> on: aClass [ - ^ (self new) - initialize; + ^ self new classOrMeta: aClass; yourself ] @@ -49,7 +49,7 @@ GtkConcreteWidget subclass: GtkCategoryWidget [ self initializeCategories. - self mainWidget: self buildTreeView. + self buildTreeView. self registerNotifier ] @@ -77,7 +77,7 @@ GtkConcreteWidget subclass: GtkCategoryWidget [ class := aClass. categories empty. - model + widget item: (self buildCategory: categories); refresh ] @@ -100,31 +100,27 @@ GtkConcreteWidget subclass: GtkCategoryWidget [ clear [ - model clear + widget clear ] buildTreeView [ - categoryTree := GtkScrollTreeWidget createListWithModel: {{GtkColumnTextType title: 'Method categories'}}. - categoryTree treeView getSelection setMode: GTK.Gtk gtkSelectionBrowse. - categoryTree connectToWhenPopupMenu: (CategoryMenus on: self). - (model := GtkListModel on: categoryTree treeView getModel) - contentsBlock: [ :each | {each displayString} ]. - ^ categoryTree mainWidget + self widget: (List column: {{GtkColumnTextType title: 'Method categories'}} contents: [ :each | {each displayString} ]). + widget singleSelection. + widget popupMenu: (CategoryMenus on: self). ] unselectAll [ - categoryTree treeView getSelection unselectAll + widget unselectAll ] whenSelectionChangedSend: aSelector to: anObject [ - categoryTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] state [ @@ -138,29 +134,20 @@ GtkConcreteWidget subclass: GtkCategoryWidget [ hasSelectedCategory [ - ^ categoryTree treeView hasSelectedItem + ^ widget hasSelection ] selectedCategory [ self hasSelectedCategory ifFalse: [ self error: 'nothing is selected' ]. - ^ categoryTree treeView selection + ^ widget selection ] selectACategory: aString [ - categoryTree treeView select: aString - ] - - findIterInACategory: aString [ - - - | result | - result := model findIterInACategory: aString. - categoryTree treeView scrollToCell: (model gtkModel getPath: result) column: nil useAlign: false rowAlign: 0.5 colAlign: 0.5. - ^ result + widget select: aString ] viewedCategoryWidget [ @@ -169,37 +156,30 @@ GtkConcreteWidget subclass: GtkCategoryWidget [ ^ self ] - viewedCategoryModel [ - - - ^ model - ] - removeEmptyCategory [ | set | set := Set new. self buildCategory: set. - (categories - set) do: [ :each | - model remove: each. - categories remove: each ifAbsent: [] ] + (categories - set) do: [ :each | categories remove: each ifAbsent: [] ]. ] addEvent: anEvent [ - (anEvent item methodClass == self classOrMeta and: [ (model hasItem: anEvent item methodCategory) not ]) ifFalse: [ ^ self ]. + (anEvent item methodClass == self classOrMeta and: [ (categories includes: anEvent item methodCategory) not ]) ifFalse: [ ^ self ]. categories add: anEvent item methodCategory. - model append: anEvent item methodCategory. - self removeEmptyCategory + self removeEmptyCategory. + widget refresh. ] removeEvent: anEvent [ - (anEvent item methodClass == self classOrMeta and: [ (model hasItem: anEvent item methodCategory) not ]) ifFalse: [ ^ self ]. - self removeEmptyCategory + (anEvent item methodClass == self classOrMeta and: [ (categories includes: anEvent item methodCategory) not ]) ifFalse: [ ^ self ]. + self removeEmptyCategory. + widget refresh ] ] diff --git a/packages/visualgst/StBrowser/GtkClassBrowserWidget.st b/packages/visualgst/StBrowser/GtkClassBrowserWidget.st index cc95c40..58ead5b 100644 --- a/packages/visualgst/StBrowser/GtkClassBrowserWidget.st +++ b/packages/visualgst/StBrowser/GtkClassBrowserWidget.st @@ -33,7 +33,8 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkClassBrowserWidget [ +Compoment subclass: GtkClassBrowserWidget [ + GtkClassBrowserWidget class [ | Undo | ] | launcher checkCode namespaceWidget classWidget classHierarchyWidget classHierarchyUpdate iCategoryWidget iMethodWidget cCategoryWidget cMethodWidget classAndInstanceSide codeWidget historyStack state | @@ -66,75 +67,69 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ buildBrowser [ - ^ GTK.GtkHPaned addAll: {self buildCategoryClassesAndHierarchy. self buildProtocolAndMethod} + ^ HPaned addAll: {self buildCategoryClassesAndHierarchy. self buildProtocolAndMethod} ] buildCategoryAndClass [ - ^ GTK.GtkHPaned addAll: {self buildNamespaceView. self buildClassView} + ^ HPaned addAll: {self buildNamespaceView. self buildClassView} ] buildClassBrowser [ - ^ GTK.GtkHPaned addAll: {self buildClassCategoryView. self buildClassMethodView} + ^ HPaned addAll: {self buildClassCategoryView. self buildClassMethodView} ] buildInstanceBrowser [ - ^ GTK.GtkHPaned addAll: {self buildInstanceCategoryView. self buildInstanceMethodView} + ^ HPaned addAll: {self buildInstanceCategoryView. self buildInstanceMethodView} ] buildProtocolAndMethod [ - ^ classAndInstanceSide := (GTK.GtkNotebook new) - appendPage: self buildInstanceBrowser tabLabel: (GTK.GtkLabel new: 'Instance'); - appendPage: self buildClassBrowser tabLabel: (GTK.GtkLabel new: 'Class'); - showAll; - setCurrentPage: 0; - connectSignal: 'switch-page' to: self selector: #'classInstanceSwitchOn:page:number:'; + ^ classAndInstanceSide := Notebook new + addPermanentWidget: self buildInstanceBrowser label: 'Instance'; + addPermanentWidget: self buildClassBrowser label: 'Class'; + currentPage: 0; + "connectSignal: 'switch-page' to: self selector: #'classInstanceSwitchOn:page:number:';" yourself ] buildCategoryClassesAndHierarchy [ - ^ (GTK.GtkNotebook new) - appendPage: self buildCategoryAndClass tabLabel: (GTK.GtkLabel new: 'Class'); - appendPage: self buildHierarchy tabLabel: (GTK.GtkLabel new: 'Hierarchy'); - showAll; - setCurrentPage: 0; - connectSignal: 'switch-page' to: self selector: #'namespaceHierarchySwitchOn:page:number:'; + ^ Notebook new + addPermanentWidget: self buildCategoryAndClass label: 'Class'; + addPermanentWidget: self buildHierarchy label: 'Hierarchy'; + currentPage: 0; + "connectSignal: 'switch-page' to: self selector: #'namespaceHierarchySwitchOn:page:number:';" yourself ] buildNamespaceView [ - ^ (namespaceWidget := self buildWidget: GtkCategorizedNamespaceWidget whenSelectionChangedSend: #onNamespaceChanged) - mainWidget + ^ namespaceWidget := self buildWidget: GtkCategorizedNamespaceWidget whenSelectionChangedSend: #onNamespaceChanged ] buildClassView [ - ^ (classWidget := self buildWidget: GtkCategorizedClassWidget whenSelectionChangedSend: #onClassChanged) - mainWidget + ^ classWidget := self buildWidget: GtkCategorizedClassWidget whenSelectionChangedSend: #onClassChanged ] buildCodeView [ - codeWidget := GtkSourceCodeWidget showAll + ^ codeWidget := GtkSourceCodeWidget new parentWindow: self parentWindow; browser: self; - yourself. - - ^ codeWidget mainWidget + yourself ] buildWidget: aClass whenSelectionChangedSend: aSymbol [ - ^ aClass showAll + ^ aClass new whenSelectionChangedSend: aSymbol to: self; yourself ] @@ -143,21 +138,18 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ ^ (classHierarchyWidget := self buildWidget: GtkClassHierarchyWidget whenSelectionChangedSend: #onClassHierarchyChanged) - mainWidget ] buildInstanceCategoryView [ ^ (iCategoryWidget := self buildWidget: GtkCategoryWidget whenSelectionChangedSend: #onInstanceSideCategoryChanged) - mainWidget ] buildClassCategoryView [ ^ (cCategoryWidget := self buildWidget: GtkCategoryWidget whenSelectionChangedSend: #onClassSideCategoryChanged) - mainWidget ] buildClassMethodView [ @@ -165,7 +157,7 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ ^ (cMethodWidget := self buildWidget: GtkMethodWidget whenSelectionChangedSend: #onClassSideMethodChanged) browser: self; - mainWidget + yourself ] buildInstanceMethodView [ @@ -173,17 +165,13 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ ^ (iMethodWidget := self buildWidget: GtkMethodWidget whenSelectionChangedSend: #onInstanceSideMethodChanged) browser: self; - mainWidget + yourself ] buildBrowserPaned [ - ^ GTK.GtkVPaned new - pack1: self buildBrowser resize: true shrink: false; - pack2: self buildCodeView resize: true shrink: true ; - showAll; - yourself + self widget: (VPaned with: self buildBrowser with: self buildCodeView) ] initializeHistory [ @@ -204,7 +192,7 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ self initializeHistory; - mainWidget: self buildBrowserPaned + buildBrowserPaned ] postInitialize [ @@ -229,7 +217,7 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ grabFocus [ - namespaceWidget mainWidget grabFocus + namespaceWidget grabFocus ] namespaceHierarchySwitchOn: aGtkNotebook page: aGtkNotebookPage number: aSmallInteger [ @@ -533,14 +521,14 @@ GtkConcreteWidget subclass: GtkClassBrowserWidget [ self selectClass: aSelector in: iMethodWidget withCategory: iCategoryWidget. - classAndInstanceSide setCurrentPage: 0 + classAndInstanceSide currentPage: 0 ] selectAClassMethod: aSelector [ self selectMetaclass: aSelector in: cMethodWidget withCategory: cCategoryWidget. - classAndInstanceSide setCurrentPage: 1 + classAndInstanceSide currentPage: 1 ] targetObject [ diff --git a/packages/visualgst/StBrowser/GtkClassHierarchyWidget.st b/packages/visualgst/StBrowser/GtkClassHierarchyWidget.st index 272b60a..0bfd6ad 100644 --- a/packages/visualgst/StBrowser/GtkClassHierarchyWidget.st +++ b/packages/visualgst/StBrowser/GtkClassHierarchyWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkClassHierarchyWidget [ - | root dic classesTree model classOrMeta | +Compoment subclass: GtkClassHierarchyWidget [ + + | root dic classOrMeta | GtkClassHierarchyWidget >> on: aClass [ - ^ (self new) - initialize; + ^ self new classOrMeta: aClass; yourself ] @@ -50,7 +50,7 @@ GtkConcreteWidget subclass: GtkClassHierarchyWidget [ dic := Dictionary new. self - mainWidget: self buildTreeView; + buildTreeView; registerNotifier ] @@ -75,17 +75,15 @@ GtkConcreteWidget subclass: GtkClassHierarchyWidget [ classOrMeta := aClass asClass. dic := Dictionary new. self buildSuperclasses. - model - item: #root; - refresh. + widget refresh. - classesTree + widget expandAll; select: aClass ] emptyModel [ - classesTree getSelection unselectAll + widget unselectAll ] buildSuperclasses [ @@ -101,37 +99,35 @@ GtkConcreteWidget subclass: GtkClassHierarchyWidget [ buildTreeView [ - classesTree := GTK.GtkTreeView createTreeWithModel: {{GtkColumnTextType title: 'Classes'}}. - classesTree getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkTreeModel on: classesTree getModel) - item: #root; - childrenBlock: [ :each | - dic at: each ifAbsent: [ | col | + self widget: (Tree + column: {{GtkColumnTextType title: 'Classes'}} + children: [ :each | + dic at: each ifAbsent: [ | col | col := SortedCollection sortBlock: [ :a :b | a asClass name <= b asClass name ]. col addAll: (each subclasses select: [ :behavior | behavior isClass ]). - col ] ]; - contentsBlock: [ :each | {each asClass name asString, ' '} ]. - ^ GTK.GtkScrolledWindow withChild: classesTree + col ] ] + contents: [ :each | {each asClass name asString, ' '} ]). + widget singleSelection. + widget item: #root. ] whenSelectionChangedSend: aSelector to: anObject [ - classesTree getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] hasSelectedClass [ - ^ classesTree hasSelectedItem + ^ widget hasSelection ] selectedClass [ self hasSelectedClass ifFalse: [ ^ self classOrMeta " self error: 'Nothing is selected' " ]. - ^ classesTree selection asClass + ^ widget selection asClass ] state [ diff --git a/packages/visualgst/StBrowser/GtkMethodWidget.st b/packages/visualgst/StBrowser/GtkMethodWidget.st index 77803a6..d28d6e5 100644 --- a/packages/visualgst/StBrowser/GtkMethodWidget.st +++ b/packages/visualgst/StBrowser/GtkMethodWidget.st @@ -33,14 +33,14 @@ | ======================================================================" -GtkConcreteWidget subclass: GtkMethodWidget [ - | browser model methodTree class category | +Compoment subclass: GtkMethodWidget [ + + | browser class category | GtkMethodWidget >> on: aClass withCategory: aCategory [ - ^ (self new) - initialize; + ^ self new class: aClass withCategory: aCategory; yourself ] @@ -49,7 +49,7 @@ GtkConcreteWidget subclass: GtkMethodWidget [ self - mainWidget: self buildTreeView; + buildTreeView; registerNotifier ] @@ -84,9 +84,9 @@ GtkConcreteWidget subclass: GtkMethodWidget [ category := aString. self classOrMeta methodDictionary ifNil: [ - model clear. + self clear. ^ self]. - model + widget item: ((self classOrMeta methodDictionary select: [ :each | self category = '*' or: [ each methodCategory = self category ] ]) asArray sort: [ :a :b | a selector <= b selector ]); refresh @@ -105,10 +105,6 @@ GtkConcreteWidget subclass: GtkMethodWidget [ self category: aString ] - gtkModel [ - ^ methodTree treeView getModel - ] - emptyModel [ @@ -118,7 +114,7 @@ GtkConcreteWidget subclass: GtkMethodWidget [ clear [ - model clear + widget clear ] includesCategory: aSymbol [ @@ -132,12 +128,9 @@ GtkConcreteWidget subclass: GtkMethodWidget [ buildTreeView [ - methodTree := GtkScrollTreeWidget createListWithModel: {{GtkColumnPixbufType visible. GtkColumnTextType title: 'Methods'}}. - methodTree connectToWhenPopupMenu: (MethodMenus on: self). - methodTree treeView getSelection setMode: GTK.Gtk gtkSelectionBrowse. - (model := GtkListModel on: methodTree treeView getModel) - contentsBlock: [ :each | {each methodViewIcon. each selector asString} ]. - ^ methodTree mainWidget + self widget: (List column: {{GtkColumnPixbufType visible. GtkColumnTextType title: 'Methods'}} contents: [ :each | {each methodViewIcon. each selector asString} ]). + widget popupMenu: (MethodMenus on: self). + widget singleSelection. ] hasSelectedTestMethod [ @@ -151,8 +144,7 @@ GtkConcreteWidget subclass: GtkMethodWidget [ whenSelectionChangedSend: aSelector to: anObject [ - methodTree treeView getSelection - connectSignal: 'changed' to: anObject selector: aSelector + widget whenSelectionChangedSend: aSelector to: anObject ] launcher [ @@ -190,7 +182,7 @@ GtkConcreteWidget subclass: GtkMethodWidget [ hasSelectedMethod [ - ^ methodTree treeView hasSelectedItem + ^ widget hasSelection ] ifNoSelection: aBlock [ @@ -209,13 +201,13 @@ GtkConcreteWidget subclass: GtkMethodWidget [ self ifNoSelection: [ self error: 'nothing is selected' ]. - ^ methodTree treeView selection + ^ widget selection ] selectAMethod: aSymbol [ - methodTree treeView select: (self classOrMeta methodDictionary at: aSymbol) + widget select: (self classOrMeta methodDictionary at: aSymbol) ] sourceCode [ @@ -236,14 +228,14 @@ GtkConcreteWidget subclass: GtkMethodWidget [ (anEvent item methodClass == self classOrMeta and: [ self includesCategory: anEvent item methodCategory ] ) ifFalse: [ ^ self ]. - model append: anEvent item + widget refresh ] removeEvent: anEvent [ (anEvent item methodClass == self classOrMeta and: [ self includesCategory: anEvent item methodCategory ]) ifFalse: [ ^ self ]. - model remove: anEvent item + widget refresh ] ] diff --git a/packages/visualgst/Tetris/Tetris.st b/packages/visualgst/Tetris/Tetris.st index 04856fb..9f1348c 100644 --- a/packages/visualgst/Tetris/Tetris.st +++ b/packages/visualgst/Tetris/Tetris.st @@ -27,7 +27,7 @@ | ======================================================================" -GtkMainWindow subclass: Tetris [ +Window subclass: Tetris [ | canvasWidget canvas process pause delay grid movingBlocks level score level lines | diff --git a/packages/visualgst/Text/GtkFindWidget.st b/packages/visualgst/Text/GtkFindWidget.st deleted file mode 100644 index 3e3f5cf..0000000 --- a/packages/visualgst/Text/GtkFindWidget.st +++ /dev/null @@ -1,125 +0,0 @@ -"====================================================================== -| -| GtkFindWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkTextPluginWidget subclass: GtkFindWidget [ - | entry matchCase next previous lastPosition | - - buildEntry [ - - - ^ entry := GTK.GtkEntry new - connectSignal: 'activate' to: self selector: #keyPressed; - yourself - ] - - buildPreviousButton [ - - - ^ previous := GTK.GtkButton previousButton - connectSignal: 'clicked' to: self selector: #previousPressed; - yourself - ] - - buildNextButton [ - - - ^ next := GTK.GtkButton nextButton - connectSignal: 'clicked' to: self selector: #keyPressed; - yourself - ] - - buildMatchCaseButton [ - - - ^ matchCase := GTK.GtkCheckButton newWithLabel: 'match case' - ] - - hBox [ - - - ^ super hBox - packStart: (GTK.GtkLabel new: 'Find:') expand: false fill: false padding: 2; - packStart: self buildEntry expand: false fill: false padding: 15; - packStart: self buildPreviousButton expand: false fill: false padding: 0; - packStart: self buildNextButton expand: false fill: false padding: 0; - packStart: self buildMatchCaseButton expand: false fill: false padding: 0; - yourself - ] - - grabFocus [ - - - entry grabFocus - ] - - searchFrom: anInteger [ - - - ^ textWidget text indexOf: entry getText matchCase: matchCase getActive startingAt: anInteger - ] - - searchBackFrom: anInteger [ - - - ^ textWidget text deindexOf: entry getText matchCase: matchCase getActive startingAt: anInteger - ] - - keyPressed [ - - - | int | - lastPosition := textWidget hasSelection - ifTrue: [ textWidget cursorPosition + 2 ] - ifFalse: [ textWidget cursorPosition + 1 ]. - lastPosition > textWidget text size ifTrue: [ lastPosition := 1 ]. - int := self searchFrom: lastPosition. - int ifNil: [ (int := self searchFrom: 1) ifNil: [ int := textWidget cursorPosition + 1 to: textWidget cursorPosition ] ]. - textWidget selectRange: int first - 1 bound: int last. - ] - - previousPressed [ - - - | int | - lastPosition := textWidget hasSelection - ifTrue: [ textWidget cursorPosition ] - ifFalse: [ textWidget cursorPosition + 1 ]. - lastPosition = 0 ifTrue: [ lastPosition := textWidget text size ]. - int := self searchBackFrom: lastPosition. - int ifNil: [ (int := self searchBackFrom: textWidget text size) ifNil: [ int := textWidget cursorPosition + 1 to: textWidget cursorPosition ] ]. - textWidget selectRange: int first - 1 bound: int last. - ] -] - diff --git a/packages/visualgst/Text/GtkReplaceWidget.st b/packages/visualgst/Text/GtkReplaceWidget.st deleted file mode 100644 index dd6efb9..0000000 --- a/packages/visualgst/Text/GtkReplaceWidget.st +++ /dev/null @@ -1,103 +0,0 @@ -"====================================================================== -| -| GtkReplaceWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkFindWidget subclass: GtkReplaceWidget [ - | replaceWidget replaceButton replaceAllButton | - - replaceEntry [ - - - ^ replaceWidget := GTK.GtkEntry new - connectSignal: 'activate' to: self selector: #replacePressed; - yourself - ] - - replaceButton [ - - - ^ replaceButton := (GTK.GtkButton newWithLabel: 'Replace') - connectSignal: 'clicked' to: self selector: #replacePressed; - yourself - ] - - replaceAllButton [ - - - ^ replaceAllButton := (GTK.GtkButton newWithLabel: 'Replace All') - connectSignal: 'clicked' to: self selector: #replaceAllPressed; - yourself - ] - - replaceBox [ - - - | hBox | - ^ (GTK.GtkHBox new: false spacing: 3) - packStart: (GTK.GtkLabel new: 'Replace with:') expand: false fill: false padding: 2; - packStart: self replaceEntry expand: false fill: false padding: 15; - packStart: self replaceButton expand: false fill: false padding: 15; - packStart: self replaceAllButton expand: false fill: false padding: 15; - yourself - ] - - buildWidget [ - - - ^ super buildWidget - packStart: self replaceBox expand: false fill: false padding: 0; - yourself - - ] - - replacePressed [ - - - | i iter | - self keyPressed. - textWidget hasSelection ifFalse: [ ^ self ]. - i := textWidget iterOfSelectedText first getOffset. - textWidget cut. - iter := textWidget buffer getIterAtOffset: i. - textWidget buffer insertInteractive: iter text: replaceWidget getText len: replaceWidget getText size defaultEditable: true - ] - - replaceAllPressed [ - - - "matching doesn't work now" - textWidget replace: entry getText by: replaceWidget getText - ] -] - diff --git a/packages/visualgst/Text/GtkSaveTextWidget.st b/packages/visualgst/Text/GtkSaveTextWidget.st deleted file mode 100644 index 0f6871b..0000000 --- a/packages/visualgst/Text/GtkSaveTextWidget.st +++ /dev/null @@ -1,89 +0,0 @@ -"====================================================================== -| -| GtkSaveTestWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkTextPluginWidget subclass: GtkSaveTextWidget [ - | label | - - buildDropButton [ - - - ^(GTK.GtkButton newWithLabel: 'Drop') - connectSignal: 'pressed' to: self selector: #cancel; - yourself - ] - - buildAcceptButton [ - - - ^(GTK.GtkButton newWithLabel: 'Accept') - connectSignal: 'pressed' to: self selector: #acceptIt; - yourself - ] - - hBox [ - - - ^ super hBox - packStart: (label := GTK.GtkLabel new: '') expand: false fill: false padding: 2; - packEnd: self buildAcceptButton expand: false fill: false padding: 0; - packEnd: self buildDropButton expand: false fill: false padding: 0; - yourself - ] - - label: aString [ - - - label setText: aString - ] - - grabFocus [ - - - closeButton grabFocus - ] - - acceptIt [ - - - textWidget acceptIt - ] - - cancel [ - - - textWidget cancel - ] -] - diff --git a/packages/visualgst/Text/GtkSourceCodeWidget.st b/packages/visualgst/Text/GtkSourceCodeWidget.st deleted file mode 100644 index 3ff4935..0000000 --- a/packages/visualgst/Text/GtkSourceCodeWidget.st +++ /dev/null @@ -1,287 +0,0 @@ -"====================================================================== -| -| GtkSourceCodeWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkTextWidget subclass: GtkSourceCodeWidget [ - | browser codeText saveWidget | - - initialize [ - - - super initialize. - self initializeHighlighter - ] - - initializeHighlighter [ - - - (self buffer) - createTag: #classVar varargs: #('foreground' 'cyan4' nil); - createTag: #globalVar varargs: #('foreground' 'cyan4' nil); - createTag: #poolVar varargs: #('foreground' 'cyan4' nil); - createTag: #undeclaredVar varargs: #('foreground' 'red' nil); - createTag: #instanceVar varargs: #('foreground' 'black' nil); - createTag: #argumentVar varargs: #('foreground' 'black' nil); - createTag: #temporary varargs: #('foreground' 'black' nil); - createTag: #specialId varargs: #('foreground' 'grey50' nil); - createTag: #literal varargs: #('foreground' 'grey50' nil); - createTag: #temporaries varargs: #('foreground' 'magenta' nil); - createTag: #methodHeader varargs: #('foreground' 'magenta' nil); - createTag: #primitive varargs: #('foreground' 'magenta' nil); - createTag: #arguments varargs: #('foreground' 'magenta' nil); - createTag: #special varargs: #('foreground' 'magenta' nil); - createTag: #unaryMsg varargs: #('foreground' 'magenta4' nil); - createTag: #binaryMsg varargs: #('foreground' 'chocolate4' nil); - createTag: #keywordMsg varargs: #('foreground' 'NavyBlue' nil); - createTag: #comment varargs: #('foreground' 'SpringGreen4' nil) - ] - - sourceCode [ - - - ^ self buffer text - ] - - source: aSource [ - - - | string | - string := aSource source. - self emptyStack. - self codeText: string. - self buffer setText: self codeText. - aSource parser == STInST.RBBracketedMethodParser ifTrue: [ - self parseSource: string ifParsed: [ :node | SyntaxHighlighter highlight: node in: self buffer ] ] - ] - - parseSource: aString ifParsed: aOneArgBlock [ - - - | node parser | - parser := STInST.RBBracketedMethodParser new - errorBlock: [ :string :pos | ^ self ]; - initializeParserWith: aString type: #'on:errorBlock:'; - yourself. - [ node := parser parseMethod ] on: Error do: [ :ex | stderr print: ex messageText; nl; print: ex signalingContext; nl; nl. ^ self ]. - ^ aOneArgBlock value: node - ] - - connectSignals [ - - - super connectSignals. - self - connectToWhenPopupMenu: (TextMenus on: self). - (self buffer) - connectSignal: 'changed' to: self selector: #'changed' userData: nil - ] - - buildWidget [ - - - ^ (GTK.GtkFrame new: 'Code') - add: super buildWidget; - yourself - ] - - changed [ - - - | node text | - (text := self buffer text) = '' ifTrue: [ ^ self ]. - self parseSource: text ifParsed: [ :node | SyntaxHighlighter highlight: node in: self buffer ] - ] - - state [ - - - ^browser state - ] - - packPluginsInto: vbox [ - - vbox - packStart: ((saveWidget := GtkSaveTextWidget on: self) mainWidget) expand: false fill: false padding: 0. - super packPluginsInto: vbox - ] - - showSave: aString [ - - - saveWidget label: aString. - saveWidget showAll - ] - - postInitialize [ - - - super postInitialize. - saveWidget mainWidget hide - ] - - acceptIt [ - - - browser acceptIt - ] - - compileError: aString line: line [ - - - self showSave: aString - ] - - cancel [ - - - self clearUndo. - saveWidget hideAll. - self buffer setText: self codeText - ] - - doIt [ - - - ^ browser doIt - ] - - debugIt [ - - - ^ browser debugIt - ] - - inspectIt [ - - - ^ browser inspectIt - ] - - printIt [ - - - ^ browser printIt - ] - - codeSaved [ - - - saveWidget hideAll. - self textSaved - ] - - codeText [ - - - ^ codeText ifNil: [ codeText := '' ] - ] - - codeText: aString [ - - - codeText := aString copy - ] - - browser: aGtkClassBrowserWidget [ - - - browser := aGtkClassBrowserWidget - ] - - selectedMethodSymbol [ - - - | iters stream parser node | - stream := self sourceCode readStream. - iters := self buffer getSelectionBounds. - parser := STInST.RBBracketedMethodParser new. - parser errorBlock: [:message :position | ^nil]. - parser - scanner: (parser scannerClass on: stream errorBlock: parser errorBlock). - node := parser parseMethod body. - node := node bestNodeFor: - (iters first getOffset + 1 to: iters second getOffset + 1). - [node isNil ifTrue: [^nil]. - node isMessage] whileFalse: - [node := node parent]. - ^node selector - ] - - sourceCodeWidgetHasFocus [ - - - ^ true - ] - - browserHasFocus [ - - - ^ false - ] - - launcher [ - - - ^browser ifNotNil: [ browser launcher ] - ] - - browseSenders [ - - - OpenSenderCommand on: self - ] - - browseImplementors [ - - - ^ browser ifNotNil: [ browser launcher ] - ] - - appendTag: aSymbol description: anArray [ - - - self buffer - createTag: aSymbol varargs: anArray - ] - - applyTag: aSymbol forLine: anInteger [ - - - | start end | - start := self buffer getIterAtLine: anInteger - 1. - end := self buffer getIterAtLine: anInteger. - self buffer applyTagByName: aSymbol start: start end: end - ] -] - diff --git a/packages/visualgst/Text/GtkTextPluginWidget.st b/packages/visualgst/Text/GtkTextPluginWidget.st deleted file mode 100644 index d0438c3..0000000 --- a/packages/visualgst/Text/GtkTextPluginWidget.st +++ /dev/null @@ -1,90 +0,0 @@ -"====================================================================== -| -| GtkTextPluginWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkConcreteWidget subclass: GtkTextPluginWidget [ - | textWidget closeButton | - - GtkTextPluginWidget class >> on: aTextWidget [ - - - ^ self new - initialize; - textWidget: aTextWidget; - yourself - ] - - initialize [ - - - self mainWidget: self buildWidget - ] - - buildCloseButton [ - - - ^(closeButton := GTK.GtkButton closeButton) - connectSignal: 'pressed' to: self selector: #'close' userData: nil; - yourself - ] - - hBox [ - - - ^ (GTK.GtkHBox new: false spacing: 3) - packEnd: self buildCloseButton expand: false fill: false padding: 0; - yourself - ] - - buildWidget [ - - - ^ (GTK.GtkVBox new: false spacing: 3) - packStart: self hBox expand: false fill: false padding: 0; - yourself - ] - - close [ - - - self mainWidget hide - ] - - textWidget: aTextWidget [ - - - textWidget := aTextWidget - ] -] - diff --git a/packages/visualgst/Text/GtkTextWidget.st b/packages/visualgst/Text/GtkTextWidget.st deleted file mode 100644 index 12c4c4f..0000000 --- a/packages/visualgst/Text/GtkTextWidget.st +++ /dev/null @@ -1,435 +0,0 @@ -"====================================================================== -| -| GtkTextWidget class definition -| -======================================================================" - -"====================================================================== -| -| Copyright (c) 2013 -| Gwenael Casaccio , -| -| -| This file is part of VisualGST. -| -| Permission is hereby granted, free of charge, to any person obtaining -| a copy of this software and associated documentation files (the -| 'Software'), to deal in the Software without restriction, including -| without limitation the rights to use, copy, modify, merge, publish, -| distribute, sublicense, and/or sell copies of the Software, and to -| permit persons to whom the Software is furnished to do so, subject to -| the following conditions: -| -| The above copyright notice and this permission notice shall be -| included in all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -======================================================================" - -GtkConcreteWidget subclass: GtkTextWidget [ - | findWidget replaceWidget textWidget userAction undoStack lastCommand cut textSaved lastSavedCommand | - - GtkTextWidget class >> newWithBuffer: aGtkTextBuffer [ - - - ^ self new - initialize; - buffer: aGtkTextBuffer; - yourself - ] - - connectToWhenPopupMenu: aMenu [ - - popupMenu := aMenu. - textWidget - connectSignal: 'populate-popup' to: self selector: #'popupMenuOn:menu:' - ] - - popupMenuOn: aWidget menu: aGtkMenu [ - - aGtkMenu append: (GTK.GtkMenuItem new show; yourself). - popupMenu appendTo: aGtkMenu - ] - - connectSignals [ - - - textWidget - connectSignal: 'paste-clipboard' to: self selector: #pasteFromClipboard; - connectSignal: 'cut-clipboard' to: self selector: #cutFromClipboard. - - (self buffer) - connectSignal: 'begin-user-action' to: self selector: #'beginUserAction'; - connectSignal: 'end-user-action' to: self selector: #'endUserAction'; - connectSignal: 'insert-text' to: self selector: #'insert:at:text:size:'; - connectSignal: 'delete-range' to: self selector: #'delete:from:to:' - ] - - initialize [ - - - textSaved := false. - cut := userAction := false. - undoStack := (UndoStack new) - initialize; - yourself. - textWidget := GTK.GtkTextView new. - self - mainWidget: self buildWidget; - connectSignals. - - ] - - postInitialize [ - - - findWidget mainWidget hide. - replaceWidget mainWidget hide. - ] - - buildWidget [ - - - | vbox | - vbox := GTK.GtkVBox new: false spacing: 3. - self packPluginsInto: vbox. - vbox packStart: (GTK.GtkScrolledWindow withChild: textWidget) expand: true fill: true padding: 0. - ^vbox - ] - - packPluginsInto: vbox [ - - vbox - packEnd: ((findWidget := GtkFindWidget on: self) mainWidget) expand: false fill: false padding: 0; - packEnd: ((replaceWidget := GtkReplaceWidget on: self) mainWidget) expand: false fill: false padding: 0; - yourself - ] - - beginUserAction [ - - - userAction := true - ] - - endUserAction [ - - - userAction := false - ] - - pasteFromClipboard [ - - - lastCommand := nil - ] - - cutFromClipboard [ - - - cut := true and: [ self buffer getHasSelection ]. - cut ifTrue: [ lastCommand := nil ] - ] - - insert: aGtkTextBuffer at: aCObject text: aString size: anInteger [ - - - | gtkTextIter offset | - userAction ifFalse: [ ^ self ]. - gtkTextIter := GTK.GtkTextIter address: aCObject address. - (aString size = 1 and: [ aString first = Character lf]) - ifTrue: [ lastCommand := InsertTextCommand insert: aString at: gtkTextIter getOffset on: self buffer. - undoStack push: lastCommand. - lastCommand := nil. - ^ self ]. - (lastCommand isNil or: [ aString size > 1 ]) - ifTrue: [ lastCommand := InsertTextCommand insert: aString at: gtkTextIter getOffset on: self buffer. - undoStack push: lastCommand. - aString size > 1 ifTrue: [ lastCommand := nil ]. - ^ self ]. - ((gtkTextIter getOffset = (lastCommand offset + lastCommand size)) and: [ lastCommand isInsertCommand ]) - ifTrue: [ lastCommand string: (lastCommand string, aString). - ^ self ]. - lastCommand := InsertTextCommand insert: aString at: gtkTextIter getOffset on: self buffer. - undoStack push: lastCommand. - ] - - delete: aGtkTextBuffer from: aStartCObject to: anEndCObject [ - - - | startIter endIter text | - userAction ifFalse: [ cut := false. ^ self ]. - startIter := GTK.GtkTextIter address: aStartCObject address. - endIter := GTK.GtkTextIter address: anEndCObject address. - text := self buffer getText: startIter end: endIter includeHiddenChars: false. - (lastCommand isNil or: [ cut ]) - ifTrue: [ lastCommand := DeleteTextCommand from: startIter getOffset to: endIter getOffset text: text on: self buffer. - undoStack push: lastCommand. - cut ifTrue: [ lastCommand := nil ]. - cut := false. - ^ self ]. - ((startIter getOffset = (lastCommand offset - lastCommand size)) and: [ lastCommand isDeleteCommand ]) - ifTrue: [ lastCommand string: (text, lastCommand string). - ^ self ]. - lastCommand := DeleteTextCommand from: startIter getOffset to: endIter getOffset text: text on: self buffer. - undoStack push: lastCommand. - ] - - hasChanged [ - - - ^ textSaved not and: [ undoStack hasUndo ] - ] - - hasUndo [ - - - ^ undoStack hasUndo - ] - - clearUndo [ - - - textSaved := false. - lastSavedCommand := nil. - undoStack clear - ] - - undo [ - - - textSaved := self lastUndoCommand == lastSavedCommand. - undoStack undo. - lastCommand := nil. - ] - - redo [ - - - undoStack redo. - lastCommand := nil. - textSaved := self lastUndoCommand == lastSavedCommand. - ] - - emptyStack [ - - - undoStack clear - ] - - lastUndoCommand [ - - - ^ undoStack lastUndoCommand - ] - - textSaved [ - - - textSaved := true. - lastCommand := nil. - lastSavedCommand := undoStack lastUndoCommand - ] - - buffer [ - - - ^ textWidget getBuffer - ] - - buffer: aGtkTextBuffer [ - - - textWidget setBuffer: aGtkTextBuffer - ] - - showFind [ - - - replaceWidget hideAll. - findWidget showAll; grabFocus - ] - - showReplace [ - - - findWidget hideAll. - replaceWidget showAll; grabFocus - ] - - replace: aSearchString by: aReplaceString [ - - - lastCommand := ReplaceTextCommand replace: aSearchString by: aReplaceString on: self buffer. - undoStack push: lastCommand. - lastCommand := nil - ] - - copy [ - - - textWidget signalEmitByName: 'copy-clipboard' args: {} - ] - - cut [ - - - textWidget signalEmitByName: 'cut-clipboard' args: {} - ] - - paste [ - - - textWidget signalEmitByName: 'paste-clipboard' args: {}. - ] - - selectAll [ - - - textWidget signalEmitByName: 'select-all' args: {true}. - ] - - iterOfSelectedText [ - - - ^ textWidget getBuffer iterOfSelectedText - ] - - hasSelection [ - - - ^ self buffer getHasSelection - ] - - selectedMethodSymbol [ - - - ^ STInST.RBParser selectedSymbol: self selectedText - ] - - selectedText [ - - - ^ self buffer selectedText - ] - - clear [ - - - self text: '' - ] - - text [ - - - ^ self buffer text - ] - - text: aString [ - - - self buffer setText: aString - ] - - textview [ - - - ^ textWidget - ] - - cursorPosition [ - - - ^ self buffer propertiesAt: 'cursor-position' - ] - - cursorPosition: anInteger [ - - - ] - - selectRange: aStartInt bound: anEndInt [ - - - | start end | - start := self buffer getIterAtOffset: aStartInt. - end := self buffer getIterAtOffset: anEndInt. - self buffer selectRange: start bound: end - ] - - centerViewAtLine: anInteger [ - - - | mark iter | - iter := self buffer getIterAtLine: anInteger. - mark := GTK.GtkTextMark new: nil leftGravity: false. - self buffer addMark: mark where: iter. - textWidget scrollMarkOnscreen: mark. - ] - - beforeEvaluation [ - - ] - - afterEvaluation [ - - ] - - doWithoutForkIt: object [ - - - | result method | - self beforeEvaluation. - method := object class - compile: 'Doit [ ^ [ ', self selectedText , ' ] value ]' - ifError: [ :fname :lineNo :errorString | self error: errorString ]. - object class removeSelector: #Doit ifAbsent: []. - result := object perform: method. - self afterEvaluation. - ^ result - ] - - doIt: object [ - - - TaskQueue uniqueInstance add: [ self doWithoutForkIt: object ] - ] - - debugIt: object [ - - - self beforeEvaluation. - object class - compile: ('Doit [ ^ [ ', self selectedText , ' ] value ]') - ifError: [ :fname :lineNo :errorString | - self error: errorString ]. - (GtkDebugger open) - doItProcess: [ object perform: #Doit ] newProcess - ] - - inspectIt: object [ - - - TaskQueue uniqueInstance add: [ GtkInspector openOn: (self doWithoutForkIt: object) ] - ] - - printIt: object [ - - - TaskQueue uniqueInstance add: - [ | iter start end result | - iter := self buffer iterOfSelectedText second. - result := ' ', ((self doWithoutForkIt: object) displayString), ' '. - self buffer insertInteractive: iter text: result len: result size defaultEditable: true. - start := self buffer getIterAtOffset: (iter getOffset - result size). - end := self buffer getIterAtOffset: (iter getOffset). - self buffer selectRange: start bound: end ] - ] -] - diff --git a/packages/visualgst/package.xml b/packages/visualgst/package.xml index f2c37d2..4fc96eb 100644 --- a/packages/visualgst/package.xml +++ b/packages/visualgst/package.xml @@ -153,6 +153,7 @@ Menus/SmalltalkMenus.st Menus/ToolsMenus.st Menus/HistoryMenus.st + Menus/HistorySelectionMenus.st Menus/TabsMenus.st Menus/InspectorMenus.st Menus/TextMenus.st @@ -164,29 +165,42 @@ Category/AbstractNamespace.st Category/Class.st GtkConcreteWidget.st - GtkScrollTreeWidget.st + Widget/Widget.st + Widget/Compoment.st + Widget/Label.st + Widget/Entry.st + Widget/Paned.st + Widget/HPaned.st + Widget/VPaned.st + Widget/Box.st + Widget/HBox.st + Widget/VBox.st + Widget/Notebook.st + Widget/Sidebar.st + Widget/HSidebar.st + Widget/VSidebar.st + Widget/List.st + Widget/Tree.st + Widget/Window.st + Widget/Text/GtkTextPluginWidget.st + Widget/Text/GtkFindWidget.st + Widget/Text/GtkReplaceWidget.st + Widget/Text/GtkSaveTextWidget.st + Widget/Text/GtkTextWidget.st + Widget/Text/GtkSourceCodeWidget.st + Gtk/GtkScrollTreeWidget.st GtkSimpleListWidget.st GtkEntryWidget.st - GtkSidebarWidget.st - GtkHSidebarWidget.st - GtkVSidebarWidget.st Model/GtkColumnType.st Model/GtkColumnTextType.st Model/GtkColumnPixbufType.st Model/GtkColumnOOPType.st - GtkListModel.st - GtkTreeModel.st - Text/GtkTextWidget.st + Gtk/GtkListModel.st + Gtk/GtkTreeModel.st GtkPackageBuilderWidget.st - GtkMainWindow.st GtkVisualGSTTool.st GtkBrowsingTool.st GtkLauncher.st - Text/GtkTextPluginWidget.st - Text/GtkFindWidget.st - Text/GtkReplaceWidget.st - Text/GtkSaveTextWidget.st - GtkNotebookWidget.st Image/GtkImageModel.st Image/GtkImageWidget.st Debugger/Extensions.st @@ -203,7 +217,6 @@ StBrowser/GtkCategorizedClassWidget.st StBrowser/GtkCategoryWidget.st StBrowser/GtkMethodWidget.st - Text/GtkSourceCodeWidget.st StBrowser/GtkClassHierarchyWidget.st GtkHistoryWidget.st Inspector/Extensions.st @@ -248,16 +261,16 @@ Inspector/GtkInspectorSourceWidget.st Inspector/GtkInspectorBrowserWidget.st Inspector/GtkInspectorWidget.st - Inspector/GtkObjectInspectorView.st - Inspector/GtkCompiledMethodInspectorView.st - Inspector/GtkCompiledBlockInspectorView.st - Inspector/GtkSequenceableCollectionInspectorView.st - Inspector/GtkSetInspectorView.st - Inspector/GtkDictionaryInspectorView.st - Inspector/GtkCharacterInspectorView.st - Inspector/GtkContextInspectorView.st - Inspector/GtkIntegerInspectorView.st - Inspector/GtkFloatInspectorView.st + Inspector/View/GtkObjectInspectorView.st + Inspector/View/GtkCompiledMethodInspectorView.st + Inspector/View/GtkCompiledBlockInspectorView.st + Inspector/View/GtkSequenceableCollectionInspectorView.st + Inspector/View/GtkSetInspectorView.st + Inspector/View/GtkDictionaryInspectorView.st + Inspector/View/GtkCharacterInspectorView.st + Inspector/View/GtkContextInspectorView.st + Inspector/View/GtkIntegerInspectorView.st + Inspector/View/GtkFloatInspectorView.st Implementors/GtkImageResultsWidget.st Implementors/GtkImplementorResultsWidget.st Implementors/GtkSenderResultsWidget.st @@ -283,8 +296,8 @@ Tetris/Tetris.st SUnit/TestBacktraceLog.st SUnit/GtkSUnitResultWidget.st - GtkClassSUnitWidget.st - GtkMethodSUnitWidget.st + SUnit/GtkClassSUnitWidget.st + SUnit/GtkMethodSUnitWidget.st SUnit/GtkSUnit.st Commands/OpenBrowserCommand.st Commands/OpenTabbedBrowserCommand.st @@ -392,29 +405,16 @@ Category/AbstractNamespace.st Category/Class.st GtkConcreteWidget.st - GtkScrollTreeWidget.st GtkSimpleListWidget.st GtkEntryWidget.st - GtkSidebarWidget.st - GtkHSidebarWidget.st - GtkVSidebarWidget.st Model/GtkColumnType.st Model/GtkColumnTextType.st Model/GtkColumnPixbufType.st Model/GtkColumnOOPType.st - GtkListModel.st - GtkTreeModel.st - Text/GtkTextWidget.st GtkPackageBuilderWidget.st - GtkMainWindow.st GtkVisualGSTTool.st GtkBrowsingTool.st GtkLauncher.st - Text/GtkTextPluginWidget.st - Text/GtkFindWidget.st - Text/GtkReplaceWidget.st - Text/GtkSaveTextWidget.st - GtkNotebookWidget.st Image/GtkImageModel.st Image/GtkImageWidget.st Debugger/Extensions.st @@ -431,10 +431,8 @@ StBrowser/GtkCategorizedClassWidget.st StBrowser/GtkCategoryWidget.st StBrowser/GtkMethodWidget.st - Text/GtkSourceCodeWidget.st StBrowser/GtkClassHierarchyWidget.st GtkHistoryWidget.st - Inspector/GtkInspector.st StBrowser/GtkClassBrowserWidget.st GtkEntryDialog.st HistoryStack.st @@ -475,19 +473,6 @@ Undo/Text/DeleteTextCommand.st Undo/Text/ReplaceTextCommand.st Clock/GtkClock.st - Inspector/Extensions.st - Inspector/GtkInspectorSourceWidget.st - Inspector/GtkInspectorBrowserWidget.st - Inspector/GtkInspectorWidget.st - Inspector/GtkObjectInspectorView.st - Inspector/GtkCompiledMethodInspectorView.st - Inspector/GtkCompiledBlockInspectorView.st - Inspector/GtkSequenceableCollectionInspectorView.st - Inspector/GtkSetInspectorView.st - Inspector/GtkDictionaryInspectorView.st - Inspector/GtkCharacterInspectorView.st - Inspector/GtkIntegerInspectorView.st - Inspector/GtkFloatInspectorView.st Implementors/GtkImageResultsWidget.st Implementors/GtkImplementorResultsWidget.st Implementors/GtkSenderResultsWidget.st @@ -511,11 +496,6 @@ Tetris/TetrisPieceT.st Tetris/TetrisPieceZ.st Tetris/Tetris.st - SUnit/TestBacktraceLog.st - SUnit/GtkSUnitResultWidget.st - GtkClassSUnitWidget.st - GtkMethodSUnitWidget.st - SUnit/GtkSUnit.st Commands/OpenBrowserCommand.st Commands/OpenTabbedBrowserCommand.st Commands/ToolsMenus/OpenSUnitCommand.st -- 1.8.3.2