UIPainter.st
changeset 50 fb4359c9bdc4
parent 46 8301d6b9e67c
child 54 d0b5a33e6df0
equal deleted inserted replaced
49:7f58dd5fc836 50:fb4359c9bdc4
    17 		aspectSelectorHolder aspectChannel nameChannel fgChannel
    17 		aspectSelectorHolder aspectChannel nameChannel fgChannel
    18 		bgChannel applyAction leftFractionHolder leftOffsetHolder
    18 		bgChannel applyAction leftFractionHolder leftOffsetHolder
    19 		rightFractionHolder rightOffsetHolder topFractionHolder
    19 		rightFractionHolder rightOffsetHolder topFractionHolder
    20 		topOffsetHolder bottomFractionHolder bottomOffsetHolder specClass
    20 		topOffsetHolder bottomFractionHolder bottomOffsetHolder specClass
    21 		specSelector leftAlignmentFractionHolder
    21 		specSelector leftAlignmentFractionHolder
    22 		topAlignmentFractionHolder propertyShown specShown'
    22 		topAlignmentFractionHolder classNameHolder methodNameHolder
       
    23 		aspectHolders propertyShown specShown'
    23 	classVariableNames:''
    24 	classVariableNames:''
    24 	poolDictionaries:''
    25 	poolDictionaries:''
    25 	category:'Interface-UIPainter'
    26 	category:'Interface-UIPainter'
    26 !
    27 !
    27 
    28 
   859            #(#WindowSpec
   860            #(#WindowSpec
   860               #'label:' 'unnamed'
   861               #'label:' 'unnamed'
   861               #'bounds:' #(#Rectangle 0 0 255 292)
   862               #'bounds:' #(#Rectangle 0 0 255 292)
   862           )
   863           )
   863       )
   864       )
       
   865 !
       
   866 
       
   867 nameAndSelectorSpec
       
   868     "this window spec was automatically generated by the ST/X UIPainter"
       
   869 
       
   870     "do not manually edit this - the painter/builder may not be able to
       
   871      handle the specification if its corrupted."
       
   872 
       
   873     "UIPainter new openOnClass:NewApplication andSelector:#windowSpec"
       
   874     "NewApplication new openInterface:#windowSpec"
       
   875     "NewApplication open"
       
   876 
       
   877     <resource: #canvas>
       
   878 
       
   879     ^
       
   880 
       
   881        #(#FullSpec
       
   882           #'window:' 
       
   883            #(#WindowSpec
       
   884               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   885               #'label:' 'unnamed'
       
   886               #'bounds:' #(#Rectangle 0 0 300 300)
       
   887           )
       
   888           #'component:' 
       
   889            #(#SpecCollection
       
   890               #'collection:' 
       
   891                #(
       
   892                  #(#LabelSpec
       
   893                     #'name:' 'label1'
       
   894                     #'layout:' #(#LayoutFrame 10 0 50 0 110 0 70 0)
       
   895                     #'label:' 'class:'
       
   896                     #'adjust:' #right
       
   897                 )
       
   898                  #(#LabelSpec
       
   899                     #'name:' 'label2'
       
   900                     #'layout:' #(#LayoutFrame 10 0 90 0 110 0 110 0)
       
   901                     #'label:' 'superclass:'
       
   902                     #'adjust:' #right
       
   903                 )
       
   904                  #(#LabelSpec
       
   905                     #'name:' 'label3'
       
   906                     #'layout:' #(#LayoutFrame 10 0 130 0 110 0 150 0)
       
   907                     #'label:' 'selector:'
       
   908                     #'adjust:' #right
       
   909                 )
       
   910                  #(#InputFieldSpec
       
   911                     #'name:' 'classNameField'
       
   912                     #'layout:' #(#LayoutFrame 120 0 50 0 289 0 69 0)
       
   913                     #'model:' #classNameChannel
       
   914                     #'immediateAccept:' false
       
   915                     #'acceptOnLeave:' true
       
   916                     #'acceptOnReturn:' true
       
   917                     #'acceptOnTab:' true
       
   918                 )
       
   919                  #(#InputFieldSpec
       
   920                     #'name:' 'superclassNameField'
       
   921                     #'layout:' #(#LayoutFrame 120 0 90 0 289 0 109 0)
       
   922                     #'model:' #superclassNameChannel
       
   923                     #'immediateAccept:' false
       
   924                     #'acceptOnLeave:' true
       
   925                     #'acceptOnReturn:' true
       
   926                     #'acceptOnTab:' true
       
   927                 )
       
   928                  #(#InputFieldSpec
       
   929                     #'name:' 'methodNameField'
       
   930                     #'layout:' #(#LayoutFrame 120 0 130 0 289 0 149 0)
       
   931                     #'model:' #methodNameChannel
       
   932                     #'immediateAccept:' false
       
   933                     #'acceptOnLeave:' true
       
   934                     #'acceptOnReturn:' true
       
   935                     #'acceptOnTab:' true
       
   936                 )
       
   937                  #(#ActionButtonSpec
       
   938                     #'name:' 'button1'
       
   939                     #'layout:' #(#LayoutFrame 30 0 250 0 129 0 279 0)
       
   940                     #'label:' 'cancel'
       
   941                     #'model:' #cancelClicked
       
   942                 )
       
   943                  #(#ActionButtonSpec
       
   944                     #'name:' 'button2'
       
   945                     #'layout:' #(#LayoutFrame 160 0 250 0 259 0 279 0)
       
   946                     #'label:' 'ok'
       
   947                     #'model:' #okClicked
       
   948                 )
       
   949               )
       
   950           )
       
   951       )
       
   952 
       
   953 
       
   954 
   864 ! !
   955 ! !
   865 
   956 
   866 !UIPainter methodsFor:'BuilderView interface'!
   957 !UIPainter methodsFor:'BuilderView interface'!
   867 
   958 
   868 setUndoLabel:aString
   959 setUndoLabel:aString
   915     ].
  1006     ].
   916 ! !
  1007 ! !
   917 
  1008 
   918 !UIPainter methodsFor:'aspects'!
  1009 !UIPainter methodsFor:'aspects'!
   919 
  1010 
   920 aspectChannel
  1011 aspectFor:aKey
   921     ^ aspectChannel
  1012     ^ aspectHolders at:aKey ifAbsent:[super aspectFor:aKey]
   922 
       
   923     "Modified: 6.9.1995 / 01:00:30 / claus"
       
   924 !
  1013 !
   925 
  1014 
   926 backgroundChannel
  1015 backgroundChannel
   927     ^ bgChannel
  1016     ^ bgChannel
   928 !
  1017 !
   932 !
  1021 !
   933 
  1022 
   934 bottomOffsetChannel
  1023 bottomOffsetChannel
   935     ^ bottomOffsetHolder
  1024     ^ bottomOffsetHolder
   936 
  1025 
   937 !
       
   938 
       
   939 changeChannel
       
   940     ^ changeChannel
       
   941 
       
   942     "Modified: 6.9.1995 / 01:00:33 / claus"
       
   943 !
  1026 !
   944 
  1027 
   945 foregroundChannel
  1028 foregroundChannel
   946     ^ fgChannel
  1029     ^ fgChannel
   947 !
  1030 !
  1106 
  1189 
  1107     "Modified: 5.9.1995 / 23:52:57 / claus"
  1190     "Modified: 5.9.1995 / 23:52:57 / claus"
  1108 !
  1191 !
  1109 
  1192 
  1110 initChannels
  1193 initChannels
       
  1194     aspectHolders := IdentityDictionary new.
       
  1195 
       
  1196     aspectHolders at:#classNameChannel put:((specClass notNil ifTrue:[specClass name] ifFalse:['NewApplication']) asValue).
       
  1197     aspectHolders at:#superclassNameChannel put:((specClass notNil ifTrue:[specClass superclass] ifFalse:[ApplicationModel]) name asValue).
       
  1198     aspectHolders at:#methodNameChannel put:(specSelector asValue).
       
  1199 
       
  1200     aspectHolders at:#aspectChannel put:(ValueHolder new).
       
  1201     aspectHolders at:#changeChannel put:(ValueHolder new).
       
  1202 
       
  1203     aspectHolders at:#foregroundChannel put:(ValueHolder new).
       
  1204     aspectHolders at:#backgroundChannel put:(ValueHolder new).
       
  1205 
  1111 
  1206 
  1112     bottomFractionHolder        := nil asValue.
  1207     bottomFractionHolder        := nil asValue.
  1113     bottomOffsetHolder          := nil asValue.
  1208     bottomOffsetHolder          := nil asValue.
  1114     leftFractionHolder          := nil asValue.
  1209     leftFractionHolder          := nil asValue.
  1115     leftOffsetHolder            := nil asValue.
  1210     leftOffsetHolder            := nil asValue.
  1117     rightOffsetHolder           := nil asValue.
  1212     rightOffsetHolder           := nil asValue.
  1118     topFractionHolder           := nil asValue.
  1213     topFractionHolder           := nil asValue.
  1119     topOffsetHolder             := nil asValue.
  1214     topOffsetHolder             := nil asValue.
  1120     leftAlignmentFractionHolder := nil asValue.
  1215     leftAlignmentFractionHolder := nil asValue.
  1121     topAlignmentFractionHolder  := nil asValue.
  1216     topAlignmentFractionHolder  := nil asValue.
  1122 
       
  1123     fgChannel := nil asValue.
       
  1124     bgChannel := nil asValue.
       
  1125 
       
  1126     aspectChannel := nil asValue.
       
  1127     changeChannel := nil asValue.
       
  1128 
  1217 
  1129 !
  1218 !
  1130 
  1219 
  1131 initPullDownMenu
  1220 initPullDownMenu
  1132     menu labels:(resources  array:#(
  1221     menu labels:(resources  array:#(
  1341                        )
  1430                        )
  1342              receiver:workView.
  1431              receiver:workView.
  1343 
  1432 
  1344     menu at:#code 
  1433     menu at:#code 
  1345             putLabels:(resources  array:#(
  1434             putLabels:(resources  array:#(
  1346                         'class' 
  1435                         'class & method' 
  1347                         'method' 
       
  1348 "/                        'variables' 
       
  1349                        ) )
  1436                        ) )
  1350             selectors:#(
  1437             selectors:#(
  1351                         changeClass
  1438                         defineClassAndSelector
  1352                         changeMethod
       
  1353 "/                        changeVariables
       
  1354                        )
  1439                        )
  1355              receiver:self.
  1440              receiver:self.
  1356 
  1441 
  1357     menu at:#debugging 
  1442     menu at:#debugging 
  1358             putLabels:(resources array:#(
  1443             putLabels:(resources array:#(
  1504 
  1589 
  1505     |specArray|
  1590     |specArray|
  1506 
  1591 
  1507     specClass := aClass.
  1592     specClass := aClass.
  1508     specSelector :=  aSelector.
  1593     specSelector :=  aSelector.
       
  1594 
  1509     self openInterface.
  1595     self openInterface.
  1510     workView className:aClass name.
  1596     workView className:aClass name.
  1511     workView methodName:aSelector.
  1597     workView methodName:aSelector.
  1512     workView setupFromSpec:(aClass perform:aSelector).
  1598     workView setupFromSpec:(aClass perform:aSelector).
  1513 !
  1599 !
  1834 
  1920 
  1835 
  1921 
  1836 !
  1922 !
  1837 
  1923 
  1838 fetchModelAspectsFrom:aView
  1924 fetchModelAspectsFrom:aView
  1839     aspectChannel value:(workView aspectSelectorForView:aView).
  1925     (self aspectFor:#aspectChannel) value:(workView aspectSelectorForView:aView).
  1840     changeChannel value:(workView changeSelectorForView:aView).
  1926     (self aspectFor:#changeChannel) value:(workView changeSelectorForView:aView).
  1841 
  1927 
  1842 ! !
  1928 ! !
  1843 
  1929 
  1844 !UIPainter methodsFor:'setup choices'!
  1930 !UIPainter methodsFor:'setup choices'!
  1845 
  1931 
  2055 ! !
  2141 ! !
  2056 
  2142 
  2057 !UIPainter methodsFor:'user interaction'!
  2143 !UIPainter methodsFor:'user interaction'!
  2058 
  2144 
  2059 closeRequest
  2145 closeRequest
  2060     workView  notNil ifTrue:[workView  release].
  2146     workView  notNil ifTrue:[workView  release. workView := nil].
  2061     fileBox   notNil ifTrue:[fileBox   destroy].
       
  2062     stringBox notNil ifTrue:[stringBox destroy].
       
  2063     actionBox notNil ifTrue:[actionBox destroy].
       
  2064     listBox   notNil ifTrue:[listBox   destroy].
       
  2065     super closeRequest
  2147     super closeRequest
  2066 !
  2148 !
  2067 
  2149 
  2068 doCompile
  2150 doCompile
  2069    |code|
  2151    |code|
  2572 setModelAspects
  2654 setModelAspects
  2573     "sent when apply is pressen in the model-sub view"
  2655     "sent when apply is pressen in the model-sub view"
  2574 
  2656 
  2575     |aspectSymbol|
  2657     |aspectSymbol|
  2576 
  2658 
  2577     aspectSymbol := aspectChannel value.
  2659     aspectSymbol := (self aspectFor:#aspectChannel) value.
  2578     (aspectSymbol notNil and:[aspectSymbol notEmpty]) ifTrue:[
  2660     (aspectSymbol notNil and:[aspectSymbol notEmpty]) ifTrue:[
  2579         aspectSymbol := aspectSymbol asSymbol.
  2661         aspectSymbol := aspectSymbol asSymbol.
  2580         workView singleSelectionDo:[:selectedView |
  2662         workView singleSelectionDo:[:selectedView |
  2581             selectedView ~~ workView ifTrue:[
  2663             selectedView ~~ workView ifTrue:[
  2582                 workView setAspectSelector:aspectSymbol forView:selectedView
  2664                 workView setAspectSelector:aspectSymbol forView:selectedView
  2717         m labelAt:#toggleTest put:(resources string:'test on')
  2799         m labelAt:#toggleTest put:(resources string:'test on')
  2718     ].
  2800     ].
  2719     workView testMode:t
  2801     workView testMode:t
  2720 ! !
  2802 ! !
  2721 
  2803 
       
  2804 !UIPainter methodsFor:'user interaction - dialogs'!
       
  2805 
       
  2806 defineClassAndSelector
       
  2807     "launch a dialog to define class, superclass and method"
       
  2808 
       
  2809     |dialog|
       
  2810 
       
  2811     self openDialogInterface:#nameAndSelectorSpec.
       
  2812 ! !
       
  2813 
  2722 !UIPainter class methodsFor:'documentation'!
  2814 !UIPainter class methodsFor:'documentation'!
  2723 
  2815 
  2724 version
  2816 version
  2725     ^ '$Header$'
  2817     ^ '$Header$'
  2726 ! !
  2818 ! !