diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-22 13:44:04 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-22 13:44:04 +0300 |
commit | da01481bc5c5462afac3521b2a383e3dce3ee2c0 (patch) | |
tree | 06e237239450d26ca23860908b7464ac51fb13ea /src | |
parent | de5bed516c43c882766b97133bbd5234026c4d4d (diff) |
DocumentWidget: Debug outlines for text runs
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index a2cf0a8f..c0dbcded 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -71,7 +71,7 @@ void init_DocumentWidget(iDocumentWidget *d) { | |||
71 | d->newSource = new_String(); | 71 | d->newSource = new_String(); |
72 | d->doc = new_GmDocument(); | 72 | d->doc = new_GmDocument(); |
73 | d->pageMargin = 5; | 73 | d->pageMargin = 5; |
74 | setUrl_DocumentWidget(d, collectNewCStr_String("file:///Users/jaakko/test.gmi")); | 74 | setUrl_DocumentWidget(d, collectNewCStr_String("file:///home/jaakko/test.gmi")); |
75 | } | 75 | } |
76 | 76 | ||
77 | void deinit_DocumentWidget(iDocumentWidget *d) { | 77 | void deinit_DocumentWidget(iDocumentWidget *d) { |
@@ -190,6 +190,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
190 | /* TODO: making a copy is unnecessary; the text routines should accept Rangecc */ | 190 | /* TODO: making a copy is unnecessary; the text routines should accept Rangecc */ |
191 | initRange_String(&text, run->text); | 191 | initRange_String(&text, run->text); |
192 | drawString_Text(run->font, add_I2(d->bounds.pos, run->bounds.pos), run->color, &text); | 192 | drawString_Text(run->font, add_I2(d->bounds.pos, run->bounds.pos), run->color, &text); |
193 | drawRect_Paint(&d->paint, moved_Rect(run->bounds, d->bounds.pos), red_ColorId); | ||
193 | deinit_String(&text); | 194 | deinit_String(&text); |
194 | } | 195 | } |
195 | 196 | ||
@@ -208,6 +209,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
208 | iDrawContext ctx = {.d = d, .bounds = bounds_Widget(w) }; | 209 | iDrawContext ctx = {.d = d, .bounds = bounds_Widget(w) }; |
209 | shrink_Rect(&ctx.bounds, init1_I2(gap_UI * d->pageMargin)); | 210 | shrink_Rect(&ctx.bounds, init1_I2(gap_UI * d->pageMargin)); |
210 | init_Paint(&ctx.paint); | 211 | init_Paint(&ctx.paint); |
212 | drawRect_Paint(&ctx.paint, ctx.bounds, teal_ColorId); | ||
211 | render_GmDocument(d->doc, (iRangei){ 0, height_Rect(ctx.bounds) }, drawRun_DrawContext_, &ctx); | 213 | render_GmDocument(d->doc, (iRangei){ 0, height_Rect(ctx.bounds) }, drawRun_DrawContext_, &ctx); |
212 | } | 214 | } |
213 | 215 | ||