[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52992] trunk/blender/source/blender/ editors: correct scrollbars not working properly with DPI in the console/ info view.
Campbell Barton
ideasman42 at gmail.com
Fri Dec 14 09:06:01 CET 2012
Revision: 52992
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52992
Author: campbellbarton
Date: 2012-12-14 08:05:56 +0000 (Fri, 14 Dec 2012)
Log Message:
-----------
correct scrollbars not working properly with DPI in the console/info view.
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/UI_view2d.h
trunk/blender/source/blender/editors/space_console/console_draw.c
trunk/blender/source/blender/editors/space_info/info_draw.c
trunk/blender/source/blender/editors/space_info/textview.c
Modified: trunk/blender/source/blender/editors/include/UI_view2d.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_view2d.h 2012-12-14 06:12:04 UTC (rev 52991)
+++ trunk/blender/source/blender/editors/include/UI_view2d.h 2012-12-14 08:05:56 UTC (rev 52992)
@@ -132,6 +132,7 @@
struct wmKeyConfig;
struct bScreen;
+struct Scene;
struct ScrArea;
struct ARegion;
struct bContext;
Modified: trunk/blender/source/blender/editors/space_console/console_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_console/console_draw.c 2012-12-14 06:12:04 UTC (rev 52991)
+++ trunk/blender/source/blender/editors/space_console/console_draw.c 2012-12-14 08:05:56 UTC (rev 52992)
@@ -52,6 +52,7 @@
#include "UI_interface.h"
#include "UI_resources.h"
+#include "UI_view2d.h"
#include "console_intern.h"
@@ -80,9 +81,9 @@
int cwidth;
int lheight;
int console_width;
- int winx;
int ymin, ymax;
#if 0 /* used by textview, may use later */
+ int winx;
int *xy; // [2]
int *sel; // [2]
int *pos_pick; /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */
@@ -112,10 +113,7 @@
}
#define CONSOLE_DRAW_MARGIN 4
-#define CONSOLE_DRAW_SCROLL 16
-
-
/* console textview callbacks */
static int console_textview_begin(TextViewContext *tvc)
{
@@ -222,7 +220,7 @@
tvc.lheight = sc->lheight * UI_DPI_FAC;
tvc.ymin = v2d->cur.ymin;
tvc.ymax = v2d->cur.ymax;
- tvc.winx = ar->winx;
+ tvc.winx = ar->winx - V2D_SCROLL_WIDTH;
console_scrollback_prompt_begin(sc, &cl_dummy);
ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
@@ -250,7 +248,7 @@
void *mouse_pick = NULL;
int mval_clamp[2];
- mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
+ mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - CONSOLE_DRAW_MARGIN);
mval_clamp[1] = CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy - CONSOLE_DRAW_MARGIN);
console_textview_main__internal(sc, ar, 0, mval_clamp, &mouse_pick, &pos_pick);
Modified: trunk/blender/source/blender/editors/space_info/info_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_info/info_draw.c 2012-12-14 06:12:04 UTC (rev 52991)
+++ trunk/blender/source/blender/editors/space_info/info_draw.c 2012-12-14 08:05:56 UTC (rev 52992)
@@ -57,6 +57,7 @@
#include "UI_resources.h"
#include "UI_interface.h"
+#include "UI_view2d.h"
#include "info_intern.h"
#include "../space_info/textview.h"
@@ -273,7 +274,7 @@
tvc.lheight = 14 * UI_DPI_FAC; //sc->lheight;
tvc.ymin = v2d->cur.ymin;
tvc.ymax = v2d->cur.ymax;
- tvc.winx = ar->winx;
+ tvc.winx = ar->winx - V2D_SCROLL_WIDTH;
ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
Modified: trunk/blender/source/blender/editors/space_info/textview.c
===================================================================
--- trunk/blender/source/blender/editors/space_info/textview.c 2012-12-14 06:12:04 UTC (rev 52991)
+++ trunk/blender/source/blender/editors/space_info/textview.c 2012-12-14 08:05:56 UTC (rev 52992)
@@ -221,7 +221,6 @@
}
#define CONSOLE_DRAW_MARGIN 4
-#define CONSOLE_DRAW_SCROLL 16
int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mouse_pick, int *pos_pick)
{
@@ -247,9 +246,10 @@
cdc.cwidth = (int)BLF_fixed_width(mono);
assert(cdc.cwidth > 0);
cdc.lheight = tvc->lheight;
- cdc.console_width = (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth;
+ /* note, scroll bar must be already subtracted () */
+ cdc.console_width = (tvc->winx - (CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth;
CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */
- cdc.winx = tvc->winx - (CONSOLE_DRAW_MARGIN + CONSOLE_DRAW_SCROLL);
+ cdc.winx = tvc->winx - CONSOLE_DRAW_MARGIN;
cdc.ymin = tvc->ymin;
cdc.ymax = tvc->ymax;
cdc.xy = xy;
More information about the Bf-blender-cvs
mailing list