summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c32
1 files changed, 16 insertions, 16 deletions
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 }