--- a/ApplicationModel.st Tue Jul 02 14:13:57 2019 +0200
+++ b/ApplicationModel.st Sun Jul 07 15:05:19 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
@@ -2483,6 +2481,189 @@
!ApplicationModel methodsFor:'forced actions'!
+close
+ "this is sent by my topView when about to be closed
+ by the program (not by the windowManager).
+ Notice, that we get a closeRequest message if closed by the windowManager,
+ which can be rejected by the app (or confirmed via a dialog)
+ Could be redefined in subclasses."
+
+ self closeDownViews
+!
+
+closeDownViews
+ "close down the application's view(s)"
+
+ <modifier: #super> "must be called if redefined"
+
+ |wg wgProcess window|
+
+ self release.
+ ActiveHelp stopFor:self.
+
+ self shouldRememberLastExtent ifTrue:[
+ self rememberLastExtent.
+ ].
+ wg := self windowGroup.
+ (wg notNil and:[wg isModal not]) ifTrue:[
+ wgProcess := wg process.
+ (wgProcess notNil and:[Processor activeProcess ~~ wgProcess]) ifTrue:[
+ wgProcess terminate
+ ] ifFalse:[
+ wg closeDownViews.
+ ].
+ ^ self.
+ ].
+
+ window := self window.
+ window notNil ifTrue:[
+ window destroy.
+ ].
+
+ "Modified: / 08-02-2017 / 00:24:14 / cg"
+ "Modified: / 03-03-2017 / 12:00:22 / stefan"
+!
+
+closeRequest
+ "this is sent by my topView when about to be closed by the windowManager.
+ Could be redefined in subclasses to suppress close or confirm."
+
+ <modifier: #super> "must be called if redefined"
+
+ |sav window|
+
+ window := self window.
+ window isNil ifTrue:[
+ 'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR.
+ ^ self
+ ].
+
+ window isTopView ifFalse:[
+ window topView isModal ifTrue:[
+ WindowGroup leaveSignal raise.
+ ].
+
+ 'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR.
+ ^ self
+ ].
+
+ "/ In multiView apps, tell my master.
+ "/ (but not if I am a modal reincarnation)
+ (masterApplication notNil
+ and:[window isModal not]) ifTrue:[
+
+ "/ temporary clear my masterApplication to prevent
+ "/ endless recursion, in case the master sends me
+ "/ a closeRequest (although, it is supposed to
+ "/ send me a closeDownViews ...)
+
+ sav := masterApplication.
+ masterApplication := nil.
+ sav closeRequestFor:window.
+
+ "/ restore - in case master did not want me to close ...
+ masterApplication := sav.
+ ] ifFalse:[
+ "/ ST/X does close-check by redefining this message without
+ "/ a supersend;
+ "/ VW does it by returning false from requestForWindowClose
+ "/ sigh.
+
+ self requestForWindowClose ifTrue:[
+ window isSlave ifTrue:[
+ window destroy
+ ] ifFalse:[
+ self closeDownViews
+ ]
+ ]
+ ].
+
+ "Modified: / 08-02-2017 / 00:25:11 / cg"
+!
+
+closeRequestFor:aTopView
+ "this is sent by any of my topViews when about to be closed by the
+ windowmanager. For backward compatibility with single-view applications,
+ this is forwarded here to a simple (non topView-specific) closeRequest,
+ effectively closing all of my views.
+ MultiView applications should redefine this method if closing of individual
+ views closing is to be caught and/or should not close all of them."
+
+ |savedMaster myWindow|
+
+ myWindow := self window.
+
+ "/ In multiView apps, tell my master.
+ "/ (but not if I am a modal reincarnation)
+ (masterApplication notNil
+ and:[myWindow topView isModal not]) ifTrue:[
+
+ "/ temporary clear my masterApplication to prevent
+ "/ endless recursion, in case the master sends me
+ "/ a closeRequest (although, it is supposed to
+ "/ send me a closeDownViews ...)
+
+ savedMaster := masterApplication.
+ masterApplication := nil.
+ aTopView isSlave ifTrue:[
+ savedMaster closeRequestFor:aTopView.
+ ] ifFalse:[
+ savedMaster closeRequestFor:myWindow.
+ ].
+
+ "/ restore - in case master did not want me to close ...
+ masterApplication := savedMaster.
+ ^ self
+ ].
+
+ (aTopView == myWindow) ifTrue:[
+ self closeRequest.
+ ^ self
+ ].
+
+ (aTopView isPartner or:[aTopView isMaster]) ifTrue:[
+ aTopView application closeRequest.
+ self closeRequest.
+ ^ self.
+ ].
+ aTopView isSlave ifTrue:[
+ aTopView closeRequest
+ ] ifFalse:[
+ aTopView application closeRequest.
+ ]
+!
+
+doAccept
+ "this is invoked by the Return-Key (if returnIsOK) or
+ the ok-button (if any), IFF the application has been
+ opened modal (i.e. as a dialog)."
+
+ "/ the following is a bad kludge -
+ "/ actually, modal apps should inherit from SimpleDialog
+ "/ (then, things would be clean)
+ "/ However, it may be useful, to open some app (which is normally
+ "/ modeless) as a modal one as well.
+ "/ In that, case, we have no acceptHolder (see SimpleDialog),
+ "/ to remember the accept vs. cancel case.
+ "/
+ self window isModal ifTrue:[
+ masterApplication notNil ifTrue:[
+ masterApplication window topView == self window topView ifTrue:[
+ masterApplication window isModal ifTrue:[
+ masterApplication doAccept.
+ ^ self.
+ ].
+ ].
+ ].
+
+ "/ mhmh - is this a good idea ?
+ self perform:#accept ifNotUnderstood:[self closeRequest].
+ ^ self
+ ].
+
+ ^ self "/ nothing done here ...
+!
+
doAcceptByReturnKey
|acceptAction|
@@ -2496,6 +2677,27 @@
]
!
+doCancel
+ "this is invoked by the Escape-Key (if escapeIsCancel) or
+ the cancel-button (if any), IFF the application has been
+ opened modal (i.e. as a dialog)."
+
+ "/ the following is a bad kludge -
+ "/ actually, modal apps should inherit from SimpleDialog
+ "/ (then, things would be clean)
+ "/ However, it may be useful, to open some app (which is normally
+ "/ modeless) as a modal one as well.
+ "/ In that, case, we have no acceptHolder (see SimpleDialog),
+ "/ to remember the accept vs. cancel case.
+ "/
+ self window isModal ifTrue:[
+ "/ mhmh - is this a good idea ?
+ self perform:#cancel ifNotUnderstood:[self closeRequest].
+ ^ self
+ ].
+ ^ self "/ nothing done here ...
+!
+
doCancelByEscapeKey
|cancelAction|
@@ -2931,7 +3133,7 @@
!
postOpenDialogWith:aBuilder
- "this is sent after the applicationÄs window is opened as a dialog with me
+ "this is sent after the applicationÄs window is opened as a dialog with me
as a source (for aspects) i.e. via openDialogInterface:.
Can be redefined in subclasses for actions after opening a dialog view."
@@ -3773,6 +3975,12 @@
!ApplicationModel methodsFor:'queries'!
+applicationWindowClass
+ "return the class used for my (top-) windows"
+
+ ^ ApplicationWindow
+!
+
ctrlDown
"answer true if the control key is pressed"
@@ -3967,216 +4175,6 @@
"Created: / 20-04-2019 / 09:01:46 / Claus Gittinger"
!
-applicationWindowClass
- "return the class used for my (top-) windows"
-
- ^ ApplicationWindow
-!
-
-close
- "this is sent by my topView when about to be closed
- by the program (not by the windowManager).
- Notice, that we get a closeRequest message if closed by the windowManager,
- which can be rejected by the app (or confirmed via a dialog)
- Could be redefined in subclasses."
-
- self closeDownViews
-!
-
-closeDownViews
- "close down the application's view(s)"
-
- <modifier: #super> "must be called if redefined"
-
- |wg wgProcess window|
-
- self release.
- ActiveHelp stopFor:self.
-
- self shouldRememberLastExtent ifTrue:[
- self rememberLastExtent.
- ].
- wg := self windowGroup.
- (wg notNil and:[wg isModal not]) ifTrue:[
- wgProcess := wg process.
- (wgProcess notNil and:[Processor activeProcess ~~ wgProcess]) ifTrue:[
- wgProcess terminate
- ] ifFalse:[
- wg closeDownViews.
- ].
- ^ self.
- ].
-
- window := self window.
- window notNil ifTrue:[
- window destroy.
- ].
-
- "Modified: / 08-02-2017 / 00:24:14 / cg"
- "Modified: / 03-03-2017 / 12:00:22 / stefan"
-!
-
-closeRequest
- "this is sent by my topView when about to be closed by the windowManager.
- Could be redefined in subclasses to suppress close or confirm."
-
- <modifier: #super> "must be called if redefined"
-
- |sav window|
-
- window := self window.
- window isNil ifTrue:[
- 'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR.
- ^ self
- ].
-
- window isTopView ifFalse:[
- window topView isModal ifTrue:[
- WindowGroup leaveSignal raise.
- ].
-
- 'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR.
- ^ self
- ].
-
- "/ In multiView apps, tell my master.
- "/ (but not if I am a modal reincarnation)
- (masterApplication notNil
- and:[window isModal not]) ifTrue:[
-
- "/ temporary clear my masterApplication to prevent
- "/ endless recursion, in case the master sends me
- "/ a closeRequest (although, it is supposed to
- "/ send me a closeDownViews ...)
-
- sav := masterApplication.
- masterApplication := nil.
- sav closeRequestFor:window.
-
- "/ restore - in case master did not want me to close ...
- masterApplication := sav.
- ] ifFalse:[
- "/ ST/X does close-check by redefining this message without
- "/ a supersend;
- "/ VW does it by returning false from requestForWindowClose
- "/ sigh.
-
- self requestForWindowClose ifTrue:[
- window isSlave ifTrue:[
- window destroy
- ] ifFalse:[
- self closeDownViews
- ]
- ]
- ].
-
- "Modified: / 08-02-2017 / 00:25:11 / cg"
-!
-
-closeRequestFor:aTopView
- "this is sent by any of my topViews when about to be closed by the
- windowmanager. For backward compatibility with single-view applications,
- this is forwarded here to a simple (non topView-specific) closeRequest,
- effectively closing all of my views.
- MultiView applications should redefine this method if closing of individual
- views closing is to be caught and/or should not close all of them."
-
- |savedMaster myWindow|
-
- myWindow := self window.
-
- "/ In multiView apps, tell my master.
- "/ (but not if I am a modal reincarnation)
- (masterApplication notNil
- and:[myWindow topView isModal not]) ifTrue:[
-
- "/ temporary clear my masterApplication to prevent
- "/ endless recursion, in case the master sends me
- "/ a closeRequest (although, it is supposed to
- "/ send me a closeDownViews ...)
-
- savedMaster := masterApplication.
- masterApplication := nil.
- aTopView isSlave ifTrue:[
- savedMaster closeRequestFor:aTopView.
- ] ifFalse:[
- savedMaster closeRequestFor:myWindow.
- ].
-
- "/ restore - in case master did not want me to close ...
- masterApplication := savedMaster.
- ^ self
- ].
-
- (aTopView == myWindow) ifTrue:[
- self closeRequest.
- ^ self
- ].
-
- (aTopView isPartner or:[aTopView isMaster]) ifTrue:[
- aTopView application closeRequest.
- self closeRequest.
- ^ self.
- ].
- aTopView isSlave ifTrue:[
- aTopView closeRequest
- ] ifFalse:[
- aTopView application closeRequest.
- ]
-!
-
-doAccept
- "this is invoked by the Return-Key (if returnIsOK) or
- the ok-button (if any), IFF the application has been
- opened modal (i.e. as a dialog)."
-
- "/ the following is a bad kludge -
- "/ actually, modal apps should inherit from SimpleDialog
- "/ (then, things would be clean)
- "/ However, it may be useful, to open some app (which is normally
- "/ modeless) as a modal one as well.
- "/ In that, case, we have no acceptHolder (see SimpleDialog),
- "/ to remember the accept vs. cancel case.
- "/
- self window isModal ifTrue:[
- masterApplication notNil ifTrue:[
- masterApplication window topView == self window topView ifTrue:[
- masterApplication window isModal ifTrue:[
- masterApplication doAccept.
- ^ self.
- ].
- ].
- ].
-
- "/ mhmh - is this a good idea ?
- self perform:#accept ifNotUnderstood:[self closeRequest].
- ^ self
- ].
-
- ^ self "/ nothing done here ...
-!
-
-doCancel
- "this is invoked by the Escape-Key (if escapeIsCancel) or
- the cancel-button (if any), IFF the application has been
- opened modal (i.e. as a dialog)."
-
- "/ the following is a bad kludge -
- "/ actually, modal apps should inherit from SimpleDialog
- "/ (then, things would be clean)
- "/ However, it may be useful, to open some app (which is normally
- "/ modeless) as a modal one as well.
- "/ In that, case, we have no acceptHolder (see SimpleDialog),
- "/ to remember the accept vs. cancel case.
- "/
- self window isModal ifTrue:[
- "/ mhmh - is this a good idea ?
- self perform:#cancel ifNotUnderstood:[self closeRequest].
- ^ self
- ].
- ^ self "/ nothing done here ...
-!
-
releaseAsSubCanvas
"a subcanvas is closed or switching to a new application.
Can be redefined to perform a self release in this case."