1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

TextStyleCollection moved into ViewOptions

This commit is contained in:
Nikolay Pultsin 2014-02-01 10:25:15 +00:00
parent 19206273d6
commit 8df6ffa064
5 changed files with 12 additions and 8 deletions

View file

@ -64,7 +64,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
final PageTurningOptions pageTurningOptions = new PageTurningOptions(); final PageTurningOptions pageTurningOptions = new PageTurningOptions();
final ImageOptions imageOptions = new ImageOptions(); final ImageOptions imageOptions = new ImageOptions();
final ColorProfile profile = viewOptions.getColorProfile(); final ColorProfile profile = viewOptions.getColorProfile();
final ZLTextStyleCollection collection = fbReader.TextStyleCollection; final ZLTextStyleCollection collection = viewOptions.getTextStyleCollection();
final ZLKeyBindings keyBindings = new ZLKeyBindings(); final ZLKeyBindings keyBindings = new ZLKeyBindings();
final ZLAndroidLibrary androidLibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance(); final ZLAndroidLibrary androidLibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();

View file

@ -32,7 +32,7 @@ class ChangeFontSizeAction extends FBAction {
@Override @Override
protected void run(Object ... params) { protected void run(Object ... params) {
final ZLIntegerRangeOption option = final ZLIntegerRangeOption option =
Reader.TextStyleCollection.getBaseStyle().FontSizeOption; Reader.ViewOptions.getTextStyleCollection().getBaseStyle().FontSizeOption;
option.setValue(option.getValue() + myDelta); option.setValue(option.getValue() + myDelta);
Reader.clearTextCaches(); Reader.clearTextCaches();
Reader.getViewWidget().repaint(); Reader.getViewWidget().repaint();

View file

@ -30,15 +30,12 @@ import org.geometerplus.zlibrary.core.util.*;
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator; import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
import org.geometerplus.zlibrary.text.model.ZLTextModel; import org.geometerplus.zlibrary.text.model.ZLTextModel;
import org.geometerplus.zlibrary.text.view.*; import org.geometerplus.zlibrary.text.view.*;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleCollection;
import org.geometerplus.fbreader.book.*; import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.bookmodel.*; import org.geometerplus.fbreader.bookmodel.*;
import org.geometerplus.fbreader.fbreader.options.*; import org.geometerplus.fbreader.fbreader.options.*;
public final class FBReaderApp extends ZLApplication { public final class FBReaderApp extends ZLApplication {
public final ZLTextStyleCollection TextStyleCollection;
public final MiscOptions MiscOptions; public final MiscOptions MiscOptions;
public final ImageOptions ImageOptions; public final ImageOptions ImageOptions;
public final ViewOptions ViewOptions; public final ViewOptions ViewOptions;
@ -48,8 +45,6 @@ public final class FBReaderApp extends ZLApplication {
private final ZLKeyBindings myBindings; private final ZLKeyBindings myBindings;
{ {
TextStyleCollection = new ZLTextStyleCollection("Base");
MiscOptions = new MiscOptions(); MiscOptions = new MiscOptions();
ImageOptions = new ImageOptions(); ImageOptions = new ImageOptions();
ViewOptions = new ViewOptions(); ViewOptions = new ViewOptions();

View file

@ -340,7 +340,7 @@ public final class FBView extends ZLTextView {
@Override @Override
public ZLTextStyleCollection getTextStyleCollection() { public ZLTextStyleCollection getTextStyleCollection() {
return myReader.TextStyleCollection; return myReader.ViewOptions.getTextStyleCollection();
} }
@Override @Override

View file

@ -21,6 +21,7 @@ package org.geometerplus.fbreader.fbreader.options;
import org.geometerplus.zlibrary.core.library.ZLibrary; import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.options.*; import org.geometerplus.zlibrary.core.options.*;
import org.geometerplus.zlibrary.text.view.style.ZLTextStyleCollection;
import org.geometerplus.fbreader.fbreader.FBView; import org.geometerplus.fbreader.fbreader.FBView;
@ -36,6 +37,7 @@ public class ViewOptions {
public final ZLStringOption ColorProfileName; public final ZLStringOption ColorProfileName;
private ColorProfile myColorProfile; private ColorProfile myColorProfile;
private ZLTextStyleCollection myTextStyleCollection;
public ViewOptions() { public ViewOptions() {
final ZLibrary zlibrary = ZLibrary.Instance(); final ZLibrary zlibrary = ZLibrary.Instance();
@ -72,4 +74,11 @@ public class ViewOptions {
} }
return myColorProfile; return myColorProfile;
} }
public ZLTextStyleCollection getTextStyleCollection() {
if (myTextStyleCollection == null) {
myTextStyleCollection = new ZLTextStyleCollection("Base");
}
return myTextStyleCollection;
}
} }