diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 25 | ||||
-rw-r--r-- | src/app.h | 1 | ||||
-rw-r--r-- | src/gmdocument.c | 10 | ||||
-rw-r--r-- | src/gmdocument.h | 5 | ||||
-rw-r--r-- | src/prefs.c | 1 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 11 | ||||
-rw-r--r-- | src/ui/window.c | 2 |
8 files changed, 13 insertions, 43 deletions
@@ -105,21 +105,10 @@ struct Impl_App { | |||
105 | iBool isFinishedLaunching; | 105 | iBool isFinishedLaunching; |
106 | iTime lastDropTime; /* for detecting drops of multiple items */ | 106 | iTime lastDropTime; /* for detecting drops of multiple items */ |
107 | /* Preferences: */ | 107 | /* Preferences: */ |
108 | iBool commandEcho; /* --echo */ | 108 | iBool commandEcho; /* --echo */ |
109 | iBool forceSoftwareRender; /* --sw */ | 109 | iBool forceSoftwareRender; /* --sw */ |
110 | iRect initialWindowRect; | 110 | iRect initialWindowRect; |
111 | iPrefs prefs; | 111 | iPrefs prefs; |
112 | #if 0 | ||
113 | iBool retainWindowSize; | ||
114 | float uiScale; | ||
115 | int zoomPercent; | ||
116 | iBool forceWrap; | ||
117 | enum iColorTheme theme; | ||
118 | iBool useSystemTheme; | ||
119 | iString gopherProxy; | ||
120 | iString httpProxy; | ||
121 | iString downloadDir; | ||
122 | #endif | ||
123 | }; | 112 | }; |
124 | 113 | ||
125 | static iApp app_; | 114 | static iApp app_; |
@@ -172,9 +161,6 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
172 | if (isVisible_Widget(sidebar)) { | 161 | if (isVisible_Widget(sidebar)) { |
173 | appendCStr_String(str, "sidebar.toggle\n"); | 162 | appendCStr_String(str, "sidebar.toggle\n"); |
174 | } | 163 | } |
175 | if (d->prefs.forceLineWrap) { | ||
176 | appendFormat_String(str, "forcewrap.toggle\n"); | ||
177 | } | ||
178 | appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar)); | 164 | appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar)); |
179 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window)); | 165 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window)); |
180 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); | 166 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); |
@@ -617,10 +603,6 @@ const iPrefs *prefs_App(void) { | |||
617 | return &app_.prefs; | 603 | return &app_.prefs; |
618 | } | 604 | } |
619 | 605 | ||
620 | iBool forceLineWrap_App(void) { | ||
621 | return app_.prefs.forceLineWrap; | ||
622 | } | ||
623 | |||
624 | iBool forceSoftwareRender_App(void) { | 606 | iBool forceSoftwareRender_App(void) { |
625 | if (app_.forceSoftwareRender) { | 607 | if (app_.forceSoftwareRender) { |
626 | return iTrue; | 608 | return iTrue; |
@@ -985,11 +967,6 @@ iBool handleCommand_App(const char *cmd) { | |||
985 | d->prefs.loadImageInsteadOfScrolling = arg_Command(cmd); | 967 | d->prefs.loadImageInsteadOfScrolling = arg_Command(cmd); |
986 | return iTrue; | 968 | return iTrue; |
987 | } | 969 | } |
988 | else if (equal_Command(cmd, "forcewrap.toggle")) { | ||
989 | d->prefs.forceLineWrap = !d->prefs.forceLineWrap; | ||
990 | updateSize_DocumentWidget(document_App()); | ||
991 | return iTrue; | ||
992 | } | ||
993 | else if (equal_Command(cmd, "theme.set")) { | 970 | else if (equal_Command(cmd, "theme.set")) { |
994 | const int isAuto = argLabel_Command(cmd, "auto"); | 971 | const int isAuto = argLabel_Command(cmd, "auto"); |
995 | d->prefs.theme = arg_Command(cmd); | 972 | d->prefs.theme = arg_Command(cmd); |
@@ -60,7 +60,6 @@ iBool isRefreshPending_App (void); | |||
60 | uint32_t elapsedSinceLastTicker_App (void); /* milliseconds */ | 60 | uint32_t elapsedSinceLastTicker_App (void); /* milliseconds */ |
61 | 61 | ||
62 | const iPrefs * prefs_App (void); | 62 | const iPrefs * prefs_App (void); |
63 | iBool forceLineWrap_App (void); | ||
64 | iBool forceSoftwareRender_App(void); | 63 | iBool forceSoftwareRender_App(void); |
65 | enum iColorTheme colorTheme_App (void); | 64 | enum iColorTheme colorTheme_App (void); |
66 | const iString * schemeProxy_App (iRangecc scheme); | 65 | const iString * schemeProxy_App (iRangecc scheme); |
diff --git a/src/gmdocument.c b/src/gmdocument.c index fd7804fa..2f3a006f 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -64,7 +64,6 @@ struct Impl_GmDocument { | |||
64 | iString source; | 64 | iString source; |
65 | iString url; /* for resolving relative links */ | 65 | iString url; /* for resolving relative links */ |
66 | iString localHost; | 66 | iString localHost; |
67 | int forceBreakWidth; /* force breaks on very long preformatted lines */ | ||
68 | iBool siteBannerEnabled; | 67 | iBool siteBannerEnabled; |
69 | iInt2 size; | 68 | iInt2 size; |
70 | iArray layout; /* contents of source, laid out in document space */ | 69 | iArray layout; /* contents of source, laid out in document space */ |
@@ -510,7 +509,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
510 | } | 509 | } |
511 | run.bounds.pos = addX_I2(pos, indent * gap_Text); | 510 | run.bounds.pos = addX_I2(pos, indent * gap_Text); |
512 | const char *contPos; | 511 | const char *contPos; |
513 | const int avail = (isPreformat ? d->forceBreakWidth : d->size.x) - run.bounds.pos.x; | 512 | const int avail = d->size.x - run.bounds.pos.x; |
514 | const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos); | 513 | const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos); |
515 | run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */ | 514 | run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */ |
516 | run.bounds.size.y = dims.y; | 515 | run.bounds.size.y = dims.y; |
@@ -1073,8 +1072,7 @@ void setSiteBannerEnabled_GmDocument(iGmDocument *d, iBool siteBannerEnabled) { | |||
1073 | d->siteBannerEnabled = siteBannerEnabled; | 1072 | d->siteBannerEnabled = siteBannerEnabled; |
1074 | } | 1073 | } |
1075 | 1074 | ||
1076 | void setWidth_GmDocument(iGmDocument *d, int width, int forceBreakWidth) { | 1075 | void setWidth_GmDocument(iGmDocument *d, int width) { |
1077 | d->forceBreakWidth = forceBreakWidth; | ||
1078 | d->size.x = width; | 1076 | d->size.x = width; |
1079 | doLayout_GmDocument_(d); /* TODO: just flag need-layout and do it later */ | 1077 | doLayout_GmDocument_(d); /* TODO: just flag need-layout and do it later */ |
1080 | } | 1078 | } |
@@ -1159,10 +1157,10 @@ void setUrl_GmDocument(iGmDocument *d, const iString *url) { | |||
1159 | setRange_String(&d->localHost, parts.host); | 1157 | setRange_String(&d->localHost, parts.host); |
1160 | } | 1158 | } |
1161 | 1159 | ||
1162 | void setSource_GmDocument(iGmDocument *d, const iString *source, int width, int forceBreakWidth) { | 1160 | void setSource_GmDocument(iGmDocument *d, const iString *source, int width) { |
1163 | set_String(&d->source, source); | 1161 | set_String(&d->source, source); |
1164 | normalize_GmDocument(d); | 1162 | normalize_GmDocument(d); |
1165 | setWidth_GmDocument(d, width, forceBreakWidth); /* re-do layout */ | 1163 | setWidth_GmDocument(d, width); /* re-do layout */ |
1166 | } | 1164 | } |
1167 | 1165 | ||
1168 | void render_GmDocument(const iGmDocument *d, iRangei visRangeY, iGmDocumentRenderFunc render, | 1166 | void render_GmDocument(const iGmDocument *d, iRangei visRangeY, iGmDocumentRenderFunc render, |
diff --git a/src/gmdocument.h b/src/gmdocument.h index 5234f890..c2a4b272 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -80,6 +80,7 @@ enum iGmRunFlags { | |||
80 | endOfLine_GmRunFlag = iBit(3), | 80 | endOfLine_GmRunFlag = iBit(3), |
81 | siteBanner_GmRunFlag = iBit(4), /* area reserved for the site banner */ | 81 | siteBanner_GmRunFlag = iBit(4), /* area reserved for the site banner */ |
82 | quoteBorder_GmRunFlag = iBit(5), | 82 | quoteBorder_GmRunFlag = iBit(5), |
83 | wide_GmRunFlag = iBit(6), /* horizontally scrollable */ | ||
83 | }; | 84 | }; |
84 | 85 | ||
85 | struct Impl_GmRun { | 86 | struct Impl_GmRun { |
@@ -108,10 +109,10 @@ enum iGmDocumentFormat { | |||
108 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); | 109 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); |
109 | void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); | 110 | void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); |
110 | void setSiteBannerEnabled_GmDocument(iGmDocument *, iBool siteBannerEnabled); | 111 | void setSiteBannerEnabled_GmDocument(iGmDocument *, iBool siteBannerEnabled); |
111 | void setWidth_GmDocument (iGmDocument *, int width, int forceBreakWidth); | 112 | void setWidth_GmDocument (iGmDocument *, int width); |
112 | void redoLayout_GmDocument (iGmDocument *); | 113 | void redoLayout_GmDocument (iGmDocument *); |
113 | void setUrl_GmDocument (iGmDocument *, const iString *url); | 114 | void setUrl_GmDocument (iGmDocument *, const iString *url); |
114 | void setSource_GmDocument (iGmDocument *, const iString *source, int width, int forceBreakWidth); | 115 | void setSource_GmDocument (iGmDocument *, const iString *source, int width); |
115 | 116 | ||
116 | void reset_GmDocument (iGmDocument *); /* free images */ | 117 | void reset_GmDocument (iGmDocument *); /* free images */ |
117 | 118 | ||
diff --git a/src/prefs.c b/src/prefs.c index dc2bd601..574e07d0 100644 --- a/src/prefs.c +++ b/src/prefs.c | |||
@@ -39,7 +39,6 @@ void init_Prefs(iPrefs *d) { | |||
39 | d->monospaceGopher = iFalse; | 39 | d->monospaceGopher = iFalse; |
40 | d->lineWidth = 40; | 40 | d->lineWidth = 40; |
41 | d->bigFirstParagraph = iTrue; | 41 | d->bigFirstParagraph = iTrue; |
42 | d->forceLineWrap = iFalse; | ||
43 | d->quoteIcon = iTrue; | 42 | d->quoteIcon = iTrue; |
44 | d->docThemeDark = colorfulDark_GmDocumentTheme; | 43 | d->docThemeDark = colorfulDark_GmDocumentTheme; |
45 | d->docThemeLight = white_GmDocumentTheme; | 44 | d->docThemeLight = white_GmDocumentTheme; |
diff --git a/src/prefs.h b/src/prefs.h index a3993629..3f4f534f 100644 --- a/src/prefs.h +++ b/src/prefs.h | |||
@@ -58,7 +58,6 @@ struct Impl_Prefs { | |||
58 | iBool monospaceGopher; | 58 | iBool monospaceGopher; |
59 | int lineWidth; | 59 | int lineWidth; |
60 | iBool bigFirstParagraph; | 60 | iBool bigFirstParagraph; |
61 | iBool forceLineWrap; | ||
62 | iBool quoteIcon; | 61 | iBool quoteIcon; |
63 | /* Colors */ | 62 | /* Colors */ |
64 | enum iGmDocumentTheme docThemeDark; | 63 | enum iGmDocumentTheme docThemeDark; |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ef856558..c82e823d 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -317,6 +317,7 @@ static iRect siteBannerRect_DocumentWidget_(const iDocumentWidget *d) { | |||
317 | return moved_Rect(banner->visBounds, origin); | 317 | return moved_Rect(banner->visBounds, origin); |
318 | } | 318 | } |
319 | 319 | ||
320 | #if 0 | ||
320 | static int forceBreakWidth_DocumentWidget_(const iDocumentWidget *d) { | 321 | static int forceBreakWidth_DocumentWidget_(const iDocumentWidget *d) { |
321 | if (equalCase_Rangecc(urlScheme_String(d->mod.url), "gopher")) { | 322 | if (equalCase_Rangecc(urlScheme_String(d->mod.url), "gopher")) { |
322 | return documentWidth_DocumentWidget_(d); | 323 | return documentWidth_DocumentWidget_(d); |
@@ -328,6 +329,7 @@ static int forceBreakWidth_DocumentWidget_(const iDocumentWidget *d) { | |||
328 | } | 329 | } |
329 | return 0; | 330 | return 0; |
330 | } | 331 | } |
332 | #endif | ||
331 | 333 | ||
332 | static iInt2 documentPos_DocumentWidget_(const iDocumentWidget *d, iInt2 pos) { | 334 | static iInt2 documentPos_DocumentWidget_(const iDocumentWidget *d, iInt2 pos) { |
333 | return addY_I2(sub_I2(pos, topLeft_Rect(documentBounds_DocumentWidget_(d))), | 335 | return addY_I2(sub_I2(pos, topLeft_Rect(documentBounds_DocumentWidget_(d))), |
@@ -691,8 +693,7 @@ static void updateOutline_DocumentWidget_(iDocumentWidget *d) { | |||
691 | 693 | ||
692 | static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) { | 694 | static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) { |
693 | setUrl_GmDocument(d->doc, d->mod.url); | 695 | setUrl_GmDocument(d->doc, d->mod.url); |
694 | setSource_GmDocument( | 696 | setSource_GmDocument(d->doc, source, documentWidth_DocumentWidget_(d)); |
695 | d->doc, source, documentWidth_DocumentWidget_(d), forceBreakWidth_DocumentWidget_(d)); | ||
696 | d->foundMark = iNullRange; | 697 | d->foundMark = iNullRange; |
697 | d->selectMark = iNullRange; | 698 | d->selectMark = iNullRange; |
698 | d->hoverLink = NULL; | 699 | d->hoverLink = NULL; |
@@ -1354,8 +1355,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1354 | const char *midLoc = (mid ? mid->text.start : NULL); | 1355 | const char *midLoc = (mid ? mid->text.start : NULL); |
1355 | /* Alt/Option key may be involved in window size changes. */ | 1356 | /* Alt/Option key may be involved in window size changes. */ |
1356 | iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse); | 1357 | iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse); |
1357 | setWidth_GmDocument( | 1358 | setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); |
1358 | d->doc, documentWidth_DocumentWidget_(d), forceBreakWidth_DocumentWidget_(d)); | ||
1359 | scroll_DocumentWidget_(d, 0); | 1359 | scroll_DocumentWidget_(d, 0); |
1360 | if (midLoc) { | 1360 | if (midLoc) { |
1361 | mid = findRunAtLoc_GmDocument(d->doc, midLoc); | 1361 | mid = findRunAtLoc_GmDocument(d->doc, midLoc); |
@@ -2948,8 +2948,7 @@ iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { | |||
2948 | } | 2948 | } |
2949 | 2949 | ||
2950 | void updateSize_DocumentWidget(iDocumentWidget *d) { | 2950 | void updateSize_DocumentWidget(iDocumentWidget *d) { |
2951 | setWidth_GmDocument( | 2951 | setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); |
2952 | d->doc, documentWidth_DocumentWidget_(d), forceBreakWidth_DocumentWidget_(d)); | ||
2953 | updateSideIconBuf_DocumentWidget_(d); | 2952 | updateSideIconBuf_DocumentWidget_(d); |
2954 | updateOutline_DocumentWidget_(d); | 2953 | updateOutline_DocumentWidget_(d); |
2955 | updateVisible_DocumentWidget_(d); | 2954 | updateVisible_DocumentWidget_(d); |
diff --git a/src/ui/window.c b/src/ui/window.c index 906e1084..c0afe266 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -155,8 +155,6 @@ static const iMenuItem viewMenuItems_[] = { | |||
155 | { "Zoom In", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, | 155 | { "Zoom In", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, |
156 | { "Zoom Out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, | 156 | { "Zoom Out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, |
157 | { "Reset Zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, | 157 | { "Reset Zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, |
158 | { "---", 0, 0, NULL }, | ||
159 | { "Wrap Preformatted", 0, 0, "forcewrap.toggle" } /* TODO: remove this; should scroll preformatted */ | ||
160 | }; | 158 | }; |
161 | 159 | ||
162 | static iMenuItem bookmarksMenuItems_[] = { | 160 | static iMenuItem bookmarksMenuItems_[] = { |