#-------------------------------------------------------------------------------
#
#	Name    : BaseMode
#	Purpose : The main configuration file for StrongED
#	Author  :  Guttorm Vik
#	Licence : Freeware
#	Version :
#
#-------------------------------------------------------------------------------

# This is the mode that lies under any other mode. This file should not be
# renamed. If it is, StrongED will get seriously confused and won't start..

# Options:
#   StrongED$FoldParm1 = ("#-",,Startofline)
#-----------------------------------------------------------------------------
# 10.02.98 Added _perl and _HTML expressions for ModeWhen testing
# 12.07.98 Added '-' and '_' to characters that can appear in an email address.
# 31.07.98 cs-ESC is now a global toggle between mode and BaseMode
#          (had to be ctrl-shift to not interfere with ESC-blockmark)
#--- v 4.53 released
# 14.08.98 Added wsp to _markword, so you with one press on c-A can mark all
#          spaces.
# 02.10.98 Corrected the advancedsyntax help page name in the SearchReplace
#          keylist, and added the keypress to the LoF keylist.
# 20.10.98 Changed _MoveWord/_Deleteword to use the *old* _MarkWord value
# 03.11.98 Added _SpellIgnore
# 15.01.99 s-F1 is again Help StrongED. Haven't used StrongHelp search dbox..
# 31.03.99 Now defines _ParPrefix so all modes can have a sensible hardwrap
# 07.07.00 Added IconiseView
# 25.04.02 Added https:// to syntax colouring
#-----------------------------------------------------------------------------

#--- PrintHead & PrintFoot
#    These two defines default heading and footing used when printing.

PrintHead	<tmp$path>.<tmp$leaf>|i|i<Sys$Date> <Sys$Time>|m
PrintFoot	|m|i---- <tmp$page> ----

#--- Bitmap
#    The name of the bitmap to use for basemode, and all modes not
#    overriding this with their own. (Is the name of a file in the
#    !StrongED.Defaults.Bitmaps directory)

Bitmap		System

#--- Syntax colouring; We colour URLs to show that they are clickable.

ID_FirstChar	A-Za-z
ID_Middle	A-Za-z_0-9./~+\-:;,?%@&#=*

SyntaxWords Group8 EndOfID nocase
	https:// http:// ftp:// telnet:// file:/ mailto: news: stronghelp: www.
End

#--- Named search/match expressions.
#    Some are used to modify how standard functions behave, and some are
#    used as parameters to functions.

Search
	_Indent		{" "|"\t"}
	_MarkWord	{AlphaNum|"_"}+ | {Punct}+ | {' \t'}+
	_MoveWord	{AlphaNum|"_"}+ | {Punct}+
	_DeleteWord	_MoveWord
	_EndSpc		{'\t '}+ >
	_spct		{" " | "\t"}+
	_Complete	{" "} ((Upper [{Upper}+ | {Lower}+]) | {Lower}+ ["_"]) | {Punct|Digit}+
	_Wrap		~NL Any @1 {" "} NL ~ NL|"\t"|" "

	http		"https://" | "http://" | "ftp://" | "telnet://" | "file:/" | "mailto:" | "news:" | "stronghelp:" {'A-Za-z_0-9./~+\-:;,?%@&#='}+
	www		"www." {'A-Za-z_0-9./~+\-:;,?%@&#='}+
	emailpart	{'A-Za-z0-9_\-'}+
	email		emailpart {'.' emailpart} "@" emailpart {'.' emailpart}
	me		"Guttorm"|("Strong" "ED"|"Help"|"Hlp")

	_SpellIgnore	email | http | www | ( {Upper}+ ~? )

#	With hardwrap turned on, the default paragraph definition is the one
#	used by the !News mode.

	_ParPrefix	{'>|*' [' ']} {' '}

#

	_foldstar	{' \t'} "*"
	_foldindent	{' \t'} ~NL .

# clicklist related entries

	c_TRUE		"TRUE"
	c_FALSE		"FALSE"

End

#--- Named replace expressions.
#    Mostly used as parameter in functions.

Replace
	_rwrap		@01 " "
End

#--- The default fold-expression

FoldParm1 ("*",,StartOfLine)

#--- Clicklist
#    Each time you doubleclick with Select, this list will
#    be consulted, and if the clicked word matches the search expression
#    the corresponding function will be executed.

ClickList Select2
	http	BroadcastURL("<tmp$word>")
	www	BroadcastURL("http://<tmp$word>")
	email	BroadcastURL("mailto:<tmp$word>")
End

ClickList Toggle
	c_TRUE	ToggleStr("FALSE")
	c_FALSE	ToggleStr("TRUE")
End

#--- Key definitions for various dialogue boxes.
#    Note that shortcuts like ctrl-C for toggeling case sensitivity is defined
#    directly in the template files (in the validation string) This because
#    shortcuts that depend on the label are language specific.
#    (You *can* override them here, if you wish..)

KeyList SearchReplace
	F4		Select(Old)
	RETURN		Select(GO)
	PgUp		History(older)
	PgDown		History(newer)
	F1		MenuToWindow HelpString("StrongEDRes:StrongED !ref_as_")
End

KeyList LoF_dbox
	F2		Select(Old)
	Return		Select(GO)
	PgUp		History(older)
	PgDown		History(newer)
	F1		MenuToWindow HelpString("StrongEDRes:StrongED !ref_as_")
End

KeyList Interactive
	F4		Select(Old)
	Down		Select(Next)
	Up		Select(Prev)
	PgUp		Select(Old)
	PgDown		Adjust(Old)
End

KeyList SaveBox
	Return		Select(Save)
	^Q		Select(Kill)
	PgUp		History(older)
	PgDown		History(newer)
End

KeyList WhatNext
	Down		Select(Next)
	Return		Select(Replace)
	F8		Select(Undo)
	^F8		Select(Redo)
End

KeyList	Goto
	F5		History(older)
	PgUp		History(older)
	PgDown		History(newer)
End


#KeyList Print
#	^F		Select(HeaderFooter)
#	Return		Select(GO)
#End

#--- Key definitions when CopyCursor is used.

KeyList CopyCursor
	ESC		CopyCursor_Off
	Copy		CopyFromCC
	Copy		CopyCursor_Off
	Left		CopyCursor_Left
	Right		CopyCursor_Right
	Up		CopyCursor_Up
	Down		CopyCursor_Down
	Left		CaretLeft
	Right		CaretRight
	Up		CaretUp
	Down		CaretDown
	Return		CopyCursor_Off NewLine
End

#--- Global key definitions
#    These keys are checked last of all, and are also checked even if
#    StrongED doesn't have the input focus.

KeyList Global
	^F9		dbox_Chars
	^F1 1		GotoMark (1)
	^F2 1		GotoMark (2)
	^F3 1		GotoMark (3)
	^F4 1		GotoMark (4)
	F5 1		GotoBlock_Start
	F5 2		GotoBlock_End
	^H		HideAll
	^L		ListOfWindows
	^W		Complete(_Complete) ;
#	^W		WordToBuffer   ; These three are used to copy text to writable fields in dboxes.
	F7		BlockToBuffer  ; They have no meaning if no writable field has caret.
	F8		ClipToBuffer   ;
	F11		CreateText
	^Tab		SetDir
	Up		NextWindow
	Down		PreviousWindow
	^PgUp		UserMessage1(&400D1,"<1><0><0><0>")
	^PgDown		UserMessage1(&400D1,"<2><0><0><0>")
End

#--- The main keylist.

KeyList
	ESC		BlockMark_ESC
	F2		dbox_ListOfFound
	F3		dbox_SaveText
	F4		dbox_Interactive
	F5		dbox_GotoLine
#	F6		BlockMark_Standard
	F6		BlockMark_Continous
	F7		BlockCopy
	F8		Undo
	F9		Playback

#	F3		dbox_SaveBlock
	F4		dbox_Replace
#	F5		GotoBlock
	F6		BlockClear
	F7		BlockMove
	F8		BlockDelete
	F9		Learn

	^ESC		ChangeMode()
	^F5		InsertCtrl
	^F6		MarkText
	^F7		LoseCaret
	^F8		Redo

	^F1 1		SetMark(5) GotoMark (1)
	^F2 1		SetMark(5) GotoMark (2)
	^F3 1		SetMark(5) GotoMark (3)
	^F4 1		SetMark(5) GotoMark (4)
	^F1 2		GotoMark(5)
	^F2 2		GotoMark(5)
	^F3 2		GotoMark(5)
	^F4 2		GotoMark(5)

	^F1 1		SetMark (1)
	^F2 1		SetMark (2)
	^F3 1		SetMark (3)
	^F4 1		SetMark (4)

	^F1 2		ClearMark (1)
	^F2 2		ClearMark (2)
	^F3 2		ClearMark (3)
	^F4 2		ClearMark (4)

	^A 1		MarkWord
	^A 2		MarkLine
	^A 3		MarkText
	^B		ToggleIndent
	^C		BlockCopy

	s-KpPlus	OpenFold
	s-KpMin		CloseFold
	^KpMin		UnfoldText() FoldText
#	^KpMin		UnfoldText() FoldText(_foldstar,,line,case)
#	^KpMin B	AddFold
	^KpPlus		UnfoldText

	F10		Process(Text,"Filer_Run <Wimp$ScrapDir>.StrongED.out",,noreplace)

	^F11		Debug2()
#	^F11		Reformat(40)
#	^F11		SetTmp() InsertFile("ADFS::Hard1.$.NewsProb")
#	^F11		MinimizeModes

	^D,^D		DateAndTime ("%DY.%MN.%YR")
	^D,^T		DateAndTime ("%24:%MI")
	^D,^W		DateAndTime ("%WK")
	^F		ListOfWord (Text,Whole,NoLine,NoCase)
	^F		ListOfWord (All,Whole,NoLine,NoCase)
	^H		HideView
	^I		IconiseView
	^J		LowercaseChar
	^L		LongestLine
	^N		FindNext
	^P		PreviousMessage

	^Q		KillView
	^Q		KillStrongED
	^R		Pop
	^R		PopAll
	^S		SwapcaseChar
	^T		ViewToTop
#	^T		Transpose(-2)
	^U		UppercaseChar
	^V		BlockMove
	^W,^C		CreateView
	^W,^V		SplitViewVert
	^W,^H		SplitViewHor
	^W,^F		FullView
	^W,^S		ScaleView
	^X		BlockDelete
	^Z		BlockClear

	Tab		Tab
	Tab		ToggleTabLine
	^Tab		CycleTabkey
	Copy		DeleteRight
	Copy		CopyCursor_On
	^Copy		DeleteLine
	^Copy 1	MarkToEnd_tl
	^Copy 2	BlockDelete
	Print		Print
	Print		dbox_Print
	Delete		DeleteLeft
	Delete		DeleteWordRight
	^Delete		CB_Copy BlockDelete
	Backspace	DeleteLeft
	Backspace	DeleteWordLeft
	Insert		ToggleInsert
	^Insert		CB_Copy
	Insert		CB_Paste
	Home		StartOfText
	Home		ClickList("Toggle")
	^Home		ClickList("Select2")
	Return		NewLine
	Return		NewLine(noindent)
	^Return	CaretUp() EndOfTLine() NewLine()

#	Select		PlaceCaret() Clicklist("TEST")
#	Select 2	MarkWord()
#	Select 3	MarkLine()
#	Adjust		adjustmark()   if(focus) { MarkBlock() wobble } ifnot(focus) Setfocus()

	Left		CaretLeft
	Left		WordLeft
	^Left 1		StartOfWLine
	^Left 2		StartOfTLine
	^Left 1	MarkToStart_tl
	^Left 2	BlockDelete

	Right		CaretRight
	Right		WordRight
	^Right 1	EndOfWLine
	^Right 2	EndOfTLine
	^Right 1	MarkToEnd_tl
	^Right 2	BlockDelete

	Up		CaretUp
	^Up		StartOftext
	^Up		LineUp
	Down		CaretDown
	^Down		EndOfText
	^Down		LineDown

	PgUp		PageUp
	PgDown		PageDown

	^Z		CB_Purge
	^X		CB_Copy  BlockDelete
	^C		CB_Copy  BlockClear
	^V		CB_Paste
End

#--- Toolbar and mode-menu functions

Functions
	Key	F1
	Icon	help
	Help	HBM_help
	Select	HelpStrongED

	Adjust	HelpMode

#	Key	F1
#	Select	HelpSearchWord

	Key	^I
	Select	dbox_FileInfo

	Key	F1
	Adjust	HelpWord

	^Adjust	CharInfo

	Key	^L
	Icon	Lot
	Help	HBM_low
	Select	ListOfWindows

	Adjust	dbox_LoadFile

	Icon	dicticon
	Help	HBM_spell
	Select	SpellCheck()

	Adjust	dbox_spellcheck()

	Select	SetTmp() Run("Dict <Tmp$Word>")

	Icon	opton
	Help	HBM_opt
	Select	dbox_GlobalChoices

	Adjust	dbox_ModeChoices

	Icon	Save
	Help	HBM_save
	Select	dbox_SaveText

	Adjust	SaveText()

	Icon	Undo
	Help	HBM_undo
	Select	Undo

	Icon	Redo
	Help	HBM_redo
	Select	Redo

	Icon	Speak
	Help	HBM_speak
	Select	SetTmp() Process(block,"<Tmp$Tool>.Speak")

	Adjust	SetTmp() Process(,"<Tmp$Tool>.Mute")

	Icon	Reload
	Help	HBM_reload
	Select	ReloadFile

#	Key	^W,^F
#	Select	Fullview

#	Menu	Tab to spaces
#	Help	Replaces occurrences of the TAB character with spaces.
#	Select	Untab
#
#	Menu	Spaces to Tab
#	Help	Replaces multiple spaces with TAB characters.|MOnly handles spaces at the start of the line.
#	Select	TabIt

	Menu	List me
	Select	ListOfFound (me,ALL,Align,NoLine,NoCase)

	Menu	Trim lines
	Help	HBM_trim
	Select	Replace (_EndSpc,"",,NoLine)

	Menu	Left Adjust
	Help	HBM_ltrim
	Select	Replace (_spct,"",,Line)

	Menu	Wrap
	Help	HBM_join
	Select	Replace (_wrap,_rwrap,,Noline)

	Menu	Unwrap
	Help	HBM_split
	Select	Unwrap

	Menu	Fold
	Select	UnfoldText() FoldText

	Menu	Unfold
	Select	UnfoldText
End

#--- Shortcuts
#    Small macros that, when written, will expand to the full text.

Shortcuts
	``-	--------------------------------------------------------------------------------\n
End
