<?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"/>
	</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>

</vobj>

<Load option="exec"> lib/HTML.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) () () () () () () (
		("OTHER" "ENABLED" ($ menu-new)
				() 
				"CTRL" 
				"N" 
				() 
				"call-menu-new"
				"new" 
				())
		("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" () () () ())
		))
)</VMenuBar>
</current-lang-env>

</vobj>
