[diff/merge] Fix divider polygons alignment for the short diff.

Use a separate value for the short diff and for the full diff.
This commit is contained in:
Kirill Likhodedov
2012-07-22 17:07:29 +04:00
parent f8d8dfa0b1
commit c96c97cf95
3 changed files with 7 additions and 5 deletions
@@ -77,7 +77,6 @@ import java.util.List;
public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSidesContainer {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.DiffPanelImpl");
public static final int DIFF_DIVIDER_POLYGONS_OFFSET = 3;
private final DiffSplitterI mySplitter;
private final DiffPanelOuterComponent myPanel;
@@ -111,7 +110,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
private CanNotCalculateDiffPanel myNotCalculateDiffPanel;
private final VisibleAreaListener myVisibleAreaListener;
public DiffPanelImpl(final Window owner, Project project, boolean enableToolbar, boolean horizontal) {
public DiffPanelImpl(final Window owner, Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset) {
myProject = project;
myIsHorizontal = horizontal;
myOptions = new DiffPanelOptions(this);
@@ -130,7 +129,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
if (horizontal) {
mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(),
new DiffDividerPaint(this, FragmentSide.SIDE1, DIFF_DIVIDER_POLYGONS_OFFSET), myData);
new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData);
}
else {
mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
@@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.Arrays;
public class DiffManagerImpl extends DiffManager implements JDOMExternalizable {
public static final int FULL_DIFF_DIVIDER_POLYGONS_OFFSET = 3;
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.external.DiffManagerImpl");
private static final Externalizer<String> TOOL_PATH_UPDATE = new Externalizer<String>() {
@@ -137,7 +138,7 @@ public class DiffManagerImpl extends DiffManager implements JDOMExternalizable {
}
public DiffPanel createDiffPanel(Window window, Project project) {
return new DiffPanelImpl(window, project, true, true);
return new DiffPanelImpl(window, project, true, true, FULL_DIFF_DIVIDER_POLYGONS_OFFSET);
}
@Override
@@ -79,6 +79,8 @@ import java.util.List;
* Time: 4:00 PM
*/
public class ChangesFragmentedDiffPanel implements Disposable {
private static final int SHORT_DIFF_DIVIDER_POLYGONS_OFFSET = 2;
private final JPanel myPanel;
private final Project myProject;
private final JComponent myParent;
@@ -346,7 +348,7 @@ public class ChangesFragmentedDiffPanel implements Disposable {
}
private DiffPanel createPanel(final boolean horizontal) {
final DiffPanel diffPanel = new DiffPanelImpl(null, myProject, false, horizontal){
final DiffPanel diffPanel = new DiffPanelImpl(null, myProject, false, horizontal, SHORT_DIFF_DIVIDER_POLYGONS_OFFSET){
@Override
protected DiffPanelState createDiffPanelState(@NotNull Disposable parentDisposable) {
return new FragmentedDiffPanelState(this, myProject, ! horizontal, parentDisposable);