Skip to content

Commit 4059702

Browse files
authored
Merge pull request #50 from virxkane/plotn-rounded-corners
Plotn rounded corners
2 parents 107cb57 + 504dd25 commit 4059702

7 files changed

Lines changed: 17 additions & 4 deletions

File tree

android/res/values-ru/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<string name="options_page_margin_right">Правый отступ</string>
9090
<string name="options_page_margin_top">Верхний отступ</string>
9191
<string name="options_page_margin_bottom">Нижний отступ</string>
92+
<string name="options_rounded_corners_margin">Отступ (для устройств со скругленными углами)</string>
9293
<string name="options_view_mode">Режим просмотра</string>
9394
<string name="options_view_mode_pages">Страницы</string>
9495
<string name="options_view_mode_scroll">Свиток</string>

android/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
<string name="options_page_margin_right">Right margin</string>
9595
<string name="options_page_margin_top">Top margin</string>
9696
<string name="options_page_margin_bottom">Bottom margin</string>
97+
<string name="options_rounded_corners_margin">Margin (for devices with rounded corners)</string>
9798
<string name="options_view_mode">View mode</string>
9899
<string name="options_view_mode_pages">Pages</string>
99100
<string name="options_view_mode_scroll">Scroll</string>

android/src/org/coolreader/crengine/BaseActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,7 @@ public Properties loadSettings(BaseActivity activity, File file) {
17181718
props.applyDefault(ReaderView.PROP_PAGE_MARGIN_RIGHT, hmargin);
17191719
props.applyDefault(ReaderView.PROP_PAGE_MARGIN_TOP, vmargin);
17201720
props.applyDefault(ReaderView.PROP_PAGE_MARGIN_BOTTOM, vmargin);
1721+
props.applyDefault(ReaderView.PROP_ROUNDED_CORNERS_MARGIN, "0");
17211722

17221723
props.applyDefault(ReaderView.PROP_APP_SCREEN_UPDATE_MODE, "0");
17231724
props.applyDefault(ReaderView.PROP_APP_SCREEN_UPDATE_INTERVAL, "10");

android/src/org/coolreader/crengine/OptionsDialog.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public static int findBacklightSettingIndex( int value ) {
103103
int[] mMargins = new int[] {
104104
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 20, 25, 30, 40, 50, 60, 80, 100, 130, 150, 200, 300
105105
};
106+
int[] mRoundedCornersMargins = new int[] {
107+
0, 5, 10, 15, 20, 30, 40, 50, 60, 70,80, 90, 100, 120, 140, 160
108+
};
106109
double[] mGammas = new double[] {
107110
0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.5, 1.9
108111
};
@@ -756,6 +759,7 @@ public void onSelect() {
756759
BaseDialog dlg = new BaseDialog(mActivity, label, false, false);
757760
OptionsListView listView = new OptionsListView(getContext());
758761
listView.add(new ListOption(mOwner, getString(R.string.options_page_show_titlebar), PROP_STATUS_LOCATION).add(mStatusPositions, mStatusPositionsTitles).setDefaultValue("1"));
762+
listView.add(new ListOption(mOwner, getString(R.string.options_rounded_corners_margin), PROP_ROUNDED_CORNERS_MARGIN).add(mRoundedCornersMargins).setDefaultValue("0"));
759763
listView.add(new ListOption(mOwner, getString(R.string.options_page_titlebar_font_face), PROP_STATUS_FONT_FACE).add(mFontFaces).setDefaultValue(mFontFaces[0]).setIconIdByAttr(R.attr.cr3_option_font_face_drawable, R.drawable.cr3_option_font_face));
760764
listView.add(new ListOption(mOwner, getString(R.string.options_page_titlebar_font_size), PROP_STATUS_FONT_SIZE).add(filterFontSizes(mStatusFontSizes)).setDefaultValue("18").setIconIdByAttr(R.attr.cr3_option_font_size_drawable, R.drawable.cr3_option_font_size));
761765
listView.add(new ColorOption(mOwner, getString(R.string.options_page_titlebar_font_color), PROP_STATUS_FONT_COLOR, 0x000000));
@@ -1952,7 +1956,7 @@ private void setupReaderOptions()
19521956
mOptionsPage.add(new ListOption(this, getString(R.string.options_page_margin_right), PROP_PAGE_MARGIN_RIGHT).add(mMargins).setDefaultValue("5").setIconIdByAttr(R.attr.cr3_option_text_margin_right_drawable, R.drawable.cr3_option_text_margin_right));
19531957
mOptionsPage.add(new ListOption(this, getString(R.string.options_page_margin_top), PROP_PAGE_MARGIN_TOP).add(mMargins).setDefaultValue("5").setIconIdByAttr(R.attr.cr3_option_text_margin_top_drawable, R.drawable.cr3_option_text_margin_top));
19541958
mOptionsPage.add(new ListOption(this, getString(R.string.options_page_margin_bottom), PROP_PAGE_MARGIN_BOTTOM).add(mMargins).setDefaultValue("5").setIconIdByAttr(R.attr.cr3_option_text_margin_bottom_drawable, R.drawable.cr3_option_text_margin_bottom));
1955-
1959+
19561960
mOptionsControls = new OptionsListView(getContext());
19571961
mOptionsControls.add(new KeyMapOption(this, getString(R.string.options_app_key_actions)).setIconIdByAttr(R.attr.cr3_option_controls_keys_drawable, R.drawable.cr3_option_controls_keys));
19581962
mOptionsControls.add(new TapZoneOption(this, getString(R.string.options_app_tapzones_normal), PROP_APP_TAP_ZONE_ACTIONS_TAP).setIconIdByAttr(R.attr.cr3_option_controls_tapzones_drawable, R.drawable.cr3_option_controls_tapzones));

android/src/org/coolreader/crengine/Settings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public interface Settings {
4141
public static final String PROP_PAGE_MARGIN_BOTTOM ="crengine.page.margin.bottom";
4242
public static final String PROP_PAGE_MARGIN_LEFT ="crengine.page.margin.left";
4343
public static final String PROP_PAGE_MARGIN_RIGHT ="crengine.page.margin.right";
44+
public static final String PROP_ROUNDED_CORNERS_MARGIN ="crengine.rounded.corners.margin";
4445
public static final String PROP_PAGE_VIEW_MODE ="crengine.page.view.mode"; // pages/scroll
4546
public static final String PROP_PAGE_ANIMATION ="crengine.page.animation";
4647
public static final String PROP_INTERLINE_SPACE ="crengine.interline.space";

crengine/include/lvdocviewprops.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define PROP_PAGE_MARGIN_BOTTOM "crengine.page.margin.bottom"
2525
#define PROP_PAGE_MARGIN_LEFT "crengine.page.margin.left"
2626
#define PROP_PAGE_MARGIN_RIGHT "crengine.page.margin.right"
27+
#define PROP_ROUNDED_CORNERS_MARGIN "crengine.rounded.corners.margin"
2728
#define PROP_PAGE_VIEW_MODE "crengine.page.view.mode" // pages/scroll
2829
#define PROP_INTERLINE_SPACE "crengine.interline.space"
2930
#if CR_INTERNAL_PAGE_ORIENTATION==1

crengine/src/lvdocview.cpp

100755100644
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,11 @@ void LVDocView::getPageHeaderRectangle(int pageIndex, lvRect & headerRc) {
12451245
headerRc.bottom = 0;
12461246
} else {
12471247
int h = getPageHeaderHeight();
1248+
int propHeaderMargin = m_props->getIntDef(PROP_ROUNDED_CORNERS_MARGIN, 0);
12481249
headerRc.bottom = headerRc.top + h;
12491250
headerRc.top += HEADER_MARGIN;
1250-
headerRc.left += HEADER_MARGIN;
1251-
headerRc.right -= HEADER_MARGIN;
1251+
headerRc.left += HEADER_MARGIN + propHeaderMargin;
1252+
headerRc.right -= HEADER_MARGIN + propHeaderMargin;
12521253
}
12531254
}
12541255

@@ -5698,7 +5699,10 @@ void LVDocView::propsUpdateDefaults(CRPropRef props) {
56985699
props->limitValueList(PROP_PAGE_MARGIN_BOTTOM, def_margin, sizeof(def_margin)/sizeof(int));
56995700
props->limitValueList(PROP_PAGE_MARGIN_LEFT, def_margin, sizeof(def_margin)/sizeof(int));
57005701
props->limitValueList(PROP_PAGE_MARGIN_RIGHT, def_margin, sizeof(def_margin)/sizeof(int));
5701-
static int def_updates[] = { 1, 0, 2, 3, 4, 5, 6, 7, 8, 10, 14 };
5702+
static int def_rounded_corners_margin[] = {0, 5, 10, 15, 20, 30, 40, 50, 60, 70,80, 90, 100, 120, 140, 160};
5703+
props->limitValueList(PROP_ROUNDED_CORNERS_MARGIN, def_rounded_corners_margin, sizeof(def_rounded_corners_margin)/sizeof(int));
5704+
5705+
static int def_updates[] = { 1, 0, 2, 3, 4, 5, 6, 7, 8, 10, 14 };
57025706
props->limitValueList(PROP_DISPLAY_FULL_UPDATE_INTERVAL, def_updates, 11);
57035707
int fs = props->getIntDef(PROP_STATUS_FONT_SIZE, INFO_FONT_SIZE);
57045708
if (fs < MIN_STATUS_FONT_SIZE)

0 commit comments

Comments
 (0)