Skip to content

Commit

Permalink
Add Squeeze Button
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippDex committed Mar 12, 2024
1 parent 5001d42 commit 792f31b
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 16 deletions.
29 changes: 15 additions & 14 deletions NAPS2.Lib/Config/ToolbarButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ public enum ToolbarButtons
Profiles = 1 << 2,
Ocr = 1 << 3,
Import = 1 << 4,
SavePdf = 1 << 5,
SaveImages = 1 << 6,
EmailPdf = 1 << 7,
Print = 1 << 8,
Image = 1 << 9,
Rotate = 1 << 10,
Move = 1 << 11,
Reorder = 1 << 12,
Delete = 1 << 13,
Clear = 1 << 14,
Language = 1 << 15,
Settings = 1 << 16,
About = 1 << 17,
Donate = 1 << 18
Squeeze = 1 << 5,
SavePdf = 1 << 6,
SaveImages = 1 << 7,
EmailPdf = 1 << 8,
Print = 1 << 9,
Image = 1 << 10,
Rotate = 1 << 11,
Move = 1 << 12,
Reorder = 1 << 13,
Delete = 1 << 14,
Clear = 1 << 15,
Language = 1 << 16,
Settings = 1 << 17,
About = 1 << 18,
Donate = 1 << 19
}
4 changes: 4 additions & 0 deletions NAPS2.Lib/EtoForms/Desktop/DesktopController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ public void Import()
ImportFiles(fileNames!);
}
}
public void Squeeze()
{

}

public void Suspend()
{
Expand Down
5 changes: 5 additions & 0 deletions NAPS2.Lib/EtoForms/Desktop/DesktopSubFormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ public void ShowAboutForm()
{
_formFactory.Create<AboutForm>().ShowModal();
}
//Squeeze Anpassung
public void ShowSqueezeSettingsForm()
{
_formFactory.Create<SettingsForm>().ShowModal();
}
}
3 changes: 2 additions & 1 deletion NAPS2.Lib/EtoForms/Desktop/DesktopToolbarMenuType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public enum DesktopToolbarMenuType
Scan,
SavePdf,
SaveImages,
EmailPdf
EmailPdf,
Squeeze
}
1 change: 1 addition & 0 deletions NAPS2.Lib/EtoForms/Desktop/IDesktopSubFormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public interface IDesktopSubFormController
void ShowEmailSettingsForm();
void ShowAboutForm();
void ShowSettingsForm();
void ShowSqueezeSettingsForm();
}
23 changes: 23 additions & 0 deletions NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ public DesktopCommands(DesktopController desktopController, DesktopScanControlle
Image = iconProvider.GetIcon("folder_picture"),
Shortcut = Application.Instance.CommonModifier | Keys.O
};
// Squeeze Icon Shortcut?
Squeeze = new ActionCommand(desktopController.Squeeze)
{
Text = UiStrings.Squeeze,
Image = iconProvider.GetIcon("inbox_out-white")
};
SqueezeAll = new ActionCommand(_imageListActions.SelectAll)
{
Text = UiStrings.SqueezeAll
};
SqueezeSelected = new ActionCommand(_imageListActions.SelectAll)
{
Text = UiStrings.SqueezeSelected
};
SqueezeSettings = new ActionCommand(desktopSubFormController.ShowSqueezeSettingsForm)
{
Text = UiStrings.SqueezeSettings,
Image = iconProvider.GetIcon("cog_small")
};
SaveAll = new ActionCommand(_imageListActions.SaveAllAsPdfOrImages)
{
Text = UiStrings.SaveAll,
Expand Down Expand Up @@ -337,6 +356,10 @@ public DesktopCommands WithSelection(Func<ListSelection<UiImage>> selectionFunc)
public ActionCommand Profiles { get; set; }
public ActionCommand Ocr { get; set; }
public ActionCommand Import { get; set; }
public ActionCommand Squeeze { get; set; }
public ActionCommand SqueezeAll { get; set; }
public ActionCommand SqueezeSelected { get; set; }
public ActionCommand SqueezeSettings { get; set; }
public ActionCommand SaveAll { get; set; }
public ActionCommand SaveSelected { get; set; }
public ActionCommand SavePdf { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions NAPS2.Lib/EtoForms/Ui/DesktopForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ protected virtual void CreateToolbarsAndMenus()
CreateToolbarButton(Commands.Ocr);
if (!hiddenButtons.HasFlag(ToolbarButtons.Import))
CreateToolbarButton(Commands.Import);
// CreateToolbarSeparator();
// Anpassung für den Squeeze Button
if (!hiddenButtons.HasFlag(ToolbarButtons.Squeeze))
CreateToolbarButtonWithMenu(Commands.Squeeze, DesktopToolbarMenuType.Squeeze, new MenuProvider()
.Append(Commands.SqueezeAll)
.Append(Commands.SqueezeSelected)
.Separator()
.Append(Commands.SqueezeSettings));
CreateToolbarSeparator();
if (!hiddenButtons.HasFlag(ToolbarButtons.SavePdf))
CreateToolbarButtonWithMenu(Commands.SavePdf, DesktopToolbarMenuType.SavePdf, new MenuProvider()
Expand Down
Binary file added NAPS2.Lib/Icons/inbox_out-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion NAPS2.Lib/Lang/Resources/UiStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions NAPS2.Lib/Lang/Resources/UiStrings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -756,4 +756,16 @@
<data name="ShareAsService" xml:space="preserve">
<value>Auch teilen, wenn NAPS2 geschlossen ist</value>
</data>
<data name="Squeeze" xml:space="preserve">
<value>Squeeze</value>
</data>
<data name="SqueezeAll" xml:space="preserve">
<value>Alle</value>
</data>
<data name="SqueezeSelected" xml:space="preserve">
<value>Ausgewählte</value>
</data>
<data name="SqueezeSettings" xml:space="preserve">
<value>Sqz Einstellungen</value>
</data>
</root>

0 comments on commit 792f31b

Please sign in to comment.