From: Alex B. <al...@us...> - 2013-04-17 05:18:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "omegat". The branch, master has been updated via d1892912aa6492f8ab3de7ce6adea488032178c4 (commit) via 8c129b7d84624c7a6ac3bb72db26ecdf6851b088 (commit) via c6f285ecc51d98b92524a54dca7d06ced6a4d2b7 (commit) via ec6ccfb94d477b0608d36175c3f2d62c744893c2 (commit) via 919baad2dfa354d519565f623ced77d273d6f128 (commit) from ea4a8937b8571ff5d7963f4214c4e35ae8a433df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://omegat.git.sourceforge.net/git/gitweb.cgi?p=omegat/omegat;a=commitdiff;h=d1892912aa6492f8ab3de7ce6adea488032178c4 commit d1892912aa6492f8ab3de7ce6adea488032178c4 Author: Alex Buloichik <ale...@gm...> Date: Wed Apr 17 04:52:05 2013 +0000 Wordwrap issue comment git-svn-id: svn+ssh://svn.code.sf.net/p/omegat/svn/trunk@5182 b0d8beef-cb45-0410-a8e4-c0d495c3b779 diff --git a/src/org/omegat/gui/editor/ViewParagraph.java b/src/org/omegat/gui/editor/ViewParagraph.java index 1375b8f..75bf543 100644 --- a/src/org/omegat/gui/editor/ViewParagraph.java +++ b/src/org/omegat/gui/editor/ViewParagraph.java @@ -33,6 +33,14 @@ import javax.swing.text.View; import javax.swing.text.ViewFactory; /** + * Custom breakspots processing required only for word wrapping issue fix: on + * the editing line with wordwrap, add a new line at the beginning of the line + * and write something, the word wrapping behaves in a strange way. If you paste + * a long line (wrapped one), the word wrap disappears and the line gets looong. + * + * JDK bug 6539700(http://bugs.sun.com/view_bug.do?bug_id=6539700) : JTextPane + * line wrap radically different from previous versions in jre 1.5.0_10+. Fixed + * in Java 7b70. * * @author bartkoz */ http://omegat.git.sourceforge.net/git/gitweb.cgi?p=omegat/omegat;a=commitdiff;h=8c129b7d84624c7a6ac3bb72db26ecdf6851b088 commit 8c129b7d84624c7a6ac3bb72db26ecdf6851b088 Author: Alex Buloichik <ale...@gm...> Date: Wed Apr 17 04:38:55 2013 +0000 Fix wordwrap for JDK 17. git-svn-id: svn+ssh://svn.code.sf.net/p/omegat/svn/trunk@5181 b0d8beef-cb45-0410-a8e4-c0d495c3b779 diff --git a/src/org/omegat/gui/editor/EditorTextArea3.java b/src/org/omegat/gui/editor/EditorTextArea3.java index 6b380b1..0a6ecc4 100644 --- a/src/org/omegat/gui/editor/EditorTextArea3.java +++ b/src/org/omegat/gui/editor/EditorTextArea3.java @@ -654,7 +654,7 @@ public class EditorTextArea3 extends JEditorPane { if (kind.equals(AbstractDocument.ContentElementName)) { return new ViewLabel(elem); } else if (kind.equals(AbstractDocument.ParagraphElementName)) { - return new ParagraphView(elem); + return new ViewParagraph(elem); } else if (kind.equals(AbstractDocument.SectionElementName)) { return new BoxView(elem, View.Y_AXIS); } else if (kind.equals(StyleConstants.ComponentElementName)) { diff --git a/src/org/omegat/gui/editor/ViewLabel.java b/src/org/omegat/gui/editor/ViewLabel.java index aa77ce4..6150675 100644 --- a/src/org/omegat/gui/editor/ViewLabel.java +++ b/src/org/omegat/gui/editor/ViewLabel.java @@ -3,7 +3,7 @@ with fuzzy matching, translation memory, keyword search, glossaries, and translation leveraging into updated projects. - Copyright (C) 2007 - Zoltan Bartko - bar...@ba... + Copyright (C) 2007, 2013 - Zoltan Bartko - bar...@ba... 2009 Alex Buloichik Home page: http://www.omegat.org/ Support center: http://groups.yahoo.com/group/OmegaT/ @@ -32,6 +32,7 @@ import java.awt.Shape; import javax.swing.text.Element; import javax.swing.text.LabelView; +import javax.swing.text.View; /** * Custom implementation of view. @@ -43,6 +44,8 @@ public class ViewLabel extends LabelView { /** Maximum font height for display labels. */ protected static int fontHeight; + boolean isResetBreakSpots = false; + public ViewLabel(final Element el) { super(el); } @@ -63,13 +66,45 @@ public class ViewLabel extends LabelView { } } + @Override public float getPreferredSpan(int axis) { if (fontHeight > 0 && axis == ViewLabel.Y_AXIS) { - // System.out.println("Calculated: " + super.getPreferredSpan(axis) - // + " height: " + fontHeight); return fontHeight; } else { return super.getPreferredSpan(axis); } } + + @Override + public float getMinimumSpan(int axis) { + switch (axis) { + case View.X_AXIS: + return 0; + case View.Y_AXIS: + return super.getMinimumSpan(axis); + default: + throw new IllegalArgumentException("Invalid axis: " + axis); + } + } + + @Override + public View breakView(int axis, int p0, float pos, float len) { + if (axis == View.X_AXIS) { + resetBreakSpots(); + } + return super.breakView(axis, p0, pos, len); + } + + public void resetBreakSpots() { + isResetBreakSpots = true; + removeUpdate(null, null, null); + isResetBreakSpots = false; + } + + @Override + public void preferenceChanged(View child, boolean width, boolean height) { + if (!isResetBreakSpots) { + super.preferenceChanged(child, width, height); + } + } } diff --git a/src/org/omegat/gui/editor/ViewParagraph.java b/src/org/omegat/gui/editor/ViewParagraph.java index e69de29..1375b8f 100644 --- a/src/org/omegat/gui/editor/ViewParagraph.java +++ b/src/org/omegat/gui/editor/ViewParagraph.java @@ -0,0 +1,65 @@ +/************************************************************************** + OmegaT - Computer Assisted Translation (CAT) tool + with fuzzy matching, translation memory, keyword search, + glossaries, and translation leveraging into updated projects. + + Copyright (C) 2013 - Zoltan Bartko - bar...@ba... + Home page: http://www.omegat.org/ + Support center: http://groups.yahoo.com/group/OmegaT/ + + This file is part of OmegaT. + + OmegaT is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OmegaT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + **************************************************************************/ + +package org.omegat.gui.editor; + +import java.awt.Shape; +import javax.swing.event.DocumentEvent; +import javax.swing.text.Element; +import javax.swing.text.ParagraphView; +import javax.swing.text.View; +import javax.swing.text.ViewFactory; + +/** + * + * @author bartkoz + */ +public class ViewParagraph extends ParagraphView { + + public ViewParagraph(Element elem) { + super(elem); + } + + @Override + public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f) { + super.removeUpdate(e, a, f); + resetBreakSpots(); + } + + @Override + public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f) { + super.insertUpdate(e, a, f); + resetBreakSpots(); + } + + private void resetBreakSpots() { + for (int i = 0; i < layoutPool.getViewCount(); i++) { + View v = layoutPool.getView(i); + if (v instanceof ViewLabel) { + ((ViewLabel) v).resetBreakSpots(); + } + } + } +} http://omegat.git.sourceforge.net/git/gitweb.cgi?p=omegat/omegat;a=commitdiff;h=c6f285ecc51d98b92524a54dca7d06ced6a4d2b7 commit c6f285ecc51d98b92524a54dca7d06ced6a4d2b7 Author: Alex Buloichik <ale...@gm...> Date: Wed Apr 17 04:37:53 2013 +0000 New file git-svn-id: svn+ssh://svn.code.sf.net/p/omegat/svn/trunk@5180 b0d8beef-cb45-0410-a8e4-c0d495c3b779 diff --git a/src/org/omegat/gui/editor/ViewParagraph.java b/src/org/omegat/gui/editor/ViewParagraph.java new file mode 100644 index 0000000..e69de29 http://omegat.git.sourceforge.net/git/gitweb.cgi?p=omegat/omegat;a=commitdiff;h=ec6ccfb94d477b0608d36175c3f2d62c744893c2 commit ec6ccfb94d477b0608d36175c3f2d62c744893c2 Author: Alex Buloichik <ale...@gm...> Date: Wed Apr 17 04:25:37 2013 +0000 Change undo processing git-svn-id: svn+ssh://svn.code.sf.net/p/omegat/svn/trunk@5179 b0d8beef-cb45-0410-a8e4-c0d495c3b779 diff --git a/src/org/omegat/gui/editor/EditorController.java b/src/org/omegat/gui/editor/EditorController.java index aab2038..d6e7225 100644 --- a/src/org/omegat/gui/editor/EditorController.java +++ b/src/org/omegat/gui/editor/EditorController.java @@ -627,7 +627,6 @@ public class EditorController implements IEditor { return; } if (doc.isEditMode()) { - editor.undoManager.onTextChanged(); m_docSegList[displayedEntryIndex].onActiveEntryChanged(); SwingUtilities.invokeLater(new Runnable() { diff --git a/src/org/omegat/gui/editor/TranslationUndoManager.java b/src/org/omegat/gui/editor/TranslationUndoManager.java index c42a831..42e8a6c 100644 --- a/src/org/omegat/gui/editor/TranslationUndoManager.java +++ b/src/org/omegat/gui/editor/TranslationUndoManager.java @@ -28,8 +28,10 @@ package org.omegat.gui.editor; import java.util.ArrayList; import java.util.List; +import javax.swing.event.DocumentEvent; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; +import javax.swing.text.AbstractDocument; import org.omegat.util.gui.UIThreadsUtil; @@ -50,7 +52,6 @@ public class TranslationUndoManager implements UndoableEditListener { private final List<Change> redos = new ArrayList<Change>(); private Change currentState; private boolean inProgress; - private String changedText; public TranslationUndoManager(EditorTextArea3 editor) { this.editor = editor; @@ -63,9 +64,8 @@ public class TranslationUndoManager implements UndoableEditListener { undos.clear(); redos.clear(); currentState = null; - changedText = editor.getOmDocument().extractTranslation(); } - remember(); + remember(0); } public void undo() { @@ -122,40 +122,16 @@ public class TranslationUndoManager implements UndoableEditListener { } /** - * Executed on each text changed for remember - */ - public void onTextChanged() { - UIThreadsUtil.mustBeSwingThread(); - - if (inProgress) { - return; - } - if (!editor.getOmDocument().isEditMode()) { - return; - } - synchronized (this) { - if (currentState != null) { - currentState.caretPos = editor.getCaretPosition() - editor.getOmDocument().getTranslationStart(); - } - // remember text, but don't consider it as 'undoable' - changedText = editor.getOmDocument().extractTranslation(); - } - } - - /** * Remember change. */ - public void remember() { + public void remember(int caretPos) { UIThreadsUtil.mustBeSwingThread(); synchronized (this) { - if (changedText == null) { - return; - } Change ch = new Change(); - ch.text = changedText; - changedText = null; + ch.text = editor.getOmDocument().extractTranslation(); if (currentState != null) { + currentState.caretPos = caretPos; undos.add(currentState); } currentState = ch; @@ -166,7 +142,20 @@ public class TranslationUndoManager implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { UIThreadsUtil.mustBeSwingThread(); - remember(); + if (inProgress || editor.getOmDocument().trustedChangesInProgress) { + return; + } + AbstractDocument.DefaultDocumentEvent event = (AbstractDocument.DefaultDocumentEvent) e.getEdit(); + if (event.getType() == DocumentEvent.EventType.CHANGE) { + // attributes changed + return; + } + + int caretPos = event.getOffset() - editor.getOmDocument().getTranslationStart(); + if (event.getType() == DocumentEvent.EventType.REMOVE) { + caretPos += event.getLength(); + } + remember(caretPos); } protected static final class Change { http://omegat.git.sourceforge.net/git/gitweb.cgi?p=omegat/omegat;a=commitdiff;h=919baad2dfa354d519565f623ced77d273d6f128 commit 919baad2dfa354d519565f623ced77d273d6f128 Author: Didier Briel <d....@fr...> Date: Tue Apr 16 15:52:52 2013 +0000 Merged revision(s) 5177 from branches/release-2-6/release/changes.txt: Java (for Windows and Linux with JRE) updated to 1.6.0_43-b0 git-svn-id: svn+ssh://svn.code.sf.net/p/omegat/svn/trunk@5178 b0d8beef-cb45-0410-a8e4-c0d495c3b779 diff --git a/release/changes.txt b/release/changes.txt index f652d84..a072916 100644 --- a/release/changes.txt +++ b/release/changes.txt @@ -111,7 +111,7 @@ OmegaT failed to load the valid ones ---------------------------------------------------------------------- OmegaT 2.6.3 update 1 ---------------------------------------------------------------------- - 2 Enhancements + 3 Enhancements 2 Bug fixes 1 Localisation update ---------------------------------------------------------------------- @@ -133,6 +133,8 @@ external entities, the target files could be empty - Word selection with a double-click could sometimes be off + - Java (for Windows and Linux with JRE) updated to 1.6.0_43-b01 + Localisation updates: - Japanese localisation updated to 2.6.3 (UI, Documentation) ----------------------------------------------------------------------- Summary of changes: release/changes.txt | 4 +- src/org/omegat/gui/editor/EditorController.java | 1 - src/org/omegat/gui/editor/EditorTextArea3.java | 2 +- .../omegat/gui/editor/TranslationUndoManager.java | 51 ++++++-------- src/org/omegat/gui/editor/ViewLabel.java | 41 ++++++++++- src/org/omegat/gui/editor/ViewParagraph.java | 73 ++++++++++++++++++++ 6 files changed, 135 insertions(+), 37 deletions(-) create mode 100644 src/org/omegat/gui/editor/ViewParagraph.java hooks/post-receive -- omegat |