summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c7
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/documentwidget.c20
-rw-r--r--src/ui/util.c3
-rw-r--r--src/ui/window.c2
6 files changed, 24 insertions, 10 deletions
diff --git a/src/app.c b/src/app.c
index daf3d102..3d3dc6f8 100644
--- a/src/app.c
+++ b/src/app.c
@@ -215,6 +215,7 @@ static iString *serializePrefs_App_(const iApp *d) {
215 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); 215 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);
216 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); 216 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph);
217 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); 217 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon);
218 appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs);
218 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); 219 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0);
219 appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink); 220 appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink);
220 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme); 221 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme);
@@ -1264,6 +1265,11 @@ iBool handleCommand_App(const char *cmd) {
1264 postRefresh_App(); 1265 postRefresh_App();
1265 return iTrue; 1266 return iTrue;
1266 } 1267 }
1268 else if (equal_Command(cmd, "prefs.centershort.changed")) {
1269 d->prefs.centerShortDocs = arg_Command(cmd) != 0;
1270 postCommand_App("theme.changed");
1271 return iTrue;
1272 }
1267 else if (equal_Command(cmd, "prefs.hoverlink.changed")) { 1273 else if (equal_Command(cmd, "prefs.hoverlink.changed")) {
1268 d->prefs.hoverLink = arg_Command(cmd) != 0; 1274 d->prefs.hoverLink = arg_Command(cmd) != 0;
1269 postRefresh_App(); 1275 postRefresh_App();
@@ -1457,6 +1463,7 @@ iBool handleCommand_App(const char *cmd) {
1457 iTrue); 1463 iTrue);
1458 setToggle_Widget(findChild_Widget(dlg, "prefs.biglede"), d->prefs.bigFirstParagraph); 1464 setToggle_Widget(findChild_Widget(dlg, "prefs.biglede"), d->prefs.bigFirstParagraph);
1459 setToggle_Widget(findChild_Widget(dlg, "prefs.sideicon"), d->prefs.sideIcon); 1465 setToggle_Widget(findChild_Widget(dlg, "prefs.sideicon"), d->prefs.sideIcon);
1466 setToggle_Widget(findChild_Widget(dlg, "prefs.centershort"), d->prefs.centerShortDocs);
1460 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark); 1467 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark);
1461 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight); 1468 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight);
1462 setFlags_Widget( 1469 setFlags_Widget(
diff --git a/src/prefs.c b/src/prefs.c
index 6af8f1d8..a8f34b02 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -43,6 +43,7 @@ void init_Prefs(iPrefs *d) {
43 d->lineWidth = 38; 43 d->lineWidth = 38;
44 d->bigFirstParagraph = iTrue; 44 d->bigFirstParagraph = iTrue;
45 d->quoteIcon = iTrue; 45 d->quoteIcon = iTrue;
46 d->centerShortDocs = iTrue;
46 d->docThemeDark = colorfulDark_GmDocumentTheme; 47 d->docThemeDark = colorfulDark_GmDocumentTheme;
47 d->docThemeLight = white_GmDocumentTheme; 48 d->docThemeLight = white_GmDocumentTheme;
48 d->saturation = 1.0f; 49 d->saturation = 1.0f;
diff --git a/src/prefs.h b/src/prefs.h
index de354a04..dcda695f 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -62,6 +62,7 @@ struct Impl_Prefs {
62 int lineWidth; 62 int lineWidth;
63 iBool bigFirstParagraph; 63 iBool bigFirstParagraph;
64 iBool quoteIcon; 64 iBool quoteIcon;
65 iBool centerShortDocs;
65 /* Colors */ 66 /* Colors */
66 enum iGmDocumentTheme docThemeDark; 67 enum iGmDocumentTheme docThemeDark;
67 enum iGmDocumentTheme docThemeLight; 68 enum iGmDocumentTheme docThemeLight;
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index e9753fec..603af076 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -332,15 +332,17 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) {
332 rect.pos.y += margin; 332 rect.pos.y += margin;
333 rect.size.y -= margin; 333 rect.size.y -= margin;
334 } 334 }
335 const iInt2 docSize = size_GmDocument(d->doc); 335 if (prefs_App()->centerShortDocs) {
336 if (docSize.y < rect.size.y) { 336 const iInt2 docSize = size_GmDocument(d->doc);
337 /* Center vertically if short. There is one empty paragraph line's worth of margin 337 if (docSize.y < rect.size.y) {
338 between the banner and the page contents. */ 338 /* Center vertically if short. There is one empty paragraph line's worth of margin
339 const int bannerHeight = banner ? height_Rect(banner->visBounds) : 0; 339 between the banner and the page contents. */
340 int offset = iMax(0, (rect.size.y + margin - docSize.y - bannerHeight - 340 const int bannerHeight = banner ? height_Rect(banner->visBounds) : 0;
341 lineHeight_Text(paragraph_FontId)) / 2); 341 int offset = iMax(0, (rect.size.y + margin - docSize.y - bannerHeight -
342 rect.pos.y += offset; 342 lineHeight_Text(paragraph_FontId)) / 2);
343 rect.size.y = docSize.y; 343 rect.pos.y += offset;
344 rect.size.y = docSize.y;
345 }
344 } 346 }
345 return rect; 347 return rect;
346} 348}
diff --git a/src/ui/util.c b/src/ui/util.c
index 75a770eb..b52dea2d 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1063,6 +1063,9 @@ iWidget *makePreferences_Widget(void) {
1063#endif 1063#endif
1064 addChild_Widget(headings, iClob(makeHeading_Widget("Show URL on hover:"))); 1064 addChild_Widget(headings, iClob(makeHeading_Widget("Show URL on hover:")));
1065 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink"))); 1065 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink")));
1066 addChild_Widget(headings, iClob(makeHeading_Widget("Vertical centering:")));
1067 addChild_Widget(values, iClob(makeToggle_Widget("prefs.centershort")));
1068 makeTwoColumnHeading_("SCROLLING", headings, values);
1066 addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:"))); 1069 addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:")));
1067 addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll"))); 1070 addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll")));
1068 addChild_Widget(headings, iClob(makeHeading_Widget("Load image on scroll:"))); 1071 addChild_Widget(headings, iClob(makeHeading_Widget("Load image on scroll:")));
diff --git a/src/ui/window.c b/src/ui/window.c
index c5eb7e03..d6a41d3b 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -935,7 +935,7 @@ void init_Window(iWindow *d, iRect rect) {
935 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { 935 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) {
936 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); 936 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect));
937 } 937 }
938 const iInt2 minSize = init_I2(425, 300); 938 const iInt2 minSize = init_I2(425, 325);
939 SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y); 939 SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y);
940 SDL_SetWindowTitle(d->win, "Lagrange"); 940 SDL_SetWindowTitle(d->win, "Lagrange");
941 /* Some info. */ { 941 /* Some info. */ {