diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 11 | ||||
-rw-r--r-- | src/ui/util.c | 6 | ||||
-rw-r--r-- | src/ui/window.c | 12 | ||||
-rw-r--r-- | src/ui/window.h | 1 |
4 files changed, 28 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 558c320d..8d3716a6 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1234,6 +1234,10 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1234 | refresh_Widget(w); | 1234 | refresh_Widget(w); |
1235 | updateWindowTitle_DocumentWidget_(d); | 1235 | updateWindowTitle_DocumentWidget_(d); |
1236 | } | 1236 | } |
1237 | else if (equal_Command(cmd, "window.mouse.exited")) { | ||
1238 | updateOutlineOpacity_DocumentWidget_(d); | ||
1239 | return iFalse; | ||
1240 | } | ||
1237 | else if (equal_Command(cmd, "theme.changed") && document_App() == d) { | 1241 | else if (equal_Command(cmd, "theme.changed") && document_App() == d) { |
1238 | updateTheme_DocumentWidget_(d); | 1242 | updateTheme_DocumentWidget_(d); |
1239 | invalidate_DocumentWidget_(d); | 1243 | invalidate_DocumentWidget_(d); |
@@ -2116,7 +2120,6 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
2116 | } | 2120 | } |
2117 | else if (run->audioId) { | 2121 | else if (run->audioId) { |
2118 | /* Audio player UI is drawn afterwards as a dynamic overlay. */ | 2122 | /* Audio player UI is drawn afterwards as a dynamic overlay. */ |
2119 | //fillRect_Paint(&d->paint, moved_Rect(run->visBounds, origin), red_ColorId); | ||
2120 | return; | 2123 | return; |
2121 | } | 2124 | } |
2122 | enum iColorId fg = run->color; | 2125 | enum iColorId fg = run->color; |
@@ -2181,6 +2184,12 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
2181 | goto runDrawn; | 2184 | goto runDrawn; |
2182 | } | 2185 | } |
2183 | } | 2186 | } |
2187 | if (run->flags & quoteBorder_GmRunFlag) { | ||
2188 | drawVLine_Paint(&d->paint, | ||
2189 | addX_I2(visPos, -gap_Text * 5 / 2), | ||
2190 | height_Rect(run->visBounds), | ||
2191 | tmQuoteIcon_ColorId); | ||
2192 | } | ||
2184 | drawRange_Text(run->font, visPos, fg, run->text); | 2193 | drawRange_Text(run->font, visPos, fg, run->text); |
2185 | // printf("{%s}\n", cstr_Rangecc(run->text)); | 2194 | // printf("{%s}\n", cstr_Rangecc(run->text)); |
2186 | runDrawn:; | 2195 | runDrawn:; |
diff --git a/src/ui/util.c b/src/ui/util.c index 35eea9c3..bef839dc 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -991,6 +991,12 @@ iWidget *makePreferences_Widget(void) { | |||
991 | addRadioButton_(widths, "prefs.linewidth.1000", "Window", "linewidth.set arg:1000"); | 991 | addRadioButton_(widths, "prefs.linewidth.1000", "Window", "linewidth.set arg:1000"); |
992 | } | 992 | } |
993 | addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 993 | addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
994 | addChild_Widget(headings, iClob(makeHeading_Widget("Quote indicator:"))); | ||
995 | iWidget *quote = new_Widget(); { | ||
996 | addRadioButton_(quote, "prefs.quoteicon.1", "Icon", "quoteicon.set arg:1"); | ||
997 | addRadioButton_(quote, "prefs.quoteicon.0", "Line", "quoteicon.set arg:0"); | ||
998 | } | ||
999 | addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | ||
994 | addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:"))); | 1000 | addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:"))); |
995 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); | 1001 | addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); |
996 | makeTwoColumnHeading_("WIDE LAYOUT", headings, values); | 1002 | makeTwoColumnHeading_("WIDE LAYOUT", headings, values); |
diff --git a/src/ui/window.c b/src/ui/window.c index 40215506..c5194ea0 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -524,6 +524,7 @@ void init_Window(iWindow *d, iRect rect) { | |||
524 | d->lastRect = rect; | 524 | d->lastRect = rect; |
525 | d->pendingCursor = NULL; | 525 | d->pendingCursor = NULL; |
526 | d->isDrawFrozen = iTrue; | 526 | d->isDrawFrozen = iTrue; |
527 | d->isMouseInside = iTrue; | ||
527 | uint32_t flags = 0; | 528 | uint32_t flags = 0; |
528 | #if defined (iPlatformApple) | 529 | #if defined (iPlatformApple) |
529 | SDL_SetHint(SDL_HINT_RENDER_DRIVER, shouldDefaultToMetalRenderer_MacOS() ? "metal" : "opengl"); | 530 | SDL_SetHint(SDL_HINT_RENDER_DRIVER, shouldDefaultToMetalRenderer_MacOS() ? "metal" : "opengl"); |
@@ -543,7 +544,7 @@ void init_Window(iWindow *d, iRect rect) { | |||
543 | if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { | 544 | if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { |
544 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); | 545 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); |
545 | } | 546 | } |
546 | const iInt2 minSize = init_I2(425, 250); | 547 | const iInt2 minSize = init_I2(425, 300); |
547 | SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y); | 548 | SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y); |
548 | SDL_SetWindowTitle(d->win, "Lagrange"); | 549 | SDL_SetWindowTitle(d->win, "Lagrange"); |
549 | /* Some info. */ { | 550 | /* Some info. */ { |
@@ -655,6 +656,12 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
655 | return iTrue; | 656 | return iTrue; |
656 | case SDL_WINDOWEVENT_LEAVE: | 657 | case SDL_WINDOWEVENT_LEAVE: |
657 | unhover_Widget(); | 658 | unhover_Widget(); |
659 | d->isMouseInside = iFalse; | ||
660 | postCommand_App("window.mouse.exited"); | ||
661 | return iTrue; | ||
662 | case SDL_WINDOWEVENT_ENTER: | ||
663 | d->isMouseInside = iTrue; | ||
664 | postCommand_App("window.mouse.entered"); | ||
658 | return iTrue; | 665 | return iTrue; |
659 | default: | 666 | default: |
660 | break; | 667 | break; |
@@ -812,6 +819,9 @@ iInt2 coord_Window(const iWindow *d, int x, int y) { | |||
812 | } | 819 | } |
813 | 820 | ||
814 | iInt2 mouseCoord_Window(const iWindow *d) { | 821 | iInt2 mouseCoord_Window(const iWindow *d) { |
822 | if (!d->isMouseInside) { | ||
823 | return init_I2(-1000000, -1000000); | ||
824 | } | ||
815 | int x, y; | 825 | int x, y; |
816 | SDL_GetMouseState(&x, &y); | 826 | SDL_GetMouseState(&x, &y); |
817 | return coord_Window(d, x, y); | 827 | return coord_Window(d, x, y); |
diff --git a/src/ui/window.h b/src/ui/window.h index da4a2123..3ede1578 100644 --- a/src/ui/window.h +++ b/src/ui/window.h | |||
@@ -37,6 +37,7 @@ struct Impl_Window { | |||
37 | iInt2 initialPos; | 37 | iInt2 initialPos; |
38 | iRect lastRect; /* updated when window is moved/resized */ | 38 | iRect lastRect; /* updated when window is moved/resized */ |
39 | iBool isDrawFrozen; /* avoids premature draws while restoring window state */ | 39 | iBool isDrawFrozen; /* avoids premature draws while restoring window state */ |
40 | iBool isMouseInside; | ||
40 | SDL_Renderer *render; | 41 | SDL_Renderer *render; |
41 | iWidget * root; | 42 | iWidget * root; |
42 | float pixelRatio; | 43 | float pixelRatio; |