Skip to content

Commit

Permalink
Added new button next to duplicate image results (above the Open Both…
Browse files Browse the repository at this point in the history
… Folders button), with tooltip text "Open both images". Clicking this will open both of the displayed images simultaneously in the associated external image viewing application;

Added new PNG image of two images;
Adjusted column/row spacing of the button strip in both horizontal and vertical views, to keep the Go To Next/Previous Result arrow buttons centered, after the addition of the Open Both Folders & Open Both Images buttons.
  • Loading branch information
John Ingersoll committed Jun 18, 2020
1 parent 79508db commit da7223a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 22 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/AntiDupl/AntiDupl.NET/AntiDupl.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<Compile Include="Form\ProgressForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ImageOpener.cs" />
<Compile Include="ProgressUtils.cs" />
<Compile Include="StringsDefaultRussian.cs" />
<Compile Include="CoreOptions.cs" />
Expand Down
11 changes: 1 addition & 10 deletions src/AntiDupl/AntiDupl.NET/GUIControl/ImagePreviewContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,7 @@ private void UpdateStrings()

private void OpenImage(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = m_imagePreviewPanel.CurrentImageInfo.path;
try
{
Process.Start(startInfo);
}
catch (System.Exception exeption)
{
MessageBox.Show(exeption.Message);
}
ImageOpener.OpenFile(m_imagePreviewPanel.CurrentImageInfo.path);
}

private void OpenFolder(object sender, EventArgs e)
Expand Down
11 changes: 1 addition & 10 deletions src/AntiDupl/AntiDupl.NET/GUIControl/PictureBoxPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,7 @@ private void OnFrameChanged(object sender, EventArgs e)

private void OnImageDoubleClicked(object sender, System.EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = m_currentImageInfo.path;
try
{
Process.Start(startInfo);
}
catch (System.Exception exeption)
{
MessageBox.Show(exeption.Message);
}
ImageOpener.OpenFile(m_currentImageInfo.path);
}

private void OnSizeChanged(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions src/AntiDupl/AntiDupl.NET/GUIControl/ResultsPreviewBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void SetViewMode(ResultsOptions.ViewMode viewMode)
{
m_toolStripPanel.Orientation = Orientation.Vertical;

m_buttonLayout = InitFactory.Layout.CreateVerticalCompensatedCenterAlign(30, 0);
m_buttonLayout = InitFactory.Layout.CreateVerticalCompensatedCenterAlign(0, 5);
m_buttonLayout.Controls.Add(m_toolStripPanel, 0, 2);

m_imageLayout = InitFactory.Layout.Create(1, 2, 0, 0);
Expand All @@ -100,7 +100,7 @@ public void SetViewMode(ResultsOptions.ViewMode viewMode)
{
m_toolStripPanel.Orientation = Orientation.Horizontal;

m_buttonLayout = InitFactory.Layout.CreateHorizontalCompensatedCenterAlign(0, 1);
m_buttonLayout = InitFactory.Layout.CreateHorizontalCompensatedCenterAlign(0, 104);
m_buttonLayout.Controls.Add(m_toolStripPanel, 2, 0);

m_imageLayout = InitFactory.Layout.Create(2, 1, 0, 0);
Expand Down
10 changes: 10 additions & 0 deletions src/AntiDupl/AntiDupl.NET/GUIControl/ResultsPreviewDuplPair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class ResultsPreviewDuplPair : ResultsPreviewBase
private ToolStripButton m_deleteBothButton;
private ToolStripButton m_mistakeButton;
private ToolStripButton m_openBothFoldersButton;
private ToolStripButton m_openBothImagesButton;

private struct RectanglesWithSimilarity
{
Expand Down Expand Up @@ -82,6 +83,7 @@ private void InitializeComponents()
m_renameSecondToFirstButton = InitFactory.ToolButton.Create("RenameSecondToFirstVerticalButton", CoreDll.LocalActionType.RenameSecondToFirst, OnButtonClicked);
m_mistakeButton = InitFactory.ToolButton.Create("MistakeButton", CoreDll.LocalActionType.Mistake, OnButtonClicked);
m_openBothFoldersButton = InitFactory.ToolButton.Create("OpenBothFoldersButton.png", null, OnOpenBothFoldersButtonClicked);
m_openBothImagesButton = InitFactory.ToolButton.Create("OpenBothImagesButton.png", null, OnOpenBothImagesButtonClicked);

/* m_difrentNumericUpDown = new System.Windows.Forms.NumericUpDown();
m_difrentNumericUpDown.Size = new System.Drawing.Size(62, 17);
Expand Down Expand Up @@ -123,6 +125,7 @@ public void UpdateStrings()
m_renameSecondToFirstButton.ToolTipText = GetToolTip(s.ResultsPreviewDuplPair_RenameSecondToFirstButton_ToolTip_Text, HotKeyOptions.Action.CurrentDuplPairRenameSecondToFirst);
m_mistakeButton.ToolTipText = GetToolTip(s.ResultsPreviewDefect_MistakeButton_ToolTip_Text, HotKeyOptions.Action.CurrentMistake);
m_openBothFoldersButton.ToolTipText = s.ResultsPreviewDuplPair_OpenBothFoldersButton_ToolTip_Text;
m_openBothImagesButton.ToolTipText = s.ResultsPreviewDuplPair_OpenBothImagesButton_ToolTip_Text;

// Для обновления EXIF.
if (m_currentSearchResult != null)
Expand Down Expand Up @@ -201,6 +204,12 @@ private void OnOpenBothFoldersButtonClicked(object sender, System.EventArgs e)
FolderOpener.OpenContainingFolder(m_secondImagePreviewPanel.CurrentImageInfo);
}

private void OnOpenBothImagesButtonClicked(object sender, System.EventArgs e)
{
ImageOpener.OpenFile(m_firstImagePreviewPanel.CurrentImageInfo.path);
ImageOpener.OpenFile(m_secondImagePreviewPanel.CurrentImageInfo.path);
}

private void OnOptionsChanged()
{
m_mistakeButton.Enabled = m_coreOptions.advancedOptions.mistakeDataBase;
Expand Down Expand Up @@ -237,6 +246,7 @@ protected override void AddItems(ResultsOptions.ViewMode viewMode)
m_renameSecondToFirstButton.Image = Resources.Images.Get("RenameSecondToFirstHorizontalButton");
}

m_toolStrip.Items.Add(m_openBothImagesButton);
m_toolStrip.Items.Add(m_openBothFoldersButton);
m_toolStrip.Items.Add(new ToolStripSeparator());
m_toolStrip.Items.Add(m_deleteBothButton);
Expand Down
25 changes: 25 additions & 0 deletions src/AntiDupl/AntiDupl.NET/ImageOpener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Diagnostics;
using System.Windows.Forms;

namespace AntiDupl.NET
{
static public class ImageOpener
{
/// <summary>
/// Opens the specified file using its default application.
/// </summary>
static public void OpenFile(string filePath)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = filePath;
try
{
Process.Start(startInfo);
}
catch (System.Exception exeption)
{
MessageBox.Show(exeption.Message);
}
}
}
}
1 change: 1 addition & 0 deletions src/AntiDupl/AntiDupl.NET/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public Strings()
public string ResultsPreviewDuplPair_RenameSecondToFirstButton_ToolTip_Text;
public string ResultsPreviewDuplPair_MistakeButton_ToolTip_Text;
public string ResultsPreviewDuplPair_OpenBothFoldersButton_ToolTip_Text;
public string ResultsPreviewDuplPair_OpenBothImagesButton_ToolTip_Text;

public string ResultsPreviewDefect_DeleteButton_ToolTip_Text;
public string ResultsPreviewDefect_MistakeButton_ToolTip_Text;
Expand Down
1 change: 1 addition & 0 deletions src/AntiDupl/AntiDupl.NET/StringsDefaultEnglish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static public void CopyTo(Strings s)
s.ResultsPreviewDuplPair_RenameSecondToFirstButton_ToolTip_Text = "Replace first picture by the second picture";
s.ResultsPreviewDuplPair_MistakeButton_ToolTip_Text = "Mark current result as a mistake";
s.ResultsPreviewDuplPair_OpenBothFoldersButton_ToolTip_Text = "Open both containing folders";
s.ResultsPreviewDuplPair_OpenBothImagesButton_ToolTip_Text = "Open both images";

s.ResultsPreviewDefect_DeleteButton_ToolTip_Text = "Delete picture";
s.ResultsPreviewDefect_MistakeButton_ToolTip_Text = "Mark current result as a mistake";
Expand Down
1 change: 1 addition & 0 deletions src/AntiDupl/AntiDupl.NET/StringsDefaultRussian.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static public void CopyTo(Strings s)
s.ResultsPreviewDuplPair_RenameSecondToFirstButton_ToolTip_Text = "Заместить первую картинку второй";
s.ResultsPreviewDuplPair_MistakeButton_ToolTip_Text = "Пометить текущий результат как ошибочный";
s.ResultsPreviewDuplPair_OpenBothFoldersButton_ToolTip_Text = "Откройте обе содержащие папки";
s.ResultsPreviewDuplPair_OpenBothImagesButton_ToolTip_Text = "Откройте оба изображения";

s.ResultsPreviewDefect_DeleteButton_ToolTip_Text = "Удалить картинку";
s.ResultsPreviewDefect_MistakeButton_ToolTip_Text = "Пометить текущий результат как ошибочный";
Expand Down

0 comments on commit da7223a

Please sign in to comment.