UIPainterView.st
changeset 62 0e8573b4329a
parent 60 7542ab7fbbfe
child 69 e533f77871dd
equal deleted inserted replaced
61:85ef247db6b1 62:0e8573b4329a
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 'From Smalltalk/X, Version:3.1.4 on 25-feb-1997 at 2:17:29 pm'                  !
       
    14 
       
    15 UIObjectView subclass:#UIPainterView
    13 UIObjectView subclass:#UIPainterView
    16 	instanceVariableNames:'fontPanel viewProperties superclassName className methodName
    14 	instanceVariableNames:'fontPanel viewProperties superclassName className methodName
    17 		categoryName'
    15 		categoryName'
    18 	classVariableNames:'HandCursor'
    16 	classVariableNames:'HandCursor'
    19 	poolDictionaries:''
    17 	poolDictionaries:''
   210     ].
   208     ].
   211     self unselect.
   209     self unselect.
   212 !
   210 !
   213 
   211 
   214 deleteSelection
   212 deleteSelection
   215     "delete the selection; not into the paste buffer (undo)
   213     "delete the selection; copy the selection into the cut&paste-buffer
   216     "
   214      and open a transaction
   217     |text|
   215     "
       
   216     |text specs|
   218 
   217 
   219     self numberOfSelections ~~ 0 ifTrue:[
   218     self numberOfSelections ~~ 0 ifTrue:[
   220         text := self transactionTextFor:selection.
   219         specs := self generateSpecFor:selection.
       
   220         text  := self transactionTextFor:selection.
   221 
   221 
   222         undoHistory transaction:#cut text:text do:[
   222         undoHistory transaction:#cut text:text do:[
   223             super deleteSelection
   223             super deleteSelection
   224         ].
   224         ].
       
   225         self setSelection:specs
   225     ]
   226     ]
   226 !
   227 !
   227 
   228 
   228 pasteBuffer
   229 pasteBuffer
   229     "add the objects in the paste-buffer
   230     "add the objects in the paste-buffer to the object view
   230     "
   231     "
   231     |paste builder frame pasteOrigin pasteOffset|
   232     |paste builder frame pasteOrigin pasteOffset|
   232 
   233 
   233     paste := self getSelection.
   234     paste := self getSelection.
   234 
   235 
   235     (self canPaste:paste) ifFalse:[ ^ self].
   236     (self canPaste:paste) ifFalse:[ ^ self].
   236     (paste isCollection)  ifFalse:[ paste := Array with:paste].
   237     (paste isCollection)  ifFalse:[ paste := Array with:paste].
   237 
   238 
   238     frame := self singleSelection.
   239     frame := self singleSelection.
   239 
   240 
   240     (self supportsSubComponents:frame) ifFalse:[
   241     (self canPasteInto:frame) ifFalse:[
   241         frame := self
   242         frame := self
   242     ].
   243     ].
   243     self unselect.
   244     self unselect.
   244 
   245 
   245     builder     := UIBuilder new.
   246     builder     := UIBuilder new.
   275         selection := selection at:1
   276         selection := selection at:1
   276     ].
   277     ].
   277     self showSelection.
   278     self showSelection.
   278     self realizeAllSubViews.
   279     self realizeAllSubViews.
   279     inputView raise.
   280     inputView raise.
       
   281     self elementChangedSize:frame.
   280     self changed:#tree
   282     self changed:#tree
   281 
   283 
   282 ! !
   284 ! !
   283 
   285 
   284 !UIPainterView methodsFor:'creating subviews'!
   286 !UIPainterView methodsFor:'creating subviews'!
   294     ].
   296     ].
   295 
   297 
   296     viewProperties add:props.
   298     viewProperties add:props.
   297     name := props name.
   299     name := props name.
   298 
   300 
   299     aView specClass basicNew supportsLabel ifTrue:[
   301     aView specClass supportsLabel ifTrue:[
   300         aView label:name
   302         aView label:name
   301     ].
   303     ].
   302     aView name:name.
   304     aView name:name.
   303   ^ props
   305   ^ props
   304 !
   306 !
   305 
   307 
   306 propertiesForNewView:aView
   308 propertiesForNewView:aView
       
   309     "generate property for a view and return properties
       
   310     "
   307     |cls props index|
   311     |cls props index|
   308 
   312 
   309     cls := aView class.
   313     cls := aView class.
   310 
   314 
   311     props := ViewProperty new.
   315     props := ViewProperty new.
   346 ! !
   350 ! !
   347 
   351 
   348 !UIPainterView methodsFor:'event handling'!
   352 !UIPainterView methodsFor:'event handling'!
   349 
   353 
   350 keyPress:key x:x y:y
   354 keyPress:key x:x y:y
       
   355     "any key pressed
       
   356     "
   351     <resource: #keyboard ( #Copy #Paste) >
   357     <resource: #keyboard ( #Copy #Paste) >
   352 
   358 
   353     key == #Copy ifTrue:[
   359     key == #Copy ifTrue:[
   354         ^ self copySelection
   360         ^ self copySelection
   355     ].
   361     ].
   403     ].
   409     ].
   404 
   410 
   405     code := ''.
   411     code := ''.
   406 
   412 
   407     viewProperties do:[:aProp |
   413     viewProperties do:[:aProp |
   408         |modelSelector protoSpec thisCode|
   414         |modelSelector menuSelector protoSpec thisCode|
   409 
   415 
   410         (modelSelector := aProp aspectSelector) notNil ifTrue:[
   416         (modelSelector := aProp aspectSelector) notNil ifTrue:[
   411             (cls implements:modelSelector asSymbol) ifFalse:[
   417             (cls implements:modelSelector asSymbol) ifFalse:[
   412                 protoSpec := aProp view specClass basicNew.
   418                 protoSpec := aProp view specClass basicNew.
   413                 "/ kludge ..
   419                 "/ kludge ..
   414                 (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
   420                 (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
   415                     thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
   421                     thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
   416                 ] ifFalse:[
   422                 ] ifFalse:[
   417                     thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
   423                     thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
   418                 ].
   424                 ].
       
   425                 code := code , thisCode
       
   426             ].
       
   427         ].
       
   428 
       
   429         (menuSelector := aProp menuSelector) notNil ifTrue:[
       
   430             (cls implements:menuSelector asSymbol) ifFalse:[
       
   431                 protoSpec := aProp view specClass basicNew.
       
   432                 "/ kludge ..
       
   433                 thisCode := (self generateAspectMethodFor:menuSelector spec:protoSpec inClass:cls).
   419                 code := code , thisCode
   434                 code := code , thisCode
   420             ]
   435             ]
   421         ]
   436         ]
   422     ].
   437     ].
   423     ^ code
   438     ^ code
   831         newSpec menu:menuSelector
   846         newSpec menu:menuSelector
   832     ].
   847     ].
   833     (labelSelector := props labelSelector) notNil ifTrue:[
   848     (labelSelector := props labelSelector) notNil ifTrue:[
   834         newSpec label:labelSelector
   849         newSpec label:labelSelector
   835     ].
   850     ].
   836     (tabable := props tabable) notNil ifTrue:[
   851     (tabable := props tabable) == true ifTrue:[
   837         newSpec tabable:tabable
   852         newSpec tabable:tabable
   838     ].
   853     ].
   839     (defaultable := props defaultable) notNil ifTrue:[
   854     (defaultable := props defaultable) notNil ifTrue:[
   840         newSpec defaultable:defaultable
   855         newSpec defaultable:defaultable
   841     ].
   856     ].
   887         (aView isKindOf:EditField) ifFalse:[
   902         (aView isKindOf:EditField) ifFalse:[
   888             self warn:'select EditFields only !!'.
   903             self warn:'select EditFields only !!'.
   889             ^ self
   904             ^ self
   890         ]
   905         ]
   891     ].
   906     ].
   892     self selectionHiddenDo:[
   907     self withSelectionHiddenDo:[
   893         group := EnterFieldGroup new.
   908         group := EnterFieldGroup new.
   894 
   909 
   895         props := GroupProperties new.
   910         props := GroupProperties new.
   896         props elementClass:EnterFieldGroup.
   911         props elementClass:EnterFieldGroup.
   897         props group:group.
   912         props group:group.
   920         (aView isKindOf:RadioButton) ifFalse:[
   935         (aView isKindOf:RadioButton) ifFalse:[
   921             self warn:'select RadioButtons only !!'.
   936             self warn:'select RadioButtons only !!'.
   922             ^ self
   937             ^ self
   923         ]
   938         ]
   924     ].
   939     ].
   925     self selectionHiddenDo:[
   940     self withSelectionHiddenDo:[
   926         group := RadioButtonGroup new.
   941         group := RadioButtonGroup new.
   927 
   942 
   928         props := GroupProperties new.
   943         props := GroupProperties new.
   929         props elementClass:RadioButtonGroup.
   944         props elementClass:RadioButtonGroup.
   930         props group:group.
   945         props group:group.
   948 ! !
   963 ! !
   949 
   964 
   950 !UIPainterView methodsFor:'initialization'!
   965 !UIPainterView methodsFor:'initialization'!
   951 
   966 
   952 initialize
   967 initialize
       
   968     "setup attributes
       
   969     "
   953     super initialize.
   970     super initialize.
   954 
   971 
   955     superclassName := 'ApplicationModel'.
   972     superclassName := 'ApplicationModel'.
   956     className      := 'NewApplication'.
   973     className      := 'NewApplication'.
   957     methodName     := 'windowSpec'.
   974     methodName     := 'windowSpec'.
  1111 ! !
  1128 ! !
  1112 
  1129 
  1113 !UIPainterView methodsFor:'menus'!
  1130 !UIPainterView methodsFor:'menus'!
  1114 
  1131 
  1115 menu
  1132 menu
       
  1133     "returns middle-button menu dependent on the selection
       
  1134     "
  1116     |menu canPaste|
  1135     |menu canPaste|
  1117 
  1136 
  1118     testMode ifTrue:[^ nil ].
  1137     testMode ifTrue:[^ nil ].
  1119 
  1138 
  1120     canPaste := self canPaste:(self getSelection).
  1139     canPaste := self canPaste:(self getSelection).
  1156                                   nil
  1175                                   nil
  1157                                   nil
  1176                                   nil
  1158                               )
  1177                               )
  1159                      receiver:self.
  1178                      receiver:self.
  1160 
  1179 
  1161     (canPaste and:[self supportsSubComponents:selection]) ifFalse:[
  1180     (canPaste and:[self canPasteInto:selection]) ifFalse:[
  1162         menu disable:#pasteBuffer
  1181         menu disable:#pasteBuffer
  1163     ].
  1182     ].
  1164 
  1183 
  1165     menu subMenuAt:#arrange   put:(self subMenuArrange).
  1184     menu subMenuAt:#arrange   put:(self subMenuArrange).
  1166     menu subMenuAt:#dimension put:(self subMenuDimension).
  1185     menu subMenuAt:#dimension put:(self subMenuDimension).
  1167     menu subMenuAt:#align     put:(self subMenuAlign).
  1186     menu subMenuAt:#align     put:(self subMenuAlign).
  1168   ^ menu
  1187   ^ menu
       
  1188 
       
  1189 
  1169 
  1190 
  1170 !
  1191 !
  1171 
  1192 
  1172 subMenuAlign
  1193 subMenuAlign
  1173     "returns submenu alignment
  1194     "returns submenu alignment
  1184                                     'align centered vertical'
  1205                                     'align centered vertical'
  1185                                     'align centered horizontal'
  1206                                     'align centered horizontal'
  1186                                     '-'
  1207                                     '-'
  1187                                     'spread horizontal'
  1208                                     'spread horizontal'
  1188                                     'spread vertical'
  1209                                     'spread vertical'
       
  1210                                     '-'
  1189                                     'center horizontal in frame'
  1211                                     'center horizontal in frame'
  1190                                     'center vertical in frame'
  1212                                     'center vertical in frame'
  1191                                   )
  1213                                   )
  1192                          )
  1214                          )
  1193 
  1215 
  1200                             alignSelectionCenterHor
  1222                             alignSelectionCenterHor
  1201                             alignSelectionCenterVer
  1223                             alignSelectionCenterVer
  1202                             nil
  1224                             nil
  1203                             spreadSelectionHor
  1225                             spreadSelectionHor
  1204                             spreadSelectionVer
  1226                             spreadSelectionVer
       
  1227                             nil
  1205                             centerSelectionHor
  1228                             centerSelectionHor
  1206                             centerSelectionVer
  1229                             centerSelectionVer
  1207                          )
  1230                          )
  1208                receiver:self.
  1231                receiver:self.
  1209     ^ menu    
  1232     ^ menu    
  1304                 face:face
  1327                 face:face
  1305                style:style
  1328                style:style
  1306                 size:size.
  1329                 size:size.
  1307 
  1330 
  1308     f notNil ifTrue:[
  1331     f notNil ifTrue:[
  1309         self selectionHiddenDo:[
  1332         self withSelectionHiddenDo:[
  1310             self selectionDo:[:aView |
  1333             self selectionDo:[:aView |
  1311                 aView font:f.
  1334                 aView font:f.
  1312                 self elementChanged:aView.
  1335                 self elementChangedSize:aView.
  1313             ]
  1336             ]
  1314         ]
  1337         ].
       
  1338         self changed:#any.
  1315     ]
  1339     ]
  1316 
  1340 
  1317     "Modified: 5.9.1995 / 12:13:27 / claus"
  1341     "Modified: 5.9.1995 / 12:13:27 / claus"
  1318 !
  1342 !
  1319 
  1343 
  1325     prop isNil ifTrue:[
  1349     prop isNil ifTrue:[
  1326         ^ self error:'no such view'
  1350         ^ self error:'no such view'
  1327     ].
  1351     ].
  1328 
  1352 
  1329     ((aView respondsTo:#label:) and:[aView label = prop name]) ifTrue:[
  1353     ((aView respondsTo:#label:) and:[aView label = prop name]) ifTrue:[
  1330         self selectionHiddenDo:[
  1354         self withSelectionHiddenDo:[
  1331             |layout|
  1355             |layout|
  1332             layout := aView geometryLayout copy.
  1356             layout := aView geometryLayout copy.
  1333             aView label:newName.
  1357             aView label:newName.
  1334             aView geometryLayout:layout.
  1358             aView geometryLayout:layout.
  1335         ]
  1359         ]
  1389 
  1413 
  1390 
  1414 
  1391 !
  1415 !
  1392 
  1416 
  1393 removeAll
  1417 removeAll
  1394     "remove the argument, anObject"
  1418     "remove all objects and properties
  1395 
  1419     "
  1396     self unselect.
  1420     self unselect.
       
  1421     viewProperties := OrderedCollection new.
  1397 
  1422 
  1398     subViews notNil ifTrue:[
  1423     subViews notNil ifTrue:[
  1399         subViews copy do:[:sub |
  1424         subViews copy do:[:sub |
  1400             sub ~~ inputView ifTrue:[   
  1425             sub ~~ inputView ifTrue:[   
  1401                 self removeTreeFrom:sub
  1426                 self removeTreeFrom:sub
  1402             ]
  1427             ]
  1403         ]
  1428         ]
  1404     ].
  1429     ].
  1405     viewProperties := OrderedCollection new.
       
  1406     undoHistory reinitialize.
  1430     undoHistory reinitialize.
  1407     self changed:#tree
  1431     self changed:#tree
  1408 !
  1432 !
  1409 
  1433 
  1410 removeObject:anObject
  1434 removeObject:anObject
  1420     self removeTreeFrom:anObject.
  1444     self removeTreeFrom:anObject.
  1421     self changed:#tree
  1445     self changed:#tree
  1422 !
  1446 !
  1423 
  1447 
  1424 removeTreeFrom:anObject
  1448 removeTreeFrom:anObject
  1425     "remove the argument, anObject and all of its children
  1449     "remove the argument, anObject and all of its subviews
  1426     "
  1450     "
  1427     |props|
  1451     |props|
  1428 
  1452 
  1429     anObject notNil ifTrue:[
  1453     anObject notNil ifTrue:[
  1430         (anObject subViews notNil) ifTrue:[
  1454         (anObject subViews notNil) ifTrue:[
  1459     ].
  1483     ].
  1460     ^ view
  1484     ^ view
  1461 !
  1485 !
  1462 
  1486 
  1463 findViewWithId:aViewId
  1487 findViewWithId:aViewId
  1464     "finds view assigned to id and returns the view or nil
  1488     "finds view assigned to identifier and returns the view or nil
  1465     "
  1489     "
  1466     |prop|
  1490     |prop|
  1467 
  1491 
  1468     prop := self propertyOfIdentifier:aViewId.
  1492     prop := self propertyOfIdentifier:aViewId.
  1469 
  1493 
  1472 ! !
  1496 ! !
  1473 
  1497 
  1474 !UIPainterView methodsFor:'seraching property'!
  1498 !UIPainterView methodsFor:'seraching property'!
  1475 
  1499 
  1476 propertyOf:something
  1500 propertyOf:something
  1477 
  1501     "returns property assigned to group or view
       
  1502     "
  1478     ^ viewProperties detect:[:p| (p view == something or:[p group == something])]
  1503     ^ viewProperties detect:[:p| (p view == something or:[p group == something])]
  1479                      ifNone:nil
  1504                      ifNone:nil
  1480 
  1505 
  1481 
  1506 
  1482 
  1507 
  1483 
  1508 
  1484 
  1509 
  1485 !
  1510 !
  1486 
  1511 
  1487 propertyOfGroup:aGroup
  1512 propertyOfGroup:aGroup
  1488 
  1513     "returns property assigned to group
       
  1514     "
  1489     ^ viewProperties detect:[:p| p group == aGroup] ifNone:nil
  1515     ^ viewProperties detect:[:p| p group == aGroup] ifNone:nil
  1490 !
  1516 !
  1491 
  1517 
  1492 propertyOfIdentifier:anId
  1518 propertyOfIdentifier:anId
  1493 
  1519     "returns property assigned to unique identifier
       
  1520     "
  1494     anId notNil ifTrue:[
  1521     anId notNil ifTrue:[
  1495         ^ viewProperties detect:[:p| p identifier == anId] ifNone:nil.
  1522         ^ viewProperties detect:[:p| p identifier == anId] ifNone:nil.
  1496     ].
  1523     ].
  1497     ^ nil
  1524     ^ nil
  1498 !
  1525 !
  1499 
  1526 
  1500 propertyOfName:aString
  1527 propertyOfName:aString
  1501 
  1528     "returns property assigned to name
       
  1529     "
  1502     aString = 'self' ifFalse:[
  1530     aString = 'self' ifFalse:[
  1503         ^ viewProperties detect:[:p| p name = aString] ifNone:nil
  1531         ^ viewProperties detect:[:p| p name = aString] ifNone:nil
  1504     ].
  1532     ].
  1505     ^ nil
  1533     ^ nil
  1506 !
  1534 !
  1507 
  1535 
  1508 propertyOfView:aView
  1536 propertyOfView:aView
  1509 
  1537     "returns property assigned to view
       
  1538     "
  1510     (aView isNil or:[aView == self]) ifFalse:[
  1539     (aView isNil or:[aView == self]) ifFalse:[
  1511         ^ viewProperties detect:[:p| p view == aView] ifNone:nil
  1540         ^ viewProperties detect:[:p| p view == aView] ifNone:nil
  1512     ].
  1541     ].
  1513     ^ nil
  1542     ^ nil
  1514 ! !
  1543 ! !
  1515 
  1544 
  1516 !UIPainterView methodsFor:'testing'!
  1545 !UIPainterView methodsFor:'testing'!
  1517 
  1546 
  1518 isHorizontalResizable:aComponent
  1547 isHorizontalResizable:aComponent
  1519 
  1548     "returns true if instance is horizontal resizeable
       
  1549     "
  1520     (aComponent isKindOf:ScrollBar) ifTrue:[
  1550     (aComponent isKindOf:ScrollBar) ifTrue:[
  1521         ^ aComponent orientation == #horizontal
  1551         ^ aComponent orientation == #horizontal
  1522     ].
  1552     ].
  1523     (aComponent isKindOf:Scroller) ifTrue:[
  1553     (aComponent isKindOf:Scroller) ifTrue:[
  1524         ^ aComponent orientation == #horizontal
  1554         ^ aComponent orientation == #horizontal
  1530 
  1560 
  1531 
  1561 
  1532 !
  1562 !
  1533 
  1563 
  1534 isVerticalResizable:aComponent
  1564 isVerticalResizable:aComponent
  1535 
  1565     "returns true if instance is vertical resizeable
       
  1566     "
  1536     (aComponent isKindOf:EditField) ifTrue:[
  1567     (aComponent isKindOf:EditField) ifTrue:[
  1537         ^ false
  1568         ^ false
  1538     ].
  1569     ].
  1539     (aComponent isKindOf:ComboBoxView) ifTrue:[
  1570     (aComponent isKindOf:ComboBoxView) ifTrue:[
  1540         ^ false
  1571         ^ false
  1598 ! !
  1629 ! !
  1599 
  1630 
  1600 !UIPainterView methodsFor:'undo actions'!
  1631 !UIPainterView methodsFor:'undo actions'!
  1601 
  1632 
  1602 undoCreate:aViewId
  1633 undoCreate:aViewId
       
  1634     "undo method when creating or pasting an object
       
  1635     "
  1603     |view|
  1636     |view|
  1604 
  1637 
  1605     undoHistory addUndoBlock:[
  1638     undoHistory addUndoBlock:[
  1606         (view := self findViewWithId:aViewId) notNil ifTrue:[
  1639         (view := self findViewWithId:aViewId) notNil ifTrue:[
  1607             self removeObject:view
  1640             self removeObject:view
  1609     ]
  1642     ]
  1610 
  1643 
  1611 !
  1644 !
  1612 
  1645 
  1613 undoLayout:aViewId
  1646 undoLayout:aViewId
  1614     "undo method layout
  1647     "undo method when changing the layout (position or dimension)
  1615     "
  1648     "
  1616     |view layout|
  1649     |view layout extent|
  1617 
  1650 
  1618     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1651     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1619         layout := view geometryLayout copy.
  1652         (layout := view geometryLayout copy) isNil ifTrue:[
  1620         view   := nil.
  1653             extent := view extent copy
  1621 
  1654         ].
  1622         layout notNil ifTrue:[
  1655         undoHistory addUndoBlock:[
  1623             undoHistory addUndoBlock:[
  1656             (view := self findViewWithId:aViewId) notNil ifTrue:[
  1624                 (view := self findViewWithId:aViewId) notNil ifTrue:[
  1657                 layout notNil ifTrue:[view geometryLayout:layout]
  1625                     view geometryLayout:layout
  1658                              ifFalse:[view extent:extent]
  1626                 ]
       
  1627             ]
  1659             ]
  1628         ] ifFalse:[
  1660         ]
  1629             layout := view pixelOrigin.
  1661     ].
  1630 
  1662     view := nil
  1631             undoHistory addUndoBlock:[
       
  1632                 (view := self findViewWithId:aViewId) notNil ifTrue:[
       
  1633                     view pixelOrigin:layout
       
  1634                 ]
       
  1635             ]
       
  1636         ]
       
  1637     ]
       
  1638 !
  1663 !
  1639 
  1664 
  1640 undoLayoutView:aView
  1665 undoLayoutView:aView
  1641     "undo method for changing layout on a view
  1666     "undo method for changing layout on a view
  1642     "
  1667     "
  1649         ]
  1674         ]
  1650     ]
  1675     ]
  1651 !
  1676 !
  1652 
  1677 
  1653 undoRemove:aViewId
  1678 undoRemove:aViewId
  1654     "prepare undo method
  1679     "undo method when removing an object
  1655     "
  1680     "
  1656     |view prop spec parentId|
  1681     |view prop spec parentId|
  1657 
  1682 
  1658     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1683     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1659         spec := (self generateSpecFor:view) first.
  1684         spec := (self generateSpecFor:view) first.
  1660         view := view superView.
  1685         view := view superView.
  1661 
  1686 
  1662         (self supportsSubComponents:view) ifTrue:[
  1687         (self canPasteInto:view) ifTrue:[
  1663             prop := self propertyOfView:view.
  1688             (prop := self propertyOfView:view) notNil ifTrue:[
  1664 
       
  1665             prop notNil ifTrue:[
       
  1666                 parentId := prop identifier
  1689                 parentId := prop identifier
  1667             ]
  1690             ]
  1668         ].
  1691         ].
  1669         view := nil.
  1692         view := nil.
  1670         prop := nil.
  1693         prop := nil.
  1689         ].
  1712         ].
  1690     ]
  1713     ]
  1691 !
  1714 !
  1692 
  1715 
  1693 undoSpecModify:aViewId
  1716 undoSpecModify:aViewId
  1694     "undo for updateFromSpec
  1717     "undo method when changing the specification for an object
  1695     "
  1718     "
  1696     |builder view spec|
  1719     |builder view spec|
  1697 
  1720 
  1698     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1721     (view := self findViewWithId:aViewId) notNil ifTrue:[
  1699         spec := (self generateSpecFor:view) first.
  1722         spec := (self generateSpecFor:view) first.
  1701 
  1724 
  1702         undoHistory addUndoBlock:[
  1725         undoHistory addUndoBlock:[
  1703             (view := self findViewWithId:aViewId) notNil ifTrue:[
  1726             (view := self findViewWithId:aViewId) notNil ifTrue:[
  1704                 builder := UIBuilder new.
  1727                 builder := UIBuilder new.
  1705                 spec setAttributesIn:view with:builder.
  1728                 spec setAttributesIn:view with:builder.
  1706                 view superView sizeChanged:nil
  1729                 self elementChangedSize:view.
  1707             ]
  1730             ]
  1708         ]
  1731         ]
  1709     ].
  1732     ].
  1710 
  1733 
  1711 
  1734 
  1718     "update current selected view from specification
  1741     "update current selected view from specification
  1719     "
  1742     "
  1720     |props name builder|
  1743     |props name builder|
  1721 
  1744 
  1722     self singleSelection notNil ifTrue:[
  1745     self singleSelection notNil ifTrue:[
  1723         self selectionHiddenDo:[
  1746         self withSelectionHiddenDo:[
  1724             self transaction:#specification selectionDo:[:aView|
  1747             self transaction:#specification selectionDo:[:aView|
  1725                 builder := UIBuilder new.
  1748                 builder := UIBuilder new.
  1726                 props   := self propertyOfView:aView.
  1749                 props   := self propertyOfView:aView.
  1727                 name    := aSpec name.
  1750                 name    := aSpec name.
  1728 
  1751 
  1740                         aSpec name:(aView name).
  1763                         aSpec name:(aView name).
  1741                     ]
  1764                     ]
  1742                 ].
  1765                 ].
  1743 
  1766 
  1744                 aSpec setAttributesIn:aView with:builder.
  1767                 aSpec setAttributesIn:aView with:builder.
  1745                 aView superView sizeChanged:nil.
  1768                 self elementChangedSize:aView.
  1746 
  1769 
  1747                 props tabable:aSpec tabable.
  1770                 props tabable:aSpec tabable.
  1748                 props defaultable:aSpec defaultable.
  1771                 props defaultable:aSpec defaultable.
  1749                 props initiallyInvisible:aSpec initiallyInvisible.
  1772                 props initiallyInvisible:aSpec initiallyInvisible.
  1750                 props aspectSelector:aSpec modelSelector.
  1773                 props aspectSelector:aSpec modelSelector.
  1751                 props changeSelector:aSpec changeSelector.
  1774                 props changeSelector:aSpec changeSelector.
  1752                 props labelSelector:aSpec labelSelector.
  1775                 props labelSelector:aSpec labelSelector.
  1753                 props menuSelector:aSpec menuSelector.
  1776                 props menuSelector:aSpec menuSelector.
  1754             ].
  1777             ]
  1755             self changed:#tree
  1778         ].
  1756         ]
  1779         self changed:#tree
  1757     ].
  1780     ].
  1758 
  1781 
  1759 ! !
  1782 ! !
  1760 
  1783 
  1761 !UIPainterView::ViewProperty class methodsFor:'documentation'!
  1784 !UIPainterView::ViewProperty class methodsFor:'documentation'!