예제 #1
0
        public void createPromptNameCheck()
        {
            GuiControl       DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";
            editor           Editor             = "Editor";
            GuiPopUpMenuCtrl copySourceDropdown =
                DatablockEditorCreatePrompt.findObjectByInternalName("copySourceDropdown", true);

            string name =
                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .getText();

            if (!Editor.validateObjectName(name, true))
            {
                return;
            }

            // Fetch the copy source and clear the list.

            string copySource = copySourceDropdown.getText();

            copySourceDropdown.clear();

            // Remove the dialog and create the datablock.

            ((GuiCanvas)"canvas").popDialog(DatablockEditorCreatePrompt);
            this.createDatablockFinish(name, copySource);
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();

            editorTabs = new editor();
            this.codePanel.Controls.Add(this.editorTabs);
        }
예제 #3
0
        public NewEditorModel(editor editor)
        {
            foreach (var propertyInfo in editor.GetType().GetProperties())
            {
                if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String")
                {
                    propertyInfo.SetValue(this, propertyInfo.GetValue(editor));
                }
            }
            Email              = editor.user.Email;
            Password           = editor.user.Password;
            Deleted            = editor.user.Deleted;
            PermittedCountries = new List <int>();
            PermittedCities    = new List <int>();
            //PermittedRegions = new List<int>();
            foreach (var countryPermission in editor.user.country_permission)
            {
                PermittedCountries.Add(countryPermission.country.Id);
            }

            /*foreach (var regionPermission in editor.user.region_permission)
             * {
             *  PermittedRegions.Add(regionPermission.region.Id);
             * }*/
            foreach (var cityPermission in editor.user.city_permission)
            {
                PermittedCities.Add(cityPermission.city.Id);
            }
        }
            public void updateParticle(string propertyField, string value, bool isSlider, bool onMouseUp)
            {
                editor         Editor         = "Editor";
                ParticleEditor ParticleEditor = "ParticleEditor";

                this.setParticleDirty();
                SimObject particle = this.currParticle;

                SimObject last =
                    Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool()))
                {
                    last["field"]     = propertyField;
                    last["isSlider"]  = isSlider.AsString();
                    last["onMouseUp"] = onMouseUp.AsString();
                    last["newValue"]  = value;
                }
                else
                {
                    var action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveParticle>("Update Active Particle");
                    action["particle"]  = particle;
                    action["field"]     = propertyField;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();
                    action["newValue"]  = value;
                    action["oldValue"]  = particle.getFieldValue(propertyField, -1);

                    ParticleEditor.submitUndo(action);
                }

                particle.setFieldValue(propertyField, value, -1);
                particle.call("reload");
            }
예제 #5
0
        public override void onEndReparenting()
        {
            EWorldEditor EWorldEditor = "EWorldEditor";
            editor       Editor       = "Editor";

            UndoActionReparentObjects action = this.reparentUndoAction;

            this.reparentUndoAction = "";

            if (action.numObjects > 0)
            {
                if (action.numObjects == 1)
                {
                    action.actionName = "Reparent Object";
                }
                else
                {
                    action.actionName = "Reparent Objects";
                }

                action.addToManager(Editor.getUndoManager());

                EWorldEditor.syncGui();
            }
            else
            {
                action.delete();
            }
        }
예제 #6
0
            public void updateEmitter(string propertyField, string value, bool isSlider, bool onMouseUp)
            {
                ParticleEditor ParticleEditor = "ParticleEditor";
                editor         Editor         = "Editor";

                this.setEmitterDirty();

                SimObject emitter = this.currEmitter;

                SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"]).AsBool() && (!last["onMouseUp"].AsBool()))
                {
                    last["field"]     = propertyField;
                    last["isSlider"]  = isSlider.AsString();
                    last["onMouseUp"] = onMouseUp.AsString();
                    last["newValue"]  = value;
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitter>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["field"]     = propertyField;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();
                    action["newValue"]  = value;
                    action["oldValue"]  = emitter.getFieldValue(propertyField, -1);

                    ParticleEditor.submitUndo(action);
                }

                emitter.setFieldValue(propertyField, value, -1);
                emitter.call("reload");
            }
예제 #7
0
 return(ApplySemanticEditsAsync(
            editor, document,
            originalNodes,
            selector,
            GetExpressionSemanticBoundary,
            canReplace,
            updateRoot,
            cancellationToken));
예제 #8
0
        public object OPEN(menuForm menu, EDIT5.editor ED)
        {
            MENU_EL = menu;
            EDITOR  = ED;

            var C0 = OP_MENU_CL.GET_CURRENT_CHEP(ED, -1);

            THE_FILE = EDITOR.THE_FILE; /
        public override void onDeactivated()
        {
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdAnimWindow     ShapeEdAnimWindow     = "ShapeEdAnimWindow";
            ShapeEditorToolbar    ShapeEditorToolbar    = "ShapeEditorToolbar";

            ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui = "ShapeEdPreviewGui";
            editor Editor = "Editor";

            ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials";
            ShapeEditor ShapeEditor = "ShapeEditor";
            MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!this["isActive"].AsBool())
            {
                return;
            }
            this["isActive"] = false.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            this.writeSettings();

            // Notify game objects if shape has been modified
            if (ShapeEditor.isDirty())
            {
                ShapeEditor.shape.notifyShapeChanged();
            }

            bGlobal["$gfx::wireframe"] = bGlobal["$wasInWireFrameMode"];

            ShapeEdMaterials.updateSelectedMaterial(false);
            ShapeEditorToolbar.setVisible(false);

            ShapeEdPreviewGui.setVisible(false);
            ShapeEdSelectWindow.setVisible(false);
            ShapeEdPropWindow.setVisible(false);
            ShapeEdAnimWindow.setVisible(false);
            ShapeEdAdvancedWindow.setVisible(false);
            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (MaterialEditorPropertiesWindow.visible)
            {
                ShapeEdMaterials.editSelectedMaterialEnd(true);
            }
            //Copyright Winterleaf Entertainment L.L.C. 2013
            this.map.pop();

            // Restore the original undo manager
            Editor.setUndoManager(this["oldUndoMgr"]);

            // Restore menu bar
            this.replaceMenuCmd("Camera", "8", this["oldCamFitCmd"]);
            this.replaceMenuCmd("Camera", "9", this["oldCamFitOrbitCmd"]);

            base.onDeactivated();
        }
예제 #10
0
 public void CopyTo(ref editor editor)
 {
     foreach (var propertyInfo in editor.GetType().GetProperties())
     {
         if (!propertyInfo.Name.Contains("Id") && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String"))
         {
             propertyInfo.SetValue(editor, propertyInfo.GetValue(this));
         }
     }
 }
예제 #11
0
        public void onSolderEdges()
        {
            editor Editor = "Editor";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            // # Work with all terrains on the loaded level.
            TerrainSolderEdgesAction action = new ObjectCreator("TerrainSolderEdgesAction").Create();
            action.solder();
            action.addToManager(Editor.getUndoManager());
            ETerrainEditor.isDirty = true;
        }
예제 #12
0
        public void onSmoothHeightmap()
        {
            editor Editor = "Editor";

            if (!this.getActiveTerrain().AsBool())
                return;
            // Show the dialog first and let the user
            // set the smoothing parameters.

            // Now create the terrain smoothing action to
            // get the work done and perform later undos.

            TerrainSmoothAction action = new ObjectCreator("TerrainSmoothAction").Create();
            action.smooth(this.getActiveTerrain().AsString(), 1.0f, 1);
            action.addToManager(Editor.getUndoManager());
        }
예제 #13
0
        public void AddNewEditor(NewEditorModel model)
        {
            model.Email = StringTransformationProvider.TransformEmail(model.Email);
            if (_db.user.Any(u => u.Email == model.Email))
            {
                throw new MyException(Errors.UserExists);
            }
            var trans = _db.Database.BeginTransaction();

            try
            {
                var newUser = new user
                {
                    Guid       = Guid.NewGuid().ToString(),
                    Password   = StringTransformationProvider.Md5(model.Password),
                    Email      = model.Email,
                    UserTypeId = GetUserTypeByTag(UserTypes.Editor),
                    Deleted    = model.Deleted
                };
                _db.user.Add(newUser);
                _db.SaveChanges();
                var newEditor = new editor();
                model.CopyTo(ref newEditor);
                newEditor.UserId = newUser.Id;
                _db.editor.Add(newEditor);

                _db.country_permission.AddRange(
                    model.PermittedCountries.Select(c => new country_permission {
                    CountryId = c, UserId = newUser.Id
                }));
                _db.city_permission.AddRange(
                    model.PermittedCities.Select(c => new city_permission {
                    CityId = c, UserId = newUser.Id
                }));

                /* _db.region_permission.AddRange(
                 *   model.PermittedRegions.Select(c => new region_permission {RegionId = c, UserId = newUser.Id}));*/

                _db.SaveChanges();
                trans.Commit();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw;
            }
        }
예제 #14
0
        public TextSource(editor currentTB)
        {
            this.CurrentTB = currentTB;
            linesAccessor  = new LinesAccessor(this);
            Manager        = new CommandManager(this);

            if (Enum.GetUnderlyingType(typeof(StyleIndex)) == typeof(UInt32))
            {
                Styles = new Style[32];
            }
            else
            {
                Styles = new Style[16];
            }

            InitDefaultStyle();
        }
예제 #15
0
        public string Login(editor login)
        {
            MD5 md5Hash = MD5.Create();

            login.pass = Config.GetMd5Hash(md5Hash, login.pass);
            var p = (from q in db.editors where q.name.Contains(login.name) && q.pass.Contains(login.pass) select q.name).SingleOrDefault();

            if (p != null && p != "")
            {
                //Ghi ra cookie
                Config.setCookie("editor", p);
                return("1");
            }
            else
            {
                return("0");
            }
        }
예제 #16
0
        //todo need to change this.
        //[ConsoleInteraction ]
        /// A helper for submitting a delete undo action.
        /// If %wordSeperated is not specified or is false it is assumed %deleteObjects
        /// is tab sperated.
        public static void submit(string deleteObjects, bool wordSeperated)
        {
            editor Editor = "Editor";

            // The instant group will try to add our
            // UndoAction if we don't disable it.
            omni.Util.pushInstantGroup();

            // Create the undo action.
            ObjectCreator actionCreator = new ObjectCreator("MEDeleteUndoAction");

            actionCreator["actionName"] = "Delete";

            MEDeleteUndoAction action = actionCreator.Create();

            // Restore the instant group.
            omni.Util.popInstantGroup();

            // Add the deletion objects to the action which
            // will take care of properly deleting them.
            deleteObjects = omni.Util.trim(deleteObjects);

            if (wordSeperated)
            {
                int count = omni.Util.getWordCount(deleteObjects);
                for (int i = 0; i < count; i++)
                {
                    SimObject xobject = omni.Util.getWord(deleteObjects, i);
                    action.deleteObject(xobject);
                }
            }
            else
            {
                int count = omni.Util.getFieldCount(deleteObjects);
                for (int i = 0; i < count; i++)
                {
                    SimObject xobject = omni.Util.getField(deleteObjects, i);
                    action.deleteObject(xobject);
                }
            }

            // Submit it.
            action.addToManager(Editor.getUndoManager());
        }
예제 #17
0
        public void onOK()
        {
            GuiTextEditCtrl  nameField     = this.FOT("nameField");
            GuiPopUpMenuCtrl classDropdown = this.FOT("classDropdown");
            editor           Editor        = "Editor";

            string name      = nameField.getValue();
            string className = classDropdown.getText();

            // Make sure we don't clash with an existing object.
            // If there's an existing GUIControl with the name, ask to replace.
            // If there's an existing non-GUIControl with the name, or the name is invalid, refuse to create.

            if (name.isObject() && ((SimObject)name).isMemberOfClass("GuiControl"))
            {
                if (
                    Util.messageBox("Warning", "Replace the existing control '" + name + "'?", "OkCancel", "Question") ==
                    iGlobal["$MROk"])
                {
                    name.delete();
                }
                else
                {
                    return;
                }
            }

            if (Editor.validateObjectName(name, false))
            {
                ((GuiCanvas)this.getRoot()).popDialog(this);
                SimObject obj = Util.eval("return new " + className + "(" + name + ");");

                // Make sure we have no association with a filename.
                obj.setFilename("");

                GuiEditorGui.GuiEditContent(obj);
            }
        }
예제 #18
0
            public NodeTypeEditorControl(ContentTypeControl parent)
            {
                prnt = parent;
                this.Attributes.Add("width", "100%");
                HtmlTableRow  tr = new HtmlTableRow();
                HtmlTableCell td = new HtmlTableCell();

                td.InnerText = "Alias";
                tr.Cells.Add(td);

                td           = new HtmlTableCell();
                td.InnerText = "Navn";
                tr.Cells.Add(td);

                td           = new HtmlTableCell();
                td.InnerText = "Type";
                tr.Cells.Add(td);

                td           = new HtmlTableCell();
                td.InnerText = "Fane";
                tr.Cells.Add(td);

                td = new HtmlTableCell();
                tr.Cells.Add(td);

                this.Rows.Add(tr);

                cms.businesslogic.ContentType.TabI[] tbs = prnt.docType.getVirtualTabs;


                foreach (cms.businesslogic.propertytype.PropertyType pt in prnt.docType.PropertyTypes)
                {
                    editor e = new editor(pt, prnt);
                    PropertyTypes.Add(e);
                    this.Controls.Add(e);
                }
            }
예제 #19
0
        public virtual void insertDockControl(editor.ui.DockTo dockto, System.Windows.Forms.Control c)
        {
            SceneEditorDockTo _to = dockto as SceneEditorDockTo;

            switch (_to.mDockto)
            {
                case SceneEditor_FormDockID.CreateDock:
                    this.tabPageCreate.Controls.Clear();
                    this.tabPageCreate.Controls.Add(c);
                    c.Dock = DockStyle.Fill;
                    break;
                case SceneEditor_FormDockID.PropertyDock:
                    this.tabPageProperty.Controls.Clear();
                    this.tabPageProperty.Controls.Add(c);
                    c.Dock = DockStyle.Fill;
                    break;
                case SceneEditor_FormDockID.ListDock:
                    this.tabPageList.Controls.Clear();
                    this.tabPageList.Controls.Add(c);
                    c.Dock = DockStyle.Fill;
                    break;

            }
        }
예제 #20
0
        /// A helper for submitting a creation undo action.
        public static void submit(SimObject undoObject)
        {
            editor Editor = "Editor";

            // The instant group will try to add our
            // UndoAction if we don't disable it.
            omni.Util.pushInstantGroup();

            // Create the undo action.
            ObjectCreator actionCreator = new ObjectCreator("MECreateUndoAction");

            actionCreator["actionName"] = "Create " + undoObject.getClassName();

            MECreateUndoAction action = actionCreator.Create();

            // Restore the instant group.
            omni.Util.popInstantGroup();

            // Set the object to undo.
            action.addObject(undoObject);

            // Submit it.
            action.addToManager(Editor.getUndoManager());
        }
예제 #21
0
        static void Main(string[] args)
        {
            server _server = new server(constantinople.XML_FILEPATH);
            dir    _dir    = new dir(constantinople.XML_FILEPATH);

            if (args == null || args.Length == 0)
            {
                return;
            }

            switch (args[0])
            {
            case "help":
                runHelp();
                break;

            case "servername":
                Console.WriteLine(_server.Name);
                setter(args, () => new server(constantinople.XML_FILEPATH, args[2], string.Empty));
                break;

            case "db":
                Console.WriteLine(_server.Db);
                setter(args, () => new server(constantinople.XML_FILEPATH, string.Empty, args[2]));
                break;

            case "cs":     // connection string
                Console.WriteLine(_server.connectionString);
                break;

            case "dir":
                Console.WriteLine(_dir.Dirpath);
                setter(args, () => new dir(constantinople.XML_FILEPATH, args[2]));
                break;

            case "recursive":
                Console.WriteLine(_dir.Recursive);
                setter(args, () => new dir(constantinople.XML_FILEPATH, args[2].ToLowerInvariant() == "true" || args[2].ToLowerInvariant() == "t"));
                break;

            case "load":
                _dir.loadSql(args)
                .ForEach(p => Console.WriteLine(p));
                break;

            case "add":
                _dir.addSql(args).ForEach(p => Console.WriteLine(p));
                break;

            case "leave":
                _dir.leaveSql(args).ForEach(p => Console.WriteLine(p));
                break;

            case "list":
                _dir.listSql().ForEach(p => Console.WriteLine(p));
                break;

            case "exists":
                if (args.Count() > 1)
                {
                    Console.WriteLine("The filename {0} is {1} the current list.", args[1], _dir.exists(args[1]) ? "in" : "NOT in");
                }
                else
                {
                    Console.WriteLine("The exists needs one filename argument.");
                }
                break;

            case "run":
                runSql runsql = new runSql(_server.connectionString, _dir);
                runsql.run().ForEach(p =>
                {
                    Console.WriteLine(p);
                });
                break;

            case "change":
                if (args.Length > 2)
                {
                    editor ed = new editor(_dir.listSql(), _dir.Dirpath);
                    ed.change(args[1], args[2]).ForEach(p =>
                    {
                        Console.WriteLine(p);
                    });
                }
                break;

            case "show":
                if (args.Length == 2)
                {
                    Console.WriteLine(System.IO.File.ReadAllText(_dir.Dirpath + "\\" + args[1]));
                }
                break;

            case "addsql":
                if (args.Length > 2)
                {
                    editor ed = new editor(_dir.listSql(), _dir.Dirpath);
                    ed.add(args[1], args[2]).ForEach(p =>
                    {
                        Console.WriteLine(p);
                    });
                }
                break;

            case "edit":
                if (args.Length > 1)
                {
                    Process.Start(_dir.Dirpath + "\\" + args[1]);
                }
                break;

            case "delSql":
                if (args.Length > 2)
                {
                    var delSp = new deleteSql(_server.connectionString, args[1]);
                    args.Skip(2).ToList().ForEach(p => {
                        Console.WriteLine(delSp.run(p));
                    });
                }
                else
                {
                    Console.WriteLine("To delete an SQL entity you need the type of sql (ie function, procedure...) and then a list of names.");
                }
                break;
            }
        }
예제 #22
0
            public override void onBeginCompoundEdit()
            {
                editor Editor = "Editor";

                Editor.getUndoManager().pushCompound("Multiple Field Edit");
            }
예제 #23
0
            public override void onEndCompoundEdit()
            {
                editor Editor = "Editor";

                Editor.getUndoManager().popCompound();
            }
예제 #24
0
			public NodeTypeEditorControl(ContentTypeControl parent) 
			{
				prnt = parent;
				this.Attributes.Add("width","100%");
				HtmlTableRow tr = new HtmlTableRow();
				HtmlTableCell td =  new HtmlTableCell();
				td.InnerText = "Alias";
				tr.Cells.Add(td);

				td = new HtmlTableCell();
				td.InnerText  = "Navn";
				tr.Cells.Add(td);

				td = new HtmlTableCell();
				td.InnerText = "Type";
				tr.Cells.Add(td);

				td = new HtmlTableCell();
				td.InnerText = "Fane";
				tr.Cells.Add(td);

				td = new HtmlTableCell();
				tr.Cells.Add(td);

				this.Rows.Add(tr);
               
				cms.businesslogic.ContentType.TabI[] tbs = prnt.docType.getVirtualTabs;
	

				foreach (cms.businesslogic.propertytype.PropertyType pt in prnt.docType.PropertyTypes) 
				{
					editor e = new editor(pt,prnt);
					PropertyTypes.Add(e);
					this.Controls.Add(e);
				}
				
			}
 AddAssignmentStatements(editor, exprOrStatement, statements);
        public void submitUndo(UndoScriptAction action)
        {
            editor Editor = "Editor";

            action.addToManager(Editor.getUndoManager());
        }
예제 #27
0
            public void updateLifeFields(bool isRandom, float value, bool isSlider, bool onMouseUp)
            {
                GuiCheckBoxCtrl PEE_infiniteLoop                = this.FOT("PEE_infiniteLoop");
                GuiSliderCtrl   PEE_lifetimeMS_slider           = this.FOT("PEE_lifetimeMS_slider");
                GuiSliderCtrl   PEE_lifetimeVarianceMS_slider   = this.FOT("PEE_lifetimeVarianceMS_slider");
                GuiTextEditCtrl PEE_lifetimeVarianceMS_textEdit = this.FOT("PEE_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl PEE_lifetimeMS_textEdit         = this.FOT("PEE_lifetimeMS_textEdit");
                editor          Editor         = "Editor";
                ParticleEditor  ParticleEditor = "ParticleEditor";

                this.setEmitterDirty();

                SimObject emitter = this.currEmitter;

                // Transfer values over to gui controls.

                if (isRandom)
                {
                    if (value > 0)
                    {
                        value++;
                    }

                    if (value > PEE_lifetimeMS_slider.getValue())
                    {
                        PEE_lifetimeMS_textEdit.setText(value.AsString());
                        PEE_lifetimeMS_slider.setValue(value.AsString());
                    }
                }
                else
                {
                    if (value > 0)
                    {
                        value--;
                    }

                    if (value < PEE_lifetimeVarianceMS_slider.getValue())
                    {
                        PEE_lifetimeVarianceMS_textEdit.setText(value.AsString());
                        PEE_lifetimeVarianceMS_slider.setValue(value.AsString());
                    }
                }

                // Submit undo.

                SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool()))
                {
                    last["isSlider"]                   = isSlider.AsString();
                    last["onMouseUp"]                  = onMouseUp.AsString();
                    last["newValueLifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                    last["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterLifeFields>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();

                    action["newValueLifetimeMS"] = PEE_lifetimeMS_textEdit.getText();
                    action["oldValueLifetimeMS"] = emitter["lifetimeMS"];

                    action["newValueLifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                    action["oldValueLifetimeVarianceMS"] = emitter["lifetimeVarianceMS"];

                    ParticleEditor.submitUndo(action);
                }

                // Set the values on the current emitter.

                emitter["lifetimeMS"]         = PEE_lifetimeMS_textEdit.getText();
                emitter["lifetimeVarianceMS"] = PEE_lifetimeVarianceMS_textEdit.getText();
                emitter.call("reload");

                // Keep the infiniteLoop checkbox up to date.

                PEE_infiniteLoop.setStateOn(emitter["lifetimeMS"].AsInt() == 0);
            }
 ImplementINotifyPropertyChangedAsync(
     editor,
     addUsings: true,
예제 #29
0
            public void updateSpeedFields(bool isRandom, float value, bool isSlider, bool onMouseUp)
            {
                GuiSliderCtrl   PEE_ejectionVelocity_slider   = this.FOT("PEE_ejectionVelocity_slider");
                GuiSliderCtrl   PEE_velocityVariance_slider   = this.FOT("PEE_velocityVariance_slider");
                GuiTextEditCtrl PEE_ejectionVelocity_textEdit = this.FOT("PEE_ejectionVelocity_textEdit");
                GuiTextEditCtrl PEE_velocityVariance_textEdit = this.FOT("PEE_velocityVariance_textEdit");
                editor          Editor         = "Editor";
                ParticleEditor  ParticleEditor = "ParticleEditor";

                this.setEmitterDirty();
                SimObject emitter = this.currEmitter;

                // Transfer values over to gui controls.

                if (isRandom)
                {
                    if (value > PEE_ejectionVelocity_slider.getValue())
                    {
                        PEE_ejectionVelocity_textEdit.setText(value.AsString());
                        PEE_ejectionVelocity_slider.setValue(value.AsString());
                    }
                }
                else
                {
                    if (value < PEE_velocityVariance_slider.getValue())
                    {
                        PEE_velocityVariance_textEdit.setText(value.AsString());
                        PEE_velocityVariance_slider.setValue(value.AsString());
                    }
                }

                // Submit undo.

                SimObject last = Editor.getUndoManager().getUndoAction((Editor.getUndoManager().getUndoCount() - 1));

                if ((isSlider) && (last["isSlider"].AsBool()) && (!last["onMouseUp"].AsBool()))
                {
                    last["isSlider"]  = isSlider.AsString();
                    last["onMouseUp"] = onMouseUp.AsString();
                    last["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                    last["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText();
                }
                else
                {
                    ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields action = ParticleEditor.createUndo <ParticleEditorUndo.ActionUpdateActiveEmitterSpeedFields>("Update Active Emitter");
                    action["emitter"]   = emitter;
                    action["isSlider"]  = isSlider.AsString();
                    action["onMouseUp"] = onMouseUp.AsString();

                    action["newValueEjectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                    action["oldValueEjectionVelocity"] = emitter["ejectionVelocity"];

                    action["newValueVelocityVariance"] = PEE_velocityVariance_textEdit.getText();
                    action["oldValueVelocityVariance"] = emitter["velocityVariance"];

                    ParticleEditor.submitUndo(action);
                }

                // Set the values on the current emitter.

                emitter["ejectionVelocity"] = PEE_ejectionVelocity_textEdit.getText();
                emitter["velocityVariance"] = PEE_velocityVariance_textEdit.getText();
                emitter.call("reload");
            }
예제 #30
0
 return(ApplySemanticEditsAsync(
            editor, document,
            originalNodes,
            selector,
            (syntaxFacts, node) => GetExpressionSemanticBoundary(syntaxFacts, node),
        public override void onSelectObjects(bool val, bool reuseExistingSet = false)
        {
            string sel = "";
            // See if we should create an independent selection set.
            GuiCheckBoxCtrl createSelectionSet = this.findObjectByInternalName("createSelectionSet", true);

            if (createSelectionSet.isStateOn())
            {
                string sname = ((GuiTextEditCtrl)this.findObjectByInternalName("selectionSetName", true)).getText();
                // See if we should create or re-use a set.

                if (sname.isObject())
                {
                    SimObject name = sname;
                    if (name.isMemberOfClass("WorldEditorSelection"))
                    {
                        messageBox.MessageBoxOK("Error",
                                                "An object called '" + name +
                                                "' already exists and is not a selection.  Please choose a different name.");
                        return;
                    }
                    else if (!reuseExistingSet)
                    {
                        messageBox.MessageBoxYesNo("Question",
                                                   "A selection called '" + name + "' already exists. Modify the existing selection?",
                                                   this + ".onSelectObjects( " + val + ", true );", "");
                        return;
                    }
                    else
                    {
                        sel = name;
                    }
                }
                else
                {
                    editor Editor = "Editor";
                    if (!Editor.validateObjectName(name, false))
                    {
                        return;
                    }

                    // Create a new selection set.
                    sel =
                        console.Eval("%sel = new WorldEditorSelection( " + name +
                                     " ) { parentGroup = Selections; canSave = true; };return sel;", true);

                    if (!sel.isObject())
                    {
                        messageBox.MessageBoxOK("Error",
                                                "Could not create the selection set.  Please look at the console.log for details.");
                        return;
                    }
                }

                this["selectionSet"] = sel;
            }
            else
            {
                this["selectionSet"] = "";
            }

            base.onSelectObjects(val, false);

            // Refresh editor tree just in case.
            EditorTree EditorTree = "EditorTree";

            EditorTree.buildVisibleTree();
        }
        public void deleteDatablock()
        {
            GuiTreeViewCtrl tree   = "DatablockEditorTree";
            editor          Editor = "Editor";

            // If we have more than single datablock selected,
            // turn our undos into a compound undo.

            int numSelected = tree.getSelectedItemsCount();

            if (numSelected > 1)
            {
                Editor.getUndoManager().pushCompound("Delete Multiple Datablocks");
            }

            for (int i = 0; i < numSelected; i++)
            {
                int       id = tree.getSelectedItem(i);
                SimObject db = tree.getItemValue(id);

                string fileName = db.getFilename();

                // Remove the datablock from the tree.

                tree.removeItem(id);

                // Create undo.

                UndoScriptAction action = this.createUndo <DatablockEditorUndo.ActionDeleteDatablock>("Delete Datablock");
                action["db"]     = db;
                action["dbName"] = db.getName();
                action["fname"]  = fileName;

                this.submitUndo(action);

                // Kill the datablock in the file.

                if (fileName != "")
                {
                    this.PM.removeObjectFromFile(db);
                }

                ((SimSet)"UnlistedDatablocks").add(db);

                // Show some confirmation.

                if (numSelected == 1)
                {
                    messageBox.MessageBoxOK("Datablock Deleted", "The datablock (" + db.getName() + ") has been removed from " + "it's file (" + db.getFilename() + ") and upon restart will cease to exist");
                }
            }

            // Close compound, if we were deleting multiple datablocks.

            if (numSelected > 1)
            {
                Editor.getUndoManager().popCompound();
            }

            // Show confirmation for multiple datablocks.

            if (numSelected > 1)
            {
                messageBox.MessageBoxOK("Datablocks Deleted", "The datablocks have been deleted and upon restart will cease to exist.");
            }

            // Clear selection.

            this.resetSelectedDatablock();
        }
        public void import()
        {
            // Gather all the import settings.
            GuiTextEditCtrl HeightfieldFilename = this.findObjectByInternalName("HeightfieldFilename", true);
            string          heightMapPng        = HeightfieldFilename.getText();
            GuiTextEditCtrl MetersPerPixel      = this.findObjectByInternalName("MetersPerPixel", true);
            string          metersPerPixel      = MetersPerPixel.getText();
            GuiTextEditCtrl HeightScale         = findObjectByInternalName("HeightScale", true);
            string          heightScale         = HeightScale.getText();
            GuiCheckBoxCtrl FlipYAxis           = findObjectByInternalName("FlipYAxis", true);
            bool            flipYAxis           = FlipYAxis.isStateOn();

            editor Editor = "Editor";
            // Grab and validate terrain object name.

            string terrainName = ((GuiTextEditCtrl)this.findObjectByInternalName("TerrainName", true)).getText();

            if (!terrainName.isObject() && ((SimObject)terrainName).isMemberOfClass("TerrainBlock") &&
                !Editor.validateObjectName(terrainName, false))
            {
                return;
            }

            string opacityNames  = "";
            string materialNames = "";

            GuiTextListCtrl opacityList = this.findObjectByInternalName("OpacityLayerTextList", true);


            ArrayObject namesArray    = this["namesArray"];
            ArrayObject channelsArray = this["channelsArray"];

            for (int i = 0; i < opacityList.rowCount(); i++)
            {
                string itemText    = opacityList.getRowTextById(i);
                string opacityName = namesArray.getValue(i);
                string channelInfo = channelsArray.getValue(i);
                string channel     = Util.getWord(channelInfo, 0);

                string materialName = Util.getField(itemText, 2);
                opacityNames  += opacityName + "\t" + channel + "\n";
                materialNames += materialName + "\n";
            }

            int updated = Util.nameToID(terrainName);
            // This will update an existing terrain with the name %terrainName,
            // or create a new one if %terrainName isn't a TerrainBlock

            String obj = console.Call_Classname("TerrainBlock", "import",
                                                new string[]
            {
                terrainName, heightMapPng, metersPerPixel, heightScale, opacityNames, materialNames,
                flipYAxis.AsString()
            });

            ((GuiCanvas)"Canvas").popDialog(this);

            if (obj.isObject())
            {
                if (obj != updated.AsString())
                {
                    // created a new TerrainBlock
                    // Submit an undo action.
                    Extendable.MECreateUndoAction.submit(obj);
                }

                EWorldEditor EWorldEditor = "EWorldEditor";

                if (!EWorldEditor.isObject())
                {
                    throw new Exception("ObjectBuilderGui::processNewObject - EWorldEditor is missing!");
                }

                // Select it in the editor.
                EWorldEditor.clearSelection();
                EWorldEditor.selectObject(obj);
                // When we drop the selection don't store undo
                // state for it... the creation deals with it.

                EWorldEditor.dropSelection(obj.AsBool());

                EWorldEditor.isDirty = true;
                //Copyright Winterleaf Entertainment L.L.C. 2013
                ((TerrainPainter)"TerrainPainter").updateLayers("");
                //Copyright Winterleaf Entertainment L.L.C. 2013
            }
            else
            {
                messageBox.MessageBoxOK("Import Terrain", "Terrain import failed! Check console for error messages.",
                                        "Ok");
            }
        }