private void UpdateToolDropDownList( ToolStripDropDownButton button, string action) { button.DropDownItems.Clear(); DocumentType documentType = GetPinnedOrActiveDocumentType(); if (documentType == null) { return; } Dictionary <String, BuildTool> tools = _buildToolManager.BuildTools.GetTools( documentType, action); foreach (string id in tools.Keys) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = tools[id].DisplayName; item.Tag = id; item.Checked = _buildToolManager.BuildTools.ToolIsSelected(tools[id]); item.Enabled = tools[id].BuildCommand != null; // Apply theme color if available. ThemeFlags flags = _applicationManager.ClientProfile.ThemeFlags; if (flags != null && flags.MenuForeColor != Color.Empty) { item.ForeColor = flags.MenuForeColor; } button.DropDownItems.Add(item); } }
/// <summary> /// Create the pop-up window. /// </summary> /// <param name="p">The location of the pop-up window.</param> /// <param name="list">The code assist information to be presented.</param> public LookupForm(Point p, LookupList list) { _themeFlags = ApplicationManager.GetInstance(). ClientProfile.ThemeFlags; InitializeComponent(); _listView.MultiSelect = false; _listView.Columns[0].Width = -1; this.StartPosition = FormStartPosition.Manual; this.Location = p; PopulateLookupList(list); // Remember items start with " " (it looks better) _incrementalSearchText = " " + list.LookAheadText; // Allow client apps to modify the form. LookupFormProxy.GetInstance().UpdateFormControls(Controls); }
private void ToolbarSqlConnectionSelect_DropDownOpening( object sender, EventArgs e) { _toolbarSqlConnectionSelect.Enabled = false; _toolbarSqlConnectionSelect.DropDownItems.Clear(); ThemeFlags flags = _applicationManager. ClientProfile.ThemeFlags; bool applyTheme = flags != null && flags.MenuForeColor != Color.Empty; foreach (SqlConnection cnn in _sqlConnectionManager.SqlConnections.Values) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = cnn.Name; item.Tag = cnn.ID; item.Click += new EventHandler(ConnectionMenu_Click); // Apply theme color if available. if (applyTheme) { item.ForeColor = flags.MenuForeColor; } if (_sqlConnectionManager.SelectedConnectionId == cnn.ID) { item.Checked = true; } _toolbarSqlConnectionSelect.DropDownItems.Add(item); } if (_toolbarSqlConnectionSelect.DropDownItems.Count > 0) { _toolbarSqlConnectionSelect.Enabled = true; } }
private void MainForm_ThemeActivated() { ApplicationManager applicationManager = ApplicationManager.GetInstance(); ThemeFlags flags = applicationManager. ClientProfile.ThemeFlags; if (flags != null) { if (flags.MainBackColor != Color.Empty) { BackColor = flags.MainBackColor; } if (flags.ViewBackColor != Color.Empty) { ListView.BackColor = flags.ViewBackColor; TextView.BackColor = flags.ViewBackColor; } if (flags.ViewForeColor != Color.Empty) { ListView.ForeColor = flags.ViewForeColor; TextView.ForeColor = flags.ViewForeColor; } if (flags.ViewShowBorder == false) { _listViewListView.BorderStyle = BorderStyle.None; _textViewTextBox.BorderStyle = BorderStyle.None; } } SetBackgroundImage(); }
private void PopulateSnippetsMenu( string rootFolder, ToolStripMenuItem rootMenuItem) { if (!Directory.Exists(rootFolder)) { return; } rootMenuItem.ShowShortcutKeys = true; ThemeFlags themeFlags = _applicationManager. ClientProfile.ThemeFlags; bool applyTheme = themeFlags != null && themeFlags.MenuForeColor != Color.Empty; foreach (string folder in Directory.GetDirectories(rootFolder)) { try { ToolStripMenuItem tmi = new ToolStripMenuItem(); tmi.Text = tmi.Name = Path.GetFileName(folder); tmi.Image = Resources.Folder; tmi.ImageTransparentColor = Color.Fuchsia; if (applyTheme) { tmi.ForeColor = themeFlags.MenuForeColor; if (themeFlags.MenuHideImages) { tmi.Image = null; } } rootMenuItem.DropDownItems.Add(tmi); PopulateSnippetsMenu(folder, tmi); } catch { // Ignore menu entry on error } } string[] files = Directory.GetFiles( rootFolder, Constants.SNIPPET_FILE_PATTERN); Array.Sort(files, new NoShortcutComparer()); foreach (string file in files) { try { ToolStripMenuItem tmi = new ToolStripMenuItem(); string name = Path.GetFileNameWithoutExtension(file); // Decode any shorcut keys in the name tmi.ShortcutKeys = GetShortcutKeys(ref name); // Must have a name for the snippet if (name == String.Empty) { continue; } tmi.Text = name; tmi.Name = file; tmi.Click += new EventHandler(InsertSnippet_Click); if (applyTheme) { tmi.ForeColor = themeFlags.MenuForeColor; } rootMenuItem.DropDownItems.Add(tmi); } catch { // Ignore menu entry on error } } rootMenuItem.Enabled = (rootMenuItem.DropDownItems.Count > 0); }
private void UpdatePinFileStatus() { string currentDirectory = Directory.GetCurrentDirectory(); PinnedFile pinnedFile = _buildToolManager.PinnedFiles. GetPinnedFile(currentDirectory); /* * Is it still valid? */ if (pinnedFile != null && !pinnedFile.Exists()) { _buildToolManager.PinnedFiles.Remove(pinnedFile); pinnedFile = null; } /* * PinnedFile is now null or a valid file path. * Reset the UI to base state. */ _toolbarPin.Enabled = false; _toolbarPin.Checked = false; _toolbarPinSelect.Enabled = false; _toolbarPinSelect.DropDownItems.Clear(); /* * Now refresh the file list. */ List <String> documentTypes = _buildToolManager.BuildTools.GetDocumentTypes(); string[] files = Directory.GetFiles(currentDirectory); ThemeFlags flags = _applicationManager. ClientProfile.ThemeFlags; bool applyTheme = flags != null && flags.MenuForeColor != Color.Empty; foreach (string file in files) { FileInfo fi = new FileInfo(file); if (!documentTypes.Contains(fi.Extension)) { continue; } ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = Path.GetFileName(file); item.Tag = file; // Apply theme color if available. if (applyTheme) { item.ForeColor = flags.MenuForeColor; } if (pinnedFile != null) { item.Checked = pinnedFile.Matches(file); } _toolbarPinSelect.DropDownItems.Add(item); } /* * Update the UI based on what we found. */ if (_toolbarPinSelect.DropDownItems.Count > 0) { _toolbarPinSelect.Enabled = true; } if (pinnedFile != null) { _toolbarPin.Enabled = true; _toolbarPin.Checked = pinnedFile.Selected; _toolbarPin.ToolTipText = String.Format("{0}: {1}", Resources.ToolbarPinFile, pinnedFile.Name); } else { _toolbarPin.ToolTipText = Resources.ToolbarPinFile; } UpdateBuildToolStatus(); }
public ObjectBrowserForm(ToolStrip toolbar) { _includeWorkspace = ApplicationManager.GetInstance().ClientProfile.HaveFlag( ClientFlags.CodeAssistObjectBrowserIncludeWorkspace); InitializeComponent(); #region Initialize UI _mainForm = ApplicationManager.GetInstance().MainForm; if (toolbar == null) { _useMainToolbar = true; _toolbar = _mainForm.MainToolbar; } else { _toolbar = toolbar; _useMainToolbar = false; } _hideNonPublicMembers = true; _hideSpecialNames = true; _hideInheritedMembers = true; _hidePropertyGrid = true; // Make the readonly items nearly black (black will be ignored!) propertyGrid.ViewForeColor = Color.FromArgb(0, 0, 1); Text = Resources.OBDocumentTitle; listView.Columns[0].Width = listView.Width; PopulateToolbar(); /* * Apply theme if available. */ ThemeFlags flags = ApplicationManager.GetInstance(). ClientProfile.ThemeFlags; if (flags != null) { if (flags.ViewAltBackColor != Color.Empty) { treeView.BackColor = flags.ViewAltBackColor; listView.BackColor = flags.ViewAltBackColor; propertyGrid.ViewBackColor = flags.ViewAltBackColor; } if (flags.ViewAltForeColor != Color.Empty) { treeView.ForeColor = flags.ViewAltForeColor; listView.ForeColor = flags.ViewAltForeColor; // Don't set to black (shows up as silver). if (flags.ViewAltForeColor != Color.Black) { propertyGrid.ViewForeColor = flags.ViewAltForeColor; } } if (flags.MainBackColor != Color.Empty) { _splitter.BackColor = flags.MainBackColor; _splitContainer.BackColor = flags.MainBackColor; } if (flags.ViewShowBorder == false) { treeView.BorderStyle = BorderStyle.None; listView.BorderStyle = BorderStyle.None; } } #endregion #region ActionState Handlers RegisterActionStateHandler( Constants.UI_TOOLBAR_VIEW_MODULES, ToolbarButtonState); RegisterActionStateHandler( Constants.UI_TOOLBAR_VIEW_NAMESPACES, ToolbarButtonState); if (_includeWorkspace) { RegisterActionStateHandler( Constants.UI_TOOLBAR_SHOW_WORKSPACE_ONLY, ToolbarButtonState); } RegisterActionStateHandler( Constants.UI_TOOLBAR_SHOW_NONPUBLIC, ToolbarButtonState); RegisterActionStateHandler( Constants.UI_TOOLBAR_SHOW_HIDDEN, ToolbarButtonState); RegisterActionStateHandler( Constants.UI_TOOLBAR_SHOW_INHERITED, ToolbarButtonState); RegisterActionStateHandler( Constants.UI_TOOLBAR_REFRESH_VIEW, ToolbarButtonState); RegisterActionStateHandler( Constants.UI_TOOLBAR_SHOW_PROPERTIES, ToolbarButtonState); _mainForm.ClientWindow.ActiveDocumentChanged += new EventHandler(_mainForm_ActiveDocumentChanged); FormClosed += new FormClosedEventHandler(ObjectBrowserForm_FormClosed); #endregion _referenceManager = ReferenceManager.GetInstance(); _modules = new Dictionary <string, ModuleData>(); LoadModules(); EnableModuleView(false); UpdateTreeView(); /* * Allow client applications to modify the form. */ ObjectBrowserFormProxy.GetInstance(). UpdateFormControls(Controls); }