summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c16
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/inputwidget.c24
-rw-r--r--src/ui/util.c9
5 files changed, 32 insertions, 19 deletions
diff --git a/src/app.c b/src/app.c
index 828f5097..e807f09d 100644
--- a/src/app.c
+++ b/src/app.c
@@ -258,6 +258,7 @@ static iString *serializePrefs_App_(const iApp *d) {
258 { "prefs.bookmarks.addbottom", &d->prefs.addBookmarksToBottom }, 258 { "prefs.bookmarks.addbottom", &d->prefs.addBookmarksToBottom },
259 { "prefs.archive.openindex", &d->prefs.openArchiveIndexPages }, 259 { "prefs.archive.openindex", &d->prefs.openArchiveIndexPages },
260 { "prefs.font.warnmissing", &d->prefs.warnAboutMissingGlyphs }, 260 { "prefs.font.warnmissing", &d->prefs.warnAboutMissingGlyphs },
261 { "prefs.blink", &d->prefs.blinkingCursor },
261 }; 262 };
262 iForIndices(i, boolPrefs) { 263 iForIndices(i, boolPrefs) {
263 appendFormat_String(str, "%s.changed arg:%d\n", boolPrefs[i].id, *boolPrefs[i].value); 264 appendFormat_String(str, "%s.changed arg:%d\n", boolPrefs[i].id, *boolPrefs[i].value);
@@ -2600,6 +2601,10 @@ iBool handleCommand_App(const char *cmd) {
2600 d->prefs.uiAnimations = arg_Command(cmd) != 0; 2601 d->prefs.uiAnimations = arg_Command(cmd) != 0;
2601 return iTrue; 2602 return iTrue;
2602 } 2603 }
2604 else if (equal_Command(cmd, "prefs.blink.changed")) {
2605 d->prefs.blinkingCursor = arg_Command(cmd) != 0;
2606 return iTrue;
2607 }
2603 else if (equal_Command(cmd, "prefs.time.24h.changed")) { 2608 else if (equal_Command(cmd, "prefs.time.24h.changed")) {
2604 d->prefs.time24h = arg_Command(cmd) != 0; 2609 d->prefs.time24h = arg_Command(cmd) != 0;
2605 return iTrue; 2610 return iTrue;
@@ -2911,6 +2916,8 @@ iBool handleCommand_App(const char *cmd) {
2911 iWidget *dlg = makePreferences_Widget(); 2916 iWidget *dlg = makePreferences_Widget();
2912 updatePrefsThemeButtons_(dlg); 2917 updatePrefsThemeButtons_(dlg);
2913 setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.strings[downloadDir_PrefsString]); 2918 setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.strings[downloadDir_PrefsString]);
2919 /* TODO: Use a common table in Prefs to do this more conviently.
2920 Also see `serializePrefs_App_()`. */
2914 setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink); 2921 setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink);
2915 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); 2922 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling);
2916 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); 2923 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling);
@@ -2921,7 +2928,7 @@ iBool handleCommand_App(const char *cmd) {
2921 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); 2928 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme);
2922 setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); 2929 setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame);
2923 setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations); 2930 setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations);
2924// setText_InputWidget(findChild_Widget(dlg, "prefs.userfont"), &d->prefs.symbolFontPath); 2931 setToggle_Widget(findChild_Widget(dlg, "prefs.blink"), d->prefs.blinkingCursor);
2925 updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); 2932 updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit);
2926 updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]); 2933 updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]);
2927 updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]); 2934 updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]);
@@ -2933,13 +2940,6 @@ iBool handleCommand_App(const char *cmd) {
2933 setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); 2940 setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize);
2934 setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), 2941 setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"),
2935 collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); 2942 collectNewFormat_String("%g", uiScale_Window(as_Window(d->window))));
2936// setFlags_Widget(findChild_Widget(dlg, format_CStr("prefs.font.%d", d->prefs.font)),
2937// selected_WidgetFlag,
2938// iTrue);
2939// setFlags_Widget(
2940// findChild_Widget(dlg, format_CStr("prefs.headingfont.%d", d->prefs.headingFont)),
2941// selected_WidgetFlag,
2942// iTrue);
2943 setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gemini"), 2943 setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gemini"),
2944 selected_WidgetFlag, 2944 selected_WidgetFlag,
2945 d->prefs.monospaceGemini); 2945 d->prefs.monospaceGemini);
diff --git a/src/prefs.c b/src/prefs.c
index 10df9ade..5d85f195 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -42,6 +42,7 @@ void init_Prefs(iPrefs *d) {
42 d->zoomPercent = 100; 42 d->zoomPercent = 100;
43 d->sideIcon = iTrue; 43 d->sideIcon = iTrue;
44 d->hideToolbarOnScroll = iTrue; 44 d->hideToolbarOnScroll = iTrue;
45 d->blinkingCursor = iTrue;
45 d->pinSplit = 1; 46 d->pinSplit = 1;
46 d->time24h = iTrue; 47 d->time24h = iTrue;
47 d->returnKey = default_ReturnKeyBehavior; 48 d->returnKey = default_ReturnKeyBehavior;
diff --git a/src/prefs.h b/src/prefs.h
index c9abfc8e..f22953c5 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -72,6 +72,7 @@ struct Impl_Prefs {
72 iBool uiAnimations; 72 iBool uiAnimations;
73 float uiScale; 73 float uiScale;
74 iBool hideToolbarOnScroll; 74 iBool hideToolbarOnScroll;
75 iBool blinkingCursor;
75 /* Document presentation */ 76 /* Document presentation */
76 int zoomPercent; 77 int zoomPercent;
77 iBool sideIcon; 78 iBool sideIcon;
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 49cc0a1e..b910f905 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -588,7 +588,7 @@ static void updateVisible_InputWidget_(iInputWidget *d) {
588 } 588 }
589 d->visWrapLines.start += delta; 589 d->visWrapLines.start += delta;
590 d->visWrapLines.end += delta; 590 d->visWrapLines.end += delta;
591 iAssert(contains_Range(&d->visWrapLines, cursorY)); 591// iAssert(contains_Range(&d->visWrapLines, cursorY));
592 if (!isFocused_Widget(d) && d->maxWrapLines == 1) { 592 if (!isFocused_Widget(d) && d->maxWrapLines == 1) {
593 d->visWrapLines.start = 0; 593 d->visWrapLines.start = 0;
594 d->visWrapLines.end = 1; 594 d->visWrapLines.end = 1;
@@ -711,7 +711,10 @@ static uint32_t cursorTimer_(uint32_t interval, void *w) {
711 return interval; 711 return interval;
712} 712}
713 713
714static void startOrStopCursorTimer_InputWidget_(iInputWidget *d, iBool doStart) { 714static void startOrStopCursorTimer_InputWidget_(iInputWidget *d, int doStart) {
715 if (!prefs_App()->blinkingCursor && doStart == 1) {
716 doStart = iFalse;
717 }
715 if (doStart && !d->timer) { 718 if (doStart && !d->timer) {
716 d->timer = SDL_AddTimer(refreshInterval_InputWidget_, cursorTimer_, d); 719 d->timer = SDL_AddTimer(refreshInterval_InputWidget_, cursorTimer_, d);
717 } 720 }
@@ -2167,6 +2170,12 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {
2167 return iFalse; 2170 return iFalse;
2168 } 2171 }
2169#if !LAGRANGE_USE_SYSTEM_TEXT_INPUT 2172#if !LAGRANGE_USE_SYSTEM_TEXT_INPUT
2173 else if (isCommand_UserEvent(ev, "prefs.blink.changed")) {
2174 if (isEditing_InputWidget_(d) && arg_Command(command_UserEvent(ev))) {
2175 startOrStopCursorTimer_InputWidget_(d, 2);
2176 }
2177 return iFalse;
2178 }
2170 else if (isEditing_InputWidget_(d) && (isCommand_UserEvent(ev, "window.focus.lost") || 2179 else if (isEditing_InputWidget_(d) && (isCommand_UserEvent(ev, "window.focus.lost") ||
2171 isCommand_UserEvent(ev, "window.focus.gained"))) { 2180 isCommand_UserEvent(ev, "window.focus.gained"))) {
2172 startOrStopCursorTimer_InputWidget_(d, isCommand_UserEvent(ev, "window.focus.gained")); 2181 startOrStopCursorTimer_InputWidget_(d, isCommand_UserEvent(ev, "window.focus.gained"));
@@ -2613,10 +2622,10 @@ static void draw_InputWidget_(const iInputWidget *d) {
2613 return; 2622 return;
2614 } 2623 }
2615 const iRect contentBounds = contentBounds_InputWidget_(d); 2624 const iRect contentBounds = contentBounds_InputWidget_(d);
2616 iInt2 drawPos = topLeft_Rect(contentBounds); 2625 iInt2 drawPos = topLeft_Rect(contentBounds);
2617 const int fg = isHint ? uiAnnotation_ColorId 2626 const int fg = isHint ? uiAnnotation_ColorId
2618 : isFocused /*&& !isEmpty_Array(&d->lines)*/ ? uiInputTextFocused_ColorId 2627 : isFocused ? uiInputTextFocused_ColorId
2619 : uiInputText_ColorId; 2628 : uiInputText_ColorId;
2620#if !LAGRANGE_USE_SYSTEM_TEXT_INPUT 2629#if !LAGRANGE_USE_SYSTEM_TEXT_INPUT
2621 setClip_Paint(&p, 2630 setClip_Paint(&p,
2622 adjusted_Rect(bounds, 2631 adjusted_Rect(bounds,
@@ -2685,7 +2694,8 @@ static void draw_InputWidget_(const iInputWidget *d) {
2685 wrapText.context = NULL; 2694 wrapText.context = NULL;
2686 } 2695 }
2687 /* Draw the insertion point. */ 2696 /* Draw the insertion point. */
2688 if (isFocused && d->cursorVis && contains_Range(&visLines, d->cursor.y) && 2697 if (isFocused && (d->cursorVis || !prefs_App()->blinkingCursor) &&
2698 contains_Range(&visLines, d->cursor.y) &&
2689 (deviceType_App() == desktop_AppDeviceType || isEmpty_Range(&d->mark))) { 2699 (deviceType_App() == desktop_AppDeviceType || isEmpty_Range(&d->mark))) {
2690 iInt2 curSize; 2700 iInt2 curSize;
2691 iRangecc cursorChar = iNullRange; 2701 iRangecc cursorChar = iNullRange;
diff --git a/src/ui/util.c b/src/ui/util.c
index db24b6fc..a46c7f80 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2629,9 +2629,8 @@ iWidget *makePreferences_Widget(void) {
2629 } 2629 }
2630 /* User Interface. */ { 2630 /* User Interface. */ {
2631 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values); 2631 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values);
2632#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 2632 addDialogToggle_(headings, values, "${prefs.animate}", "prefs.animate");
2633 addDialogToggle_(headings, values, "${prefs.customframe}", "prefs.customframe"); 2633 addDialogToggle_(headings, values, "${prefs.blink}", "prefs.blink");
2634#endif
2635 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.returnkey}"))); 2634 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.returnkey}")));
2636 /* Return key behaviors. */ { 2635 /* Return key behaviors. */ {
2637 iLabelWidget *returnKey = makeMenuButton_LabelWidget( 2636 iLabelWidget *returnKey = makeMenuButton_LabelWidget(
@@ -2645,7 +2644,9 @@ iWidget *makePreferences_Widget(void) {
2645 setId_Widget(addChildFlags_Widget(values, iClob(returnKey), alignLeft_WidgetFlag), 2644 setId_Widget(addChildFlags_Widget(values, iClob(returnKey), alignLeft_WidgetFlag),
2646 "prefs.returnkey"); 2645 "prefs.returnkey");
2647 } 2646 }
2648 addDialogToggle_(headings, values, "${prefs.animate}", "prefs.animate"); 2647#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
2648 addDialogToggle_(headings, values, "${prefs.customframe}", "prefs.customframe");
2649#endif
2649 makeTwoColumnHeading_("${heading.prefs.scrolling}", headings, values); 2650 makeTwoColumnHeading_("${heading.prefs.scrolling}", headings, values);
2650 addDialogToggle_(headings, values, "${prefs.smoothscroll}", "prefs.smoothscroll"); 2651 addDialogToggle_(headings, values, "${prefs.smoothscroll}", "prefs.smoothscroll");
2651 /* Scroll speeds. */ { 2652 /* Scroll speeds. */ {