UIPainter.st
changeset 3251 b5188e3ab24f
parent 3241 1fca4b63f4bf
child 3256 175d2d7e95c5
equal deleted inserted replaced
3250:48b1dfb0b16f 3251:b5188e3ab24f
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1995-1998 by eXept Software AG
     2  COPYRIGHT (c) 1995-1998 by eXept Software AG
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
  3848     ].
  3846     ].
  3849     (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
  3847     (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
  3850         spec majorKey isNil ifTrue:[
  3848         spec majorKey isNil ifTrue:[
  3851             ^ self warn:'Cannot find class (no majorKey specified).'.
  3849             ^ self warn:'Cannot find class (no majorKey specified).'.
  3852         ].
  3850         ].
  3853         ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
  3851         ^ self warn:('Cannot find class ', spec majorKey allBold, '.').
  3854     ].
  3852     ].
  3855     sel := spec minorKey.
  3853     sel := spec minorKey.
  3856     meta := cls class whichClassIncludesSelector:sel.
  3854     meta := cls class whichClassIncludesSelector:sel.
  3857     meta isNil ifTrue:[
  3855     meta isNil ifTrue:[
  3858         ^ self warn:'Cannot find selector #', (sel ? '') asBoldText, ' in class ', cls name asBoldText, '!!'
  3856         ^ self warn:'Cannot find selector #', (sel ? '') allBold, ' in class ', cls name allBold, '!!'
  3859     ].
  3857     ].
  3860 
  3858 
  3861     aTwoArgBlock value:meta value:spec minorKey.
  3859     aTwoArgBlock value:meta value:spec minorKey.
  3862 ! !
  3860 ! !
  3863 
  3861 
  4298 
  4296 
  4299 askForSectionModification
  4297 askForSectionModification
  4300     "asks for section modification in the notebook"
  4298     "asks for section modification in the notebook"
  4301 
  4299 
  4302     self isModified ifTrue:[
  4300     self isModified ifTrue:[
  4303         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  4301         (self confirm:'Accept modifications in section ' , tabSelection printString allBold, '?') ifTrue:[
  4304             self accept
  4302             self accept
  4305         ] ifFalse: [
  4303         ] ifFalse: [
  4306             self cancel
  4304             self cancel
  4307         ]
  4305         ]
  4308     ]
  4306     ]
  4323         superclass isNil ifTrue:[
  4321         superclass isNil ifTrue:[
  4324             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  4322             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  4325             ^ false.
  4323             ^ false.
  4326         ].
  4324         ].
  4327 
  4325 
  4328         (self confirm:'Create class ' , specClassName asBoldText, '?') ifTrue:[
  4326         (self confirm:'Create class ' , specClassName allBold, '?') ifTrue:[
  4329             cls := superclass 
  4327             cls := superclass 
  4330                         subclass:(specClassName asSymbol)
  4328                         subclass:(specClassName asSymbol)
  4331                         instanceVariableNames:''
  4329                         instanceVariableNames:''
  4332                         classVariableNames:''
  4330                         classVariableNames:''
  4333                         poolDictionaries:''
  4331                         poolDictionaries:''
  4651     |whatToDo|
  4649     |whatToDo|
  4652 
  4650 
  4653     self isModified ifFalse:[^ true].
  4651     self isModified ifFalse:[^ true].
  4654 
  4652 
  4655     whatToDo := DialogBox 
  4653     whatToDo := DialogBox 
  4656                     confirmWithCancel:'Accept modifications in section ' , tabSelection printString asBoldText, ' ?'
  4654                     confirmWithCancel:'Accept modifications in section ' , tabSelection printString allBold, ' ?'
  4657                     labels:#('Cancel' 'Ignore' 'Accept')
  4655                     labels:#('Cancel' 'Ignore' 'Accept')
  4658                     default:3.
  4656                     default:3.
  4659     whatToDo isNil ifTrue:[^ false].
  4657     whatToDo isNil ifTrue:[^ false].
  4660     whatToDo == true ifTrue:[
  4658     whatToDo == true ifTrue:[
  4661         self accept
  4659         self accept
  6524 
  6522 
  6525     props := UIPainterView::ViewProperty new.
  6523     props := UIPainterView::ViewProperty new.
  6526     props view:aCanvas.
  6524     props view:aCanvas.
  6527 
  6525 
  6528     model root:(TreeItem 
  6526     model root:(TreeItem 
  6529                     name:(nameOfSpec ? painter defaultNameOfCanvas) asBoldText 
  6527                     name:(nameOfSpec ? painter defaultNameOfCanvas) allBold 
  6530                     contents:props).
  6528                     contents:props).
  6531 
  6529 
  6532     model root expand.
  6530     model root expand.
  6533     self enableChannel:(aCanvas enableChannel).
  6531     self enableChannel:(aCanvas enableChannel).
  6534 !
  6532 !
  6708     ].
  6706     ].
  6709     self canvas subViews copy do:[:aView|
  6707     self canvas subViews copy do:[:aView|
  6710         "/ care to not destroy the transparent input view
  6708         "/ care to not destroy the transparent input view
  6711         (aView isInputOnly) ifFalse:[aView destroy]
  6709         (aView isInputOnly) ifFalse:[aView destroy]
  6712     ].
  6710     ].
  6713     model root name: painter defaultNameOfCanvas asBoldText.
  6711     model root name: painter defaultNameOfCanvas allBold.
  6714     model removeAllOtherThanRoot.
  6712     model removeAllOtherThanRoot.
  6715 !
  6713 !
  6716 
  6714 
  6717 removeView:aView
  6715 removeView:aView
  6718     "removes a view"
  6716     "removes a view"
  6855     (    aName size ~~ 0
  6853     (    aName size ~~ 0
  6856      and:[(name := aName string withoutSeparators) size ~~ 0
  6854      and:[(name := aName string withoutSeparators) size ~~ 0
  6857      and:[(self propertyDetect:[:p| p name = name]) isNil
  6855      and:[(self propertyDetect:[:p| p name = name]) isNil
  6858      and:[node name ~= name]]]
  6856      and:[node name ~= name]]]
  6859     ) ifTrue:[
  6857     ) ifTrue:[
  6860         node name: name asBoldText.
  6858         node name: name allBold.
  6861         node changed.   
  6859         node changed.   
  6862     ].
  6860     ].
  6863 !
  6861 !
  6864 
  6862 
  6865 layoutChanged
  6863 layoutChanged