summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-25 18:11:04 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-25 18:11:04 +0300
commit51a9618e72450c8a50a8d4f1fd2cb3b4921a537d (patch)
tree4ddc9b27e0ced5521de67a7fabb5753b299ed3f6
parent327e2fd4229bf14ef61b0aeace9c8503b183f7e9 (diff)
Cleanup
-rw-r--r--src/app.c2
-rw-r--r--src/gmdocument.c2
-rw-r--r--src/ui/documentwidget.c32
3 files changed, 18 insertions, 18 deletions
diff --git a/src/app.c b/src/app.c
index 1e37030f..1b8147d0 100644
--- a/src/app.c
+++ b/src/app.c
@@ -420,7 +420,7 @@ void postRefresh_App(void) {
420 iApp *d = &app_; 420 iApp *d = &app_;
421 if (!d->pendingRefresh) { 421 if (!d->pendingRefresh) {
422 if (!isEmpty_SortedArray(&d->tickers)) { 422 if (!isEmpty_SortedArray(&d->tickers)) {
423 d->lastTickerTime = 0; /* tickers had been paused */ 423 d->lastTickerTime = SDL_GetTicks(); /* tickers had been paused */
424 } 424 }
425 d->pendingRefresh = iTrue; 425 d->pendingRefresh = iTrue;
426 SDL_Event ev; 426 SDL_Event ev;
diff --git a/src/gmdocument.c b/src/gmdocument.c
index eb60c9db..19c11179 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -764,7 +764,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
764 } 764 }
765 else if (i == tmBannerIcon_ColorId || i == tmBannerTitle_ColorId) { 765 else if (i == tmBannerIcon_ColorId || i == tmBannerTitle_ColorId) {
766 color.sat = 1.0f; 766 color.sat = 1.0f;
767 color.lum = 0.3f; 767 color.lum = 0.35f;
768 } 768 }
769 else if (i == tmBannerBackground_ColorId) { 769 else if (i == tmBannerBackground_ColorId) {
770 color = hsl_Color(get_Color(tmBackground_ColorId)); 770 color = hsl_Color(get_Color(tmBackground_ColorId));
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 5292d3f5..874a87f2 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -195,11 +195,11 @@ struct Impl_DocumentWidget {
195 iClick click; 195 iClick click;
196 float initNormScrollY; 196 float initNormScrollY;
197 int scrollY; 197 int scrollY;
198 iScrollWidget *scroll;
198 int smoothScroll; 199 int smoothScroll;
199 int smoothSpeed; 200 int smoothSpeed;
200 int lastSmoothOffset; 201 int smoothLastOffset;
201 iBool keepScrolling; 202 iBool smoothContinue;
202 iScrollWidget *scroll;
203 iWidget * menu; 203 iWidget * menu;
204 iVisBuffer * visBuffer; 204 iVisBuffer * visBuffer;
205}; 205};
@@ -225,8 +225,8 @@ void init_DocumentWidget(iDocumentWidget *d) {
225 d->scrollY = 0; 225 d->scrollY = 0;
226 d->smoothScroll = 0; 226 d->smoothScroll = 0;
227 d->smoothSpeed = 0; 227 d->smoothSpeed = 0;
228 d->lastSmoothOffset = 0; 228 d->smoothLastOffset = 0;
229 d->keepScrolling = iFalse; 229 d->smoothContinue = iFalse;
230 d->selecting = iFalse; 230 d->selecting = iFalse;
231 d->selectMark = iNullRange; 231 d->selectMark = iNullRange;
232 d->foundMark = iNullRange; 232 d->foundMark = iNullRange;
@@ -267,8 +267,8 @@ void deinit_DocumentWidget(iDocumentWidget *d) {
267static void resetSmoothScroll_DocumentWidget_(iDocumentWidget *d) { 267static void resetSmoothScroll_DocumentWidget_(iDocumentWidget *d) {
268 d->smoothSpeed = 0; 268 d->smoothSpeed = 0;
269 d->smoothScroll = 0; 269 d->smoothScroll = 0;
270 d->lastSmoothOffset = 0; 270 d->smoothLastOffset = 0;
271 d->keepScrolling = iFalse; 271 d->smoothContinue = iFalse;
272} 272}
273 273
274static int documentWidth_DocumentWidget_(const iDocumentWidget *d) { 274static int documentWidth_DocumentWidget_(const iDocumentWidget *d) {
@@ -769,8 +769,8 @@ static void doScroll_DocumentWidget_(iAny *ptr) {
769 const double elapsed = (double) elapsedSinceLastTicker_App() / 1000.0; 769 const double elapsed = (double) elapsedSinceLastTicker_App() / 1000.0;
770 int delta = d->smoothSpeed * elapsed * iSign(d->smoothScroll); 770 int delta = d->smoothSpeed * elapsed * iSign(d->smoothScroll);
771 if (iAbs(d->smoothScroll) <= iAbs(delta)) { 771 if (iAbs(d->smoothScroll) <= iAbs(delta)) {
772 if (d->keepScrolling) { 772 if (d->smoothContinue) {
773 d->smoothScroll += d->lastSmoothOffset; 773 d->smoothScroll += d->smoothLastOffset;
774 } 774 }
775 else { 775 else {
776 delta = d->smoothScroll; 776 delta = d->smoothScroll;
@@ -790,7 +790,7 @@ static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int spe
790 } 790 }
791 d->smoothSpeed = speed; 791 d->smoothSpeed = speed;
792 d->smoothScroll += offset; 792 d->smoothScroll += offset;
793 d->lastSmoothOffset = offset; 793 d->smoothLastOffset = offset;
794 addTicker_App(doScroll_DocumentWidget_, d); 794 addTicker_App(doScroll_DocumentWidget_, d);
795} 795}
796 796
@@ -1182,8 +1182,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1182 } 1182 }
1183 else if (equalWidget_Command(cmd, w, "scroll.page")) { 1183 else if (equalWidget_Command(cmd, w, "scroll.page")) {
1184 if (argLabel_Command(cmd, "repeat")) { 1184 if (argLabel_Command(cmd, "repeat")) {
1185 if (!d->keepScrolling) { 1185 if (!d->smoothContinue) {
1186 d->keepScrolling = iTrue; 1186 d->smoothContinue = iTrue;
1187 } 1187 }
1188 else { 1188 else {
1189 return iTrue; 1189 return iTrue;
@@ -1193,7 +1193,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1193 arg_Command(cmd) * 1193 arg_Command(cmd) *
1194 (0.5f * height_Rect(documentBounds_DocumentWidget_(d)) - 1194 (0.5f * height_Rect(documentBounds_DocumentWidget_(d)) -
1195 0 * lineHeight_Text(paragraph_FontId)), 1195 0 * lineHeight_Text(paragraph_FontId)),
1196 15 * smoothSpeed_DocumentWidget_); 1196 25 * smoothSpeed_DocumentWidget_);
1197 return iTrue; 1197 return iTrue;
1198 } 1198 }
1199 else if (equal_Command(cmd, "document.goto") && document_App() == d) { 1199 else if (equal_Command(cmd, "document.goto") && document_App() == d) {
@@ -1281,7 +1281,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1281 case SDLK_SPACE: 1281 case SDLK_SPACE:
1282 case SDLK_UP: 1282 case SDLK_UP:
1283 case SDLK_DOWN: 1283 case SDLK_DOWN:
1284 d->keepScrolling = iFalse; 1284 d->smoothContinue = iFalse;
1285 break; 1285 break;
1286 } 1286 }
1287 } 1287 }
@@ -1329,8 +1329,8 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1329 case SDLK_DOWN: 1329 case SDLK_DOWN:
1330 if (mods == 0) { 1330 if (mods == 0) {
1331 if (ev->key.repeat) { 1331 if (ev->key.repeat) {
1332 if (!d->keepScrolling) { 1332 if (!d->smoothContinue) {
1333 d->keepScrolling = iTrue; 1333 d->smoothContinue = iTrue;
1334 } 1334 }
1335 else return iTrue; 1335 else return iTrue;
1336 } 1336 }