Esempio n. 1
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. 2
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. 3
0
        /// Create a new GuiControl and move all the controls contained in the GuiEditorGroup into it.
        public void group()
        {
            GuiControl parent = this.groupParent;

            // Create group.

            GuiControl group = new ObjectCreator("GuiControl").Create();

            parent.addGuiControl(group);
            this.groupObject = group;

            // Make group fit around selection.

            string bounds          = this.getGlobalBounds();
            string parentGlobalPos = parent.getGlobalPosition().AsString();

            int x = Util.getWord(bounds, 0).AsInt() - Util.getWord(parentGlobalPos, 0).AsInt();
            int y = Util.getWord(bounds, 1).AsInt() - Util.getWord(parentGlobalPos, 1).AsInt();

            group.setPosition(x, y);
            group.setExtent(new Point2F(Util.getWord(bounds, 2).AsFloat(), Util.getWord(bounds, 3).AsFloat()));

            // Reparent all objects to group.

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

                // Save parent for undo.

                this["ctrlParent[" + i + "]"] = ctrl.parentGroup;

                // Reparent.

                group.addGuiControl(ctrl);

                // Move into place in new parent.

                string pos = ctrl.getPosition().AsString();
                ctrl.setPosition(Util.getWord(pos, 0).AsInt() - x, Util.getWord(pos, 1).AsInt() - y);
            }
        }
Esempio n. 4
0
        public static void Init()
        {
            GuiControl AL_ShadowVizOverlayCtrl = new GuiControl("AL_ShadowVizOverlayCtrl")
            {
                CanSaveDynamicFields = false,
                IsContainer          = true,
                Profile        = Sim.FindObject <GuiControlProfile>("GuiModelessDialogProfile"),
                HorizSizing    = GuiHorizontalSizing.Right,
                VertSizing     = GuiVerticalSizing.Bottom,
                Position       = new Point2I(0, 0),
                Extent         = new Point2I(1024, 768),
                MinExtent      = new Point2I(8, 8),
                CanSave        = true,
                Visible        = true,
                TooltipProfile = Sim.FindObject <GuiControlProfile>("GuiToolTipProfile"),
                Hovertime      = 1000
            };

            AL_ShadowVizOverlayCtrl.setFieldValue("noCursor", "true");

            GuiWindowCtrl windowCtrl = new GuiWindowCtrl()
            {
                InternalName         = "WindowCtrl",
                CanSaveDynamicFields = false,
                IsContainer          = true,
                Profile        = Sim.FindObject <GuiControlProfile>("GuiWindowProfile"),
                HorizSizing    = GuiHorizontalSizing.Right,
                VertSizing     = GuiVerticalSizing.Bottom,
                Position       = new Point2I(50, 50),
                Extent         = new Point2I(347, 209),
                MinExtent      = new Point2I(150, 100),
                CanSave        = true,
                Visible        = true,
                TooltipProfile = Sim.FindObject <GuiControlProfile>("GuiToolTipProfile"),
                Hovertime      = 1000,
                Margin         = new RectSpacingI(0, 0, 0, 0),
                Padding        = new RectSpacingI(0, 0, 0, 0),
                AnchorTop      = true,
                AnchorBottom   = false,
                AnchorLeft     = true,
                AnchorRight    = false,
                ResizeWidth    = true,
                ResizeHeight   = true,
                CanMove        = true,
                CanClose       = true,
                CanMinimize    = false,
                CanMaximize    = true,
                //todo minSize = "50 50"
                EdgeSnap     = true,
                Text         = "ShadowViz",
                CloseCommand = "toggleShadowViz();"
            };

            GuiMaterialCtrl materialCtrl = new GuiMaterialCtrl()
            {
                InternalName         = "MatCtrl",
                CanSaveDynamicFields = false,
                IsContainer          = false,
                Profile        = Sim.FindObject <GuiControlProfile>("GuiDefaultProfile"),
                HorizSizing    = GuiHorizontalSizing.Width,
                VertSizing     = GuiVerticalSizing.Height,
                Position       = new Point2I(3, 23),
                Extent         = new Point2I(341, 181),
                MinExtent      = new Point2I(8, 2),
                CanSave        = true,
                Visible        = true,
                TooltipProfile = Sim.FindObject <GuiControlProfile>("GuiToolTipProfile"),
                Hovertime      = 1000,
                Docking        = GuiDockingType.Client,
                Margin         = new RectSpacingI(2, 2, 2, 2),
                Padding        = new RectSpacingI(0, 0, 0, 0),
                AnchorTop      = true,
                AnchorBottom   = false,
                AnchorLeft     = true,
                AnchorRight    = false,
                MaterialName   = "AL_ShadowVisualizeMaterial"
            };

            materialCtrl.registerObject();
            windowCtrl.addGuiControl(materialCtrl);
            windowCtrl.registerObject();
            AL_ShadowVizOverlayCtrl.addGuiControl(windowCtrl);
            AL_ShadowVizOverlayCtrl.registerObject();
        }