16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Interface-Workspace' |
17 category:'Interface-Workspace' |
18 ! |
18 ! |
19 |
19 |
20 CodeView comment:' |
20 CodeView comment:' |
21 |
|
22 COPYRIGHT (c) 1989 by Claus Gittinger |
21 COPYRIGHT (c) 1989 by Claus Gittinger |
23 All Rights Reserved |
22 All Rights Reserved |
24 |
23 |
25 $Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.8 1994-06-03 14:51:20 claus Exp $ |
24 $Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.9 1994-08-07 13:21:14 claus Exp $ |
26 written winter-89 by claus |
|
27 '! |
25 '! |
28 |
26 |
29 !CodeView class methodsFor:'documentation'! |
27 !CodeView class methodsFor:'documentation'! |
|
28 |
|
29 copyright |
|
30 " |
|
31 COPYRIGHT (c) 1989 by Claus Gittinger |
|
32 All Rights Reserved |
|
33 |
|
34 This software is furnished under a license and may be used |
|
35 only in accordance with the terms of that license and with the |
|
36 inclusion of the above copyright notice. This software may not |
|
37 be provided or otherwise made available to, or used by, any |
|
38 other person. No title to or ownership of the software is |
|
39 hereby transferred. |
|
40 " |
|
41 ! |
|
42 |
|
43 version |
|
44 " |
|
45 $Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.9 1994-08-07 13:21:14 claus Exp $ |
|
46 " |
|
47 ! |
30 |
48 |
31 documentation |
49 documentation |
32 " |
50 " |
33 a view for code which can recompile its contents. It adds accept and explain |
51 a view for code which can recompile its contents. It adds accept and explain |
34 to the menu, and defines two actions: acceptAction to be performed for accept |
52 to the menu, and defines two actions: acceptAction to be performed for accept |
35 and explainAction to be performed for explain. |
53 and explainAction to be performed for explain. |
36 |
54 |
37 These actions are to be defined by the user of this view (i.e. the surrounding browser) |
55 These actions are to be defined by the user of this view |
|
56 (i.e. ususally the owning browser) |
38 " |
57 " |
39 ! ! |
58 ! ! |
40 |
59 |
41 !CodeView methodsFor:'initialization'! |
60 !CodeView methodsFor:'initialization'! |
42 |
61 |
43 initializeMiddleButtonMenu |
62 initializeMiddleButtonMenu |
44 self middleButtonMenu:(PopUpMenu |
63 |sub idx| |
45 labels: (resources array:#( |
|
46 " |
|
47 'undo' |
|
48 " |
|
49 'again' |
|
50 '-' |
|
51 'copy' |
|
52 'cut' |
|
53 'paste' |
|
54 '-' |
|
55 'doIt' |
|
56 'printIt' |
|
57 'inspectIt' |
|
58 '-' |
|
59 'accept' |
|
60 '-' |
|
61 'others' |
|
62 )) |
|
63 selectors:#( |
|
64 " |
|
65 undo |
|
66 " |
|
67 again |
|
68 nil |
|
69 copySelection |
|
70 cut |
|
71 paste |
|
72 nil |
|
73 doIt |
|
74 printIt |
|
75 inspectIt |
|
76 nil |
|
77 accept |
|
78 nil |
|
79 others |
|
80 ) |
|
81 receiver:self |
|
82 for:self). |
|
83 |
64 |
84 middleButtonMenu subMenuAt:#others put:(PopUpMenu |
65 super initializeMiddleButtonMenu. |
85 labels:(resources array:#( |
66 |
86 'search ...' |
67 " |
87 'goto ...' |
68 codeViews do support #accept |
88 '-' |
69 " |
89 'explain' |
70 idx := middleButtonMenu indexOf:#inspectIt. |
90 '-' |
71 idx ~~ 0 ifTrue:[ |
91 'font ...' |
72 middleButtonMenu addLabel:'-' |
92 '-' |
73 selector:nil |
93 'indent' |
74 after:idx. |
94 '-' |
75 middleButtonMenu addLabel:(resources string:'accept') |
95 'save as ...' |
76 selector:#accept |
96 'print' |
77 after:idx + 1. |
97 )) |
78 ]. |
98 selectors:#( |
79 |
99 search |
80 sub := middleButtonMenu subMenuAt:#others. |
100 gotoLine |
81 idx := sub indexOf:#gotoLine. |
101 nil |
82 sub addLabel:'-' |
102 explain |
83 selector:nil |
103 nil |
84 after:idx. |
104 changeFont |
85 sub addLabel:(resources string:'explain') |
105 nil |
86 selector:#explain |
106 indent |
87 after:idx + 1. |
107 nil |
|
108 save |
|
109 print |
|
110 ) |
|
111 receiver:self |
|
112 for:self). |
|
113 |
88 |
114 self enableOrDisableSelectionMenuEntries |
89 self enableOrDisableSelectionMenuEntries |
115 ! ! |
90 ! ! |
116 |
91 |
117 !CodeView methodsFor:'accessing'! |
92 !CodeView methodsFor:'accessing'! |
137 !CodeView methodsFor:'selections'! |
112 !CodeView methodsFor:'selections'! |
138 |
113 |
139 disableSelectionMenuEntries |
114 disableSelectionMenuEntries |
140 "disable relevant menu entries for a selection" |
115 "disable relevant menu entries for a selection" |
141 |
116 |
142 super disableSelectionMenuEntries. |
117 middleButtonMenu notNil ifTrue:[ |
143 middleButtonMenu disable:#explain |
118 super disableSelectionMenuEntries. |
|
119 middleButtonMenu disable:#explain |
|
120 ] |
144 ! |
121 ! |
145 |
122 |
146 enableSelectionMenuEntries |
123 enableSelectionMenuEntries |
147 "enable relevant menu entries for a selection" |
124 "enable relevant menu entries for a selection" |
148 |
125 |
149 super enableSelectionMenuEntries. |
126 middleButtonMenu notNil ifTrue:[ |
150 middleButtonMenu enable:#explain |
127 super enableSelectionMenuEntries. |
|
128 middleButtonMenu enable:#explain |
|
129 ] |
151 ! ! |
130 ! ! |
152 |
131 |
153 !CodeView methodsFor:'user actions'! |
132 !CodeView methodsFor:'user actions'! |
154 |
133 |
155 accept |
134 accept |