Ejemplo n.º 1
0
        public DefaultStringEditor()
        {
            InitializeComponent();

            m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), MyTextBox.InputFormEnum.Text, AutoCompleteSuggestions, x => MyTextBox.TextBoxBorderDaniel, 4, Fonts.Default);
            m_textBox.RequestedAreaChanged += () =>
            {
                //Draw window is the whole control so we can just modify the control
                MinimumSize = new Size(0, (int)m_textBox.RequestedArea.Height);
                Size        = m_textBox.RequestedArea.ToSize();
            };
            m_textBox.EnterPressed += () => Ok.Execute();
            m_textBox.SpecialEnter  = true;
            MyTextBox.SetupCallbacks(drawWindow1, m_textBox);
        }
Ejemplo n.º 2
0
        public MyTextBoxControl()
        {
            InitializeComponent();

            m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), MyTextBox.InputFormEnum.Text);
            m_textBox.Colors.BorderPen      = ColorScheme.ControlBorder;
            m_textBox.RequestedAreaChanged += () =>
            {
                Size        = m_textBox.RequestedArea.ToSize();
                MinimumSize = new Size(0, Size.Height);
            };
            //m_textBox.EnterPressed += () => Ok.Execute();
            //m_textBox.SpecialEnter = true;
            MyTextBox.SetupCallbacks(drawWindow1, m_textBox);
        }
Ejemplo n.º 3
0
 public void StartRenaming(int cursorPos, Control control)
 {
     if (m_textBox == null)
     {
         var area     = m_area();
         var indent   = CalculateIndent(area);
         var textArea = CalculateTextArea(area, indent);
         m_textBox      = new MyTextBox(control, () => new RectangleF(textArea.Location.Plus(ToControlTransform().OffsetX, ToControlTransform().OffsetY), textArea.Size), MyTextBox.InputFormEnum.FileName, null, x => new SimpleTextBoxBorderDrawer(x), 4, Fonts.Default);
         m_textBox.Text = PermanentText;
         m_textBox.SetCursorPosition(cursorPos);
         m_textBox.Colors.Background = Color.Transparent;
         m_textBox.Colors.BorderPen  = Pens.Transparent;
         MyTextBox.SetupCallbacks(control, m_textBox);
         m_textBox.GotFocus();
     }
 }
Ejemplo n.º 4
0
        public DynamicEnumTypeEditor()
        {
            InitializeComponent();

            using (var g = CreateGraphics())
            {
                var titleSize = g.MeasureString(TITLE, Font);
                m_titleWidth  = titleSize.Width;
                m_titleHeight = titleSize.Height;
            }

            drawWindow1.Paint += new PaintEventHandler(drawWindow1_Paint);

            m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(m_titleWidth + BUFFER, 0, drawWindow1.Width - m_titleWidth - BUFFER, drawWindow1.Height), MyTextBox.InputFormEnum.Text);
            MyTextBox.SetupCallbacks(drawWindow1, m_textBox);
            m_textBox.RequestedAreaChanged += () => Height = (int)m_textBox.RequestedArea.Height;
        }
Ejemplo n.º 5
0
        public DefaultAudioEditor()
        {
            InitializeComponent();

            //TODO: AUDIO: Suggest paths that exist for autoCompleteSuggestions
            m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width, drawWindow1.Height), MyTextBox.InputFormEnum.Path, null, x => MyTextBox.TextBoxBorderDaniel, 4, Fonts.Default);
            m_textBox.RequestedAreaChanged += () =>
            {
                int extraHeight = (Size.Height - drawWindow1.Size.Height).Clamp(0, int.MaxValue);
                drawWindow1.MinimumSize = new Size(0, (int)m_textBox.RequestedArea.Height);
                MinimumSize             = new Size(MinimumSize.Width, (int)m_textBox.RequestedArea.Height + extraHeight);
                drawWindow1.Size        = m_textBox.RequestedArea.ToSize();
                Size = new Size(Width, m_textBox.RequestedArea.ToSize().Height + extraHeight);
            };
            m_textBox.EnterPressed += () => Ok.Execute();
            m_textBox.SpecialEnter  = true;
            MyTextBox.SetupCallbacks(drawWindow1, m_textBox);
            drawWindow1.SizeChanged += new EventHandler(drawWindow1_SizeChanged);
        }
Ejemplo n.º 6
0
        public NodeEditor(IColorScheme scheme, IConversationNodeData data, AudioGenerationParameters audioContext, Func <ParameterType, ParameterEditorSetupData, IParameterEditor> config, ILocalizationEngine localizer, IAudioParameterEditorCallbacks audioProvider, AutoCompleteSuggestionsDelegate autoCompleteSuggestions)
            : this()
        {
            Scheme = scheme;
            m_data = data;

            this.SuspendLayout();
            flowLayoutPanel1.SuspendLayout();
            flowLayoutPanel2.SuspendLayout();

            if (!string.IsNullOrEmpty(data.Description))
            {
                int padding = 8;
                m_descriptionBox      = new MyTextBox(panel1, () => new RectangleF(panel1.Location.Plus(padding, padding), new SizeF(panel1.Width - padding * 2, panel1.Height - padding * 2)), MyTextBox.InputFormEnum.None, null, x => new SimpleTextBoxBorderDrawer(x), 8, Fonts.Default);
                m_descriptionBox.Text = data.Description;
                MyTextBox.SetupCallbacks(panel1, m_descriptionBox);
                panel1.Size         = m_descriptionBox.RequestedArea.ToSize();
                panel1.SizeChanged += (object sender, EventArgs e) =>
                {
                    var requested = m_descriptionBox.RequestedArea.ToSize();
                    panel1.Size = new Size(requested.Width + padding * 2, requested.Height + padding * 2);
                };
            }
            else
            {
                panel1.Height = 0;
            }

            //Make the panels really tall so they can visibly contain all the parameter editors.
            //Note the whole control won't be visible as we'll scroll them by shifting them in Y.
            flowLayoutPanel1.Height = 10000;
            flowLayoutPanel2.Height = 10000;

            Title = m_data.Name;

            foreach (Parameter p in m_data.Parameters.OrderByDescending(p => p.Name))
            {
                var editorData = new ParameterEditorSetupData(p, localizer, audioProvider, audioContext, (s) => autoCompleteSuggestions(p, s));
                if (p is UnknownParameter unknown)
                {
                    UnknownParameterEditor ed = null;
                    Label label = null;
                    ed = UnknownParameterEditor.Make(Scheme, editorData, m_data.RemoveUnknownParameter(unknown),
                                                     () =>
                    {
                        flowLayoutPanel2.Controls.Remove(ed);
                        flowLayoutPanel1.Controls.Remove(label);
                        SetupScrollbar();
                    });
                    label = AddParameter(p, ed);
                }
                else
                {
                    AddParameter(p, config(p.TypeId, editorData));
                }
            }

            flowLayoutPanel1.ResumeLayout();
            flowLayoutPanel2.ResumeLayout();

            SetupScrollbar();

            if (flowLayoutPanel1.Controls.Count > 0)
            {
                EventHandler SizeChanged = (a, b) =>
                {
                    NeedsResize.Execute();
                    DoResize();
                };
                flowLayoutPanel2.Controls[0].LocationChanged += SizeChanged;
                flowLayoutPanel2.Controls[0].SizeChanged     += SizeChanged;
                panel1.SizeChanged += SizeChanged;
            }
            ;

            this.ResumeLayout();

            this.splitContainer1.Panel2.SizeChanged += Panel2_SizeChanged;

            if (flowLayoutPanel2.Controls.Count > 0)
            {
                for (int i = flowLayoutPanel2.Controls.Count - 1; i >= 0; i--)
                {
                    (flowLayoutPanel2.Controls[i] as Panel).TabStop  = true;
                    (flowLayoutPanel2.Controls[i] as Panel).TabIndex = flowLayoutPanel2.Controls.Count - i - 1;
                }
            }
        }