コード例 #1
0
        public UI_LibraryEdit_Window(Pos pos, Point size, string Title, Point minsize, Generic_Conf conf, bool IsResizeable = true) : base(pos, size, Title, minsize, conf, IsResizeable)
        {
            Libraries = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero);
            Libraries.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false));
            AddButton  = new UI_StringButton(new Pos(-bezelsize, ORIGIN.BR, ORIGIN.BR), new Point(UI_Handler.buttonwidth, UI_Handler.buttonheight), "Add", true, UI_Handler.genbutconf);
            Open       = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, AddButton), new Point((int)(UI_Handler.buttonwidth), UI_Handler.buttonheight), "Open", true, UI_Handler.genbutconf);
            SaveAll    = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, Open), new Point((int)(UI_Handler.buttonwidth * 1.5), UI_Handler.buttonheight), "Save All", true, UI_Handler.genbutconf);
            RenameBox1 = new UI_ValueInput(new Pos(0, 0), Point.Zero, UI_Handler.genbutconf, 3);
            RenameBox2 = new UI_ValueInput(new Pos(0, 0), Point.Zero, UI_Handler.componentconf, 3);


            Add_UI_Elements(RenameBox1, RenameBox2, AddButton, Open, SaveAll);
            Add_UI_Elements(Libraries);


            UI_Handler.EditLib.ui_elements[0].GotActivatedLeft += RenameLib;
            UI_Handler.EditLib.ui_elements[1].GotActivatedLeft += AddComp;
            UI_Handler.EditLib.ui_elements[2].GotActivatedLeft += DeleteLib;

            UI_Handler.EditComp.ui_elements[0].GotActivatedLeft += RenameComp;
            UI_Handler.EditComp.ui_elements[1].GotActivatedLeft += DeleteComp;

            RenameBox1.ValueChanged    += RenameLib_Finish;
            RenameBox2.ValueChanged    += RenameComp_Finish;
            Open.GotActivatedLeft      += OpenLib;
            AddButton.GotActivatedLeft += NewLib;
            SaveAll.GotActivatedLeft   += SaveAllChanges;
        }
コード例 #2
0
        public UI_ProjectLibrary_Window(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable)
        {
            Libraries = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero);
            Libraries.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false));
            AddButton = new UI_StringButton(new Pos(-bezelsize, ORIGIN.BR, ORIGIN.BR), new Point(UI_Handler.buttonwidth, UI_Handler.buttonheight), "Add", true, UI_Handler.genbutconf);
            Reload    = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, AddButton), new Point((int)(UI_Handler.buttonwidth * 1.5), UI_Handler.buttonheight), "Reload", true, UI_Handler.genbutconf);
            Add_UI_Elements(AddButton, Reload);
            Add_UI_Elements(Libraries);


            AddButton.GotActivatedLeft += OpenLib;
            Reload.GotActivatedLeft    += ReloadComponentBox;
            UI_Handler.EditProjectLib.ui_elements[0].GotActivatedLeft += RemoveLib;
        }
コード例 #3
0
 public UI_ComponentBox(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable)
 {
     Catagories = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero);
     Catagories.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false));
     Add_UI_Elements(Catagories);
 }
コード例 #4
0
        public UI_EditComp_Window(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable)
        {
            UI_String spooky             = new UI_String(new Pos(0), Point.Zero, conf, "");
            UI_String Box_Name_Label     = new UI_String(new Pos(bezelsize, bezelsize + headheight), Point.Zero, UI_Handler.genbutconf, "Name:");
            UI_String Box_Category_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Box_Name_Label), Point.Zero, UI_Handler.genbutconf, "Category: ");

            int longestLabelX = (int)(UI_Handler.genbutconf.font.MeasureString("Category: ").X);

            Box_Name = new UI_ValueInput(new Pos(longestLabelX, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, Box_Name_Label), new Point(size.X / 3, (int)(UI_Handler.genbutconf.font.MeasureString("Test").Y)), UI_Handler.genbutconf, 3, 24);
            Box_Name.ValueChanged     += BoxName_ValueChange;
            Box_Category               = new UI_ValueInput(new Pos(longestLabelX, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, Box_Category_Label), new Point(size.X / 3, (int)(UI_Handler.genbutconf.font.MeasureString("Test").Y)), UI_Handler.genbutconf, 3, 24);
            Box_Category.ValueChanged += BoxCategory_ValueChange;


            Features = new UI_Scrollable <UI_Element>(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Box_Category_Label), Point.Zero);
            UI_String SimCode_FuncName_Label = new UI_String(new Pos(5, 5), Point.Zero, UI_Handler.genbutconf, "SC Func. Name: ");
            //UI_String AfterSimCode_FuncName_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, SimCode_FuncName_Label), Point.Zero, UI_Handler.genbutconf, "PSC Func. Name: ");
            UI_String InternalState_Length_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, SimCode_FuncName_Label), Point.Zero, UI_Handler.genbutconf, "Int. State Length: ");
            UI_String ClickType_Label            = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, InternalState_Length_Label), Point.Zero, UI_Handler.genbutconf, "Click Type: ");

            int longestLabelX2 = (int)(UI_Handler.genbutconf.font.MeasureString("Int. State Length: ").X);

            Box_SimCode_FuncName = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, SimCode_FuncName_Label), new Point(size.X / 3, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);
            //Box_AfterSimCode_FuncName = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, AfterSimCode_FuncName_Label), new Point(size.X / 3, AfterSimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);
            Box_InternalState_Length = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, InternalState_Length_Label), new Point(size.X / 3, InternalState_Length_Label.size.Y), UI_Handler.genbutconf, 1, 24);
            Box_ClickType            = new UI_ValueInput(new Pos(0, 0, ORIGIN.TR, ORIGIN.DEFAULT, ClickType_Label), new Point((int)(UI_Handler.genbutconf.font.MeasureString("00").X), InternalState_Length_Label.size.Y), UI_Handler.genbutconf, 1, 1);


            Code_Sim_Button = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, ClickType_Label), new Point((int)(UI_Handler.buttonwidth * 1.8), UI_Handler.buttonheight), "Edit Sim Code", true, UI_Handler.genbutconf);
            //Code_AfterSim_Button = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Code_Sim_Button), new Point((int)(UI_Handler.buttonwidth * 2.4), UI_Handler.buttonheight), "Edit After-Sim Code", true, UI_Handler.genbutconf);

            rotbuttons = new UI_StringButton[8];
            for (int i = 0; i < 8; ++i)
            {
                if (i == 0)
                {
                    rotbuttons[i] = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Code_Sim_Button), new Point(25, 25), i.ToString(), true, UI_Handler.behave1conf);
                }
                else
                {
                    rotbuttons[i] = new UI_StringButton(new Pos(5, 0, ORIGIN.TR, ORIGIN.DEFAULT, rotbuttons[i - 1]), new Point(25, 25), i.ToString(), true, UI_Handler.behave1conf);
                }
                rotbuttons[i].GotToggledLeft += RotButtonPressed;
            }
            rotbuttons[0].IsActivated = true;
            gridpaint = new UI_GridPaint(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, rotbuttons[0]), new Point(450), 300, new Point(150), new Point(-2, 6), UI_Handler.gridpaintbuttonconf);
            gridpaint.UpdateFunctions.Add(delegate()
            {
                if (new Rectangle(gridpaint.absolutpos, gridpaint.size).Contains(App.mo_states.New.Position))
                {
                    Features.DenyScroll = true;
                }
            });
            gridpaint.PixelChanged += PixelChanged;
            paintbuttons            = new UI_TexButton[5];
            for (int i = 0; i < 5; ++i)
            {
                Generic_Conf curconf = new Generic_Conf(UI_Handler.gridpaintbuttonconf);
                curconf.tex_color = paintbuttoncols[i];
                if (i == 0)
                {
                    paintbuttons[i] = new UI_TexButton(new Pos(5, 0, ORIGIN.TR, ORIGIN.DEFAULT, gridpaint), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, curconf);
                }
                else
                {
                    paintbuttons[i] = new UI_TexButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, paintbuttons[i - 1]), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, curconf);
                }
                paintbuttons[i].GotToggledLeft += PaintButtonPressed;
            }
            paintbuttons[0].IsActivated = true;
            overlaybutton = new UI_TexButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, paintbuttons[4]), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, UI_Handler.gridpaintbuttonconf);
            overlaybutton.GotToggledLeft += OverlayButtonPressed;
            gridpaint.curplacetype        = 1;

            UI_String OverlayTextBox_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, gridpaint), Point.Zero, UI_Handler.genbutconf, "Text for Overlay: ");

            OverlayTextBox = new UI_ValueInput(new Pos(0, ORIGIN.TR, ORIGIN.DEFAULT, OverlayTextBox_Label), new Point(size.X / 3, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);

            InputCount_Label         = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, OverlayTextBox_Label), Point.Zero, UI_Handler.genbutconf, "ParameterCount: ");
            ComponentValueInputCount = new UI_ValueInput(new Pos(0, ORIGIN.TR, ORIGIN.DEFAULT, InputCount_Label), new Point(size.X / 8, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 1, 2);

            parameterlabels = new List <string>();



            Features.Add_UI_Elements(spooky, SimCode_FuncName_Label, Box_SimCode_FuncName, InternalState_Length_Label, Box_InternalState_Length, ClickType_Label, Box_ClickType, Code_Sim_Button);
            Features.Add_UI_Elements(rotbuttons);
            Features.Add_UI_Elements(gridpaint, OverlayTextBox_Label, OverlayTextBox);
            Features.Add_UI_Elements(paintbuttons);
            Features.Add_UI_Elements(overlaybutton);
            Features.Add_UI_Elements(InputCount_Label);
            Features.Add_UI_Elements(ComponentValueInputCount);
            Add_UI_Elements(Box_Name_Label, Box_Name, Box_Category_Label, Box_Category, Features);

            Code_Sim_Button.GotActivatedLeft += Code_Sim_Button_Pressed;
            //Code_AfterSim_Button.GotActivatedLeft += Code_AfterSim_Button_Pressed;
            Box_SimCode_FuncName.ValueChanged += Box_SimCode_FuncName_ValueChange;
            //Box_AfterSimCode_FuncName.ValueChanged += Box_AfterSimCode_FuncName_ValueChange;
            Box_InternalState_Length.ValueChanged += Box_InternalState_Length_ValueChange;
            Box_ClickType.ValueChanged            += Box_ClickType_ValueChanged;
            OverlayTextBox.ValueChanged           += Box_Overlay_ValueChanged;
            ComponentValueInputCount.ValueChanged += InputCount_ValueChanged;

            // Code Boxes
            CodeBox_Sim = new UI_TextBox(new Pos(0), new Point(250, 400), UI_Handler.gen_conf);
            //CodeBox_AfterSim = new UI_TextBox(new Pos(0), new Point(250, 400), UI_Handler.gen_conf);
            CodeBox_Sim.LostFocus += Code_Sim_LostFocus;
            //CodeBox_AfterSim.LostFocus += Code_AfterSim_LostFocus;
            UpdatePos();
            Resize();
            GetsUpdated = GetsDrawn = false;
            overlayCalc = new byte[300, 300];
        }