public ChooseToolDefaultsDialog() { UI.InitScaling(this); SuspendLayout(); InitializeComponent(); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.ShapeType | ToolBarConfigItems.Brush | ToolBarConfigItems.Pen | ToolBarConfigItems.PenCaps)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.SelectionCombineMode | ToolBarConfigItems.SelectionDrawMode)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.Text)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.Gradient)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.Tolerance | ToolBarConfigItems.FloodMode)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.ColorPickerBehavior)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.Resampling)); this.toolConfigRows.Add(new ToolConfigRow(ToolBarConfigItems.AlphaBlending)); for (int i = 0; i < this.toolConfigRows.Count; ++i) { Controls.Add(this.toolConfigRows[i].HeaderLabel); Controls.Add(this.toolConfigRows[i].ToolConfigStrip); } ResumeLayout(); PerformLayout(); this.toolChooserStrip.SetTools(DocumentWorkspace.ToolInfos); PdnBaseForm.RegisterFormHotKey( Keys.Escape, delegate(Keys keys) { this.cancelButton.PerformClick(); return(true); }); }
private void ToolChooserStrip_ChooseDefaultsClicked(object sender, EventArgs e) { PdnBaseForm.UpdateAllForms(); WaitCursorChanger wcc = new WaitCursorChanger(this); using (ChooseToolDefaultsDialog dialog = new ChooseToolDefaultsDialog()) { EventHandler shownDelegate = null; shownDelegate = delegate(object sender2, EventArgs e2) { wcc.Dispose(); wcc = null; dialog.Shown -= shownDelegate; }; dialog.Shown += shownDelegate; dialog.SetToolBarSettings(this.appWorkspace.GlobalToolTypeChoice, this.appWorkspace.AppEnvironment); AppEnvironment defaultAppEnv = AppEnvironment.GetDefaultAppEnvironment(); try { dialog.LoadUIFromAppEnvironment(defaultAppEnv); } catch (Exception) { defaultAppEnv = new AppEnvironment(); defaultAppEnv.SetToDefaults(); dialog.LoadUIFromAppEnvironment(defaultAppEnv); } dialog.ToolType = this.appWorkspace.DefaultToolType; DialogResult dr = dialog.ShowDialog(this); if (dr != DialogResult.Cancel) { AppEnvironment newDefaultAppEnv = dialog.CreateAppEnvironmentFromUI(); newDefaultAppEnv.SaveAsDefaultAppEnvironment(); this.appWorkspace.AppEnvironment.LoadFrom(newDefaultAppEnv); this.appWorkspace.DefaultToolType = dialog.ToolType; this.appWorkspace.GlobalToolTypeChoice = dialog.ToolType; } } if (wcc != null) { wcc.Dispose(); wcc = null; } }
public TransferProgressDialog() { PdnBaseForm.RegisterFormHotKey( Keys.Escape, delegate(Keys keys) { OnCancelClicked(); return(true); }); InitializeComponent(); }
protected override void OnTextChanged(EventArgs e) { if (this.registeredHotKey != Keys.None) { PdnBaseForm.UnregisterFormHotKey(this.registeredHotKey, OnAccessHotKeyPressed); } char mnemonic = this.Mnemonic; if (mnemonic != noMnemonicChar && !IsOnDropDown) { Keys hotKey = Utility.LetterOrDigitCharToKeys(mnemonic); PdnBaseForm.RegisterFormHotKey(Keys.Alt | hotKey, OnAccessHotKeyPressed); } base.OnTextChanged(e); }
public DocumentStrip() { PdnBaseForm.RegisterFormHotKey(Keys.Control | Keys.Tab, OnNextTabHotKeyPressed); PdnBaseForm.RegisterFormHotKey(Keys.Control | Keys.PageDown, OnNextTabHotKeyPressed); PdnBaseForm.RegisterFormHotKey(Keys.Control | Keys.Shift | Keys.Tab, OnPreviousTabHotKeyPressed); PdnBaseForm.RegisterFormHotKey(Keys.Control | Keys.PageUp, OnPreviousTabHotKeyPressed); thumbnailManager = new ThumbnailManager(this); // allow for a 1px black border InitializeComponent(); for (int i = 0; i <= 9; ++i) { Keys digit = Utility.LetterOrDigitCharToKeys((char)(i + '0')); PdnBaseForm.RegisterFormHotKey(Keys.Control | digit, OnDigitHotKeyPressed); PdnBaseForm.RegisterFormHotKey(Keys.Alt | digit, OnDigitHotKeyPressed); } this.ShowCloseButtons = true; }
protected override void OnQueryEndSession(CancelEventArgs e) { if (IsCurrentModalForm) { OnClosing(e); } else { foreach (Form form in Application.OpenForms) { PdnBaseForm asPDF = form as PdnBaseForm; if (asPDF != null) { asPDF.Flash(); } } e.Cancel = true; } base.OnQueryEndSession(e); }