UIObjectView.st
changeset 1959 fd6bf76e712a
parent 1954 1344ec1f99eb
child 1964 65e9cc9d0fcf
equal deleted inserted replaced
1958:109ef8358a55 1959:fd6bf76e712a
  1311     "
  1311     "
  1312     self select:nil
  1312     self select:nil
  1313 !
  1313 !
  1314 
  1314 
  1315 withSelectionHiddenDo:aBlock
  1315 withSelectionHiddenDo:aBlock
  1316     "apply block with selection hidden (no handles)
  1316     "apply block with selection hidden (no handles)"
  1317     "
  1317 
  1318     |coll|
  1318     |coll|
  1319 
  1319 
  1320     selectionHiddenLevel == 0 ifTrue:[
  1320     selectionHiddenLevel == 0 ifTrue:[
  1321         self hideSelection.
  1321         self hideSelection.
  1322         device flush.
  1322         device flush.
  2486 enabled:aState
  2486 enabled:aState
  2487     enabled := aState
  2487     enabled := aState
  2488 !
  2488 !
  2489 
  2489 
  2490 resetModification
  2490 resetModification
  2491     "set modification state to false"
  2491     "set the modification state to false"
  2492 
  2492 
  2493 "/    startIdentifier := identifier
  2493 "/    startIdentifier := identifier
  2494 
  2494 
  2495     identifier := startIdentifier := 0.
  2495     identifier := startIdentifier := 0.
  2496     history    := OrderedCollection new.
  2496     history    := OrderedCollection new.
  2497 ! !
  2497 ! !
  2498 
  2498 
  2499 !UIObjectView::UndoHistory methodsFor:'activation & deactivation'!
  2499 !UIObjectView::UndoHistory methodsFor:'activation & deactivation'!
  2500 
  2500 
  2501 withinTransaction:aType text:aTextOrNil do:aBlock
  2501 withinTransaction:aType text:aTextOrNil do:aBlock
  2502     "open a transaction; perform the block; at least close the transaction"
  2502     "open a transaction; perform the block; finally close the transaction"
  2503 
  2503 
  2504     (enabled and:[transaction isNil]) ifTrue:[
  2504     (enabled and:[transaction isNil]) ifTrue:[
  2505         transaction := Transaction type:aType text:aTextOrNil.
  2505         transaction := Transaction type:aType text:aTextOrNil.
  2506 
  2506 
  2507         aBlock value.
  2507         aBlock value.
  2508 
  2508 
  2509         transaction isEmpty ifFalse:[
  2509         transaction isEmpty ifFalse:[
  2510             identifier := identifier + 1.
  2510             identifier := identifier + 1.
  2511             transaction identifier:identifier.
  2511             transaction identifier:identifier.
  2512             history addLast:transaction.
  2512             history addLast:transaction.
  2513             history size > (self class maxHistorySize) ifTrue:[history removeFirst]
  2513             history size > (self class maxHistorySize) ifTrue:[history removeFirst].
       
  2514             Transcript showCR:aTextOrNil.
  2514         ].
  2515         ].
  2515         transaction := nil
  2516         transaction := nil
  2516 
  2517 
  2517     ] ifFalse:[
  2518     ] ifFalse:[
  2518         aBlock value
  2519         aBlock value
  2597 ! !
  2598 ! !
  2598 
  2599 
  2599 !UIObjectView::UndoHistory methodsFor:'testing'!
  2600 !UIObjectView::UndoHistory methodsFor:'testing'!
  2600 
  2601 
  2601 isEmpty
  2602 isEmpty
  2602     "returns true if undo history is empty"
  2603     "returns true if the undo history is empty"
  2603 
  2604 
  2604     ^ history isEmpty
  2605     ^ history isEmpty
  2605 !
  2606 !
  2606 
  2607 
  2607 isModified
  2608 isModified
  2608     "returns true if history is modified"
  2609     "returns true if the history is modified"
  2609 
  2610 
  2610     self isEmpty ifTrue:[
  2611     self isEmpty ifTrue:[
  2611         ^ false
  2612         ^ false
  2612     ].
  2613     ].
  2613     ^ history last identifier ~~ startIdentifier
  2614     ^ history last identifier ~~ startIdentifier
  2616 isTransactionOpen
  2617 isTransactionOpen
  2617     ^ (enabled and:[transaction notNil])
  2618     ^ (enabled and:[transaction notNil])
  2618 !
  2619 !
  2619 
  2620 
  2620 notEmpty
  2621 notEmpty
  2621     "returns true if undo history is not empty"
  2622     "returns true if the undo history is not empty"
  2622 
  2623 
  2623     ^ history notEmpty
  2624     ^ history notEmpty
  2624 ! !
  2625 ! !
  2625 
  2626 
  2626 !UIObjectView::UndoHistory methodsFor:'undo'!
  2627 !UIObjectView::UndoHistory methodsFor:'undo'!
  2634     "Created: / 30.10.2001 / 13:45:28 / cg"
  2635     "Created: / 30.10.2001 / 13:45:28 / cg"
  2635     "Modified: / 30.10.2001 / 13:46:33 / cg"
  2636     "Modified: / 30.10.2001 / 13:46:33 / cg"
  2636 !
  2637 !
  2637 
  2638 
  2638 undoLast:nTransactions
  2639 undoLast:nTransactions
  2639     "undo last n transactions; an open transaction will be closed;
  2640     "undo the last n transactions; an open transaction will be closed;
  2640      transactions during undo are disabled"
  2641      transactions during undo are disabled"
  2641 
  2642 
  2642     |repeatTimes transaction actions|
  2643     |repeatTimes transaction actions|
  2643 
  2644 
  2644     transaction := nil.
  2645     transaction := nil.