'From Squeak5.3alpha of 14 May 2019 [latest update: #18583] on 15 May 2019 at 4:38:03 pm'!

!Project methodsFor: 'debugging' stamp: 'mt 5/15/2019 16:36'!
interruptSystem: title

	[self interruptName: title] fork.! !


!MorphicProject methodsFor: 'debugging' stamp: 'mt 5/15/2019 16:36'!
interruptSystem: title

	| priority doNormalInterrupt |
	priority := Processor activeProcess priority.
	[
		doNormalInterrupt := self interruptSystemReally: title.
		doNormalInterrupt == true
			ifTrue: [ [self interruptName: title] forkAt: priority ].
		
	] forkAt: Processor timingPriority - 1.! !

!MorphicProject methodsFor: 'debugging' stamp: 'mt 5/15/2019 16:35'!
interruptSystemReally: title

	| message |
	message := title, '\\1) Open interactive debugger\2) Open emergency evaluator\3) Garbage collect\4) Clean up System\5) Quit without save\\x) Continue' withCRs.
	message := message asText
		addAttribute: (TextColor color: Color white);
		addAttribute: (TextFontReference toFont: ((StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 20)));
		yourself.

	"Show options."
	Display getCanvas in: [:c |
		c fillRectangle: c clipRect color: (Color black alpha: 0.5).
		message asMorph
			center: c clipRect center;
			drawOn: c].
	
	[Sensor keyboardPressed] whileFalse.
	
	"Request choice."
	^ Sensor keyboard caseOf: {
		[$1] -> [self restoreDisplay. true].
		[$2] -> [self class tryEmergencyEvaluatorForRecovery: title. self restoreDisplay. false].
		[$3] -> [Smalltalk garbageCollect. self restoreDisplay. false].
		[$4] -> [Smalltalk cleanUp: true. self restoreDisplay. false].
		[$5] -> [Smalltalk snapshot: false andQuit: true].
		[$x] -> [self restoreDisplay. false].
	} otherwise: [self restoreDisplay. true] 
! !


!SmalltalkImage methodsFor: 'miscellaneous' stamp: 'mt 5/15/2019 16:16'!
handleUserInterrupt
	Preferences cmdDotEnabled ifTrue:
		[Project current interruptSystem: 'User Interrupt']
! !

