mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
WIP: Keyboard shortcuts
This commit is contained in:
parent
f4a1b19a5f
commit
a8d8818f30
@ -21,7 +21,7 @@ public class GtkDesktopForm : DesktopForm
|
||||
|
||||
public GtkDesktopForm(
|
||||
Naps2Config config,
|
||||
// KeyboardShortcutManager ksm,
|
||||
DesktopKeyboardShortcuts keyboardShortcuts,
|
||||
INotificationManager notify,
|
||||
CultureHelper cultureHelper,
|
||||
IProfileManager profileManager,
|
||||
@ -35,7 +35,7 @@ public class GtkDesktopForm : DesktopForm
|
||||
DesktopFormProvider desktopFormProvider,
|
||||
IDesktopSubFormController desktopSubFormController,
|
||||
DesktopCommands commands)
|
||||
: base(config, /*ksm,*/ notify, cultureHelper, profileManager,
|
||||
: base(config, keyboardShortcuts, notify, cultureHelper, profileManager,
|
||||
imageList, imageTransfer, thumbnailController, thumbnailProvider, desktopController, desktopScanController,
|
||||
imageListActions, desktopFormProvider, desktopSubFormController, commands)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ public class MacDesktopForm : DesktopForm
|
||||
{
|
||||
public MacDesktopForm(
|
||||
Naps2Config config,
|
||||
// KeyboardShortcutManager ksm,
|
||||
DesktopKeyboardShortcuts keyboardShortcuts,
|
||||
INotificationManager notify,
|
||||
CultureHelper cultureHelper,
|
||||
IProfileManager profileManager,
|
||||
@ -26,7 +26,7 @@ public class MacDesktopForm : DesktopForm
|
||||
DesktopFormProvider desktopFormProvider,
|
||||
IDesktopSubFormController desktopSubFormController,
|
||||
DesktopCommands commands)
|
||||
: base(config, /*ksm,*/ notify, cultureHelper, profileManager,
|
||||
: base(config, keyboardShortcuts, notify, cultureHelper, profileManager,
|
||||
imageList, imageTransfer, thumbnailController, thumbnailProvider, desktopController, desktopScanController,
|
||||
imageListActions, desktopFormProvider, desktopSubFormController, commands)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ public class WinFormsDesktopForm : DesktopForm
|
||||
|
||||
public WinFormsDesktopForm(
|
||||
Naps2Config config,
|
||||
// KeyboardShortcutManager ksm,
|
||||
DesktopKeyboardShortcuts keyboardShortcuts,
|
||||
INotificationManager notify,
|
||||
CultureHelper cultureHelper,
|
||||
IProfileManager profileManager,
|
||||
@ -37,7 +37,7 @@ public class WinFormsDesktopForm : DesktopForm
|
||||
DesktopFormProvider desktopFormProvider,
|
||||
IDesktopSubFormController desktopSubFormController,
|
||||
DesktopCommands commands)
|
||||
: base(config, /*ksm,*/ notify, cultureHelper, profileManager,
|
||||
: base(config, keyboardShortcuts, notify, cultureHelper, profileManager,
|
||||
imageList, imageTransfer, thumbnailController, thumbnailProvider, desktopController, desktopScanController,
|
||||
imageListActions, desktopFormProvider, desktopSubFormController, commands)
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ public class DesktopController
|
||||
if (MessageBox.Show(_desktopFormProvider.DesktopForm,
|
||||
string.Format(MiscResources.ConfirmDeleteItems, _imageList.Selection.Count),
|
||||
MiscResources.Delete, MessageBoxButtons.OKCancel,
|
||||
MessageBoxType.Question) == DialogResult.Ok)
|
||||
MessageBoxType.Question, MessageBoxDefaultButton.OK) == DialogResult.Ok)
|
||||
{
|
||||
_imageListActions.DeleteSelected();
|
||||
}
|
||||
@ -387,7 +387,7 @@ public class DesktopController
|
||||
if (MessageBox.Show(_desktopFormProvider.DesktopForm,
|
||||
string.Format(MiscResources.ConfirmResetImages, _imageList.Selection.Count),
|
||||
MiscResources.ResetImage,
|
||||
MessageBoxButtons.OKCancel, MessageBoxType.Question) == DialogResult.Ok)
|
||||
MessageBoxButtons.OKCancel, MessageBoxType.Question, MessageBoxDefaultButton.OK) == DialogResult.Ok)
|
||||
{
|
||||
_imageListActions.ResetTransforms();
|
||||
}
|
||||
|
136
NAPS2.Lib/EtoForms/Desktop/DesktopKeyboardShortcuts.cs
Normal file
136
NAPS2.Lib/EtoForms/Desktop/DesktopKeyboardShortcuts.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using Eto.Forms;
|
||||
using NAPS2.EtoForms.Ui;
|
||||
|
||||
namespace NAPS2.EtoForms.Desktop;
|
||||
|
||||
public class DesktopKeyboardShortcuts
|
||||
{
|
||||
private readonly KeyboardShortcutManager _ksm;
|
||||
private readonly Naps2Config _config;
|
||||
|
||||
public DesktopKeyboardShortcuts(KeyboardShortcutManager ksm, Naps2Config config)
|
||||
{
|
||||
_ksm = ksm;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public void Assign(DesktopCommands commands)
|
||||
{
|
||||
// Defaults
|
||||
_ksm.Assign("Ctrl+Enter", commands.Scan);
|
||||
_ksm.Assign("Ctrl+B", commands.BatchScan);
|
||||
_ksm.Assign("Ctrl+O", commands.Import);
|
||||
_ksm.Assign("Ctrl+S", commands.SavePdf);
|
||||
_ksm.Assign("Ctrl+P", commands.Print);
|
||||
_ksm.Assign("Ctrl+Up", commands.MoveUp);
|
||||
_ksm.Assign("Ctrl+Left", commands.MoveUp);
|
||||
_ksm.Assign("Ctrl+Down", commands.MoveDown);
|
||||
_ksm.Assign("Ctrl+Right", commands.MoveDown);
|
||||
_ksm.Assign("Ctrl+Shift+Del", commands.ClearAll);
|
||||
_ksm.Assign("F1", commands.About);
|
||||
_ksm.Assign("Ctrl+OemMinus", commands.ZoomOut);
|
||||
_ksm.Assign("Ctrl+Oemplus", commands.ZoomIn);
|
||||
_ksm.Assign("Del", commands.Delete);
|
||||
_ksm.Assign("Ctrl+A", commands.SelectAll);
|
||||
_ksm.Assign("Ctrl+C", commands.Copy);
|
||||
_ksm.Assign("Ctrl+V", commands.Paste);
|
||||
|
||||
// Configured
|
||||
|
||||
var ks = _config.Get(c => c.KeyboardShortcuts);
|
||||
|
||||
_ksm.Assign(ks.About, commands.About);
|
||||
_ksm.Assign(ks.BatchScan, commands.BatchScan);
|
||||
_ksm.Assign(ks.Clear, commands.ClearAll);
|
||||
_ksm.Assign(ks.Delete, commands.Delete);
|
||||
_ksm.Assign(ks.EmailPDF, commands.EmailPdf);
|
||||
_ksm.Assign(ks.EmailPDFAll, commands.EmailAllPdf);
|
||||
_ksm.Assign(ks.EmailPDFSelected, commands.EmailSelectedPdf);
|
||||
_ksm.Assign(ks.ImageBlackWhite, commands.BlackWhite);
|
||||
_ksm.Assign(ks.ImageBrightness, commands.BrightCont);
|
||||
_ksm.Assign(ks.ImageContrast, commands.BrightCont);
|
||||
_ksm.Assign(ks.ImageCrop, commands.Crop);
|
||||
_ksm.Assign(ks.ImageHue, commands.HueSat);
|
||||
_ksm.Assign(ks.ImageSaturation, commands.HueSat);
|
||||
_ksm.Assign(ks.ImageSharpen, commands.Sharpen);
|
||||
_ksm.Assign(ks.ImageReset, commands.ResetImage);
|
||||
_ksm.Assign(ks.ImageView, commands.ViewImage);
|
||||
_ksm.Assign(ks.Import, commands.Import);
|
||||
_ksm.Assign(ks.MoveDown, commands.MoveDown);
|
||||
_ksm.Assign(ks.MoveUp, commands.MoveUp);
|
||||
_ksm.Assign(ks.NewProfile, commands.NewProfile);
|
||||
_ksm.Assign(ks.Ocr, commands.Ocr);
|
||||
_ksm.Assign(ks.Print, commands.Print);
|
||||
_ksm.Assign(ks.Profiles, commands.Profiles);
|
||||
|
||||
_ksm.Assign(ks.ReorderAltDeinterleave, commands.AltDeinterleave);
|
||||
_ksm.Assign(ks.ReorderAltInterleave, commands.AltInterleave);
|
||||
_ksm.Assign(ks.ReorderDeinterleave, commands.Deinterleave);
|
||||
_ksm.Assign(ks.ReorderInterleave, commands.Interleave);
|
||||
_ksm.Assign(ks.ReorderReverseAll, commands.ReverseAll);
|
||||
_ksm.Assign(ks.ReorderReverseSelected, commands.ReverseSelected);
|
||||
_ksm.Assign(ks.RotateCustom, commands.CustomRotate);
|
||||
_ksm.Assign(ks.RotateFlip, commands.Flip);
|
||||
_ksm.Assign(ks.RotateLeft, commands.RotateLeft);
|
||||
_ksm.Assign(ks.RotateRight, commands.RotateRight);
|
||||
_ksm.Assign(ks.SaveImages, commands.SaveImages);
|
||||
_ksm.Assign(ks.SaveImagesAll, commands.SaveAllImages);
|
||||
_ksm.Assign(ks.SaveImagesSelected, commands.SaveSelectedImages);
|
||||
_ksm.Assign(ks.SavePDF, commands.SavePdf);
|
||||
_ksm.Assign(ks.SavePDFAll, commands.SaveAllPdf);
|
||||
_ksm.Assign(ks.SavePDFSelected, commands.SaveSelectedPdf);
|
||||
_ksm.Assign(ks.ScanDefault, commands.Scan);
|
||||
|
||||
_ksm.Assign(ks.ZoomIn, commands.ZoomIn);
|
||||
_ksm.Assign(ks.ZoomOut, commands.ZoomOut);
|
||||
}
|
||||
|
||||
public void AssignProfileShortcut(int i, Command command)
|
||||
{
|
||||
var sh = GetProfileShortcut(i);
|
||||
if (string.IsNullOrWhiteSpace(sh) && i <= 11)
|
||||
{
|
||||
sh = "F" + (i + 1);
|
||||
}
|
||||
_ksm.Assign(sh, command);
|
||||
}
|
||||
|
||||
private string? GetProfileShortcut(int i)
|
||||
{
|
||||
// TODO: Granular
|
||||
var ks = _config.Get(c => c.KeyboardShortcuts);
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return ks.ScanProfile1;
|
||||
case 2:
|
||||
return ks.ScanProfile2;
|
||||
case 3:
|
||||
return ks.ScanProfile3;
|
||||
case 4:
|
||||
return ks.ScanProfile4;
|
||||
case 5:
|
||||
return ks.ScanProfile5;
|
||||
case 6:
|
||||
return ks.ScanProfile6;
|
||||
case 7:
|
||||
return ks.ScanProfile7;
|
||||
case 8:
|
||||
return ks.ScanProfile8;
|
||||
case 9:
|
||||
return ks.ScanProfile9;
|
||||
case 10:
|
||||
return ks.ScanProfile10;
|
||||
case 11:
|
||||
return ks.ScanProfile11;
|
||||
case 12:
|
||||
return ks.ScanProfile12;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Perform(Keys keyData)
|
||||
{
|
||||
return _ksm.Perform(keyData);
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace NAPS2.Util;
|
||||
namespace NAPS2.EtoForms;
|
||||
|
||||
// TODO: Refactor to Eto and move to NAPS2.EtoForms
|
||||
// TODO: Most dialogs should close on Escape being pressed
|
||||
/// <summary>
|
||||
/// A helper class to assign keyboard shortcuts to actions or WinForm buttons.
|
||||
/// A helper class to assign keyboard shortcuts to commands.
|
||||
/// </summary>
|
||||
public class KeyboardShortcutManager
|
||||
{
|
||||
private readonly Dictionary<Keys, Action> _dict = new();
|
||||
private readonly Dictionary<Keys, ToolStripMenuItem> _itemDict = new();
|
||||
private readonly Dictionary<Keys, Command> _commandDict = new();
|
||||
|
||||
private readonly Dictionary<string, Keys> _customMap = new()
|
||||
{
|
||||
@ -55,35 +52,35 @@ public class KeyboardShortcutManager
|
||||
if (keys != Keys.None)
|
||||
{
|
||||
_dict[keys] = action;
|
||||
if (_itemDict.ContainsKey(keys))
|
||||
if (_commandDict.ContainsKey(keys))
|
||||
{
|
||||
_itemDict[keys].ShortcutKeys = Keys.None;
|
||||
_itemDict.Remove(keys);
|
||||
ActionCommand c;
|
||||
_commandDict[keys].Shortcut = Keys.None;
|
||||
_commandDict.Remove(keys);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Assign(string? value, ToolStripMenuItem item, Action action)
|
||||
public bool Assign(string? value, Command command, Action action)
|
||||
{
|
||||
var keys = Parse(value);
|
||||
if (keys != Keys.None)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.ShortcutKeys = Keys.None;
|
||||
item.ShortcutKeyDisplayString = TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString(keys);
|
||||
_itemDict[keys] = item;
|
||||
command.Shortcut = keys;
|
||||
_commandDict[keys] = command;
|
||||
_dict[keys] = action;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_dict[keys] = action;
|
||||
if (_itemDict.ContainsKey(keys))
|
||||
if (_commandDict.ContainsKey(keys))
|
||||
{
|
||||
_itemDict[keys].ShortcutKeys = Keys.None;
|
||||
_itemDict.Remove(keys);
|
||||
_commandDict[keys].Shortcut = Keys.None;
|
||||
_commandDict.Remove(keys);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -91,38 +88,9 @@ public class KeyboardShortcutManager
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Assign(string? value, ToolStripButton item)
|
||||
public bool Assign(string? value, Command command)
|
||||
{
|
||||
if (item.GetCurrentParent() == null) return false;
|
||||
if (Assign(value, item.PerformClick))
|
||||
{
|
||||
item.AutoToolTip = true;
|
||||
item.ToolTipText = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Assign(string? value, ToolStripMenuItem item)
|
||||
{
|
||||
return Assign(value, item, item.PerformClick);
|
||||
}
|
||||
|
||||
public bool Assign(string? value, ToolStripSplitButton item)
|
||||
{
|
||||
if (item.GetCurrentParent() == null) return false;
|
||||
if (Assign(value, item.PerformButtonClick))
|
||||
{
|
||||
item.AutoToolTip = true;
|
||||
item.ToolTipText = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Assign(string? value, Button item)
|
||||
{
|
||||
return Assign(value, item.PerformClick);
|
||||
return Assign(value, command, command.Execute);
|
||||
}
|
||||
|
||||
public bool Perform(Keys keyData)
|
@ -12,7 +12,7 @@ namespace NAPS2.EtoForms.Ui;
|
||||
|
||||
public abstract class DesktopForm : EtoFormBase
|
||||
{
|
||||
// private readonly KeyboardShortcutManager _ksm;
|
||||
private readonly DesktopKeyboardShortcuts _keyboardShortcuts;
|
||||
private readonly INotificationManager _notify;
|
||||
private readonly CultureHelper _cultureHelper;
|
||||
private readonly IProfileManager _profileManager;
|
||||
@ -34,7 +34,7 @@ public abstract class DesktopForm : EtoFormBase
|
||||
|
||||
public DesktopForm(
|
||||
Naps2Config config,
|
||||
// KeyboardShortcutManager ksm,
|
||||
DesktopKeyboardShortcuts keyboardShortcuts,
|
||||
INotificationManager notify,
|
||||
CultureHelper cultureHelper,
|
||||
IProfileManager profileManager,
|
||||
@ -49,7 +49,7 @@ public abstract class DesktopForm : EtoFormBase
|
||||
IDesktopSubFormController desktopSubFormController,
|
||||
DesktopCommands commands) : base(config)
|
||||
{
|
||||
// _ksm = ksm;
|
||||
_keyboardShortcuts = keyboardShortcuts;
|
||||
_notify = notify;
|
||||
_cultureHelper = cultureHelper;
|
||||
_profileManager = profileManager;
|
||||
@ -84,6 +84,8 @@ public abstract class DesktopForm : EtoFormBase
|
||||
// TODO: Fix Eto so that we don't need to set an item here (otherwise the first time we right click nothing happens)
|
||||
_contextMenu.Items.Add(Commands.SelectAll);
|
||||
_contextMenu.Opening += OpeningContextMenu;
|
||||
_keyboardShortcuts.Assign(Commands);
|
||||
KeyDown += OnKeyDown;
|
||||
|
||||
LayoutController.RootPadding = 0;
|
||||
FormStateController.AutoLayoutSize = false;
|
||||
@ -351,10 +353,6 @@ public abstract class DesktopForm : EtoFormBase
|
||||
return L.Row(zoomOut, zoomIn).Spacing(-1);
|
||||
}
|
||||
|
||||
// // protected override void OnLoad(EventArgs args) => PostInitializeComponent();
|
||||
//
|
||||
// protected override void OnLoadComplete(EventArgs args) => AfterLayout();
|
||||
|
||||
// /// <summary>
|
||||
// /// Runs when the form is first loaded and every time the language is changed.
|
||||
// /// </summary>
|
||||
@ -409,19 +407,6 @@ public abstract class DesktopForm : EtoFormBase
|
||||
{
|
||||
Application.Instance.MainForm = newMainForm;
|
||||
}
|
||||
//
|
||||
// private async void FDesktop_Shown(object sender, EventArgs e)
|
||||
// {
|
||||
// // TODO: Start the Eto application in the entry point once all forms (or at least FDesktop?) are migrated
|
||||
// new Eto.Forms.Application(Eto.Platforms.WinForms).Attach();
|
||||
//
|
||||
// UpdateToolbar();
|
||||
// await _desktopController.Initialize();
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
|
||||
#region Toolbar
|
||||
|
||||
protected virtual void UpdateToolbar()
|
||||
{
|
||||
@ -445,13 +430,9 @@ public abstract class DesktopForm : EtoFormBase
|
||||
Commands.ReverseSelected.MenuText = string.Format(MiscResources.SelectedCount, ImageList.Selection.Count);
|
||||
Commands.SaveSelectedPdf.Enabled = Commands.SaveSelectedImages.Enabled = Commands.EmailSelectedPdf.Enabled =
|
||||
Commands.ReverseSelected.Enabled = ImageList.Selection.Any();
|
||||
//
|
||||
// // Context-menu actions
|
||||
// ctxView.Visible = ctxCopy.Visible = ctxDelete.Visible =
|
||||
// ctxSeparator1.Visible = ctxSeparator2.Visible = _imageList.Selection.Any();
|
||||
// ctxSelectAll.Enabled = _imageList.Images.Any();
|
||||
//
|
||||
|
||||
// Other
|
||||
Commands.SelectAll.Enabled = ImageList.Images.Any();
|
||||
Commands.ZoomIn.Enabled = ImageList.Images.Any() && _thumbnailController.VisibleSize < ThumbnailSizes.MAX_SIZE;
|
||||
Commands.ZoomOut.Enabled = ImageList.Images.Any() && _thumbnailController.VisibleSize > ThumbnailSizes.MIN_SIZE;
|
||||
Commands.NewProfile.Enabled =
|
||||
@ -469,6 +450,15 @@ public abstract class DesktopForm : EtoFormBase
|
||||
Image = profile == defaultProfile ? Icons.accept_small.ToEtoImage() : null
|
||||
})
|
||||
.ToImmutableList<Command>();
|
||||
for (int i = 0; i < _scanMenuCommands.Value.Count; i++)
|
||||
{
|
||||
_keyboardShortcuts.AssignProfileShortcut(i, _scanMenuCommands.Value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
e.Handled = _keyboardShortcuts.Perform(e.KeyData);
|
||||
}
|
||||
|
||||
protected virtual void UpdateTitle(ScanProfile? defaultProfile)
|
||||
@ -476,132 +466,6 @@ public abstract class DesktopForm : EtoFormBase
|
||||
Title = string.Format(UiStrings.Naps2TitleFormat, defaultProfile?.DisplayName ?? UiStrings.Naps2FullName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//
|
||||
// #region Keyboard Shortcuts
|
||||
//
|
||||
// private void AssignKeyboardShortcuts()
|
||||
// {
|
||||
// // Defaults
|
||||
//
|
||||
// _ksm.Assign("Ctrl+Enter", tsScan);
|
||||
// _ksm.Assign("Ctrl+B", tsBatchScan);
|
||||
// _ksm.Assign("Ctrl+O", tsImport);
|
||||
// _ksm.Assign("Ctrl+S", tsdSavePDF);
|
||||
// _ksm.Assign("Ctrl+P", tsPrint);
|
||||
// _ksm.Assign("Ctrl+Up", _imageListActions.MoveUp);
|
||||
// _ksm.Assign("Ctrl+Left", _imageListActions.MoveUp);
|
||||
// _ksm.Assign("Ctrl+Down", _imageListActions.MoveDown);
|
||||
// _ksm.Assign("Ctrl+Right", _imageListActions.MoveDown);
|
||||
// _ksm.Assign("Ctrl+Shift+Del", tsClear);
|
||||
// _ksm.Assign("F1", _desktopSubFormController.ShowAboutForm);
|
||||
// _ksm.Assign("Ctrl+OemMinus", btnZoomOut);
|
||||
// _ksm.Assign("Ctrl+Oemplus", btnZoomIn);
|
||||
// _ksm.Assign("Del", ctxDelete);
|
||||
// _ksm.Assign("Ctrl+A", ctxSelectAll);
|
||||
// _ksm.Assign("Ctrl+C", ctxCopy);
|
||||
// _ksm.Assign("Ctrl+V", ctxPaste);
|
||||
//
|
||||
// // Configured
|
||||
//
|
||||
// var ks = Config.Get(c => c.KeyboardShortcuts);
|
||||
//
|
||||
// _ksm.Assign(ks.About, _desktopSubFormController.ShowAboutForm);
|
||||
// _ksm.Assign(ks.BatchScan, tsBatchScan);
|
||||
// _ksm.Assign(ks.Clear, tsClear);
|
||||
// _ksm.Assign(ks.Delete, tsDelete);
|
||||
// _ksm.Assign(ks.EmailPDF, tsdEmailPDF);
|
||||
// _ksm.Assign(ks.EmailPDFAll, tsEmailPDFAll);
|
||||
// _ksm.Assign(ks.EmailPDFSelected, tsEmailPDFSelected);
|
||||
// _ksm.Assign(ks.ImageBlackWhite, tsBlackWhite);
|
||||
// _ksm.Assign(ks.ImageBrightness, tsBrightnessContrast);
|
||||
// _ksm.Assign(ks.ImageContrast, tsBrightnessContrast);
|
||||
// _ksm.Assign(ks.ImageCrop, tsCrop);
|
||||
// _ksm.Assign(ks.ImageHue, tsHueSaturation);
|
||||
// _ksm.Assign(ks.ImageSaturation, tsHueSaturation);
|
||||
// _ksm.Assign(ks.ImageSharpen, tsSharpen);
|
||||
// _ksm.Assign(ks.ImageReset, tsReset);
|
||||
// _ksm.Assign(ks.ImageView, tsView);
|
||||
// _ksm.Assign(ks.Import, tsImport);
|
||||
// _ksm.Assign(ks.MoveDown, _imageListActions.MoveDown);
|
||||
// _ksm.Assign(ks.MoveUp, _imageListActions.MoveUp);
|
||||
// _ksm.Assign(ks.NewProfile, tsNewProfile);
|
||||
// _ksm.Assign(ks.Ocr, tsOcr);
|
||||
// _ksm.Assign(ks.Print, tsPrint);
|
||||
// _ksm.Assign(ks.Profiles, tsProfiles);
|
||||
//
|
||||
// _ksm.Assign(ks.ReorderAltDeinterleave, tsAltDeinterleave);
|
||||
// _ksm.Assign(ks.ReorderAltInterleave, tsAltInterleave);
|
||||
// _ksm.Assign(ks.ReorderDeinterleave, tsDeinterleave);
|
||||
// _ksm.Assign(ks.ReorderInterleave, tsInterleave);
|
||||
// _ksm.Assign(ks.ReorderReverseAll, tsReverseAll);
|
||||
// _ksm.Assign(ks.ReorderReverseSelected, tsReverseSelected);
|
||||
// _ksm.Assign(ks.RotateCustom, tsCustomRotation);
|
||||
// _ksm.Assign(ks.RotateFlip, tsFlip);
|
||||
// _ksm.Assign(ks.RotateLeft, tsRotateLeft);
|
||||
// _ksm.Assign(ks.RotateRight, tsRotateRight);
|
||||
// _ksm.Assign(ks.SaveImages, tsdSaveImages);
|
||||
// _ksm.Assign(ks.SaveImagesAll, tsSaveImagesAll);
|
||||
// _ksm.Assign(ks.SaveImagesSelected, tsSaveImagesSelected);
|
||||
// _ksm.Assign(ks.SavePDF, tsdSavePDF);
|
||||
// _ksm.Assign(ks.SavePDFAll, tsSavePDFAll);
|
||||
// _ksm.Assign(ks.SavePDFSelected, tsSavePDFSelected);
|
||||
// _ksm.Assign(ks.ScanDefault, tsScan);
|
||||
//
|
||||
// _ksm.Assign(ks.ZoomIn, btnZoomIn);
|
||||
// _ksm.Assign(ks.ZoomOut, btnZoomOut);
|
||||
// }
|
||||
//
|
||||
// private void AssignProfileShortcut(int i, ToolStripMenuItem item)
|
||||
// {
|
||||
// var sh = GetProfileShortcut(i);
|
||||
// if (string.IsNullOrWhiteSpace(sh) && i <= 11)
|
||||
// {
|
||||
// sh = "F" + (i + 1);
|
||||
// }
|
||||
// _ksm.Assign(sh, item);
|
||||
// }
|
||||
//
|
||||
// private string? GetProfileShortcut(int i)
|
||||
// {
|
||||
// // TODO: Granular
|
||||
// var ks = Config.Get(c => c.KeyboardShortcuts);
|
||||
// switch (i)
|
||||
// {
|
||||
// case 1:
|
||||
// return ks.ScanProfile1;
|
||||
// case 2:
|
||||
// return ks.ScanProfile2;
|
||||
// case 3:
|
||||
// return ks.ScanProfile3;
|
||||
// case 4:
|
||||
// return ks.ScanProfile4;
|
||||
// case 5:
|
||||
// return ks.ScanProfile5;
|
||||
// case 6:
|
||||
// return ks.ScanProfile6;
|
||||
// case 7:
|
||||
// return ks.ScanProfile7;
|
||||
// case 8:
|
||||
// return ks.ScanProfile8;
|
||||
// case 9:
|
||||
// return ks.ScanProfile9;
|
||||
// case 10:
|
||||
// return ks.ScanProfile10;
|
||||
// case 11:
|
||||
// return ks.ScanProfile11;
|
||||
// case 12:
|
||||
// return ks.ScanProfile12;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private void ListViewKeyDown(object? sender, KeyEventArgs e)
|
||||
// {
|
||||
// e.Handled = _ksm.Perform(e.KeyData);
|
||||
// }
|
||||
//
|
||||
// private void ListViewMouseWheel(object? sender, MouseEventArgs e)
|
||||
// {
|
||||
// if (ModifierKeys.HasFlag(Keys.Control))
|
||||
@ -614,44 +478,10 @@ public abstract class DesktopForm : EtoFormBase
|
||||
//
|
||||
//
|
||||
|
||||
// #region Context Menu
|
||||
//
|
||||
// private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
// {
|
||||
// ctxPaste.Enabled = _imageTransfer.IsInClipboard();
|
||||
// if (!_imageList.Images.Any() && !ctxPaste.Enabled)
|
||||
// {
|
||||
// e.Cancel = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void ctxSelectAll_Click(object sender, EventArgs e) => _imageListActions.SelectAll();
|
||||
// private void ctxView_Click(object sender, EventArgs e) => _desktopSubFormController.ShowViewerForm();
|
||||
// private void ctxDelete_Click(object sender, EventArgs e) => _desktopController.Delete();
|
||||
//
|
||||
// private async void ctxCopy_Click(object sender, EventArgs e) => await _desktopController.Copy();
|
||||
//
|
||||
// private void ctxPaste_Click(object sender, EventArgs e) => _desktopController.Paste();
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region Thumbnail Resizing
|
||||
//
|
||||
//
|
||||
|
||||
protected virtual void SetThumbnailSpacing(int thumbnailSize)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// private void btnZoomOut_Click(object sender, EventArgs e) => StepThumbnailSize(-1);
|
||||
// private void btnZoomIn_Click(object sender, EventArgs e) => StepThumbnailSize(1);
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
|
||||
#region Drag/Drop
|
||||
|
||||
private void ListViewItemClicked(object? sender, EventArgs e) => _desktopSubFormController.ShowViewerForm();
|
||||
|
||||
private void ListViewSelectionChanged(object? sender, EventArgs e)
|
||||
@ -693,6 +523,4 @@ public abstract class DesktopForm : EtoFormBase
|
||||
_imageListActions.MoveTo(position);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in New Issue
Block a user