forked from bonzini/gst-visualgst
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GtkLauncher.st
988 lines (736 loc) · 24.2 KB
/
GtkLauncher.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
GtkVisualGSTTool subclass: GtkLauncher [
GtkLauncher class [ | uniqueInstance | ]
| leftSidebar rightSidebar topSidebar packageBuilderWidget implementorResultWidget senderResultWidget senderWidget implementorWidget historyWidget browsers outputs saved imageName transcriptWidget windowsMenu systemChangeNotifier |
GtkLauncher class >> uniqueInstance [
<category: 'public'>
uniqueInstance ifNil: [ self createInstance ].
^ uniqueInstance
]
GtkLauncher class >> / path [
<category: 'files'>
^ (PackageLoader packageAt: 'VisualGST') / path
]
GtkLauncher class >> uniqueInstance: anObject [
<category: 'private'>
(uniqueInstance notNil and: [ anObject notNil ])
ifTrue: [ self error: 'cannot override uniqueInstance' ].
uniqueInstance := anObject
]
GtkLauncher class >> createInstance [
<category: 'private'>
^ (uniqueInstance := self basicNew)
initialize;
showAll;
postInitialize;
resize: 1024@600;
yourself
]
GtkLauncher class >> instanceCreationErrorString [
<category: 'private'>
^ 'This is a singleton implementation, so you are not allowed to create instances yourself. Use #uniqueInstance to access the instance.'
]
GtkLauncher class >> new [
<category: 'instance creation'>
^ self error: self instanceCreationErrorString
]
GtkLauncher class >> exit [
<category: 'exit'>
GTK.Gtk mainQuit.
ObjectMemory quit
]
GtkLauncher class >> open [
<category: 'user interface'>
self uniqueInstance
]
GtkLauncher class >> displayError: title message: error [
<category: 'error'>
| dialog |
dialog := GTK.GtkMessageDialog
new: nil
flags: GTK.Gtk gtkDialogDestroyWithParent
type: GTK.Gtk gtkMessageWarning
buttons: GTK.Gtk gtkButtonsNone
message: 'Error'
tip: error.
dialog
addButton: 'Ok' responseId: 1;
showModalOnAnswer: [ :dlg :res | dlg destroy ].
]
GtkLauncher class >> displayError: error [
^self displayError: 'Error' message: error
]
GtkLauncher class >> compileError: aString line: anInteger [
self uniqueInstance compileError: aString line: anInteger
]
accelPath [
<category: 'accelerator path'>
^ '<VisualGST>'
]
classBrowser [
<category: 'tools events'>
| widget |
browsers addWidget: (widget := self buildClassBrowserWidget) labeled: 'Browser'.
browsers showLastPage.
widget postInitialize.
^ widget
]
newWorkspace [
<category: 'tools events'>
^self newWorkspaceLabeled: 'Workspace'
]
newWorkspaceLabeled: aString [
<category: 'tools events'>
| widget |
widget := self buildWorkspaceWidget showAll.
widget postInitialize.
outputs addWidget: widget labeled: aString.
outputs showLastPage.
^widget
]
onDelete: aGtkWidget event: aGdkEvent [
<category: 'window events'>
self quit.
^ true
]
quit [
<category: 'file events'>
| dialog |
dialog := GTK.GtkMessageDialog
new: window
flags: GTK.Gtk gtkDialogDestroyWithParent
type: GTK.Gtk gtkMessageWarning
buttons: GTK.Gtk gtkButtonsNone
message: 'Save the image before exiting?'
tip: 'The image hosts all the code changes that you made %<since the last save|since starting VisualGST>1. Unless you exported these changes, not saving the image will lose them.' % {saved}.
dialog
addButton: 'Exit without saving' responseId: 0;
addButton: 'Cancel' responseId: 2;
addButton: 'Save image' responseId: 1;
setDefaultResponse: 2;
showModalOnAnswer: [ :dlg :res |
res = 0 ifTrue: [ self class exit ].
res = 1 ifTrue: [ self saveImageAndQuit ].
dlg destroy ].
]
open [
<category: 'file events'>
| file string |
(GTK.GtkFileChooserDialog load: 'Load Smalltalk source' parent: window)
showModalOnAnswer: [ :dlg :res |
res = GTK.Gtk gtkResponseAccept
ifTrue: [ file := File name: dlg getFilename.
FileStream open: dlg getFilename mode: FileStream read.
(self newWorkspaceLabeled: file stripPath) text: file contents ].
dlg destroy ]
]
save [
<category: 'file events'>
]
saveAs [
<category: 'file events'>
| file |
(GTK.GtkFileChooserDialog save: 'Save Smalltalk source as...' parent: window)
showModalOnAnswer: [ :dlg :res |
res = GTK.Gtk gtkResponseAccept
ifTrue: [ file := FileStream open: dlg getFilename mode: FileStream write.
file nextPutAll: outputs currentWidget text ].
dlg destroy ]
]
print [
<category: 'file events'>
]
saveImageAndQuit [
<category: 'file events'>
"ObjectMemory>>#snapshot breaks hard links due to
http://bugzilla.kernel.org/show_bug.cgi?id=9138, so we have to
check the permission of the directory rather than the file."
imageName ifNil: [ ^ self saveImageAs ].
imageName asFile parent isWriteable ifFalse: [ self saveImageAsAndQuit ].
self saveImage: [ ObjectMemory snapshot: imageName. self class exit ]
]
saveImage [
<category: 'file events'>
"ObjectMemory>>#snapshot breaks hard links due to
http://bugzilla.kernel.org/show_bug.cgi?id=9138, so we have to
check the permission of the directory rather than the file."
imageName asFile parent isWriteable ifFalse: [ ^ self saveImageAs ].
self saveImage: [ ObjectMemory snapshot: imageName ]
]
saveImageAs [
<category: 'file events'>
(GTK.GtkFileChooserDialog save: 'Save image as...' parent: window)
showModalOnAnswer: [ :dlg :res |
imageName := dlg getFilename.
dlg destroy.
res = GTK.Gtk gtkResponseAccept ifTrue: [ self saveImage: [ ObjectMemory snapshot: imageName ] ] ]
]
saveImageAsAndQuit [
<category: 'file events'>
(GTK.GtkFileChooserDialog save: 'Save image as...' parent: window)
showModalOnAnswer: [ :dlg :res |
imageName := dlg getFilename.
dlg destroy.
res = GTK.Gtk gtkResponseAccept ifTrue: [ self saveImage: [ ObjectMemory snapshot: imageName ]. self class exit ] ]
]
saveImage: aBlock [
| oldMessage oldNotifier oldCatIcon oldNameIcon |
oldNotifier := self systemChangeNotifier.
oldMessage := Transcript message.
oldCatIcon := ClassCategory icon.
ClassCategory icon: nil.
oldNameIcon := AbstractNamespace icon.
AbstractNamespace icon: nil.
Transcript message: stdout->#nextPutAllFlush:.
SystemChangeNotifier root remove: oldNotifier.
systemChangeNotifier := nil.
self class uniqueInstance: nil.
(saved := aBlock value not) ifTrue: [
self class uniqueInstance: self.
ClassCategory icon: oldCatIcon.
AbstractNamespace icon: oldNameIcon.
systemChangeNotifier := oldNotifier.
SystemChangeNotifier root add: oldNotifier.
Transcript message: oldMessage ]
]
systemChangeNotifier [
<category: 'notifications'>
^ systemChangeNotifier
]
clearGlobalState [
<category: 'initialization cleanup'>
]
initialize [
<category: 'initialization'>
saved := false.
imageName := File image asString.
systemChangeNotifier := SystemChangeNotifier new.
SystemChangeNotifier root add: systemChangeNotifier.
self clearGlobalState.
super initialize.
window maximize.
window setIcon: (GTK.GdkPixbuf newFromFile: (self class / 'Icons/visualgst.png') file displayString error: nil).
self subscribe
]
subscribe [
<category: 'initialization'>
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]
]
windowTitle [
<category: 'widget'>
^ 'VisualGST'
]
browserPostInitialize [
<category: 'initialization'>
browsers grabFocus.
browsers currentWidget postInitialize.
browsers currentWidget selectANamespace: Smalltalk.
browsers currentWidget selectAClass: Object.
outputs hideAll
]
postInitialize [
<category: 'initialization'>
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:'
]
buildNotebookWorkspaceWidget [
<category: 'user interface'>
outputs := GtkNotebookWidget new
initialize;
parentWindow: window;
showAll;
yourself.
^ outputs
addPermanentWidget: (transcriptWidget := self buildTranscriptWidget) labeled: 'Transcript';
addWidget: self buildWorkspaceWidget labeled: 'Workspace';
yourself
]
buildCentralWidget [
<category: 'intialize-release'>
^ self buildBrowserAndWorkspaceWidget
]
buildImplementorPaned [
<category: 'user interface'>
leftSidebar := GtkHSidebarWidget new
initialize;
addAll: {self buildImplementorView -> 'Implementor'. self buildSenderView -> 'Sender'. self buildHistoryView -> 'History'};
yourself.
self registerLeftPaneEvents.
^ leftSidebar mainWidget
]
buildPackageBuilderView [
<category: 'user interface'>
packageBuilderWidget := GtkPackageBuilderWidget new
initialize;
yourself.
^ packageBuilderWidget mainWidget
]
buildRightSidebarPaned [
<category: 'user interface'>
rightSidebar := GtkHSidebarWidget new
initialize;
addAll: {self buildPackageBuilderView -> 'Package Builder'};
yourself.
^ rightSidebar mainWidget
]
buildBrowserAndWorkspaceWidget [
<category: 'intialize-release'>
^ GTK.GtkVPaned addAll: {
GTK.GtkHPaned addAll: {self buildImplementorPaned. self buildBottomPanedAndClassBrowser. self buildRightSidebarPaned}.
self buildNotebookWorkspaceWidget mainWidget}
]
buildImplementorView [
<category: 'user interface'>
implementorWidget := self buildImageView
whenSelectionChangedSend: #implementorSelected to: self;
yourself.
^ implementorWidget mainWidget
]
buildSenderView [
<category: 'user interface'>
senderWidget := self buildImageView
whenSelectionChangedSend: #senderSelected to: self;
yourself.
^ senderWidget mainWidget
]
buildImageView [
<category: 'user interface'>
^ GtkImageWidget new
initialize;
yourself
]
buildHistoryView [
<category: 'user interface'>
historyWidget := GtkHistoryWidget new
browser: self;
yourself.
^ historyWidget mainWidget
]
buildImplementorResultList [
<category: 'user interface'>
^ implementorResultWidget := GtkImplementorResultsWidget new
initialize;
whenSelectionChangedSend: #resultImplementorSelected to: self;
yourself
]
buildSenderResultList [
<category: 'user interface'>
^ senderResultWidget := GtkSenderResultsWidget new
initialize;
whenSelectionChangedSend: #resultSenderSelected to: self;
yourself
]
buildTopSidebar [
<category: 'user interface'>
topSidebar := GtkHSidebarWidget new
initialize;
addAll: {self buildImplementorResultList mainWidget -> ''. self buildSenderResultList mainWidget -> ''};
hideTabs;
yourself.
^ topSidebar mainWidget
]
buildBottomPanedAndClassBrowser [
<category: 'user interface'>
^ GTK.GtkVPaned addAll: {self buildTopSidebar. self buildClassBrowserTabbedWidget mainWidget}
]
buildClassBrowserTabbedWidget [
<category: 'user interface'>
^ (browsers := GtkNotebookWidget parentWindow: window)
showAll;
whenSelectionChangedSend: #historyChanged to: self;
addWidget: self buildClassBrowserWidget labeled: 'Browser';
yourself
]
buildClassBrowserWidget [
<category: 'user interface'>
^ (GtkClassBrowserWidget parentWindow: window)
launcher: self;
yourself
]
buildTranscriptWidget [
<category: 'user interface'>
^ GtkTranscriptWidget parentWindow: window
]
buildWorkspaceWidget [
<category: 'user interface'>
^ GtkWorkspaceWidget parentWindow: window
]
registerLeftPaneEvents [
<category: 'user interface'>
leftSidebar
whenWidgetIsVisible: implementorWidget mainWidget send: #switchToImplementor to: self;
whenWidgetIsVisible: senderWidget mainWidget send: #switchToSender to: self;
whenWidgetIsVisible: historyWidget mainWidget send: #switchToHistory to: self.
]
createEditMenus [
<category: 'user interface'>
^ super createEditMenus, {
GTK.GtkMenuItem new.
GTK.GtkMenuItem menuItem: 'Clear Transcript' connectTo: self selector: #clearTranscriptWidget}
]
createNamespaceMenus [
<category: 'user interface'>
^ NamespaceMenus browserBuildOn: self
]
createClassMenus [
<category: 'user interface'>
^ ClassMenus browserBuildOn: self
]
createCategoryMenus [
<category: 'user interface'>
^ CategoryMenus browserBuildOn: self
]
createMethodMenus [
<category: 'user interface'>
^ MethodMenus browserBuildOn: self
]
createFileMenus [
<category: 'user interface'>
self accelGroup append:
{{'<Control>O'. '<GtkLauncher>/File/Open'}.
{'<Control><Shift>S'. '<GtkLauncher>/File/SaveAs'}.
{'<Control>Q'. '<GtkLauncher>/File/Quit'}}.
^{GTK.GtkMenuItem menuItem: 'New workspace' connectTo: self selector: #newWorkspace.
GTK.GtkMenuItem new.
GTK.GtkMenuItem menuItem: 'Open' accelPath: '<GtkLauncher>/File/Open' connectTo: self selector: #open.
GTK.GtkMenuItem menuItem: 'Save' connectTo: self selector: #save.
GTK.GtkMenuItem menuItem: 'Save as...' accelPath: '<GtkLauncher>/File/SaveAs' connectTo: self selector: #saveAs.
GTK.GtkMenuItem new}, super createFileMenus
]
createHistoryMenus [
<category: 'user interface'>
^ HistoryMenus browserBuildOn: self
]
createTabsMenus [
<category: 'user interface'>
^ TabsMenus browserBuildOn: self
]
createToolbar [
<category: 'user interface'>
self
appendToolItem: ((GTK.GtkToolButton newFromStock: 'gtk-new')
connectSignal: 'clicked' to: self selector: #newWorkspace;
setTooltipText: 'Create a new workspace';
yourself).
super createToolbar
]
createMenus [
<category: 'user interface'>
self createMainMenu: {#('File' #createFileMenus).
#('Edit' #createEditMenus).
#('History' #createHistoryMenus).
#('Namespace' #createNamespaceMenus).
#('Class' #createClassMenus).
#('Category' #createCategoryMenus).
#('Method' #createMethodMenus).
#('Smalltalk' #createSmalltalkMenus).
#('Tools' #createToolsMenus).
#('Tabs' #createTabsMenus).
#('Help' #createHelpMenus)}
]
createToolsMenus [
<category: 'user interface'>
self accelGroup append: {{'<Control>B'. '<GtkLauncher>/Tools/TabbedClassBrowser'}}.
^{GTK.GtkMenuItem menuItem: 'Browser' accelPath: '<GtkLauncher>/Tools/TabbedClassBrowser' connectTo: self selector: #newTabbedBrowser},
super createToolsMenus.
]
newTabbedBrowser [
<category: 'tools events'>
OpenTabbedBrowserCommand executeOn: self
]
launcher [
<category: 'accessing'>
^ self
]
cancel [
<category: 'edit events'>
self onFocusPerform: #cancel
]
undo [
<category: 'edit events'>
self onFocusPerform: #undo
]
redo [
<category: 'edit events'>
self onFocusPerform: #redo
]
cut [
<category: 'edit events'>
self onFocusPerform: #cut
]
copy [
<category: 'edit events'>
self onFocusPerform: #copy
]
paste [
<category: 'edit events'>
self onFocusPerform: #paste
]
selectAll [
<category: 'edit events'>
self onFocusPerform: #selectAll
]
find [
<category: 'edit events'>
self onFocusPerform: #showFind
]
replace [
<category: 'edit events'>
self onFocusPerform: #showReplace
]
clearTranscriptWidget [
<category: 'edit events'>
transcriptWidget clear
]
focusedWidget [
<category: 'focus'>
^browsers focusedWidget ifNil: [ outputs focusedWidget ]
]
browserHasFocus [
<category: 'testing'>
^ browsers hasFocus
]
sourceCodeWidgetHasFocus [
<category: 'focus'>
^ browsers currentWidget sourceCodeWidgetHasFocus
]
state [
<category: 'focus'>
browsers currentWidget ifNil: [ ^ BrowserState new ].
^ browsers currentWidget state
]
selectedText [
<category: 'smalltalk events'>
^ self onFocusPerform: #selectedText
]
selectedMethodSymbol [
<category: 'text editing'>
^ self onFocusPerform: #selectedMethodSymbol
]
hasSelection [
<category: 'smalltalk events'>
| widget |
widget := self focusedWidget.
^ widget notNil and: [widget hasSelection]
]
targetObject [
<category: 'smalltalk events'>
^ self onFocusPerform: #targetObject
]
doIt: anObject [
<category: 'smalltalk events'>
self onFocusPerform: #doIt: with: anObject
]
printIt: anObject [
<category: 'smalltalk events'>
self onFocusPerform: #printIt: with: anObject
]
inspectIt: anObject [
<category: 'smalltalk events'>
self onFocusPerform: #inspectIt: with: anObject
]
debugIt: anObject [
<category: 'smalltalk events'>
self onFocusPerform: #debugIt: with: anObject
]
acceptIt [
<category: 'smalltalk events'>
browsers currentWidget acceptIt
]
codeSaved [
<category: 'code saved'>
browsers currentWidget codeSaved
]
clearUndo [
<category: 'code saved'>
browsers currentWidget clearUndo
]
sourceCode [
<category: 'code saved'>
^ browsers currentWidget sourceCode
]
showImplementorOn: aSymbol [
<category: 'image events'>
(self showHideWithSelectorOn: implementorWidget at: 1)
ifTrue: [ self imageSelectorForImplementor: aSymbol ]
]
showHideImplementor [
<category: 'image events'>
self showHideOn: implementorWidget at: 1
]
showSenderOn: aSymbol [
<category: 'image events'>
(self showHideWithSelectorOn: senderWidget at: 2)
ifTrue: [ self imageSelectorForSender: aSymbol ]
]
showHideSender [
<category: 'image events'>
self showHideOn: senderWidget at: 2
]
hideSidebars [
leftSidebar hide.
topSidebar hide.
rightSidebar hide.
]
showHideOn: aGtkWidget at: anIndex [
| 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 ].
self hideSidebars.
isVisible
ifFalse: [
topSidebar show: anIndex.
leftSidebar show: anIndex ]
]
showHideWithSelectorOn: aGtkWidget at: anIndex [
<category: 'image events'>
| isVisible |
isVisible := aGtkWidget isVisible.
self hideSidebars.
isVisible ifTrue: [ ^ false ].
leftSidebar show: anIndex.
topSidebar show: anIndex.
^ true
]
showHidePackageBuilder [
<category: 'image events'>
| isVisible |
isVisible := packageBuilderWidget isVisible.
self hideSidebars.
isVisible
ifFalse: [
rightSidebar show: 1 ]
]
showHideBottomPane [
<category: 'image events'>
outputs isVisible
ifTrue: [ outputs hideAll ]
ifFalse: [ outputs showPane ]
]
back [
<category: 'history events'>
browsers currentWidget back
]
forward [
<category: 'history events'>
browsers currentWidget forward
]
showHideHistory [
<category: 'history events'>
| isVisible |
isVisible := historyWidget isVisible.
leftSidebar hide.
topSidebar hide.
isVisible ifFalse: [ leftSidebar show: 3 ]
]
historyChanged [
<category: 'public'>
self currentWidgetOfBrowser ifNotNil: [ :w |
historyWidget refresh: w historyStack ]
]
previousTab [
<category: 'tabs events'>
browsers currentPage > 0
ifTrue: [ browsers currentPage: browsers currentPage - 1 ]
ifFalse: [ browsers currentPage: browsers numberOfPages - 1 ]
]
nextTab [
<category: 'tabs events'>
browsers currentPage: (browsers currentPage + 1 \\ browsers numberOfPages)
]
closeTab [
self close
]
close [
<category: 'tabs events'>
browsers numberOfPages > 1
ifTrue: [ browsers currentWidget checkCodeWidgetAndUpdate: [ browsers closeCurrentPage ] ]
ifFalse: [ browsers closeCurrentPage ].
]
currentWidgetOfBrowser [
<category: 'browsers'>
^ browsers currentWidget
]
notebookHasFocus [
<category: 'testing'>
^ outputs hasFocus
]
switchToImplementor [
<category: 'pane events'>
implementorWidget isVisible ifFalse: [ ^ self ].
topSidebar show: 1
]
switchToSender [
<category: 'pane events'>
senderWidget isVisible ifFalse: [ ^ self ].
topSidebar show: 2
]
switchToHistory [
<category: 'pane events'>
historyWidget isVisible ifFalse: [ ^ self ].
topSidebar hideAll
]
senderSelected [
<category: 'pane events'>
senderWidget hasSelection ifFalse: [ ^ self ].
self findInMethod: (senderWidget matchSelector: senderWidget selection) values first element
]
implementorSelected [
<category: 'pane events'>
implementorWidget hasSelection ifFalse: [ ^ self ].
self imageSelectorForImplementor: implementorWidget selection
]
senderSelected [
<category: 'pane events'>
senderWidget hasSelection ifFalse: [ ^ self ].
self imageSelectorForSender: senderWidget selection
]
imageSelectorForImplementor: aSymbol [
<category: 'pane events'>
implementorResultWidget appendImplementorResults: (implementorWidget matchSelector: aSymbol)
]
imageSelectorForSender: aSymbol [
<category: 'pane events'>
senderResultWidget appendSenderResults: (senderWidget matchSelector: aSymbol)
]
resultImplementorSelected [
<category: 'pane events'>
implementorResultWidget selectedResult: self currentWidgetOfBrowser
]
resultSenderSelected [
<category: 'pane events'>
senderResultWidget selectedResult: self currentWidgetOfBrowser
]
keyPressedOn: aGtkWidget keyEvent: aGdkEventKey [
<category: 'key event'>
| event |
event := aGdkEventKey castTo: GTK.GdkEventKey type.
event keyval value = 65473 ifTrue: [ self showHideBottomPane. ^ true ].
(event state value bitAnd: GTK.Gdk gdkControlMask) = 0 ifTrue: [ ^ false ].
(#(65417 65289 65056) includes: event keyval value) ifFalse: [ ^ false ].
(event state value bitAnd: GTK.Gdk gdkShiftMask) = 0
ifFalse: [ self previousTab ]
ifTrue: [ self nextTab ].
^ true
]
selectAnInstanceMethod: aMethod [
browsers currentWidget selectAnInstanceMethod: aMethod
]
selectAClassMethod: aMethod [
browsers currentWidget selectAClassMethod: aMethod
]
compileError: aString line: anInteger [
browsers currentWidget compileError: aString line: anInteger
]
]