Just file renaming
svn path=/trunk/aspeditor/; revision=49679
This commit is contained in:
Родитель
4f0eb72ff2
Коммит
aae97d6f8e
|
@ -7,9 +7,9 @@ chrome_install_text = "content,install,url,resource:/chrome/aspdesigner/content/
|
|||
contentdir = $(chromedir)/content
|
||||
content_DATA = $(content_files)
|
||||
content_files = \
|
||||
$(srcdir)/content/aspdesigner.js \
|
||||
$(srcdir)/content/editor.js \
|
||||
$(srcdir)/../jscall/Resources/JSCall.js \
|
||||
$(srcdir)/content/aspdesigner.xul \
|
||||
$(srcdir)/content/editor.xul \
|
||||
$(srcdir)/content/editorContent.css \
|
||||
$(srcdir)/content/contents.rdf
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
table {
|
||||
border : 1px solid #aaaaaa;
|
||||
}
|
||||
|
||||
::-moz-selection{
|
||||
background-color : #003366;
|
||||
color : #eee;
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:aspdesigner"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Description about="urn:mozilla:package:aspdesigner"
|
||||
chrome:displayName="Visual ASP.NET Designer for MonoDevelop"
|
||||
chrome:author="Blagovest Dachev"
|
||||
chrome:name="aspdesigner">
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
|
@ -26,43 +26,43 @@
|
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
using System;
|
||||
using AspNetEdit.JSCall;
|
||||
using System.ComponentModel.Design;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using AspNetEdit.Editor.ComponentModel;
|
||||
using System.Web.UI;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using AspNetEdit.Editor.ComponentModel;
|
||||
using System.Web.UI;
|
||||
using System.Collections;
|
||||
using Gtk;
|
||||
|
||||
namespace AspNetEdit.Editor.UI
|
||||
{
|
||||
public class RootDesignerView : Gecko.WebControl
|
||||
{
|
||||
private const string geckoChrome = "chrome://aspdesigner/content/aspdesigner.xul";
|
||||
{
|
||||
private const string geckoChrome = "chrome://aspdesigner/content/editor.xul";
|
||||
private CommandManager comm;
|
||||
private DesignerHost host;
|
||||
private IComponentChangeService changeService;
|
||||
private ISelectionService selectionService;
|
||||
private IMenuCommandService menuService;
|
||||
protected bool active = false;
|
||||
private string outDocument = null;
|
||||
|
||||
|
||||
//there's weird bug where a second Gecko instance *can't* be created
|
||||
//so until it's fixed we reuse share one instance
|
||||
//TODO: make it so we can have more than one shown at the same time
|
||||
public static RootDesignerView instance = null;
|
||||
|
||||
public static RootDesignerView GetInstance (IDesignerHost host)
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new RootDesignerView (host);
|
||||
instance.active = false;
|
||||
return instance;
|
||||
private IMenuCommandService menuService;
|
||||
protected bool active = false;
|
||||
private string outDocument = null;
|
||||
|
||||
|
||||
//there's weird bug where a second Gecko instance *can't* be created
|
||||
//so until it's fixed we reuse share one instance
|
||||
//TODO: make it so we can have more than one shown at the same time
|
||||
public static RootDesignerView instance = null;
|
||||
|
||||
public static RootDesignerView GetInstance (IDesignerHost host)
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new RootDesignerView (host);
|
||||
instance.active = false;
|
||||
return instance;
|
||||
}
|
||||
|
||||
private RootDesignerView (IDesignerHost host)
|
||||
|
@ -97,176 +97,176 @@ namespace AspNetEdit.Editor.UI
|
|||
selectionService.SelectionChanged += new EventHandler (selectionService_SelectionChanged);
|
||||
|
||||
//Register incoming calls from JavaScript
|
||||
comm.RegisterJSHandler ("Click", new ClrCall (JSClick));
|
||||
comm.RegisterJSHandler ("Activate", new ClrCall (JSActivate));
|
||||
comm.RegisterJSHandler ("ThrowException", new ClrCall (JSException));
|
||||
comm.RegisterJSHandler ("DebugStatement", new ClrCall (JSDebugStatement));
|
||||
comm.RegisterJSHandler ("ResizeControl", new ClrCall (JSResize));
|
||||
comm.RegisterJSHandler ("DocumentReturn", new ClrCall (JSDocumentReturn));
|
||||
comm.RegisterJSHandler ("RemoveControl", new ClrCall (JSRemoveControl));
|
||||
comm.RegisterJSHandler ("DeserializeAndAdd", new ClrCall (JSDeserializeAndAdd));
|
||||
comm.RegisterJSHandler ("Click", new ClrCall (JSClick));
|
||||
comm.RegisterJSHandler ("Activate", new ClrCall (JSActivate));
|
||||
comm.RegisterJSHandler ("ThrowException", new ClrCall (JSException));
|
||||
comm.RegisterJSHandler ("DebugStatement", new ClrCall (JSDebugStatement));
|
||||
comm.RegisterJSHandler ("ResizeControl", new ClrCall (JSResize));
|
||||
comm.RegisterJSHandler ("DocumentReturn", new ClrCall (JSDocumentReturn));
|
||||
comm.RegisterJSHandler ("RemoveControl", new ClrCall (JSRemoveControl));
|
||||
comm.RegisterJSHandler ("DeserializeAndAdd", new ClrCall (JSDeserializeAndAdd));
|
||||
comm.RegisterJSHandler ("Serialize", new ClrCall (JSSerialize));
|
||||
System.Diagnostics.Trace.WriteLine ("RootDesignerView created");
|
||||
}
|
||||
|
||||
internal void BeginLoad ()
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("Loading XUL...");
|
||||
base.LoadUrl (geckoChrome);
|
||||
}
|
||||
|
||||
public override void Destroy ()
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("RootDesignerView internally destroyed.");
|
||||
active = false;
|
||||
base.Destroy ();
|
||||
}
|
||||
|
||||
internal void BeginLoad ()
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("Loading XUL...");
|
||||
base.LoadUrl (geckoChrome);
|
||||
}
|
||||
|
||||
public override void Destroy ()
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("RootDesignerView internally destroyed.");
|
||||
active = false;
|
||||
base.Destroy ();
|
||||
}
|
||||
|
||||
#region Change service handlers
|
||||
|
||||
void selectionService_SelectionChanged (object sender, EventArgs e)
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
//deselect all
|
||||
comm.JSCall (GeckoFunctions.SelectControl, null, string.Empty);
|
||||
if (selectionService.SelectionCount == 0) return;
|
||||
|
||||
ICollection selections = selectionService.GetSelectedComponents ();
|
||||
|
||||
foreach (IComponent comp in selections) {
|
||||
if (comp is WebFormPage) continue;
|
||||
Control control = comp as Control;
|
||||
if (control == null)
|
||||
throw new InvalidOperationException ("One of the selected components is not a System.Web.UI.Control.");
|
||||
//select the control
|
||||
comm.JSCall (GeckoFunctions.SelectControl, null, control.UniqueID);
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
//deselect all
|
||||
comm.JSCall (GeckoFunctions.SelectControl, null, string.Empty);
|
||||
if (selectionService.SelectionCount == 0) return;
|
||||
|
||||
ICollection selections = selectionService.GetSelectedComponents ();
|
||||
|
||||
foreach (IComponent comp in selections) {
|
||||
if (comp is WebFormPage) continue;
|
||||
Control control = comp as Control;
|
||||
if (control == null)
|
||||
throw new InvalidOperationException ("One of the selected components is not a System.Web.UI.Control.");
|
||||
//select the control
|
||||
comm.JSCall (GeckoFunctions.SelectControl, null, control.UniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
void changeService_ComponentChanged (object sender, ComponentChangedEventArgs e)
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
Control control = e.Component as Control;
|
||||
if (control == null)
|
||||
throw new InvalidOperationException ("The changed component is not a System.UI.WebControl");
|
||||
|
||||
string ctext = Document.RenderDesignerControl (control);
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
Control control = e.Component as Control;
|
||||
if (control == null)
|
||||
throw new InvalidOperationException ("The changed component is not a System.UI.WebControl");
|
||||
|
||||
string ctext = Document.RenderDesignerControl (control);
|
||||
comm.JSCall (GeckoFunctions.UpdateControl, null, control.UniqueID, ctext);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region document modification accessors for AspNetEdit.Editor.ComponentModel.Document
|
||||
|
||||
internal void InsertFragment (string fragment)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("Inserting document fragment: " + fragment);
|
||||
comm.JSCall (GeckoFunctions.InsertFragment, null, host.RootDocument.Serialize (fragment));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region document modification accessors for AspNetEdit.Editor.ComponentModel.Document
|
||||
|
||||
internal void InsertFragment (string fragment)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("Inserting document fragment: " + fragment);
|
||||
comm.JSCall (GeckoFunctions.InsertFragment, null, host.RootDocument.Serialize (fragment));
|
||||
}
|
||||
|
||||
internal void AddControl (Control control)
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
string ctext = Document.RenderDesignerControl (control);
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
string ctext = Document.RenderDesignerControl (control);
|
||||
comm.JSCall (GeckoFunctions.AddControl, null, control.UniqueID, ctext);
|
||||
}
|
||||
|
||||
internal void RemoveControl (Control control)
|
||||
{
|
||||
if (!active) return;
|
||||
{
|
||||
if (!active) return;
|
||||
|
||||
comm.JSCall (GeckoFunctions.RemoveControl, null, control.UniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenameControl (string oldName, string newName)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
internal string GetDocument ()
|
||||
{
|
||||
comm.JSCall (GeckoFunctions.GetPage, "DocumentReturn", null);
|
||||
|
||||
int counter = 0;
|
||||
do {
|
||||
//only allow JS 5 seconds to return value
|
||||
if (counter > 50) throw new Exception ("Mozilla did not return value during 5 seconds");
|
||||
|
||||
System.Threading.Thread.Sleep (100);
|
||||
counter++;
|
||||
}
|
||||
while (outDocument == null);
|
||||
System.Diagnostics.Trace.WriteLine ("Retrieved document from Gecko in ~" + (100*counter).ToString () + "ms.");
|
||||
System.Diagnostics.Trace.WriteLine ("Document: " + outDocument);
|
||||
|
||||
string d = outDocument;
|
||||
outDocument = null;
|
||||
return d;
|
||||
}
|
||||
|
||||
internal void DoCommand (string editorCommand)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ( "Executing command \"" + editorCommand +"\"");
|
||||
comm.JSCall (GeckoFunctions.DoCommand, null, editorCommand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal string GetDocument ()
|
||||
{
|
||||
comm.JSCall (GeckoFunctions.GetPage, "DocumentReturn", null);
|
||||
|
||||
int counter = 0;
|
||||
do {
|
||||
//only allow JS 5 seconds to return value
|
||||
if (counter > 50) throw new Exception ("Mozilla did not return value during 5 seconds");
|
||||
|
||||
System.Threading.Thread.Sleep (100);
|
||||
counter++;
|
||||
}
|
||||
while (outDocument == null);
|
||||
System.Diagnostics.Trace.WriteLine ("Retrieved document from Gecko in ~" + (100*counter).ToString () + "ms.");
|
||||
System.Diagnostics.Trace.WriteLine ("Document: " + outDocument);
|
||||
|
||||
string d = outDocument;
|
||||
outDocument = null;
|
||||
return d;
|
||||
}
|
||||
|
||||
internal void DoCommand (string editorCommand)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ( "Executing command \"" + editorCommand +"\"");
|
||||
comm.JSCall (GeckoFunctions.DoCommand, null, editorCommand);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inbound Gecko functions
|
||||
|
||||
|
||||
#region Inbound Gecko functions
|
||||
|
||||
|
||||
///<summary>
|
||||
/// Name: DocumentReturn
|
||||
/// Name: DocumentReturn
|
||||
/// Callback function for when host initiates document save
|
||||
/// Arguments:
|
||||
/// string document: the document text, with placeholder'd controls
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSDocumentReturn (string[] args)
|
||||
{
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSDocumentReturn (string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("DocumentReturn", -1);
|
||||
outDocument = args [0];
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
//this is because of the Gecko# not wanting to give up its DomDocument until it's been shown.
|
||||
throw new InvalidJSArgumentException ("DocumentReturn", -1);
|
||||
outDocument = args [0];
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
//this is because of the Gecko# not wanting to give up its DomDocument until it's been shown.
|
||||
///<summary>
|
||||
/// Name: Activate
|
||||
/// Name: Activate
|
||||
/// Called when the XUL document is all loaded and ready to recieve ASP.NET document
|
||||
/// Arguments: none
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSActivate (string[] args)
|
||||
{
|
||||
if (active) {
|
||||
System.Diagnostics.Trace.WriteLine ("HELP! XUL reports having been initialised again! Suppressing, but need to be fixed.");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
System.Diagnostics.Trace.WriteLine ("XUL loaded.");
|
||||
//load document with filled-in design-time HTML
|
||||
string doc = host.RootDocument.GetLoadedDocument ();
|
||||
comm.JSCall (GeckoFunctions.LoadPage, null, doc);
|
||||
active = true;
|
||||
return string.Empty;
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSActivate (string[] args)
|
||||
{
|
||||
if (active) {
|
||||
System.Diagnostics.Trace.WriteLine ("HELP! XUL reports having been initialised again! Suppressing, but need to be fixed.");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
System.Diagnostics.Trace.WriteLine ("XUL loaded.");
|
||||
//load document with filled-in design-time HTML
|
||||
string doc = host.RootDocument.GetLoadedDocument ();
|
||||
comm.JSCall (GeckoFunctions.LoadPage, null, doc);
|
||||
active = true;
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
/// Name: Click
|
||||
/// Name: Click
|
||||
/// Called when the document is clicked
|
||||
/// Arguments:
|
||||
/// Arguments:
|
||||
/// enum ClickType: The button used to click (Single|Double|Right)
|
||||
/// string Component: The unique ID if a Control, else empty
|
||||
/// Returns: none
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSClick (string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
throw new InvalidJSArgumentException ("Click", -1);
|
||||
throw new InvalidJSArgumentException ("Click", -1);
|
||||
|
||||
//look up our component
|
||||
IComponent[] components = null;
|
||||
|
@ -278,9 +278,9 @@ namespace AspNetEdit.Editor.UI
|
|||
case "Single":
|
||||
selectionService.SetSelectedComponents (components);
|
||||
break;
|
||||
case "Double":
|
||||
//TODO: what happen when we double-click on the page?
|
||||
if (args[1].Length == 0) break;
|
||||
case "Double":
|
||||
//TODO: what happen when we double-click on the page?
|
||||
if (args[1].Length == 0) break;
|
||||
|
||||
IDesigner designer = host.GetDesigner (components[0]);
|
||||
|
||||
|
@ -289,254 +289,254 @@ namespace AspNetEdit.Editor.UI
|
|||
break;
|
||||
case "Right":
|
||||
//TODO: show context menu menuService.ShowContextMenu
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
throw new InvalidJSArgumentException("Click", 0);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: ThrowException
|
||||
/// Name: ThrowException
|
||||
/// Throws managed exceptions on behalf of Javascript
|
||||
/// Arguments:
|
||||
/// Arguments:
|
||||
/// string location: some description of where the error occurred
|
||||
/// string message: the exception's message
|
||||
/// Returns: none
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSException (string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
if (args.Length != 2)
|
||||
throw new InvalidJSArgumentException ("ThrowException", -1);
|
||||
|
||||
|
||||
throw new Exception (string.Format ("Error in javascript at {0}:\n{1}", args[0], args[1]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: DebugStatement
|
||||
/// Name: DebugStatement
|
||||
/// Writes to the console on behalf of Javascript
|
||||
/// Arguments:
|
||||
/// string message: the debug message
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSDebugStatement (string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("ThrowException", -1);
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("ThrowException", -1);
|
||||
|
||||
System.Diagnostics.Trace.WriteLine ("Javascript: " + args[0]);
|
||||
System.Diagnostics.Trace.WriteLine ("Javascript: " + args[0]);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: ResizeControl
|
||||
/// Name: ResizeControl
|
||||
/// Writes to the console on behalf of Javascript
|
||||
/// Arguments:
|
||||
/// string id: the control's ID
|
||||
/// string width: the control's width
|
||||
/// string id: the control's ID
|
||||
/// string width: the control's width
|
||||
/// string height: the control's height
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSResize (string[] args)
|
||||
{
|
||||
if (args.Length != 3)
|
||||
throw new InvalidJSArgumentException ("ResizeControl", -1);
|
||||
|
||||
throw new InvalidJSArgumentException ("ResizeControl", -1);
|
||||
|
||||
//look up our component
|
||||
IComponent component = ((DesignContainer) host.Container).GetComponent (args[0]);
|
||||
System.Web.UI.WebControls.WebControl wc = component as System.Web.UI.WebControls.WebControl;
|
||||
if (wc == null)
|
||||
throw new InvalidJSArgumentException ("ResizeControl", 0);
|
||||
|
||||
PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties (wc);
|
||||
PropertyDescriptor pdc_h = pdc.Find("Height", false);
|
||||
PropertyDescriptor pdc_w = pdc.Find("Width", false);
|
||||
|
||||
//set the values
|
||||
pdc_w.SetValue (wc, pdc_w.Converter.ConvertFromInvariantString(args[1]));
|
||||
pdc_h.SetValue (wc, pdc_h.Converter.ConvertFromInvariantString(args[2]));
|
||||
|
||||
IComponent component = ((DesignContainer) host.Container).GetComponent (args[0]);
|
||||
System.Web.UI.WebControls.WebControl wc = component as System.Web.UI.WebControls.WebControl;
|
||||
if (wc == null)
|
||||
throw new InvalidJSArgumentException ("ResizeControl", 0);
|
||||
|
||||
PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties (wc);
|
||||
PropertyDescriptor pdc_h = pdc.Find("Height", false);
|
||||
PropertyDescriptor pdc_w = pdc.Find("Width", false);
|
||||
|
||||
//set the values
|
||||
pdc_w.SetValue (wc, pdc_w.Converter.ConvertFromInvariantString(args[1]));
|
||||
pdc_h.SetValue (wc, pdc_h.Converter.ConvertFromInvariantString(args[2]));
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: RemoveControl
|
||||
/// Name: RemoveControl
|
||||
/// Removes a control from the host when its Gecko representation is removed
|
||||
/// Arguments:
|
||||
/// string id: the control's ID
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
private string JSRemoveControl (string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("RemoveControl", -1);
|
||||
|
||||
//look up our component
|
||||
throw new InvalidJSArgumentException ("RemoveControl", -1);
|
||||
|
||||
//look up our component
|
||||
DesignContainer container = (DesignContainer) host.Container;
|
||||
IComponent component = container.GetComponent (args[0]);
|
||||
if (component == null)
|
||||
throw new InvalidJSArgumentException ("RemoveControl", 0);
|
||||
|
||||
//and remove it
|
||||
System.Diagnostics.Trace.WriteLine ("Removing control: " + args[0]);
|
||||
container.Remove (component);
|
||||
component.Dispose ();
|
||||
|
||||
IComponent component = container.GetComponent (args[0]);
|
||||
if (component == null)
|
||||
throw new InvalidJSArgumentException ("RemoveControl", 0);
|
||||
|
||||
//and remove it
|
||||
System.Diagnostics.Trace.WriteLine ("Removing control: " + args[0]);
|
||||
container.Remove (component);
|
||||
component.Dispose ();
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: Serialize
|
||||
/// Name: Serialize
|
||||
/// Serialises a fragment of a Gecko document into ASP.NET code
|
||||
/// Arguments:
|
||||
/// string designerDocumentFragment: the Gecko document fragment
|
||||
/// Returns: the serialised document
|
||||
///</summary>
|
||||
/// Returns: the serialised document
|
||||
///</summary>
|
||||
private string JSSerialize (string[] args)
|
||||
{
|
||||
{
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("Serialize", -1);
|
||||
|
||||
|
||||
return host.RootDocument.Serialize (args [0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Name: DeserializeAndAdd
|
||||
/// Deserialises a fragment of ASP.NET code into a Gecko designer document fragment
|
||||
/// Name: DeserializeAndAdd
|
||||
/// Deserialises a fragment of ASP.NET code into a Gecko designer document fragment
|
||||
/// and adds the controls, directives etc to the host.
|
||||
/// Arguments:
|
||||
/// string designerDocumentFragment: the ASP.NET document fragment
|
||||
/// Returns: the deserialised document
|
||||
///</summary>
|
||||
/// Returns: the deserialised document
|
||||
///</summary>
|
||||
private string JSDeserializeAndAdd (string[] args)
|
||||
{
|
||||
{
|
||||
if (args.Length != 1)
|
||||
throw new InvalidJSArgumentException ("DeserializeAndAdd", -1);
|
||||
|
||||
|
||||
return host.RootDocument.DeserializeAndAdd (args [0]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Outbound Gecko functions
|
||||
|
||||
private class GeckoFunctions
|
||||
{
|
||||
///<summary>
|
||||
/// Add a control to the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// string content: The HTML content of the control
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string AddControl = "AddControl";
|
||||
|
||||
///<summary>
|
||||
/// Updates the design-time HTML of a control to the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// string content: The HTML content of the control
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string UpdateControl = "UpdateControl";
|
||||
|
||||
///<summary>
|
||||
/// Removes a control from the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string RemoveControl = "RemoveControl";
|
||||
|
||||
///<summary>
|
||||
/// Selects a control
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control, or empty to clear selection.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string SelectControl = "SelectControl";
|
||||
|
||||
///<summary>
|
||||
/// Replaces the currently loaded document
|
||||
/// Args:
|
||||
/// string document: the document text, with placeholder'd controls.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string LoadPage = "LoadPage";
|
||||
|
||||
///<summary>
|
||||
/// Replaces the currently loaded document
|
||||
/// Args: none
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string GetPage = "GetPage";
|
||||
|
||||
///<summary>
|
||||
/// Passes a simple command to Gecko
|
||||
/// Args:
|
||||
/// string command: Use the enum EditorCommand
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string DoCommand = "DoCommand";
|
||||
|
||||
///<summary>
|
||||
/// Inserts a document fragment. Host should have deserialised it.
|
||||
/// Args:
|
||||
/// string fragment: The document fragment
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string InsertFragment = "InsertFragment";
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
//TODO: GetCommandState to check whether we can perform these commands
|
||||
|
||||
//commands for DoCommand
|
||||
//simply triggers functionality in Mozilla editor
|
||||
public class EditorCommand
|
||||
{
|
||||
//clipboard
|
||||
public static readonly string Cut = "cmd_cut";
|
||||
public static readonly string Copy = "cmd_copy";
|
||||
public static readonly string Paste = "cmd_paste";
|
||||
public static readonly string Delete = "cmd_delete";
|
||||
|
||||
//transactions
|
||||
public static readonly string Undo = "cmd_undo";
|
||||
public static readonly string Redo = "cmd_redo";
|
||||
|
||||
//styles
|
||||
public static readonly string Bold = "cmd_bold";
|
||||
public static readonly string Italic = "cmd_italic";
|
||||
public static readonly string Underline = "cmd_underline";
|
||||
public static readonly string TeleType = "cmd_tt";
|
||||
public static readonly string Strikethrough = "cmd_strikethru";
|
||||
public static readonly string Superscript = "cmd_superscript";
|
||||
public static readonly string Subscript = "cmd_subscript";
|
||||
public static readonly string Indent = "cmd_indent";
|
||||
public static readonly string Outdent = "cmd_outdent";
|
||||
public static readonly string IncreaseFont = "cmd_increaseFont";
|
||||
public static readonly string DecreaseFont = "cmd_decreaseFont";
|
||||
|
||||
//semantic
|
||||
public static readonly string Emphasis = "cmd_em";
|
||||
public static readonly string Strong = "cmd_strong";
|
||||
public static readonly string Citation = "cmd_cite";
|
||||
public static readonly string Abbreviation = "cmd_abbr";
|
||||
public static readonly string Acronym = "cmd_acronym";
|
||||
public static readonly string Code = "cmd_code";
|
||||
|
||||
//lists
|
||||
public static readonly string OrderedList = "cmd_ol";
|
||||
public static readonly string UnorderedList = "cmd_ul";
|
||||
|
||||
//public static readonly string NoBreak = "cmd_nobreak";
|
||||
//public static readonly string Underline = "cmd_dt";
|
||||
//public static readonly string Underline = "cmd_dd";
|
||||
|
||||
#region Outbound Gecko functions
|
||||
|
||||
private class GeckoFunctions
|
||||
{
|
||||
///<summary>
|
||||
/// Add a control to the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// string content: The HTML content of the control
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string AddControl = "AddControl";
|
||||
|
||||
///<summary>
|
||||
/// Updates the design-time HTML of a control to the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// string content: The HTML content of the control
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string UpdateControl = "UpdateControl";
|
||||
|
||||
///<summary>
|
||||
/// Removes a control from the document
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string RemoveControl = "RemoveControl";
|
||||
|
||||
///<summary>
|
||||
/// Selects a control
|
||||
/// Args:
|
||||
/// string id: the unique ID of the control, or empty to clear selection.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string SelectControl = "SelectControl";
|
||||
|
||||
///<summary>
|
||||
/// Replaces the currently loaded document
|
||||
/// Args:
|
||||
/// string document: the document text, with placeholder'd controls.
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string LoadPage = "LoadPage";
|
||||
|
||||
///<summary>
|
||||
/// Replaces the currently loaded document
|
||||
/// Args: none
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string GetPage = "GetPage";
|
||||
|
||||
///<summary>
|
||||
/// Passes a simple command to Gecko
|
||||
/// Args:
|
||||
/// string command: Use the enum EditorCommand
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string DoCommand = "DoCommand";
|
||||
|
||||
///<summary>
|
||||
/// Inserts a document fragment. Host should have deserialised it.
|
||||
/// Args:
|
||||
/// string fragment: The document fragment
|
||||
/// Returns: none
|
||||
///</summary>
|
||||
public static readonly string InsertFragment = "InsertFragment";
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
//TODO: GetCommandState to check whether we can perform these commands
|
||||
|
||||
//commands for DoCommand
|
||||
//simply triggers functionality in Mozilla editor
|
||||
public class EditorCommand
|
||||
{
|
||||
//clipboard
|
||||
public static readonly string Cut = "cmd_cut";
|
||||
public static readonly string Copy = "cmd_copy";
|
||||
public static readonly string Paste = "cmd_paste";
|
||||
public static readonly string Delete = "cmd_delete";
|
||||
|
||||
//transactions
|
||||
public static readonly string Undo = "cmd_undo";
|
||||
public static readonly string Redo = "cmd_redo";
|
||||
|
||||
//styles
|
||||
public static readonly string Bold = "cmd_bold";
|
||||
public static readonly string Italic = "cmd_italic";
|
||||
public static readonly string Underline = "cmd_underline";
|
||||
public static readonly string TeleType = "cmd_tt";
|
||||
public static readonly string Strikethrough = "cmd_strikethru";
|
||||
public static readonly string Superscript = "cmd_superscript";
|
||||
public static readonly string Subscript = "cmd_subscript";
|
||||
public static readonly string Indent = "cmd_indent";
|
||||
public static readonly string Outdent = "cmd_outdent";
|
||||
public static readonly string IncreaseFont = "cmd_increaseFont";
|
||||
public static readonly string DecreaseFont = "cmd_decreaseFont";
|
||||
|
||||
//semantic
|
||||
public static readonly string Emphasis = "cmd_em";
|
||||
public static readonly string Strong = "cmd_strong";
|
||||
public static readonly string Citation = "cmd_cite";
|
||||
public static readonly string Abbreviation = "cmd_abbr";
|
||||
public static readonly string Acronym = "cmd_acronym";
|
||||
public static readonly string Code = "cmd_code";
|
||||
|
||||
//lists
|
||||
public static readonly string OrderedList = "cmd_ol";
|
||||
public static readonly string UnorderedList = "cmd_ul";
|
||||
|
||||
//public static readonly string NoBreak = "cmd_nobreak";
|
||||
//public static readonly string Underline = "cmd_dt";
|
||||
//public static readonly string Underline = "cmd_dd";
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче