2656 ) |
2655 ) |
2657 (MenuItem |
2656 (MenuItem |
2658 activeHelpKey: editOpenSpecDocumentation |
2657 activeHelpKey: editOpenSpecDocumentation |
2659 label: 'Open Widget Documentation' |
2658 label: 'Open Widget Documentation' |
2660 itemValue: doOpenWidgetDocumentation |
2659 itemValue: doOpenWidgetDocumentation |
|
2660 enabled: hasOneSelectionOtherThanCanvas |
2661 ) |
2661 ) |
2662 (MenuItem |
2662 (MenuItem |
2663 activeHelpKey: referToConfigDatabase |
2663 activeHelpKey: referToConfigDatabase |
2664 label: 'Refer to Config Database' |
2664 label: 'Refer to Config Database' |
2665 itemValue: configSelection |
2665 itemValue: configSelection |
2718 ) |
2719 ) |
2719 (MenuItem |
2720 (MenuItem |
2720 activeHelpKey: editBrowseViewClass |
2721 activeHelpKey: editBrowseViewClass |
2721 label: 'Browse Specification Class' |
2722 label: 'Browse Specification Class' |
2722 itemValue: doBrowseSpecificationClass |
2723 itemValue: doBrowseSpecificationClass |
|
2724 enabled: hasOneSelectionOtherThanCanvas |
2723 ) |
2725 ) |
2724 (MenuItem |
2726 (MenuItem |
2725 activeHelpKey: editInspectSpec |
2727 activeHelpKey: editInspectSpec |
2726 label: 'Inspect Spec' |
2728 label: 'Inspect Spec' |
2727 itemValue: doInspectSpec |
2729 itemValue: doInspectSpec |
|
2730 enabled: hasOneSelectionOtherThanCanvas |
2728 ) |
2731 ) |
2729 (MenuItem |
2732 (MenuItem |
2730 label: '-' |
2733 label: '-' |
2731 ) |
2734 ) |
2732 (MenuItem |
2735 (MenuItem |
3449 holder addDependent:self. |
3453 holder addDependent:self. |
3450 ]. |
3454 ]. |
3451 ^ holder |
3455 ^ holder |
3452 ! |
3456 ! |
3453 |
3457 |
|
3458 hasMultipleSelectionOtherThanCanvas |
|
3459 "returns a value holder which is true in case that multiple widget other than the root are selected" |
|
3460 |
|
3461 ^ builder booleanValueAspectFor:#hasMultipleSelectionOtherThanCanvas |
|
3462 ! |
|
3463 |
3454 hasOneSelectionOtherThanCanvas |
3464 hasOneSelectionOtherThanCanvas |
3455 "returns a value holder which is true in case that one widget is selected |
3465 "returns a value holder which is true in case that one widget is selected |
3456 other than the root" |
3466 other than the root" |
3457 |
3467 |
3458 ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas |
3468 ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas |
|
3469 ! |
|
3470 |
|
3471 hasSelectionOtherThanCanvas |
|
3472 "returns a value holder which is true in case that any widget other than the root is selected" |
|
3473 |
|
3474 ^ builder booleanValueAspectFor:#hasSelectionOtherThanCanvas |
3459 ! |
3475 ! |
3460 |
3476 |
3461 hasUndoHistory |
3477 hasUndoHistory |
3462 ^ self painter hasUndoHistory |
3478 ^ self painter hasUndoHistory |
3463 ! |
3479 ! |
4025 self canExchangeSelectionLayouts value:(treeView canExchangeSelectionLayouts). |
4041 self canExchangeSelectionLayouts value:(treeView canExchangeSelectionLayouts). |
4026 self canChangeOrderInContainer value:(treeView canChangeOrderInContainer). |
4042 self canChangeOrderInContainer value:(treeView canChangeOrderInContainer). |
4027 self canMoveSelectionIntoContainer value:(treeView canMoveSelectionIntoContainer). |
4043 self canMoveSelectionIntoContainer value:(treeView canMoveSelectionIntoContainer). |
4028 self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer). |
4044 self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer). |
4029 self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas). |
4045 self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas). |
4030 |
4046 self hasSelectionOtherThanCanvas value:(treeView hasSelectionOtherThanCanvas). |
|
4047 self hasMultipleSelectionOtherThanCanvas value:(treeView hasMultipleSelectionOtherThanCanvas). |
|
4048 |
4031 "/ the top-node cannot be cut, copied or pasted. |
4049 "/ the top-node cannot be cut, copied or pasted. |
4032 canCutOrCopy := treeView selection notEmptyOrNil and:[treeView selection first ~~ 1]. |
4050 canCutOrCopy := treeView selection notEmptyOrNil and:[treeView selection first ~~ 1]. |
4033 |
4051 |
4034 self canCutHolder value: canCutOrCopy. |
4052 self canCutHolder value: canCutOrCopy. |
4035 self canCopyHolder value: canCutOrCopy. |
4053 self canCopyHolder value: canCutOrCopy. |
5374 self clearModifiedFlag. |
5392 self clearModifiedFlag. |
5375 self clearModified. |
5393 self clearModified. |
5376 ] |
5394 ] |
5377 ! |
5395 ! |
5378 |
5396 |
|
5397 hideEditToolbar |
|
5398 self editToolBarVisibleHolder value:false |
|
5399 ! |
|
5400 |
|
5401 hideToolbar |
|
5402 self toolBarVisibleHolder value:false |
|
5403 ! |
|
5404 |
|
5405 replaceWidgetByClass:aSpecOrWidgetClass |
|
5406 "replace the selected widget by a new instance of aSpecOrWidgetClass, |
|
5407 which gets the old widget's layout" |
|
5408 |
|
5409 |newSpecClass oldSpec newSpec| |
|
5410 |
|
5411 treeView isCanvasSelected ifTrue:[ |
|
5412 ^ self |
|
5413 ]. |
|
5414 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
5415 ^ newSpecClass |
|
5416 ]. |
|
5417 |
|
5418 oldSpec := self selectedSpec. |
|
5419 newSpec := newSpecClass cloneFrom:oldSpec. |
|
5420 |
|
5421 self painter replaceSelectionBy:newSpec. |
|
5422 |
|
5423 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
5424 ! |
|
5425 |
|
5426 setMoveByStep:nPixels |
|
5427 "change the number of pixels by which the step-buttons move the selected widget(s)" |
|
5428 |
|
5429 self painter nPixelsForMoveSelection:nPixels |
|
5430 ! |
|
5431 |
|
5432 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass |
|
5433 |newSpecClass| |
|
5434 |
|
5435 (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[ |
|
5436 newSpecClass := aSpecOrWidgetClass. |
|
5437 ] ifFalse:[ |
|
5438 (aSpecOrWidgetClass isSubclassOf:View) ifTrue:[ |
|
5439 newSpecClass := aSpecOrWidgetClass basicNew specClass. |
|
5440 ] ifFalse:[ |
|
5441 newSpecClass := nil |
|
5442 ]. |
|
5443 ]. |
|
5444 newSpecClass isNil ifTrue:[ |
|
5445 Dialog warn:'Invalid Spec- or View-Class: ' , aSpecOrWidgetClass name. |
|
5446 ^ nil. |
|
5447 ]. |
|
5448 ^ newSpecClass |
|
5449 ! |
|
5450 |
|
5451 useBackgroundImage |
|
5452 "select bitmap to underly" |
|
5453 |
|
5454 |fn| |
|
5455 |
|
5456 fn := Dialog requestFileName:'Bitmap Image File ?' pattern:'*.gif;*.tiff;*.jpg;*.png' fromDirectory:'f:'. |
|
5457 fn isNil ifTrue:[ |
|
5458 ^ self |
|
5459 ]. |
|
5460 painter useSketchFile:fn |
|
5461 |
|
5462 "Created: / 16-01-2008 / 17:49:20 / cg" |
|
5463 ! |
|
5464 |
|
5465 useSketch |
|
5466 "select sketchfile to underly. |
|
5467 Sketchfiles are generated by notepads, which can offline-store drawn sketches" |
|
5468 |
|
5469 |fn| |
|
5470 |
|
5471 fn := Dialog requestFileName:'Sketch (Notepad Drawing) ?' pattern:'*.TOP' fromDirectory:'f:'. |
|
5472 fn isNil ifTrue:[ |
|
5473 ^ self |
|
5474 ]. |
|
5475 painter useSketchFile:fn |
|
5476 |
|
5477 "Created: / 16-01-2008 / 17:49:20 / cg" |
|
5478 ! |
|
5479 |
|
5480 wrapWidgetIntoClass:aSpecOrWidgetClass |
|
5481 "put the selected widget into a new instance of aSpecOrWidgetClass, |
|
5482 which gets the wrapped widget's layout" |
|
5483 |
|
5484 |newSpecClass oldSpec newSpec| |
|
5485 |
|
5486 treeView isCanvasSelected ifTrue:[ |
|
5487 ^ self |
|
5488 ]. |
|
5489 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
5490 ^ newSpecClass |
|
5491 ]. |
|
5492 |
|
5493 oldSpec := self selectedSpec. |
|
5494 newSpec := newSpecClass new. |
|
5495 newSpec layout:oldSpec layout. |
|
5496 newSpec component:oldSpec. |
|
5497 |
|
5498 self painter replaceSelectionBy:newSpec. |
|
5499 |
|
5500 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
5501 ! ! |
|
5502 |
|
5503 !UIPainter methodsFor:'user actions-menu'! |
|
5504 |
5379 doAskAndReplaceWidgetBy |
5505 doAskAndReplaceWidgetBy |
5380 "ask for a widget class, |
5506 "ask for a widget class, |
5381 and replace the selected widget by a new instance of that one, |
5507 and replace the selected widget by a new instance of that one, |
5382 which gets the old widget's layout" |
5508 which gets the old widget's layout" |
5383 |
5509 |
5414 doAskAndWrapWidgetInto |
5540 doAskAndWrapWidgetInto |
5415 "ask for a container class, |
5541 "ask for a container class, |
5416 and put the selected widget into a new instance of that one, |
5542 and put the selected widget into a new instance of that one, |
5417 which gets the wrapped widget's layout" |
5543 which gets the wrapped widget's layout" |
5418 |
5544 |
5419 Dialog information:'sorry - unfinished.'. |
5545 |widgetClass list selectedSpec| |
5420 ^ self. |
5546 |
5421 "/ |widgetClass list selectedSpec| |
5547 selectedSpec := self selectedSpec. |
5422 "/ |
5548 selectedSpec isNil ifTrue:[^ self]. |
5423 "/ selectedSpec := self selectedSpec. |
5549 |
5424 "/ selectedSpec isNil ifTrue:[^ self]. |
5550 list := UISpecification allSubclasses |
5425 "/ |
5551 select:[:cls | |
5426 "/ list := UISpecification allSubclasses |
5552 [ cls viewClass notNil |
5427 "/ select:[:cls | |
5553 and:[ cls supportsSubComponents ]] |
5428 "/ [ cls viewClass notNil |
5554 on: NotFoundError |
5429 "/ and:[ cls supportsSubComponents ]] |
5555 do:[ false ] |
5430 "/ on: NotFoundError |
5556 ]. |
5431 "/ do:[ false ] |
5557 list sort:[:a :b | a name < b name]. |
5432 "/ ]. |
5558 |
5433 "/ list sort:[:a :b | a name < b name]. |
5559 widgetClass := Dialog |
5434 "/ |
5560 requestClass:'Wrap into (Spec or View Class):' |
5435 "/ widgetClass := Dialog |
5561 list:list |
5436 "/ requestClass:'Wrap into (Spec or View Class):' |
5562 okLabel:'OK' |
5437 "/ list:list |
5563 initialAnswer:nil. |
5438 "/ okLabel:'OK' |
5564 widgetClass isNil ifTrue:[ |
5439 "/ initialAnswer:nil. |
5565 ^ self |
5440 "/ widgetClass isNil ifTrue:[ |
5566 ]. |
5441 "/ ^ self |
5567 self wrapWidgetIntoClass:widgetClass |
5442 "/ ]. |
|
5443 "/ self wrapWidgetIntoClass:widgetClass |
|
5444 ! |
5568 ! |
5445 |
5569 |
5446 doBrowseActionMethod:aspectSelector |
5570 doBrowseActionMethod:aspectSelector |
5447 "browse or create the action method as entered in the field |
5571 "browse or create the action method as entered in the field |
5448 (button beside input field in ui-slice pressed)" |
5572 (button beside input field in ui-slice pressed)" |
6414 |
6538 |
6415 CodeView |
6539 CodeView |
6416 openWith: self painter generateWindowSpecMethodSource |
6540 openWith: self painter generateWindowSpecMethodSource |
6417 title: 'Window Spec' |
6541 title: 'Window Spec' |
6418 |
6542 |
6419 ! |
|
6420 |
|
6421 hideEditToolbar |
|
6422 self editToolBarVisibleHolder value:false |
|
6423 ! |
|
6424 |
|
6425 hideToolbar |
|
6426 self toolBarVisibleHolder value:false |
|
6427 ! |
|
6428 |
|
6429 replaceWidgetByClass:aSpecOrWidgetClass |
|
6430 "replace the selected widget by a new instance of aSpecOrWidgetClass, |
|
6431 which gets the old widget's layout" |
|
6432 |
|
6433 |newSpecClass oldSpec newSpec| |
|
6434 |
|
6435 treeView isCanvasSelected ifTrue:[ |
|
6436 ^ self |
|
6437 ]. |
|
6438 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
6439 ^ newSpecClass |
|
6440 ]. |
|
6441 |
|
6442 oldSpec := self selectedSpec. |
|
6443 newSpec := newSpecClass cloneFrom:oldSpec. |
|
6444 |
|
6445 self painter replaceSelectionBy:newSpec. |
|
6446 |
|
6447 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
6448 ! |
|
6449 |
|
6450 setMoveByStep:nPixels |
|
6451 "change the number of pixels by which the step-buttons move the selected widget(s)" |
|
6452 |
|
6453 self painter nPixelsForMoveSelection:nPixels |
|
6454 ! |
|
6455 |
|
6456 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass |
|
6457 |newSpecClass| |
|
6458 |
|
6459 (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[ |
|
6460 newSpecClass := aSpecOrWidgetClass. |
|
6461 ] ifFalse:[ |
|
6462 (aSpecOrWidgetClass isSubclassOf:View) ifTrue:[ |
|
6463 newSpecClass := aSpecOrWidgetClass basicNew specClass. |
|
6464 ] ifFalse:[ |
|
6465 newSpecClass := nil |
|
6466 ]. |
|
6467 ]. |
|
6468 newSpecClass isNil ifTrue:[ |
|
6469 Dialog warn:'Invalid Spec- or View-Class: ' , aSpecOrWidgetClass name. |
|
6470 ^ nil. |
|
6471 ]. |
|
6472 ^ newSpecClass |
|
6473 ! |
|
6474 |
|
6475 useBackgroundImage |
|
6476 "select bitmap to underly" |
|
6477 |
|
6478 |fn| |
|
6479 |
|
6480 fn := Dialog requestFileName:'Bitmap Image File ?' pattern:'*.gif;*.tiff;*.jpg;*.png' fromDirectory:'f:'. |
|
6481 fn isNil ifTrue:[ |
|
6482 ^ self |
|
6483 ]. |
|
6484 painter useSketchFile:fn |
|
6485 |
|
6486 "Created: / 16-01-2008 / 17:49:20 / cg" |
|
6487 ! |
|
6488 |
|
6489 useSketch |
|
6490 "select sketchfile to underly. |
|
6491 Sketchfiles are generated by notepads, which can offline-store drawn sketches" |
|
6492 |
|
6493 |fn| |
|
6494 |
|
6495 fn := Dialog requestFileName:'Sketch (Notepad Drawing) ?' pattern:'*.TOP' fromDirectory:'f:'. |
|
6496 fn isNil ifTrue:[ |
|
6497 ^ self |
|
6498 ]. |
|
6499 painter useSketchFile:fn |
|
6500 |
|
6501 "Created: / 16-01-2008 / 17:49:20 / cg" |
|
6502 ! |
|
6503 |
|
6504 wrapWidgetIntoClass:aSpecOrWidgetClass |
|
6505 "put the selected widget into a new instance of aSpecOrWidgetClass, |
|
6506 which gets the wrapped widget's layout" |
|
6507 |
|
6508 |newSpecClass oldSpec newSpec| |
|
6509 |
|
6510 treeView isCanvasSelected ifTrue:[ |
|
6511 ^ self |
|
6512 ]. |
|
6513 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
6514 ^ newSpecClass |
|
6515 ]. |
|
6516 |
|
6517 oldSpec := self selectedSpec. |
|
6518 newSpec := newSpecClass cloneFrom:oldSpec. |
|
6519 |
|
6520 self painter wrapSelectionInto:newSpec. |
|
6521 |
|
6522 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
6523 ! ! |
6543 ! ! |
6524 |
6544 |
6525 !UIPainter::ApplicationClassQuery class methodsFor:'documentation'! |
6545 !UIPainter::ApplicationClassQuery class methodsFor:'documentation'! |
6526 |
6546 |
6527 documentation |
6547 documentation |
7281 |
7301 |
7282 selection isEmptyOrNil ifTrue:[ ^ false ]. |
7302 selection isEmptyOrNil ifTrue:[ ^ false ]. |
7283 ^ self canvas canResize:(self selectedViews) |
7303 ^ self canvas canResize:(self selectedViews) |
7284 ! |
7304 ! |
7285 |
7305 |
|
7306 hasMultipleSelectionOtherThanCanvas |
|
7307 "returns true in case that any selection other than the canvas exists" |
|
7308 |
|
7309 ^ selection size > 0 and:[ (selection count:[:anyindex | anyindex ~~ 1]) > 1] |
|
7310 ! |
|
7311 |
7286 hasOneSelectionOtherThanCanvas |
7312 hasOneSelectionOtherThanCanvas |
7287 "returns true in case that one selection exists other than the canvas" |
7313 "returns true in case that one selection exists other than the canvas" |
7288 |
7314 |
7289 ^ selection size == 1 and:[selection first ~~ 1] |
7315 ^ selection size == 1 and:[selection first ~~ 1] |
|
7316 ! |
|
7317 |
|
7318 hasSelectionOtherThanCanvas |
|
7319 "returns true in case that any selection other than the canvas exists" |
|
7320 |
|
7321 ^ selection size > 0 and:[selection contains:[:anyindex | anyindex ~~ 1]] |
7290 ! |
7322 ! |
7291 |
7323 |
7292 isCanvasSelected |
7324 isCanvasSelected |
7293 "returns true in case of a single selection and the |
7325 "returns true in case of a single selection and the |
7294 selection is the canvas (index 1)" |
7326 selection is the canvas (index 1)" |