<!-- This file is provided under the Open Game License version 1.0a
  -- For more information on OGL and related issues, see 
  --   http://www.wizards.com/d20
  --
  -- For information on the Fantasy Grounds d20 Ruleset licensing and
  -- the OGL license text, see the d20 ruleset license in the program
  -- options.
  --
  -- All producers of work derived from this definition are adviced to
  -- familiarize themselves with the above licenses, and to take special
  -- care in providing the definition of Product Identity (as specified
  -- by the OGL) in their products.
  --
  -- Copyright 2007 SmiteWorks Ltd.
  -->

<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.0">
	<includefile source="utility_combattracker.xml" />
	<includefile source="utility_notes.xml" />
	<includefile source="utility_export.xml" />

	<windowclass name="tokenbag">
		<frame>tokenbag</frame>
		<placement>
			<size>
				<width>350</width>
				<height>353</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
			<minimum>
				<width>350</width>
				<height>353</height>
			</minimum>
		</sizelimits>
		<sheetdata>
			<tokenbag>
				<bounds>13,13,-28,-30</bounds>
				<tokenarea>0,0,-1,-49</tokenarea>
				<bagbar>
					<rect>0,-49,-1,49</rect>
					<frame>tokenbagbar</frame>
					<slotsize>49,49</slotsize>
				</bagbar>
				<bag>
					<icon>tokenbag</icon>
					<top>tokenbagtop</top>
					<up>tokenbagup</up>
					<custom>tokenbagcustom</custom>
					<labelframe>mini_name</labelframe>
					<labelfont>mini_name</labelfont>
				</bag>
				<grid>
					<width>46</width>
					<height>50</height>
				</grid>
			</tokenbag>
		</sheetdata>
	</windowclass>

	<!-- Player character selection -->
	<windowclass name="identityselection_newentry">
		<sizelimits>
			<minimum>
				<height>92</height>
			</minimum>
			<maximum>
				<width>235</width>
			</maximum>
		</sizelimits>
		<frame>modifier</frame>
		<script>
			function requestResponse(result, identity)
				if result and identity then
					windowlist.window.close();
				end
			end
		</script>
		<sheetdata>
			<stringcontrol name="label">
				<bounds>40,37,-10,20</bounds>
				<font>sheettext</font>
				<empty>&#171; Create New Character &#187;</empty>
			</stringcontrol>

			<genericcontrol name="base">
				<bounds>0,0,-1,-1</bounds>
				<script file="scripts/identityselection_newentry_base.lua" />
			</genericcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="identityselection_entry">
		<sizelimits>
			<minimum>
				<height>92</height>
			</minimum>
			<maximum>
				<width>235</width>
			</maximum>
		</sizelimits>
		<frame>modifier</frame>
		<script file="scripts/identityselection_entry.lua" />
		<sheetdata>
			<genericcontrol name="base">
				<bounds>0,0,-1,-1</bounds>
				<script file="scripts/identityselection_entry_base.lua" />
			</genericcontrol>

			<genericcontrol name="portrait">
				<bounds>10,10,72,72</bounds>
				<icon>charlist_base</icon>
				<disabled />
			</genericcontrol>
			<portraitselectioncontrol name="localportrait">
				<bounds>10,10,72,72</bounds>
				<base>charlist_base</base>
				<mask>charlist_mask</mask>
				<invisible />
				<script>
					function onDrop(x, y, draginfo)
						if draginfo.isType("portraitselection") then
							local portraitfile = draginfo.getStringData();
							setFile(portraitfile);
							User.setLocalIdentityPortrait(window.localdatabasenode, portraitfile);
							return true;
						end
					end
				</script>
			</portraitselectioncontrol>
			
			<stringcontrol name="campaign">
				<bounds>90,50,-10,20</bounds>
				<font>chatfont</font>
				<disabled />
			</stringcontrol>
			<genericcontrol name="error">
				<bounds>-65,15,56,56</bounds>
				<icon>indicator_error</icon>
				<disabled />
				<invisible />
			</genericcontrol>

			<stringcontrol name="label">
				<bounds>90,31,-10,20</bounds>
				<font>sheettext</font>
				<empty>&#171; Unnamed &#187;</empty>
				<disabled />
			</stringcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="identityselection">
		<frame>characterbox</frame>
		<placement>
			<size>
				<width>676</width>
				<height>430</height>
			</size>
		</placement>
		<sheetdata>
			<windowlist name="list">
				<bounds>102,43,470,359</bounds>
				<class>identityselection_entry</class>
				<columns>
					<width>235</width>
					<fillwidth />
				</columns>
				<script file="scripts/identityselection_list.lua" />
			</windowlist>
			<scroller>
				<bounds>-98,-80,45,27</bounds>
				<target>list</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scroller>
		</sheetdata>
	</windowclass>

	<!-- GM character list -->
	<windowclass name="charactersheetlistentry">
		<sizelimits>
			<minimum>
				<height>92</height>
			</minimum>
			<maximum>
				<width>235</width>
			</maximum>
		</sizelimits>
		<frame>modifier</frame>
		<script>
			function onInit()
				registerMenuItem("Clear owner", "erase", 4);
			end
			
			function onMenuSelection(item)
				if item == 4 and getDatabaseNode().getOwner() then
					getDatabaseNode().removeHolder(getDatabaseNode().getOwner());
				end
			end
		</script>
		<sheetdata>
			<genericcontrol name="base">
				<bounds>0,0,-1,-1</bounds>
				<script>
					function onClickDown(button, x, y)
						return true;
					end

					function onClickRelease(button, x, y)
						Interface.openWindow("charsheet", window.getDatabaseNode().getNodeName());
						return true;
					end
				</script>
			</genericcontrol>

			<genericcontrol name="portrait">
				<bounds>10,10,72,72</bounds>
				<icon>charlist_base</icon>
				<disabled />
				<script>
					function onInit()
						setIcon("portrait_" .. window.getDatabaseNode().getName() .. "_charlist");
					end
				</script>
			</genericcontrol>
			<stringcontrol name="owner">
				<bounds>90,50,-10,20</bounds>
				<font>chatfont</font>
				<disabled />
				<script>
					function update()
						local ownername = window.getDatabaseNode().getOwner();
						if not ownername then
							ownername = "None";
						end
						
						setValue("Owned by: " .. ownername);
					end
					
					function onInit()
						window.getDatabaseNode().onObserverUpdate = update;
						update();
					end
				</script>
			</stringcontrol>

			<stringfield name="name">
				<bounds>90,31,-10,20</bounds>
				<font>sheettext</font>
				<empty>&#171; Unnamed &#187;</empty>
				<disabled />
			</stringfield>
		</sheetdata>
	</windowclass>

	<windowclass name="charactersheetlist">
		<frame>characterbox</frame>
		<placement>
			<size>
				<width>676</width>
				<height>430</height>
			</size>
		</placement>
		<nodelete />
		<sheetdata>
			<windowlist name="list">
				<bounds>102,43,470,359</bounds>
				<datasource>.</datasource>
				<class>charactersheetlistentry</class>
				<allowcreate />
				<allowdelete />
				<columns>
					<width>235</width>
					<fillwidth />
				</columns>
			</windowlist>
			<scroller>
				<bounds>-98,-80,45,27</bounds>
				<target>list</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scroller>
		</sheetdata>
	</windowclass>

	<windowclass name="portraitselection_entry">
		<sizelimits>
			<minimum>
				<height>75</height>
			</minimum>
		</sizelimits>
		<sheetdata>
			<portraitselectioncontrol name="portrait">
				<bounds>0,0,-1,-1</bounds>
				<base>charlist_base</base>
				<mask>charlist_mask</mask>
				<script>
					function onDoubleClick(x, y)
						activate();
						window.windowlist.window.close();
					end
					
					function onDrag(button, x, y, draginfo)
						draginfo.setType("portraitselection");
						draginfo.setStringData(getFile());
						draginfo.setIcon("button_dragtarget");
						return true;
					end
				</script>
			</portraitselectioncontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="portraitselection">
		<frame>framebox</frame>
		<placement>
			<size>
				<width>460</width>
				<height>300</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
		</sizelimits>
		<sheetdata>
			<windowlist name="portraits">
				<class>portraitselection_entry</class>
				<bounds>30,30,-30,-30</bounds>
				<columns>
					<width>75</width>
					<fillwidth />
				</columns>
				<script>
					function onInit()
						getWindows()[1].close();
					
						for k, v in ipairs(User.getPortraitFileList()) do
							local newentry = createWindow();
							newentry.portrait.setFile(v);
						end
					end
				</script>
			</windowlist>
			<scrollercontrol>
				<bounds>-60,-50,45,27</bounds>
				<target>portraits</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="pointerselection">
		<placement>
			<size>
				<width>210</width>
				<height>215</height>
			</size>
		</placement>
		<sheetdata>
			<genericcontrol>
				<bounds>0,0,210,205</bounds>
				<script file="scripts/pointerselection.lua" />
			</genericcontrol>
		</sheetdata>
	</windowclass>
	
	<template name="modulepermissioncontrol">
		<genericcontrol>
			<script>
				function onDrag(button, x, y, draginfo)
					draginfo.setType("modulepermissions");

					draginfo.setStringData(permissions[1]);
					draginfo.setIcon(icon[1]);
					
					setIcon(nil);
					
					return true;
				end
				
				function onDragEnd(draginfo)
					setIcon(icon[1]);
				end
				
				function onInit()
					setHoverCursor("hand");
					if not User.isHost() then
						setVisible(false);
					end
				end
			</script>
		</genericcontrol>
	</template>
	
	<windowclass name="moduleselection_entry">
		<sizelimits>
			<minimum>
				<height>80</height>
			</minimum>
		</sizelimits>
		<frame>modifier</frame>
		<script file="scripts/moduleselectionentry.lua" />
		<sheetdata>
			<genericcontrol name="thumbnail">
				<bounds>8,8,63,63</bounds>
				<script>
					localwidget = nil;
				
					function onDoubleClick()
						if window.active then
							window.deactivate();
						else
							window.activate();
						end
					end
					
					function onInit()
						localwidget = addBitmapWidget("indicator_sent");
						localwidget.setPosition("bottomleft", 10, -10);
						localwidget.setVisible(false);
					end
				</script>
			</genericcontrol>
			<stringcontrol name="name">
				<bounds>80,23,-10,15</bounds>
				<font>sheetlabel</font>
				<static />
			</stringcontrol>
			<stringcontrol name="author">
				<bounds>80,40,-10,15</bounds>
				<font>sheetlabelsmall</font>
				<static />
			</stringcontrol>
			<genericcontrol name="load">
				<bounds>-50,10,40,28</bounds>
				<states>
					<loaded>indicator_moduleloaded</loaded>
					<unloaded>indicator_moduleunloaded</unloaded>
					<loading>indicator_moduleloading</loading>
					<unloading>indicator_moduleunloading</unloading>
				</states>
				<script file="scripts/moduleselectionentry_load.lua" />
			</genericcontrol>
			<genericcontrol name="permissions">
				<bounds>-50,-40,40,31</bounds>
				<states>
					<none>indicator_modulestatenone</none>
					<pending>indicator_modulestatepending</pending>
					<block>indicator_modulestateblocked</block>
					<allow>indicator_modulestateallowed</allow>
					<autoload>indicator_modulestateautoload</autoload>
				</states>
				<script>
					function onDrop(x, y, draginfo)
						if draginfo.isType("modulepermissions") then
							window.setPermissions(draginfo.getStringData());
							return true;
						end
						
						return false;
					end
				</script>
			</genericcontrol>
		</sheetdata>
	</windowclass>
	
	<windowclass name="moduleselection">
		<frame>indexbox</frame>
		<placement>
			<size>
				<width>600</width>
				<height>400</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic>
				<resize>vertical</resize>
			</dynamic>
		</sizelimits>
		<script>
			function createEntry(name)
				local win = list.createWindow();
				win.setName(name);
			end
		
			function onInit()
				list.getWindows()[1].close();
			
				local modules = Module.getModules();
				
				for k, v in ipairs(modules) do
					createEntry(v);
				end
				
				Module.onModuleAdded = createEntry;
			end
		</script>
		<sheetdata>
			<genericcontrol>
				<bounds>195,0,200,40</bounds>
				<frame>
					<name>indexboxtitle</name>
				</frame>
			</genericcontrol>
			
			<stringcontrol>
				<bounds>26,15,-30,17</bounds>
				<font>sheetlabel</font>
				<color>#9fffffff</color>
				<center />
				<static>Module Activation</static>
			</stringcontrol>
			<stringcontrol>
				<bounds>25,14,-30,17</bounds>
				<font>sheetlabel</font>
				<center />
				<static>Module Activation</static>
			</stringcontrol>
			
			<windowlist name="list">
				<class>moduleselection_entry</class>
				<bounds>23,40,-27,-51</bounds>
				<columns>
					<width>275</width>
					<fillwidth />
				</columns>
				<frame>
					<name>sheetgroup</name>
					<offset>9,7,9,7</offset>
				</frame>
			</windowlist>
			<scrollercontrol>
				<bounds>-70,-45,45,27</bounds>
				<target>list</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>
			
			<modulepermissioncontrol>
				<bounds>20,-47,30,31</bounds>
				<icon>indicator_modulestateblocked</icon>
				<permissions>disallow</permissions>
				<tooltip>
					<text>Block from players</text>
				</tooltip>
			</modulepermissioncontrol>
			<modulepermissioncontrol>
				<bounds>50,-47,30,31</bounds>
				<icon>indicator_modulestateallowed</icon>
				<permissions>allow</permissions>
				<tooltip>
					<text>Allow for players</text>
				</tooltip>
			</modulepermissioncontrol>
			<modulepermissioncontrol>
				<bounds>80,-47,30,31</bounds>
				<icon>indicator_modulestateautoload</icon>
				<permissions>autoload</permissions>
				<tooltip>
					<text>Force load for players</text>
				</tooltip>
			</modulepermissioncontrol>
		</sheetdata>
	</windowclass>

	<template name="lightingselection">
		<genericcontrol>
			<light>
				<system>FFFFFFFF</system>
				<window>FFFFFFFF</window>
				<control>FFFFFFFF</control>
				<content>FFFFFFFF</content>
			</light>
			<script>
				function onClickDown(button, x, y)
					Interface.setLighting(light[1].system[1], light[1].window[1], light[1].control[1], light[1].content[1]);
					window.close();
				end
			</script>
		</genericcontrol>
	</template>
	
	<windowclass name="lightingselection">
		<frame name="framebox" />
		<placement>
			<size>
				<width>165</width>
				<height>460</height>
			</size>
		</placement>
		<sheetdata>
			<lightingselection name="day">
				<anchored>
					<top>
						<anchor>top</anchor>
						<offset>30</offset>
					</top>
					<left>
						<anchor>left</anchor>
						<offset>30</offset>
					</left>
					<size>
						<width>100</width>
						<height>100</height>
					</size>
				</anchored>
				<icon>lighting_day</icon>
				<light>
				</light>
			</lightingselection>
			<lightingselection name="night">
				<anchored>
					<to>day</to>
					<position>below</position>
					<size>
						<height>100</height>
					</size>
				</anchored>
				<icon>lighting_night</icon>
				<light>
					<window>FFFFB8A4</window>
				</light>
			</lightingselection>
			<lightingselection name="fire">
				<anchored>
					<to>night</to>
					<position>below</position>
					<size>
						<height>100</height>
					</size>
				</anchored>
				<icon>lighting_fire</icon>
				<light>
					<window>FFB1C6F4</window>
				</light>
			</lightingselection>
			<lightingselection name="forest">
				<anchored>
					<to>fire</to>
					<position>below</position>
					<size>
						<height>100</height>
					</size>
				</anchored>
				<icon>lighting_forest</icon>
				<light>
					<window>FFE0FDE6</window>
				</light>
			</lightingselection>
		</sheetdata>
	</windowclass>
</root>
