diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-03 11:37:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-03 11:53:40 +0300 |
commit | 1fdea43c29a7a0ffb65ec8049da574d4198d22af (patch) | |
tree | b910b6604d60c6710570d4c133893ed2ce73abe1 /source/blender/editors/space_info/info_draw.c | |
parent | a81fdefddebc0eec3e324cf6a9d8c51050d3e749 (diff) |
Fix minor errors with text view margins for console/info editor
- Margins used duplicate define between files.
- Cursor selection ignored margins.
- Cursor wasn't scaling with DPI.
Add a 'draw_rect' member which is the region rect with margins applied
to make these checks clearer.
This resolves issue pointed out in D6300,
which complicated further refactoring.
Diffstat (limited to 'source/blender/editors/space_info/info_draw.c')
-rw-r--r-- | source/blender/editors/space_info/info_draw.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 734515e1f79..a22983c15a8 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -228,6 +228,16 @@ static int report_textview_line_color(struct TextViewContext *tvc, #undef USE_INFO_NEWLINE +static void info_textview_draw_rect_calc(ARegion *ar, rcti *draw_rect) +{ + const int margin = 4 * UI_DPI_FAC; + draw_rect->xmin = margin; + draw_rect->xmax = ar->winx - (V2D_SCROLL_WIDTH + margin); + draw_rect->ymin = margin; + /* No margin at the top (allow text to scroll off the window). */ + draw_rect->ymax = ar->winy; +} + static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, ReportList *reports, @@ -258,7 +268,8 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo, tvc.lheight = 14 * UI_DPI_FAC; // sc->lheight; tvc.ymin = v2d->cur.ymin; tvc.ymax = v2d->cur.ymax; - tvc.winx = ar->winx - V2D_SCROLL_WIDTH; + + info_textview_draw_rect_calc(ar, &tvc.draw_rect); ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick); |