private void textbox_BeforeShowIntellisense(object sender, QuuxControls.BeforeShowIntellisenseEventArgs e) { if (textbox.IsCommentedOrQuoted(textbox.CaretLocation)) { e.Cancel = true; return; } string w = textbox.CaretIsAfterWhiteSpaceOrParen ? textbox.LastWord : textbox.WordBeforeCurrent; List <string> ww = textbox.WordsBeforeCursor; bool modifierSection = ww.Contains("SortBy", StringComparer.InvariantCultureIgnoreCase) || ww.Contains("SelectBy", StringComparer.InvariantCultureIgnoreCase) || ww.Contains("LimitTo", StringComparer.InvariantCultureIgnoreCase); if (modifierSection) { switch (w.ToLower()) { case "sortby": case "selectby": case "thenby": e.Values = orderableFieldsComplete; break; case "tracks": case "kilobytes": case "megabytes": case "gigabytes": case "days": case "hours": case "minutes": case "seconds": case "ascending": case "descending": e.Values = modifierStarts.ToList(); adjustModifierSection(e, ww); break; case "limitto": e.Cancel = true; break; default: if (w == "ascending" || w == "descending" || orderableFieldsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = modifierStarts.ToList(); // copy since the list will be changed adjustModifierSection(e, ww); string wbwbc = textbox.WordBeforeWordBeforeCurrent.ToLower(); if (wbwbc == "selectby" || wbwbc == "sortby" || wbwbc == "thenby") { e.Values = e.Values.Union(modifierEnds).ToList(); } } else { string wbwbc = textbox.WordBeforeWordBeforeCurrent.ToLower(); if (wbwbc == "limitto") { e.Values = limitTypes; } else { e.Cancel = true; } } break; } } else { if (w.Length > 0) { if (numericFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = numericComparitors; } else if (stringFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { switch (w.ToLower()) { case "track": e.Values = new List <string>() { "ContainedIn", "NotContainedIn" }; break; default: e.Values = stringComparitors; break; } } else if (numericFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = numericComparitors; } else if (binaryFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = new List <string>() { "Is" }; } else if (operatorsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = allFieldsAndModifierStarts; } else if (comparitorsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.ValueNeedsQuoting = true; switch (textbox.WordBeforeWordBeforeCurrent.ToLower()) { case "artist": e.Values = Database.GetArtists(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "albumartist": e.Values = Database.GetAlbumArtists(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "album": e.Values = Database.GetAlbums(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "genre": e.Values = Database.GetGenres(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "grouping": e.Values = Database.GetGroupings(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "composer": e.Values = Database.GetComposers(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "track": e.Values = Database.GetPlaylists(); break; case "compilation": e.Values = trueOrFalse; e.ValueNeedsQuoting = false; break; case "mono": e.Values = trueOrFalse; e.ValueNeedsQuoting = false; break; case "encoder": e.Values = Database.GetEncoders(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "equalizer": e.Values = EqualizerSetting.GetAllSettingStrings(Equalizer.GetEqualizerSettings()); break; case "filetype": e.Values = Database.GetFileTypes(); break; case "title": e.Values = Database.GetTitles(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "year": e.Values = Database.GetYears(); break; case "rating": e.Values = new List <string>() { "0", "1", "2", "3", "4", "5" }; break; default: e.Cancel = true; break; } } else if (w == "byalbum" || w == "bytrack") { e.Values = allFieldsAndModifierStarts; } else if (w.Length > 0) { e.Values = operatorsAndModifiers; } else { e.Values = allFieldsAndModifierStarts; } } else { e.Values = allStarts; } } }
public Equalizer() { instance = this; this.DoubleBuffered = true; _currentEqualizer = EqualizerSetting.Off; scrollBars = new QScrollBar[MAX_NUM_BANDS]; for (int i = 0; i < MAX_NUM_BANDS; i++) { QScrollBar qsb = new QScrollBar(false); qsb.Max = SCALE; qsb.Min = -SCALE; qsb.LargeChange = LARGE_CHANGE; qsb.Value = 0; qsb.Brightness = QScrollBar.SBBrightness.Dim; qsb.UserScroll += new QScrollBar.ScrollDelegate(scroll); this.Controls.Add(qsb); qsb.Tag = i; scrollBars[i] = qsb; } btnOn = new QButton(Localization.Get(UI_Key.Equalizer_Eq_Off), true, false); btnOn.BackColor = Color.Black; cboName = new QComboBox(true); cboName.Location = new Point(HORIZ_MARGIN, BUTTON_TOPS + btnOn.Height / 2 - cboName.Height / 2); cboName.DropDownStyle = ComboBoxStyle.DropDownList; cboName.SelectedValueChanged += new EventHandler(cboName_SelectedValueChanged); this.Controls.Add(cboName); btnOn.ButtonPressed += new QButton.ButtonDelegate(turnOn); this.Controls.Add(btnOn); btnLockPreset = new QButton(Localization.Get(UI_Key.Equalizer_Lock), true, false); btnLockPreset.BackColor = Color.Black; btnLockPreset.ButtonPressed += new QButton.ButtonDelegate(btnLockPreset_ButtonPressed); this.Controls.Add(btnLockPreset); btnFineControl = new QButton(Localization.Get(UI_Key.Equalizer_Fine_Control), true, false); btnFineControl.BackColor = Color.Black; btnFineControl.Value = false; btnFineControl.ButtonPressed += (s) => { if (btnFineControl.Value) { btnAllTogether.Value = false; } }; this.Controls.Add(btnFineControl); btnAllTogether = new QButton(Localization.Get(UI_Key.Equalizer_All_Together), true, false); btnAllTogether.BackColor = Color.Black; btnAllTogether.Value = false; btnAllTogether.ButtonPressed += (s) => { if (btnAllTogether.Value) { btnFineControl.Value = false; } }; this.Controls.Add(btnAllTogether); btnExpand = new QButton(Localization.Get(UI_Key.Equalizer_Expand), false, false); btnExpand.BackColor = Color.Black; btnExpand.ButtonPressed += new QButton.ButtonDelegate(expand); this.Controls.Add(btnExpand); btnCompress = new QButton(Localization.Get(UI_Key.Equalizer_Compress), false, false); btnCompress.BackColor = Color.Black; btnCompress.ButtonPressed += new QButton.ButtonDelegate(compress); this.Controls.Add(btnCompress); btnReset = new QButton(Localization.Get(UI_Key.Equalizer_Reset), false, false); btnReset.BackColor = Color.Black; btnReset.ButtonPressed += new QButton.ButtonDelegate(reset); this.Controls.Add(btnReset); btnRemovePreset = new QButton(Localization.Get(UI_Key.Equalizer_Remove), false, false); btnRemovePreset.BackColor = Color.Black; btnRemovePreset.ButtonPressed += new QButton.ButtonDelegate(btnRemovePreset_ButtonPressed); this.Controls.Add(btnRemovePreset); btnNewPreset = new QButton(Localization.Get(UI_Key.Equalizer_New), false, false); btnNewPreset.BackColor = Color.Black; btnNewPreset.ButtonPressed += new QButton.ButtonDelegate(btnNewPreset_ButtonPressed); this.Controls.Add(btnNewPreset); btnNumBands = new QButton(Localization.Get(UI_Key.Equalizer_Bands, "10"), false, false); btnNumBands.BackColor = Color.Black; btnNumBands.ButtonPressed += new QButton.ButtonDelegate(btnNumBands_ButtonPressed); this.Controls.Add(btnNumBands); fullButtonsWidth = getButtonsWidth(); }