#-------------------------------------------------------------------------------
#
#	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
# 25.06.03 Extended ee_url expression, also made http & www expressions use it
# 01.07.03 Added ^D^I to main keylist, inserts date in ISO format i.e. 20030701
# 02.07.04 Moved functions tied to c-E to c-K to make room for export functions
#          Added keybindings to export in Impression, OvationPro & Raw format
#          Switched definitions for Print and s-Print
#          Added default tabstop definition
# 25.01.05 Added keybindings for commands (cs-E) and snippets (cs-S) windows
#          Added keyboard control for commands,snippets and tabstops windows
#          Added shortcuts ``se and ``ro, expand to StrongED and RISC OS
# 08.02.05 Removed several invalid characters from ee_url expression
#          Removed CR expression as awkify is now replaced by apply script icon
# 16.08.05 Added ^E^H and ^E^X to export to HTML and XHTML
# 31.12.05 Now uses c-R and cs-R for Reformat, Pop, PopAll moved to c-Y, cs-Y 
# 31.12.05 Updated export key bindings for updated export utility  
# 31.12.05 Added key bindings to give focus to LoF and Throwback (cs-F7, cs-F8) 
#-------------------------------------------------------------------------------

#--- 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

#--- Tabstops
#    This is the default tabstop definition. It is used by all modes that
#    do not override this with their own.

Tabstops	3*

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

Search
	scheme		"https://" | "http://" | "ftp://" | "telnet://" | "file:/" | "mailto:" | "news:" | "stronghelp:"
	ee_url		{'A-Za-z_0-9./~+\-:;*\`()?%=@&$,!#'}+
	http		scheme ee_url
	www		"www." ee_url
	emailpart	{'A-Za-z0-9_\-'}+
	email		emailpart {'.' emailpart} "@" emailpart {'.' emailpart}

	_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"|" "
	_SpellIgnore	email | http | www | ( {Upper}+ ~? )

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

	Quoted		(< {'>' [' ']}+)
	Bullet		({' '} '\-*o' ' ')
	Spaces		({' '})
	_ParPrefix	< [Quoted] @1 [Bullet] @2 [Spaces]

#

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

# clicklist related entries

	c_TRUE		"TRUE"
	c_FALSE		"FALSE"

End

#--- 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 EndOfExpr ee_url nocase
	https:// http:// ftp:// telnet:// file:/ mailto: news: stronghelp: www.
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	CommandsBox
	F1		MenuToWindow HelpString("StrongEDRes:StrongED !ref_function")
	Esc		Select(Cancel)
	Return		Select(Execute)
	PgUp		History(older)
	PgDown		History(newer)
End

KeyList	SnippetsBox
	Esc		Select(Cancel)
	Return		Select(Insert)
	PgUp		History(older)
	PgDown		History(newer)
End

KeyList	TabstopsBox
	Esc		Select(Cancel)
	Return		Select(Apply)
End

KeyList	LoadFileBox
	Esc		Select(Cancel)
	Return		Select(Load)
	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
	^ESC		ChangeMode()

	F2		dbox_ListOfFound
	F3		dbox_SaveText
	F4		dbox_Interactive
	F5		dbox_GotoLine
#	F6		BlockMark_Standard
	F6		BlockMark_Continous
	F7		BlockCopy
	F8		Undo
	F9		Playback
	F10		Process(Text,"Filer_Run <StrongED_Scrap$Dir>.out",,noreplace)

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

	^F5		InsertCtrl
	^F6		MarkText
	^F7		LoseCaret
	^F8		Redo

	^F7		FocusToMRU(ListOfFound)
	^F8		FocusToMRU(Throwback)

	^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)

	^F5		SetTmp() Run("<Tmp$Tool>.DictURL")
	^F6		SetTmp() Run("<Tmp$Tool>.ThesURL")

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

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

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

	^D,^I		DateAndTime ("%CE%YR%MN%DY")
	^D,^D		DateAndTime ("%DY.%MN.%YR")
	^D,^T		DateAndTime ("%24:%MI")
	^D,^W		DateAndTime ("%WK")
	^E,^I		SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED DDF")
	^E,^O		SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED DDL")
	^E,^H		SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED HTML")
	^E,^X		SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED XHTML")
	^E,^R		SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED RAW")
	^E		dbox_Commands
	^F		ListOfWord (Text,Whole,NoLine,NoCase)
	^F		ListOfWord (All,Whole,NoLine,NoCase)
	^H		HideView
	^I		IconiseView
	^J		LowercaseChar
	^K		CB_Copy BlockClear StartOfText BlockMark_Standard EndOfText BlockMark_Standard BlockDelete CB_Paste
#	^K		GotoBlock_Start Push GotoBlock_End BlockClear BlockMark_Standard EndOfText BlockMark_Standard BlockDelete StartOfText BlockMark_Standard Pop BlockMark_Standard BlockDelete
	^L		LongestLine
	^N		FindNext(Text)
	^N		FindNext(All)

	^O,^C		dbox_Commands
	^O,^F		dbox_FileInfo
	^O,^G		dbox_GotoLine
	^O,^P		dbox_Print
	^O,^S		dbox_Snippets

	^P		FindPrev(Text)
	^P		FindPrev(All)
#	^P		PreviousMessage

	^Q		KillView
	^Q		KillStrongED
	c-R		Reformat(,Para,ParagraphWrap,Quote)
	cs-R		Reformat(,Text,LineWrap,)
	^S		SwapcaseChar
	^S		dbox_Snippets
	^T		ViewToTop
#	^T		Transpose(-2)
	^U		UppercaseChar
	^V		BlockMove
#	^W		CountWords
	^W,^C		CreateView
	^W,^V		SplitViewVert
	^W,^H		SplitViewHor
	^W,^F		FullView
	^W,^S		ScaleView
	^X		BlockDelete
	^Y		Pop
	^Y		PopAll
	^Z		BlockClear

	Tab		Tab
	Tab		ToggleTabLine
	^Tab		CycleTabkey
	Copy		DeleteRight
	Copy		CopyCursor_On
	^Copy		DeleteLine
	^Copy 1	MarkToEnd_tl
	^Copy 2	BlockDelete
	Print		dbox_Print
	Print		Print
	Delete		DeleteRight
	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("TaskWindow \"Dict <Tmp$Word>\" -display")

	Icon	opton
	Help	HBM_opt
	Select	dbox_GlobalChoices

	Adjust	dbox_ModeChoices

	Icon	Save
	Help	HBM_save
	Select	dbox_SaveText

	Adjust	SaveText()

	^Select	SetTmp() ExportText() Run("Run <StrongED$Tmp_ToolPath>.!ExportSED")

	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",,NoReplace)

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

	Icon	Refresh
	Help	HBM_refresh
	Select	dbox_RefreshFile()

	Adjust	RefreshFile()

	^Select	SetTmp() Process(Text,"Run <Tmp$Tool>.DoDiff",,NoReplace)

	Icon	Apply
	Help	HBM_apply
	Select	SetTmp() Run("Obey <Tmp$Tool>.ScriptsDir")

	^Drag	SetTmp() Process(,"<Tmp$Tool>.DoScript <Tmp$Drag>",,NoReplace) Run("Filer_Run <StrongED_Scrap$Dir>.in")

	Drag	SetTmp() Process(,"<Tmp$Tool>.DoScript <Tmp$Drag>",,"<StrongED_Scrap$Dir>.in")

	^Drag	SetTmp() Process(All,"<Tmp$Tool>.DoScript <Tmp$Drag>",,"<StrongED_Scrap$Dir>.in")

#	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	Trim lines
	Menu	Remove trailing spaces
	Help	HBM_trim
#	Select	Replace (_EndSpc,"",,NoLine)
	Select	TrimLines()

#	Menu	Remove indentation
	Menu	Remove leading spaces
	Help	HBM_ltrim
	Select	Replace(_spct,"",,Line)

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

	Menu	Unwrap (split) lines
	Help	HBM_split
	Select	Unwrap

	Menu	Fold text
	Select	UnfoldText() FoldText

	Menu	Unfold text
	Select	UnfoldText
End

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

Shortcuts
	``-	--------------------------------------------------------------------------------\n
	``ro	RISC OS
	``se	StrongED
End
