Exemplo n.º 1
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="refObj">master page to copy from</param>
 private MasterPage(MasterPage refObj)
 {
     this.ConstraintWidth    = refObj.ConstraintWidth;
     this.ConstraintHeight   = refObj.ConstraintHeight;
     this.IsCSSOnFile        = refObj.IsCSSOnFile;
     this.CSSFileName        = ExtensionMethods.CloneThis(refObj.CSSFileName);
     this.IsJavaScriptOnFile = refObj.IsJavaScriptOnFile;
     this.JavaScriptFileName = ExtensionMethods.CloneThis(refObj.JavaScriptFileName);
     this.Width        = refObj.Width;
     this.Height       = refObj.Height;
     this.CountLines   = refObj.CountLines;
     this.CountColumns = refObj.CountColumns;
     this.Name         = ExtensionMethods.CloneThis(refObj.Name);
     foreach (HTMLObject obj in refObj.Objects)
     {
         this.Objects.Add(obj.Clone() as HTMLObject);
     }
     foreach (HorizontalZone hz in refObj.HorizontalZones)
     {
         this.HorizontalZones.Add(hz.Clone() as HorizontalZone);
     }
     this.Set(eventsName, refObj.Events.Clone());
     this.Set(javascriptName, refObj.JavaScript.Clone());
     this.Set(javascriptOnloadName, refObj.JavaScriptOnLoad.Clone());
     this.Set(cssListName, refObj.CSSList.Clone());
     this.Meta = ExtensionMethods.CloneThis(refObj.Meta);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="r">ref object to copy</param>
 private RefObject(RefObject r)
 {
     this.Set(objectTypeName, ExtensionMethods.CloneThis(r.Type));
     this.Set(titleName, ExtensionMethods.CloneThis(r.Title));
     // this element is not cloned, use a reference
     this.Set(directObjectName, r.DirectObject);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Copy constructor
        /// </summary>
        /// <param name="obj">object to copy</param>
        private HTMLObject(HTMLObject obj)
        {
            int val = Project.CurrentProject.IncrementedCounter;

            this.Set(automaticNameName, String.Format("object{0}", val));
            this.Set(automaticIdName, String.Format("idObject{0}", val));

            this.Set(toolName, ExtensionMethods.CloneThis(obj.ToolFullPath));
            this.Set(masterObjectName, ExtensionMethods.CloneThis(obj.MasterObjectName));
            this.Width            = obj.Width;
            this.Height           = obj.Height;
            this.ConstraintWidth  = obj.ConstraintWidth;
            this.ConstraintHeight = obj.ConstraintHeight;
            this.Title            = ExtensionMethods.CloneThis(obj.Title);
            this.Container        = ExtensionMethods.CloneThis(obj.Container);
            this.HTML             = ExtensionMethods.CloneThis(obj.HTML);
            this.Set(eventsName, obj.Events.Clone());
            this.Set(javascriptName, obj.JavaScript.Clone());
            this.Set(javascriptOnloadName, obj.JavaScriptOnLoad.Clone());
            this.Set(cssListName, new CSSList((from CodeCSS c in this.CSSList.List select c.Clone() as CodeCSS).ToList()));
            this.CSSList.RenamePrincipalCSS(obj.Id, this.Id);
            this.Set(attributesName, obj.Attributes.Clone());
            this.Attributes.RenameId(this.Id);
            this.Attributes.HasId = false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Default constructor
        /// Create an HTML object that hosts an instance of a tool
        /// </summary>
        /// <param name="htmlTool">HTML Tool import</param>
        public HTMLObject(HTMLTool htmlTool)
        {
            int val = Project.CurrentProject.IncrementedCounter;

            this.Set(automaticNameName, String.Format("object{0}", val));
            this.Set(automaticIdName, String.Format("idObject{0}", val));

            this.Set(masterObjectName, "");
            this.Set(toolName, htmlTool.Path + "/" + htmlTool.Title);
            this.Width            = htmlTool.Width;
            this.Height           = htmlTool.Height;
            this.ConstraintWidth  = htmlTool.ConstraintWidth;
            this.ConstraintHeight = htmlTool.ConstraintHeight;
            this.Title            = ExtensionMethods.CloneThis(htmlTool.Title);
            this.HTML             = htmlTool.HTML;
            this.Set(eventsName, htmlTool.Events.Clone());
            this.Set(javascriptName, htmlTool.JavaScript.Clone());
            this.Set(javascriptOnloadName, htmlTool.JavaScriptOnLoad.Clone());
            this.Set(cssListName, new CSSList(htmlTool.CSSList.List));
            // rename the principal css element
            this.CSSList.RenamePrincipalCSS(htmlTool.Id, this.Id);
            this.Set(attributesName, htmlTool.Attributes.Clone());
            this.Attributes.RenameId(this.Id);
            this.Attributes.HasId = false;
        }
        /// <summary>
        /// Clone this object
        /// </summary>
        /// <returns>cloned object</returns>
        public object Clone()
        {
            CodeJavaScript cj = new CodeJavaScript();

            cj.Code = ExtensionMethods.CloneThis(this.Code);
            return(cj);
        }
Exemplo n.º 6
0
 private FolderTool(FolderTool ft)
 {
     this.name = ExtensionMethods.CloneThis(ft.name);
     this.path = ExtensionMethods.CloneThis(ft.path);
     foreach (FolderTool subFolder in ft.folders)
     {
         this.folders.Add(subFolder.Clone() as FolderTool);
     }
     foreach (HTMLTool tool in ft.tools)
     {
         this.tools.Add(tool.Clone() as HTMLTool);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="refp">input page</param>
 private Page(Page refp)
 {
     this.Disposition      = refp.Disposition;
     this.ConstraintWidth  = refp.ConstraintWidth;
     this.ConstraintHeight = refp.ConstraintHeight;
     this.Name             = ExtensionMethods.CloneThis(refp.Name);
     this.MasterPageName   = ExtensionMethods.CloneThis(refp.MasterPageName);
     this.Width            = refp.Width;
     this.Height           = refp.Height;
     this.Set(eventsName, refp.Events.Clone());
     foreach (HTMLObject obj in refp.Objects)
     {
         this.Objects.Add(obj.Clone() as HTMLObject);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="gs">generated sculpture to copy</param>
 private GeneratedSculpture(GeneratedSculpture gs)
 {
     this.Type         = ExtensionMethods.CloneThis(gs.Type);
     this.Name         = ExtensionMethods.CloneThis(gs.Name);
     this.SecondObject = ExtensionMethods.CloneThis(gs.SecondObject);
     this.Destination  = ExtensionMethods.CloneThis(gs.Destination);
     foreach (RefObject r in gs.Objects)
     {
         this.Objects.Add(r.Clone() as RefObject);
     }
     foreach (CadreModel cm in gs.RemainerModels)
     {
         this.RemainerModels.Add(cm.Clone() as CadreModel);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="obj">object source to copy</param>
 private SculptureObject(SculptureObject obj)
 {
     this.Title = ExtensionMethods.CloneThis(obj.Title);
     foreach (CadreModel cm in obj.Cadres)
     {
         this.Cadres.Add(cm.Clone() as CadreModel);
     }
     foreach (GeneratedSculpture gs in obj.Generated)
     {
         this.Generated.Add(gs.Clone() as GeneratedSculpture);
     }
     foreach (DistanceCadreModel d in obj.Distances)
     {
         this.Distances.Add(d.Clone() as DistanceCadreModel);
     }
 }
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="code">css source</param>
 public CodeCSS(CodeCSS code)
 {
     this.Ids = ExtensionMethods.CloneThis(code.Ids);
     this.BackgroundImageURL = ExtensionMethods.CloneThis(code.BackgroundImageURL);
     this.BackgroundColor    = ExtensionMethods.CloneThis(code.BackgroundColor);
     this.BorderLeftColor    = ExtensionMethods.CloneThis(code.BorderLeftColor);
     this.BorderRightColor   = ExtensionMethods.CloneThis(code.BorderRightColor);
     this.BorderTopColor     = ExtensionMethods.CloneThis(code.BorderTopColor);
     this.BorderBottomColor  = ExtensionMethods.CloneThis(code.BorderBottomColor);
     this.ForegroundColor    = ExtensionMethods.CloneThis(code.ForegroundColor);
     this.Padding            = ExtensionMethods.CloneThis(code.Padding);
     this.Margin             = ExtensionMethods.CloneThis(code.Margin);
     this.Border             = ExtensionMethods.CloneThis(code.Border);
     foreach (string key in code.Body.AllKeys)
     {
         this.Body.Add(key, code.Body[key]);
     }
 }
 /// <summary>
 /// Copy constructor (object reference is already used to set ancestor)
 /// </summary>
 private Folder(string name, List <Folder> subFolders, List <Page> pages, List <string> files, Folder ancestor)
 {
     this.name = ExtensionMethods.CloneThis(name);
     foreach (Folder subFolder in subFolders)
     {
         Folder newFolder = new Folder(subFolder.name, subFolder.folders, subFolder.pages, subFolder.files, this);
         this.folders.Add(newFolder);
     }
     foreach (Page p in pages)
     {
         this.pages.Add(p.Clone() as Page);
     }
     foreach (string s in files)
     {
         this.files.Add(s.Clone() as string);
     }
     this.folder = ancestor;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Clone this object
        /// </summary>
        /// <returns>cloned object</returns>
        public object Clone()
        {
            HTMLTool tool = new HTMLTool();

            tool.ConstraintWidth  = this.ConstraintWidth;
            tool.ConstraintHeight = this.ConstraintHeight;
            tool.Width            = this.Width;
            tool.Height           = this.Height;
            tool.Title            = ExtensionMethods.CloneThis(this.Title);
            tool.Path             = ExtensionMethods.CloneThis(this.Path);
            tool.HTML             = ExtensionMethods.CloneThis(this.HTML);
            tool.Set(eventsName, this.Events.Clone());
            tool.Set(javascriptName, this.JavaScript.Clone());
            tool.Set(javascriptOnloadName, this.JavaScriptOnLoad.Clone());
            tool.CSSList.List.AddRange(from CodeCSS c in this.CSSList.List select c.Clone() as CodeCSS);
            tool.CSSList.RenamePrincipalCSS(this.Id, tool.Id);
            tool.Set(attributesName, this.Attributes.Clone());
            tool.Attributes.RenameId(tool.Id);
            tool.Attributes.HasId = false;
            return(tool);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Constructor for a master object
        /// </summary>
        /// <param name="masterObject">master object to use</param>
        public HTMLObject(MasterObject masterObject)
        {
            int val = Project.CurrentProject.IncrementedCounter;

            this.Set(automaticNameName, String.Format("object{0}", val));
            this.Set(automaticIdName, String.Format("idObject{0}", val));

            this.Set(masterObjectName, masterObject.Name);
            this.Width            = masterObject.Width;
            this.Height           = masterObject.Height;
            this.ConstraintWidth  = masterObject.ConstraintWidth;
            this.ConstraintHeight = masterObject.ConstraintHeight;
            this.Title            = ExtensionMethods.CloneThis(masterObject.Title);
            this.Set(eventsName, masterObject.Events.Clone());
            this.Set(javascriptName, masterObject.JavaScript.Clone());
            this.Set(javascriptOnloadName, masterObject.JavaScriptOnLoad.Clone());
            this.Set(cssListName, new CSSList((from CodeCSS c in masterObject.CSSList.List select c.Clone() as CodeCSS).ToList()));
            this.CSSList.RenamePrincipalCSS(masterObject.Id, this.Id);
            this.Set(attributesName, masterObject.Attributes.Clone());
            this.Attributes.RenameId(this.Id);
            this.Attributes.HasId = false;
        }
Exemplo n.º 14
0
        /// <summary>
        /// A master page has a thumbnail visual
        /// </summary>
        /// <returns>html output</returns>
        public OutputHTML GenerateThumbnail()
        {
            Page page = new Page();

            if (this.ConstraintWidth == EnumConstraint.RELATIVE || this.ConstraintHeight == EnumConstraint.RELATIVE)
            {
                DesignPage config = new DesignPage();
                config.constraintWidth  = this.ConstraintWidth;
                config.constraintHeight = this.ConstraintHeight;
                config.width            = this.Width;
                config.height           = this.Height;
                CodeCSS cssThumbnail = new CodeCSS(this.CSS);
                cssThumbnail.Body.Add("zoom", "0.4");
                config.cssList          = ExtensionMethods.CloneThis(this.CSSList);
                config.cssOnFile        = false;
                config.cssFile          = "";
                config.events           = this.Events;
                config.javascriptPart   = this.JavaScript;
                config.javascriptOnFile = false;
                config.javascriptFile   = "";
                config.onload           = this.JavaScriptOnLoad;
                config.zones            = this.HorizontalZones;
                config.includeContainer = false;
                return(Routines.GenerateDesignPageTable(page, this, config));
            }
            else
            {
                // il faut décider si l'on utilise une table ou des div
                // s'il existe une colonne dont countLines > countLines de l'horizontal alors on utilise une table
                // sinon on peut utiliser des div
                bool cannotUseDiv = false;
                foreach (HorizontalZone hz in this.HorizontalZones)
                {
                    bool sup = false;
                    foreach (VerticalZone vz in hz.VerticalZones)
                    {
                        if (vz.CountLines < hz.CountLines)
                        {
                            sup = true;
                        }
                    }
                    if (sup)
                    {
                        cannotUseDiv = true;
                        break;
                    }
                }
                OutputHTML html;
                DesignPage config = new DesignPage();
                config.constraintWidth  = this.ConstraintWidth;
                config.constraintHeight = this.ConstraintHeight;
                config.width            = this.Width;
                config.height           = this.Height;
                CodeCSS cssThumbnail = new CodeCSS(this.CSS);
                cssThumbnail.Body.Add("zoom", "0.4");
                this.CSSList.AddCSS(cssThumbnail);
                config.cssList          = this.CSSList;
                config.cssOnFile        = false;
                config.cssFile          = "";
                config.events           = this.Events;
                config.javascriptPart   = this.JavaScript;
                config.javascriptOnFile = false;
                config.javascriptFile   = "";
                config.onload           = this.JavaScriptOnLoad;
                config.zones            = this.HorizontalZones;
                config.includeContainer = false;
                if (cannotUseDiv)
                {
                    html = Routines.GenerateDesignPageTable(page, this, config);
                }
                else
                {
                    html = Routines.GenerateDesignPageDIV(page, this, config);
                }
                return(html);
            }
        }