/// <summary> /// Configures the user interface when the settings have been changed and an update is needed. /// </summary> private void UpdateChangedSettings() { ProfessionalColorTable oColourTable = new ProfessionalColorTable(); // Assign a custom colour table if specified. if (IViewSettings.Default.ColourTable == ColourTable.ArcticSilver) oColourTable = new ArcticSilverColourTable(); else if (IViewSettings.Default.ColourTable == ColourTable.SkyBlue) oColourTable = new SkyBlueColourTable(); // Create and assign a toolstrip renderer with the specified colour table to the toolstrip manager. ToolStripProfessionalRenderer oRenderer = new ToolStripProfessionalRenderer(oColourTable); ToolStripManager.Renderer = oRenderer; // Create another toolstrip renderer but remove the rounded edges. oRenderer = new ToolStripProfessionalRenderer(oColourTable); oRenderer.RoundedEdges = false; // Apply the toolstrip renderer without rounded edges to the smaller toolstrips. ts_elvw_Tools.Renderer = oRenderer; ts_etvw_Tools.Renderer = oRenderer; ts_task_Tools.Renderer = oRenderer; ts_imgbx_Tools.Renderer = oRenderer; // Update the ImageBrowser properties. m_oImageBrowser.MaxFiles = IViewSettings.Default.MaxFiles; m_oImageBrowser.MaxFileLength = IViewSettings.Default.MaxFileLength; m_oImageBrowser.HighQualityThumbnails = IViewSettings.Default.HighQualityThumbnails; m_oImageBrowser.Effect = IViewSettings.Default.ThumbnailEffect; // Update the imagebox back colour. imgbx_MainImage.BackColor = IViewSettings.Default.MainDisplayColour; // Update the show listviewitem tooltips. elvw_Images.ShowItemToolTips = IViewSettings.Default.ImageListToolTips; // Update the listview item spacing. AdjustListViewItemSpacing(m_nImageListViewType); }
/// <summary> /// Configures the application when the form has been initialized. /// </summary> /// <returns></returns> private void ConfigureApplication() { // Form designer code initialization. InitializeComponent(); // Make sure certain field members get initialized. m_nImageBoxKeyPressed = Keys.None; m_nCurrentTool = Tool.None; m_nSelectedWindow = Window.None; m_nSelectedTaskWindow = IViewSettings.Default.SelectedTaskWindow; m_nImageScale = IViewSettings.Default.AutoScale; m_nImageListViewType = IViewSettings.Default.ImageListViewType; m_oUndoRedo = new ImageEditManagement(IViewSettings.Default.MaxUndos); m_oFavourites = new FavouritesCollection(IViewSettings.Default.Favourites); m_oNewWindows = new List<NewWindow>(); // Initialize a new instance of the ImageBrowser class. m_oImageBrowser = new ImageBrowser(); m_oImageBrowser.MaxFiles = IViewSettings.Default.MaxFiles; m_oImageBrowser.MaxFileLength = IViewSettings.Default.MaxFileLength; m_oImageBrowser.HighQualityThumbnails = IViewSettings.Default.HighQualityThumbnails; m_oImageBrowser.Effect = IViewSettings.Default.ThumbnailEffect; m_oImageBrowser.FileRenamed += new EventHandler<ImageBrowserRenameEventArgs>(ImageBrowser_FileRenamed); m_oImageBrowser.ItemRemoved += new EventHandler<ImageBrowserItemEventArgs>(ImageBrowser_ItemRemoved); // Initialize a new docking window for the explorer. Rectangle WndRect = IViewSettings.Default.ExplorerWindowRect; m_oExplorerDockWindow = new DockingWindow(WndRect, ExplorerSplitterPanel, new Control[] { etvw_Directorys, ts_etvw_Tools }); m_oExplorerDockWindow.Name = "ExplorerDockingWindow"; m_oExplorerDockWindow.Text = "Explorer"; m_oExplorerDockWindow.DockChanged += new EventHandler<DockChangedEventArgs>(DockingWindow_DockChanged); // Initialize a new docking window for the image list. WndRect = IViewSettings.Default.ImageListWindowRect; m_oImageListDockWindow = new DockingWindow(WndRect, ImageListSplitterPanel, new Control[] { elvw_Images, ts_elvw_Tools }); m_oImageListDockWindow.Name = "ImageListDockingWindow"; m_oImageListDockWindow.Text = "Image List"; m_oImageListDockWindow.DockChanged += new EventHandler<DockChangedEventArgs>(DockingWindow_DockChanged); // Initialize a new docking window for the task panel. WndRect = IViewSettings.Default.TasksWindowRect; m_oTaskDockWindow = new DockingWindow(WndRect, TaskSplitterPanel, new Control[] { pan_TasksContainer, ts_task_Tools }); m_oTaskDockWindow.Name = "TaskDockingWindow"; m_oTaskDockWindow.Text = "Tasks"; m_oTaskDockWindow.DockChanged += new EventHandler<DockChangedEventArgs>(DockingWindow_DockChanged); // Initialize the PropertiesPanel. m_oPropertiesPanel = new PropertiesPanel(); m_oPropertiesPanel.Dock = DockStyle.Fill; m_oPropertiesPanel.HistogramAutoRefresh = IViewSettings.Default.AutoRefreshHistogram; m_oPropertiesPanel.HistogramVisible = IViewSettings.Default.HistogramVisible; m_oPropertiesPanel.PropertiesToolbarVisible = IViewSettings.Default.PropertiesToolbarVisible; m_oPropertiesPanel.PropertiesHelpVisible = IViewSettings.Default.PropertiesHelpVisible; int nDist = m_oPropertiesPanel.Height - IViewSettings.Default.HistogramHeight; m_oPropertiesPanel.SplitterDistance = (nDist > 0 && nDist < m_oPropertiesPanel.Height) ? nDist : 100; m_oPropertiesPanel.HistogramUpdateRequested += delegate(object sender, EventArgs e) { if (imgbx_MainImage.IsImageLoaded) m_oPropertiesPanel.ProcessImage((Bitmap)imgbx_MainImage.ImageBoxImage); }; // Initialize the ResizePanel. m_oResizePanel = new ResizePanel(); m_oResizePanel.Dock = DockStyle.Fill; m_oResizePanel.Enabled = false; m_oResizePanel.ApplyButtonClicked += delegate(object sender, EventArgs e) { SubResizeImage(); }; // Initialize the ShearPanel. m_oShearPanel = new ShearPanel(); m_oShearPanel.Dock = DockStyle.Fill; m_oShearPanel.Enabled = false; m_oShearPanel.ApplyButtonClicked += delegate(object sender, EventArgs e) { SubShearImage(); }; // Initialize the RedEyePanel. m_oRedEyePanel = new RedEyePanel(); m_oRedEyePanel.Dock = DockStyle.Fill; m_oRedEyePanel.Enabled = false; m_oRedEyePanel.PupilSizeMinimum = 1; m_oRedEyePanel.PupilSizeMaximium = 64; m_oRedEyePanel.PupilSize = 32; m_oRedEyePanel.ActivateClick += delegate(object sender, EventArgs e) { m_nCurrentTool = Tool.RedEyeCorrection; }; ProfessionalColorTable oColourTable = new ProfessionalColorTable(); // Assign a custom colour table if specified. if (IViewSettings.Default.ColourTable == ColourTable.ArcticSilver) oColourTable = new ArcticSilverColourTable(); else if (IViewSettings.Default.ColourTable == ColourTable.SkyBlue) oColourTable = new SkyBlueColourTable(); // Create and assign a toolstrip renderer with the specified colour table to the toolstrip manager. ToolStripProfessionalRenderer oRenderer = new ToolStripProfessionalRenderer(oColourTable); ToolStripManager.Renderer = oRenderer; // Create another toolstrip renderer but remove the rounded edges. oRenderer = new ToolStripProfessionalRenderer(oColourTable); oRenderer.RoundedEdges = false; // Apply the toolstrip renderer without rounded edges to the smaller toolstrips. ts_elvw_Tools.Renderer = oRenderer; ts_etvw_Tools.Renderer = oRenderer; ts_task_Tools.Renderer = oRenderer; ts_imgbx_Tools.Renderer = oRenderer; // Set the toolstrip overflow button properties. ts_Toolbar.OverflowButton.AutoToolTip = true; ts_Toolbar.OverflowButton.DropDownDirection = ToolStripDropDownDirection.BelowRight; ts_Toolbar.OverflowButton.ToolTipText = "Toolbar Options"; // Put the add or remove button on the overflow. VS will cash if implemented at design time. tsddb_tb_AddRemove.Overflow = ToolStripItemOverflow.Always; // Set the main toolbar and status bar visibility. ts_Toolbar.Visible = IViewSettings.Default.ToolbarVisible; ss_Main.Visible = IViewSettings.Default.StatusStripVisible; // Send the main toolstrip to the specified parent container. if (IViewSettings.Default.ToolBarPanel == ToolBarPanel.Top) ts_Toolbar.Parent = tsc_Main.TopToolStripPanel; else if (IViewSettings.Default.ToolBarPanel == ToolBarPanel.Bottom) ts_Toolbar.Parent = tsc_Main.BottomToolStripPanel; else if (IViewSettings.Default.ToolBarPanel == ToolBarPanel.Left) ts_Toolbar.Parent = tsc_Main.LeftToolStripPanel; else if (IViewSettings.Default.ToolBarPanel == ToolBarPanel.Right) ts_Toolbar.Parent = tsc_Main.RightToolStripPanel; // Configure the forms DesktopBounds property. this.DesktopBounds = IViewSettings.Default.MainWindowRect; // Configure the state of the main window. if (IViewSettings.Default.MainWindowState == MainWindowState.FullScreen) SubToggleFullScreenMode(); else if (IViewSettings.Default.MainWindowState == MainWindowState.Maximized) this.WindowState = FormWindowState.Maximized; // Set the explorer splitter bar distance. nDist = IViewSettings.Default.ExplorerSplitterDist; sc_Explorer.SplitterDistance = (nDist > 0 && nDist < (sc_Explorer.Width - sc_Explorer.Panel2MinSize)) ? nDist : sc_Explorer.Width / 2; // Set the image list splitter bar distance. nDist = sc_ImageList.Height - IViewSettings.Default.ImageListSplitterDist; sc_ImageList.SplitterDistance = (nDist > 0 && nDist < (sc_ImageList.Height - sc_ImageList.Panel2MinSize)) ? nDist : sc_ImageList.Height / 2; // Set the tasks splitter bar distance. nDist = sc_Tasks.Width - IViewSettings.Default.TasksSplitterDist; sc_Tasks.SplitterDistance = (nDist > 0 && nDist < (sc_Tasks.Width - sc_Tasks.Panel2MinSize)) ? nDist : sc_Tasks.Width / 2; // Configure the dock or collapse state of the explorer window. if (!IViewSettings.Default.ExplorerDocked) m_oExplorerDockWindow.UnDock(this); else ExplorerSplitterPanelCollapsed = IViewSettings.Default.ExplorerCollapsed; // Configure the dock or collapse state of the image list window. if (!IViewSettings.Default.ImageListDocked) m_oImageListDockWindow.UnDock(this); else ImageListSplitterPanelCollapsed = IViewSettings.Default.ImageListCollapsed; // Configure the dock or collapse state of the tasks window. if (!IViewSettings.Default.TasksDocked) m_oTaskDockWindow.UnDock(this); else TaskSplitterPanelCollapsed = IViewSettings.Default.TasksCollapsed; // Configure the explorerlistview, view. switch (IViewSettings.Default.ImageListViewType) { case ImageListViewType.LargeIcons: case ImageListViewType.MediumIcons: case ImageListViewType.SmallIcons: elvw_Images.View = View.LargeIcon; break; case ImageListViewType.List: elvw_Images.View = View.List; break; case ImageListViewType.Details: elvw_Images.View = View.Details; break; } // Set the width of the explorer listview column headers. ch_FileName.Width = IViewSettings.Default.NameColumnWidth; ch_Date.Width = IViewSettings.Default.DateColumnWidth; ch_FileType.Width = IViewSettings.Default.TypeColumnWidth; ch_FileSize.Width = IViewSettings.Default.SizeColumnWidth; // Update the imagebox back colour. imgbx_MainImage.BackColor = IViewSettings.Default.MainDisplayColour; // Add the explorer treeview parent nodes. etvw_Directorys.AddBaseNodes(); // Add the favourite nodes to the treeview. SubLoadFavourites(); // Show the last selected task window. SubShowTaskWindow(m_nSelectedTaskWindow, false); // Check for updates if specified. if (IViewSettings.Default.AutomaticUpdates) SubCheckForUpdates(false, false); }