Skip to content

Conversation

@mandulaj
Copy link

Sometimes the red/blue diff view is a bit confusing and its easier to just check the left/right documents individually. This PR adds buttons to toggle between 3 modes:

  • Left Document
  • Diff
  • Right Document

You can also use Ctrl < and Ctrl > to hot switch between the Left/Right view.

Ctrl d returns to the default Diff view.

Futher more, the Ctrl d sets the offsets to 0, 0 (acts as a clear in case you want to quickly reset the offset)

Futher Improvements

[ ] Show the names of the current document view (Left: file.pdf/ Right other.pdf / Diff)
[ ] Handle Missing pages (currently the diff doesn't handle missing pages and just shows changes for all subsequent pages)

Comment on lines +611 to +616
toolbar->AddTool(ID_LEFT_DOC, "Left document", BMP_ARTPROV(wxART_GO_BACK),
"Show left document (Ctrl <)");
toolbar->AddTool(ID_DIFF_DOC, "Diff document", BMP_ARTPROV(wxART_REDO),
"Show diff document (Ctrl d)");
toolbar->AddTool(ID_RIGHT_DOC, "Right document", BMP_ARTPROV(wxART_GO_FORWARD),
"Show right document (Ctrl >)");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These icons seem arbitrary — and semantically incorrect.

switch ( m_display_mode )
{
case SHOW_LEFT_DOCUMENT:
//
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh?

Comment on lines +723 to +738
if ( img1 )
m_viewer->Set(img1);
else if ( img2 )
m_viewer->Set(img2);
else
m_viewer->Set(NULL);
break;

case SHOW_RIGHT_DOCUMENT:
if ( img2 )
m_viewer->Set(img2);
else if ( img1 )
m_viewer->Set(img1);
else
m_viewer->Set(NULL);
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t understand why this code shows left-side image on the right side and vice versa?

Comment on lines +838 to +839
m_offset = wxPoint(0, 0);
DoUpdatePage();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these reset the offset — seems unrelated?

Please also don’t duplicate code like this, use a helper function.

Comment on lines +886 to +888
EVT_TOOL (ID_LEFT_DOC, DiffFrame::OnShowLeftDocument)
EVT_TOOL (ID_DIFF_DOC, DiffFrame::OnShowDiffDocument)
EVT_TOOL (ID_RIGHT_DOC, DiffFrame::OnShowRightDocument)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indentation, D is not aligned.

It is also possible to shift the two pages relatively to each other using
Ctrl-arrows (Cmd-arrows on MacOS). This is useful for identifying translation-only differences.

You can also use Ctrl < and Ctrl > (Cmd < and Cmd > on MacOS) show the left and right documents respecively. Ctrl d to return back to the diff view.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the standard way of referring to combined keypresses, which is Ctrl+D etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants