Exemplo n.º 1
0
        public Control Create()
        {
            txt          = new FastColoredTextBox();
            txt.ReadOnly = false;
            //txt.MouseWheel += MouseWheel;
            txt.KeyDown += KeyDown;
            //txt.KeyPress += KeyPress;
            //txt.TextChanged += TextChanged;
            txt.SelectionChanged += SelectionChanged;

            //txt.Language = Language.CSharp;
            //txt.Language = Language.SQL;
            txt.Language          = Language.Custom;
            txt.DescriptionFile   = "isql_syntax_desc.xml";
            txt.Font              = new Font("Courier New", 10);
            txt.WordWrap          = true;
            txt.WordWrapMode      = WordWrapMode.CharWrapControlWidth;
            txt.ShowLineNumbers   = false;
            txt.AutoIndentNeeded += (object sender, AutoIndentEventArgs e) => { e.Shift = 0; e.AbsoluteIndentation = 0; e.ShiftNextLines = 0; };             // Disable auto-indentation

            //txt.Text = "> ";

            ClearAction        = ActionManager.CreateAction("Clear console", this, "Clear");
            PrintCommandAction = ActionManager.CreateAction("Print command to console", this, "PrintCommand");
            ActionManager.Do(ClearAction);

            return(txt);
        }
Exemplo n.º 2
0
        public void Init()
        {
            Vector3[] border_positions =
            {
                new Vector3(0.0f,  0.0f, 0.0f), new Vector3(0.0f,  1.0f, 0.0f),
                new Vector3(0.0f,  1.0f, 0.0f), new Vector3(1.0f,  1.0f, 0.0f),
                new Vector3(1.0f,  1.0f, 0.0f), new Vector3(1.0f,  0.0f, 0.0f),
                new Vector3(1.0f,  0.0f, 0.0f), new Vector3(0.0f,  0.0f, 0.0f),

                new Vector3(1.01f, 0.0f, 0.0f), new Vector3(1.01f, 1.0f, 0.0f),
                new Vector3(1.01f, 1.0f, 0.0f), new Vector3(1.06f, 1.0f, 0.0f),
                new Vector3(1.06f, 1.0f, 0.0f), new Vector3(1.06f, 0.0f, 0.0f),
                new Vector3(1.06f, 0.0f, 0.0f), new Vector3(1.01f, 0.0f, 0.0f)
            };
            meshBorders = new GLMesh(border_positions, null, null, null, null, null, PrimitiveType.Lines);

            Vector3[] tick_positions =
            {
                new Vector3(0.0f, 0.2f, 0.0f),
                new Vector3(0.0f, 0.8f, 0.0f)
            };
            meshTick = new GLMesh(tick_positions, null, null, null, null, null, PrimitiveType.Lines);

            meshCheck = new GLMesh(new Vector3[] { new Vector3(-1.0f, -0.1f, 0.0f), new Vector3(-1.0f, 1.15f, 0.0f), new Vector3(1.0f, 1.15f, 0.0f), new Vector3(1.0f, -0.1f, 0.0f) }, null, null, null, null, null, PrimitiveType.TriangleFan);

            ParameterChangedAction = ActionManager.CreateAction <int, bool[]>("Called when the checked states of the values of a parameter have changed", "", delegate(object[] p) {
                int paramidx     = (int)p[0];
                bool[] isChecked = (bool[])p[1];
                Array.Copy(isChecked, parameters[paramidx].isChecked, isChecked.Length);
                ParameterChanged(parameters[paramidx], paramidx);
                return(null);
            });
        }
Exemplo n.º 3
0
        public ImageBrowser()
        {
            // Create actions for control functions

            // Selection functions don't need to call an action, because SelectionChanged() calls an action

            // Focus functions don't need to call an action, because changing the view calls an action

            MoveImagesAction    = ActionManager.CreateAction("", (ImageBrowser)this, "DoMoveImages");
            MoveImageAction     = ActionManager.CreateAction("", (ImageBrowser)this, "DoMoveImage");
            MoveSelectionAction = ActionManager.CreateAction("", this, "DoMoveSelection");

            ShowImagesAction    = ActionManager.CreateAction("", (ImageBrowser)this, "DoShowImages");
            ShowImageAction     = ActionManager.CreateAction("", (ImageBrowser)this, "DoShowImage");
            ShowSelectionAction = ActionManager.CreateAction("", this, "DoShowSelection");

            HideImagesAction    = ActionManager.CreateAction("", (ImageBrowser)this, "DoHideImages");
            HideImageAction     = ActionManager.CreateAction("", (ImageBrowser)this, "DoHideImage");
            HideSelectionAction = ActionManager.CreateAction("", this, "DoHideSelection");
        }
Exemplo n.º 4
0
        public GLButton(GLTexture2D texture, Rectangle bounds, AnchorStyles anchor = AnchorStyles.Top | AnchorStyles.Left, string actionname = null, string actiondesc = null)
        {
            this.Anchor = anchor;

            this.tex = texture;
            if (actionname != null)
            {
                clickAction = ActionManager.CreateAction(actiondesc == null ? "" : actiondesc, actionname, this, "ClickInternal");
            }

            if (bounds.Width <= 0)
            {
                bounds.Width = tex.width;
            }
            if (bounds.Height <= 0)
            {
                bounds.Height = tex.height;
            }
            this.Bounds = bounds;
        }
Exemplo n.º 5
0
        public void Init()
        {
            Vector3[] border_positions =
            {
                new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f),
                new Vector3(0.0f, 1.0f, 0.0f), new Vector3(1.0f, 1.0f, 0.0f),
                new Vector3(1.0f, 1.0f, 0.0f), new Vector3(1.0f, 0.0f, 0.0f),
                new Vector3(1.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f)
            };
            meshBorders = new GLMesh(border_positions, null, null, null, null, null, PrimitiveType.Lines);

            Vector3[] tick_positions =
            {
                new Vector3(0.0f, 0.2f, 0.0f),
                new Vector3(0.0f, 0.8f, 0.0f)
            };
            meshTick = new GLMesh(tick_positions, null, null, null, null, null, PrimitiveType.Lines);

            meshSlider = new GLMesh(new Vector3[] { new Vector3(-1.0f, -0.1f, 0.0f), new Vector3(-1.0f, 1.15f, 0.0f), new Vector3(1.0f, 1.15f, 0.0f), new Vector3(1.0f, -0.1f, 0.0f) }, null, null, null, null, null, PrimitiveType.TriangleFan);

            CustomControlValueChangedAction = ActionManager.CreateAction <int, float>("Called when a custom control's value has changed", "", delegate(object[] p) {
                int controlIdx = (int)p[0];
                float value    = (float)p[1];
                if (CustomControlValueChanged != null)
                {
                    CustomControlValueChanged(controlIdx, sliders[controlIdx].Value = value);
                }
                else
                {
                    sliders[controlIdx].Value = value;
                }
                return(null);
            });
            RemoveCustomControlsAction = ActionManager.CreateAction("Remove all custom controls", "", delegate(object[] p) {
                sliders.Clear();
                return(null);
            });
            ActionManager.Do(RemoveCustomControlsAction);
        }
Exemplo n.º 6
0
        public Console()
        {
            ActionManager.CreateAction("List files and directories of the current working directory", "ls", delegate(object[] parameters) {
                return(ListFiles());
            });
            ActionManager.CreateAction <string>("Change working directory", "cd", delegate(object[] parameters) {
                return(ChangeWorkingDirectory((string)parameters[0]));
            });

            HISTORY_PATH  = System.Reflection.Assembly.GetEntryAssembly().Location;
            MACRO_PATH    = HISTORY_PATH = HISTORY_PATH.Substring(0, Math.Max(HISTORY_PATH.LastIndexOf('/'), HISTORY_PATH.LastIndexOf('\\')) + 1);
            HISTORY_PATH += ".history";
            MACRO_PATH   += ".macros";

            if (File.Exists(HISTORY_PATH))
            {
                StreamReader sr = new StreamReader(HISTORY_PATH);
                while (sr.Peek() != -1)
                {
                    history.Add(sr.ReadLine());
                }
                sr.Close();
                history_idx = history.Count;
            }
            if (File.Exists(MACRO_PATH))
            {
                StreamReader sr = new StreamReader(MACRO_PATH);
                int          i  = 0;
                while (i < macros.Length && sr.Peek() != -1)
                {
                    macros[i++] = sr.ReadLine();
                }
                while (i < macros.Length)
                {
                    macros[i++] = "";
                }
                sr.Close();
            }
        }