<?xml version="1.0" encoding="utf-8" ?>
<jsml xmlns="http://cutesoft.net/jsml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://cutesoft.net/jsml ../core/jsml.xsd">


	<panel jsml-class="menu_context_common" jsml-base="floatmenu">
		<panel jsml-base="rtemenuitem" command="selectall" imagename="selectall" htmlcode="@SELECTALL" />
		<panel jsml-base="rtemenuspliter" />
		<panel jsml-base="rtemenuitem" command="undo" imagename="undo" htmlcode="@UNDO" />
		<panel jsml-base="rtemenuitem" command="redo" imagename="redo" htmlcode="@REDO" />
		<panel jsml-base="rtemenuspliter" />
		<panel jsml-base="rtemenuitem" command="save" imagename="save" htmlcode="@SAVE" />
		<panel jsml-base="rtemenuitem" command="new" imagename="newdoc" htmlcode="@NEW" />
		<panel jsml-base="rtemenuitem" command="print" imagename="print" htmlcode="@PRINT" />
		<panel jsml-base="rtemenuitem" command="ExecPlugin" arguments="spellcheck" imagename="spell" htmlcode="@SPELLCHECK" />
		<panel jsml-base="rtemenuitem" command="Find" imagename="Find" htmlcode="@FINDANDREPLACE" />
		<panel jsml-base="rtemenuitem" command="CleanCode" imagename="cleanup" htmlcode="@CLEANCODE" />
	</panel>

	<panel jsml-class="menu_context_format" jsml-base="floatmenu">
		<panel dock="top" margin="0,0,0,25" overflow="visible">
			<panel jsml-base="tbgroup_{skin}_{color}" dock="none">
				<image jsml-base="image_{skin}_{color}" command="bold" imagename="bold" tooltip="@BOLD" />
				<image jsml-base="image_{skin}_{color}" command="italic" imagename="italic" tooltip="@ITALIC" />
				<image jsml-base="image_{skin}_{color}" command="underline" imagename="under" tooltip="@UNDERLINE" />
				<image jsml-base="image_{skin}_{color}" command="linethrough" imagename="strike" tooltip="@LINETHROUGH" />
				<image jsml-base="image_{skin}_{color}" command="overline" imagename="overline" tooltip="@OVERLINE" />
			</panel>
		</panel>

		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuitem" htmlcode="@FONTNAME" arrow="true" xmlfile="setfontname.xml" />
		<panel jsml-base="rtemenuitem" htmlcode="@FONTSIZE" arrow="true" xmlfile="setfontsize.xml" />

		<panel jsml-base="rtemenuitem" htmlcode="@TEXTCOLOR" arrow="true" xmlfile="colorpicker.xml">
			<method name="initoption" arguments="newoption">
				newoption.setcolor=function(val){editor.ExecCommand("forecolor",val);}
			</method>
		</panel>
		<panel jsml-base="rtemenuitem" htmlcode="@BACKCOLOR" arrow="true" xmlfile="colorpicker.xml">
			<method name="initoption" arguments="newoption">
				newoption.setcolor=function(val){editor.ExecCommand("backcolor",val);}
			</method>
		</panel>


		<panel jsml-base="rtemenuspliter" />
		<panel jsml-base="rtemenuitem" command="removeformat" imagename="unformat" htmlcode="@REMOVEFORMAT" />

	</panel>


	<panel jsml-class="menu_context_justify" jsml-base="floatmenu">
		<panel jsml-base="rtemenuitem"  command="JustifyLeft" text="@JUSTIFYLEFT" imagename="left" />
		<panel jsml-base="rtemenuitem" command="JustifyCenter" text="@JUSTIFYCENTER" imagename="center" />
		<panel jsml-base="rtemenuitem" command="JustifyRight" text="@JUSTIFYRIGHT" imagename="right" />
		<panel jsml-base="rtemenuitem"  command="JustifyFull" text="@JUSTIFYFULL" imagename="justifyfull" />
		<panel jsml-base="rtemenuitem" command="JustifyNone" text="@JUSTIFYNONE" imagename="justifynone" />
	</panel>


	<panel jsml-class="menu_context_paragraphs" jsml-base="floatmenu">

		<panel dock="top" margin="0,0,0,25" overflow="visible">
			<panel jsml-base="tbgroup_{skin}_{color}" dock="none">
				<image jsml-base="image_{skin}_{color}" command="JustifyLeft" text="@JUSTIFYLEFT" imagename="left" />
				<image jsml-base="image_{skin}_{color}" command="JustifyCenter" text="@JUSTIFYCENTER" imagename="center" />
				<image jsml-base="image_{skin}_{color}" command="JustifyRight" text="@JUSTIFYRIGHT" imagename="right" />
				<image jsml-base="image_{skin}_{color}"  command="JustifyFull" text="@JUSTIFYFULL" imagename="justifyfull" />
				<image jsml-base="image_{skin}_{color}" command="JustifyNone" text="@JUSTIFYNONE" imagename="justifynone" />
			</panel>
		</panel>
		<!--
		<panel jsml-base="rtemenuopener" menuclass="menu_context_justify" htmlcode="@JUSTIFY" />
		-->

		<!--
		<panel dock="top" margin="0,0,0,25" overflow="visible">
			<panel jsml-base="tbgroup_{skin}_{color}" dock="none">
				<image jsml-base="image_{skin}_{color}" command="Outdent" tooltip="@OUTDENT" />
				<image jsml-base="image_{skin}_{color}" command="Indent" tooltip="@INDENT" />
				<image jsml-base="image_{skin}_{color}" command="InsertBlockQuote" tooltip="@INSERTBLOCKQUOTE" imagename="blockquote" />
				<image jsml-base="image_{skin}_{color}" command="Ltr" imagename="dir_ltr" />
				<image jsml-base="image_{skin}_{color}" command="Rtl"  imagename="dir_rtl" />
			</panel>
		</panel>
		-->

		<panel jsml-base="rtemenuitem" command="InsertBlockQuote" text="@INSERTBLOCKQUOTE" imagename="blockquote" />
		<panel jsml-base="rtemenuitem" command="Outdent" text="@OUTDENT" />
		<panel jsml-base="rtemenuitem" command="Indent" text="@INDENT" />
		<panel jsml-base="rtemenuitem" command="LTR" text="@DIRECTION_LTR" imagename="dir_ltr" />
		<panel jsml-base="rtemenuitem" command="RTL" text="@DIRECTION_RTL" imagename="dir_rtl" />

		<!--
		<panel jsml-base="rtemenuitem" htmlcode="@PARAGRAPHS" arrow="true" xmlfile="setparagraph.xml" />
		-->

	</panel>


	<panel jsml-class="menu_context_table" jsml-base="floatmenu">

		<panel jsml-base="rtemenuitem" command="mergecells" imagename="mrgcell" htmlcode="@MERGECELLS" />
		<panel jsml-base="rtemenuitem" command="splitcells" imagename="spltcell" htmlcode="@SPLITCELLS" />
		<panel jsml-base="rtemenuspliter" />
		<panel jsml-base="rtemenuitem" command="deleterow" htmlcode="@DELETEROW" imagename="delrow"  />
		<panel jsml-base="rtemenuitem" command="deletecolumn" htmlcode="@DELETECOLUMN" imagename="delcol"  />
		<panel jsml-base="rtemenuitem" command="insertrowtop" htmlcode="@INSERTROWTOP" imagename="insrow_t"  />
		<panel jsml-base="rtemenuitem" command="insertrowbottom" htmlcode="@INSERTROWBOTTOM" imagename="insrow_b"  />
		<panel jsml-base="rtemenuspliter" />
		<panel jsml-base="rtemenuitem" command="insertcolumnleft" htmlcode="@INSERTCOLUMNLEFT" imagename="inscol_l"  />
		<panel jsml-base="rtemenuitem" command="insertcolumnright" htmlcode="@INSERTCOLUMNRIGHT" imagename="inscol_r" />

	</panel>

	<!--
	<panel jsml-class="menu_context_link" jsml-base="floatmenu">
		<panel jsml-base="rtemenuitem" imagename="link" htmlcode="@EDIT| |@LINK">
			<attach name="click">
				var link=editor.IsIncludedByTag("a");
				if(link)editor.ShowPropertiesDialog(link);
			</attach>
		</panel>
		<panel jsml-base="rtemenuitem" imagename="unlink" htmlcode="@REMOVE| |@LINK">
			<attach name="click">
				var link=editor.IsIncludedByTag("a");
				if(link)link.RemoveNode(false);
			</attach>
		</panel>
	</panel>
	-->

	<panel jsml-class="menu_context_taglist" jsml-base="floatmenu">
		<initialize>
			<![CDATA[
			var node=editor.GetSelectionRoot();
			for(;node&&node.GetNameLower()!="body";node=node.GetParent())
			{
				if(node.nodeType!=1)continue;
				
				var item=self.createitem(node);
				self.append_child(item);
			}
			]]>
		</initialize>
		<method name="createitem" arguments="node">
			<![CDATA[
			var item=jsml.class_create_instance("rtemenuitem");
			item.set_arrow(true);
			item.set_xmlfile("menu_tagitem.xml");
			item._floatboxClass="floatmenu";
			item.initoption=function(newoption)
			{
				newoption.node=node;
				newoption.buttonClick=function()
				{
					item.invoke_event("click");
				}
			}
			item.attach_event("click",function()
			{
				editor.ShowPropertiesDialog(node);
			});
			item.set_text(node.GetName());
			return item;
			]]>
		</method>
	</panel>





	<panel jsml-class="menu_context_point" dock="fill" overflow="visible">


		<panel jsml-base="rtemenuitem" command="selectall" imagename="selectall" htmlcode="@SELECTALL" />

		<panel jsml-base="rtemenuitem" command="undo" imagename="undo" htmlcode="@UNDO" />

		<panel jsml-base="rtemenuspliter" />

		<!--
	<panel jsml-base="rtemenuitem" command="paste" imagename="paste" htmlcode="@PASTE" />
	-->
		<panel jsml-base="rtemenuitem" htmlcode="@PASTE" imagename="paste" arrow="true" xmlfile="editor_paste.xml">
			<initialize>
				if(editor.GetSelectionType()=="Control")self.set_visible(false);
			</initialize>
			<method name="initoption" arguments="newoption">
				this._lastpastecmd="paste";
				newoption.command="paste";
				newoption.width=360;
				newoption.height=240;
				newoption.puretextmode=false;
				newoption.callback=editor.delegate(editor._onpastedialogreturn);
			</method>
		</panel>

		<panel jsml-base="rtemenuspliter" />


		<panel jsml-base="rtemenuopener" menuclass="menu_context_common" htmlcode="@COMMON" />

		<panel jsml-base="rtemenuopener" menuclass="menu_context_paragraphs" htmlcode="@PARAGRAPHS">
			<initialize>
				//if(editor.GetSelectionType()=="Control")self.set_visible(false);
				//if(!editor.QueryStyle("paragraph"))self.set_visible(false);
			</initialize>
		</panel>

		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuopener" menuclass="menu_context_taglist" htmlcode="@TAGLIST">
			<initialize>
				<![CDATA[
			var node=editor.GetSelectionRoot();
			var count=0;
			for(;node&&node.GetNameLower()!="body";node=node.GetParent())
			{
				if(node.nodeType==1)count++;
			}
			if(count==0)self.set_disabled(true);
			]]>
			</initialize>
		</panel>

		<panel jsml-base="rtemenuopener" menuclass="menu_context_table" htmlcode="@TABLE" imagename="inserttable">
			<initialize>
				var table=editor.IsIncludedByTag("table");
				if(table==null)return self.set_visible(false);
			</initialize>
		</panel>

		<!--
		<panel jsml-base="rtemenuopener" menuclass="menu_context_link" htmlcode="@LINK" imagename="link">
			<initialize>
				var link=editor.IsIncludedByTag("a");
				if(link==null)return self.set_visible(false);
			</initialize>
			<attach name="click">
				var link=editor.IsIncludedByTag("a");
				if(link)editor.ShowPropertiesDialog(link);
			</attach>
		</panel>
		-->

		<panel jsml-base="rtemenuitem" imagename="link" htmlcode="@EDIT| |@LINK">
			<initialize>
				var link=editor.IsIncludedByTag("a");
				if(link==null)return self.set_visible(false);
			</initialize>
			<attach name="click">
				var link=editor.IsIncludedByTag("a");
				if(link)editor.ShowPropertiesDialog(link);
			</attach>
		</panel>
		<panel jsml-base="rtemenuitem" imagename="unlink" htmlcode="@REMOVE| |@LINK">
			<initialize>
				var link=editor.IsIncludedByTag("a");
				if(link==null)return self.set_visible(false);
			</initialize>
			<attach name="click">
				var link=editor.IsIncludedByTag("a");
				if(link)link.RemoveNode(false);
			</attach>
		</panel>

	</panel>



	<panel jsml-class="menu_context_range" dock="fill" overflow="visible">

		<panel jsml-base="rtemenuitem" command="mergecells" imagename="mrgcell" htmlcode="@MERGECELLS">
			<initialize>
				if(!editor.CanExecCommand("mergecells"))self.set_visible(false);
			</initialize>
		</panel>

		<panel jsml-base="rtemenuitem" command="cut" imagename="cut" htmlcode="@CUT">
			<initialize>
				if(editor.CanExecCommand("mergecells"))self.set_visible(false);
			</initialize>
			<attach name="mousehover">self._ResetFCButton();</attach>
		</panel>
		<panel jsml-base="rtemenuitem" command="copy" imagename="copy" htmlcode="@COPY">
			<initialize>
				if(editor.CanExecCommand("mergecells"))self.set_visible(false);
			</initialize>
			<attach name="mousehover">self._ResetFCButton();</attach>
		</panel>

		<panel jsml-base="rtemenuitem" command="delete" imagename="delete" htmlcode="@DELETE">
			<initialize>
				if(editor.CanExecCommand("mergecells"))self.set_visible(false);
			</initialize>
		</panel>

		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuitem" command="removeformat" imagename="unformat" htmlcode="@REMOVEFORMAT" />

		<panel jsml-base="rtemenuspliter" />

		<panel dock="top" margin="0,0,0,25" overflow="visible">
			<panel jsml-base="tbgroup_{skin}_{color}" dock="none">
				<image jsml-base="image_{skin}_{color}" command="bold" imagename="bold" tooltip="@BOLD" />
				<image jsml-base="image_{skin}_{color}" command="italic" imagename="italic" tooltip="@ITALIC" />
				<image jsml-base="image_{skin}_{color}" command="underline" imagename="under" tooltip="@UNDERLINE" />
				<image jsml-base="image_{skin}_{color}" command="linethrough" imagename="strike" tooltip="@LINETHROUGH" />
				<image jsml-base="image_{skin}_{color}" command="overline" imagename="overline" tooltip="@OVERLINE" />
			</panel>
		</panel>

		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuitem" htmlcode="@FONTNAME" arrow="true" xmlfile="setfontname.xml" />
		<panel jsml-base="rtemenuitem" htmlcode="@FONTSIZE" arrow="true" xmlfile="setfontsize.xml" />

		<panel jsml-base="rtemenuitem" htmlcode="@TEXTCOLOR" arrow="true" xmlfile="colorpicker.xml">
			<method name="initoption" arguments="newoption">
				newoption.setcolor=function(val){editor.ExecCommand("forecolor",val);}
			</method>
		</panel>
		<panel jsml-base="rtemenuitem" htmlcode="@BACKCOLOR" arrow="true" xmlfile="colorpicker.xml">
			<method name="initoption" arguments="newoption">
				newoption.setcolor=function(val){editor.ExecCommand("backcolor",val);}
			</method>
		</panel>


		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuopener" menuclass="menu_context_taglist" htmlcode="@TAGLIST">
			<initialize>
				<![CDATA[
			var node=editor.GetSelectionRoot();
			var count=0;
			for(;node&&node.GetNameLower()!="body";node=node.GetParent())
			{
				if(node.nodeType==1)count++;
			}
			if(count==0)self.set_disabled(true);
			]]>
			</initialize>
		</panel>

		<panel jsml-base="rtemenuopener" menuclass="menu_context_table" htmlcode="@TABLE">
			<initialize>
				var table=editor.IsIncludedByTag("table");
				if(table==null)return self.set_visible(false);
			</initialize>
		</panel>

	</panel>



	<panel jsml-class="menu_context_control" dock="fill" overflow="visible">

		<panel jsml-base="rtemenuitem" command="cut" imagename="cut" htmlcode="@CUT">
			<attach name="mousehover">self._ResetFCButton();</attach>
		</panel>
		<panel jsml-base="rtemenuitem" command="copy" imagename="copy" htmlcode="@COPY">
			<attach name="mousehover">self._ResetFCButton();</attach>
		</panel>

		<panel jsml-base="rtemenuitem" command="delete" imagename="delete" htmlcode="@DELETE" />

		<panel jsml-base="rtemenuspliter" />

		<panel jsml-base="rtemenuopener" menuclass="menu_context_taglist" htmlcode="@TAGLIST">
			<initialize>
				<![CDATA[
			var node=editor.GetSelectionRoot();
			var count=0;
			for(;node&&node.GetNameLower()!="body";node=node.GetParent())
			{
				if(node.nodeType==1)count++;
			}
			if(count==0)self.set_disabled(true);
			]]>
			</initialize>
		</panel>

		<panel jsml-base="rtemenuitem" htmlcode="@IMAGEEDITOR" imagename="imageeditor">
			<initialize>
				<![CDATA[
			var node=editor.GetSelectionRoot();
			if(!node||node.GetNameLower()!="img")self.set_visible(false);
			self.set_disabled(true);
			editor.FindStorage(["Gallery","Image"],node.GetAttribute("src"),function(storage,fileitem)
			{
				if(!storage)return;
				self.imgnode=node;
				self.storage=storage;
				self.fileitem=fileitem;
				self.set_disabled(false);
			});
			]]>
			</initialize>
			<attach name="click">
				if(!self.storage)return;
				editor.ShowImageEditor(self.imgnode,self.storage,self.fileitem);
			</attach>
		</panel>

		<panel jsml-base="rtemenuitem" htmlcode="@INSERTIMAGEMAP" imagename="imagemap">
			<initialize>
				<![CDATA[
				var node=editor.GetSelectionRoot();
				if(!node||node.GetNameLower()!="img")self.set_visible(false);
				self.imgnode=node;
				]]>
			</initialize>
			<attach name="click">
				editor.ExecInsertImageMap(null,self.imgnode);
			</attach>
		</panel>

		<panel jsml-base="rtemenuitem" htmlcode="@STYLES" imagename="properties">
			<initialize>
				<![CDATA[
				var node=editor.GetSelectionRoot();
				if(!node||!node.IsControl())
				{
					self.set_visible(false);
					return;
				}
				self.set_arrow(true);
				self.set_xmlfile("menu_styles.xml");
				self._floatboxClass="floatmenu";
				self.initoption=function(newoption)
				{
					newoption.node=node;
					newoption.buttonClick=function()
					{
						self.invoke_event("click");
					}
				}
				]]>
			</initialize>
			<attach name="click">
				editor.ShowPropertiesDialog(editor.GetSelectionRoot(),{styletab:"text"})
			</attach>
		</panel>
		<panel jsml-base="rtemenuitem" htmlcode="@PROPERTIES" imagename="properties">
			<initialize>
				var node=editor.GetSelectionRoot();
				if(!node||!node.IsControl())self.set_visible(false);
			</initialize>
			<attach name="click">
				editor.ShowPropertiesDialog(editor.GetSelectionRoot())
			</attach>
		</panel>

	</panel>


	<panel dock="fill" overflow="visible">
		<initialize>
			<![CDATA[
			var seltype=editor.GetSelectionType();
			var menucls="menu_context_point";	
			if(seltype=="Range")
				menucls="menu_context_range";
			if(seltype=="Control")
				menucls="menu_context_control";
			self.append_child(jsml.class_create_instance(menucls));
			]]>
		</initialize>
	</panel>












</jsml>
