protected MyGuiControlCompositePanel AddCompositePanel(MyGuiCompositeTexture texture, Vector2 position, Vector2 size, MyGuiDrawAlignEnum panelAlign)
        {
            var panel = new MyGuiControlCompositePanel()
            {
                BackgroundTexture = texture
            };
            panel.Position = position;
            panel.Size = size;
            panel.OriginAlign = panelAlign;
            Controls.Add(panel);

            return panel;
        }
        private void CreateFactionsPageControls(MyGuiControlTabPage page)
        {
            page.Name = "PageFactions";
            page.TextEnum = MySpaceTexts.TerminalTab_Factions;

            var left = -0.462f;
            var top = -0.34f;
            var spacingH = 0.0045f;
            var spacingV = 0.01f;
            var buttonSize = new Vector2(0.29f, 0.052f);
            var smallerBtn = new Vector2(0.13f, 0.04f);

            var factionsComposite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.4f, 0.69f),
                Name = "Factions"
            };
            left += spacingH;
            top += spacingV;

            var factionsPanel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionsComposite.Size.X - 0.01f, 0.035f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK
            };

            var factionsLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left + spacingH, top),
                size: factionsPanel.Size - new Vector2(0.01f, 0.01f),
                text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions)
            );
            top += factionsLabel.Size.Y + spacingV;

            var factionsTable = new MyGuiControlTable()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionsPanel.Size.X, 0.15f),
                Name = "FactionsTable",
                ColumnsCount = 3,
                VisibleRowsCount = 14,
            };
            factionsTable.SetCustomColumnWidths(new float[] { 0.16f, 0.75f, 0.09f });
            factionsTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Tag));
            factionsTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Name));
            top += factionsTable.Size.Y + spacingV;

            var createBtn      = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top)) { Name = "buttonCreate" };
            var joinBtn        = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonJoin" };
            var joinCancelBtn  = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonCancelJoin" };
            var leaveBtn       = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonLeave" };
            var sendPeaceBtn   = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonSendPeace" };
            var cancelPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonCancelPeace" };
            var acceptPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonAcceptPeace" };
            var enemyBtn       = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top + buttonSize.Y + spacingV)) { Name = "buttonEnemy" };

            page.Controls.Add(factionsComposite);
            page.Controls.Add(factionsPanel);
            page.Controls.Add(factionsLabel);
            page.Controls.Add(factionsTable);
            page.Controls.Add(createBtn);
            page.Controls.Add(joinBtn);
            page.Controls.Add(joinCancelBtn);
            page.Controls.Add(leaveBtn);
            page.Controls.Add(sendPeaceBtn);
            page.Controls.Add(cancelPeaceBtn);
            page.Controls.Add(acceptPeaceBtn);
            page.Controls.Add(enemyBtn);

            // Do the right side
            // reset left / top
            left = -0.0475f;
            top = -0.34f;

            var factionComposite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(-0.05f, top),
                Size = new Vector2(0.5f, 0.69f),
                Name = "compositeFaction"
            };
            left += spacingH;
            top += spacingV;

            var factionNamePanel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionComposite.Size.X - 0.012f, 0.035f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK,
                Name = "panelFactionName"
            };

            var factionName = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left + spacingH, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionName" };
            top += factionsLabel.Size.Y + (2f * spacingV);
            var size = factionNamePanel.Size - new Vector2(0.14f, 0.01f);

            var factionDescLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionDesc" };
            top += factionDescLabel.Size.Y + spacingV;

            var factionDesc = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE,
                position: new Vector2(left, top),
                size: new Vector2(size.X, 0.08f)
            )
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Name = "textFactionDesc",
            };
            top += factionDesc.Size.Y + 2f * spacingV;

            var factionPrivateLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionPrivate" };
            top += factionPrivateLabel.Size.Y + spacingV;

            var factionPrivate = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE,
                position: new Vector2(left, top),
                size: new Vector2(size.X, 0.08f)
            )
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Name = "textFactionPrivate",
            };
            top += factionDesc.Size.Y + 0.0275f;

            var labelFactionMembers = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionMembers" };


            var checkAcceptEveryone = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                position: new Vector2(factionNamePanel.Position.X + factionNamePanel.Size.X, top + spacingV)
            ) { Name = "checkFactionMembersAcceptEveryone" };

            var labelAcceptEveryone = new MyGuiControlLabel(
             originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
             position: new Vector2(checkAcceptEveryone.Position.X - checkAcceptEveryone.Size.X - spacingH, top),
             size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f)
         ) { Name = "labelFactionMembersAcceptEveryone" };


            var labelAcceptPeace = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2((17 * spacingH), top),
                size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionMembersAcceptPeace" };

            var checkAcceptPeace = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2((47 * spacingH), top + spacingV)
            ) { Name = "checkFactionMembersAcceptPeace" };



            top += factionPrivateLabel.Size.Y + spacingV;

            var membersTable = new MyGuiControlTable()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(size.X, 0.15f),
                Name = "tableMembers",
                ColumnsCount = 2,
                VisibleRowsCount = 8,
                HeaderVisible = false
            };
            membersTable.SetCustomColumnWidths(new float[] { 0.7f, 0.3f });
            membersTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Name));
            membersTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Status));

            var btnSpacing = smallerBtn.Y + spacingV;
            var editBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, factionDesc.Position.Y)) { Name = "buttonEdit" };
            var promBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y)) { Name = "buttonPromote" };
            var kickBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + btnSpacing)) { Name = "buttonKick" };
            var acceptJoin = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptJoin" };
            var demote = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 3f * btnSpacing)) { Name = "buttonDemote" };
            //var acceptPeace = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,    position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptPeace" };
            var addNpcToFaction = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 4f * btnSpacing)) { Name = "buttonAddNpc" };

            page.Controls.Add(factionComposite);
            page.Controls.Add(factionNamePanel);
            page.Controls.Add(factionName);
            page.Controls.Add(factionDescLabel);
            page.Controls.Add(factionDesc);
            page.Controls.Add(factionPrivateLabel);
            page.Controls.Add(factionPrivate);
            page.Controls.Add(labelFactionMembers);
            page.Controls.Add(labelAcceptEveryone);
            page.Controls.Add(labelAcceptPeace);
            page.Controls.Add(checkAcceptEveryone);
            page.Controls.Add(checkAcceptPeace);
            page.Controls.Add(membersTable);

            page.Controls.Add(editBtn);
            page.Controls.Add(promBtn);
            page.Controls.Add(kickBtn);
            page.Controls.Add(demote);
            page.Controls.Add(acceptJoin);
            page.Controls.Add(addNpcToFaction);
        }
        private void CreateControlPanelPageControls(MyGuiControlTabPage page)
        {
            page.Name      = "PageControlPanel";
            page.TextEnum  = MySpaceTexts.ControlPanel;
            page.TextScale = 0.9f;

            var functionalBlockSearch = new MyGuiControlTextbox()
            {
                Position = new Vector2(-0.4625f, -0.325f),
                Size = new Vector2(0.255f, 0.052f),
                Name = "FunctionalBlockSearch",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
            };

            var functionalBlockSearchClear = new MyGuiControlButton()
            {
                Position = new Vector2(-0.232f, -0.325f),
                Size = new Vector2(0.045f, 0.05666667f),
                Name = "FunctionalBlockSearchClear",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle = MyGuiControlButtonStyleEnum.Close,
                ActivateOnMouseRelease = true
            };

            var functionalBlockListbox = new MyGuiControlListbox()
            {
                Position = new Vector2(-0.4625f, 0.0225f),
                Size = new Vector2(0.29f, 0.5f),
                Name = "FunctionalBlockListbox",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisibleRowsCount = 16
            };

            var control = new MyGuiControlCompositePanel()
            {
                Position = new Vector2(-0.1525f, 0f),
                Size = new Vector2(0.615f, 0.7125f),
                Name = "Control",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                InnerHeight = 0.685f
            };

            var selectedBlockNamePanel = new MyGuiControlPanel()
            {
                Position = new Vector2(-0.1425f, -0.32f),
                Size = new Vector2(0.595f, 0.035f),
                Name = "SelectedBlockNamePanel",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK
            };

            var blockNameLabel = new MyGuiControlLabel()
            {
                Position = new Vector2(-0.1325f, -0.322f),
                Size = new Vector2(0.0470270254f, 0.0266666654f),
                Name = "BlockNameLabel",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                TextEnum = MySpaceTexts.Afterburner
            };

            var groupTitleLabel = new MyGuiControlLabel()
            {
                Position = new Vector2(0.17f, -0.27f),
                Size = new Vector2(0.0470270254f, 0.0266666654f),
                Name = "GroupTitleLabel",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                TextEnum = MySpaceTexts.Terminal_GroupTitle
            };

            var groupName = new MyGuiControlTextbox()
            {
                Position = new Vector2(0.165f, -0.23f),
                Size = new Vector2(0.29f, 0.052f),
                Name = "GroupName",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
            };

            var groupSave = new MyGuiControlButton()
            {
                Position = new Vector2(0.2f, -0.17f),
                Name = "GroupSave",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                TextEnum = MySpaceTexts.TerminalButton_GroupSave
            };

            var groupDelete = new MyGuiControlButton()
            {
                Position = new Vector2(0.4f, -0.17f),
                Size = new Vector2(0.045f, 0.05666667f),
                Name = "GroupDelete",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle = MyGuiControlButtonStyleEnum.Close
            };


            var showAll = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.SquareSmall,
                position: new Vector2(-0.205f, -0.345f),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                buttonScale:0.5f)
                {
                    Name = "ShowAll",
                };

                 
            page.Controls.Add(functionalBlockSearch);
            page.Controls.Add(functionalBlockSearchClear);
            page.Controls.Add(functionalBlockListbox);
            page.Controls.Add(control);
            page.Controls.Add(selectedBlockNamePanel);
            page.Controls.Add(blockNameLabel);
            page.Controls.Add(groupTitleLabel);
            page.Controls.Add(groupName);
            page.Controls.Add(groupSave);
            page.Controls.Add(showAll);
            page.Controls.Add(groupDelete);
        }
        private void CreateGpsPageControls(MyGuiControlTabPage gpsPage)
        {
            gpsPage.Name      = "PageIns";
            gpsPage.TextEnum = MySpaceTexts.TerminalTab_GPS;
            gpsPage.TextScale = 0.9f;
            var spacingH = 0.01f;
            var spacingV = 0.01f;
            var buttonSize = new Vector2(0.29f, 0.052f);
            var smallerBtn = new Vector2(0.13f, 0.04f);
            var left = -0.4625f;
            var top = -0.325f;

            var gpsBlockSearch = new MyGuiControlTextbox()
            {
                Position = new Vector2(left,top),
                Size = new Vector2(0.29f, 0.052f),
                Name = "SearchIns",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            var gpsBlockSearchClear = new MyGuiControlButton()
            {
                Position = new Vector2(left+gpsBlockSearch.Size.X, top+0.01f),
                Size = new Vector2(0.045f, 0.05666667f),
                Name = "SearchInsClear",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                VisualStyle = MyGuiControlButtonStyleEnum.Close,
                ActivateOnMouseRelease = true
            };
            top += gpsBlockSearch.Size.Y + spacingV;

            var gpsBlockTable = new MyGuiControlTable()
            {
                Position = new Vector2(left,top),
                Size = new Vector2(0.29f, 0.5f),
                Name = "TableINS",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                ColumnsCount = 1,
                VisibleRowsCount = 14,
                HeaderVisible=false
            };
            gpsBlockTable.SetCustomColumnWidths(new float[1]{1});
            top += gpsBlockTable.Size.Y + spacingV;

            //LEFT SIDE BUTTONS:
            var gpsButtonAdd = new MyGuiControlButton(
                position: new Vector2(left,top),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(140f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Add),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                Name = "buttonAdd"
            };
            var gpsButtonDelete = new MyGuiControlButton(
                position: new Vector2(left,top +gpsButtonAdd.Size.Y+spacingV),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(140f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Delete),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                Name = "buttonDelete"
            };
            var gpsButtonFromCurrent = new MyGuiControlButton(
                position: new Vector2(left+gpsButtonAdd.Size.X+spacingH,top),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(310f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_NewFromCurrent),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                Name = "buttonFromCurrent"
            };
            var gpsButtonFromClipboard = new MyGuiControlButton(
                position: new Vector2(left + gpsButtonAdd.Size.X + spacingH, top + gpsButtonAdd.Size.Y + spacingV),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(310f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_NewFromClipboard),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                Name = "buttonFromClipboard"
            };


            gpsPage.Controls.Add(gpsBlockSearch);
            gpsPage.Controls.Add(gpsBlockSearchClear);
            gpsPage.Controls.Add(gpsBlockTable);
            gpsPage.Controls.Add(gpsButtonAdd);
            gpsPage.Controls.Add(gpsButtonDelete);
            gpsPage.Controls.Add(gpsButtonFromCurrent);
            gpsPage.Controls.Add(gpsButtonFromClipboard);


            //RIGHT SIDE:
            left = -0.15f;
            top = -0.325f;
            var gpsComposite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.6f, 0.39f),
                Name = "compositeIns"
            };
            left += spacingH;
            top += spacingV+0.05f;

            var gpsNameLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top),
                size: new Vector2(0.4f, 0.035f)
            ) { Name = "labelInsName",
                Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Name).ToString()
            };
            var gpsNamePanel = new MyGuiControlTextbox(maxLength:32)
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Position = new Vector2(left + spacingH + gpsNameLabel.Size.X, top),
                Size = new Vector2(gpsComposite.Size.X - spacingH - gpsNameLabel.Size.X - spacingH -0.01f, 0.035f),
                Name = "panelInsName"
            };

            top += gpsNamePanel.Size.Y + (2f * spacingV);

            var size = gpsNamePanel.Size - new Vector2(0.14f, 0.01f);

            var gpsDescLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top),
                //size: insNamePanel.Size - new Vector2(0.01f, 0.01f)
                size : new Vector2(gpsComposite.Size.X - 0.012f, 0.035f)
            ){
                Name = "labelInsDesc",
                Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Description).ToString()
            };
            top += gpsDescLabel.Size.Y + spacingV;

            var gpsDescText = new MyGuiControlTextbox(
                position: new Vector2(left, top),
                maxLength:255
            )
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Name = "textInsDesc",
                Size= new Vector2(gpsComposite.Size.X - 2*spacingH, 0.035f)
            };
            top += gpsDescText.Size.Y + 2f * spacingV;

            //X,Y,Z:
            var gpsLabelX = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top),
                size : new Vector2(0.01f, 0.035f),
                text : MyTexts.Get(MySpaceTexts.TerminalTab_GPS_X).ToString()
            )
            {
                Name = "labelInsX",
            };
            left += gpsLabelX.Size.X+spacingH;
            var gpsXCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Position = new Vector2(left, top),
                Size = new Vector2((gpsComposite.Size.X - spacingH )/ 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f),
                Name = "textInsX"
            };
            left += gpsXCoord.Size.X + spacingH;

            var gpsLabelY = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top),
                //size: new Vector2(0.01f, 0.035f),
                size : new Vector2(gpsComposite.Size.X - 0.012f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Y).ToString()
                //size: new Vector2(0.4f, 0.035f)
            )
            {
                Name = "labelInsY"
            };
            left += gpsLabelX.Size.X + spacingH;
            var gpsYCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Position = new Vector2(left, top),
                Size = new Vector2((gpsComposite.Size.X - spacingH) / 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f),
                Name = "textInsY"
            };
            left += gpsYCoord.Size.X + spacingH;

            var gpsLabelZ = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Z).ToString()
                //size: new Vector2(0.4f, 0.035f)
            )
            {
                Name = "labelInsZ",
            };
            left += gpsLabelX.Size.X + spacingH;
            var gpsZCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                Position = new Vector2(left, top),
                Size = new Vector2((gpsComposite.Size.X - spacingH) / 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f),
                Name = "textInsZ"
            };
            top += gpsNamePanel.Size.Y + (2f * spacingV);

            //BUTTONS:
            left = spacingH-0.15f;

            //SHOW ON HUD & COPY TO CLIPBOARD:
            var checkGpsShowOnHud = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top)
            ) { Name = "checkInsShowOnHud" };

            var labelGpsShowOnHud = new MyGuiControlLabel(
             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
             position: new Vector2(left+ checkGpsShowOnHud.Size.X + spacingH, top),
             size: checkGpsShowOnHud.Size - new Vector2(0.01f, 0.01f)
            )
            {
                Name = "labelInsShowOnHud",
                Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_ShowOnHud).ToString()
            };

            var toClipboardButton = new MyGuiControlButton(
                position: new Vector2(gpsComposite.Position.X+gpsComposite.Size.X-spacingH, top),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(300f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_CopyToClipboard),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER)
            {
                Name = "buttonToClipboard"
            };

            top += toClipboardButton.Size.Y * 1.1f;
            var checkGpsAlwaysVisible = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2(left, top)
            )
            {
                Name = "checkInsAlwaysVisible",
            };
            checkGpsAlwaysVisible.SetToolTip(MySpaceTexts.TerminalTab_GPS_AlwaysVisible_Tooltip);

            var labelGpsAlwaysVisible = new MyGuiControlLabel(
             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
             position: new Vector2(left + checkGpsShowOnHud.Size.X + spacingH, top),
             size: checkGpsShowOnHud.Size - new Vector2(0.01f, 0.01f)
            )
            {
                Name = "labelInsAlwaysVisible",
                Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_AlwaysVisible).ToString()
            };
            labelGpsAlwaysVisible.SetToolTip(MySpaceTexts.TerminalTab_GPS_AlwaysVisible_Tooltip);

            top += checkGpsShowOnHud.Size.Y;
            var labelIllegalDataWarning = new MyGuiControlLabel(
             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
             position: new Vector2(left + spacingH, top),
             size: new Vector2(gpsComposite.Size.X - 0.012f, 0.035f)
            )
            {
                Name = "TerminalTab_GPS_SaveWarning",
                Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_SaveWarning).ToString(),
                ColorMask = Color.Red.ToVector4()
            };

            gpsPage.Controls.Add(gpsComposite);
            gpsPage.Controls.Add(gpsNamePanel);
            gpsPage.Controls.Add(gpsNameLabel);
            gpsPage.Controls.Add(gpsDescLabel);
            gpsPage.Controls.Add(gpsDescText);

            gpsPage.Controls.Add(gpsLabelX);
            gpsPage.Controls.Add(gpsXCoord);
            gpsPage.Controls.Add(gpsLabelY);
            gpsPage.Controls.Add(gpsYCoord);
            gpsPage.Controls.Add(gpsLabelZ);
            gpsPage.Controls.Add(gpsZCoord);

            gpsPage.Controls.Add(toClipboardButton);

            gpsPage.Controls.Add(checkGpsShowOnHud);
            gpsPage.Controls.Add(labelGpsShowOnHud);

            gpsPage.Controls.Add(labelIllegalDataWarning);

            gpsPage.Controls.Add(checkGpsAlwaysVisible);
            gpsPage.Controls.Add(labelGpsAlwaysVisible);
        }
        private void CreateProductionPageControls(MyGuiControlTabPage productionPage)
        {
            productionPage.Name = "PageProduction";
            productionPage.TextEnum = MySpaceTexts.TerminalTab_Production;

            float columnSpacing = 0.03f;
            float controlSpacing = 0.01f;
            float smallBackgroundPanelHeight = 0.05f;
            float largeBackgroundPanelHeight = 0.08f;

            var assemblersCombobox = new MyGuiControlCombobox(
                position: -0.5f * productionPage.Size + new Vector2(0f, controlSpacing))
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    Name = "AssemblersCombobox"
                };

            var blueprintsBackgroundPanel = new MyGuiControlPanel(
                position: assemblersCombobox.Position + new Vector2(0f, assemblersCombobox.Size.Y + controlSpacing),
                size: new Vector2(1f, largeBackgroundPanelHeight),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
                {
                    BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
                    Name = "BlueprintsBackgroundPanel",
                };

            var blueprintsLabel = new MyGuiControlLabel(
                position: blueprintsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing),
                text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Blueprints),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
                {
                    Name = "BlueprintsLabel"
                };
            var blueprintsGrid = new MyGuiControlGrid()
            {
                VisualStyle = MyGuiControlGridStyleEnum.Toolbar,
                RowsCount = MyTerminalProductionController.BLUEPRINT_GRID_ROWS,
                ColumnsCount = 4,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            var blueprintsScrollableArea = new MyGuiControlScrollablePanel(
                scrolledControl: blueprintsGrid)
                {
                    Name = "BlueprintsScrollableArea",
                    ScrollbarVEnabled = true,
                    Position = blueprintsBackgroundPanel.Position + new Vector2(0f, blueprintsBackgroundPanel.Size.Y),
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
                    Size = new Vector2(blueprintsBackgroundPanel.Size.X, 0.5f),
                    ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
                };
            blueprintsScrollableArea.FitSizeToScrolledControl();
            assemblersCombobox.Size = new Vector2(blueprintsScrollableArea.Size.X, assemblersCombobox.Size.Y);
            blueprintsBackgroundPanel.Size = new Vector2(blueprintsScrollableArea.Size.X, largeBackgroundPanelHeight);
            blueprintsGrid.RowsCount = 20;

            productionPage.Controls.Add(assemblersCombobox);
            productionPage.Controls.Add(blueprintsBackgroundPanel);
            productionPage.Controls.Add(blueprintsLabel);
            productionPage.Controls.Add(blueprintsScrollableArea);

            var materialsBackgroundPanel = new MyGuiControlPanel(
                position: blueprintsBackgroundPanel.Position + new Vector2(blueprintsBackgroundPanel.Size.X + columnSpacing, 0f),
                size: new Vector2(blueprintsBackgroundPanel.Size.X, smallBackgroundPanelHeight),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
                {
                    BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK
                };

            var materialsLabel = new MyGuiControlLabel(
                position: materialsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing),
                text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_StoredMaterials),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            );

            var materialsList = new MyGuiControlComponentList()
            {
                Position = materialsBackgroundPanel.Position + new Vector2(0f, materialsBackgroundPanel.Size.Y),
                Size = new Vector2(materialsBackgroundPanel.Size.X, blueprintsBackgroundPanel.Size.Y + blueprintsScrollableArea.Size.Y - materialsBackgroundPanel.Size.Y),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_NEUTRAL,
                Name = "MaterialsList",
            };

            productionPage.Controls.Add(materialsBackgroundPanel);
            productionPage.Controls.Add(materialsLabel);
            productionPage.Controls.Add(materialsList);

            var assemblingButton = new MyGuiControlRadioButton(
                position: materialsBackgroundPanel.Position + new Vector2(materialsBackgroundPanel.Size.X + columnSpacing, 0f),
                size: new Vector2(200f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE)
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_COMPONENT,
                    IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                    TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                    Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_AssemblingButton),
                    Name = "AssemblingButton",
                };
            assemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_AssemblingMode);

            var disassemblingButton = new MyGuiControlRadioButton(
                position: assemblingButton.Position + new Vector2(assemblingButton.Size.X + controlSpacing, 0f),
                size: new Vector2(238f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE)
                {
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_DISASSEMBLY,
                    IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                    TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                    Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassemblingButton),
                    Name = "DisassemblingButton",
                };
            disassemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_DisassemblingMode);

            var queueBackgroundPanel = new MyGuiControlCompositePanel()
            {
                Position = assemblingButton.Position + new Vector2(0f, assemblingButton.Size.Y + controlSpacing),
                Size = new Vector2(0.4f, largeBackgroundPanelHeight),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
            };
            var queueLabel = new MyGuiControlLabel(
                position: queueBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing),
                text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_ProductionQueue),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            );
            var queueGrid = new MyGuiControlGrid()
            {
                VisualStyle = MyGuiControlGridStyleEnum.Toolbar,
                RowsCount = 2,
                ColumnsCount = 6,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };
            var queueScrollableArea = new MyGuiControlScrollablePanel(
                scrolledControl: queueGrid)
                {
                    Name = "QueueScrollableArea",
                    ScrollbarVEnabled = true,
                    Position = queueBackgroundPanel.Position + new Vector2(0f, queueBackgroundPanel.Size.Y),
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
                    ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
                };
            queueScrollableArea.FitSizeToScrolledControl();
            queueGrid.RowsCount = 10;
            queueBackgroundPanel.Size = new Vector2(queueScrollableArea.Size.X, queueBackgroundPanel.Size.Y);

            var repeatCheckbox = new MyGuiControlCheckbox(
                position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - controlSpacing, controlSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_RepeatMode),
                visualStyle: MyGuiControlCheckboxStyleEnum.Repeat)
                {
                    Name = "RepeatCheckbox",
                };

            var slaveCheckbox = new MyGuiControlCheckbox(
                position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - 0.1f - controlSpacing, controlSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_SlaveMode),
                visualStyle: MyGuiControlCheckboxStyleEnum.Slave)
            {
                Name = "SlaveCheckbox",
            };

            var inventoryBackgroundPanel = new MyGuiControlCompositePanel()
            {
                Position = queueScrollableArea.Position + new Vector2(0f, queueScrollableArea.Size.Y + controlSpacing),
                Size = new Vector2(0.4f, largeBackgroundPanelHeight),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
            };
            var inventoryLabel = new MyGuiControlLabel(
                position: inventoryBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing),
                text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Inventory),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            );
            var inventoryGrid = new MyGuiControlGrid()
            {
                VisualStyle = MyGuiControlGridStyleEnum.Toolbar,
                RowsCount = 3,
                ColumnsCount = 6,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };
            var inventoryScrollableArea = new MyGuiControlScrollablePanel(
                scrolledControl: inventoryGrid)
                {
                    Name = "InventoryScrollableArea",
                    ScrollbarVEnabled = true,
                    Position = inventoryBackgroundPanel.Position + new Vector2(0f, inventoryBackgroundPanel.Size.Y),
                    OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
                    ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
                };
            inventoryScrollableArea.FitSizeToScrolledControl();
            inventoryGrid.RowsCount = 10;
            inventoryBackgroundPanel.Size = new Vector2(inventoryScrollableArea.Size.X, inventoryBackgroundPanel.Size.Y);
            var disassembleAllButton = new MyGuiControlButton(
                position: inventoryBackgroundPanel.Position + new Vector2(inventoryBackgroundPanel.Size.X - controlSpacing, controlSpacing),
                size: new Vector2(220f, 40f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassembleAllButton),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_DisassembleAll))
                {
                    Name = "DisassembleAllButton",
                };

            var inventoryButton = new MyGuiControlButton(
                position: inventoryScrollableArea.Position + new Vector2(0f, inventoryScrollableArea.Size.Y + controlSpacing),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: new Vector2(214f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_InventoryButton))
                {
                    Name = "InventoryButton",
                };

            var controlPanelButton = new MyGuiControlButton(
                position: inventoryButton.Position + new Vector2(inventoryButton.Size.X + controlSpacing, 0f),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                size: inventoryButton.Size,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_ControlPanelButton))
                {
                    Name = "ControlPanelButton",
                };

            productionPage.Controls.Add(assemblingButton);
            productionPage.Controls.Add(disassemblingButton);
            productionPage.Controls.Add(queueBackgroundPanel);
            productionPage.Controls.Add(queueLabel);
            productionPage.Controls.Add(repeatCheckbox);
            productionPage.Controls.Add(slaveCheckbox);
            productionPage.Controls.Add(queueScrollableArea);
            productionPage.Controls.Add(inventoryBackgroundPanel);
            productionPage.Controls.Add(inventoryLabel);
            productionPage.Controls.Add(disassembleAllButton);
            productionPage.Controls.Add(inventoryScrollableArea);
            productionPage.Controls.Add(inventoryButton);
            productionPage.Controls.Add(controlPanelButton);
        }
        public override void RecreateControls(bool constructor)
        {
            var titlePos = new Vector2(0f, -0.3f);
            var descSize = m_descSize;
            var descPosition = new Vector2(-descSize.X/2, titlePos.Y + 0.10f);
            var objSize = new Vector2(0.2f, 0.3f);
            var objOffset = new Vector2(0.32f, 0f);
            var padding = new Vector2(0.005f, 0f);

            var curObjPos = new Vector2(0f, titlePos.Y + 0.05f);

            base.RecreateControls(constructor);

            CloseButtonEnabled = true;

            m_okButton = new MyGuiControlButton(position: new Vector2(0f, 0.29f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: m_okButtonCaption , onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_okButton);

            m_titleLabel = new MyGuiControlLabel(text: m_missionTitle, position: titlePos, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textScale: 1.5f);
            Controls.Add(m_titleLabel);
            
            m_currentObjectiveLabel = new MyGuiControlLabel(position: curObjPos, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textScale: 1f);
            Controls.Add(m_currentObjectiveLabel);
            SetCurrentObjective(m_currentObjective);
 

            m_descriptionBackgroundPanel = AddCompositePanel(MyGuiConstants.TEXTURE_RECTANGLE_DARK, descPosition, descSize, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            m_descriptionBox = AddMultilineText(offset: descPosition + padding, size: descSize, selectable: false);
            m_descriptionBox.Text = new StringBuilder(m_description);
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            var left       = -0.23f;
            var top        = -0.23f;
            var spacingV   =  0.045f;
            var buttonSize = new Vector2(0.29f, 0.052f);

            var composite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.46f, 0.46f)
            };
            left += 0.005f;
            top  += 0.007f;

            var panel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.451f, 0.038f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK
            };
            left += 0.005f;
            top  += 0.003f;

            // LABELS
            var headerText = MyTexts.GetString((m_editFaction == null) ? MySpaceTexts.TerminalTab_Factions_CreateFaction : MySpaceTexts.TerminalTab_Factions_EditFaction);
            var headerLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top), text: headerText);
            top += 0.01f;
            var shortcutLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionTag));
            var nameLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 2f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionName));
            var descLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 3f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription));
            var secretLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 4f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfo));

            shortcutLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip);
            secretLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip);

            Controls.Add(composite);
            Controls.Add(panel);
            Controls.Add(headerLabel);
            Controls.Add(shortcutLabel);
            Controls.Add(nameLabel);
            Controls.Add(descLabel);
            Controls.Add(secretLabel);

            // INPUTS
            var iLeft =  0.06f;
            var iTop  = -0.15f;

            m_shortcut = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop),                 maxLength: 3,   defaultText: (m_editFaction != null) ? m_editFaction.Tag : "");
            m_name     = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + spacingV),      maxLength: 64,  defaultText: (m_editFaction != null) ? m_editFaction.Name : "");
            m_desc     = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 2f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.Description : "");
            m_privInfo = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 3f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.PrivateInfo : "");

            m_shortcut.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip);
            m_privInfo.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip);

            Controls.Add(m_shortcut);
            Controls.Add(m_name);
            Controls.Add(m_desc);
            Controls.Add(m_privInfo);

            // BUTTONS
            top  -= 0.003f;

            Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(left, -top), text: MyTexts.Get(MySpaceTexts.Ok), onButtonClick: OnOkClick));
            Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(-left, -top), text: MyTexts.Get(MySpaceTexts.Cancel), onButtonClick: OnCancelClick));
        }
        private void AddSeparator(string sectionName)
        {
            var panel = new MyGuiControlCompositePanel()
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = Vector2.Zero
            };

            var label = new MyGuiControlLabel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Text = sectionName,
                Font = MyFontEnum.Blue,
                PositionX = 0.005f
            };

            var imageOffset = 0.003f;
            var colorMask = MyGuiConstants.THEMED_GUI_LINE_COLOR;
            var img = new MyGuiControlImage(textures: new[] { @"Textures\GUI\FogSmall3.dds" })
            {
                Size = new Vector2(label.Size.X + imageOffset * 10, 0.007f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                //ColorMask = new Vector4(0,0,0,1),
                ColorMask = colorMask.ToVector4(),
                Position = new Vector2(-imageOffset, label.Size.Y)
            };

            var parent = new MyGuiControlParent
            {
                Size = new Vector2(m_campaignList.Size.X, label.Size.Y),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = Vector2.Zero
            };

            panel.Size = parent.Size + new Vector2(-0.035f, 0.01f);

            panel.Position -= parent.Size / 2 - new Vector2(-0.01f, 0f);
            label.Position -= parent.Size / 2;
            img.Position -= parent.Size / 2;

            parent.Controls.Add(panel);
            parent.Controls.Add(img);
            parent.Controls.Add(label);

            m_campaignList.Controls.Add(parent);
        }
        private void InitRightSide()
        {
            Vector2 originL;
            originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);

            var screenSize = m_size.Value;
            var layoutSize = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM);
            var columnWidthLabel = layoutSize.X * 0.25f;
            var columnWidthControl = layoutSize.X - columnWidthLabel;
            var rowHeight = 0.052f;
            var leftHeight = layoutSize.Y - 4 * rowHeight;
            var descriptionMargin = 0.005f;

            m_tableLayout = new MyLayoutTable(this, originL, layoutSize);
            m_tableLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl);
            m_tableLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, leftHeight);

            m_nameLabel = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.Name), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, position: new Vector2(0, 0.2f));
            m_nameTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
            m_nameTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            m_nameTextbox.Enabled = false;

            float width = m_nameTextbox.Size.X;

            m_difficultyLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.Difficulty), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_difficultyCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_difficultyCombo.Enabled = false;
            m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy);
            m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal);
            m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard);

            m_onlineModeLabel = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.WorldSettings_OnlineMode), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_onlineMode = new MyGuiControlCheckbox(originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
            m_onlineMode.Enabled = false;

            m_descriptionMultilineText = new MyGuiControlMultilineText(
                    selectable: false,
                    font: MyFontEnum.Blue)
            {
                Name = "BriefingMultilineText",
                Position = new Vector2(-0.009f, -0.115f),
                Size = new Vector2(0.419f, 0.412f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
            };

            var panel = new MyGuiControlCompositePanel()
            {
                BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
            };


            m_tableLayout.Add(m_nameLabel, MyAlignH.Left, MyAlignV.Center, 0, 0);
            m_tableLayout.Add(m_difficultyLabel, MyAlignH.Left, MyAlignV.Center, 2, 0);
            m_tableLayout.Add(m_onlineModeLabel, MyAlignH.Left, MyAlignV.Center, 3, 0);

            m_tableLayout.Add(m_nameTextbox, MyAlignH.Left, MyAlignV.Center, 0, 1);
            m_tableLayout.Add(m_difficultyCombo, MyAlignH.Left, MyAlignV.Center, 2, 1);
            m_tableLayout.Add(m_onlineMode, MyAlignH.Left, MyAlignV.Center, 3, 1);

            m_tableLayout.Add(panel, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);
            m_tableLayout.Add(m_descriptionMultilineText, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2);
            m_descriptionMultilineText.Position = new Vector2(panel.Position.X + descriptionMargin, panel.Position.Y);
            panel.Size = new Vector2(m_nameTextbox.Size.X + columnWidthLabel, m_tableLayout.GetCellSize(4, 0).Y + 0.01f);
            m_descriptionMultilineText.Size = new Vector2(panel.Size.X - descriptionMargin, m_tableLayout.GetCellSize(4, 0).Y - descriptionMargin + 0.01f);

            var buttonsOrigin = m_size.Value / 2 - new Vector2(0.365f, 0.03f);
            var buttonSize = MyGuiConstants.BACK_BUTTON_SIZE;
            // Ok/Cancel
            var okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            var cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            Controls.Add(okButton);
            Controls.Add(cancelButton);

            CloseButtonEnabled = true;
        }