<?xl version="0.1" encoding="SHIFT_JIS"?>


<!--------------------------------------------------------------------------
	Initial Preferences Loading
-------------------------------------------------------------------------->


<Env0 type="raw">
	<Define> ^gb-ns xlp://isjhp1.nichibun.ac.jp:8080/gb_metadata
	</Define>
</Env0>

<WritingStyle stylename="DefaultStyle">
<Font fontname="-*-times-medium-r-normal--*-iso8859-1" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-2" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-3" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-4" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-5" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-6" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-7" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-8" method="nearly"/>
<Font fontname="-*-times-medium-r-normal--*-iso8859-9" method="nearly"/>

<Font fontname="times medium" method="nearly"/>
</WritingStyle>

<vobj type="raw">


<WritingStyle stylename="NormalStyle"/>
<WritingStyle stylename="TitleStyle"/>

<Define> ^VObjectStatus ^'([VObjectStatus
		ws="DefaultStyle"])
</Define>

</vobj>

<Env0 type="raw">
<Define> ^gbview-first-cmd
<quote type="direct">
	<Env0 type="raw">

	<Define> ^gv-flame-event ()
		<Arguments> ^arg-type ^arg-list </Arguments>
		<Sequence> ()
			<Define> ^cmd (quote
				([win-flame-event flame-id="$flame-id"] ($ arg-type)
					(quote ($arg-list)))
			) </Define>
			<Define> ^iid (GetMainInterpreter) </Define>
			<Remote> ^iid
				(Eval Env0 (Local cmd))
			</Remote>
		</Sequence>
	</Define>

	<Define> ^gv-flame-radar-indicate-event ()
		<Arguments> ^arg-list </Arguments>
		<Sequence> ()
			<Define> ^cmd (quote
				([win-flame-indicate-event flame-id="$flame-id"]
					(quote ($arg-list)))
			) </Define>
			<Define> ^iid (GetMainInterpreter) </Define>
			<Remote> ^iid
					(Eval Env0 (Local cmd))
			</Remote>
		</Sequence>
	</Define>
	</Env0>
</quote>
</Define>
</Env0>


<!--------------------------------------------------------------------------
	LOGSYSTEM Setup
-------------------------------------------------------------------------->


<SetLogCondition>
	<Reset file="\{preference}console.log"/>
	<Reset file="\{preference}debug.log"/>
	<Condition>
		<Action 
			type="save"
			option="unlock:all"
			path="\{preference}console.log"/>
	</Condition>
	<Condition>
		(($ DEBUG) = level)
		<Action 
			type="save"
			option="unlock:all"
			path="\{preference}debug.log"/>
		<Action 
			type="console"
			path=""/>
	</Condition>
	<Condition>
		(($ WARNING) &lt;= level)
		<Action 
			type="console"
			path=""/>
	</Condition>
</SetLogCondition>


<!--------------------------------------------------------------------------
	Preferences Setup
-------------------------------------------------------------------------->

<gv-resource rid="4">
<Let>
<Sub>
<lst>
	<ErrHandler>
	<Load option="exec"> (+ gv-initdir "gbview.param") </Load>
	</ErrHandler>
</lst>
<code>
	(GE lst 5)
</code>
</Sub>
	<If> (= 0 code)
	<Else>
		<gv-reset-status/>
		<Load option="exec"> (+ gv-initdir "gbview.param") </Load>
	</Else>
	</If>
</Let>
</gv-resource>

<Env0 type="raw">
<Define> ^preferences ([gv-resource rid="4"] (gv-resource-status)) </Define>

<Define> ^theme ([GE path="gv-resource/theme"
			el="1"
			default="skeleton1"] 
		preferences) </Define>
<Define> ^lang ([GE path="gv-resource/lang"
			el="1"
			default="en"]
		preferences)
</Define>
</Env0>

<!--------------------------------------------------------------------------
	Some functions are defined
-------------------------------------------------------------------------->

<Define> ^lang-setup ()
<Arguments> 	^lang
		^lang-name
		^en-lang-name
</Arguments>
<Let>
<Env> ^vobj </Env>

<If> (= ([GE path="^lang" default="()"] languages) ()) 
<Else> <Break/> </Else> 
</If>
<set> ^languages (cons '(
		($ ([Cast type="symbol"] lang))
		($ lang-name)
		($ en-lang-name)
		($ ([Cast type="symbol"] (+ lang "-env")))
			)
			languages) </set>
</Let>
</Define>

<vobj type="raw">
<Define> ^lang-list ()
<Arguments/>
<Let>
<Env> ^vobj </Env>
<Sub>
	<ret> () </ret>
	<L> ^languages </L>
</Sub>
<For dec="L">
	<set> ^ret (cons (+ 
			(GE (car L) 1)
			"("
			(GE (car L) 2)
			")") 
			ret) </set>
</For>
<Reverse> ^ret </Reverse>
</Let>
</Define>

<Define> ^lang-no ()
<Arguments/>
<Let>
<Env> ^vobj </Env>
<Sub>
	<L> ^languages </L>
	<ret> 0 </ret>
</Sub>
<For dec="L">
	<If> (= (GE (car L) 0) current-lang-abb)
	<Then><Break> ^ret </Break></Then>
	<Else><set> ^ret (+ ret 1) </set></Else>
	</If>
</For>
^ret
</Let>
</Define>

<Define> ^call-menu-help ()
<Arguments>
	^win ^url
</Arguments>
<Let>
<LaunchWWW> ^url </LaunchWWW>
</Let>
</Define>

<Define> ^VersionPattern1 (GE (DivideString (GE ([GetVersion layer="AP.code"]) 3) "(") 0)
</Define>
<Define> ^VersionPattern2 (ReplaceString VersionPattern1 "." "-")
</Define>
<Define> ^VersionPattern0 (GE ([GetVersion layer="AP.code"]) 3)
</Define>
<Define> ^CopyRightPattern0 (GE ([GetVersion layer="AP.code"]) 2)
</Define>

</vobj>


<Load option="exec"> lib/HTML.xl </Load>
<Load option="exec"> lib/mapping.xl </Load>

<!--------------------------------------------------------------------------
	Loading Opening Windows
-------------------------------------------------------------------------->

<Load option="exec"> (+ "theme/" theme "/opening.xl") </Load>

<vobj>

<SetStatus visible="1">
	(GetObjectID opening-win 'opening-win)
</SetStatus>
</vobj>

<!--------------------------------------------------------------------------
	Loading Languages Setups
-------------------------------------------------------------------------->

<vobj type="raw">
<Define> ^languages () </Define>
</vobj>

<Define> ^path-list (FindFile "lang/*.xl") </Define>
<For dec="path-list">
	<Load option="exec"> (car path-list) </Load>
</For>

<WritingStyle stylename="NormalStyle" parentof="DefaultStyle" />
<WritingStyle stylename="TitleStyle" parentof="DefaultStyle"/>
<vobj>
<vobjTarget>
<ObjectList> ^opening-win </ObjectList>
	<vobjWaitSync/>
</vobjTarget>


<vobjTarget>
<ObjectList append="off"> ^opening-win </ObjectList>
	<VxlText 	refer="text"
			ws="DefaultStyle"
			ps-flags="text">
		($ ([GetVersion layer="AP.code"])) ^"\n"
		($ ([GetVersion layer="MA.code"])) ^"\n"
	</VxlText>
</vobjTarget>

</vobj>


<Env0 type="raw">
	<Define> ^period-switch ()
	<Arguments> ^p </Arguments>
	<Switch>
	<Case> (= p 'now)
		([GetXLTime format="W3C-DTF"])
	</Case>
	<Case> (= p 'undef)
		^""
	</Case>
	<Case> 1
		^p
	</Case>
	</Switch>
	</Define>

	<Define> ^gb-template1 ()
	<Arguments>
		^keyword
		^property
		^period.type
		^period.from
		^period.to
	</Arguments>
	<Sequence> ()
		<Define> ^period.from (period-switch period.from) </Define>
		<Define> ^period.to (period-switch period.to) </Define>
		<Define> ^property
			(quote ([qualifier cond="part"]
				($ gb-ns) 0
				"property" () ($ property)))
		</Define>
		<Define> ^period
			(quote ([qualifier cond="boundary"]
				($ gb-ns) 0
				"content.period" ($ period.type)
				($ (+ period.from " / " period.to))))
		</Define>
		<If> (Or (= keyword ()) (= keyword ""))
		<Then>
			(List 'AND
				property
				period)
		</Then>
		<Else>
			(List 'AND
				(quote ([qualifier cond="part"]
					($ gb-ns) -1
					() () ($ keyword)))
				property
				period)
		</Else>
		</If>
	</Sequence>
	</Define>

</Env0>

<!--------------------------------------------------------------------------
	Loading Preferences (pxlconf/gbview.param)
-------------------------------------------------------------------------->

<Env1>
<Load option="exec"> (+ preference-path "gbview.param") </Load>
</Env1>

<!--------------------------------------------------------------------------
	Loading windows and setups of theme
-------------------------------------------------------------------------->


<vobj type="raw">

<Define> ^current-lang-env 
	(Eval (CurrentEnvironment)
		([Cast type="symbol"] (+ lang "-env")))
</Define>
<Define> ^current-lang-abb
		([Cast type="symbol"] lang)
</Define>

</vobj>

<Load option="exec"> (+ "theme/" theme "/windows.xl") </Load>

<!--
<Sleep>  5 </Sleep>
-->

<vobj type="raw">

<SetStatus visible="0">
	(GetObjectID opening-win 'opening-win)
</SetStatus>

<VDestroy> (GetObjectID opening-win 'opening-win) </VDestroy>


<!--------------------------------------------------------------------------
	Menu Setup and Start
-------------------------------------------------------------------------->


<current-lang-env>
<VMenuBar> 0 1 
^'(
	("FILE" "ENABLED" ($ menu-file) () () () () () () (
		(($ VMT-NEW) "ENABLED" ($ menu-new)
				() 
				"CTRL" 
				"N" 
				() 
				"call-menu-new"
				"new" 
				())
		(($ VMT-OPEN) "" ($ menu-open)
				() 
				"CTRL" 
				"O" 
				() 
				"call-menu-new"
				() 
				())
		(($ VMT-SAVE) "" ($ menu-save)
				() 
				"CTRL" 
				"S" 
				() 
				"call-menu-new"
				() 
				())
		(($ VMT-SAVE-AS) "" ($ menu-save-as)
				() 
				"CTRL,SHIFT" 
				"S" 
				() 
				"call-menu-new"
				() 
				())
		("SEPARATOR" "" "-" () () () () () () ())
		(($ VMT-PAGE-SETUP) "" ($ menu-page-setup)
				() 
				"CTRL,SHIFT" 
				"P" 
				() 
				"call-menu-new"
				() 
				())
		(($ VMT-PRINT) "" ($ menu-print)
				() 
				"CTRL" 
				"P" 
				() 
				"call-menu-new"
				() 
				())
		("SEPARATOR" "" "-" () () () () () () ())
		("SETUP" "ENABLED" ($ menu-preferences) 
				()  
				()
				() 
				() 
				"preferences-window" 
				() 
				())
		("QUIT" "ENABLED" ($ menu-quit)
				() 
				"CTRL" 
				"Q" 
				() 
				"Quit" 
				() 
				())
		))
	("EDIT" "ENABLED" ($ menu-edit) () () () () () () (
		("UNDO" "" ($ menu-undo) () "CTRL" "Z" () () () ())
		("REDO" "" ($ menu-redo) ()  "CTRL,SHIFT" "Z" () () () ())
		("SEPARATOR" "" "-" () () () () () () ())
		("CUT" "" ($ menu-cut) ()  "CTRL" "X" () () () ())
		("COPY" "" ($ menu-copy) ()  "CTRL" "C" () () () ())
		("PASTE" "" ($ menu-paste) ()  "CTRL" "V" () () () ())
		("CLEAR" "" ($ menu-clear) () () () () () () ())
		("SEPARATOR" "" "" () () () () () () ())
		("SEL_ALL" "" ($ menu-select-all) ()  "CTRL" "A" () () () ())
		("SEPARATOR" "" "-" () () () () () () ())
		(($ VMT-COPY-WARP-POINT) "" ($ menu-copy-warp-point) () "CTRL,SHIFT" "C"  () "call-edit-warp" () ())
		))
	(($ VMT-WARP) "ENABLED" ($ menu-warp) () () () () () () (
		(($ VMT-WARP-REPLACE-MODE) "CHECKED" ($ menu-warp-replace-mode) ()  () () () "call-add-warp" () ())
		(($ VMT-WARP-INSERT-MODE) "" ($ menu-warp-insert-mode) ()  () () () "call-add-warp" () ())
		("SEPARATOR" "" "-" () () () () () () ())
		(($ VMT-ADD-WARP) "" ($ menu-add-warp) ()  "CTRL" "D" () "call-add-warp" () ())
		(($ VMT-SET-IWP) "" ($ menu-set-iwp) ()  "CTRL" "I" () "call-add-warp" () ())
		(($ VMT-EDIT-WARP) "" ($ menu-edit-warp) () "CTRL,SHIFT" "D"  () "call-edit-warp" () ())
		(($ VMT-WARP-EDIT-NEW-GROUP) "" ($ menu-warp-edit-new-group) 
				()  "CTRL,SHIFT"  "N" () "call-add-warp" () ())
		("SEPARATOR" "" "-" () () () () () () ())
		))
	(($ (VxlVMTstr -9200)) "ENABLED" ($ menu-indicates) () () () () () () (
		(($ VMT-HWF) "" ($ menu-hwf-toggle) () () () () () () ())
		(($ (VxlVMTstr -9201)) ($ (check-mapping-toggle)) ($ menu-mapping-toggle) () () () () "call-mapping-toggle" () ())
	))
	("WINDOW" "ENABLED" ($ menu-window) () () () () () () (
	))
	("HELP" "ENABLED" ($ menu-help) () () () () () () (
		("OTHER" "ENABLED" ($ menu-help-online)
				() 
				() 
				() 
				() 
				("call-menu-help" 
					($ help-URL-online))
				()
				())
		("SEPARATOR" "" "-" () () () () () () ())
		("OTHER" "ENABLED" ($ menu-help-release)
				() 
				() 
				() 
				() 
				("call-menu-help" ($ help-URL-release))
				()
				())
		("OTHER" "ENABLED" ($ menu-help-GLOBALBASE)
				() 
				() 
				() 
				() 
				("call-menu-help" "http://www.globalbase.org/")
				()
				())
		("OTHER" "ENABLED" ($ menu-help-download)
				() 
				() 
				() 
				() 
				("call-menu-help" "http://sourceforge.jp/projects/globalbase/")
				()
				())
		("SEPARATOR" "" "-" () () () () () () ())
		("ABOUT" "ENABLED" ($ menu-about-cosmos)
				() 
				() 
				() 
				() 
				"about-cosmos-window"
				()
				())
	))
)</VMenuBar>
</current-lang-env>

(PrintStd "===================================================")
(PrintStd lang)


<VgbFlameStandardLoadWPM preference="warppoint.xml" type="1">(+ "init/warppoint." lang ".xml")</VgbFlameStandardLoadWPM>
<VgbFlameStandardLoadWPM preference="iwp.xml" type="2">init/iwp.xml</VgbFlameStandardLoadWPM>


</vobj>
