Esempio n. 1
0
        private void controlOnBlur(object sender, System.EventArgs e)
        {
            try
            {
                if (sender is Control)
                {
                    Control    tb  = sender as Control;
                    GuiControl gtb = guiController[tb.Name] as GuiControl;

                    foreach (string functionName in gtb.GetEventHandlers("onblur"))
                    {
                        this.executioner.ExecuteFunction(functionName, gtb);
                    }
                }
            }
            catch (Exception x)
            {
                //ZeusDisplayError formError = new ZeusDisplayError(x);
                //formError.ShowDialog(this);
                if (logger != null)
                {
                    logger.LogException(x);
                }
            }
        }
Esempio n. 2
0
        public void update()
        {
            GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack");

            for (uint i = 0; i < SFXParametersStack.getCount(); i++)
            {
                // If either the value field or the slider are currently being
                // edited, don't update the value in order to not interfere with
                // user editing.

                GuiControl ctrl = SFXParametersStack.getObject(i);

                GuiTextEditCtrl valueField  = ctrl.FOT("valueField");
                GuiSliderCtrl   valueSlider = ctrl.FOT("valueSlider");

                if (valueField.isFirstResponder() || valueSlider.isThumbBeingDragged())
                {
                    continue;
                }

                SFXParameter parameter = ctrl["sfxParameter"];

                valueField.setValue(parameter.value.AsString());
                valueSlider.setValue(parameter.value.AsString());
            }

            // If the control is still awake, schedule another
            // update.

            if (this.isVisible())
            {
                this.schedule(iGlobal["$SFX_PARAMETERS_UPDATE_INTERVAL"].AsString(), "update");
            }
        }
Esempio n. 3
0
        public void createTool(string tool, string cmd, GuiDynamicCtrlArrayControl toolsArray)
        {
            var        oc1       = new ObjectCreator("GuiControl");
            GuiControl container = oc1.Create();

            var oc = new ObjectCreator("GuiBitmapButtonCtrl");

            oc["Extent"]     = "108 81";
            oc["position"]   = "35 0";
            oc["bitmap"]     = "art/gui/no-preview";
            oc["altCommand"] = "ToolsDlg.execute(\\\"" + this["cwd"] + "/" + cmd + ".bat\\\");";
            GuiBitmapButtonCtrl bitmap = oc.Create();

            var oc2 = new ObjectCreator("GuiTextCtrl");

            oc2["text"]     = tool;
            oc2["Extent"]   = "108 30";
            oc2["position"] = "35 85";
            GuiTextCtrl text = oc2.Create();

            container.addGuiControl(bitmap);
            container.addGuiControl(text);

            toolsArray.addGuiControl(container);
        }
Esempio n. 4
0
        public override void onDeactivated()
        {
            GuiMeshRoadEditorCtrl MeshRoadEditorGui           = "MeshRoadEditorGui";
            GuiControl            MeshRoadEditorToolbar       = "MeshRoadEditorToolbar";
            GuiWindowCollapseCtrl MeshRoadEditorOptionsWindow = "MeshRoadEditorOptionsWindow";

            MeshRoadEditorGui.MeshRoadEditorTreeWindow MeshRoadEditorTreeWindow = "MeshRoadEditorTreeWindow";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            //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();

            MeshRoadEditorGui.setVisible(false);
            MeshRoadEditorOptionsWindow.setVisible(false);
            MeshRoadEditorToolbar.setVisible(false);
            MeshRoadEditorTreeWindow.setVisible(false);
            this.map.pop();

            // Restore the previous Gizmo
            // alignment settings.
            GlobalGizmoProfile["alignment"] = this["prevGizmoAlignment"];

            base.onDeactivated();
        }
Esempio n. 5
0
        public override void onDeactivated()
        {
            GuiRoadEditorCtrl     RoadEditorGui           = "RoadEditorGui";
            GuiControl            RoadEditorToolbar       = "RoadEditorToolbar";
            GuiWindowCollapseCtrl RoadEditorOptionsWindow = "RoadEditorOptionsWindow";
            GuiWindowCollapseCtrl RoadEditorTreeWindow    = "RoadEditorTreeWindow";

            //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();

            RoadEditorGui.setVisible(false);
            RoadEditorToolbar.setVisible(false);
            RoadEditorOptionsWindow.setVisible(false);
            RoadEditorTreeWindow.setVisible(false);
            this.map.pop();

            base.onDeactivated();
        }
Esempio n. 6
0
        /// <summary>
        /// Parses the specified input string.
        /// </summary>
        /// <param name="game">The game instance.</param>
        /// <param name="inputString">The input string.</param>
        /// <param name="sender">The <see cref="GuiControl" /> instance to use as sender in a <see cref="GuiScriptedValue`1" />.</param>
        /// <returns></returns>
        public static GuiValue <T> Parse(BlackbirdGame game, string inputString, GuiControl sender)
        {
            if (inputString == null || inputString == "$null")
            {
                return(new GuiNullValue <T>(game));
            }

            // Scripted values.
            if (inputString.StartsWith("$=") || inputString.StartsWith("${"))
            {
                return(new GuiScriptedValue <T>(game, inputString.Substring(1), sender));
            }
            else if (inputString.StartsWith("#=") || inputString.StartsWith("#{"))
            {
                return(new GuiScriptedValue <T>(game, inputString, sender));
            }

            if (inputString.StartsWith("$"))
            {
                return(new GuiVariableValue <T>(game, inputString.Substring(1)));
            }
            else
            {
                return(new GuiConstantValue <T>(game, XmlHelper.Parse <T>(inputString)));
            }
        }
Esempio n. 7
0
        void BubbleControl(GuiControl control, MouseEventArgument e)
        {
            int x = control.X;
            int y = control.Y;

            if (e.X >= x && e.X <= x + control.Width &&
                e.Y >= y && e.Y <= y + control.Height)
            {
                if (e is MouseClickEventArgument)
                {
                    control.MouseClick.Invoke(e as MouseClickEventArgument);
                }
                else if (e is MouseMoveEventArgument)
                {
                    control.MouseMove.Invoke(e as MouseMoveEventArgument);
                }

                if (!e.Bubble)
                {
                    return;
                }

                if (control is GuiFaceControl)
                {
                    e.X -= x;
                    e.Y -= y;

                    Game.GuiManager.GetFace((control as GuiFaceControl).FaceId).Bubble(BubbleFace, e);

                    e.X += x;
                    e.Y += y;
                }
            }
        }
 public static void SetToggleButtonValue(GuiControl ctrl, string value)
 {
     if (ctrl.getValue() != value)
     {
         ctrl.call("performClick");
     }
 }
Esempio n. 9
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);
        }
        public void update()
        {
            GuiControl GuiEditorContent = "GuiEditorContent";

            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

            SimObject obj = GuiEditorContent.getObject(0);

            if (!obj.isObject())
            {
                this.clear();
            }
            else
            {
                // Open inspector tree.

                this.open(obj);

                // Sync selection with GuiEditor.

                this.clearSelection();

                SimSet selection = GuiEditor.getSelection();
                int    count     = selection.getCount();

                for (uint i = 0; i < count; i++)
                {
                    this.addSelection(selection.getObject(i).AsInt(), false);
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Allows a control to ask to continue to receive mouse
 /// events outside its draw area.
 /// </summary>
 public void GrabMouse(GuiControl c)
 {
     if (_grabbedMouse.Contains(c) == false)
     {
         _grabbedMouse.Add(c);
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Method is meant to loop down the parents control to find a suitable event control.  If the predicate returns false
 /// it will continue down the control tree.
 /// </summary>
 /// <param name="control">The control we want to check against</param>
 /// <param name="predicate">A function to check if the propagation should resume, if returns false it will continue down the tree.</param>
 private void PropagateDown(GuiControl control, Func <GuiControl, bool> predicate)
 {
     while (control != null && predicate(control))
     {
         control = control.Parent;
     }
 }
Esempio n. 13
0
        private void OnPointerMoved(GuiPointerEventArgs args)
        {
            CursorPosition = args.Position.ToVector2();

            if (ActiveScreen == null || !ActiveScreen.IsVisible)
            {
                return;
            }

            var hoveredControl = FindControlAtPoint(args.Position);

            if (_hoveredControl != hoveredControl)
            {
                if (_hoveredControl != null && (hoveredControl == null || !hoveredControl.HasParent(_hoveredControl)))
                {
                    PropagateDown(_hoveredControl, x => x.OnPointerLeave(this, args));
                }
                _hoveredControl = hoveredControl;
                PropagateDown(_hoveredControl, x => x.OnPointerEnter(this, args));
            }
            else
            {
                PropagateDown(_hoveredControl, x => x.OnPointerMove(this, args));
            }
        }
        public void previousPreviews()
        {
            GuiDynamicCtrlArrayControl SmallPreviews = ((GuiDynamicCtrlArrayControl)((GuiWindowCtrl)"ChooseLevelWindow").findObjectByInternalName("SmallPreviews", false));

            int prevHiddenIdx = SmallPreviews["firstVisible"].AsInt() - 1;

            if (prevHiddenIdx < 0)
            {
                return;
            }

            int lastVisibleIdx = SmallPreviews["lastVisible"].AsInt();

            if (lastVisibleIdx >= SmallPreviews.getCount())
            {
                return;
            }

            GuiControl prevHiddenObj  = SmallPreviews.getObject((uint)prevHiddenIdx);
            GuiControl lastVisibleObj = SmallPreviews.getObject((uint)lastVisibleIdx);

            if (prevHiddenObj.isObject() && lastVisibleObj.isObject())
            {
                SmallPreviews["firstVisible"] = (SmallPreviews["firstVisible"].AsInt() - 1).AsString();
                SmallPreviews["lastVisible"]  = (SmallPreviews["lastVisible"].AsInt() - 1).AsString();

                prevHiddenObj.setVisible(true);
                lastVisibleObj.setVisible(false);
            }
        }
Esempio n. 15
0
        private void OnPointerUp(GuiPointerEventArgs args)
        {
            if (Screen == null)
            {
                return;
            }

            var postFocusedControl = FindControlAtPoint(Screen.Controls, args.Position);

            if (_preFocusedControl == postFocusedControl)
            {
                var focusedControl = postFocusedControl;

                if (_focusedControl != focusedControl)
                {
                    if (_focusedControl != null)
                    {
                        _focusedControl.IsFocused = false;
                    }

                    _focusedControl = focusedControl;

                    if (_focusedControl != null)
                    {
                        _focusedControl.IsFocused = true;
                    }
                }
            }

            _preFocusedControl = null;
            _hoveredControl?.OnPointerUp(args);
        }
        private static void ChangePropertyValues(GuiControl control, Dictionary <string, object> setters)
        {
            var targetType = control.GetType();

            foreach (var propertyName in setters.Keys)
            {
                var propertyInfo = targetType.GetRuntimeProperty(propertyName);
                var value        = setters[propertyName];

                if (propertyInfo != null)
                {
                    if (propertyInfo.CanWrite)
                    {
                        propertyInfo.SetValue(control, value);
                    }

                    // special case when we have a list of items as objects (like on a list box)
                    if (propertyInfo.PropertyType == typeof(List <object>))
                    {
                        var items     = (List <object>)value;
                        var addMethod = propertyInfo.PropertyType.GetRuntimeMethod("Add", new[] { typeof(object) });

                        foreach (var item in items)
                        {
                            addMethod.Invoke(propertyInfo.GetValue(control), new[] { item });
                        }
                    }
                }
            }
        }
        public override void onDeactivated()
        {
            RiverEditorGui        RiverEditorGui           = "RiverEditorGui";
            GuiControl            RiverEditorToolbar       = "RiverEditorToolbar";
            GuiWindowCollapseCtrl RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            GuiWindowCollapseCtrl RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            GizmoProfile          GlobalGizmoProfile       = "GlobalGizmoProfile";

            //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();

            omni.bGlobal["$River::EditorOpen"] = false;

            RiverEditorGui.setVisible(false);
            RiverEditorToolbar.setVisible(false);
            RiverEditorOptionsWindow.setVisible(false);
            RiverEditorTreeWindow.setVisible(false);
            this.map.pop();

            // Restore the previous Gizmo
            // alignment settings.
            GlobalGizmoProfile["alignment"] = this["prevGizmoAlignment"];

            // Allow the Gui to cleanup.
            RiverEditorGui.onEditorDeactivated();

            base.onDeactivated();
        }
Esempio n. 18
0
        public override void onDeactivated()
        {
            writeSettings();

            bGlobal["$Nav::EditorOpen"] = false;

            NavEditorGui          NavEditorGui           = "NavEditorGui";
            GuiWindowCollapseCtrl NavEditorOptionsWindow = "NavEditorOptionsWindow";
            GuiWindowCollapseCtrl NavEditorTreeWindow    = "NavEditorTreeWindow";
            GuiControl            NavEditorToolbar       = "NavEditorToolbar";
            GizmoProfile          GlobalGizmoProfile     = "GlobalGizmoProfile";

            NavEditorGui.setVisible(false);
            NavEditorToolbar.setVisible(false);
            NavEditorOptionsWindow.setVisible(false);
            NavEditorTreeWindow.setVisible(false);
            map.pop();

            // Restore the previous Gizmo alignment settings.
            GlobalGizmoProfile.alignment = prevGizmoAlignment;

            // Allow the Gui to cleanup.
            NavEditorGui.onEditorDeactivated();

            base.onDeactivated();
        }
Esempio n. 19
0
        public override void onDeactivated()
        {
            if (!isActive)
            {
                return;
            }

            EditorGui             EditorGui               = "EditorGui";
            TerrainPainter        TerrainPainter          = "TerrainPainter";
            GuiWindowCollapseCtrl TerrainPainterPreview   = "TerrainPainterPreview";
            GuiControl            EWTerrainPainterToolbar = "EWTerrainPainterToolbar";
            TerrainEditor         ETerrainEditor          = "ETerrainEditor";

            isActive = false;
            base.onDeactivated();

            EditorGui.writeTerrainEditorSettings();
            map.pop();

            //Copyright Winterleaf Entertainment L.L.C. 2013
            TerrainPainter.setVisible(false);
            TerrainPainterPreview.setVisible(false);
            //Copyright Winterleaf Entertainment L.L.C. 2013
            EWTerrainPainterToolbar.setVisible(false);
            ETerrainEditor.setVisible(false);
        }
Esempio n. 20
0
        public void Apply(GuiControl control)
        {
            _previousState = _setters
                             .ToDictionary(i => i.Key, i => TargetType.GetRuntimeProperty(i.Key)?.GetValue(control));

            ChangePropertyValues(control, _setters);
        }
Esempio n. 21
0
        /// Move all controls out of group to either former parent or group parent.
        public void ungroup()
        {
            GuiControl defaultParent = this.groupParent;
            string     groupPos      = this.groupObject.getPosition().AsString();

            int x = Util.getWord(groupPos, 0).AsInt();
            int y = Util.getWord(groupPos, 1).AsInt();

            // Move each control to its former parent (or default parent when
            // there is no former parent).

            for (int i = 0; i < this.count; i++)
            {
                GuiControl ctrl = this["ctrl[" + i + "]"];

                GuiControl parent = defaultParent;
                if (this["ctrlParent[" + i + "]"].isObject())
                {
                    parent = this["ctrlParent[" + i + "]"];
                }

                parent.addGuiControl(ctrl);

                // Move into place in new parent.

                string ctrlPos = ctrl.getPosition().AsString();
                ctrl.setPosition(Util.getWord(ctrlPos, 0).AsInt() + x, Util.getWord(ctrlPos, 1).AsInt() + y);
            }

            // Delete old group object.

            this.groupObject.delete();
        }
Esempio n. 22
0
        public override void onControlDropped(GuiControl control, string dropPoint)
        {
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            string     srcBtn = control["dragSourceControl"];
            GuiControl dstBtn = this;
            GuiControl stack  = this.getParent();

            // Not dropped on a valid Button.
            // Really this shouldnt happen since we are in a callback on our specialized
            // EPainterIconBtn namespace.

            if (stack != dstBtn.getParent() || stack != "EPainterStack".getID())
            {
                console.print("Not dropped on valid control");
                return;
            }
            // Dropped on the original control, no order change.
            // Simulate a click on the control, instead of a drag/drop.
            if (srcBtn == dstBtn)
            {
                dstBtn.call("performClick");
                return;
            }

            int dstIndex = stack.getObjectIndex(dstBtn);

            ETerrainEditor.reorderMaterial(stack.getObjectIndex(srcBtn), dstIndex);

            // select the button/material we just reordered.

            stack.getObject((uint)dstIndex).call("performClick");
        }
        public void loadDialog(GuiControl ctrl)
        {
            GuiCanvas       Canvas                    = "Canvas";
            GuiSliderCtrl   AlphaLevelSlider          = "AlphaLevelSlider";
            GuiSliderCtrl   MouseOverAlphaLevelSlider = "MouseOverAlphaLevelSlider";
            GuiTextEditCtrl AlphaLevelText            = "AlphaLevelText";
            GuiTextEditCtrl MouseOverAlphaLevelText   = "MouseOverAlphaLevelText";
            GuiTextEditCtrl AlphaFadeTimeText         = "AlphaFadeTimeText";

            this["ctrl"] = ctrl;
            this.checkAllowedDialogs();
            Canvas.pushDialog(this);

            if (this.ctrl["alpha"].AsBool())
            {
                this["oldAlphaValue"]     = ctrl.getAlphaValue().AsString();
                AlphaLevelSlider["value"] = this["oldAlphaValue"];
                AlphaLevelText["text"]    = this["oldAlphaValue"];
            }
            if (this.ctrl.mouseOverAlpha)
            {
                this["oldMouseOverAlphaValue"]     = ctrl.getMouseOverAlphaValue().AsString();
                MouseOverAlphaLevelSlider["value"] = this["oldMouseOverAlphaValue"];
                MouseOverAlphaLevelText["text"]    = this["oldMouseOverAlphaValue"];
            }
            if (this.ctrl.alphaFade)
            {
                this["oldAlphaFadeTime"]  = ctrl.getAlphaFadeTime().AsString();
                AlphaFadeTimeText["text"] = this["oldAlphaFadeTime"];
            }
        }
        public void checkAllowedDialogs()
        {
            GuiControl AlphaLevelControl     = "AlphaLevelControl";
            GuiControl MouseOverAlphaControl = "MouseOverAlphaControl";
            GuiControl AlphaFadeControl      = "AlphaFadeControl";

            if (!this.ctrl["alpha"].AsBool())
            {
                AlphaLevelControl["visible"] = "0";
            }
            else
            {
                AlphaLevelControl["visible"] = "1";
            }

            if (!this.ctrl["mouseOverAlpha"].AsBool())
            {
                MouseOverAlphaControl["visible"] = "0";
            }
            else
            {
                MouseOverAlphaControl["visible"] = "1";
            }

            if (!this.ctrl["alphaFade"].AsBool())
            {
                AlphaFadeControl["visible"] = "0";
            }
            else
            {
                AlphaFadeControl["visible"] = "1";
            }
        }
Esempio n. 25
0
        public static void _setShadowVizLight(string light, bool force)
        {
            GuiControl AL_ShadowVizOverlayCtrl = "AL_ShadowVizOverlayCtrl";


            if (!AL_ShadowVizOverlayCtrl.isAwake())
            {
                return;
            }
            if (AL_ShadowVizOverlayCtrl["isLocked"].AsBool() && !force)
            {
                return;
            }

            string sizeAndAspect = "";

            if (light.isObject())
            {
                //todo Got a bug here I think, don't know enough about lighting to debug it at the moment.  the sizeAndAspect is always blank.
                string clientLight = client.serverToClientObject(light.AsInt()).AsString();
                //console.Call("serverToClientObject", new string[] { light });
                sizeAndAspect = omni.Util.setShadowVizLight(clientLight);
            }

            omni.console.Call(AL_ShadowVizOverlayCtrl.findObjectByInternalName("MatCtrl", true), "setMaterial",
                              new[] { "AL_ShadowVisualizeMaterial" });
            string text = "ShadowViz";

            if (light.isObject() && sizeAndAspect != "")
            {
                text = text + ":" + sizeAndAspect.Split(' ')[0] + " x " + sizeAndAspect.Split(' ')[1];
            }

            omni.console.SetVar(AL_ShadowVizOverlayCtrl.findObjectByInternalName("WindowCtrl", true), text);
        }
        public override void onDeactivated()
        {
            EditorGui EditorGui = "EditorGui";

            ParticleEditor.PE_Window PE_Window = "PE_Window";

            GuiControl WorldEditorToolbar = EditorGui.FOT("WorldEditorToolbar");

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

            if (sGlobal["$ParticleEditor::emitterNode"].isObject())
            {
                sGlobal["$ParticleEditor::emitterNode"].delete();
            }

            this.map.pop();

            base.onDeactivated();
        }
        public override void onActivated()
        {
            ParticleEditor ParticleEditor = "ParticleEditor";
            EditorGui      EditorGui      = "EditorGui";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            ParticleEditor.PE_Window     PE_Window          = "PE_Window";

            GuiControl WorldEditorToolbar = EditorGui.FOT("WorldEditorToolbar");

            //Copyright Winterleaf Entertainment L.L.C. 2013
            this["isActive"] = true.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!ParticleEditor["isInitialized"].AsBool())
            {
                ParticleEditor.initEditor();
                ParticleEditor["isInitialized"] = true.AsString();
            }

            WorldEditorToolbar.setVisible(true);
            EditorGui.bringToFront(PE_Window);
            PE_Window.setVisible(true);
            PE_Window.makeFirstResponder(true);

            this.map.push();

            ParticleEditor.resetEmitterNode();

            // Set the status bar here
            EditorGuiStatusBar.setInfo("Particle editor.");
            EditorGuiStatusBar.setSelection("");

            base.onActivated();
        }
Esempio n. 28
0
        public void syncBrushInfo()
        {
            GuiControl    TerrainBrushSizeTextEditContainer     = "TerrainBrushSizeTextEditContainer";
            GuiControl    TerrainBrushPressureTextEditContainer = "TerrainBrushPressureTextEditContainer";
            GuiControl    TerrainBrushSoftnessTextEditContainer = "TerrainBrushSoftnessTextEditContainer";
            GuiControl    TerrainSetHeightTextEditContainer     = "TerrainSetHeightTextEditContainer";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            GuiTextEditCtrl tTerrainBrushSizeTextEditContainer =
                TerrainBrushSizeTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushPressureTextEditContainer =
                TerrainBrushPressureTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushSoftnessTextEditContainer =
                TerrainBrushSoftnessTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainSetHeightTextEditContainer =
                TerrainSetHeightTextEditContainer.findObjectByInternalName("textEdit", true);

            tTerrainBrushSizeTextEditContainer.text     = Util.getWord(ETerrainEditor.getBrushSize(), 0);
            tTerrainBrushPressureTextEditContainer.text = (ETerrainEditor.getBrushPressure() * 100).AsString();
            tTerrainBrushSoftnessTextEditContainer.text = (ETerrainEditor.getBrushSoftness() * 100).AsString();
            tTerrainSetHeightTextEditContainer.text     = (ETerrainEditor.setHeightVal.AsString());

            string brushType = ETerrainEditor.getBrushType();

            Util.eval("EWTerrainEditToolbar-->" + brushType + ".setStateOn(1);");
        }
Esempio n. 29
0
 /// <description>
 /// Scroll the control so that the given child<paramref name="" /> control is visible.
 ///
 ///
 /// </description>
 /// <param name="control">A child control.</param>
 public void ScrollToObject(GuiControl control)
 {
     InternalUnsafeMethods.ScrollToObject__Args _args = new InternalUnsafeMethods.ScrollToObject__Args()
     {
         control = control.ObjectPtr,
     };
     InternalUnsafeMethods.ScrollToObject()(ObjectPtr, _args);
 }
Esempio n. 30
0
 public virtual void Dispose()
 {
     if (GuiControl != null)
     {
         GuiControl.Dispose();
         GuiControl = null;
     }
 }
        void HandleControl(GuiConfigDB conf, GuiControl gctl)
        {
            if (!Controls.ContainsKey(gctl.name))
                return;

            Control ct = Controls[gctl.name]; // find the existing control
            if (gctl.visible.IsExplicit())
                ct.Visible = gctl.visible.GetVal();
            ct.Width = gctl.w.GetIfExplicit(ct.Width);
            ct.Height = gctl.h.GetIfExplicit(ct.Height);
            //load some control locations as well,

            if (gctl.px.IsExplicit() || gctl.py.IsExplicit())
            {
                int px, py;
                px = gctl.px.GetIfExplicit(ct.Location.X);
                py = gctl.py.GetIfExplicit(ct.Location.Y);
                Point pt = new Point(px, py);
                ct.Location = pt;
            }

            // load docking style
            if (gctl.action.IsExplicit())
            {
                string action = gctl.action;  // telling something to happen to this control
                if (action.Contains("remove")) // this handles removing a control from it's parent
                {
                    // remove this control from it's parent
                    if (ct.Parent != null)
                    {
                        ct.Parent.Controls.Remove(ct);
                        ct.Parent = null;
                    }
                }
                else if (action.Contains("hide")) // this handles hiding
                {
                    // hide this control, do not remove it from the parent
                    ct.Hide();
                }
                else if (action.Contains("show")) // this handles showing
                {
                    // show this control
                    ct.Show();
                }
                else if (action.Contains("addto")) // this handles adding a new/existing control to a parent control
                {
                    // Get the name of the parent
                    // Get the name of the parent
                    string parentname = gctl.parent;
                    if (gctl.parent.IsExplicit() && (parentname != null) && (parentname.Length != 0))
                    {
                        //find the parent
                        //find the parent
                        if (Controls.ContainsKey(parentname))
                        {
                            Control ctlParent = Controls[parentname];
                            ctlParent.Controls.Add(ct);
                        }
                        else
                        {
                            DebugLogger.Instance().LogWarning("Control parent not found: " + parentname);
                        }
                    }
                }
            }

            String styleName = gctl.style.GetIfValid(null);
            GuiControlStyle style = conf.GetControlStyle(styleName);
            if (ct is ctlUserPanel)
            {
                ctlUserPanel ctl = (ctlUserPanel)ct;
                ctl.GuiAnchor = gctl.dock.GetIfExplicit(ctl.GuiAnchor);
                ctl.Gapx = gctl.x.GetIfExplicit(ctl.Gapx);
                ctl.Gapy = gctl.y.GetIfExplicit(ctl.Gapy);
                if (styleName != null)
                {
                    ctl.StyleName = styleName;
                    if (style != null)
                    {
                        ctl.GLVisible = style.glMode;
                        ctl.ApplyStyle(style);
                    }
                }
                //ctl.GLVisible = GetBoolParam(ctlnode, "gl", false);
                if (ctl.GLVisible)
                    ctl.GLBackgroundImage = gctl.BorderShape.GetIfExplicit(ctl.GLBackgroundImage);
                else
                    ctl.bgndPanel.imageName = gctl.BorderShape.GetIfExplicit(ctl.bgndPanel.imageName);
            }
            else
            {
                if (style != null)
                {
                    ApplyStyleRecurse(ct, style);
                }
            }
        }