diff options
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index e0272a5d..fa65cf3c 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -59,7 +59,7 @@ static void enableEditorKeysInMenus_(iBool enable) { | |||
59 | /*----------------------------------------------------------------------------------------------*/ | 59 | /*----------------------------------------------------------------------------------------------*/ |
60 | 60 | ||
61 | iDeclareType(InputLine) | 61 | iDeclareType(InputLine) |
62 | 62 | ||
63 | struct Impl_InputLine { | 63 | struct Impl_InputLine { |
64 | iString text; | 64 | iString text; |
65 | iRanges range; /* byte offset inside the entire content; for marking */ | 65 | iRanges range; /* byte offset inside the entire content; for marking */ |
@@ -157,7 +157,7 @@ static void mergeLines_(const iArray *inputLines, iString *merged) { | |||
157 | } | 157 | } |
158 | 158 | ||
159 | iDefineTypeConstruction(InputLine) | 159 | iDefineTypeConstruction(InputLine) |
160 | 160 | ||
161 | /*----------------------------------------------------------------------------------------------*/ | 161 | /*----------------------------------------------------------------------------------------------*/ |
162 | 162 | ||
163 | iDeclareType(InputUndo) | 163 | iDeclareType(InputUndo) |
@@ -227,7 +227,7 @@ struct Impl_InputWidget { | |||
227 | }; | 227 | }; |
228 | 228 | ||
229 | iDefineObjectConstructionArgs(InputWidget, (size_t maxLen), maxLen) | 229 | iDefineObjectConstructionArgs(InputWidget, (size_t maxLen), maxLen) |
230 | 230 | ||
231 | static void updateMetrics_InputWidget_(iInputWidget *); | 231 | static void updateMetrics_InputWidget_(iInputWidget *); |
232 | 232 | ||
233 | static void restoreBackup_InputWidget_(iInputWidget *d) { | 233 | static void restoreBackup_InputWidget_(iInputWidget *d) { |
@@ -610,7 +610,7 @@ static uint32_t cursorTimer_(uint32_t interval, void *w) { | |||
610 | 610 | ||
611 | static void startOrStopCursorTimer_InputWidget_(iInputWidget *d, iBool doStart) { | 611 | static void startOrStopCursorTimer_InputWidget_(iInputWidget *d, iBool doStart) { |
612 | if (doStart && !d->timer) { | 612 | if (doStart && !d->timer) { |
613 | d->timer = SDL_AddTimer(refreshInterval_InputWidget_, cursorTimer_, d); | 613 | d->timer = SDL_AddTimer(refreshInterval_InputWidget_, cursorTimer_, d); |
614 | } | 614 | } |
615 | else if (!doStart && d->timer) { | 615 | else if (!doStart && d->timer) { |
616 | SDL_RemoveTimer(d->timer); | 616 | SDL_RemoveTimer(d->timer); |
@@ -679,7 +679,7 @@ void deinit_InputWidget(iInputWidget *d) { | |||
679 | delete_TextBuf(d->buffered); | 679 | delete_TextBuf(d->buffered); |
680 | clearUndo_InputWidget_(d); | 680 | clearUndo_InputWidget_(d); |
681 | deinit_Array(&d->undoStack); | 681 | deinit_Array(&d->undoStack); |
682 | startOrStopCursorTimer_InputWidget_(d, iFalse); | 682 | startOrStopCursorTimer_InputWidget_(d, iFalse); |
683 | deinit_String(&d->srcHint); | 683 | deinit_String(&d->srcHint); |
684 | deinit_String(&d->hint); | 684 | deinit_String(&d->hint); |
685 | deinit_String(&d->oldText); | 685 | deinit_String(&d->oldText); |
@@ -708,7 +708,7 @@ static iBool popUndo_InputWidget_(iInputWidget *d) { | |||
708 | splitToLines_(&undo->text, &d->lines); | 708 | splitToLines_(&undo->text, &d->lines); |
709 | d->cursor = undo->cursor; | 709 | d->cursor = undo->cursor; |
710 | deinit_InputUndo_(undo); | 710 | deinit_InputUndo_(undo); |
711 | popBack_Array(&d->undoStack); | 711 | popBack_Array(&d->undoStack); |
712 | iZap(d->mark); | 712 | iZap(d->mark); |
713 | updateAllLinesAndResizeHeight_InputWidget_(d); | 713 | updateAllLinesAndResizeHeight_InputWidget_(d); |
714 | return iTrue; | 714 | return iTrue; |
@@ -836,7 +836,7 @@ static iRangei visibleLineRange_InputWidget_(const iInputWidget *d) { | |||
836 | static void updateBuffered_InputWidget_(iInputWidget *d) { | 836 | static void updateBuffered_InputWidget_(iInputWidget *d) { |
837 | invalidateBuffered_InputWidget_(d); | 837 | invalidateBuffered_InputWidget_(d); |
838 | if (isHintVisible_InputWidget_(d)) { | 838 | if (isHintVisible_InputWidget_(d)) { |
839 | d->buffered = newRange_TextBuf(d->font, uiAnnotation_ColorId, range_String(&d->hint)); | 839 | d->buffered = newRange_TextBuf(d->font, uiAnnotation_ColorId, range_String(&d->hint)); |
840 | } | 840 | } |
841 | else { | 841 | else { |
842 | /* Draw all the potentially visible lines to a buffer. */ | 842 | /* Draw all the potentially visible lines to a buffer. */ |
@@ -1073,7 +1073,7 @@ static void insertRange_InputWidget_(iInputWidget *d, iRangecc range) { | |||
1073 | } | 1073 | } |
1074 | textOfLinesWasChanged_InputWidget_(d, (iRangei){ firstModified, d->cursor.y + 1 }); | 1074 | textOfLinesWasChanged_InputWidget_(d, (iRangei){ firstModified, d->cursor.y + 1 }); |
1075 | showCursor_InputWidget_(d); | 1075 | showCursor_InputWidget_(d); |
1076 | refresh_Widget(as_Widget(d)); | 1076 | refresh_Widget(as_Widget(d)); |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | static void insertChar_InputWidget_(iInputWidget *d, iChar chr) { | 1079 | static void insertChar_InputWidget_(iInputWidget *d, iChar chr) { |
@@ -1110,7 +1110,7 @@ void setCursor_InputWidget(iInputWidget *d, iInt2 pos) { | |||
1110 | static iBool moveCursorByLine_InputWidget_(iInputWidget *d, int dir, int horiz) { | 1110 | static iBool moveCursorByLine_InputWidget_(iInputWidget *d, int dir, int horiz) { |
1111 | const iInputLine *line = cursorLine_InputWidget_(d); | 1111 | const iInputLine *line = cursorLine_InputWidget_(d); |
1112 | iInt2 relCoord = relativeCursorCoord_InputWidget_(d); | 1112 | iInt2 relCoord = relativeCursorCoord_InputWidget_(d); |
1113 | int relLine = relCoord.y / lineHeight_Text(d->font); | 1113 | int relLine = relCoord.y / lineHeight_Text(d->font); |
1114 | if ((dir < 0 && relLine > 0) || (dir > 0 && relLine < numWrapLines_InputLine_(line) - 1)) { | 1114 | if ((dir < 0 && relLine > 0) || (dir > 0 && relLine < numWrapLines_InputLine_(line) - 1)) { |
1115 | relCoord.y += dir * lineHeight_Text(d->font); | 1115 | relCoord.y += dir * lineHeight_Text(d->font); |
1116 | } | 1116 | } |
@@ -1542,7 +1542,7 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
1542 | else if (lineDelta > 0) { | 1542 | else if (lineDelta > 0) { |
1543 | lineDelta = iMin(lineDelta, | 1543 | lineDelta = iMin(lineDelta, |
1544 | lastLine_InputWidget_(d)->wrapLines.end - d->visWrapLines.end); | 1544 | lastLine_InputWidget_(d)->wrapLines.end - d->visWrapLines.end); |
1545 | if (!lineDelta) d->wheelAccum = 0; | 1545 | if (!lineDelta) d->wheelAccum = 0; |
1546 | } | 1546 | } |
1547 | d->wheelAccum -= lineDelta * lineHeight; | 1547 | d->wheelAccum -= lineDelta * lineHeight; |
1548 | d->visWrapLines.start += lineDelta; | 1548 | d->visWrapLines.start += lineDelta; |
@@ -1925,7 +1925,7 @@ static void draw_InputWidget_(const iInputWidget *d) { | |||
1925 | } | 1925 | } |
1926 | iPaint p; | 1926 | iPaint p; |
1927 | init_Paint(&p); | 1927 | init_Paint(&p); |
1928 | /* `lines` is already up to date and ready for drawing. */ | 1928 | /* `lines` is already up to date and ready for drawing. */ |
1929 | fillRect_Paint( | 1929 | fillRect_Paint( |
1930 | &p, bounds, isFocused ? uiInputBackgroundFocused_ColorId : uiInputBackground_ColorId); | 1930 | &p, bounds, isFocused ? uiInputBackgroundFocused_ColorId : uiInputBackground_ColorId); |
1931 | drawRectThickness_Paint(&p, | 1931 | drawRectThickness_Paint(&p, |