[Bf-blender-cvs] [c7e64f67ed8] master: Cleanup: rename textview ymin/max

Campbell Barton noreply at git.blender.org
Tue Dec 3 09:59:32 CET 2019


Commit: c7e64f67ed8e0a0f1f7a4f3fa1bab55210140543
Author: Campbell Barton
Date:   Tue Dec 3 19:58:06 2019 +1100
Branches: master
https://developer.blender.org/rBc7e64f67ed8e0a0f1f7a4f3fa1bab55210140543

Cleanup: rename textview ymin/max

This is used for scrolling which wasn't obvious.

===================================================================

M	source/blender/editors/space_console/console_draw.c
M	source/blender/editors/space_info/info_draw.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_info/textview.h

===================================================================

diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 02278934c20..5476bde8af5 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -224,8 +224,8 @@ static int console_textview_main__internal(struct SpaceConsole *sc,
   tvc.sel_start = sc->sel_start;
   tvc.sel_end = sc->sel_end;
   tvc.lheight = sc->lheight * UI_DPI_FAC;
-  tvc.ymin = v2d->cur.ymin;
-  tvc.ymax = v2d->cur.ymax;
+  tvc.scroll_ymin = v2d->cur.ymin;
+  tvc.scroll_ymax = v2d->cur.ymax;
 
   console_textview_draw_rect_calc(ar, &tvc.draw_rect);
 
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index a22983c15a8..f2f8b2da4db 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -266,8 +266,8 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
   tvc.sel_start = 0;
   tvc.sel_end = 0;
   tvc.lheight = 14 * UI_DPI_FAC;  // sc->lheight;
-  tvc.ymin = v2d->cur.ymin;
-  tvc.ymax = v2d->cur.ymax;
+  tvc.scroll_ymin = v2d->cur.ymin;
+  tvc.scroll_ymax = v2d->cur.ymax;
 
   info_textview_draw_rect_calc(ar, &tvc.draw_rect);
 
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 0ebd8bdc065..a112929cf25 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -52,7 +52,7 @@ typedef struct ConsoleDrawContext {
   /** number of characters that fit into the width of the console (fixed width) */
   int console_width;
   const rcti *draw_rect;
-  int ymin, ymax;
+  int scroll_ymin, scroll_ymax;
   int *xy;   // [2]
   int *sel;  // [2]
   /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */
@@ -169,7 +169,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
     MEM_freeN(offsets);
     return 1;
   }
-  else if (y_next < cdc->ymin) {
+  else if (y_next < cdc->scroll_ymin) {
     /* have not reached the drawable area so don't break */
     cdc->xy[1] = y_next;
 
@@ -236,7 +236,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
       cdc->xy[1] += cdc->lheight;
 
       /* check if were out of view bounds */
-      if (cdc->xy[1] > cdc->ymax) {
+      if (cdc->xy[1] > cdc->scroll_ymax) {
         MEM_freeN(offsets);
         return 0;
       }
@@ -275,7 +275,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
 
     cdc->xy[1] += cdc->lheight;
 
-    if (cdc->xy[1] > cdc->ymax) {
+    if (cdc->xy[1] > cdc->scroll_ymax) {
       MEM_freeN(offsets);
       return 0;
     }
@@ -309,7 +309,7 @@ int textview_draw(
           CLAMPIS(mval_init[0], tvc->draw_rect.xmin, tvc->draw_rect.xmax) - tvc->draw_rect.xmin,
       (mval_init[1] == INT_MAX) ?
           INT_MAX :
-          CLAMPIS(mval_init[1], tvc->draw_rect.ymin, tvc->draw_rect.ymax) + tvc->ymin,
+          CLAMPIS(mval_init[1], tvc->draw_rect.ymin, tvc->draw_rect.ymax) + tvc->scroll_ymin,
   };
 
   if (pos_pick) {
@@ -329,8 +329,8 @@ int textview_draw(
     cdc.console_width = 1;
   }
   cdc.draw_rect = &tvc->draw_rect;
-  cdc.ymin = tvc->ymin;
-  cdc.ymax = tvc->ymax;
+  cdc.scroll_ymin = tvc->scroll_ymin;
+  cdc.scroll_ymax = tvc->scroll_ymax;
   cdc.xy = xy;
   cdc.sel = sel;
   cdc.pos_pick = pos_pick;
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
index ca5744dbe90..f7ec61fe65d 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -32,7 +32,8 @@ typedef struct TextViewContext {
   /** Area to draw: (0, 0, winx, winy) with a margin applied and scroll-bar subtracted. */
   rcti draw_rect;
 
-  int ymin, ymax;
+  /** Scroll offset in pixels. */
+  int scroll_ymin, scroll_ymax;
 
   /* callbacks */
   int (*begin)(struct TextViewContext *tvc);



More information about the Bf-blender-cvs mailing list