UIPainter.st
changeset 729 12f157d5e017
parent 724 7c7fb3f3a927
child 735 29c8681ce68d
equal deleted inserted replaced
728:638ae95885e1 729:12f157d5e017
    12 
    12 
    13 
    13 
    14 ToolApplicationModel subclass:#UIPainter
    14 ToolApplicationModel subclass:#UIPainter
    15 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
    15 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
    16 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
    16 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
    17 		transcript'
    17 		transcript modified'
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
   265 
   265 
   266 #testStartApplication
   266 #testStartApplication
   267 'Starts current application on current window spec.'
   267 'Starts current application on current window spec.'
   268 
   268 
   269 )
   269 )
       
   270 
   270 ! !
   271 ! !
   271 
   272 
   272 !UIPainter class methodsFor:'helpers'!
   273 !UIPainter class methodsFor:'helpers'!
   273 
   274 
   274 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   275 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
  1148             )
  1149             )
  1149              #(#MenuItem
  1150              #(#MenuItem
  1150                 #label: 'Paste With Layout'
  1151                 #label: 'Paste With Layout'
  1151                 #value: #pasteWithLayout
  1152                 #value: #pasteWithLayout
  1152                 #activeHelpKey: #pasteWithLayout
  1153                 #activeHelpKey: #pasteWithLayout
  1153                 #enabled: #canKeepLayoutInSelection
  1154                 #enabled: #valueOfCanPasteWithKeepingLayout
  1154             )
  1155             )
  1155              #(#MenuItem
  1156              #(#MenuItem
  1156                 #label: '-'
  1157                 #label: '-'
  1157             )
  1158             )
  1158              #(#MenuItem
  1159              #(#MenuItem
  1361                 #activeHelpKey: #editCopy
  1362                 #activeHelpKey: #editCopy
  1362                 #enabled: #valueOfCanCopy
  1363                 #enabled: #valueOfCanCopy
  1363                 #labelImage: #(#ResourceRetriever nil #copyIcon)
  1364                 #labelImage: #(#ResourceRetriever nil #copyIcon)
  1364             )
  1365             )
  1365              #(#MenuItem
  1366              #(#MenuItem
  1366                 #label: 'Paste'
  1367                 #label: 'Paste With Layout'
  1367                 #isButton: true
  1368                 #isButton: true
  1368                 #value: #pasteBuffer
  1369                 #value: #pasteWithLayout
  1369                 #activeHelpKey: #editPaste
  1370                 #activeHelpKey: #editPaste
  1370                 #enabled: #valueOfCanPaste
  1371                 #enabled: #valueOfCanPasteWithKeepingLayout
  1371                 #labelImage: #(#ResourceRetriever nil #pasteIcon)
  1372                 #labelImage: #(#ResourceRetriever nil #pasteIcon)
  1372             )
  1373             )
  1373              #(#MenuItem
  1374              #(#MenuItem
  1374                 #label: 'Delete'
  1375                 #label: 'Delete'
  1375                 #isButton: true
  1376                 #isButton: true
  1615             ].
  1616             ].
  1616             spec activeHelpKey:key.
  1617             spec activeHelpKey:key.
  1617         ] ifFalse:[
  1618         ] ifFalse:[
  1618             self painter updateFromSpec:spec.
  1619             self painter updateFromSpec:spec.
  1619         ]
  1620         ]
  1620     ].
  1621     ].             
  1621     self modifiedChannel value:false.
  1622     self modifiedChannel value:false.
       
  1623     modified := true.
  1622 !
  1624 !
  1623 
  1625 
  1624 addWidget: aSpecClass
  1626 addWidget: aSpecClass
  1625 
  1627 
  1626     self addWidgetOfSpec: (Array with: (Smalltalk at: aSpecClass) new)
  1628     self addWidgetOfSpec: (Array with: (Smalltalk at: aSpecClass) new)
  1668         self setViewInLayoutTool:view.
  1670         self setViewInLayoutTool:view.
  1669         spec class == DataSetSpec ifTrue:[
  1671         spec class == DataSetSpec ifTrue:[
  1670             view columnDescriptors:(spec columns)
  1672             view columnDescriptors:(spec columns)
  1671         ].        
  1673         ].        
  1672         self modifiedChannel value:false.
  1674         self modifiedChannel value:false.
       
  1675         modified := false
  1673     ]
  1676     ]
  1674 !
  1677 !
  1675 
  1678 
  1676 inspectSpec
  1679 inspectSpec
  1677     "inspect the selected specification"
  1680     "inspect the selected specification"
  1865 
  1868 
  1866 treeView
  1869 treeView
  1867     "returns the selection tree view which holds all widget identifiers
  1870     "returns the selection tree view which holds all widget identifiers
  1868     "
  1871     "
  1869     ^ treeView
  1872     ^ treeView
       
  1873 !
       
  1874 
       
  1875 valueOfCanPasteWithKeepingLayout
       
  1876 
       
  1877     |holder|
       
  1878     (holder := builder bindingAt:#valueOfCanPasteWithKeepingLayout) isNil ifTrue:[
       
  1879         builder aspectAt:#valueOfCanPasteWithKeepingLayout put:(holder :=  false asValue).
       
  1880     ].
       
  1881     ^ holder
       
  1882 
       
  1883 
       
  1884 
  1870 ! !
  1885 ! !
  1871 
  1886 
  1872 !UIPainter methodsFor:'building editors'!
  1887 !UIPainter methodsFor:'building editors'!
  1873 
  1888 
  1874 openDataSetColumnEditor
  1889 openDataSetColumnEditor
  1896 !
  1911 !
  1897 
  1912 
  1898 openEditMenu
  1913 openEditMenu
  1899     "opens a menu editor on current widget
  1914     "opens a menu editor on current widget
  1900     "
  1915     "
  1901     |cls aspect editor|
  1916     |cls selectorOrMenu editor selectedSpec|
  1902 
  1917 
  1903     cls := self resolveName:specClass.
  1918     cls := self resolveName:specClass.
  1904 
  1919 
  1905     cls isNil ifTrue:[
  1920     cls isNil ifTrue:[
  1906         ^ self warn:'No application class defined yet!!'
  1921         ^ self warn:'No application class defined yet!!'
  1907     ].
  1922     ].
  1908 
  1923 
  1909     cls notNil ifTrue:[
  1924     cls notNil ifTrue:[
  1910         (aspect := self specTool specification menuSelector) notNil ifTrue:[
  1925         (selectorOrMenu := self specTool specification menuSelector) notNil ifTrue:[
  1911             aspect := aspect asSymbol
  1926             selectorOrMenu := selectorOrMenu asSymbol
  1912         ] ifFalse:[
  1927         ] ifFalse:[
  1913             "/ cg: q&d hack ...
  1928             "/ cg: q&d hack ...
  1914 
  1929 
  1915             aspect := treeView propertySelected.
  1930             (selectedSpec := treeView propertySelected) notNil ifTrue:[
  1916             aspect notNil ifTrue:[
       
  1917                 Object errorSignal handle:[:ex |
  1931                 Object errorSignal handle:[:ex |
  1918                     aspect := nil.
  1932                     selectorOrMenu := nil.
  1919                 ] do:[
  1933                 ] do:[
  1920                     aspect := aspect view asMenu.
  1934                     selectorOrMenu := selectedSpec view asMenu.
  1921                 ]
  1935                 ]
  1922             ].
  1936             ].
  1923         ].
  1937         ].
  1924         
  1938 
  1925         editor := MenuEditor new.
  1939         editor := MenuEditor new.
  1926         editor masterApplication:self.
  1940         editor masterApplication:self.
  1927         editor specClass: cls.
  1941         editor specClass: cls.
  1928         editor useHelpTool: self helpTool.
  1942         editor useHelpTool: self helpTool. 
  1929         editor openModalOnClass:cls andSelector:aspect.
  1943         selectorOrMenu class ~~ Menu
       
  1944             ifTrue:  [editor openModalOnClass:cls andSelector:selectorOrMenu]
       
  1945             ifFalse: [editor openModalOnMenu:selectorOrMenu].
  1930         self helpTool updateList.
  1946         self helpTool updateList.
  1931 
  1947 
  1932         editor selectorName ~= aspect ifTrue:[
  1948         editor selectorName ~= selectorOrMenu ifTrue:[
  1933             editor didInstall ifTrue:[
  1949             editor didInstall ifTrue:[
  1934                 self specTool specification menuSelector:editor selectorName asSymbol.
  1950                 self specTool specification menuSelector:editor selectorName asSymbol.
  1935                 self modifiedChannel value:true.
  1951                 self modifiedChannel value:true.
  1936                 self accept
  1952                 self accept
  1937             ]
  1953             ]
  1978             self accept
  1994             self accept
  1979         ]
  1995         ]
  1980     ]
  1996     ]
  1981 !
  1997 !
  1982 
  1998 
  1983 openSubSpecGuiPainter
  1999 openSubSpecGUIPainter
  1984     "opens a GUI Painter on the current subspecification"
  2000     "opens a GUI Painter on the current subspecification"
  1985 
  2001 
  1986     |spec cls meta sel|
  2002     |spec cls meta sel|
  1987 
  2003 
  1988     spec := self specTool specification.
  2004     spec := self specTool specification.
  1989     cls := spec majorKey.
  2005     cls := spec majorKey.
  1990     cls isNil ifTrue:[
  2006     cls isNil ifTrue:[
  1991         cls := self specClass.
  2007         cls := specClass.
  1992     ].
  2008     ].
  1993     (cls isNil or:[(cls := self resolveName:cls) isNil]) ifTrue:[
  2009     (cls isNil or:[(cls := self resolveName:cls) isNil]) ifTrue:[
  1994         spec majorKey isNil ifTrue:[
  2010         spec majorKey isNil ifTrue:[
  1995             ^ self warn:'Cannot find class (no majorKey specified)'.
  2011             ^ self warn:'Cannot find class (no majorKey specified)'.
  1996         ].
  2012         ].
  2144         
  2160         
  2145 ! !
  2161 ! !
  2146 
  2162 
  2147 !UIPainter methodsFor:'private'!
  2163 !UIPainter methodsFor:'private'!
  2148 
  2164 
       
  2165 askForModification
       
  2166     "check interface modification
       
  2167     " 
       
  2168 
       
  2169     self treeSelection. "accept modifications"    
       
  2170 
       
  2171     (modified or: [self painter isModified or: [self helpTool isModified]])
       
  2172     ifTrue:
       
  2173     [
       
  2174         ((YesNoBox title:'Window Spec was modified!!')        
       
  2175             noText:'Cancel';
       
  2176             yesText:'Waste it and proceed';
       
  2177             showAtPointer;
       
  2178             accepted) ifFalse: [^false].
       
  2179         modified := false.
       
  2180         self painter resetModification
       
  2181     ].
       
  2182     ^true
       
  2183 !
       
  2184 
  2149 checkModified
  2185 checkModified
  2150     "check interface modification
  2186     "check interface modification
  2151     "                 
  2187     "               
  2152     (self painter isModified or: [self helpTool isModified])
  2188     (self isModified and: [self isModified or: [self helpTool isModified]])
  2153     ifTrue:
  2189     ifTrue:
  2154     [
  2190     [
  2155         ((YesNoBox title:'Window Spec was modified!!')        
  2191         ((YesNoBox title:'Window Spec was modified!!')        
  2156             noText:'Cancel';
  2192             noText:'Cancel';
  2157             yesText:'Waste it and proceed';
  2193             yesText:'Waste it and proceed';
  2190     aView bePartner.
  2226     aView bePartner.
  2191 !
  2227 !
  2192 
  2228 
  2193 resourceMessage: aString
  2229 resourceMessage: aString
  2194 
  2230 
  2195     aString notNil "and: [self askForModification])" 
  2231     (aString notNil and: [self askForModification]) 
  2196     ifTrue:
  2232     ifTrue:
  2197     [            
  2233     [            
  2198         |msg cls sel|
  2234         |msg cls sel|
  2199         msg := aString asCollectionOfWords.
  2235         msg := aString asCollectionOfWords.
  2200         (msg size == 2 and:
  2236         (msg size == 2 and:
  2328     "
  2364     "
  2329     ^ tabSelection = UILayoutTool label
  2365     ^ tabSelection = UILayoutTool label
  2330 !
  2366 !
  2331 
  2367 
  2332 isModified
  2368 isModified
  2333     "returns true if current specification or layout is modified
  2369     "return true if current specification or layout is modified
  2334     "
  2370     "
  2335     ^ self modifiedChannel value
  2371     ^ self modifiedChannel value
  2336 !
  2372 !
  2337 
  2373 
  2338 isPainterEnabled
  2374 isPainterEnabled
  2455                     or: [self canPasteInto: treeView selectedNode contents view]]]
  2491                     or: [self canPasteInto: treeView selectedNode contents view]]]
  2456     ].
  2492     ].
  2457 
  2493 
  2458     self valueOfCanCut value: canCutOrCopy.
  2494     self valueOfCanCut value: canCutOrCopy.
  2459     self valueOfCanCopy value: canCutOrCopy.
  2495     self valueOfCanCopy value: canCutOrCopy.
  2460     self valueOfCanPaste value: canPaste
  2496     self valueOfCanPaste value: canPaste.             
  2461 
  2497     self valueOfCanPasteWithKeepingLayout value: (canPaste &  self canKeepLayoutInSelection)
  2462 ! !
  2498 ! !
  2463 
  2499 
  2464 !UIPainter methodsFor:'startup / release'!
  2500 !UIPainter methodsFor:'startup / release'!
  2465 
  2501 
  2466 closeRequest
  2502 closeRequest
  2467     "close all windows open by builder
  2503     "close all windows open by builder
  2468     "
  2504     "
  2469 
  2505 
  2470     self checkModified ifFalse:[^self].
  2506     self askForModification ifFalse:[^self].
  2471 
  2507 
  2472     treeView model removeDependent:self.
  2508     treeView model removeDependent:self.
  2473     self painter release.
  2509     self painter release.
  2474     ColorMenu releaseResources.
  2510     ColorMenu releaseResources.
  2475 
  2511 
  2513 openInterface:aSymbol
  2549 openInterface:aSymbol
  2514     "open interfaces
  2550     "open interfaces
  2515     "
  2551     "
  2516     |painterView painter cls topView|
  2552     |painterView painter cls topView|
  2517 
  2553 
       
  2554     modified := false.
       
  2555 
  2518     aspects := IdentityDictionary new.
  2556     aspects := IdentityDictionary new.
  2519 
  2557 
  2520     aspects at:#classNameChannel put:(
  2558     aspects at:#classNameChannel put:(
  2521         (specClass notNil ifTrue:[specClass]
  2559         (specClass notNil ifTrue:[specClass]
  2522                          ifFalse:['NewApplication']) asValue
  2560                          ifFalse:['NewApplication']) asValue
  2677 doInstallAspects
  2715 doInstallAspects
  2678     "install aspects and actions
  2716     "install aspects and actions
  2679     "
  2717     "
  2680     |code|
  2718     |code|
  2681 
  2719 
       
  2720     self treeSelection. "accept modifications"
       
  2721 
  2682     self hasSpecClassAndSelector ifFalse:[
  2722     self hasSpecClassAndSelector ifFalse:[
  2683         self defineClassAndSelector
  2723         self defineClassAndSelector
  2684     ].
  2724     ].
  2685 
  2725 
  2686     self checkClassAndSelector ifFalse:[
  2726     self checkClassAndSelector ifFalse:[
  2699 doInstallHooks
  2739 doInstallHooks
  2700     "install application hooks
  2740     "install application hooks
  2701     "
  2741     "
  2702     |code|
  2742     |code|
  2703 
  2743 
       
  2744     self treeSelection. "accept modifications"
       
  2745 
  2704     self hasSpecClassAndSelector ifFalse:[
  2746     self hasSpecClassAndSelector ifFalse:[
  2705         self defineClassAndSelector
  2747         self defineClassAndSelector
  2706     ].
  2748     ].
  2707 
  2749 
  2708     self checkClassAndSelector ifFalse:[
  2750     self checkClassAndSelector ifFalse:[
  2718 
  2760 
  2719     "Created: / 31.10.1997 / 17:37:54 / cg"
  2761     "Created: / 31.10.1997 / 17:37:54 / cg"
  2720 !
  2762 !
  2721 
  2763 
  2722 doLoad
  2764 doLoad
       
  2765 
       
  2766     self askForModification ifFalse: [^nil].
  2723 
  2767 
  2724     self loadFromMessage: 
  2768     self loadFromMessage: 
  2725         (ResourceSelectionBrowser
  2769         (ResourceSelectionBrowser
  2726             request: 'Load Window Spec From Class'
  2770             request: 'Load Window Spec From Class'
  2727             onSuperclass: nil
  2771             onSuperclass: nil
  2731 !
  2775 !
  2732 
  2776 
  2733 doLoadSubspec
  2777 doLoadSubspec
  2734 
  2778 
  2735     |subSpecMessage|
  2779     |subSpecMessage|
       
  2780 
       
  2781     self treeSelection. "ask for modification"
       
  2782 
  2736     (subSpecMessage := ResourceSelectionBrowser
  2783     (subSpecMessage := ResourceSelectionBrowser
  2737             request: 'Load Subspec From Class'
  2784             request: 'Load Subspec From Class'
  2738             onSuperclass: nil
  2785             onSuperclass: nil
  2739             andClass: specClass
  2786             andClass: specClass
  2740             andSelector: specSelector
  2787             andSelector: specSelector
  2758 !
  2805 !
  2759 
  2806 
  2760 doNew
  2807 doNew
  2761     "remove all components and associated resources
  2808     "remove all components and associated resources
  2762     "
  2809     "
  2763     self painter isModified ifTrue:[
  2810 
  2764         (self confirm:'Edit a new window spec without saving current?') ifFalse:[
  2811     self askForModification ifFalse: [^nil].
  2765             ^ self
  2812     specClass := specSelector := nil.
  2766         ]
       
  2767     ].
       
  2768     self painter removeAll.
  2813     self painter removeAll.
       
  2814     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
       
  2815     treeView canvas topView label: UIPainter defaultNameOfCanvas.
       
  2816     treeView selection:#(1).
       
  2817     self treeSelection.
       
  2818     self updateInfoLabel.
  2769 !
  2819 !
  2770 
  2820 
  2771 doPickAView
  2821 doPickAView
  2772     "pick a view and setup specifications
  2822     "pick a view and setup specifications
  2773     "
  2823     "
  2774     |painter view cls spec app|
  2824     |painter view cls spec app|
  2775 
  2825 
  2776     self painter isModified ifTrue:[
  2826     self askForModification ifFalse: [^nil].
  2777         (self confirm:'Pick another window spec without saving your modifications?') ifFalse:[
       
  2778             ^ self
       
  2779         ]
       
  2780     ].
       
  2781 
  2827 
  2782     (view := Screen current viewFromUser) notNil ifTrue:[
  2828     (view := Screen current viewFromUser) notNil ifTrue:[
  2783         view == Screen current rootView ifFalse:[
  2829         view == Screen current rootView ifFalse:[
  2784             painter := self painter.
  2830             painter := self painter.
  2785             spec    := UISpecification fromView:view topView.
  2831             spec    := UISpecification fromView:view topView.
  2786 
  2832 
  2787          "/ ok, got it
  2833          "/ ok, got it
  2788 
  2834 
  2789             (app := view application) notNil ifTrue:[
  2835          "   (app := view application) notNil ifTrue:[
  2790                 cls := app class
  2836                 cls := app class
  2791             ] ifFalse:[
  2837             ] ifFalse:[
  2792                 cls := view class
  2838                 cls := view class
  2793             ].
  2839             ].            
  2794             self setClass:cls selector:nil.
  2840             self setClass:cls selector:nil.
  2795 
  2841          "
  2796             painter setupFromSpec:spec.
  2842             painter setupFromSpec:spec.
  2797         ]
  2843         ]
  2798     ]
  2844     ].
  2799 
  2845 
  2800     "Modified: / 1.11.1997 / 13:47:49 / cg"
  2846     self updateInfoLabel
       
  2847 
  2801 !
  2848 !
  2802 
  2849 
  2803 doRedefineMethods
  2850 doRedefineMethods
  2804     "redefine methods yes or no. If a method is defined in super class
  2851     "redefine methods yes or no. If a method is defined in super class
  2805      should the message be reinstalled ?
  2852      should the message be reinstalled ?
  2821 doSave
  2868 doSave
  2822     "install window spec
  2869     "install window spec
  2823     "
  2870     "
  2824     |code painter|
  2871     |code painter|
  2825 
  2872 
       
  2873     self treeSelection. "ask for modification"
       
  2874 
  2826     self hasSpecClassAndSelector ifFalse:[
  2875     self hasSpecClassAndSelector ifFalse:[
  2827          self defineClassAndSelector
  2876          (self defineClassAndSelector) isNil ifTrue: [^nil]
  2828     ].
  2877     ].
  2829 
  2878 
  2830     (specClass notNil and: [(Smalltalk at: specClass asSymbol) isClass])
  2879     (specClass notNil and: [(Smalltalk at: specClass asSymbol) isClass])
  2831     ifFalse: 
  2880     ifFalse: 
  2832     [   
  2881     [   
  2854     (ReadStream on:code) fileIn.
  2903     (ReadStream on:code) fileIn.
  2855 
  2904 
  2856     self helpTool installHelpSpecsOnClass:specClass.
  2905     self helpTool installHelpSpecsOnClass:specClass.
  2857 
  2906 
  2858     self updateInfoLabel.
  2907     self updateInfoLabel.
       
  2908     modified := false.
  2859     self painter resetModification.
  2909     self painter resetModification.
  2860 
  2910 
  2861     ((Smalltalk at: specClass asSymbol) class implements: specSelector) 
  2911     ((Smalltalk at: specClass asSymbol) class implements: specSelector) 
  2862     ifTrue: 
  2912     ifTrue: 
  2863     [
  2913     [
  2869 
  2919 
  2870 doSaveAs
  2920 doSaveAs
  2871     "launch a dialog to define class, superclass and method"
  2921     "launch a dialog to define class, superclass and method"
  2872 
  2922 
  2873     |resourceMessage|
  2923     |resourceMessage|
       
  2924 
       
  2925     self treeSelection. "ask for modification"
  2874 
  2926 
  2875     (resourceMessage := ResourceSelectionBrowser
  2927     (resourceMessage := ResourceSelectionBrowser
  2876             request: 'Save In Class'
  2928             request: 'Save In Class'
  2877             onSuperclass: #Object
  2929             onSuperclass: #Object
  2878             andClass: specClass ? #ApplicationModel
  2930             andClass: specClass ? #ApplicationModel
  2893 doStartApplication
  2945 doStartApplication
  2894     "start current edited application
  2946     "start current edited application
  2895     "
  2947     "
  2896     |cls app infoMessage|
  2948     |cls app infoMessage|
  2897 
  2949 
       
  2950     self treeSelection. "accept modifications"
       
  2951 
  2898     (specClass isNil or:[specSelector size < 2]) ifTrue:[
  2952     (specClass isNil or:[specSelector size < 2]) ifTrue:[
  2899         self painter isModified ifTrue:[
  2953         self painter isModified ifTrue:[
  2900             infoMessage := 'Class and selector must be defined,\and the window spec must be saved first!!' withCRs.
  2954             infoMessage := 'Class and selector must be defined,\and the window spec must be saved first!!' withCRs.
  2901         ] ifFalse:[
  2955         ] ifFalse:[
  2902             infoMessage := 'No class and selector defined!!'.
  2956             infoMessage := 'No class and selector defined!!'.
  2949    "create the window specification but do not write to application; instead
  3003    "create the window specification but do not write to application; instead
  2950     open a view
  3004     open a view
  2951    "
  3005    "
  2952    |code v|
  3006    |code v|
  2953 
  3007 
       
  3008    self treeSelection. "accept modifications"
       
  3009 
  2954    code := self painter generateWindowSpecMethodSource.
  3010    code := self painter generateWindowSpecMethodSource.
  2955 
  3011 
  2956    v := CodeView open.
  3012    v := CodeView open.
  2957    v contents:code.
  3013    v contents:code.
  2958    v label:'windowSpec'.
  3014    v label:'windowSpec'.
  2959 
  3015 
  2960 !
  3016 !
  2961 
  3017 
  2962 loadFromMessage: aMessage
  3018 loadFromMessage: aMessage
  2963 
  3019 
  2964     ((aMessage size > 0) and: [self checkModified])
  3020     ((aMessage size > 0) and: [self askForModification])
  2965     ifTrue:
  3021     ifTrue:
  2966     [
  3022     [
  2967         |readStream aClass aSelector|
  3023         |readStream aClass aSelector|
  2968         readStream := aMessage readStream.
  3024         readStream := aMessage readStream.
  2969         (aClass := Smalltalk at: (readStream upTo: $ ) asSymbol) notNil
  3025         (aClass := Smalltalk at: (readStream upTo: $ ) asSymbol) notNil
  2997 
  3053 
  2998         superclass isNil ifTrue:[
  3054         superclass isNil ifTrue:[
  2999             self warn:'No class named ' , specSuperclass , ' exists!!'.
  3055             self warn:'No class named ' , specSuperclass , ' exists!!'.
  3000             ^ false.
  3056             ^ false.
  3001         ].
  3057         ].
  3002         (self confirm:'Create ' , specClass , '?') ifTrue:[
  3058         (self confirm:'Create class ' , specClass asBoldText, '?') ifTrue:[
  3003             superclass subclass:(specClass asSymbol)
  3059             superclass subclass:(specClass asSymbol)
  3004                        instanceVariableNames:''
  3060                        instanceVariableNames:''
  3005                        classVariableNames:''
  3061                        classVariableNames:''
  3006                        poolDictionaries:''
  3062                        poolDictionaries:''
  3007                        category:'Applications'.
  3063                        category:'Applications'.
  3076                 self painter className:specClass
  3132                 self painter className:specClass
  3077                         superclassName:specSuperclass
  3133                         superclassName:specSuperclass
  3078                               selector:specSelector.
  3134                               selector:specSelector.
  3079             ]
  3135             ]
  3080         ]
  3136         ]
       
  3137         ifFalse:
       
  3138         [
       
  3139             ^nil
       
  3140         ]
  3081 
  3141 
  3082     ] doWhile:[again].
  3142     ] doWhile:[again].
  3083 
  3143 
  3084     self specClass:specClass.
  3144     self specClass:specClass.
  3085     self helpTool isModified: true
  3145     self helpTool isModified: true
  3292     self canvas subViews copy do:[:aView|
  3352     self canvas subViews copy do:[:aView|
  3293         (aView isKindOf:InputView) ifFalse:[aView destroy]
  3353         (aView isKindOf:InputView) ifFalse:[aView destroy]
  3294     ].
  3354     ].
  3295     model root name: UIPainter defaultNameOfCanvas asBoldText.
  3355     model root name: UIPainter defaultNameOfCanvas asBoldText.
  3296     model root children:(OrderedCollection new).
  3356     model root children:(OrderedCollection new).
  3297     model recomputeList.
  3357     model recomputeList.                
  3298     self selection:nil.
       
  3299 
       
  3300 
  3358 
  3301 !
  3359 !
  3302 
  3360 
  3303 removeView:aView
  3361 removeView:aView
  3304     "remove a view
  3362     "remove a view