" This file contains the settings of some of the ENFIN tools: "
" Currently the ClassBrowser, Designer, Desktop and Workspace "
" store here per user initialization information like selected "
" fonts, window sizes and background colors "

":Part - KeyBindings"

" This section of enfin.ini contains a keyboard binding table for ENFIN's "
" TextEditor. It is read in the class initialize method of the TextEditor 	"
" Item. Implemented here are the bindings correspondant to the 'Brief' - 	"
" Editor, which is quite popular in the DOS - OS/2 world							"

" (c) EASEL Corp. 1994																	"

TextEditorCtrl modeDescription: 'Brief';

" Brief standard key bindings -----------------------------------------"

	onKey: #End do: [ :editor | 
	(editor lastKey == #End) ifTrue: [
		(editor lastLastKey == #End) ifTrue: [
			editor cursorEof.
		] ifFalse: [
			editor cursorDown: #page.
		].
	] ifFalse: [ editor cursorRight: #end .  ]. ];
	onKey: #Home do: [ :editor | 
	(editor lastKey == #Home) ifTrue: [
		(editor lastLastKey == #Home) ifTrue: [
			editor cursorHome.
		] ifFalse: [
			editor cursorUp: #page.
		].
	] ifFalse: [ editor cursorLeft: #end .  ]. ];
	onKey: #KP_Multiply do: #undo;
	onKey: #KP_Add do: [ :editor | editor selection == nil ifTrue: [
		editor formItem copyToClipboard: nil from: ((editor curpos) x: 1)
				to: ((editor curpos) x: 10000) append: false.
		] ifFalse: [
			editor copyToClipboard.
			editor hideSelection.
		]. ];
	onKey: #KP_Subtract do: [ :editor | 
		editor selection == nil ifTrue: [
			editor deleteLine.
		] ifFalse: [
			editor deleteSelection.
		]. ];
	onKey:	#AltA do: [ :editor | editor toggleSelectionType: #blknormal ];
	onKey:	#Altb do: #showWindowList;
	onKey:	#AltC do: [ :editor | editor toggleSelectionType: #blkcols ];
	onKey:	#AltD do: #deleteLine;
	onKey:	#AltG do: #gotoLine;
	onKey:	#AltK do: [ :editor | editor deleteChar: #end ];
	onKey:	#CtrlL do: [ :editor | editor toggleSelectionType: #blklines ];
	onKey:	#CtrlM do: [ :editor | editor toggleSelectionType: #blknormal ];
	onKey:	#AltN do: #nextWindow;
	onKey:	#AltO do: #saveAs;
	onKey:	#Altminus do: #previousWindow;
	onKey:	#Ctrlminus do: #quitFile;
	onKey:	#AltU do: #undo;
	onKey:	#AltR do: #insertFile;
" commented out to make menu mnemonic accelerators work
	onKey:	#AltW do: [ :editor | (editor selection) == nil ifTrue: [
				editor save. 
			] ifFalse: [
				editor writeSelection.
			].];
	"
	onKey:	#AltX do: #quit;
	onKey:	#Tab do: [ :editor | (editor selection) == nil ifTrue: [
				editor insert: (9 asChar).
			] ifFalse: [
				editor shiftSelectionRight.
			].];
	onKey:	#ShiftTab do: [ :editor | (editor selection) == nil ifTrue: [
				editor cursorLeft: #single.
			] ifFalse: [
				editor shiftSelectionLeft.
			].];

	onKey: #F5 			do: #search;
	onKey: #CtrlS		do: #search;
	onKey: #ShiftF5 	do: #searchAgainForward;
	onKey: #AltF5		do: #searchAgainBackward;

	onKey: #F6 			do: #replace;
	onKey: #ShiftF6 	do: #replaceAgain;
	onKey: #AltT		do: #replace;
	onKey: #CtrlF5		do: [ :editor | 
			(editor toggleSearchOption: #ignorecase) == true ifTrue: [
				editor showStatus: 'Case sensity search is off'.
			] ifFalse: [
				editor showStatus: 'Case sensity search is on'.
			]. ];
	onKey: #CtrlF6 		do: [ :editor | 
			(editor toggleSearchOption: #regex) == true ifTrue: [
				editor showStatus: 'Regular expression search is on'.
			] ifFalse: [
				editor showStatus: 'Regular expression search is off'.
			]. ];

	onKey: #Ctrl1	do: [ :editor |
			editor setBookmark: #'Bookmark 1'. ];
	onKey: #Ctrl2	do: [ :editor |
			editor setBookmark: #'Bookmark 2'. ];
	onKey: #Alt1		do: [ :editor |
			editor gotoBookmark: #'Bookmark 1'. ];
	onKey: #Alt2		do: [ :editor |
			editor gotoBookmark: #'Bookmark 2'. ];

" Extensions to Brief standard key bindings ------------------------------"

	onKey: #ShiftNext do: [ :item | item cursorDown: { #extend #page } ];
	onKey: #ShiftPrior do: [ :item | item cursorUp: { #extend #page } ];
	onKey: #ShiftCtrlRight do: [ :item | item cursorRight: { #extend #word } ];
	onKey: #ShiftCtrlLeft do: [ :item | item cursorLeft: { #extend #word } ];
	onKey: #CtrlK do: [ :editor | editor scrollUp. ];
	onKey: #CtrlJ do: [ :editor | editor scrollDown. ];
	onKey: #CtrlE do: #execute;
	onKey: #CtrlI do: #inspectSelection;
	onKey: #Escape do: #insertTemplate;
	onKey: #F9 do: #loadAsClassMethods;
	onKey: #CtrlF9 do: #reloadAsClassMethods;
	onKey: #ShiftF9 do: #executeSelection;

	onKey: #F11 do: #lowerCaseSelection;
	onKey: #CtrlF11 do: #upperCaseSelection;
	onKey: #ShiftF11 do: #upperCaseSelection;

	onKey: #F10 do: #formatSelection;
	onKey: #ShiftF10 do: #convertToTabsSelection;
	onKey: #CtrlF10 do: #convertToSpacesSelection;
	onKey: #ShiftCtrlEnd do: [ :editor | editor cursorDown: {#extend #file}. ];
	onKey: #ShiftCtrlHome do: [ :editor | editor cursorUp: {#extend #file}. ];
	onKey: #Ctrlnumbersign do: #toggleTopWindows;
	onKey: #F12 do: [ :editor |
			editor showStatus: 'reading ini file'.
			editor class readIniFile.
			editor showStatus: 'done.'
		];
	onKey: #ShiftDelete do: #deleteSelection;
	onKey: #CtrlF 	do: #search;
	onKey: #CtrlR 	do: #replace;
	onKey: #CtrlA 	do: #searchAgainForward;
	onKey: #CtrlB 	do: #searchAgainBackward;
	onKey: #CtrlG 	do: #info;
	onKey: #Ctrlo 	do: #openFile;
	onKey: #CtrlQ 	do: #quitFile;
	onKey: #CtrlW 	do: #save;
	onKey: #Ctrlu 	do: #scanDirs;
	onKey: #CtrlN 	do: #diffNext;
	onKey: #CtrlP 	do: #diffPrevious;
	onKey: #F7 		do: #recordMacro;
	onKey: #F8 		do: #playMacro;
	onKey: #F2 		do: #searchCursorWordForward;
	onKey: #ShiftF2	do: #searchCursorWordBackward;
	onKey: #CtrlF2  do: #matchBracket;
	onKey: #CtrlF8 	do: #searchSenders;
	onKey: #ShiftF8 do: #searchImplementors;
	onKey: #Insert	do: #toggleInsert;
	onKey: #Altperiod	do: #gotoPreviousPos;

"	AIX keyboard glitches "
	onKey: #Altplus do: [ :editor | editor insert: $~ ];

" templates "
	bindTemplate: #'Secondary File' value: {
		'" (c) 1994 EASEL CORPORATION.  ALL RIGHTS RESERVED. "'
		''
		'@[X := ''Object'' editIn: nil prompt: ''Secondary File Class:''] SecondaryFile!'
		''
		''
		'!@[X] class methods!'
		''
		''
		'!"end of @[X] class methods block"'
		''
		''
		'!@[X] methods!'
		''
		''
		'!"end @[X] methods"' };
	bindTemplate: #'Primary File' value: {
		'" (c) 1994 EASEL CORPORATION.  ALL RIGHTS RESERVED. "'
		''
		'Object subclass: #@[X := ''Object'' editIn: nil prompt: ''Create Header for Class:'']'
		'instanceVariableNames: '''
		'''' 
		'classVariableNames: '''''
		'poolDictionaries: '''' !'
		''
		''
		'!@[X] class methods!'
		''
		''
		'!"end of @[X] class methods block"'
		''
		''
		'!@[X] methods!'
		''
		''
		'!"end of @[X] methods block"'
		};
	bindTemplate: #'For' value: '1 to: 1 do: [ :count |
	
]."endDo:"';
	bindTemplate: #IfTrueElse value: 	' ifTrue: [
	
] ifFalse: [
	
]."end ifTrue:ifFalse:"';
	bindTemplate: #IfTrue value: 	' ifTrue: [
	
]."end ifTrue:"';
	bindTemplate: #IfFalse value: 	' ifFalse: [
	
]."end ifFalse:"';
	bindTemplate: #AssociationsDo value: 	' associationsDo: [ :key :value |
	
]."end associationsDo:"';
	bindTemplate: #WhileTrue value: 	'[ ] whileTrue: [
	
]."end whileTrue:"';
	bindTemplate: #'Reference / Return Instance Var' value: {
		'	^ @[currentIdent].'
		'":Section Reference'
		'@[currentIdent]'
		''
		'Description:			Returns the ''@[currentIdent]'' instance variable'
		'							of the receiver.'
		'Assumptions:			None.'
		'Return Value:			The instance variable @[currentIdent].'
		'Receiver Modified:	No.'
		':End"' 
		'!"end @[currentIdent]"' 
		''
		''};
	bindTemplate: #'Reference / Assign Instance Var' value: {
		'	@[ID := currentLine extractFields at: 1] := @[V := currentLine extractFields at: 2].'
		'":Section Reference'
		'@[ID]: @[V]'
		''
		'Description:			Assigns ''@[V]'' to the ''@[ID]'' instance'
		'							variable of the receiver.'
		'Assumptions:			None.'
		'Return Value:			The receiver.'
		'Receiver Modified:	Yes.'
		':End"' 
		'!"end @[ID]:"' 
		''
		''};
	bindTemplate: #'Signum' value: {
		'Tom Krauss, Easel Germany @[Date today asISOString]'
	};
	bindTemplate: #'Test Template' value: {
		'this is the current line: @[currentLine]'
		'Insert date here: @[Date today] @[Time now]'
		'number of lines: @[textEditor formItem lines.]'
	};
	bindTemplate: #'Class File Header' value: {
		'"(c) 1994 EASEL CORPORATION.  ALL RIGHTS RESERVED."'
	};
	" This template is used, when creating a new reference in the "
	" class browser "
	bindTemplate: #MethodReference value: {
		''
		''
		'Description:			.'
		'Assumptions:			.'
		'Return Value:			.'
		'Receiver Modified:	.'};
	bindTemplate: #'Reference / Standard' value: {
		'":Section Reference'
		'@[currentLine]'
		''
		'Description:			.'
		'Assumptions:			None.'
		'Return Value:			The receiver.'
		'Receiver Modified:	Yes.'
		':End"' 
		''}.
	TextEditorCtrl
	defaultHooks: {
		{ '{' '}' 1 }
		{ '(' ')' 1 }
		{ '[' ']' 1 }
		{ 'TOM' [ :editor | editor showStatus: 'hy there'. ] }
		{ 'IE ' [ :editor | editor abbreviate: 'IE ' with: #IfTrueElse; cursorDown: 1; cursorRight: #end ]}
		{ 'IT ' [ :editor | editor abbreviate: 'IT ' with: #IfTrue; cursorDown: 1; cursorRight: #end ]}
		{ 'IF ' [ :editor | editor abbreviate: 'IF ' with: #IfFalse; cursorDown: 1; cursorRight: #end ]}
		{ 'WHILE ' [ :editor | editor abbreviate: 'WHILE ' with: #WhileTrue ] }
		{ 'FOR ' [ :editor | editor abbreviate: 'FOR ' with: #For; cursorDown: 1 ] }
		{ 'ADO ' [ :editor | editor abbreviate: 'ADO ' with: #AssociationsDo; 
				cursorDown: 1 ; cursorRight: #end] }
	}.

":Part - TextEditorCtrl (generated)"
	TextEditorCtrl
		defaultTabs: 3;
		defaultVisibleTab: $ ;
		defaultDisplayOptions: {#expandtabs #attribs #markeof};
		defaultInsertMode: {#match #indent #abbreviate #blkautodel #insert};
		defaultScrollMode: {#track};
		defaultScrollVert: 5;
		defaultScrollVDist: 1;
		defaultScrollHorz: 4;
		defaultScrollHDist: 4;
		defaultNundo: 100;
		defaultTextOptions: {#Left #Top {#FontFace #'System VIO'} {#PointSize 10} {#Background #ButtonMiddleColor} #false {#SelectedBackground #DarkBlue} {#SelectedForeground #Green}};
		defaultCursorFile: ''.
":Part - ClassFileEditor  (generated)"
	((IdentityDictionary newEntries: 3) at: #desktopObjects
			 put: ((((((IdentityDictionary newEntries: 4) at: #'Global Browser' put: (1)) at: #Workspace put: (1)) at: #ClassBrowser put: (1)) at: #SystemTranscript put: (1)));
			 at: #windows
			 put: (((((((((IdentityDictionary newEntries: 7) at: #window2 put: ({0 8 1951 1253} asRect)) at: #window5 put: ({8 4 2641 2074} asRect)) at: #window3 put: ({4 4 2625 2066} asRect)) at: #window6 put: ({199 199 2499 1501} asRect)) at: #window1 put: ({0 4 1949 1255} asRect)) at: #window4 put: ({4 4 2625 2066} asRect)) at: #mainForm put: ({39 23 2215 1571} asRect)));
			 at: #default
			 put: ((((((IdentityDictionary newEntries: 4) at: #showStatusLine put: (true)) at: #history put: ({#Noname1} asOrderedCollection)) at: #popupEditor put: (true)) at: #showToolBar put: (true))))
":Part - TextEditorMacro (generated)"
( ( ( TextEditorMacro name: #tempMacro ) assignCommands:  'editor curpos: 1 @ 1.
' ) setDescriptionTo: nil ).
( ( ( TextEditorMacro name: #fritz ) assignCommands:  'editor curpos: 1 @ 1.
' ) setDescriptionTo: 'This is a test macro' ).
":Part - Workspace (generated)"
	((IdentityDictionary newEntries: 1) at: #default
			 put: (((((IdentityDictionary newEntries: 3) at: #visibleAreas put: ({#showToolBar #showStatusLine})) at: #showStatusLine put: (false)) at: #showToolBar put: (false))))
":Part - Designer (generated)"
	((IdentityDictionary newEntries: 1) at: #default
			 put: (((IdentityDictionary newEntries: 1) at: #visibleAreas put: ({#showStatusLine #showToolBar}))))
":Part - WPENFIN (generated)"
	Application setLeftBox: 'New Objects' size: 343/1039 show: true.
	Application setRightBox: 'Tools' size: 343/1039 show: true.
	Application setMidBox: 'Workarea' show: true.
	Application mainForm setBackgroundSourceTo: #Background.
	Application setApprenticeTo: false.

