Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-03-06 18:56:42 +0300
committerJulian Eisel <julian@blender.org>2020-03-06 19:19:23 +0300
commitb2ee1770d4c31078518f4ec9edd5196a41345162 (patch)
tree6b7f6ff9057322245fc3b3407bece3f1c0cb3eb5 /source/blender/editors/space_info
parentb825a95ec311a169d33fe21e28418f11a516c82f (diff)
Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files.
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r--source/blender/editors/space_info/info_draw.c31
-rw-r--r--source/blender/editors/space_info/info_intern.h6
-rw-r--r--source/blender/editors/space_info/info_report.c10
-rw-r--r--source/blender/editors/space_info/space_info.c85
4 files changed, 68 insertions, 64 deletions
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 6d652610b3b..4d5f59cdb7c 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -203,25 +203,25 @@ static int report_textview_line_get(struct TextViewContext *tvc, const char **li
return 1;
}
-static void info_textview_draw_rect_calc(const ARegion *ar,
+static void info_textview_draw_rect_calc(const ARegion *region,
rcti *r_draw_rect,
rcti *r_draw_rect_outer)
{
const int margin = 0.45f * U.widget_unit;
r_draw_rect->xmin = margin + UI_UNIT_X;
- r_draw_rect->xmax = ar->winx - V2D_SCROLL_WIDTH;
+ r_draw_rect->xmax = region->winx - V2D_SCROLL_WIDTH;
r_draw_rect->ymin = margin;
- r_draw_rect->ymax = ar->winy;
+ r_draw_rect->ymax = region->winy;
/* No margin at the top (allow text to scroll off the window). */
r_draw_rect_outer->xmin = 0;
- r_draw_rect_outer->xmax = ar->winx;
+ r_draw_rect_outer->xmax = region->winx;
r_draw_rect_outer->ymin = 0;
- r_draw_rect_outer->ymax = ar->winy;
+ r_draw_rect_outer->ymax = region->winy;
}
static int info_textview_main__internal(struct SpaceInfo *sinfo,
- const ARegion *ar,
+ const ARegion *region,
ReportList *reports,
const bool do_draw,
const int mval[2],
@@ -230,7 +230,7 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
{
int ret = 0;
- const View2D *v2d = &ar->v2d;
+ const View2D *v2d = &region->v2d;
TextViewContext tvc = {0};
tvc.begin = report_textview_begin;
@@ -252,30 +252,33 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
tvc.scroll_ymin = v2d->cur.ymin;
tvc.scroll_ymax = v2d->cur.ymax;
- info_textview_draw_rect_calc(ar, &tvc.draw_rect, &tvc.draw_rect_outer);
+ info_textview_draw_rect_calc(region, &tvc.draw_rect, &tvc.draw_rect_outer);
ret = textview_draw(&tvc, do_draw, mval, r_mval_pick_item, r_mval_pick_offset);
return ret;
}
-void *info_text_pick(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports, int mval_y)
+void *info_text_pick(struct SpaceInfo *sinfo,
+ const ARegion *region,
+ ReportList *reports,
+ int mval_y)
{
void *mval_pick_item = NULL;
const int mval[2] = {0, mval_y};
- info_textview_main__internal(sinfo, ar, reports, false, mval, &mval_pick_item, NULL);
+ info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, NULL);
return (void *)mval_pick_item;
}
-int info_textview_height(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports)
+int info_textview_height(struct SpaceInfo *sinfo, const ARegion *region, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- return info_textview_main__internal(sinfo, ar, reports, false, mval, NULL, NULL);
+ return info_textview_main__internal(sinfo, region, reports, false, mval, NULL, NULL);
}
-void info_textview_main(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports)
+void info_textview_main(struct SpaceInfo *sinfo, const ARegion *region, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- info_textview_main__internal(sinfo, ar, reports, true, mval, NULL, NULL);
+ info_textview_main__internal(sinfo, region, reports, true, mval, NULL, NULL);
}
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 177b43edf74..443a1659690 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -46,14 +46,14 @@ void INFO_OT_reports_display_update(struct wmOperatorType *ot);
/* info_draw.c */
void *info_text_pick(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
ReportList *reports,
int mouse_y);
int info_textview_height(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct ReportList *reports);
void info_textview_main(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct ReportList *reports);
/* info_report.c */
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 0fa9ddacc20..1b01ac95866 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -172,11 +172,11 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
static int select_report_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
Report *report;
- report = info_text_pick(sinfo, ar, reports, event->mval[1]);
+ report = info_text_pick(sinfo, region, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
@@ -239,7 +239,7 @@ void INFO_OT_select_all(wmOperatorType *ot)
static int box_select_exec(bContext *C, wmOperator *op)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
int report_mask = info_report_mask(sinfo);
Report *report_min, *report_max;
@@ -258,8 +258,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- report_min = info_text_pick(sinfo, ar, reports, rect.ymax);
- report_max = info_text_pick(sinfo, ar, reports, rect.ymin);
+ report_min = info_text_pick(sinfo, region, reports, rect.ymax);
+ report_max = info_text_pick(sinfo, region, reports, rect.ymin);
/* get the first report if none found */
if (report_min == NULL) {
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 8eddf90b06b..789a0d8ea08 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -55,7 +55,7 @@
static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceInfo *sinfo;
sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo");
@@ -64,28 +64,28 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
sinfo->rpt_mask = INFO_RPT_OP;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for info");
+ region = MEM_callocN(sizeof(ARegion), "header for info");
- BLI_addtail(&sinfo->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sinfo->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for info");
+ region = MEM_callocN(sizeof(ARegion), "main region for info");
- BLI_addtail(&sinfo->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sinfo->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
/* keep in sync with console */
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
- ar->v2d.keepofs |= V2D_LOCKOFS_X;
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ region->v2d.keepofs |= V2D_LOCKOFS_X;
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
- // ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
+ // region->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
return (SpaceLink *)sinfo;
}
@@ -111,33 +111,34 @@ static SpaceLink *info_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void info_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void info_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* force it on init, for old files, until it becomes config */
- ar->v2d.scroll = (V2D_SCROLL_RIGHT);
+ region->v2d.scroll = (V2D_SCROLL_RIGHT);
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Info", SPACE_INFO, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void info_textview_update_rect(const bContext *C, ARegion *ar)
+static void info_textview_update_rect(const bContext *C, ARegion *region)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
- UI_view2d_totRect_set(v2d, ar->winx - 1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
+ UI_view2d_totRect_set(
+ v2d, region->winx - 1, info_textview_height(sinfo, region, CTX_wm_reports(C)));
}
-static void info_main_region_draw(const bContext *C, ARegion *ar)
+static void info_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceInfo *sinfo = CTX_wm_space_info(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
/* clear and setup matrix */
@@ -145,16 +146,16 @@ static void info_main_region_draw(const bContext *C, ARegion *ar)
GPU_clear(GPU_COLOR_BIT);
/* quick way to avoid drawing if not bug enough */
- if (ar->winy < 16) {
+ if (region->winy < 16) {
return;
}
- info_textview_update_rect(C, ar);
+ info_textview_update_rect(C, region);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
- info_textview_main(sinfo, ar, CTX_wm_reports(C));
+ info_textview_main(sinfo, region, CTX_wm_reports(C));
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -197,19 +198,19 @@ static void info_keymap(struct wmKeyConfig *keyconf)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void info_header_region_draw(const bContext *C, ARegion *ar)
+static void info_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void info_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -220,7 +221,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win),
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO_REPORT) {
/* redraw also but only for report view, could do less redraws by checking the type */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -228,7 +229,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win),
static void info_header_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -236,27 +237,27 @@ static void info_header_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_WM:
if (wmn->data == ND_JOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_RENDER_RESULT) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -267,12 +268,12 @@ static void info_header_region_message_subscribe(const bContext *UNUSED(C),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};