Ejemplo n.º 1
0
 private void setupTextBox(out QTextBox TextBox, string Caption, string DefaultText, bool MakeCheckbox)
 {
     TextBox           = new QTextBox(Styles.FontSmaller);
     TextBox.Text      = DefaultText;
     TextBox.MaxLength = 255;
     setupControl(TextBox, Caption, MakeCheckbox);
 }
Ejemplo n.º 2
0
            public QPodcastDetails(PodcastSubscription Subscription, Callback Done)
                : base()
            {
                this.ps           = Subscription;
                this.doneCallback = Done;

                lblTitle       = new QLabel("Title");
                lblURL         = new QLabel("URL");
                lblGenre       = new QLabel("Mark New Episodes with Genre");
                txtTitle       = new QTextBox();
                txtTitle.Width = 1000; // prevent scrolling when text set
                txtTitle.Text  = ps.Name;
                txtURL         = new QTextBox();
                txtURL.Text    = ps.URL;

                btnOK     = new QButton("Save", false, false);
                btnCancel = new QButton("Cancel", false, false);

                AddButton(btnOK, ok);
                AddButton(btnCancel, cancel);

                cboGenre = new QComboBox(true);
                List <string> genres = Database.GetGenres();

                if (!genres.Contains(ps.DefaultGenre, StringComparer.OrdinalIgnoreCase))
                {
                    genres.Add(ps.DefaultGenre);
                }
                genres.Sort();
                cboGenre.Items.AddRange(genres.ToArray());
                cboGenre.SelectedIndex = genres.FindIndex(g => String.Compare(g, ps.DefaultGenre, StringComparison.OrdinalIgnoreCase) == 0);

                this.Controls.Add(lblTitle);
                this.Controls.Add(lblURL);
                this.Controls.Add(txtTitle);
                this.Controls.Add(txtURL);
                this.Controls.Add(lblGenre);
                this.Controls.Add(cboGenre);

                buttonWidth = Math.Max(btnOK.Width, btnCancel.Width);

                btnOK.Width     = buttonWidth;
                btnCancel.Width = buttonWidth;

                this.Height = calcHeight();

                int tabIndex = 0;

                lblTitle.TabIndex  = tabIndex++;
                txtTitle.TabIndex  = tabIndex++;
                lblURL.TabIndex    = tabIndex++;
                txtURL.TabIndex    = tabIndex++;
                lblGenre.TabIndex  = tabIndex++;
                cboGenre.TabIndex  = tabIndex++;
                btnOK.TabIndex     = tabIndex++;
                btnCancel.TabIndex = tabIndex++;

                setWrapAroundTabControl(tabIndex, txtTitle, null);
            }
Ejemplo n.º 3
0
        public frmLock(QLock Lock) : base(Localization.Get(UI_Key.Lock_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(400, 300);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.Lock_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(SPACING, SPACING);
            lblInstructions.SetWidth(this.ClientRectangle.Width - 2 * SPACING);
            this.Controls.Add(lblInstructions);

            chkMain                 = new QCheckBox(Localization.Get(UI_Key.Lock_Checkbox), this.BackColor);
            chkMain.Checked         = Lock != null && Lock.Locked;
            chkMain.Location        = new Point(2 * SPACING, lblInstructions.Bottom + SPACING);
            chkMain.CheckedChanged += new EventHandler(chkMainCheckedChanged);
            this.Controls.Add(chkMain);

            chkCode                 = new QCheckBox(Localization.Get(UI_Key.Lock_Code), this.BackColor);
            chkCode.Checked         = (Lock != null) && (Lock.Code.Length > 0);
            chkCode.Location        = new Point(3 * SPACING, chkMain.Bottom + SPACING);
            chkCode.CheckedChanged += (s, e) => { txtCode.Enabled = chkCode.Checked; };
            this.Controls.Add(chkCode);

            txtCode           = new QTextBox();
            txtCode.Text      = (Lock != null) ? Lock.Code : String.Empty;
            txtCode.MaxLength = QLock.MAX_CODE_LENGTH;
            txtCode.Location  = new Point(chkCode.Right + SPACING, chkCode.Top + chkCode.Height / 2 - txtCode.Height / 2 + 2);
            txtCode.Enabled   = chkCode.Checked;
            this.Controls.Add(txtCode);

            chkGamepadLock          = new QCheckBox(Localization.Get(UI_Key.Lock_Gamepad), this.BackColor);
            chkGamepadLock.Checked  = (Lock != null) && Lock.GamepadLock;
            chkGamepadLock.Location = new Point(3 * SPACING, chkCode.Bottom + SPACING);
            this.Controls.Add(chkGamepadLock);

            //btnCancel.Location = new Point(this.ClientRectangle.Width - btnCancel.Width - SPACING, chkGamepadLock.Bottom + SPACING);

            //btnOK.Location = new Point(btnCancel.Left - btnOK.Width - SPACING, btnCancel.Top);

            PlaceButtons(this.ClientRectangle.Width, chkGamepadLock.Bottom + SPACING);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnOK.Bottom + SPACING);

            this.chkMainCheckedChanged(this, EventArgs.Empty);

            int tabIndex = 0;

            chkMain.TabIndex        = tabIndex++;
            chkCode.TabIndex        = tabIndex++;
            txtCode.TabIndex        = tabIndex++;
            chkGamepadLock.TabIndex = tabIndex++;
            btnOK.TabIndex          = tabIndex++;
            btnCancel.TabIndex      = tabIndex++;
        }
Ejemplo n.º 4
0
        private void setupControls()
        {
            txtFilter = new QTextBox();
            txtFilter.EnableWatermark(this, Localization.Get(UI_Key.Filter_Search), String.Empty);

            fltPlaylist = new FilterButton(FilterType.Playlist);
            fltGenre    = new FilterButton(FilterType.Genre);
            fltArtist   = new FilterButton(FilterType.Artist);
            fltAlbum    = new FilterButton(FilterType.Album);
            fltYear     = new FilterButton(FilterType.Year);
            fltGrouping = new FilterButton(FilterType.Grouping);

            filterButtons = new Dictionary <FilterType, FilterButton>();

            filterButtons.Add(fltPlaylist.FilterType, fltPlaylist);
            filterButtons.Add(fltGenre.FilterType, fltGenre);
            filterButtons.Add(fltArtist.FilterType, fltArtist);
            filterButtons.Add(fltAlbum.FilterType, fltAlbum);
            filterButtons.Add(fltYear.FilterType, fltYear);
            filterButtons.Add(fltGrouping.FilterType, fltGrouping);

            txtFilter.Bounds = new Rectangle(8, 5, 135, 12);

            clearTextFilterRectangle = new Rectangle(150, 0, 15, this.ClientRectangle.Height);

            fltPlaylist.Left = 175;

            fltPlaylist.FilterName = Localization.Get(UI_Key.Filter_Playlist);
            fltGenre.FilterName    = Localization.Get(UI_Key.Filter_Genre);
            fltArtist.FilterName   = Localization.Get(UI_Key.Filter_Artist);
            fltAlbum.FilterName    = Localization.Get(UI_Key.Filter_Album);
            fltYear.FilterName     = Localization.Get(UI_Key.Filter_Year);
            fltGrouping.FilterName = Localization.Get(UI_Key.Filter_Grouping);

            foreach (KeyValuePair <FilterType, FilterButton> kvp in filterButtons)
            {
                kvp.Value.SelectedEvent          += filterSelected;
                kvp.Value.FilterValueChanged     += filterChanged;
                kvp.Value.IndexSelected          += showFilterIndex;
                kvp.Value.ClickedWithoutSelected += (s) => { RemoveFilterIndex(); };
                kvp.Value.ReleaseFilter();
            }

            txtFilter.Enter       += (s, e) => { txtFilterFocus = true; controller.RequestAction(QActionType.KeyPreviewChange); };
            txtFilter.Leave       += (s, e) => { txtFilterFocus = false; controller.RequestAction(QActionType.KeyPreviewChange); };
            txtFilter.TextChanged += new EventHandler(txtFilter_TextChanged);

            this.Controls.AddRange(new Control[] { txtFilter, fltPlaylist, fltGenre, fltArtist, fltAlbum, fltYear, fltGrouping });
        }
Ejemplo n.º 5
0
        public frmTwitter() : base(Localization.Get(UI_Key.Twitter_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(420, 200);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.Twitter_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);
            this.Controls.Add(lblInstructions);

            chkEnable                 = new QCheckBox(Localization.Get(UI_Key.Twitter_Enable), this.BackColor);
            chkEnable.Location        = new Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN);
            chkEnable.CheckedChanged += new EventHandler(enableCheckChanged);
            this.Controls.Add(chkEnable);

            lblUserName = new QLabel(Localization.Get(UI_Key.Twitter_User_Name));
            lblPassword = new QLabel(Localization.Get(UI_Key.Twitter_Password));

            txtUserName              = new QTextBox();
            txtUserName.Text         = Twitter.UserName;
            txtUserName.MaxLength    = 64;
            txtUserName.TextChanged += new EventHandler(textChanged);

            txtPassword              = new QTextBox();
            txtPassword.Text         = Twitter.Password;
            txtPassword.MaxLength    = 64;
            txtPassword.TextChanged += new EventHandler(textChanged);
            txtPassword.PasswordChar = '*';

            lblUserName.Location = new Point(2 * MARGIN, chkEnable.Bottom + MARGIN + MARGIN + (txtUserName.Height - lblUserName.Height) / 2);
            lblPassword.Location = new Point(2 * MARGIN, lblUserName.Top + MARGIN + txtUserName.Height);

            this.Controls.Add(lblUserName);
            this.Controls.Add(lblPassword);

            int x = Math.Max(lblUserName.Right, lblPassword.Right) + MARGIN;

            txtUserName.Location = new Point(x, lblUserName.Top + (lblUserName.Height - txtUserName.Height) / 2);
            txtPassword.Location = new Point(x, lblPassword.Top + (lblPassword.Height - txtPassword.Height) / 2);

            this.Controls.Add(txtUserName);
            this.Controls.Add(txtPassword);

            lblMode = new QLabel("Post A Tweet With Each:");
            this.Controls.Add(lblMode);
            lblMode.Location = new Point(4 * MARGIN, txtPassword.Bottom + MARGIN);

            cboMode = new QComboBox(false);
            cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Song));
            cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Album));

            this.Controls.Add(cboMode);

            cboMode.Location = new Point(lblMode.Right + MARGIN, lblMode.Top + (lblMode.Height - cboMode.Height) / 2);

            switch (Twitter.TwitterMode)
            {
            case Twitter.Mode.Album:
                cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Album));
                break;

            default:
                cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Song));
                break;
            }

            btnTest = new QButton(Localization.Get(UI_Key.Twitter_Test), false, false);
            AddButton(btnTest, test);

            btnViewOnWeb = new QButton(Localization.Get(UI_Key.Twitter_View_On_Web), false, false);
            AddButton(btnViewOnWeb, viewOnWeb);

            PlaceButtons(this.ClientRectangle.Width,
                         cboMode.Bottom + MARGIN + MARGIN,
                         btnCancel,
                         btnOK,
                         btnTest,
                         btnViewOnWeb);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN);

            int tabIndex = 0;

            chkEnable.TabIndex   = tabIndex++;
            txtUserName.TabIndex = tabIndex++;
            txtPassword.TabIndex = tabIndex++;

            btnViewOnWeb.TabIndex = tabIndex++;
            btnTest.TabIndex      = tabIndex++;
            btnOK.TabIndex        = tabIndex++;
            btnCancel.TabIndex    = tabIndex++;

            chkEnable.Checked = Twitter.On;
            enableControls();
        }
Ejemplo n.º 6
0
        public RadioEditPanel(RadioStation Station, string[] GenreList, Radio.StationEditComplete Callback) : base()
        {
            SPACING = 8;

            station  = Station;
            callback = Callback;

            lblName = new QLabel("&Name");
            lblName.ShowAccellerator();
            this.Controls.Add(lblName);

            lblGenre = new QLabel("&Genre");
            lblGenre.ShowAccellerator();
            this.Controls.Add(lblGenre);

            lblBitRate = new QLabel("&Bit Rate");
            lblBitRate.ShowAccellerator();
            this.Controls.Add(lblBitRate);

            lblStreamType = new QLabel("&Stream Type");
            lblStreamType.ShowAccellerator();
            this.Controls.Add(lblStreamType);

            lblURL = new QLabel("&URL");
            lblURL.ShowAccellerator();
            this.Controls.Add(lblURL);

            txtName           = new QTextBox();
            txtName.Width     = 1000;
            txtName.MaxLength = 140;
            txtName.GotFocus += (s, e) => txtName.SelectAll();
            this.Controls.Add(txtName);

            cboGenre           = new QComboBox(true);
            cboGenre.MaxLength = 30;
            cboGenre.Items.AddRange(GenreList);
            this.Controls.Add(cboGenre);

            txtBitrate             = new QTextBox();
            txtBitrate.NumericOnly = true;
            txtBitrate.MaxLength   = 3;
            this.Controls.Add(txtBitrate);

            cboStreamType = new QComboBox(false);
            cboStreamType.Items.AddRange(RadioStation.StreamTypeArray);
            this.Controls.Add(cboStreamType);

            txtURL           = new QTextBox();
            txtURL.MaxLength = 2048;
            this.Controls.Add(txtURL);

            txtName.Text  = station.Name;
            cboGenre.Text = station.Genre;
            if (station.BitRate > 0)
            {
                txtBitrate.Text = station.BitRate.ToString();
            }
            else
            {
                txtBitrate.Text = String.Empty;
            }

            cboStreamType.SelectedIndex = (int)station.StreamType;
            txtURL.Text = station.URL;

            btnOK = new QButton(Localization.OK, false, false);
            AddButton(btnOK, ok);
            btnCancel = new QButton(Localization.CANCEL, false, false);
            AddButton(btnCancel, cancel);

            resize();

            this.ClientSize = new Size(this.ClientRectangle.Width, btnOK.Bottom + MARGIN);

            int tabIndex = 0;

            lblName.TabIndex       = tabIndex++;
            txtName.TabIndex       = tabIndex++;
            lblGenre.TabIndex      = tabIndex++;
            cboGenre.TabIndex      = tabIndex++;
            lblURL.TabIndex        = tabIndex++;
            txtURL.TabIndex        = tabIndex++;
            lblBitRate.TabIndex    = tabIndex++;
            txtBitrate.TabIndex    = tabIndex++;
            lblStreamType.TabIndex = tabIndex++;
            cboStreamType.TabIndex = tabIndex++;
            btnOK.TabIndex         = tabIndex++;
            btnCancel.TabIndex     = tabIndex++;

            setWrapAroundTabControl(tabIndex, txtName, null);

            initialized = true;
        }
Ejemplo n.º 7
0
        public QSpin(bool CheckBox, bool Checked, string PrefixText, string PostfixText, int Min, int Max, int Default, int Increment, Color BackColor)
        {
            restoring = true;

            this.Min = Min;
            this.Max = Max;

            this.BackColor = BackColor;

            upHover   = false;
            downHover = false;

            this.Increment = Increment;

            if (CheckBox)
            {
                chkMain                 = new QCheckBox(PrefixText, this.BackColor);
                chkMain.AutoSize        = false;
                chkMain.Checked         = Checked;
                chkMain.CheckedChanged += new EventHandler(chkMain_CheckedChanged);
                chkMain.MouseEnter     += (s, e) => { this.Hovering = true; this.Invalidate(); };
                chkMain.MouseLeave     += (s, e) => { this.Hovering = false; this.Invalidate(); };
                this.Controls.Add(chkMain);
            }
            else
            {
                chkMain = null;
            }

            prefixText  = PrefixText;
            postfixText = PostfixText;

            txtMain              = new QTextBox();
            txtMain.Font         = Styles.Font;
            txtMain.Width        = 30;
            txtMain.TextAlign    = HorizontalAlignment.Right;
            txtMain.BorderStyle  = BorderStyle.None;
            txtMain.TextChanged += new EventHandler(txtMain_TextChanged);
            txtMain.Leave       += (s, e) => { if (txtMain.Text.Length == 0)
                                               {
                                                   txtMain.Text = this.Min.ToString();
                                               }
            };
            txtMain.KeyUp += (s, e) =>
            {
                switch (e.KeyCode)
                {
                case Keys.Up:
                    setValWithIncrement(this.Value + Increment);
                    e.Handled = true;
                    break;

                case Keys.Down:
                    setValWithIncrement(this.value - Increment);
                    e.Handled = true;
                    break;
                }
            };

            //this.Size = txtMain.Size;
            this.Controls.Add(txtMain);

            setValue(Math.Min(this.Max, Math.Max(this.Min, Default)));

            OffEquivalent = -1;

            updateControls();

            restoring = false;

            this.TabStop = false;
        }
Ejemplo n.º 8
0
        public QInputBox(IWin32Window Owner,
                         string Text,
                         string Caption,
                         string DefaultValue,
                         string CheckboxText,
                         bool CheckboxVal,
                         int MaxLength,
                         int MinLength) : base(Caption, ButtonCreateType.OKAndCancel)
        {
            this.SPACING = 8;

            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            this.ClientSize = new Size(275, 300);

            lblMain = new QLabel(Text);
            lblMain.ShowAccellerator();
            this.Controls.Add(lblMain);
            lblMain.Location = new Point(SPACING, 2 * SPACING);
            lblMain.SetWidth(this.ClientRectangle.Width - SPACING - SPACING);

            txtMain          = new QTextBox();
            txtMain.Text     = DefaultValue;
            txtMain.KeyDown += (s, e) =>
            {
                /* if (e.KeyCode == Keys.Enter)
                 * {
                 *  e.Handled = true;
                 *  ok();
                 * }
                 * else */if (e.KeyCode == Keys.Escape)
                {
                    e.Handled = true;
                    cancel();
                }
            };
            txtMain.MaxLength = MaxLength;
            minLength         = MinLength;
            txtMain.Bounds    = new System.Drawing.Rectangle(SPACING, lblMain.Bottom + 2 * SPACING, this.ClientRectangle.Width - 2 * SPACING, txtMain.Height);
            this.Controls.Add(txtMain);

            if (CheckboxText.Length > 0)
            {
                chkCheckbox          = new QCheckBox(CheckboxText, this.BackColor);
                chkCheckbox.Checked  = CheckboxVal;
                chkCheckbox.Location = new Point(SPACING, txtMain.Bottom + SPACING);
                chkCheckbox.Enabled  = false;
                this.Controls.Add(chkCheckbox);
            }

            PlaceButtons(this.ClientRectangle.Width, ((chkCheckbox != null) ? chkCheckbox.Bottom : txtMain.Bottom) + 2 * SPACING);

            btnOK.Enabled = false;

            this.ClientSize = new Size(this.ClientSize.Width, btnOK.Bottom + SPACING);

            int tabIndex = 0;

            lblMain.TabIndex = tabIndex++;
            txtMain.TabIndex = tabIndex++;

            if (chkCheckbox != null)
            {
                chkCheckbox.TabIndex = tabIndex++;
            }

            btnOK.TabIndex     = tabIndex++;
            btnCancel.TabIndex = tabIndex++;

            txtMain.TextChanged += (s, e) =>
            {
                btnOK.Enabled = txtMain.Text.Length >= minLength;
                if (chkCheckbox != null)
                {
                    chkCheckbox.Enabled = btnOK.Enabled;
                }
            };

            this.ShowDialog(Owner);
        }
Ejemplo n.º 9
0
        public Radio()
        {
            this.Visible        = false;
            this.DoubleBuffered = true;

            stationPanel = new StationPanel();
            this.Panel2.Controls.Add(stationPanel);
            stationPanel.AllowDrop = true;

            instance              = this;
            scrollBar             = new QScrollBar(false);
            scrollBar.Width       = SCROLL_BAR_WIDTH;
            scrollBar.UserScroll += new QScrollBar.ScrollDelegate(scroll);
            stationPanel.Controls.Add(scrollBar);

            txtURL = new QTextBoxFocusOnClick();
            stationPanel.Controls.Add(txtURL);
            txtURL.EnableWatermark(stationPanel, Localization.Get(UI_Key.Radio_URL_Watermark), String.Empty);
            txtURL.MaxLength = 2048;
            txtURL.Enter    += (s, e) => { keyPreviewChange(); };
            txtURL.Leave    += (s, e) => { keyPreviewChange(); };
            txtURL.KeyPress += (s, e) =>
            {
                switch (e.KeyChar)
                {
                case '\r':
                    if (txtURL.Text.Length > 0)
                    {
                        go(btnGo);
                    }
                    e.Handled = true;
                    break;
                }
            };

            txtFilter = new QTextBox();
            stationPanel.Controls.Add(txtFilter);
            txtFilter.EnableWatermark(stationPanel, Localization.Get(UI_Key.Radio_Filter_Watermark), String.Empty);
            txtFilter.Enter       += (s, e) => { keyPreviewChange(); };
            txtFilter.Leave       += (s, e) => { keyPreviewChange(); };
            txtFilter.TextChanged += (s, e) => { populateStations(); };

            btnClear = new QButton("X", false, true);
            btnClear.ButtonPressed += new QButton.ButtonDelegate(clear);
            btnClear.BackColor      = stationPanel.BackColor;
            stationPanel.Controls.Add(btnClear);

            btnGo = new QButton(Localization.Get(UI_Key.Radio_Add_And_Play), false, true);
            btnGo.ButtonPressed += new QButton.ButtonDelegate(go);
            btnGo.BackColor      = stationPanel.BackColor;
            stationPanel.Controls.Add(btnGo);

            genrePanel            = new RadioGenreSelectPanel();
            genrePanel.Location   = Point.Empty;
            genrePanel.HeaderText = Localization.Get(UI_Key.Radio_Genres);
            this.Panel1.Controls.Add(genrePanel);

            cells = new List <Cell>();
            setupCells();

            this.Panel1.Resize += (s, e) => { arrangeSelectPanel(); };
            this.Panel2.Resize += (s, e) => { arrangeStationPanel(); };

            stationPanel.MouseMove        += new MouseEventHandler(stationPanelMouseMove);
            stationPanel.MouseDown        += new MouseEventHandler(stationPanelMouseDown);
            stationPanel.MouseUp          += new MouseEventHandler(stationPanelMouseUp);
            stationPanel.Paint            += new PaintEventHandler(stationPanelPaint);
            stationPanel.MouseDoubleClick += new MouseEventHandler(stationPanelDoubleClick);
            stationPanel.MouseWheel       += new MouseEventHandler(stationPanelMouseWheel);
            stationPanel.MouseEnter       += (s, e) => { if (!txtURL.Focused && !txtFilter.Focused)
                                                         {
                                                             stationPanel.Focus();
                                                         }
            };
            stationPanel.MouseLeave += (s, e) => { hoverCell = null; };
            stationPanel.Resize     += (s, e) => { setupCells(); };
            stationPanel.GotFocus   += (s, e) => { stationPanel.Active = true; keyPreviewChange(); };
            stationPanel.LostFocus  += (s, e) => { stationPanel.Active = false; };
            stationPanel.DragEnter  += (s, e) => { onDragEnter(e); };
            stationPanel.DragDrop   += (s, e) => { onDragDrop(e, true); };

            txtURL.DragEnter += (s, e) => { onDragEnter(e); };
            txtURL.DragDrop  += (s, e) => { onDragDrop(e, false); };
            txtURL.AllowDrop  = true;

            txtURL.Watermark.DragEnter += (s, e) => { onDragEnter(e); };
            txtURL.Watermark.DragDrop  += (s, e) => { onDragDrop(e, false); };
            txtURL.Watermark.AllowDrop  = true;

            genrePanel.AllowDrop             = true;
            genrePanel.SelectedIndexChanged += () => { populateStations(); };
            genrePanel.ValueChanged         += new QSelectPanel.ValueEditDelegate(selectPanel_ValueChanged);
            genrePanel.DragEnter            += (s, e) =>
            {
                onDragEnter(e);
            };
            genrePanel.DragDrop         += (s, e) => { onDragDropGenre(e); };
            this.genrePanel.MouseEnter  += (s, e) => { genrePanel.Focus(); };
            this.genrePanel.GotFocus    += (s, e) => { genrePanel.Active = true; };
            this.genrePanel.LostFocus   += (s, e) => { genrePanel.Active = false; };
            this.genrePanel.DoubleClick += (s, e) => { genreDoubleClick(); };

            int tabIndex = 0;

            txtFilter.TabIndex = tabIndex++;
            btnClear.TabIndex  = tabIndex++;
            txtURL.TabIndex    = tabIndex++;
            btnGo.TabIndex     = tabIndex++;
        }
Ejemplo n.º 10
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);
            }
        }
Ejemplo n.º 11
0
        public frmLastFM(bool Enabled, string UserName, string Password) : base(Localization.Get(UI_Key.LastFM_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(370, 200);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.LastFM_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);
            this.Controls.Add(lblInstructions);

            chkEnable                 = new QCheckBox(Localization.Get(UI_Key.LastFM_Enable), this.BackColor);
            chkEnable.Checked         = Enabled;
            chkEnable.Location        = new Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN);
            chkEnable.CheckedChanged += new EventHandler(chkEnableChanged);
            this.Controls.Add(chkEnable);

            lblUserName = new QLabel(Localization.Get(UI_Key.LastFM_User_Name));
            lblPassword = new QLabel(Localization.Get(UI_Key.LastFM_Password));

            lblUserName.Enabled = Enabled;
            lblPassword.Enabled = Enabled;

            txtUserName              = new QTextBox();
            txtUserName.Text         = UserName;
            txtUserName.MaxLength    = 64;
            txtUserName.Enabled      = Enabled;
            txtUserName.TextChanged += new EventHandler(textChanged);

            txtPassword              = new QTextBox();
            txtPassword.Text         = Password;
            txtPassword.MaxLength    = 64;
            txtPassword.Enabled      = Enabled;
            txtPassword.TextChanged += new EventHandler(textChanged);
            txtPassword.PasswordChar = '*';

            lblUserName.Location = new Point(2 * MARGIN, chkEnable.Bottom + MARGIN + MARGIN + (txtUserName.Height - lblUserName.Height) / 2);
            lblPassword.Location = new Point(2 * MARGIN, lblUserName.Top + MARGIN + txtUserName.Height);

            this.Controls.Add(lblUserName);
            this.Controls.Add(lblPassword);

            int x = Math.Max(lblUserName.Right, lblPassword.Right) + MARGIN;

            txtUserName.Location = new Point(x, lblUserName.Top + (lblUserName.Height - txtUserName.Height) / 2);
            txtPassword.Location = new Point(x, lblPassword.Top + (lblPassword.Height - txtPassword.Height) / 2);

            this.Controls.Add(txtUserName);
            this.Controls.Add(txtPassword);

            //btnCancel.Location = new Point(this.ClientRectangle.Width - MARGIN - btnCancel.Width, txtPassword.Bottom + MARGIN + MARGIN);

            //btnOK.Location = new Point(btnCancel.Left - btnOK.Width - MARGIN, btnCancel.Top);

            btnGoToAcccount = new QButton(Localization.Get(UI_Key.LastFM_Go_To_Account), false, false);
            AddButton(btnGoToAcccount, gotoAccount);

            //btnGoToAcccount.Location = new Point(btnOK.Left - btnGoToAcccount.Width - MARGIN, btnCancel.Top);

            PlaceButtons(this.ClientRectangle.Width,
                         txtPassword.Bottom + MARGIN + MARGIN,
                         btnCancel,
                         btnOK,
                         btnGoToAcccount);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN);

            int tabIndex = 0;

            chkEnable.TabIndex       = tabIndex++;
            txtUserName.TabIndex     = tabIndex++;
            txtPassword.TabIndex     = tabIndex++;
            btnGoToAcccount.TabIndex = tabIndex++;
            btnOK.TabIndex           = tabIndex++;
            btnCancel.TabIndex       = tabIndex++;

            enableControls();
        }
Ejemplo n.º 12
0
        public Organizer(Callback DoneCallback) : base()
        {
            TrackWriter.Stop();

            done = DoneCallback;

            invalidPath      = Localization.Get(UI_Key.Organize_Invalid_Path);
            sample           = Localization.Get(UI_Key.Organize_Sample);
            tokenMyMusic     = Localization.Get(UI_Key.Organize_Token_My_Music);
            tokenMyDocuments = Localization.Get(UI_Key.Organize_Token_My_Documents);
            tokenDesktop     = Localization.Get(UI_Key.Organize_Token_Desktop);

            font     = Styles.FontSmaller;
            boldFont = new Font(font, FontStyle.Bold);

            btnOK     = new QButton(Localization.OK, false, true);
            btnCancel = new QButton(Localization.CANCEL, false, true);

            btnHelp = new QButton(Localization.Get(UI_Key.Organize_Help), false, true);
            AddButton(btnHelp, help);

            lblTitle = new QLabel(Localization.Get(UI_Key.Organize_Title), font);
            this.Controls.Add(lblTitle);
            lblTitle.Location = new System.Drawing.Point(MARGIN, MARGIN);

            lblDirectory = new QLabel(Localization.Get(UI_Key.Organize_Top_Folder), font);
            lblDirectory.ShowAccellerator();
            this.Controls.Add(lblDirectory);

            txtDirectory      = new QTextBox();
            txtDirectory.Font = font;
            this.Controls.Add(txtDirectory);

            if (Setting.TopLevelDirectory.Length == 0)
            {
                Setting.TopLevelDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
            }

            oldRoot           = Setting.TopLevelDirectory;
            txtDirectory.Text = simplify(oldRoot);

            btnBrowse = new QButton(Localization.Get(UI_Key.Organize_Browse), false, false);
            btnBrowse.ShowAccellerator(Keys.B);
            AddButton(btnBrowse, browse);

            lblSubdirectory = new QLabel(Localization.Get(UI_Key.Organize_Folder_Structure), font);
            lblSubdirectory.ShowAccellerator();
            this.Controls.Add(lblSubdirectory);

            cboSubdirectory      = new QComboBox(false);
            cboSubdirectory.Font = font;
            cboSubdirectory.Items.AddRange(TrackWriter.GetDirFormats().ToArray());
            string sub = TrackWriter.GetDirFormat(Setting.DefaultDirectoryFormat);

            if (cboSubdirectory.Items.Contains(sub))
            {
                cboSubdirectory.SelectedIndex = cboSubdirectory.FindStringExact(sub);
            }
            else
            {
                cboSubdirectory.SelectedIndex = 0;
            }
            this.Controls.Add(cboSubdirectory);
            cboSubdirectory.AutoSetWidth();

            lblRename = new QLabel(Localization.Get(UI_Key.Organize_Rename), font);
            lblRename.ShowAccellerator();
            this.Controls.Add(lblRename);

            cboRename      = new QComboBox(false);
            cboRename.Font = font;
            string[] renames = TrackWriter.GetRenames().ToArray();
            renames[0] = Localization.Get(UI_Key.Organize_Dont_Change);
            cboRename.Items.AddRange(renames);
            string ren = TrackWriter.GetRenameFormat(Setting.DefaultRenameFormat);

            if (cboRename.Items.Contains(ren))
            {
                cboRename.SelectedIndex = cboRename.FindStringExact(ren);
            }
            else
            {
                cboRename.SelectedIndex = 0;
            }
            this.Controls.Add(cboRename);

            cboRename.AutoSetWidth();

            chkKeepOrganized = new QCheckBox(Localization.Get(UI_Key.Organize_Keep_Organized), this.BackColor);
            chkKeepOrganized.ShowAccellerator();
            chkKeepOrganized.Font    = font;
            chkKeepOrganized.Checked = Setting.KeepOrganized;
            this.Controls.Add(chkKeepOrganized);

            chkMoveIntoTopFolder         = new QCheckBox(Localization.Get(UI_Key.Organize_Move_Into_Top_Folder), this.BackColor);
            chkMoveIntoTopFolder.Font    = font;
            chkMoveIntoTopFolder.Checked = Setting.MoveNewFilesIntoMain;
            this.Controls.Add(chkMoveIntoTopFolder);

            btnOK.Text     = Localization.Get(UI_Key.Organize_Organize);
            btnCancel.Text = Localization.Get(UI_Key.Organize_Dont_Organize);
            btnOK.ShowAccellerator(Keys.O);
            btnCancel.ShowAccellerator(Keys.D);

            AddButton(btnOK, ok);
            AddButton(btnCancel, cancel);

            sampleTrack = new Track(-1,
                                    Localization.Get(UI_Key.Organize_Sample_Track_Path),
                                    Track.FileType.MP3,
                                    Localization.Get(UI_Key.Organize_Sample_Track_Title),
                                    Localization.Get(UI_Key.Organize_Sample_Track_Album),
                                    Localization.Get(UI_Key.Organize_Sample_Track_Artist),
                                    String.Empty,
                                    String.Empty,
                                    Localization.Get(UI_Key.Organize_Sample_Track_Grouping),
                                    Localization.Get(UI_Key.Organize_Sample_Track_Genre),
                                    (6 * 60 + 24) * 1000,
                                    5,
                                    0,
                                    1973,
                                    0,
                                    5,
                                    320000,
                                    0,
                                    false,
                                    DateTime.Today,
                                    DateTime.Today,
                                    DateTime.Today,
                                    String.Empty,
                                    2,
                                    44100,
                                    ChangeType.None,
                                    null,
                                    float.MinValue,
                                    float.MinValue);

            resize();
            this.Height = chkKeepOrganized.Bottom + MARGIN;

            cboSubdirectory.SelectedIndexChanged += (s, e) => { updateSample(); };
            cboRename.SelectedIndexChanged       += (s, e) => { updateSample(); };
            txtDirectory.TextChanged             += (s, e) => { updateSample(); };

            updateSample();

            int tabIndex = 0;

            lblDirectory.TabIndex         = tabIndex++;
            txtDirectory.TabIndex         = tabIndex++;
            btnBrowse.TabIndex            = tabIndex++;
            lblSubdirectory.TabIndex      = tabIndex++;
            cboSubdirectory.TabIndex      = tabIndex++;
            lblRename.TabIndex            = tabIndex++;
            cboRename.TabIndex            = tabIndex++;
            chkKeepOrganized.TabIndex     = tabIndex++;
            chkMoveIntoTopFolder.TabIndex = tabIndex++;
            btnHelp.TabIndex   = tabIndex++;
            btnCancel.TabIndex = tabIndex++;
            btnOK.TabIndex     = tabIndex++;

            setWrapAroundTabControl(tabIndex, txtDirectory, null);

            initialized = true;
        }