diff --git a/ChangeLog b/ChangeLog index c2f3ac8cb..1b2627d67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ ===== 1.8 (May ??, 2013) ===== +* 2 column text view (in horizontal mode, optional, enabled by default on devices with diagonal > 7") * Fixed series index representation: 10 instead 1E+1 ===== 1.7.9 (Apr 23, 2013) ===== diff --git a/TODO.2pages b/TODO.2pages new file mode 100644 index 000000000..7cca4a322 --- /dev/null +++ b/TODO.2pages @@ -0,0 +1,7 @@ +* FIRST RELEASE +** fix end-of-section processing + +* OPTIONAL +** 3d animation +** more animation types +** footer/header diff --git a/assets/resources/application/be.xml b/assets/resources/application/be.xml index 24f6bccac..434aa6f8a 100644 --- a/assets/resources/application/be.xml +++ b/assets/resources/application/be.xml @@ -319,6 +319,10 @@ + + + + @@ -551,6 +555,7 @@ + diff --git a/assets/resources/application/bg.xml b/assets/resources/application/bg.xml index bf11453b7..1e9e02fae 100644 --- a/assets/resources/application/bg.xml +++ b/assets/resources/application/bg.xml @@ -318,6 +318,10 @@ + + + + @@ -550,6 +554,7 @@ + diff --git a/assets/resources/application/ca.xml b/assets/resources/application/ca.xml index 60ea2a21a..51ccaf91a 100644 --- a/assets/resources/application/ca.xml +++ b/assets/resources/application/ca.xml @@ -317,6 +317,10 @@ + + + + @@ -549,6 +553,7 @@ + diff --git a/assets/resources/application/cs.xml b/assets/resources/application/cs.xml index 59dac612c..064423307 100644 --- a/assets/resources/application/cs.xml +++ b/assets/resources/application/cs.xml @@ -322,6 +322,10 @@ + + + + @@ -554,6 +558,7 @@ + diff --git a/assets/resources/application/de.xml b/assets/resources/application/de.xml index dfa6e4a45..22a7ed285 100644 --- a/assets/resources/application/de.xml +++ b/assets/resources/application/de.xml @@ -307,6 +307,10 @@ + + + + @@ -539,6 +543,7 @@ + diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml index 33069ffaf..dd0535a9e 100644 --- a/assets/resources/application/en.xml +++ b/assets/resources/application/en.xml @@ -313,6 +313,10 @@ + + + + @@ -545,6 +549,7 @@ + diff --git a/assets/resources/application/es.xml b/assets/resources/application/es.xml index fbb35351d..d282c256a 100644 --- a/assets/resources/application/es.xml +++ b/assets/resources/application/es.xml @@ -317,6 +317,10 @@ + + + + @@ -549,6 +553,7 @@ + diff --git a/assets/resources/application/fr.xml b/assets/resources/application/fr.xml index 78d48d027..3104cfbae 100644 --- a/assets/resources/application/fr.xml +++ b/assets/resources/application/fr.xml @@ -306,6 +306,10 @@ + + + + @@ -538,6 +542,7 @@ + diff --git a/assets/resources/application/gl.xml b/assets/resources/application/gl.xml index 8b7991481..a9854aac4 100644 --- a/assets/resources/application/gl.xml +++ b/assets/resources/application/gl.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/hu.xml b/assets/resources/application/hu.xml index 7691c7be7..5fb8b7dd0 100644 --- a/assets/resources/application/hu.xml +++ b/assets/resources/application/hu.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/it.xml b/assets/resources/application/it.xml index b650227d3..99e4dc777 100644 --- a/assets/resources/application/it.xml +++ b/assets/resources/application/it.xml @@ -304,6 +304,10 @@ + + + + @@ -536,6 +540,7 @@ + diff --git a/assets/resources/application/ka.xml b/assets/resources/application/ka.xml index 7bd1025cb..04f747012 100644 --- a/assets/resources/application/ka.xml +++ b/assets/resources/application/ka.xml @@ -318,6 +318,10 @@ + + + + @@ -550,6 +554,7 @@ + diff --git a/assets/resources/application/nb.xml b/assets/resources/application/nb.xml index 242d0a25a..52fd4af54 100644 --- a/assets/resources/application/nb.xml +++ b/assets/resources/application/nb.xml @@ -313,6 +313,10 @@ + + + + @@ -545,6 +549,7 @@ + diff --git a/assets/resources/application/nl.xml b/assets/resources/application/nl.xml index 07ee04344..f3b7f29de 100644 --- a/assets/resources/application/nl.xml +++ b/assets/resources/application/nl.xml @@ -313,6 +313,10 @@ + + + + @@ -545,6 +549,7 @@ + diff --git a/assets/resources/application/pl.xml b/assets/resources/application/pl.xml index 31fba3ad1..5ef751248 100644 --- a/assets/resources/application/pl.xml +++ b/assets/resources/application/pl.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/pt.xml b/assets/resources/application/pt.xml index 38f558f09..cdd292d68 100644 --- a/assets/resources/application/pt.xml +++ b/assets/resources/application/pt.xml @@ -315,6 +315,10 @@ + + + + @@ -547,6 +551,7 @@ + diff --git a/assets/resources/application/ro.xml b/assets/resources/application/ro.xml index 9a5b29903..8da4dcbee 100644 --- a/assets/resources/application/ro.xml +++ b/assets/resources/application/ro.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/ru.xml b/assets/resources/application/ru.xml index c75bde9fe..da5ca904c 100644 --- a/assets/resources/application/ru.xml +++ b/assets/resources/application/ru.xml @@ -318,6 +318,10 @@ + + + + @@ -550,6 +554,7 @@ + diff --git a/assets/resources/application/sr.xml b/assets/resources/application/sr.xml index 6324acea5..cc4528213 100644 --- a/assets/resources/application/sr.xml +++ b/assets/resources/application/sr.xml @@ -313,6 +313,10 @@ + + + + @@ -545,6 +549,7 @@ + diff --git a/assets/resources/application/th.xml b/assets/resources/application/th.xml index 5a9e4928e..cfb62de58 100644 --- a/assets/resources/application/th.xml +++ b/assets/resources/application/th.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/tr.xml b/assets/resources/application/tr.xml index 74037a374..d98805f84 100644 --- a/assets/resources/application/tr.xml +++ b/assets/resources/application/tr.xml @@ -313,6 +313,10 @@ + + + + @@ -545,6 +549,7 @@ + diff --git a/assets/resources/application/uk.xml b/assets/resources/application/uk.xml index 3e5c52d76..43e291c37 100644 --- a/assets/resources/application/uk.xml +++ b/assets/resources/application/uk.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/vi.xml b/assets/resources/application/vi.xml index 8f3ca8fe7..fb3cbb786 100644 --- a/assets/resources/application/vi.xml +++ b/assets/resources/application/vi.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/zh.xml b/assets/resources/application/zh.xml index 154f08b6f..1e7baa636 100644 --- a/assets/resources/application/zh.xml +++ b/assets/resources/application/zh.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/assets/resources/application/zh_TW.xml b/assets/resources/application/zh_TW.xml index 2d07d9d68..5757c639c 100644 --- a/assets/resources/application/zh_TW.xml +++ b/assets/resources/application/zh_TW.xml @@ -303,6 +303,10 @@ + + + + @@ -535,6 +539,7 @@ + diff --git a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java index 90cb07d0a..629b81853 100644 --- a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java +++ b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java @@ -107,6 +107,12 @@ public class PreferenceActivity extends ZLPreferenceActivity { this, appearanceScreen.Resource, "screenOrientation", androidLibrary.getOrientationOption(), androidLibrary.allOrientations() )); + appearanceScreen.addPreference(new ZLBooleanPreference( + this, + fbReader.TwoColumnViewOption, + appearanceScreen.Resource, + "twoColumnView" + )); appearanceScreen.addPreference(new ZLBooleanPreference( this, fbReader.AllowScreenBrightnessAdjustmentOption, @@ -341,6 +347,10 @@ public class PreferenceActivity extends ZLPreferenceActivity { this, marginsScreen.Resource.getResource("bottom"), fbReader.BottomMarginOption )); + marginsScreen.addPreference(new ZLIntegerRangePreference( + this, marginsScreen.Resource.getResource("spaceBetweenColumns"), + fbReader.SpaceBetweenColumnsOption + )); final Screen statusLineScreen = createPreferenceScreen("scrollBar"); diff --git a/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java b/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java index f705d6928..038a06dc4 100644 --- a/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java +++ b/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java @@ -64,21 +64,26 @@ public final class FBReaderApp extends ZLApplication { public final ZLEnumOption ImageTappingActionOption = new ZLEnumOption("Options", "ImageTappingAction", ImageTappingAction.openImageView); + public final ZLBooleanOption TwoColumnViewOption; public final ZLIntegerRangeOption LeftMarginOption; public final ZLIntegerRangeOption RightMarginOption; public final ZLIntegerRangeOption TopMarginOption; public final ZLIntegerRangeOption BottomMarginOption; - public final ZLIntegerRangeOption IntercolumnSpaceOption; + public final ZLIntegerRangeOption SpaceBetweenColumnsOption; { final int dpi = ZLibrary.Instance().getDisplayDPI(); final int x = ZLibrary.Instance().getPixelWidth(); final int y = ZLibrary.Instance().getPixelHeight(); + TwoColumnViewOption = new ZLBooleanOption( + "Options", "TwoColumnView", + x * x + y * y >= 50 * dpi * dpi + ); final int horMargin = Math.min(dpi / 5, Math.min(x, y) / 30); LeftMarginOption = new ZLIntegerRangeOption("Options", "LeftMargin", 0, 100, horMargin); RightMarginOption = new ZLIntegerRangeOption("Options", "RightMargin", 0, 100, horMargin); TopMarginOption = new ZLIntegerRangeOption("Options", "TopMargin", 0, 100, 0); BottomMarginOption = new ZLIntegerRangeOption("Options", "BottomMargin", 0, 100, 4); - IntercolumnSpaceOption = new ZLIntegerRangeOption("Options", "IntercolumnSpace", 0, 100, 3 * horMargin); + SpaceBetweenColumnsOption = new ZLIntegerRangeOption("Options", "SpaceBetweenColumns", 0, 100, 3 * horMargin); } public final ZLIntegerRangeOption ScrollbarTypeOption = diff --git a/src/org/geometerplus/fbreader/fbreader/FBView.java b/src/org/geometerplus/fbreader/fbreader/FBView.java index bbd52e8e3..dc158fe48 100644 --- a/src/org/geometerplus/fbreader/fbreader/FBView.java +++ b/src/org/geometerplus/fbreader/fbreader/FBView.java @@ -353,8 +353,13 @@ public final class FBView extends ZLTextView { } @Override - public int getIntercolumnSpace() { - return myReader.IntercolumnSpaceOption.getValue(); + public int getSpaceBetweenColumns() { + return myReader.SpaceBetweenColumnsOption.getValue(); + } + + @Override + public boolean twoColumnView() { + return getContextHeight() <= getContextWidth() && myReader.TwoColumnViewOption.getValue(); } @Override diff --git a/src/org/geometerplus/zlibrary/text/view/ZLTextPage.java b/src/org/geometerplus/zlibrary/text/view/ZLTextPage.java index dd330d7c5..510edf68c 100644 --- a/src/org/geometerplus/zlibrary/text/view/ZLTextPage.java +++ b/src/org/geometerplus/zlibrary/text/view/ZLTextPage.java @@ -32,14 +32,16 @@ final class ZLTextPage { private int myWidth; private int myHeight; + private boolean myTwoColumnView; private int myColumnWidth; - void setSize(int width, int height, int columnWidth, boolean keepEndNotStart) { - if (myWidth == width && myHeight == height && myColumnWidth == columnWidth) { + void setSize(int width, int height, boolean twoColumnView, int columnWidth, boolean keepEndNotStart) { + if (myWidth == width && myHeight == height && myTwoColumnView == twoColumnView && myColumnWidth == columnWidth) { return; } myWidth = width; myHeight = height; + myTwoColumnView = twoColumnView; myColumnWidth = columnWidth; if (PaintState != PaintStateEnum.NOTHING_TO_PAINT) { @@ -105,6 +107,10 @@ final class ZLTextPage { PaintState = PaintStateEnum.END_IS_KNOWN; } + boolean twoColumnView() { + return myTwoColumnView; + } + boolean isEmptyPage() { for (ZLTextLineInfo info : LineInfos) { if (info.IsVisible) { diff --git a/src/org/geometerplus/zlibrary/text/view/ZLTextView.java b/src/org/geometerplus/zlibrary/text/view/ZLTextView.java index da0799578..b3fb0c5d7 100644 --- a/src/org/geometerplus/zlibrary/text/view/ZLTextView.java +++ b/src/org/geometerplus/zlibrary/text/view/ZLTextView.java @@ -442,7 +442,7 @@ public abstract class ZLTextView extends ZLTextViewBase { labels[++index] = page.TextElementMap.size(); if (index == page.Column0Height) { y = getTopMargin(); - x += getTextColumnWidth() + getIntercolumnSpace(); + x += getTextColumnWidth() + getSpaceBetweenColumns(); } } @@ -455,7 +455,7 @@ public abstract class ZLTextView extends ZLTextViewBase { ++index; if (index == page.Column0Height) { y = getTopMargin(); - x += getTextColumnWidth() + getIntercolumnSpace(); + x += getTextColumnWidth() + getSpaceBetweenColumns(); } } @@ -858,7 +858,7 @@ public abstract class ZLTextView extends ZLTextViewBase { info = processTextLine(paragraphCursor, info.EndElementIndex, info.EndCharIndex, endIndex); textAreaHeight -= info.Height + info.Descent; if (textAreaHeight < 0 && page.LineInfos.size() > page.Column0Height) { - if (columnCounter == 0) { + if (columnCounter == 0 && page.twoColumnView()) { ++columnCounter; textAreaHeight = getTextAreaHeight(); textAreaHeight -= info.Height + info.Descent; @@ -1238,7 +1238,7 @@ public abstract class ZLTextView extends ZLTextViewBase { } private synchronized void preparePaintInfo(ZLTextPage page) { - page.setSize(getTextAreaWidth(), getTextAreaHeight(), getTextColumnWidth(), page == myPreviousPage); + page.setSize(getTextAreaWidth(), getTextAreaHeight(), twoColumnView(), getTextColumnWidth(), page == myPreviousPage); if (page.PaintState == PaintStateEnum.NOTHING_TO_PAINT || page.PaintState == PaintStateEnum.READY) { return; diff --git a/src/org/geometerplus/zlibrary/text/view/ZLTextViewBase.java b/src/org/geometerplus/zlibrary/text/view/ZLTextViewBase.java index b5b9572ba..aa8266614 100644 --- a/src/org/geometerplus/zlibrary/text/view/ZLTextViewBase.java +++ b/src/org/geometerplus/zlibrary/text/view/ZLTextViewBase.java @@ -81,7 +81,9 @@ abstract class ZLTextViewBase extends ZLView { public abstract int getRightMargin(); public abstract int getTopMargin(); public abstract int getBottomMargin(); - public abstract int getIntercolumnSpace(); + public abstract int getSpaceBetweenColumns(); + + public abstract boolean twoColumnView(); public abstract ZLFile getWallpaperFile(); public abstract ZLPaintContext.WallpaperMode getWallpaperMode(); @@ -104,7 +106,9 @@ abstract class ZLTextViewBase extends ZLView { } int getTextColumnWidth() { - return (getContextWidth() - getLeftMargin() - getRightMargin() - getIntercolumnSpace()) / 2; + return twoColumnView() + ? (getTextAreaWidth() - getSpaceBetweenColumns()) / 2 + : getTextAreaWidth(); } final ZLTextStyle getTextStyle() {