Exemple #1
0
        private void setupCompilation(out QComboBox ComboBox, string Caption, bool MakeCheckbox)
        {
            ComboBox = new QComboBox(false, Styles.FontSmaller);

            bool?isComp = tracks[0].Compilation;

            foreach (Track t in tracks)
            {
                if (t.Compilation != isComp)
                {
                    isComp = null;
                    break;
                }
            }

            if (isComp.HasValue)
            {
                ComboBox.Items.AddRange(new string[] { Localization.YES, Localization.NO });
                if (isComp.Value)
                {
                    ComboBox.SelectedIndex = ComboBox.FindStringExact(Localization.YES);
                }
                else
                {
                    ComboBox.SelectedIndex = ComboBox.FindStringExact(Localization.NO);
                }
            }
            else
            {
                System.Diagnostics.Debug.Assert(isMultiple);
                ComboBox.Items.AddRange(new string[] { MULTIPLE_VALUES, Localization.YES, Localization.NO });
                ComboBox.SelectedIndex = 0;
                ComboBox.EnableWatermark(this, MULTIPLE_VALUES, MULTIPLE_VALUES);
            }

            setupControl(ComboBox, Caption, MakeCheckbox);
        }
Exemple #2
0
        private void setupRename(string Caption, bool MakeCheckbox)
        {
            cboRename = new QComboBox(false, Styles.FontSmaller);
            setupControl(cboRename, Caption, MakeCheckbox);

            if (isMultiple)
            {
                string[] ss = TrackWriter.GetRenames().ToArray();
                cboRename.Items.AddRange(ss);
                cboRename.SelectedIndex = 0; // cboRename.FindStringExact(ss[0]);
                cboRename.LostFocus    += (s, e) =>
                {
                    if (cboRename.Text.Length == 0)
                    {
                        checkboxes[cboRename].Checked = false;
                    }
                };
                cboRename.EnableWatermark(this, MULTIPLE_VALUES, MULTIPLE_VALUES);
            }
            else
            {
                updateFilenames(0);
            }
        }
Exemple #3
0
        private void setupControl(IEditControl Control, string Caption, bool MakeCheckbox)
        {
            QLabel label = new QLabel(Caption, Styles.FontSmaller);

            this.Controls.Add(label);

            labels.Add(Control, label);
            label.ShowAccellerator();

            if (MakeCheckbox)
            {
                QCheckBox cb = new QCheckBox(String.Empty, this.BackColor);
                cb.CheckedChanged += (s, e) =>
                {
                    updateColor(s, e);
                    Dirty = true;
                };
                this.Controls.Add(cb);
                checkboxes.Add(Control, cb);
                Control.ForeColor = Styles.Watermark;
            }

            this.Controls.Add(Control as Control);

            if (Control is QTextBox)
            {
                Control.TextChanged += textChanged;
                QTextBox tb = Control as QTextBox;
                tb.GotFocus += (s, e) => { Clock.DoOnMainThread(tb.SelectAll, 30); };
                if (tb.Text == VARIES_TOKEN)
                {
                    tb.EnableWatermark(this, MULTIPLE_VALUES, String.Empty);
                    tb.Text = String.Empty;
                }
                editControls.Add(tb);
            }
            else if (Control is QComboBox)
            {
                QComboBox cb = Control as QComboBox;

                // need both, depends on editable vs. uneditable
                cb.TextChanged          += textChanged;
                cb.SelectedIndexChanged += textChanged;

                if (cb.Text == VARIES_TOKEN)
                {
                    cb.EnableWatermark(this, MULTIPLE_VALUES, String.Empty);
                    cb.Text = String.Empty;
                }
                cb.DropDown += (s, e) =>
                {
                    if (isMultiple)
                    {
                        cb.ForeColor = Color.Black;
                    }
                };
                cb.DropDownClosed += (s, e) =>
                {
                    if (isMultiple)
                    {
                        updateColor(cb, checkboxes[cb]);
                    }
                    else
                    {
                        updateColor(cb, EventArgs.Empty);
                    }
                };
                editControls.Add(cb);
            }
        }