diff -r 4f78683e96ac -r 7a948179f949 BrowserView.st --- a/BrowserView.st Sun Mar 07 16:05:27 1999 +0100 +++ b/BrowserView.st Sun Mar 07 17:20:02 1999 +0100 @@ -1377,13 +1377,20 @@ itemList:items resources:resources. - Smalltalk sourceCodeManager isNil ifTrue:[ + (Smalltalk sourceCodeManager isNil) ifTrue:[ specialMenu disableAll:#(classCategoryRepositoryHistory classCategoryCheckinEach classCategoryValidateClassRevisions classCategoryLoadFromRepository ). ]. + (currentClassCategory = '* hierarchy *' + or:[currentClassCategory = '* obsolete *']) ifTrue:[ + specialMenu disableAll:#(classCategoryFileOutBinaryEach + classCategoryCheckinEach + classCategoryValidateClassRevisions + ). + ]. device ctrlDown ifTrue:[ ^ specialMenu @@ -1442,6 +1449,17 @@ m subMenuAt:#otherMenu put:specialMenu. m subMenuAt:#classHistoryMenu put:self classHistoryMenu. + + ((currentClassCategory = '* hierarchy *') + or:[currentClassCategory = '* obsolete *']) ifTrue:[ + m disableAll:#(classCategoryFileOut classCategoryFileOutAs classCategoryFileOutEach + classCategoryFileOutEachIn + classCategoryPrintOut classCategoryPrintOutProtocol + classCategoryRename classCategoryRemove) + ]. + (currentClassCategory = '* obsolete *') ifTrue:[ + m disableAll:#(classCategorySpawn classCategorySpawnFullClass) + ]. ^ m "Created: / 14.9.1995 / 10:50:17 / claus" @@ -3124,6 +3142,7 @@ items := #( ('new class' classNewClass Cmdn) ('new application' classNewApplication) + ('new dialog' classNewDialog) ). ] ifFalse:[ currentClass isLoaded ifFalse:[ @@ -3135,6 +3154,7 @@ ('-' nil ) ('new class' classNewClass Cmdn ) ('new application' classNewApplication ) + ('new dialog' classNewDialog ) ('remove...' classRemove ) ('-' nil ) ('load' classLoad Cmdl ) @@ -3203,6 +3223,7 @@ ('subclass' classNewSubclass ) ('private class' classNewPrivateClass ) ('application' classNewApplication ) + ('dialog' classNewDialog ) ) resources:resources. @@ -3285,6 +3306,21 @@ "Modified: 4.1.1997 / 14:52:16 / cg" ! +classNewDialog + "create a class-definition prototype for a dialog in codeview" + + |theClass cls| + + self + classClassDefinitionTemplateFor:SimpleDialog + in:currentClassCategory + namespace:false + private:false. + + aspect := nil. + +! + classNewPrivateClass "create a class-definition prototype in codeview" @@ -5279,21 +5315,23 @@ (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[ - nm := self displayedClassNameOf:aClass. - - (namesPresent includes:nm) ifFalse:[ - indent := String new:lvl*2. - - "/ show classes from other nameSpaces in italic - - (allNameSpaces not - and:[(self findClassNamedInNameSpace:nm) isNil]) ifTrue:[ - nm := nm asText emphasizeAllWith:#italic. - ]. - nm := indent , nm. - namesPresent add:nm. - listOfClassNames add:nm. - listOfClasses add:nm. + aClass isObsolete ifFalse:[ + nm := self displayedClassNameOf:aClass. + + (namesPresent includes:nm) ifFalse:[ + indent := String new:lvl*2. + + "/ show classes from other nameSpaces in italic + + (allNameSpaces not + and:[(self findClassNamedInNameSpace:nm) isNil]) ifTrue:[ + nm := nm asText emphasizeAllWith:#italic. + ]. + nm := indent , nm. + namesPresent add:nm. + listOfClassNames add:nm. + listOfClasses add:nm. + ] ] ] ]. @@ -7048,10 +7086,12 @@ methodCategoryCreateApplicationMethods "create an empty application framework" - |cls fn txt| + |cls fn txt isDialog| self checkClassSelected ifFalse:[^ self]. + isDialog := (currentClass isSubclassOf:SimpleDialog). + cls := currentClass class. self withBusyCursorDo:[ @@ -7061,7 +7101,73 @@ "/ with a menuPanel. (cls includesSelector:#windowSpec) ifFalse:[ - Compiler compile: + isDialog ifTrue:[ + txt := +'windowSpec + "This resource specification was automatically generated + by the Browser." + + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." + + " + UIPainter new openOnClass:' , currentClass name , ' andSelector:#windowSpec + " + + + + ^ + + #(#FullSpec + #window: + #(#WindowSpec + #name: ''' , currentClass name , ''' + #layout: #(#LayoutFrame 221 0 118 0 520 0 417 0) + #level: 0 + #label: ''' , currentClass name , ''' + #min: #(#Point 10 10) + #max: #(#Point 1024 768) + #bounds: #(#Rectangle 221 118 521 418) + #usePreferredExtent: false + ) + #component: + #(#SpecCollection + #collection: + #( + #(#HorizontalPanelViewSpec + #name: ''buttonPanel'' + #layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 0 1.0) + #component: + #(#SpecCollection + #collection: + #( + #(#ActionButtonSpec + #name: ''cancelButton'' + #label: ''Cancel'' + #translateLabel: true + #model: #cancel + #extent: #(#Point 125 22) + ) + #(#ActionButtonSpec + #name: ''okButton'' + #label: ''OK'' + #translateLabel: true + #model: #accept + #extent: #(#Point 125 22) + ) + ) + ) + #horizontalLayout: #spreadSpaceMax + #verticalLayout: #center + #horizontalSpace: 3 + #verticalSpace: 3 + ) + ) + ) + ) +'. + ] ifFalse:[ + txt := 'windowSpec "This resource specification was automatically generated by the Browser." @@ -7092,15 +7198,19 @@ #collection: #() ) ) -' - forClass:cls - inCategory:'interface specs'. - ]. - +'. + ]. + Compiler + compile:txt + forClass:cls + inCategory:'interface specs'. + ]. + + isDialog ifFalse:[ "/ add a topMenu method (cls includesSelector:#mainMenu) ifFalse:[ - Compiler compile: + txt := 'mainMenu "This resource specification was automatically generated by the Browser." @@ -7187,9 +7297,103 @@ ) nil nil ) -' - forClass:cls - inCategory:'menu specs'. +'. + Compiler + compile:txt + forClass:cls + inCategory:'menu specs'. + ]. + ]. + + (cls includesSelector:#postBuildWith:) ifFalse:[ + txt := +'postBuildWith:aBuilder + "This is a hook method generated by the Browser. + It will be invoked during the initialization of your app/dialog, + after all of the visual components have been built, + but BEFORE the top window is made visible. + Add any app-specific actions here (reading files, setting up + values etc.)" + + "/ add any code here ... + + ^ super postBuildWith:aBuilder +'. + Compiler + compile:txt + forClass:currentClass + inCategory:'initialization & release'. + ]. + + isDialog ifFalse:[ + (cls includesSelector:#closeRequest) ifFalse:[ + txt := +'closeRequest + "This is a hook method generated by the Browser. + It will be invoked when your app/dialog-window is about to be + closed (and has a chance to suppress the close)." + + "/ change the code below as required ... + "/ Closing can be suppressed, by returning. + "/ super closeRequest will initiate the closeDown + + ("self hasUnsavedChanges" true) ifTrue:[ + (self confirm:(resources string:''Close without saving ?'')) ifFalse:[ + ^ self + ] + ]. + + ^ super closeRequest +'. + Compiler + compile:txt + forClass:currentClass + inCategory:'initialization & release'. + ]. + ]. + + isDialog ifFalse:[ + (cls includesSelector:#closeDownViews) ifFalse:[ + txt := +'closeDownViews + "This is a hook method generated by the Browser. + It will be invoked when your app/dialog-window is really closed." + + "/ change the code below as required ... + "/ This should cleanup any leftover resources + "/ (for example, temporary files) + "/ super closeRequest will initiate the closeDown + + "/ add your code here + + "/ do not remove the one below ... + ^ super closeDownViews +'. + Compiler + compile:txt + forClass:currentClass + inCategory:'initialization & release'. + ]. + ]. + + isDialog ifTrue:[ + (cls includesSelector:#accept) ifFalse:[ + txt := +'closeAccept + "This is a hook method generated by the Browser. + It will be invoked when your dialog-window is closed with OK." + + "/ add any actions as required here ... + Transcript showCR:''dialog accepted''. + + "/ do not remove the one below ... + ^ super closeAccept +'. + Compiler + compile:txt + forClass:currentClass + inCategory:'user actions'. + ]. ]. self instanceProtocol:false. @@ -7401,7 +7605,7 @@ - |items m varSel s1 s2 codeMenu| + |items m varSel s1 s2 codeMenu disableFlag| currentClass isNil ifTrue:[ methodCategoryListView flash. @@ -7410,19 +7614,26 @@ currentClass isLoaded ifTrue:[ + disableFlag := false. showInstance ifFalse:[ items := #( ( 'create documentation stubs' methodCategoryCreateDocumentationMethods) ). (currentClass isSubclassOf:ApplicationModel) ifTrue:[ - ((currentClass class implements:#windowSpec) - and:[currentClass class implements:#mainMenu]) ifFalse:[ - items := items , #( - ( 'create initial application code' methodCategoryCreateApplicationMethods) - ). + (currentClass isSubclassOf:SimpleDialog) ifTrue:[ + items := items , #( + ( 'create initial dialog code' methodCategoryCreateApplicationMethods) + ). + ] ifFalse:[ +"/ ((currentClass class implements:#windowSpec) +"/ and:[currentClass class implements:#mainMenu]) ifFalse:[ + items := items , #( + ( 'create initial application code' methodCategoryCreateApplicationMethods) + ). +"/ ] ] - ] + ] ] ifTrue:[ (variableListView notNil and:[(varSel := variableListView selectionValue) notNil]) ifTrue:[ @@ -7431,6 +7642,7 @@ ] ifFalse:[ s1 := 'create access methods (for all)'. s2 := 'create access methods with change message (for all)'. + disableFlag := currentClass instVarNames size == 0 ]. s1 := resources string:s1 with:varSel. s2 := resources string:s2 with:varSel. @@ -7442,6 +7654,10 @@ with:#methodCategoryCreateAccessMethodsWithChange) ]. codeMenu := PopUpMenu itemList:items resources:resources. + + disableFlag ifTrue:[ + codeMenu disableAll:#(methodCategoryCreateAccessMethods methodCategoryCreateAccessMethodsWithChange). + ] ]. currentMethodCategory notNil ifTrue:[ @@ -12848,6 +13064,6 @@ !BrowserView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.479 1999-03-07 15:05:27 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.480 1999-03-07 16:20:02 cg Exp $' ! ! BrowserView initialize!