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:
authorCampbell Barton <ideasman42@gmail.com>2012-05-08 19:43:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-08 19:43:59 +0400
commitfacc97637108efbde58e4da10d333a5bddd5a7c5 (patch)
treeeaccecd2812966a28251d8648fa66b433f79348e
parentf9d07ff3ee312a9ea7d93ef53bfebe327fa058ee (diff)
style cleanup: screen
-rw-r--r--source/blender/editors/screen/area.c836
-rw-r--r--source/blender/editors/screen/glutil.c442
-rw-r--r--source/blender/editors/screen/screen_context.c98
-rw-r--r--source/blender/editors/screen/screen_edit.c954
-rw-r--r--source/blender/editors/screen/screen_intern.h32
-rw-r--r--source/blender/editors/screen/screendump.c143
6 files changed, 1251 insertions, 1254 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2fa1e759e21..0f286d91613 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -104,10 +104,10 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
void ED_region_pixelspace(ARegion *ar)
{
- int width= ar->winrct.xmax-ar->winrct.xmin+1;
- int height= ar->winrct.ymax-ar->winrct.ymin+1;
+ int width = ar->winrct.xmax - ar->winrct.xmin + 1;
+ int height = ar->winrct.ymax - ar->winrct.ymin + 1;
- wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
+ wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
glLoadIdentity();
}
@@ -117,7 +117,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
/* generic notes first */
switch (note->category) {
case NC_WM:
- if (note->data==ND_FILEREAD)
+ if (note->data == ND_FILEREAD)
ED_region_tag_redraw(ar);
break;
case NC_WINDOW:
@@ -145,7 +145,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
if (sa->type && sa->type->refresh) {
sa->type->refresh(C, sa);
}
- sa->do_refresh= 0;
+ sa->do_refresh = 0;
}
/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
@@ -154,15 +154,15 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
{
AZone *az;
- for (az= sa->actionzones.first; az; az= az->next) {
+ for (az = sa->actionzones.first; az; az = az->next) {
int xs, ys;
- xs= (az->x1+az->x2)/2;
- ys= (az->y1+az->y2)/2;
+ xs = (az->x1 + az->x2) / 2;
+ ys = (az->y1 + az->y2) / 2;
/* test if inside */
if (BLI_in_rcti(&ar->winrct, xs, ys)) {
- az->do_draw= 1;
+ az->do_draw = 1;
}
}
}
@@ -181,16 +181,16 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
glColor4ub(255, 255, 255, 180);
fdrawline(x1, y2, x2, y1);
glColor4ub(255, 255, 255, 130);
- fdrawline(x1, y2-dy, x2-dx, y1);
+ fdrawline(x1, y2 - dy, x2 - dx, y1);
glColor4ub(255, 255, 255, 80);
- fdrawline(x1, y2-2*dy, x2-2*dx, y1);
+ fdrawline(x1, y2 - 2 * dy, x2 - 2 * dx, y1);
glColor4ub(0, 0, 0, 210);
- fdrawline(x1, y2+1, x2+1, y1);
+ fdrawline(x1, y2 + 1, x2 + 1, y1);
glColor4ub(0, 0, 0, 180);
- fdrawline(x1, y2-dy+1, x2-dx+1, y1);
+ fdrawline(x1, y2 - dy + 1, x2 - dx + 1, y1);
glColor4ub(0, 0, 0, 150);
- fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
+ fdrawline(x1, y2 - 2 * dy + 1, x2 - 2 * dx + 1, y1);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -199,8 +199,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
static void region_draw_azone_icon(AZone *az)
{
GLUquadricObj *qobj = NULL;
- short midx = az->x1 + (az->x2 - az->x1)/2;
- short midy = az->y1 + (az->y2 - az->y1)/2;
+ short midx = az->x1 + (az->x2 - az->x1) / 2;
+ short midy = az->y1 + (az->y2 - az->y1) / 2;
qobj = gluNewQuadric();
@@ -226,8 +226,8 @@ static void region_draw_azone_icon(AZone *az)
gluDeleteQuadric(qobj);
/* + */
- sdrawline(midx, midy-2, midx, midy+3);
- sdrawline(midx-2, midy, midx+3, midy);
+ sdrawline(midx, midy - 2, midx, midy + 3);
+ sdrawline(midx - 2, midy, midx + 3, midy);
}
static void draw_azone_plus(float x1, float y1, float x2, float y2)
@@ -235,9 +235,9 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2)
float width = 2.0f;
float pad = 4.0f;
- glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad);
- glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f);
- glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f);
+ glRectf((x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad);
+ glRectf(x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f);
+ glRectf((x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f);
}
static void region_draw_azone_tab_plus(AZone *az)
@@ -288,14 +288,14 @@ static void region_draw_azone_tab(AZone *az)
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
- uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+ uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
break;
case AE_BOTTOM_TO_TOPLEFT:
uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
glColor4ub(0, 0, 0, 255);
- uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+ uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
break;
case AE_LEFT_TO_TOPRIGHT:
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
@@ -327,19 +327,19 @@ static void region_draw_azone_tria(AZone *az)
/* add code to draw region hidden as 'too small' */
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
+ ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1 + az->x2) / 2, (float)az->y2);
break;
case AE_BOTTOM_TO_TOPLEFT:
- ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1+az->x2)/2, (float)az->y1);
+ ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1 + az->x2) / 2, (float)az->y1);
break;
case AE_LEFT_TO_TOPRIGHT:
- ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1+az->y2)/2);
+ ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1 + az->y2) / 2);
break;
case AE_RIGHT_TO_TOPLEFT:
- ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1+az->y2)/2);
+ ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1 + az->y2) / 2);
break;
}
@@ -350,8 +350,8 @@ static void region_draw_azone_tria(AZone *az)
/* only exported for WM */
void ED_area_overdraw(bContext *C)
{
- wmWindow *win= CTX_wm_window(C);
- bScreen *screen= CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *screen = CTX_wm_screen(C);
ScrArea *sa;
/* Draw AZones, in screenspace */
@@ -360,23 +360,23 @@ void ED_area_overdraw(bContext *C)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
AZone *az;
- for (az= sa->actionzones.first; az; az= az->next) {
+ for (az = sa->actionzones.first; az; az = az->next) {
if (az->do_draw) {
- if (az->type==AZONE_AREA) {
+ if (az->type == AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
}
- else if (az->type==AZONE_REGION) {
+ else if (az->type == AZONE_REGION) {
if (az->ar) {
/* only display tab or icons when the region is hidden */
- if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if (G.rt==3)
+ if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+ if (G.rt == 3)
region_draw_azone_icon(az);
- else if (G.rt==2)
+ else if (G.rt == 2)
region_draw_azone_tria(az);
- else if (G.rt==1)
+ else if (G.rt == 1)
region_draw_azone_tab(az);
else
region_draw_azone_tab_plus(az);
@@ -384,7 +384,7 @@ void ED_area_overdraw(bContext *C)
}
}
- az->do_draw= 0;
+ az->do_draw = 0;
}
}
}
@@ -395,21 +395,21 @@ void ED_area_overdraw(bContext *C)
/* get scissor rect, checking overlapping regions */
void region_scissor_winrct(ARegion *ar, rcti *winrct)
{
- *winrct= ar->winrct;
+ *winrct = ar->winrct;
if (ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
return;
while (ar->prev) {
- ar= ar->prev;
+ ar = ar->prev;
if (BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
- if (ar->flag & RGN_FLAG_HIDDEN);
- else if (ar->alignment & RGN_SPLIT_PREV);
- else if (ar->alignment==RGN_OVERLAP_LEFT) {
+ if (ar->flag & RGN_FLAG_HIDDEN) ;
+ else if (ar->alignment & RGN_SPLIT_PREV) ;
+ else if (ar->alignment == RGN_OVERLAP_LEFT) {
winrct->xmin = ar->winrct.xmax + 1;
}
- else if (ar->alignment==RGN_OVERLAP_RIGHT) {
+ else if (ar->alignment == RGN_OVERLAP_RIGHT) {
winrct->xmax = ar->winrct.xmin - 1;
}
else break;
@@ -421,19 +421,19 @@ void region_scissor_winrct(ARegion *ar, rcti *winrct)
/* makes region ready for drawing, sets pixelspace */
void ED_region_set(const bContext *C, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
- ScrArea *sa= CTX_wm_area(C);
+ wmWindow *win = CTX_wm_window(C);
+ ScrArea *sa = CTX_wm_area(C);
rcti winrct;
/* checks other overlapping regions */
region_scissor_winrct(ar, &winrct);
- ar->drawrct= winrct;
+ ar->drawrct = winrct;
/* note; this sets state, so we can use wmOrtho and friends */
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
- UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
+ UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
ED_region_pixelspace(ar);
}
@@ -442,9 +442,9 @@ void ED_region_set(const bContext *C, ARegion *ar)
/* only exported for WM */
void ED_region_do_draw(bContext *C, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
- ScrArea *sa= CTX_wm_area(C);
- ARegionType *at= ar->type;
+ wmWindow *win = CTX_wm_window(C);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegionType *at = ar->type;
rcti winrct;
/* see BKE_spacedata_draw_locks() */
@@ -456,7 +456,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* if no partial draw rect set, full rect */
if (ar->drawrct.xmin == ar->drawrct.xmax)
- ar->drawrct= winrct;
+ ar->drawrct = winrct;
else {
/* extra clip for safety */
ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin);
@@ -468,7 +468,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* note; this sets state, so we can use wmOrtho and friends */
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
- UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
+ UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
/* optional header info instead? */
if (ar->headerstr) {
@@ -487,7 +487,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
- ar->do_draw= 0;
+ ar->do_draw = 0;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
uiFreeInactiveBlocks(C, &ar->uiblocks);
@@ -505,7 +505,7 @@ void ED_region_tag_redraw(ARegion *ar)
{
if (ar) {
/* zero region means full region redraw */
- ar->do_draw= RGN_DRAW;
+ ar->do_draw = RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
}
}
@@ -513,7 +513,7 @@ void ED_region_tag_redraw(ARegion *ar)
void ED_region_tag_redraw_overlay(ARegion *ar)
{
if (ar)
- ar->do_draw_overlay= RGN_DRAW;
+ ar->do_draw_overlay = RGN_DRAW;
}
void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
@@ -521,8 +521,8 @@ void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
if (ar) {
if (!ar->do_draw) {
/* no redraw set yet, set partial region */
- ar->do_draw= RGN_DRAW_PARTIAL;
- ar->drawrct= *rct;
+ ar->do_draw = RGN_DRAW_PARTIAL;
+ ar->drawrct = *rct;
}
else if (ar->drawrct.xmin != ar->drawrct.xmax) {
/* partial redraw already set, expand region */
@@ -539,7 +539,7 @@ void ED_area_tag_redraw(ScrArea *sa)
ARegion *ar;
if (sa)
- for (ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
ED_region_tag_redraw(ar);
}
@@ -548,7 +548,7 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
ARegion *ar;
if (sa) {
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == regiontype) {
ED_region_tag_redraw(ar);
}
@@ -559,7 +559,7 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
void ED_area_tag_refresh(ScrArea *sa)
{
if (sa)
- sa->do_refresh= 1;
+ sa->do_refresh = 1;
}
/* *************************************************************** */
@@ -573,16 +573,16 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
if (sa == NULL)
return;
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_HEADER) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_HEADER) {
if (str) {
- if (ar->headerstr==NULL)
- ar->headerstr= MEM_mallocN(256, "headerprint");
+ if (ar->headerstr == NULL)
+ ar->headerstr = MEM_mallocN(256, "headerprint");
BLI_strncpy(ar->headerstr, str, 256);
}
else if (ar->headerstr) {
MEM_freeN(ar->headerstr);
- ar->headerstr= NULL;
+ ar->headerstr = NULL;
}
ED_region_tag_redraw(ar);
}
@@ -600,53 +600,53 @@ static void area_azone_initialize(ScrArea *sa)
BLI_freelistN(&sa->actionzones);
/* set area action zones */
- az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+ az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
- az->type= AZONE_AREA;
- az->x1= sa->totrct.xmin - 1;
- az->y1= sa->totrct.ymin - 1;
- az->x2= sa->totrct.xmin + (AZONESPOT-1);
- az->y2= sa->totrct.ymin + (AZONESPOT-1);
+ az->type = AZONE_AREA;
+ az->x1 = sa->totrct.xmin - 1;
+ az->y1 = sa->totrct.ymin - 1;
+ az->x2 = sa->totrct.xmin + (AZONESPOT - 1);
+ az->y2 = sa->totrct.ymin + (AZONESPOT - 1);
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
- az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+ az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
- az->type= AZONE_AREA;
- az->x1= sa->totrct.xmax + 1;
- az->y1= sa->totrct.ymax + 1;
- az->x2= sa->totrct.xmax - (AZONESPOT-1);
- az->y2= sa->totrct.ymax - (AZONESPOT-1);
+ az->type = AZONE_AREA;
+ az->x1 = sa->totrct.xmax + 1;
+ az->y1 = sa->totrct.ymax + 1;
+ az->x2 = sa->totrct.xmax - (AZONESPOT - 1);
+ az->y2 = sa->totrct.ymax - (AZONESPOT - 1);
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
-#define AZONEPAD_EDGE 4
-#define AZONEPAD_ICON 9
+#define AZONEPAD_EDGE 4
+#define AZONEPAD_ICON 9
static void region_azone_edge(AZone *az, ARegion *ar)
{
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- az->x1= ar->winrct.xmin;
- az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
- az->x2= ar->winrct.xmax;
- az->y2= ar->winrct.ymax;
+ az->x1 = ar->winrct.xmin;
+ az->y1 = ar->winrct.ymax - AZONEPAD_EDGE;
+ az->x2 = ar->winrct.xmax;
+ az->y2 = ar->winrct.ymax;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1= ar->winrct.xmin;
- az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
- az->x2= ar->winrct.xmax;
- az->y2= ar->winrct.ymin;
+ az->x1 = ar->winrct.xmin;
+ az->y1 = ar->winrct.ymin + AZONEPAD_EDGE;
+ az->x2 = ar->winrct.xmax;
+ az->y2 = ar->winrct.ymin;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1= ar->winrct.xmin;
- az->y1= ar->winrct.ymin;
- az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
- az->y2= ar->winrct.ymax;
+ az->x1 = ar->winrct.xmin;
+ az->y1 = ar->winrct.ymin;
+ az->x2 = ar->winrct.xmin + AZONEPAD_EDGE;
+ az->y2 = ar->winrct.ymax;
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1= ar->winrct.xmax;
- az->y1= ar->winrct.ymin;
- az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
- az->y2= ar->winrct.ymax;
+ az->x1 = ar->winrct.xmax;
+ az->y1 = ar->winrct.ymin;
+ az->x2 = ar->winrct.xmax - AZONEPAD_EDGE;
+ az->y2 = ar->winrct.ymax;
break;
}
@@ -656,55 +656,55 @@ static void region_azone_edge(AZone *az, ARegion *ar)
static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
{
AZone *azt;
- int tot=0;
+ int tot = 0;
/* count how many actionzones with along same edge are available.
* This allows for adding more action zones in the future without
* having to worry about correct offset */
- for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ for (azt = sa->actionzones.first; azt; azt = azt->next) {
if (azt->edge == az->edge) tot++;
}
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
- az->y1= ar->winrct.ymax + AZONEPAD_ICON;
- az->x2= ar->winrct.xmax - tot*AZONEPAD_ICON;
- az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
+ az->x1 = ar->winrct.xmax - tot * 2 * AZONEPAD_ICON;
+ az->y1 = ar->winrct.ymax + AZONEPAD_ICON;
+ az->x2 = ar->winrct.xmax - tot * AZONEPAD_ICON;
+ az->y2 = ar->winrct.ymax + 2 * AZONEPAD_ICON;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1= ar->winrct.xmin + AZONEPAD_ICON;
- az->y1= ar->winrct.ymin - 2*AZONEPAD_ICON;
- az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
- az->y2= ar->winrct.ymin - AZONEPAD_ICON;
+ az->x1 = ar->winrct.xmin + AZONEPAD_ICON;
+ az->y1 = ar->winrct.ymin - 2 * AZONEPAD_ICON;
+ az->x2 = ar->winrct.xmin + 2 * AZONEPAD_ICON;
+ az->y2 = ar->winrct.ymin - AZONEPAD_ICON;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
- az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
- az->x2= ar->winrct.xmin - AZONEPAD_ICON;
- az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
+ az->x1 = ar->winrct.xmin - 2 * AZONEPAD_ICON;
+ az->y1 = ar->winrct.ymax - tot * 2 * AZONEPAD_ICON;
+ az->x2 = ar->winrct.xmin - AZONEPAD_ICON;
+ az->y2 = ar->winrct.ymax - tot * AZONEPAD_ICON;
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1= ar->winrct.xmax + AZONEPAD_ICON;
- az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
- az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
- az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
+ az->x1 = ar->winrct.xmax + AZONEPAD_ICON;
+ az->y1 = ar->winrct.ymax - tot * 2 * AZONEPAD_ICON;
+ az->x2 = ar->winrct.xmax + 2 * AZONEPAD_ICON;
+ az->y2 = ar->winrct.ymax - tot * AZONEPAD_ICON;
break;
}
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
/* if more azones on 1 spot, set offset */
- for (azt= sa->actionzones.first; azt; azt= azt->next) {
- if (az!=azt) {
- if ( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
- if (az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
- az->x1+= AZONESPOT;
- az->x2+= AZONESPOT;
+ for (azt = sa->actionzones.first; azt; azt = azt->next) {
+ if (az != azt) {
+ if (ABS(az->x1 - azt->x1) < 2 && ABS(az->y1 - azt->y1) < 2) {
+ if (az->edge == AE_TOP_TO_BOTTOMRIGHT || az->edge == AE_BOTTOM_TO_TOPLEFT) {
+ az->x1 += AZONESPOT;
+ az->x2 += AZONESPOT;
}
else {
- az->y1-= AZONESPOT;
- az->y2-= AZONESPOT;
+ az->y1 -= AZONESPOT;
+ az->y2 -= AZONESPOT;
}
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
@@ -712,44 +712,44 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
}
}
-#define AZONEPAD_TAB_PLUSW 14
-#define AZONEPAD_TAB_PLUSH 14
+#define AZONEPAD_TAB_PLUSW 14
+#define AZONEPAD_TAB_PLUSH 14
/* region already made zero sized, in shape of edge */
static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
{
AZone *azt;
- int tot= 0, add;
+ int tot = 0, add;
- for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ for (azt = sa->actionzones.first; azt; azt = azt->next) {
if (azt->edge == az->edge) tot++;
}
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
- az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
- az->y1= ar->winrct.ymax - add;
- az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
- az->y2= ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
+ if (ar->winrct.ymax == sa->totrct.ymin) add = 1; else add = 0;
+ az->x1 = ar->winrct.xmax - 2.5 * AZONEPAD_TAB_PLUSW;
+ az->y1 = ar->winrct.ymax - add;
+ az->x2 = ar->winrct.xmax - 1.5 * AZONEPAD_TAB_PLUSW;
+ az->y2 = ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
- az->y1= ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
- az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
- az->y2= ar->winrct.ymin;
+ az->x1 = ar->winrct.xmax - 2.5 * AZONEPAD_TAB_PLUSW;
+ az->y1 = ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
+ az->x2 = ar->winrct.xmax - 1.5 * AZONEPAD_TAB_PLUSW;
+ az->y2 = ar->winrct.ymin;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1= ar->winrct.xmin - AZONEPAD_TAB_PLUSH;
- az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
- az->x2= ar->winrct.xmin;
- az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+ az->x1 = ar->winrct.xmin - AZONEPAD_TAB_PLUSH;
+ az->y1 = ar->winrct.ymax - 2.5 * AZONEPAD_TAB_PLUSW;
+ az->x2 = ar->winrct.xmin;
+ az->y2 = ar->winrct.ymax - 1.5 * AZONEPAD_TAB_PLUSW;
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1= ar->winrct.xmax - 1;
- az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
- az->x2= ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
- az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+ az->x1 = ar->winrct.xmax - 1;
+ az->y1 = ar->winrct.ymax - 2.5 * AZONEPAD_TAB_PLUSW;
+ az->x2 = ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
+ az->y2 = ar->winrct.ymax - 1.5 * AZONEPAD_TAB_PLUSW;
break;
}
/* rect needed for mouse pointer test */
@@ -757,89 +757,89 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
}
-#define AZONEPAD_TABW 18
-#define AZONEPAD_TABH 7
+#define AZONEPAD_TABW 18
+#define AZONEPAD_TABH 7
/* region already made zero sized, in shape of edge */
static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
{
AZone *azt;
- int tot= 0, add;
+ int tot = 0, add;
- for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ for (azt = sa->actionzones.first; azt; azt = azt->next) {
if (azt->edge == az->edge) tot++;
}
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
- az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
- az->y1= ar->winrct.ymax - add;
- az->x2= ar->winrct.xmax - AZONEPAD_TABW;
- az->y2= ar->winrct.ymax - add + AZONEPAD_TABH;
+ if (ar->winrct.ymax == sa->totrct.ymin) add = 1; else add = 0;
+ az->x1 = ar->winrct.xmax - 2 * AZONEPAD_TABW;
+ az->y1 = ar->winrct.ymax - add;
+ az->x2 = ar->winrct.xmax - AZONEPAD_TABW;
+ az->y2 = ar->winrct.ymax - add + AZONEPAD_TABH;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1= ar->winrct.xmin + AZONEPAD_TABW;
- az->y1= ar->winrct.ymin - AZONEPAD_TABH;
- az->x2= ar->winrct.xmin + 2*AZONEPAD_TABW;
- az->y2= ar->winrct.ymin;
+ az->x1 = ar->winrct.xmin + AZONEPAD_TABW;
+ az->y1 = ar->winrct.ymin - AZONEPAD_TABH;
+ az->x2 = ar->winrct.xmin + 2 * AZONEPAD_TABW;
+ az->y2 = ar->winrct.ymin;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1= ar->winrct.xmin + 1 - AZONEPAD_TABH;
- az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
- az->x2= ar->winrct.xmin + 1;
- az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+ az->x1 = ar->winrct.xmin + 1 - AZONEPAD_TABH;
+ az->y1 = ar->winrct.ymax - 2 * AZONEPAD_TABW;
+ az->x2 = ar->winrct.xmin + 1;
+ az->y2 = ar->winrct.ymax - AZONEPAD_TABW;
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1= ar->winrct.xmax - 1;
- az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
- az->x2= ar->winrct.xmax - 1 + AZONEPAD_TABH;
- az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+ az->x1 = ar->winrct.xmax - 1;
+ az->y1 = ar->winrct.ymax - 2 * AZONEPAD_TABW;
+ az->x2 = ar->winrct.xmax - 1 + AZONEPAD_TABH;
+ az->y2 = ar->winrct.ymax - AZONEPAD_TABW;
break;
}
/* rect needed for mouse pointer test */
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
-#define AZONEPAD_TRIAW 16
-#define AZONEPAD_TRIAH 9
+#define AZONEPAD_TRIAW 16
+#define AZONEPAD_TRIAH 9
/* region already made zero sized, in shape of edge */
static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
{
AZone *azt;
- int tot= 0, add;
+ int tot = 0, add;
- for (azt= sa->actionzones.first; azt; azt= azt->next) {
+ for (azt = sa->actionzones.first; azt; azt = azt->next) {
if (azt->edge == az->edge) tot++;
}
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
- az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
- az->y1= ar->winrct.ymax - add;
- az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
- az->y2= ar->winrct.ymax - add + AZONEPAD_TRIAH;
+ if (ar->winrct.ymax == sa->totrct.ymin) add = 1; else add = 0;
+ az->x1 = ar->winrct.xmax - 2 * AZONEPAD_TRIAW;
+ az->y1 = ar->winrct.ymax - add;
+ az->x2 = ar->winrct.xmax - AZONEPAD_TRIAW;
+ az->y2 = ar->winrct.ymax - add + AZONEPAD_TRIAH;
break;
- case AE_BOTTOM_TO_TOPLEFT:
- az->x1= ar->winrct.xmin + AZONEPAD_TRIAW;
- az->y1= ar->winrct.ymin - AZONEPAD_TRIAH;
- az->x2= ar->winrct.xmin + 2*AZONEPAD_TRIAW;
- az->y2= ar->winrct.ymin;
+ case AE_BOTTOM_TO_TOPLEFT:
+ az->x1 = ar->winrct.xmin + AZONEPAD_TRIAW;
+ az->y1 = ar->winrct.ymin - AZONEPAD_TRIAH;
+ az->x2 = ar->winrct.xmin + 2 * AZONEPAD_TRIAW;
+ az->y2 = ar->winrct.ymin;
break;
- case AE_LEFT_TO_TOPRIGHT:
- az->x1= ar->winrct.xmin + 1 - AZONEPAD_TRIAH;
- az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
- az->x2= ar->winrct.xmin + 1;
- az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+ case AE_LEFT_TO_TOPRIGHT:
+ az->x1 = ar->winrct.xmin + 1 - AZONEPAD_TRIAH;
+ az->y1 = ar->winrct.ymax - 2 * AZONEPAD_TRIAW;
+ az->x2 = ar->winrct.xmin + 1;
+ az->y2 = ar->winrct.ymax - AZONEPAD_TRIAW;
break;
- case AE_RIGHT_TO_TOPLEFT:
- az->x1= ar->winrct.xmax - 1;
- az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
- az->x2= ar->winrct.xmax - 1 + AZONEPAD_TRIAH;
- az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+ case AE_RIGHT_TO_TOPLEFT:
+ az->x1 = ar->winrct.xmax - 1;
+ az->y1 = ar->winrct.ymax - 2 * AZONEPAD_TRIAW;
+ az->x2 = ar->winrct.xmax - 1 + AZONEPAD_TRIAH;
+ az->y2 = ar->winrct.ymax - AZONEPAD_TRIAW;
break;
}
/* rect needed for mouse pointer test */
@@ -851,18 +851,18 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
{
AZone *az;
- az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+ az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
- az->type= AZONE_REGION;
- az->ar= ar;
- az->edge= edge;
+ az->type = AZONE_REGION;
+ az->ar = ar;
+ az->edge = edge;
- if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if (G.rt==3)
+ if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+ if (G.rt == 3)
region_azone_icon(sa, az, ar);
- else if (G.rt==2)
+ else if (G.rt == 2)
region_azone_tria(sa, az, ar);
- else if (G.rt==1)
+ else if (G.rt == 1)
region_azone_tab(sa, az, ar);
else
region_azone_tab_plus(sa, az, ar);
@@ -878,11 +878,11 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
{
- /* edge code (t b l r) is along which area edge azone will be drawn */
+ /* edge code (t b l r) is along which area edge azone will be drawn */
- if (alignment==RGN_ALIGN_TOP)
+ if (alignment == RGN_ALIGN_TOP)
region_azone_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT);
- else if (alignment==RGN_ALIGN_BOTTOM)
+ else if (alignment == RGN_ALIGN_BOTTOM)
region_azone_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT);
else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
region_azone_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT);
@@ -893,21 +893,21 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
/* dir is direction to check, not the splitting edge direction! */
static int rct_fits(rcti *rect, char dir, int size)
{
- if (dir=='h') {
- return rect->xmax-rect->xmin - size;
+ if (dir == 'h') {
+ return rect->xmax - rect->xmin - size;
}
else { // 'v'
- return rect->ymax-rect->ymin - size;
+ return rect->ymax - rect->ymin - size;
}
}
static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int quad)
{
- rcti *remainder_prev= remainder;
+ rcti *remainder_prev = remainder;
int prefsizex, prefsizey;
int alignment;
- if (ar==NULL)
+ if (ar == NULL)
return;
/* no returns in function, winrct gets set in the end again */
@@ -916,53 +916,53 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
/* for test; allow split of previously defined region */
if (ar->alignment & RGN_SPLIT_PREV)
if (ar->prev)
- remainder= &ar->prev->winrct;
+ remainder = &ar->prev->winrct;
alignment = ar->alignment & ~RGN_SPLIT_PREV;
/* clear state flags first */
ar->flag &= ~RGN_FLAG_TOO_SMALL;
/* user errors */
- if (ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
- alignment= RGN_ALIGN_NONE;
+ if (ar->next == NULL && alignment != RGN_ALIGN_QSPLIT)
+ alignment = RGN_ALIGN_NONE;
/* prefsize, for header we stick to exception */
- prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex;
- if (ar->regiontype==RGN_TYPE_HEADER)
- prefsizey= ar->type->prefsizey;
- else if (ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
- prefsizey= UI_UNIT_Y * 2 + (UI_UNIT_Y/2);
+ prefsizex = ar->sizex ? ar->sizex : ar->type->prefsizex;
+ if (ar->regiontype == RGN_TYPE_HEADER)
+ prefsizey = ar->type->prefsizey;
+ else if (ar->regiontype == RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
+ prefsizey = UI_UNIT_Y * 2 + (UI_UNIT_Y / 2);
}
else
- prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
+ prefsizey = ar->sizey ? ar->sizey : ar->type->prefsizey;
/* hidden is user flag */
- if (ar->flag & RGN_FLAG_HIDDEN);
+ if (ar->flag & RGN_FLAG_HIDDEN) ;
/* XXX floating area region, not handled yet here */
- else if (alignment == RGN_ALIGN_FLOAT);
+ else if (alignment == RGN_ALIGN_FLOAT) ;
/* remainder is too small for any usage */
- else if ( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
+ else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
- else if (alignment==RGN_ALIGN_NONE) {
+ else if (alignment == RGN_ALIGN_NONE) {
/* typically last region */
- ar->winrct= *remainder;
+ ar->winrct = *remainder;
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
- else if (alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
+ else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
- if ( rct_fits(remainder, 'v', prefsizey) < 0 ) {
+ if (rct_fits(remainder, 'v', prefsizey) < 0) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
else {
- int fac= rct_fits(remainder, 'v', prefsizey);
+ int fac = rct_fits(remainder, 'v', prefsizey);
- if (fac < 0 )
+ if (fac < 0)
prefsizey += fac;
- ar->winrct= *remainder;
+ ar->winrct = *remainder;
- if (alignment==RGN_ALIGN_TOP) {
+ if (alignment == RGN_ALIGN_TOP) {
ar->winrct.ymin = ar->winrct.ymax - prefsizey + 1;
remainder->ymax = ar->winrct.ymin - 1;
}
@@ -972,92 +972,92 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
}
}
- else if ( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
+ else if (ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
- if ( rct_fits(remainder, 'h', prefsizex) < 0 ) {
+ if (rct_fits(remainder, 'h', prefsizex) < 0) {
ar->flag |= RGN_FLAG_TOO_SMALL;
}
else {
- int fac= rct_fits(remainder, 'h', prefsizex);
+ int fac = rct_fits(remainder, 'h', prefsizex);
- if (fac < 0 )
+ if (fac < 0)
prefsizex += fac;
- ar->winrct= *remainder;
+ ar->winrct = *remainder;
if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
ar->winrct.xmin = ar->winrct.xmax - prefsizex + 1;
- if (alignment==RGN_ALIGN_RIGHT)
+ if (alignment == RGN_ALIGN_RIGHT)
remainder->xmax = ar->winrct.xmin - 1;
}
else {
ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
- if (alignment==RGN_ALIGN_LEFT)
+ if (alignment == RGN_ALIGN_LEFT)
remainder->xmin = ar->winrct.xmax + 1;
}
}
}
- else if (alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
+ else if (alignment == RGN_ALIGN_VSPLIT || alignment == RGN_ALIGN_HSPLIT) {
/* percentage subdiv*/
- ar->winrct= *remainder;
+ ar->winrct = *remainder;
- if (alignment==RGN_ALIGN_HSPLIT) {
- if ( rct_fits(remainder, 'h', prefsizex) > 4) {
- ar->winrct.xmax = (remainder->xmin+remainder->xmax)/2;
- remainder->xmin = ar->winrct.xmax+1;
+ if (alignment == RGN_ALIGN_HSPLIT) {
+ if (rct_fits(remainder, 'h', prefsizex) > 4) {
+ ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
+ remainder->xmin = ar->winrct.xmax + 1;
}
else {
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
}
else {
- if ( rct_fits(remainder, 'v', prefsizey) > 4) {
- ar->winrct.ymax = (remainder->ymin+remainder->ymax)/2;
- remainder->ymin = ar->winrct.ymax+1;
+ if (rct_fits(remainder, 'v', prefsizey) > 4) {
+ ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
+ remainder->ymin = ar->winrct.ymax + 1;
}
else {
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
}
}
- else if (alignment==RGN_ALIGN_QSPLIT) {
- ar->winrct= *remainder;
+ else if (alignment == RGN_ALIGN_QSPLIT) {
+ ar->winrct = *remainder;
/* test if there's still 4 regions left */
- if (quad==0) {
- ARegion *artest= ar->next;
- int count= 1;
+ if (quad == 0) {
+ ARegion *artest = ar->next;
+ int count = 1;
while (artest) {
- artest->alignment= RGN_ALIGN_QSPLIT;
- artest= artest->next;
+ artest->alignment = RGN_ALIGN_QSPLIT;
+ artest = artest->next;
count++;
}
- if (count!=4) {
+ if (count != 4) {
/* let's stop adding regions */
BLI_init_rcti(remainder, 0, 0, 0, 0);
if (G.debug & G_DEBUG)
printf("region quadsplit failed\n");
}
- else quad= 1;
+ else quad = 1;
}
if (quad) {
- if (quad==1) { /* left bottom */
- ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
- ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
+ if (quad == 1) { /* left bottom */
+ ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
+ ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
}
- else if (quad==2) { /* left top */
- ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
- ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
+ else if (quad == 2) { /* left top */
+ ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
+ ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
}
- else if (quad==3) { /* right bottom */
- ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
- ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
+ else if (quad == 3) { /* right bottom */
+ ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
+ ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
}
- else { /* right top */
- ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
- ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
+ else { /* right top */
+ ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
+ ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
BLI_init_rcti(remainder, 0, 0, 0, 0);
}
@@ -1066,16 +1066,16 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
/* for speedup */
- ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
- ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
+ ar->winx = ar->winrct.xmax - ar->winrct.xmin + 1;
+ ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1;
/* set winrect for azones */
- if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- ar->winrct= *remainder;
+ if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+ ar->winrct = *remainder;
- if (alignment==RGN_ALIGN_TOP)
+ if (alignment == RGN_ALIGN_TOP)
ar->winrct.ymin = ar->winrct.ymax;
- else if (alignment==RGN_ALIGN_BOTTOM)
+ else if (alignment == RGN_ALIGN_BOTTOM)
ar->winrct.ymax = ar->winrct.ymin;
else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
ar->winrct.xmin = ar->winrct.xmax;
@@ -1088,9 +1088,9 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
/* restore prev-split exception */
if (ar->alignment & RGN_SPLIT_PREV) {
if (ar->prev) {
- remainder= remainder_prev;
- ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
- ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+ remainder = remainder_prev;
+ ar->prev->winx = ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
+ ar->prev->winy = ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
}
}
@@ -1113,34 +1113,34 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
{
- short rt= 0; // CLAMPIS(G.rt, 0, 16);
+ short rt = 0; // CLAMPIS(G.rt, 0, 16);
- if (sa->v1->vec.x>0) sa->totrct.xmin = sa->v1->vec.x+1+rt;
+ if (sa->v1->vec.x > 0) sa->totrct.xmin = sa->v1->vec.x + 1 + rt;
else sa->totrct.xmin = sa->v1->vec.x;
- if (sa->v4->vec.x<sizex-1) sa->totrct.xmax = sa->v4->vec.x-1-rt;
+ if (sa->v4->vec.x < sizex - 1) sa->totrct.xmax = sa->v4->vec.x - 1 - rt;
else sa->totrct.xmax = sa->v4->vec.x;
- if (sa->v1->vec.y>0) sa->totrct.ymin = sa->v1->vec.y+1+rt;
+ if (sa->v1->vec.y > 0) sa->totrct.ymin = sa->v1->vec.y + 1 + rt;
else sa->totrct.ymin = sa->v1->vec.y;
- if (sa->v2->vec.y<sizey-1) sa->totrct.ymax = sa->v2->vec.y-1-rt;
+ if (sa->v2->vec.y < sizey - 1) sa->totrct.ymax = sa->v2->vec.y - 1 - rt;
else sa->totrct.ymax = sa->v2->vec.y;
/* for speedup */
- sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
- sa->winy= sa->totrct.ymax-sa->totrct.ymin+1;
+ sa->winx = sa->totrct.xmax - sa->totrct.xmin + 1;
+ sa->winy = sa->totrct.ymax - sa->totrct.ymin + 1;
}
/* used for area initialize below */
static void region_subwindow(wmWindow *win, ARegion *ar)
{
- if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+ if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
if (ar->swinid)
wm_subwindow_close(win, ar->swinid);
- ar->swinid= 0;
+ ar->swinid = 0;
}
- else if (ar->swinid==0)
- ar->swinid= wm_subwindow_open(win, &ar->winrct);
+ else if (ar->swinid == 0)
+ ar->swinid = wm_subwindow_open(win, &ar->winrct);
else
wm_subwindow_position(win, ar->swinid, &ar->winrct);
}
@@ -1164,10 +1164,10 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
/* time space only has this keymap, the others get a boundbox restricted map */
- if (sa->spacetype!=SPACE_TIME) {
+ if (sa->spacetype != SPACE_TIME) {
ARegion *ar;
- static rcti rect= {0, 10000, 0, 30}; /* same local check for all areas */
- ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ static rcti rect = {0, 10000, 0, 30}; /* same local check for all areas */
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (ar) {
WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
}
@@ -1205,15 +1205,15 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
rcti rect;
/* set typedefinitions */
- sa->type= BKE_spacetype_from_id(sa->spacetype);
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
- if (sa->type==NULL) {
- sa->butspacetype= sa->spacetype= SPACE_VIEW3D;
- sa->type= BKE_spacetype_from_id(sa->spacetype);
+ if (sa->type == NULL) {
+ sa->butspacetype = sa->spacetype = SPACE_VIEW3D;
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
}
- for (ar= sa->regionbase.first; ar; ar= ar->next)
- ar->type= BKE_regiontype_from_id(sa->type, ar->regiontype);
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ ar->type = BKE_regiontype_from_id(sa->type, ar->regiontype);
/* area sizes */
area_calc_totrct(sa, win->sizex, win->sizey);
@@ -1222,7 +1222,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
area_azone_initialize(sa);
/* region rect sizes */
- rect= sa->totrct;
+ rect = sa->totrct;
region_rect_recursive(sa, sa->regionbase.first, &rect, 0);
/* default area handlers */
@@ -1232,7 +1232,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
sa->type->init(wm, sa);
/* region windows, default and own handlers */
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
region_subwindow(win, ar);
if (ar->swinid) {
@@ -1248,7 +1248,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
/* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */
- if (ar->regiontype==RGN_TYPE_HEADER)
+ if (ar->regiontype == RGN_TYPE_HEADER)
ar->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
@@ -1261,17 +1261,17 @@ void ED_region_init(bContext *C, ARegion *ar)
/* refresh can be called before window opened */
region_subwindow(CTX_wm_window(C), ar);
- ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
- ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
+ ar->winx = ar->winrct.xmax - ar->winrct.xmin + 1;
+ ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1;
/* UI convention */
- wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+ wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f);
glLoadIdentity();
}
void ED_region_toggle_hidden(bContext *C, ARegion *ar)
{
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
ar->flag ^= RGN_FLAG_HIDDEN;
@@ -1288,11 +1288,11 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
{
SpaceType *st;
ARegion *ar;
- int spacetype= sa1->spacetype;
+ int spacetype = sa1->spacetype;
- sa1->headertype= sa2->headertype;
- sa1->spacetype= sa2->spacetype;
- sa1->butspacetype= sa2->butspacetype;
+ sa1->headertype = sa2->headertype;
+ sa1->spacetype = sa2->spacetype;
+ sa1->butspacetype = sa2->butspacetype;
if (swap_space == 1) {
SWAP(ListBase, sa1->spacedata, sa2->spacedata);
@@ -1315,16 +1315,16 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
SWAP(ListBase, sa1->regionbase, sa2->regionbase);
}
else {
- if (swap_space<2) {
- st= BKE_spacetype_from_id(spacetype);
- for (ar= sa1->regionbase.first; ar; ar= ar->next)
+ if (swap_space < 2) {
+ st = BKE_spacetype_from_id(spacetype);
+ for (ar = sa1->regionbase.first; ar; ar = ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sa1->regionbase);
}
- st= BKE_spacetype_from_id(sa2->spacetype);
- for (ar= sa2->regionbase.first; ar; ar= ar->next) {
- ARegion *newar= BKE_area_region_copy(st, ar);
+ st = BKE_spacetype_from_id(sa2->spacetype);
+ for (ar = sa2->regionbase.first; ar; ar = ar->next) {
+ ARegion *newar = BKE_area_region_copy(st, ar);
BLI_addtail(&sa1->regionbase, newar);
}
}
@@ -1334,7 +1334,7 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
{
- ScrArea *tmp= MEM_callocN(sizeof(ScrArea), "addscrarea");
+ ScrArea *tmp = MEM_callocN(sizeof(ScrArea), "addscrarea");
ED_area_exit(C, sa1);
ED_area_exit(C, sa2);
@@ -1366,34 +1366,34 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
ED_area_exit(C, sa);
- st= BKE_spacetype_from_id(type);
- slold= sa->spacedata.first;
+ st = BKE_spacetype_from_id(type);
+ slold = sa->spacedata.first;
- sa->spacetype= type;
- sa->butspacetype= type;
- sa->type= st;
+ sa->spacetype = type;
+ sa->butspacetype = type;
+ sa->type = st;
/* check previously stored space */
- for (sl= sa->spacedata.first; sl; sl= sl->next)
- if (sl->spacetype==type)
+ for (sl = sa->spacedata.first; sl; sl = sl->next)
+ if (sl->spacetype == type)
break;
/* old spacedata... happened during work on 2.50, remove */
- if (sl && sl->regionbase.first==NULL) {
+ if (sl && sl->regionbase.first == NULL) {
st->free(sl);
BLI_freelinkN(&sa->spacedata, sl);
if (slold == sl) {
- slold= NULL;
+ slold = NULL;
}
- sl= NULL;
+ sl = NULL;
}
if (sl) {
/* swap regions */
- slold->regionbase= sa->regionbase;
- sa->regionbase= sl->regionbase;
- sl->regionbase.first= sl->regionbase.last= NULL;
+ slold->regionbase = sa->regionbase;
+ sa->regionbase = sl->regionbase;
+ sl->regionbase.first = sl->regionbase.last = NULL;
/* put in front of list */
BLI_remlink(&sa->spacedata, sl);
@@ -1402,14 +1402,14 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
else {
/* new space */
if (st) {
- sl= st->new(C);
+ sl = st->new(C);
BLI_addhead(&sa->spacedata, sl);
/* swap regions */
if (slold)
- slold->regionbase= sa->regionbase;
- sa->regionbase= sl->regionbase;
- sl->regionbase.first= sl->regionbase.last= NULL;
+ slold->regionbase = sa->regionbase;
+ sa->regionbase = sl->regionbase;
+ sl->regionbase.first = sl->regionbase.last = NULL;
}
}
@@ -1419,7 +1419,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
WM_event_add_mousemove(C);
/*send space change notifier*/
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa);
ED_area_tag_refresh(sa);
}
@@ -1446,47 +1446,47 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
ED_area_tag_redraw(sa);
/*send space change notifier*/
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa);
}
static const char *editortype_pup(void)
{
- const char *types= N_(
- "Editor type:%t"
- "|3D View %x1"
+ const char *types = N_(
+ "Editor type:%t"
+ "|3D View %x1"
- "|%l"
+ "|%l"
- "|Timeline %x15"
- "|Graph Editor %x2"
- "|DopeSheet %x12"
- "|NLA Editor %x13"
+ "|Timeline %x15"
+ "|Graph Editor %x2"
+ "|DopeSheet %x12"
+ "|NLA Editor %x13"
- "|%l"
+ "|%l"
- "|UV/Image Editor %x6"
+ "|UV/Image Editor %x6"
- "|Video Sequence Editor %x8"
- "|Movie Clip Editor %x20"
- "|Text Editor %x9"
- "|Node Editor %x16"
- "|Logic Editor %x17"
+ "|Video Sequence Editor %x8"
+ "|Movie Clip Editor %x20"
+ "|Text Editor %x9"
+ "|Node Editor %x16"
+ "|Logic Editor %x17"
- "|%l"
+ "|%l"
- "|Properties %x4"
- "|Outliner %x3"
- "|User Preferences %x19"
- "|Info%x7"
+ "|Properties %x4"
+ "|Outliner %x3"
+ "|User Preferences %x19"
+ "|Info%x7"
- "|%l"
+ "|%l"
- "|File Browser %x5"
+ "|File Browser %x5"
- "|%l"
+ "|%l"
- "|Python Console %x18"
- );
+ "|Python Console %x18"
+ );
return IFACE_(types);
}
@@ -1497,20 +1497,20 @@ static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)
ED_area_tag_redraw(CTX_wm_area(C));
/*send space change notifier*/
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, CTX_wm_area(C));
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, CTX_wm_area(C));
}
/* returns offset for next button in header */
int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
{
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
uiBut *but;
- int xco= 8;
+ int xco = 8;
but = uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
- editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y,
- &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- TIP_("Displays current editor type. Click for menu of available types"));
+ editortype_pup(), xco, yco, UI_UNIT_X + 10, UI_UNIT_Y,
+ &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
+ TIP_("Displays current editor type. Click for menu of available types"));
uiButSetFunc(but, spacefunc, NULL, NULL);
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
@@ -1519,12 +1519,12 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
{
- ScrArea *sa= CTX_wm_area(C);
- int xco= 8;
+ ScrArea *sa = CTX_wm_area(C);
+ int xco = 8;
uiBut *but;
if (!sa->full)
- xco= ED_area_header_switchbutton(C, block, yco);
+ xco = ED_area_header_switchbutton(C, block, yco);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1554,25 +1554,25 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr)
{
- ScrArea *sa= CTX_wm_area(C);
- uiStyle *style= UI_GetStyle();
+ ScrArea *sa = CTX_wm_area(C);
+ uiStyle *style = UI_GetStyle();
uiBlock *block;
PanelType *pt;
Panel *panel;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
- int x, y, xco, yco, w, em, triangle, open, newcontext= 0;
+ int x, y, xco, yco, w, em, triangle, open, newcontext = 0;
if (contextnr >= 0)
- newcontext= UI_view2d_tab_set(v2d, contextnr);
+ newcontext = UI_view2d_tab_set(v2d, contextnr);
if (vertical) {
- w= v2d->cur.xmax - v2d->cur.xmin;
- em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
+ w = v2d->cur.xmax - v2d->cur.xmin;
+ em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y;
}
else {
- w= UI_PANEL_WIDTH;
- em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
+ w = UI_PANEL_WIDTH;
+ em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y;
}
/* create panels */
@@ -1581,7 +1581,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(v2d);
- for (pt= ar->type->paneltypes.first; pt; pt= pt->next) {
+ for (pt = ar->type->paneltypes.first; pt; pt = pt->next) {
/* verify context */
if (context)
if (pt->context[0] && strcmp(context, pt->context) != 0)
@@ -1589,25 +1589,25 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* draw panel */
if (pt->draw && (!pt->poll || pt->poll(C, pt))) {
- block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
- panel= uiBeginPanel(sa, ar, block, pt, &open);
+ block = uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
+ panel = uiBeginPanel(sa, ar, block, pt, &open);
/* bad fixed values */
- triangle= (int)(UI_UNIT_Y * 1.1f);
+ triangle = (int)(UI_UNIT_Y * 1.1f);
if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
/* for enabled buttons */
- panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
- triangle, UI_UNIT_Y+style->panelspace+2, UI_UNIT_Y, 1, style);
+ panel->layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
+ triangle, UI_UNIT_Y + style->panelspace + 2, UI_UNIT_Y, 1, style);
pt->draw_header(C, panel);
uiBlockLayoutResolve(block, &xco, &yco);
- panel->labelofs= xco - triangle;
- panel->layout= NULL;
+ panel->labelofs = xco - triangle;
+ panel->layout = NULL;
}
else {
- panel->labelofs= 0;
+ panel->labelofs = 0;
}
if (open) {
@@ -1615,23 +1615,23 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* panel context can either be toolbar region or normal panels region */
if (ar->regiontype == RGN_TYPE_TOOLS)
- panelContext= UI_LAYOUT_TOOLBAR;
+ panelContext = UI_LAYOUT_TOOLBAR;
else
- panelContext= UI_LAYOUT_PANEL;
+ panelContext = UI_LAYOUT_PANEL;
- panel->layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, panelContext,
- style->panelspace, 0, w-2*style->panelspace, em, style);
+ panel->layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, panelContext,
+ style->panelspace, 0, w - 2 * style->panelspace, em, style);
pt->draw(C, panel);
uiBlockLayoutResolve(block, &xco, &yco);
- panel->layout= NULL;
+ panel->layout = NULL;
- yco -= 2*style->panelspace;
+ yco -= 2 * style->panelspace;
uiEndPanel(block, w, -yco);
}
else {
- yco= 0;
+ yco = 0;
uiEndPanel(block, w, 0);
}
@@ -1643,28 +1643,28 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
uiEndPanels(C, ar, &x, &y);
/* clear */
- UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW)?TH_PREVIEW_BACK:TH_BACK);
+ UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
/* before setting the view */
if (vertical) {
/* only allow scrolling in vertical direction */
- v2d->keepofs |= V2D_LOCKOFS_X|V2D_KEEPOFS_Y;
- v2d->keepofs &= ~(V2D_LOCKOFS_Y|V2D_KEEPOFS_X);
+ v2d->keepofs |= V2D_LOCKOFS_X | V2D_KEEPOFS_Y;
+ v2d->keepofs &= ~(V2D_LOCKOFS_Y | V2D_KEEPOFS_X);
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
// don't jump back when panels close or hide
if (!newcontext)
- y= MAX2(-y, -v2d->cur.ymin);
+ y = MAX2(-y, -v2d->cur.ymin);
else
- y= -y;
+ y = -y;
}
else {
/* for now, allow scrolling in both directions (since layouts are optimized for vertical,
* they often don't fit in horizontal layout)
*/
- v2d->keepofs &= ~(V2D_LOCKOFS_X|V2D_LOCKOFS_Y|V2D_KEEPOFS_X|V2D_KEEPOFS_Y);
+ v2d->keepofs &= ~(V2D_LOCKOFS_X | V2D_LOCKOFS_Y | V2D_KEEPOFS_X | V2D_KEEPOFS_Y);
//v2d->keepofs |= V2D_LOCKOFS_Y|V2D_KEEPOFS_X;
//v2d->keepofs &= ~(V2D_LOCKOFS_X|V2D_KEEPOFS_Y);
v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
@@ -1672,12 +1672,12 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
// don't jump back when panels close or hide
if (!newcontext)
- x= MAX2(x, v2d->cur.xmax);
- y= -y;
+ x = MAX2(x, v2d->cur.xmax);
+ y = -y;
}
// +V2D_SCROLL_HEIGHT is workaround to set the actual height
- UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT);
+ UI_view2d_totRect_set(v2d, x + V2D_SCROLL_WIDTH, y + V2D_SCROLL_HEIGHT);
/* set the view */
UI_view2d_view_ortho(v2d);
@@ -1689,7 +1689,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
UI_view2d_view_restore(C);
/* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
@@ -1699,13 +1699,13 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
// XXX quick hacks for files saved with 2.5 already (i.e. the builtin defaults file)
- // scrollbars for button regions
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ // scrollbars for button regions
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
ar->v2d.keepzoom |= V2D_KEEPZOOM;
- // correctly initialized User-Prefs?
+ // correctly initialized User-Prefs?
if (!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
ar->v2d.flag &= ~V2D_IS_INITIALISED;
@@ -1717,52 +1717,52 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
void ED_region_header(const bContext *C, ARegion *ar)
{
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiBlock *block;
uiLayout *layout;
HeaderType *ht;
Header header = {NULL};
int maxco, xco, yco;
- int headery= ED_area_headersize();
+ int headery = ED_area_headersize();
/* clear */
- UI_ThemeClearColor((ED_screen_area_active(C))?TH_HEADER:TH_HEADERDESEL);
+ UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(&ar->v2d);
- xco= maxco= 8;
- yco= headery-4;
+ xco = maxco = 8;
+ yco = headery - 4;
/* draw all headers types */
- for (ht= ar->type->headertypes.first; ht; ht= ht->next) {
- block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
- layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
+ for (ht = ar->type->headertypes.first; ht; ht = ht->next) {
+ block = uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
+ layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
if (ht->draw) {
- header.type= ht;
- header.layout= layout;
+ header.type = ht;
+ header.layout = layout;
ht->draw(C, &header);
/* for view2d */
- xco= uiLayoutGetWidth(layout);
+ xco = uiLayoutGetWidth(layout);
if (xco > maxco)
- maxco= xco;
+ maxco = xco;
}
uiBlockLayoutResolve(block, &xco, &yco);
/* for view2d */
if (xco > maxco)
- maxco= xco;
+ maxco = xco;
uiEndBlock(C, block);
uiDrawBlock(C, block);
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, ar->v2d.tot.ymax - ar->v2d.tot.ymin);
/* restore view matrix? */
UI_view2d_view_restore(C);
@@ -1776,20 +1776,20 @@ void ED_region_header_init(ARegion *ar)
/* UI_UNIT_Y is defined as U variable now, depending dpi */
int ED_area_headersize(void)
{
- return UI_UNIT_Y+6;
+ return UI_UNIT_Y + 6;
}
void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
{
const int header_height = 18;
- uiStyle *style= UI_GetStyle();
- int fontid= style->widget.uifont_id;
+ uiStyle *style = UI_GetStyle();
+ int fontid = style->widget.uifont_id;
rcti rect;
BLF_size(fontid, 11.0f, 72);
/* background box */
- rect= ar->winrct;
+ rect = ar->winrct;
rect.xmin = 0;
rect.ymin = ar->winrct.ymax - ar->winrct.ymin - header_height;
@@ -1805,7 +1805,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
- glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
+ glRecti(rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);
glDisable(GL_BLEND);
/* text */
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 69db65fda1c..0f1ffb856e7 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -92,7 +92,7 @@ GLubyte stipple_quarttone[128] = {
GLubyte stipple_diag_stripes_pos[128] = {
- 0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
+ 0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
@@ -111,7 +111,7 @@ GLubyte stipple_diag_stripes_pos[128] = {
GLubyte stipple_diag_stripes_neg[128] = {
- 0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
+ 0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
@@ -134,16 +134,16 @@ void fdrawbezier(float vec[4][3])
float dist;
float curve_res = 24, spline_step = 0.0f;
- dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
+ dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
/* check direction later, for top sockets */
- vec[1][0]= vec[0][0]+dist;
- vec[1][1]= vec[0][1];
+ vec[1][0] = vec[0][0] + dist;
+ vec[1][1] = vec[0][1];
- vec[2][0]= vec[3][0]-dist;
- vec[2][1]= vec[3][1];
+ vec[2][0] = vec[3][0] - dist;
+ vec[2][1] = vec[3][1];
/* we can reuse the dist variable here to increment the GL curve eval amount*/
- dist = 1.0f/curve_res;
+ dist = 1.0f / curve_res;
cpack(0x0);
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
@@ -193,7 +193,7 @@ void fdrawbox(float x1, float y1, float x2, float y2)
void fdrawcheckerboard(float x1, float y1, float x2, float y2)
{
- unsigned char col1[4]= {40, 40, 40}, col2[4]= {50, 50, 50};
+ unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50};
GLubyte checker_stipple[32 * 32 / 8] = {
255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
@@ -238,11 +238,11 @@ void sdrawline(short x1, short y1, short x2, short y2)
static void sdrawtripoints(short x1, short y1, short x2, short y2)
{
short v[2];
- v[0]= x1; v[1]= y1;
+ v[0] = x1; v[1] = y1;
glVertex2sv(v);
- v[0]= x1; v[1]= y2;
+ v[0] = x1; v[1] = y2;
glVertex2sv(v);
- v[0]= x2; v[1]= y1;
+ v[0] = x2; v[1] = y1;
glVertex2sv(v);
}
@@ -285,7 +285,7 @@ void sdrawbox(short x1, short y1, short x2, short y2)
void setlinestyle(int nr)
{
- if (nr==0) {
+ if (nr == 0) {
glDisable(GL_LINE_STIPPLE);
}
else {
@@ -295,20 +295,20 @@ void setlinestyle(int nr)
}
}
- /* Invert line handling */
+/* Invert line handling */
-#define gl_toggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
+#define gl_toggle(mode, onoff) (((onoff) ? glEnable : glDisable)(mode))
void set_inverted_drawing(int enable)
{
- glLogicOp(enable?GL_INVERT:GL_COPY);
+ glLogicOp(enable ? GL_INVERT : GL_COPY);
gl_toggle(GL_COLOR_LOGIC_OP, enable);
gl_toggle(GL_DITHER, !enable);
}
void sdrawXORline(int x0, int y0, int x1, int y1)
{
- if (x0==x1 && y0==y1) return;
+ if (x0 == x1 && y0 == y1) return;
set_inverted_drawing(1);
@@ -323,35 +323,35 @@ void sdrawXORline(int x0, int y0, int x1, int y1)
void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
{
static short old[4][2][2];
- static char flags[4]= {0, 0, 0, 0};
+ static char flags[4] = {0, 0, 0, 0};
- /* with builtin memory, max 4 lines */
+ /* with builtin memory, max 4 lines */
set_inverted_drawing(1);
glBegin(GL_LINES);
- if (nr== -1) { /* flush */
- for (nr=0; nr<4; nr++) {
+ if (nr == -1) { /* flush */
+ for (nr = 0; nr < 4; nr++) {
if (flags[nr]) {
glVertex2sv(old[nr][0]);
glVertex2sv(old[nr][1]);
- flags[nr]= 0;
+ flags[nr] = 0;
}
}
}
else {
- if (nr>=0 && nr<4) {
+ if (nr >= 0 && nr < 4) {
if (flags[nr]) {
glVertex2sv(old[nr][0]);
glVertex2sv(old[nr][1]);
}
- old[nr][0][0]= x0;
- old[nr][0][1]= y0;
- old[nr][1][0]= x1;
- old[nr][1][1]= y1;
+ old[nr][0][0] = x0;
+ old[nr][0][1] = y0;
+ old[nr][1][0] = x1;
+ old[nr][1][1] = y1;
- flags[nr]= 1;
+ flags[nr] = 1;
}
glVertex2i(x0, y0);
@@ -364,14 +364,14 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
{
- if (hw==0) return;
+ if (hw == 0) return;
set_inverted_drawing(1);
glPushMatrix();
glTranslatef(xofs, yofs, 0.0f);
glScalef(1.0f, hh / hw, 1.0f);
- glutil_draw_lined_arc(0.0, M_PI*2.0, hw, 20);
+ glutil_draw_lined_arc(0.0, M_PI * 2.0, hw, 20);
glPopMatrix();
set_inverted_drawing(0);
@@ -382,7 +382,7 @@ void fdrawXORcirc(float xofs, float yofs, float rad)
glPushMatrix();
glTranslatef(xofs, yofs, 0.0);
- glutil_draw_lined_arc(0.0, M_PI*2.0, rad, 20);
+ glutil_draw_lined_arc(0.0, M_PI * 2.0, rad, 20);
glPopMatrix();
set_inverted_drawing(0);
@@ -394,11 +394,11 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment
glBegin(GL_TRIANGLE_FAN);
glVertex2f(0.0, 0.0);
- for (i=0; i<nsegments; i++) {
- float t= (float) i/(nsegments-1);
- float cur= start + t*angle;
+ for (i = 0; i < nsegments; i++) {
+ float t = (float) i / (nsegments - 1);
+ float cur = start + t * angle;
- glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
+ glVertex2f(cosf(cur) * radius, sinf(cur) * radius);
}
glEnd();
}
@@ -408,11 +408,11 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments
int i;
glBegin(GL_LINE_STRIP);
- for (i=0; i<nsegments; i++) {
- float t= (float) i/(nsegments-1);
- float cur= start + t*angle;
+ for (i = 0; i < nsegments; i++) {
+ float t = (float) i / (nsegments - 1);
+ float cur = start + t * angle;
- glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
+ glVertex2f(cosf(cur) * radius, sinf(cur) * radius);
}
glEnd();
}
@@ -433,29 +433,29 @@ float glaGetOneFloat(int param)
void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
{
- GLubyte dummy= 0;
+ GLubyte dummy = 0;
- /* As long as known good coordinates are correct
- * this is guaranteed to generate an ok raster
- * position (ignoring potential (real) overflow
- * issues).
- */
+ /* As long as known good coordinates are correct
+ * this is guaranteed to generate an ok raster
+ * position (ignoring potential (real) overflow
+ * issues).
+ */
glRasterPos2f(known_good_x, known_good_y);
- /* Now shift the raster position to where we wanted
- * it in the first place using the glBitmap trick.
- */
+ /* Now shift the raster position to where we wanted
+ * it in the first place using the glBitmap trick.
+ */
glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy);
}
static int get_cached_work_texture(int *w_r, int *h_r)
{
- static GLint texid= -1;
- static int tex_w= 256;
- static int tex_h= 256;
+ static GLint texid = -1;
+ static int tex_w = 256;
+ static int tex_h = 256;
- if (texid==-1) {
- GLint ltexid= glaGetOneInteger(GL_TEXTURE_2D);
+ if (texid == -1) {
+ GLint ltexid = glaGetOneInteger(GL_TEXTURE_2D);
unsigned char *tbuf;
glGenTextures(1, (GLuint *)&texid);
@@ -465,28 +465,28 @@ static int get_cached_work_texture(int *w_r, int *h_r)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- tbuf= MEM_callocN(tex_w*tex_h*4, "tbuf");
+ tbuf = MEM_callocN(tex_w * tex_h * 4, "tbuf");
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tbuf);
MEM_freeN(tbuf);
glBindTexture(GL_TEXTURE_2D, ltexid);
}
- *w_r= tex_w;
- *h_r= tex_h;
+ *w_r = tex_w;
+ *h_r = tex_h;
return texid;
}
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY)
{
- unsigned char *uc_rect= (unsigned char*) rect;
- float *f_rect= (float *)rect;
- float xzoom= glaGetOneFloat(GL_ZOOM_X), yzoom= glaGetOneFloat(GL_ZOOM_Y);
- int ltexid= glaGetOneInteger(GL_TEXTURE_2D);
- int lrowlength= glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
+ unsigned char *uc_rect = (unsigned char *) rect;
+ float *f_rect = (float *)rect;
+ float xzoom = glaGetOneFloat(GL_ZOOM_X), yzoom = glaGetOneFloat(GL_ZOOM_Y);
+ int ltexid = glaGetOneInteger(GL_TEXTURE_2D);
+ int lrowlength = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
int subpart_x, subpart_y, tex_w, tex_h;
int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
- int texid= get_cached_work_texture(&tex_w, &tex_h);
+ int texid = get_cached_work_texture(&tex_w, &tex_h);
/* Specify the color outside this function, and tex will modulate it.
* This is useful for changing alpha without using glPixelTransferf()
@@ -505,66 +505,66 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
#endif
/* setup seamless 2=on, 0=off */
- seamless= ((tex_w<img_w || tex_h<img_h) && tex_w>2 && tex_h>2)? 2: 0;
-
- offset_x= tex_w - seamless;
- offset_y= tex_h - seamless;
-
- nsubparts_x= (img_w + (offset_x - 1))/(offset_x);
- nsubparts_y= (img_h + (offset_y - 1))/(offset_y);
-
- for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) {
- for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) {
- int remainder_x= img_w-subpart_x*offset_x;
- int remainder_y= img_h-subpart_y*offset_y;
- int subpart_w= (remainder_x<tex_w)? remainder_x: tex_w;
- int subpart_h= (remainder_y<tex_h)? remainder_y: tex_h;
- int offset_left= (seamless && subpart_x!=0)? 1: 0;
- int offset_bot= (seamless && subpart_y!=0)? 1: 0;
- int offset_right= (seamless && remainder_x>tex_w)? 1: 0;
- int offset_top= (seamless && remainder_y>tex_h)? 1: 0;
- float rast_x= x+subpart_x*offset_x*xzoom;
- float rast_y= y+subpart_y*offset_y*yzoom;
+ seamless = ((tex_w < img_w || tex_h < img_h) && tex_w > 2 && tex_h > 2) ? 2 : 0;
+
+ offset_x = tex_w - seamless;
+ offset_y = tex_h - seamless;
+
+ nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
+ nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
+
+ for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) {
+ for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) {
+ int remainder_x = img_w - subpart_x * offset_x;
+ int remainder_y = img_h - subpart_y * offset_y;
+ int subpart_w = (remainder_x < tex_w) ? remainder_x : tex_w;
+ int subpart_h = (remainder_y < tex_h) ? remainder_y : tex_h;
+ int offset_left = (seamless && subpart_x != 0) ? 1 : 0;
+ int offset_bot = (seamless && subpart_y != 0) ? 1 : 0;
+ int offset_right = (seamless && remainder_x > tex_w) ? 1 : 0;
+ int offset_top = (seamless && remainder_y > tex_h) ? 1 : 0;
+ float rast_x = x + subpart_x * offset_x * xzoom;
+ float rast_y = y + subpart_y * offset_y * yzoom;
/* check if we already got these because we always get 2 more when doing seamless*/
- if (subpart_w<=seamless || subpart_h<=seamless)
+ if (subpart_w <= seamless || subpart_h <= seamless)
continue;
- if (format==GL_FLOAT) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
+ if (format == GL_FLOAT) {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y * offset_y * img_w * 4 + subpart_x * offset_x * 4]);
/* add an extra border of pixels so linear looks ok at edges of full image. */
- if (subpart_w<tex_w)
- glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
- if (subpart_h<tex_h)
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
- if (subpart_w<tex_w && subpart_h<tex_h)
- glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
+ if (subpart_w < tex_w)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y * offset_y * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
+ if (subpart_h < tex_h)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + subpart_x * offset_x * 4]);
+ if (subpart_w < tex_w && subpart_h < tex_h)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
}
else {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y * offset_y * img_w * 4 + subpart_x * offset_x * 4]);
- if (subpart_w<tex_w)
- glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
- if (subpart_h<tex_h)
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
- if (subpart_w<tex_w && subpart_h<tex_h)
- glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
+ if (subpart_w < tex_w)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y * offset_y * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
+ if (subpart_h < tex_h)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + subpart_x * offset_x * 4]);
+ if (subpart_w < tex_w && subpart_h < tex_h)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
}
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
- glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(0 + offset_bot)/tex_h);
- glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)offset_bot*xzoom);
+ glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h);
+ glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * xzoom);
- glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(0 + offset_bot)/tex_h);
- glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)offset_bot*xzoom);
+ glTexCoord2f((float)(subpart_w - offset_right) / tex_w, (float)(0 + offset_bot) / tex_h);
+ glVertex2f(rast_x + (float)(subpart_w - offset_right) * xzoom * scaleX, rast_y + (float)offset_bot * xzoom);
- glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(subpart_h - offset_top)/tex_h);
- glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY);
+ glTexCoord2f((float)(subpart_w - offset_right) / tex_w, (float)(subpart_h - offset_top) / tex_h);
+ glVertex2f(rast_x + (float)(subpart_w - offset_right) * xzoom * scaleX, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY);
- glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(subpart_h - offset_top)/tex_h);
- glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY);
+ glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(subpart_h - offset_top) / tex_h);
+ glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY);
glEnd();
glDisable(GL_TEXTURE_2D);
}
@@ -587,51 +587,51 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect)
{
- float xzoom= glaGetOneFloat(GL_ZOOM_X);
- float yzoom= glaGetOneFloat(GL_ZOOM_Y);
-
- /* The pixel space coordinate of the intersection of
- * the [zoomed] image with the origin.
- */
- float ix= -x/xzoom;
- float iy= -y/yzoom;
-
- /* The maximum pixel amounts the image can be cropped
- * at the lower left without exceeding the origin.
- */
- int off_x= floor(MAX2(ix, 0));
- int off_y= floor(MAX2(iy, 0));
+ float xzoom = glaGetOneFloat(GL_ZOOM_X);
+ float yzoom = glaGetOneFloat(GL_ZOOM_Y);
+
+ /* The pixel space coordinate of the intersection of
+ * the [zoomed] image with the origin.
+ */
+ float ix = -x / xzoom;
+ float iy = -y / yzoom;
- /* The zoomed space coordinate of the raster position
- * (starting at the lower left most unclipped pixel).
- */
- float rast_x= x + off_x*xzoom;
- float rast_y= y + off_y*yzoom;
+ /* The maximum pixel amounts the image can be cropped
+ * at the lower left without exceeding the origin.
+ */
+ int off_x = floor(MAX2(ix, 0));
+ int off_y = floor(MAX2(iy, 0));
+
+ /* The zoomed space coordinate of the raster position
+ * (starting at the lower left most unclipped pixel).
+ */
+ float rast_x = x + off_x * xzoom;
+ float rast_y = y + off_y * yzoom;
GLfloat scissor[4];
int draw_w, draw_h;
- /* Determine the smallest number of pixels we need to draw
- * before the image would go off the upper right corner.
- *
- * It may seem this is just an optimization but some graphics
- * cards (ATI) freak out if there is a large zoom factor and
- * a large number of pixels off the screen (probably at some
- * level the number of image pixels to draw is getting multiplied
- * by the zoom and then clamped). Making sure we draw the
- * fewest pixels possible keeps everyone mostly happy (still
- * fails if we zoom in on one really huge pixel so that it
- * covers the entire screen).
- */
+ /* Determine the smallest number of pixels we need to draw
+ * before the image would go off the upper right corner.
+ *
+ * It may seem this is just an optimization but some graphics
+ * cards (ATI) freak out if there is a large zoom factor and
+ * a large number of pixels off the screen (probably at some
+ * level the number of image pixels to draw is getting multiplied
+ * by the zoom and then clamped). Making sure we draw the
+ * fewest pixels possible keeps everyone mostly happy (still
+ * fails if we zoom in on one really huge pixel so that it
+ * covers the entire screen).
+ */
glGetFloatv(GL_SCISSOR_BOX, scissor);
- draw_w = MIN2(img_w-off_x, ceil((scissor[2]-rast_x)/xzoom));
- draw_h = MIN2(img_h-off_y, ceil((scissor[3]-rast_y)/yzoom));
+ draw_w = MIN2(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
+ draw_h = MIN2(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
- if (draw_w>0 && draw_h>0) {
+ if (draw_w > 0 && draw_h > 0) {
int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
- /* Don't use safe RasterPos (slower) if we can avoid it. */
- if (rast_x>=0 && rast_y>=0) {
+ /* Don't use safe RasterPos (slower) if we can avoid it. */
+ if (rast_x >= 0 && rast_y >= 0) {
glRasterPos2f(rast_x, rast_y);
}
else {
@@ -639,24 +639,24 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
- if (format==GL_LUMINANCE || format==GL_RED) {
- if (type==GL_FLOAT) {
- float *f_rect= (float *)rect;
- glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x));
+ if (format == GL_LUMINANCE || format == GL_RED) {
+ if (type == GL_FLOAT) {
+ float *f_rect = (float *)rect;
+ glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x));
}
- else if (type==GL_INT || type==GL_UNSIGNED_INT) {
- int *i_rect= (int *)rect;
- glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*row_w + off_x));
+ else if (type == GL_INT || type == GL_UNSIGNED_INT) {
+ int *i_rect = (int *)rect;
+ glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y * row_w + off_x));
}
}
else { /* RGBA */
- if (type==GL_FLOAT) {
- float *f_rect= (float *)rect;
- glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x)*4);
+ if (type == GL_FLOAT) {
+ float *f_rect = (float *)rect;
+ glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x) * 4);
}
- else if (type==GL_UNSIGNED_BYTE) {
- unsigned char *uc_rect= (unsigned char *) rect;
- glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*row_w + off_x)*4);
+ else if (type == GL_UNSIGNED_BYTE) {
+ unsigned char *uc_rect = (unsigned char *) rect;
+ glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y * row_w + off_x) * 4);
}
}
@@ -668,17 +668,17 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
void glaDefine2DArea(rcti *screen_rect)
{
- int sc_w= screen_rect->xmax - screen_rect->xmin + 1;
- int sc_h= screen_rect->ymax - screen_rect->ymin + 1;
+ int sc_w = screen_rect->xmax - screen_rect->xmin + 1;
+ int sc_h = screen_rect->ymax - screen_rect->ymin + 1;
glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
- /* The 0.375 magic number is to shift the matrix so that
- * both raster and vertex integer coordinates fall at pixel
- * centers properly. For a longer discussion see the OpenGL
- * Programming Guide, Appendix H, Correctness Tips.
- */
+ /* The 0.375 magic number is to shift the matrix so that
+ * both raster and vertex integer coordinates fall at pixel
+ * centers properly. For a longer discussion see the OpenGL
+ * Programming Guide, Appendix H, Correctness Tips.
+ */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -703,7 +703,7 @@ struct gla2DDrawInfo {
void gla2DGetMap(gla2DDrawInfo *di, rctf *rect)
{
- *rect= di->world_rect;
+ *rect = di->world_rect;
}
void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
@@ -711,20 +711,20 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
int sc_w, sc_h;
float wo_w, wo_h;
- di->world_rect= *rect;
+ di->world_rect = *rect;
- sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
- sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
- wo_w= (di->world_rect.xmax-di->world_rect.xmin);
- wo_h= (di->world_rect.ymax-di->world_rect.ymin);
+ sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
+ sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
+ wo_w = (di->world_rect.xmax - di->world_rect.xmin);
+ wo_h = (di->world_rect.ymax - di->world_rect.ymin);
- di->wo_to_sc[0]= sc_w/wo_w;
- di->wo_to_sc[1]= sc_h/wo_h;
+ di->wo_to_sc[0] = sc_w / wo_w;
+ di->wo_to_sc[1] = sc_h / wo_h;
}
gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
{
- gla2DDrawInfo *di= MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
+ gla2DDrawInfo *di = MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
int sc_w, sc_h;
float wo_w, wo_h;
@@ -733,9 +733,9 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat);
glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat);
- di->screen_rect= *screen_rect;
+ di->screen_rect = *screen_rect;
if (world_rect) {
- di->world_rect= *world_rect;
+ di->world_rect = *world_rect;
}
else {
di->world_rect.xmin = di->screen_rect.xmin;
@@ -744,13 +744,13 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
di->world_rect.ymax = di->screen_rect.ymax;
}
- sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
- sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
- wo_w= (di->world_rect.xmax-di->world_rect.xmin);
- wo_h= (di->world_rect.ymax-di->world_rect.ymin);
+ sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
+ sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
+ wo_w = (di->world_rect.xmax - di->world_rect.xmin);
+ wo_h = (di->world_rect.ymax - di->world_rect.ymin);
- di->wo_to_sc[0]= sc_w/wo_w;
- di->wo_to_sc[1]= sc_h/wo_h;
+ di->wo_to_sc[0] = sc_w / wo_w;
+ di->wo_to_sc[1] = sc_h / wo_h;
glaDefine2DArea(&di->screen_rect);
@@ -759,13 +759,13 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r)
{
- *sc_x_r= (wo_x - di->world_rect.xmin)*di->wo_to_sc[0];
- *sc_y_r= (wo_y - di->world_rect.ymin)*di->wo_to_sc[1];
+ *sc_x_r = (wo_x - di->world_rect.xmin) * di->wo_to_sc[0];
+ *sc_y_r = (wo_y - di->world_rect.ymin) * di->wo_to_sc[1];
}
void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2])
{
- screen_r[0]= (world[0] - di->world_rect.xmin)*di->wo_to_sc[0];
- screen_r[1]= (world[1] - di->world_rect.ymin)*di->wo_to_sc[1];
+ screen_r[0] = (world[0] - di->world_rect.xmin) * di->wo_to_sc[0];
+ screen_r[1] = (world[1] - di->world_rect.ymin) * di->wo_to_sc[1];
}
void glaEnd2DDraw(gla2DDrawInfo *di)
@@ -783,8 +783,8 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
/* **************** GL_POINT hack ************************ */
-static int curmode=0;
-static int pointhack=0;
+static int curmode = 0;
+static int pointhack = 0;
static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
@@ -792,15 +792,15 @@ static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
void bglBegin(int mode)
{
- curmode= mode;
+ curmode = mode;
- if (mode==GL_POINTS) {
+ if (mode == GL_POINTS) {
float value[4];
glGetFloatv(GL_POINT_SIZE_RANGE, value);
if (value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
- pointhack= floor(value[0] + 0.5f);
- if (pointhack>4) pointhack= 4;
+ pointhack = floor(value[0] + 0.5f);
+ if (pointhack > 4) pointhack = 4;
}
else glBegin(mode);
}
@@ -814,8 +814,8 @@ int bglPointHack(void)
glGetFloatv(GL_POINT_SIZE_RANGE, value);
if (value[1] < 2.0f) {
glGetFloatv(GL_POINT_SIZE, value);
- pointhack_px= floorf(value[0]+0.5f);
- if (pointhack_px>4) pointhack_px= 4;
+ pointhack_px = floorf(value[0] + 0.5f);
+ if (pointhack_px > 4) pointhack_px = 4;
return pointhack_px;
}
return 0;
@@ -825,46 +825,46 @@ int bglPointHack(void)
void bglVertex3fv(const float vec[3])
{
switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos3fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
- }
- else glVertex3fv(vec);
- break;
+ case GL_POINTS:
+ if (pointhack) {
+ glRasterPos3fv(vec);
+ glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
+ }
+ else glVertex3fv(vec);
+ break;
}
}
void bglVertex3f(float x, float y, float z)
{
switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos3f(x, y, z);
- glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
- }
- else glVertex3f(x, y, z);
- break;
+ case GL_POINTS:
+ if (pointhack) {
+ glRasterPos3f(x, y, z);
+ glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
+ }
+ else glVertex3f(x, y, z);
+ break;
}
}
void bglVertex2fv(const float vec[2])
{
switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos2fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
- }
- else glVertex2fv(vec);
- break;
+ case GL_POINTS:
+ if (pointhack) {
+ glRasterPos2fv(vec);
+ glBitmap(pointhack, pointhack, (float)pointhack / 2, pointhack / 2, 0.0, 0.0, Squaredot);
+ }
+ else glVertex2fv(vec);
+ break;
}
}
void bglEnd(void)
{
- if (pointhack) pointhack= 0;
+ if (pointhack) pointhack = 0;
else glEnd();
}
@@ -872,7 +872,7 @@ void bglEnd(void)
/* Uses current OpenGL state to get view matrices for gluProject/gluUnProject */
void bgl_get_mats(bglMats *mats)
{
- const double badvalue= 1.0e-6;
+ const double badvalue = 1.0e-6;
glGetDoublev(GL_MODELVIEW_MATRIX, mats->modelview);
glGetDoublev(GL_PROJECTION_MATRIX, mats->projection);
@@ -901,7 +901,7 @@ void bgl_get_mats(bglMats *mats)
/* dist is only for ortho now... */
void bglPolygonOffset(float viewdist, float dist)
{
- static float winmat[16], offset=0.0;
+ static float winmat[16], offset = 0.0;
if (dist != 0.0f) {
float offs;
@@ -915,11 +915,11 @@ void bglPolygonOffset(float viewdist, float dist)
/* dist is from camera to center point */
- if (winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking
- else offs= 0.0005f*dist; // should be clipping value or so...
+ if (winmat[15] > 0.5f) offs = 0.00001f * dist * viewdist; // ortho tweaking
+ else offs = 0.0005f * dist; // should be clipping value or so...
- winmat[14]-= offs;
- offset+= offs;
+ winmat[14] -= offs;
+ offset += offs;
glLoadMatrixf(winmat);
glMatrixMode(GL_MODELVIEW);
@@ -927,8 +927,8 @@ void bglPolygonOffset(float viewdist, float dist)
else {
glMatrixMode(GL_PROJECTION);
- winmat[14]+= offset;
- offset= 0.0;
+ winmat[14] += offset;
+ offset = 0.0;
glLoadMatrixf(winmat);
glMatrixMode(GL_MODELVIEW);
}
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 6c5991422e5..ccc54a554e6 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -72,19 +72,19 @@ const char *screen_context_dir[] = {
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
{
- bScreen *sc= CTX_wm_screen(C);
- Scene *scene= sc->scene;
+ bScreen *sc = CTX_wm_screen(C);
+ Scene *scene = sc->scene;
Base *base;
unsigned int lay = scene->lay;
-#if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */
- Object *obact= CTX_data_active_object(C);
- Object *obedit= CTX_data_edit_object(C);
- base= CTX_data_active_base(C);
+#if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */
+ Object *obact = CTX_data_active_object(C);
+ Object *obedit = CTX_data_edit_object(C);
+ base = CTX_data_active_base(C);
#else
- Object *obedit= scene->obedit;
- Object *obact= OBACT;
- base= BASACT;
+ Object *obedit = scene->obedit;
+ Object *obact = OBACT;
+ base = BASACT;
#endif
if (CTX_data_dir(member)) {
@@ -96,9 +96,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
- int visible_objects= CTX_data_equals(member, "visible_objects");
+ int visible_objects = CTX_data_equals(member, "visible_objects");
- for (base=scene->base.first; base; base=base->next) {
+ for (base = scene->base.first; base; base = base->next) {
if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
if (visible_objects)
CTX_data_id_list_add(result, &base->object->id);
@@ -110,11 +110,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
- int selectable_objects= CTX_data_equals(member, "selectable_objects");
+ int selectable_objects = CTX_data_equals(member, "selectable_objects");
- for (base=scene->base.first; base; base=base->next) {
+ for (base = scene->base.first; base; base = base->next) {
if (base->lay & lay) {
- if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0 && (base->object->restrictflag & OB_RESTRICT_SELECT) == 0) {
if (selectable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
@@ -126,9 +126,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
- int selected_objects= CTX_data_equals(member, "selected_objects");
+ int selected_objects = CTX_data_equals(member, "selected_objects");
- for (base=scene->base.first; base; base=base->next) {
+ for (base = scene->base.first; base; base = base->next) {
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
if (selected_objects)
CTX_data_id_list_add(result, &base->object->id);
@@ -140,12 +140,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
- int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
+ int selected_editable_objects = CTX_data_equals(member, "selected_editable_objects");
- for (base=scene->base.first; base; base=base->next) {
+ for (base = scene->base.first; base; base = base->next) {
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
- if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- if (0==BKE_object_is_libdata(base->object)) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
+ if (0 == BKE_object_is_libdata(base->object)) {
if (selected_editable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
@@ -158,13 +158,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
- bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
- EditBone *ebone, *flipbone=NULL;
- int editable_bones= CTX_data_equals(member, "editable_bones");
+ bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
+ EditBone *ebone, *flipbone = NULL;
+ int editable_bones = CTX_data_equals(member, "editable_bones");
if (arm && arm->edbo) {
/* Attention: X-Axis Mirroring is also handled here... */
- for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
/* first and foremost, bone must be visible and selected */
if (EBONE_VISIBLE(arm, ebone)) {
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
@@ -190,7 +190,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
/* only include bones if visible */
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
- if ((flipbone) && EBONE_VISIBLE(arm, flipbone)==0)
+ if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0)
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
}
}
@@ -200,13 +200,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
- bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
- EditBone *ebone, *flipbone=NULL;
- int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones");
+ bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
+ EditBone *ebone, *flipbone = NULL;
+ int selected_editable_bones = CTX_data_equals(member, "selected_editable_bones");
if (arm && arm->edbo) {
/* Attention: X-Axis Mirroring is also handled here... */
- for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
/* first and foremost, bone must be visible and selected */
if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
@@ -242,12 +242,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "visible_pose_bones")) {
- Object *obpose= BKE_object_pose_armature_get(obact);
- bArmature *arm= (obpose) ? obpose->data : NULL;
+ Object *obpose = BKE_object_pose_armature_get(obact);
+ bArmature *arm = (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
if (obpose && obpose->pose && arm) {
- for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
if (PBONE_VISIBLE(arm, pchan->bone)) {
CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
@@ -258,12 +258,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_pose_bones")) {
- Object *obpose= BKE_object_pose_armature_get(obact);
- bArmature *arm= (obpose) ? obpose->data : NULL;
+ Object *obpose = BKE_object_pose_armature_get(obact);
+ bArmature *arm = (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
if (obpose && obpose->pose && arm) {
- for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
if (PBONE_VISIBLE(arm, pchan->bone)) {
if (pchan->bone->flag & BONE_SELECTED)
@@ -276,7 +276,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "active_bone")) {
if (obact && obact->type == OB_ARMATURE) {
- bArmature *arm= obact->data;
+ bArmature *arm = obact->data;
if (arm->edbo) {
if (arm->act_edbone) {
CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
@@ -293,9 +293,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "active_pose_bone")) {
bPoseChannel *pchan;
- Object *obpose= BKE_object_pose_armature_get(obact);
+ Object *obpose = BKE_object_pose_armature_get(obact);
- pchan= BKE_pose_channel_active(obpose);
+ pchan = BKE_pose_channel_active(obpose);
if (pchan) {
CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
return 1;
@@ -357,10 +357,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "sequences")) {
- Editing *ed= seq_give_editing(scene, FALSE);
+ Editing *ed = seq_give_editing(scene, FALSE);
if (ed) {
Sequence *seq;
- for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq = ed->seqbasep->first; seq; seq = seq->next) {
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -368,10 +368,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_sequences")) {
- Editing *ed= seq_give_editing(scene, FALSE);
+ Editing *ed = seq_give_editing(scene, FALSE);
if (ed) {
Sequence *seq;
- for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
}
@@ -381,10 +381,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_editable_sequences")) {
- Editing *ed= seq_give_editing(scene, FALSE);
+ Editing *ed = seq_give_editing(scene, FALSE);
if (ed) {
Sequence *seq;
- for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
}
@@ -394,19 +394,19 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "active_operator")) {
- wmOperator *op= NULL;
+ wmOperator *op = NULL;
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile) {
- op= sfile->op;
+ op = sfile->op;
}
- else if ((op= uiContextActiveOperator(C))) {
+ else if ((op = uiContextActiveOperator(C))) {
/* do nothign */
}
else {
/* note, this checks poll, could be a problem, but this also
* happens for the toolbar */
- op= WM_operator_last_redo(C);
+ op = WM_operator_last_redo(C);
}
/* TODO, get the operator from popup's */
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index b2a2a371a1a..d714f82b58b 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -66,16 +66,16 @@
/* XXX actually should be not here... solve later */
#include "wm_subwindow.h"
-#include "screen_intern.h" /* own module include */
+#include "screen_intern.h" /* own module include */
/* ******************* screen vert, edge, area managing *********************** */
static ScrVert *screen_addvert(bScreen *sc, short x, short y)
{
- ScrVert *sv= MEM_callocN(sizeof(ScrVert), "addscrvert");
- sv->vec.x= x;
- sv->vec.y= y;
+ ScrVert *sv = MEM_callocN(sizeof(ScrVert), "addscrvert");
+ sv->vec.x = x;
+ sv->vec.y = y;
BLI_addtail(&sc->vertbase, sv);
return sv;
@@ -86,19 +86,19 @@ static void sortscrvert(ScrVert **v1, ScrVert **v2)
ScrVert *tmp;
if (*v1 > *v2) {
- tmp= *v1;
- *v1= *v2;
- *v2= tmp;
+ tmp = *v1;
+ *v1 = *v2;
+ *v2 = tmp;
}
}
static ScrEdge *screen_addedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
{
- ScrEdge *se= MEM_callocN(sizeof(ScrEdge), "addscredge");
+ ScrEdge *se = MEM_callocN(sizeof(ScrEdge), "addscredge");
sortscrvert(&v1, &v2);
- se->v1= v1;
- se->v2= v2;
+ se->v1 = v1;
+ se->v2 = v2;
BLI_addtail(&sc->edgebase, se);
return se;
@@ -110,8 +110,8 @@ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
ScrEdge *se;
sortscrvert(&v1, &v2);
- for (se= sc->edgebase.first; se; se= se->next)
- if (se->v1==v1 && se->v2==v2)
+ for (se = sc->edgebase.first; se; se = se->next)
+ if (se->v1 == v1 && se->v2 == v2)
return se;
return NULL;
@@ -123,50 +123,50 @@ void removedouble_scrverts(bScreen *sc)
ScrEdge *se;
ScrArea *sa;
- verg= sc->vertbase.first;
+ verg = sc->vertbase.first;
while (verg) {
- if (verg->newv==NULL) { /* !!! */
- v1= verg->next;
+ if (verg->newv == NULL) { /* !!! */
+ v1 = verg->next;
while (v1) {
- if (v1->newv==NULL) { /* !?! */
- if (v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
+ if (v1->newv == NULL) { /* !?! */
+ if (v1->vec.x == verg->vec.x && v1->vec.y == verg->vec.y) {
/* printf("doublevert\n"); */
- v1->newv= verg;
+ v1->newv = verg;
}
}
- v1= v1->next;
+ v1 = v1->next;
}
}
- verg= verg->next;
+ verg = verg->next;
}
/* replace pointers in edges and faces */
- se= sc->edgebase.first;
+ se = sc->edgebase.first;
while (se) {
- if (se->v1->newv) se->v1= se->v1->newv;
- if (se->v2->newv) se->v2= se->v2->newv;
+ if (se->v1->newv) se->v1 = se->v1->newv;
+ if (se->v2->newv) se->v2 = se->v2->newv;
/* edges changed: so.... */
sortscrvert(&(se->v1), &(se->v2));
- se= se->next;
+ se = se->next;
}
- sa= sc->areabase.first;
+ sa = sc->areabase.first;
while (sa) {
- if (sa->v1->newv) sa->v1= sa->v1->newv;
- if (sa->v2->newv) sa->v2= sa->v2->newv;
- if (sa->v3->newv) sa->v3= sa->v3->newv;
- if (sa->v4->newv) sa->v4= sa->v4->newv;
- sa= sa->next;
+ if (sa->v1->newv) sa->v1 = sa->v1->newv;
+ if (sa->v2->newv) sa->v2 = sa->v2->newv;
+ if (sa->v3->newv) sa->v3 = sa->v3->newv;
+ if (sa->v4->newv) sa->v4 = sa->v4->newv;
+ sa = sa->next;
}
/* remove */
- verg= sc->vertbase.first;
+ verg = sc->vertbase.first;
while (verg) {
- v1= verg->next;
+ v1 = verg->next;
if (verg->newv) {
BLI_remlink(&sc->vertbase, verg);
MEM_freeN(verg);
}
- verg= v1;
+ verg = v1;
}
}
@@ -178,22 +178,22 @@ void removenotused_scrverts(bScreen *sc)
/* we assume edges are ok */
- se= sc->edgebase.first;
+ se = sc->edgebase.first;
while (se) {
- se->v1->flag= 1;
- se->v2->flag= 1;
- se= se->next;
+ se->v1->flag = 1;
+ se->v2->flag = 1;
+ se = se->next;
}
- sv= sc->vertbase.first;
+ sv = sc->vertbase.first;
while (sv) {
- svn= sv->next;
- if (sv->flag==0) {
+ svn = sv->next;
+ if (sv->flag == 0) {
BLI_remlink(&sc->vertbase, sv);
MEM_freeN(sv);
}
- else sv->flag= 0;
- sv= svn;
+ else sv->flag = 0;
+ sv = svn;
}
}
@@ -202,18 +202,18 @@ void removedouble_scredges(bScreen *sc)
ScrEdge *verg, *se, *sn;
/* compare */
- verg= sc->edgebase.first;
+ verg = sc->edgebase.first;
while (verg) {
- se= verg->next;
+ se = verg->next;
while (se) {
- sn= se->next;
- if (verg->v1==se->v1 && verg->v2==se->v2) {
+ sn = se->next;
+ if (verg->v1 == se->v1 && verg->v2 == se->v2) {
BLI_remlink(&sc->edgebase, se);
MEM_freeN(se);
}
- se= sn;
+ se = sn;
}
- verg= verg->next;
+ verg = verg->next;
}
}
@@ -221,35 +221,35 @@ void removenotused_scredges(bScreen *sc)
{
ScrEdge *se, *sen;
ScrArea *sa;
- int a=0;
+ int a = 0;
/* sets flags when edge is used in area */
- sa= sc->areabase.first;
+ sa = sc->areabase.first;
while (sa) {
- se= screen_findedge(sc, sa->v1, sa->v2);
- if (se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
- else se->flag= 1;
- se= screen_findedge(sc, sa->v2, sa->v3);
- if (se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
- else se->flag= 1;
- se= screen_findedge(sc, sa->v3, sa->v4);
- if (se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
- else se->flag= 1;
- se= screen_findedge(sc, sa->v4, sa->v1);
- if (se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
- else se->flag= 1;
- sa= sa->next;
+ se = screen_findedge(sc, sa->v1, sa->v2);
+ if (se == NULL) printf("error: area %d edge 1 doesn't exist\n", a);
+ else se->flag = 1;
+ se = screen_findedge(sc, sa->v2, sa->v3);
+ if (se == NULL) printf("error: area %d edge 2 doesn't exist\n", a);
+ else se->flag = 1;
+ se = screen_findedge(sc, sa->v3, sa->v4);
+ if (se == NULL) printf("error: area %d edge 3 doesn't exist\n", a);
+ else se->flag = 1;
+ se = screen_findedge(sc, sa->v4, sa->v1);
+ if (se == NULL) printf("error: area %d edge 4 doesn't exist\n", a);
+ else se->flag = 1;
+ sa = sa->next;
a++;
}
- se= sc->edgebase.first;
+ se = sc->edgebase.first;
while (se) {
- sen= se->next;
- if (se->flag==0) {
+ sen = se->next;
+ if (se->flag == 0) {
BLI_remlink(&sc->edgebase, se);
MEM_freeN(se);
}
- else se->flag= 0;
- se= sen;
+ else se->flag = 0;
+ se = sen;
}
}
@@ -262,21 +262,21 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
{
ScrEdge *se;
- for (se= sc->edgebase.first; se; se= se->next) {
+ for (se = sc->edgebase.first; se; se = se->next) {
if (scredge_is_horizontal(se)) {
short min, max;
- min= MIN2(se->v1->vec.x, se->v2->vec.x);
- max= MAX2(se->v1->vec.x, se->v2->vec.x);
+ min = MIN2(se->v1->vec.x, se->v2->vec.x);
+ max = MAX2(se->v1->vec.x, se->v2->vec.x);
- if (abs(my-se->v1->vec.y)<=2 && mx>=min && mx<=max)
+ if (abs(my - se->v1->vec.y) <= 2 && mx >= min && mx <= max)
return se;
}
else {
short min, max;
- min= MIN2(se->v1->vec.y, se->v2->vec.y);
- max= MAX2(se->v1->vec.y, se->v2->vec.y);
+ min = MIN2(se->v1->vec.y, se->v2->vec.y);
+ max = MAX2(se->v1->vec.y, se->v2->vec.y);
- if (abs(mx-se->v1->vec.x)<=2 && my>=min && my<=max)
+ if (abs(mx - se->v1->vec.x) <= 2 && my >= min && my <= max)
return se;
}
}
@@ -289,13 +289,13 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
/* adds no space data */
static ScrArea *screen_addarea(bScreen *sc, ScrVert *v1, ScrVert *v2, ScrVert *v3, ScrVert *v4, short headertype, short spacetype)
{
- ScrArea *sa= MEM_callocN(sizeof(ScrArea), "addscrarea");
- sa->v1= v1;
- sa->v2= v2;
- sa->v3= v3;
- sa->v4= v4;
- sa->headertype= headertype;
- sa->spacetype= sa->butspacetype= spacetype;
+ ScrArea *sa = MEM_callocN(sizeof(ScrArea), "addscrarea");
+ sa->v1 = v1;
+ sa->v2 = v2;
+ sa->v3 = v3;
+ sa->v4 = v4;
+ sa->headertype = headertype;
+ sa->spacetype = sa->butspacetype = spacetype;
BLI_addtail(&sc->areabase, sa);
@@ -320,31 +320,31 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
short x, y;
// area big enough?
- if (dir=='v' && (sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX)) return 0;
- if (dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
+ if (dir == 'v' && (sa->v4->vec.x - sa->v1->vec.x <= 2 * AREAMINX)) return 0;
+ if (dir == 'h' && (sa->v2->vec.y - sa->v1->vec.y <= 2 * AREAMINY)) return 0;
// to be sure
CLAMP(fac, 0.0f, 1.0f);
- if (dir=='h') {
- y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
+ if (dir == 'h') {
+ y = sa->v1->vec.y + fac * (sa->v2->vec.y - sa->v1->vec.y);
- if (y- sa->v1->vec.y < AREAMINY)
- y= sa->v1->vec.y+ AREAMINY;
- else if (sa->v2->vec.y- y < AREAMINY)
- y= sa->v2->vec.y- AREAMINY;
- else y-= (y % AREAGRID);
+ if (y - sa->v1->vec.y < AREAMINY)
+ y = sa->v1->vec.y + AREAMINY;
+ else if (sa->v2->vec.y - y < AREAMINY)
+ y = sa->v2->vec.y - AREAMINY;
+ else y -= (y % AREAGRID);
return y;
}
else {
- x= sa->v1->vec.x+ fac*(sa->v4->vec.x- sa->v1->vec.x);
+ x = sa->v1->vec.x + fac * (sa->v4->vec.x - sa->v1->vec.x);
- if (x- sa->v1->vec.x < AREAMINX)
- x= sa->v1->vec.x+ AREAMINX;
- else if (sa->v4->vec.x- x < AREAMINX)
- x= sa->v4->vec.x- AREAMINX;
- else x-= (x % AREAGRID);
+ if (x - sa->v1->vec.x < AREAMINX)
+ x = sa->v1->vec.x + AREAMINX;
+ else if (sa->v4->vec.x - x < AREAMINX)
+ x = sa->v4->vec.x - AREAMINX;
+ else x -= (x % AREAGRID);
return x;
}
@@ -352,19 +352,19 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
{
- ScrArea *newa=NULL;
+ ScrArea *newa = NULL;
ScrVert *sv1, *sv2;
short split;
- if (sa==NULL) return NULL;
+ if (sa == NULL) return NULL;
- split= testsplitpoint(sa, dir, fac);
- if (split==0) return NULL;
+ split = testsplitpoint(sa, dir, fac);
+ if (split == 0) return NULL;
- if (dir=='h') {
+ if (dir == 'h') {
/* new vertices */
- sv1= screen_addvert(sc, sa->v1->vec.x, split);
- sv2= screen_addvert(sc, sa->v4->vec.x, split);
+ sv1 = screen_addvert(sc, sa->v1->vec.x, split);
+ sv2 = screen_addvert(sc, sa->v4->vec.x, split);
/* new edges */
screen_addedge(sc, sa->v1, sv1);
@@ -374,18 +374,18 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
screen_addedge(sc, sv1, sv2);
/* new areas: top */
- newa= screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
area_copy_data(newa, sa, 0);
/* area below */
- sa->v2= sv1;
- sa->v3= sv2;
+ sa->v2 = sv1;
+ sa->v3 = sv2;
}
else {
/* new vertices */
- sv1= screen_addvert(sc, split, sa->v1->vec.y);
- sv2= screen_addvert(sc, split, sa->v2->vec.y);
+ sv1 = screen_addvert(sc, split, sa->v1->vec.y);
+ sv2 = screen_addvert(sc, split, sa->v2->vec.y);
/* new edges */
screen_addedge(sc, sa->v1, sv1);
@@ -395,12 +395,12 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
screen_addedge(sc, sv1, sv2);
/* new areas: left */
- newa= screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
+ newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
area_copy_data(newa, sa, 0);
/* area right */
- sa->v1= sv1;
- sa->v2= sv2;
+ sa->v1 = sv1;
+ sa->v2 = sv2;
}
/* remove double vertices en edges */
@@ -419,16 +419,16 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name)
bScreen *sc;
ScrVert *sv1, *sv2, *sv3, *sv4;
- sc= BKE_libblock_alloc(&G.main->screen, ID_SCR, name);
- sc->scene= scene;
- sc->do_refresh= 1;
- sc->redraws_flag= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
- sc->winid= win->winid;
-
- sv1= screen_addvert(sc, 0, 0);
- sv2= screen_addvert(sc, 0, win->sizey-1);
- sv3= screen_addvert(sc, win->sizex-1, win->sizey-1);
- sv4= screen_addvert(sc, win->sizex-1, 0);
+ sc = BKE_libblock_alloc(&G.main->screen, ID_SCR, name);
+ sc->scene = scene;
+ sc->do_refresh = 1;
+ sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
+ sc->winid = win->winid;
+
+ sv1 = screen_addvert(sc, 0, 0);
+ sv2 = screen_addvert(sc, 0, win->sizey - 1);
+ sv3 = screen_addvert(sc, win->sizex - 1, win->sizey - 1);
+ sv4 = screen_addvert(sc, win->sizex - 1, 0);
screen_addedge(sc, sv1, sv2);
screen_addedge(sc, sv2, sv3);
@@ -453,37 +453,37 @@ static void screen_copy(bScreen *to, bScreen *from)
BLI_duplicatelist(&to->vertbase, &from->vertbase);
BLI_duplicatelist(&to->edgebase, &from->edgebase);
BLI_duplicatelist(&to->areabase, &from->areabase);
- to->regionbase.first= to->regionbase.last= NULL;
+ to->regionbase.first = to->regionbase.last = NULL;
- s2= to->vertbase.first;
- for (s1= from->vertbase.first; s1; s1= s1->next, s2= s2->next) {
- s1->newv= s2;
+ s2 = to->vertbase.first;
+ for (s1 = from->vertbase.first; s1; s1 = s1->next, s2 = s2->next) {
+ s1->newv = s2;
}
- for (se= to->edgebase.first; se; se= se->next) {
- se->v1= se->v1->newv;
- se->v2= se->v2->newv;
+ for (se = to->edgebase.first; se; se = se->next) {
+ se->v1 = se->v1->newv;
+ se->v2 = se->v2->newv;
sortscrvert(&(se->v1), &(se->v2));
}
- saf= from->areabase.first;
- for (sa= to->areabase.first; sa; sa= sa->next, saf= saf->next) {
- sa->v1= sa->v1->newv;
- sa->v2= sa->v2->newv;
- sa->v3= sa->v3->newv;
- sa->v4= sa->v4->newv;
-
- sa->spacedata.first= sa->spacedata.last= NULL;
- sa->regionbase.first= sa->regionbase.last= NULL;
- sa->actionzones.first= sa->actionzones.last= NULL;
- sa->handlers.first= sa->handlers.last= NULL;
+ saf = from->areabase.first;
+ for (sa = to->areabase.first; sa; sa = sa->next, saf = saf->next) {
+ sa->v1 = sa->v1->newv;
+ sa->v2 = sa->v2->newv;
+ sa->v3 = sa->v3->newv;
+ sa->v4 = sa->v4->newv;
+
+ sa->spacedata.first = sa->spacedata.last = NULL;
+ sa->regionbase.first = sa->regionbase.last = NULL;
+ sa->actionzones.first = sa->actionzones.last = NULL;
+ sa->handlers.first = sa->handlers.last = NULL;
area_copy_data(sa, saf, 0);
}
/* put at zero (needed?) */
- for (s1= from->vertbase.first; s1; s1= s1->next)
- s1->newv= NULL;
+ for (s1 = from->vertbase.first; s1; s1 = s1->next)
+ s1->newv = NULL;
}
@@ -496,27 +496,27 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
ScrVert *sav1, *sav2, *sav3, *sav4;
ScrVert *sbv1, *sbv2, *sbv3, *sbv4;
- if (sa==NULL || sb==NULL) return -1;
+ if (sa == NULL || sb == NULL) return -1;
- sav1= sa->v1;
- sav2= sa->v2;
- sav3= sa->v3;
- sav4= sa->v4;
- sbv1= sb->v1;
- sbv2= sb->v2;
- sbv3= sb->v3;
- sbv4= sb->v4;
+ sav1 = sa->v1;
+ sav2 = sa->v2;
+ sav3 = sa->v3;
+ sav4 = sa->v4;
+ sbv1 = sb->v1;
+ sbv2 = sb->v2;
+ sbv3 = sb->v3;
+ sbv4 = sb->v4;
- if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+ if (sav1 == sbv4 && sav2 == sbv3) { /* sa to right of sb = W */
return 0;
}
- else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+ else if (sav2 == sbv1 && sav3 == sbv4) { /* sa to bottom of sb = N */
return 1;
}
- else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+ else if (sav3 == sbv2 && sav4 == sbv1) { /* sa to left of sb = E */
return 2;
}
- else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+ else if (sav1 == sbv2 && sav4 == sbv3) { /* sa on top of sb = S*/
return 3;
}
@@ -524,9 +524,9 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
}
/* Helper function to join 2 areas, it has a return value, 0=failed 1=success
- * used by the split, join operators
+ * used by the split, join operators
*/
-int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
+int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
{
int dir;
@@ -534,32 +534,32 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
/*printf("dir is : %i\n", dir);*/
if (dir < 0) {
- if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
- if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
+ if (sa1) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
+ if (sa2) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
return 0;
}
if (dir == 0) {
- sa1->v1= sa2->v1;
- sa1->v2= sa2->v2;
+ sa1->v1 = sa2->v1;
+ sa1->v2 = sa2->v2;
screen_addedge(scr, sa1->v2, sa1->v3);
screen_addedge(scr, sa1->v1, sa1->v4);
}
else if (dir == 1) {
- sa1->v2= sa2->v2;
- sa1->v3= sa2->v3;
+ sa1->v2 = sa2->v2;
+ sa1->v3 = sa2->v3;
screen_addedge(scr, sa1->v1, sa1->v2);
screen_addedge(scr, sa1->v3, sa1->v4);
}
else if (dir == 2) {
- sa1->v3= sa2->v3;
- sa1->v4= sa2->v4;
+ sa1->v3 = sa2->v3;
+ sa1->v4 = sa2->v4;
screen_addedge(scr, sa1->v2, sa1->v3);
screen_addedge(scr, sa1->v1, sa1->v4);
}
else if (dir == 3) {
- sa1->v1= sa2->v1;
- sa1->v4= sa2->v4;
+ sa1->v1 = sa2->v1;
+ sa1->v4 = sa2->v4;
screen_addedge(scr, sa1->v1, sa1->v2);
screen_addedge(scr, sa1->v3, sa1->v4);
}
@@ -581,34 +581,38 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
/* select connected, only in the right direction */
/* 'dir' is the direction of EDGE */
- if (edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
- else dir= 'h';
+ if (edge->v1->vec.x == edge->v2->vec.x) dir = 'v';
+ else dir = 'h';
- sv= sc->vertbase.first;
+ sv = sc->vertbase.first;
while (sv) {
sv->flag = 0;
- sv= sv->next;
+ sv = sv->next;
}
- edge->v1->flag= 1;
- edge->v2->flag= 1;
+ edge->v1->flag = 1;
+ edge->v2->flag = 1;
- oneselected= 1;
+ oneselected = 1;
while (oneselected) {
- se= sc->edgebase.first;
- oneselected= 0;
+ se = sc->edgebase.first;
+ oneselected = 0;
while (se) {
- if (se->v1->flag + se->v2->flag==1) {
- if (dir=='h') if (se->v1->vec.y==se->v2->vec.y) {
- se->v1->flag= se->v2->flag= 1;
- oneselected= 1;
+ if (se->v1->flag + se->v2->flag == 1) {
+ if (dir == 'h') {
+ if (se->v1->vec.y == se->v2->vec.y) {
+ se->v1->flag = se->v2->flag = 1;
+ oneselected = 1;
+ }
}
- if (dir=='v') if (se->v1->vec.x==se->v2->vec.x) {
- se->v1->flag= se->v2->flag= 1;
- oneselected= 1;
+ if (dir == 'v') {
+ if (se->v1->vec.x == se->v2->vec.x) {
+ se->v1->flag = se->v2->flag = 1;
+ oneselected = 1;
}
+ }
}
- se= se->next;
+ se = se->next;
}
}
}
@@ -616,52 +620,52 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
/* test if screen vertices should be scaled */
static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
{
- ScrVert *sv=NULL;
+ ScrVert *sv = NULL;
ScrArea *sa;
int sizex, sizey;
float facx, facy, tempf, min[2], max[2];
/* calculate size */
- min[0]= min[1]= 10000.0f;
- max[0]= max[1]= 0.0f;
+ min[0] = min[1] = 10000.0f;
+ max[0] = max[1] = 0.0f;
- for (sv= sc->vertbase.first; sv; sv= sv->next) {
- min[0]= MIN2(min[0], sv->vec.x);
- min[1]= MIN2(min[1], sv->vec.y);
- max[0]= MAX2(max[0], sv->vec.x);
- max[1]= MAX2(max[1], sv->vec.y);
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ min[0] = MIN2(min[0], sv->vec.x);
+ min[1] = MIN2(min[1], sv->vec.y);
+ max[0] = MAX2(max[0], sv->vec.x);
+ max[1] = MAX2(max[1], sv->vec.y);
}
/* always make 0.0 left under */
- for (sv= sc->vertbase.first; sv; sv= sv->next) {
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
sv->vec.x -= min[0];
sv->vec.y -= min[1];
}
- sizex= max[0]-min[0];
- sizey= max[1]-min[1];
+ sizex = max[0] - min[0];
+ sizey = max[1] - min[1];
- if (sizex!= winsizex || sizey!= winsizey) {
- facx= winsizex;
- facx/= (float)sizex;
- facy= winsizey;
- facy/= (float)sizey;
+ if (sizex != winsizex || sizey != winsizey) {
+ facx = winsizex;
+ facx /= (float)sizex;
+ facy = winsizey;
+ facy /= (float)sizey;
/* make sure it fits! */
- for (sv= sc->vertbase.first; sv; sv= sv->next) {
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
/* FIXME, this re-sizing logic is no good when re-sizing the window + redrawing [#24428]
* need some way to store these as floats internally and re-apply from there. */
- tempf= ((float)sv->vec.x)*facx;
- sv->vec.x= (short)(tempf+0.5f);
- sv->vec.x+= AREAGRID-1;
- sv->vec.x-= (sv->vec.x % AREAGRID);
+ tempf = ((float)sv->vec.x) * facx;
+ sv->vec.x = (short)(tempf + 0.5f);
+ sv->vec.x += AREAGRID - 1;
+ sv->vec.x -= (sv->vec.x % AREAGRID);
CLAMP(sv->vec.x, 0, winsizex);
- tempf= ((float)sv->vec.y)*facy;
- sv->vec.y= (short)(tempf+0.5f);
- sv->vec.y+= AREAGRID-1;
- sv->vec.y-= (sv->vec.y % AREAGRID);
+ tempf = ((float)sv->vec.y) * facy;
+ sv->vec.y = (short)(tempf + 0.5f);
+ sv->vec.y += AREAGRID - 1;
+ sv->vec.y -= (sv->vec.y % AREAGRID);
CLAMP(sv->vec.y, 0, winsizey);
}
@@ -671,26 +675,26 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* ton: removed option now, it needs Context... */
/* make each window at least ED_area_headersize() high */
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- int headery= ED_area_headersize()+1;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ int headery = ED_area_headersize() + 1;
- if (sa->v1->vec.y+headery > sa->v2->vec.y) {
+ if (sa->v1->vec.y + headery > sa->v2->vec.y) {
/* lower edge */
- ScrEdge *se= screen_findedge(sc, sa->v4, sa->v1);
- if (se && sa->v1!=sa->v2 ) {
+ ScrEdge *se = screen_findedge(sc, sa->v4, sa->v1);
+ if (se && sa->v1 != sa->v2) {
int yval;
select_connected_scredge(sc, se);
/* all selected vertices get the right offset */
- yval= sa->v2->vec.y-headery;
- sv= sc->vertbase.first;
+ yval = sa->v2->vec.y - headery;
+ sv = sc->vertbase.first;
while (sv) {
/* if is a collapsed area */
- if (sv!=sa->v2 && sv!=sa->v3) {
- if (sv->flag) sv->vec.y= yval;
+ if (sv != sa->v2 && sv != sa->v3) {
+ if (sv->flag) sv->vec.y = yval;
}
- sv= sv->next;
+ sv = sv->next;
}
}
}
@@ -714,17 +718,17 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
float width = sa->v3->vec.x - sa->v1->vec.x;
float height = sa->v3->vec.y - sa->v1->vec.y;
- if (height<width) {
- h = height/8;
- w = height/4;
+ if (height < width) {
+ h = height / 8;
+ w = height / 4;
}
else {
- h = width/8;
- w = width/4;
+ h = width / 8;
+ w = width / 4;
}
points[0].x = sa->v1->vec.x;
- points[0].y = sa->v1->vec.y + height/2;
+ points[0].y = sa->v1->vec.y + height / 2;
points[1].x = sa->v1->vec.x;
points[1].y = sa->v1->vec.y;
@@ -733,13 +737,13 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
points[2].y = sa->v4->vec.y;
points[3].x = sa->v4->vec.x - w;
- points[3].y = sa->v4->vec.y + height/2 - 2*h;
+ points[3].y = sa->v4->vec.y + height / 2 - 2 * h;
- points[4].x = sa->v4->vec.x - 2*w;
- points[4].y = sa->v4->vec.y + height/2;
+ points[4].x = sa->v4->vec.x - 2 * w;
+ points[4].y = sa->v4->vec.y + height / 2;
points[5].x = sa->v4->vec.x - w;
- points[5].y = sa->v4->vec.y + height/2 + 2*h;
+ points[5].y = sa->v4->vec.y + height / 2 + 2 * h;
points[6].x = sa->v3->vec.x - w;
points[6].y = sa->v3->vec.y;
@@ -748,15 +752,15 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
points[7].y = sa->v2->vec.y;
points[8].x = sa->v4->vec.x;
- points[8].y = sa->v4->vec.y + height/2 - h;
+ points[8].y = sa->v4->vec.y + height / 2 - h;
points[9].x = sa->v4->vec.x;
- points[9].y = sa->v4->vec.y + height/2 + h;
+ points[9].y = sa->v4->vec.y + height / 2 + h;
- if (dir=='l') {
+ if (dir == 'l') {
/* when direction is left, then we flip direction of arrow */
float cx = sa->v1->vec.x + width;
- for (i=0;i<10;i++) {
+ for (i = 0; i < 10; i++) {
points[i].x -= cx;
points[i].x = -points[i].x;
points[i].x += sa->v1->vec.x;
@@ -764,11 +768,11 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
}
glBegin(GL_POLYGON);
- for (i=0;i<5;i++)
+ for (i = 0; i < 5; i++)
glVertex2f(points[i].x, points[i].y);
glEnd();
glBegin(GL_POLYGON);
- for (i=4;i<8;i++)
+ for (i = 4; i < 8; i++)
glVertex2f(points[i].x, points[i].y);
glVertex2f(points[0].x, points[0].y);
glEnd();
@@ -786,16 +790,16 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
float width = sa->v3->vec.x - sa->v1->vec.x;
float height = sa->v3->vec.y - sa->v1->vec.y;
- if (height<width) {
- h = height/4;
- w = height/8;
+ if (height < width) {
+ h = height / 4;
+ w = height / 8;
}
else {
- h = width/4;
- w = width/8;
+ h = width / 4;
+ w = width / 8;
}
- points[0].x = sa->v1->vec.x + width/2;
+ points[0].x = sa->v1->vec.x + width / 2;
points[0].y = sa->v3->vec.y;
points[1].x = sa->v2->vec.x;
@@ -804,13 +808,13 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
points[2].x = sa->v1->vec.x;
points[2].y = sa->v1->vec.y + h;
- points[3].x = sa->v1->vec.x + width/2 - 2*w;
+ points[3].x = sa->v1->vec.x + width / 2 - 2 * w;
points[3].y = sa->v1->vec.y + h;
- points[4].x = sa->v1->vec.x + width/2;
- points[4].y = sa->v1->vec.y + 2*h;
+ points[4].x = sa->v1->vec.x + width / 2;
+ points[4].y = sa->v1->vec.y + 2 * h;
- points[5].x = sa->v1->vec.x + width/2 + 2*w;
+ points[5].x = sa->v1->vec.x + width / 2 + 2 * w;
points[5].y = sa->v1->vec.y + h;
points[6].x = sa->v4->vec.x;
@@ -819,16 +823,16 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
points[7].x = sa->v3->vec.x;
points[7].y = sa->v3->vec.y;
- points[8].x = sa->v1->vec.x + width/2 - w;
+ points[8].x = sa->v1->vec.x + width / 2 - w;
points[8].y = sa->v1->vec.y;
- points[9].x = sa->v1->vec.x + width/2 + w;
+ points[9].x = sa->v1->vec.x + width / 2 + w;
points[9].y = sa->v1->vec.y;
- if (dir=='u') {
+ if (dir == 'u') {
/* when direction is up, then we flip direction of arrow */
float cy = sa->v1->vec.y + height;
- for (i=0;i<10;i++) {
+ for (i = 0; i < 10; i++) {
points[i].y -= cy;
points[i].y = -points[i].y;
points[i].y += sa->v1->vec.y;
@@ -836,11 +840,11 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
}
glBegin(GL_POLYGON);
- for (i=0;i<5;i++)
+ for (i = 0; i < 5; i++)
glVertex2f(points[i].x, points[i].y);
glEnd();
glBegin(GL_POLYGON);
- for (i=4;i<8;i++)
+ for (i = 4; i < 8; i++)
glVertex2f(points[i].x, points[i].y);
glVertex2f(points[0].x, points[0].y);
glEnd();
@@ -852,7 +856,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
/* draw join shape due to direction of joining */
static void draw_join_shape(ScrArea *sa, char dir)
{
- if (dir=='u' || dir=='d')
+ if (dir == 'u' || dir == 'd')
draw_vertical_join_shape(sa, dir);
else
draw_horizontal_join_shape(sa, dir);
@@ -883,38 +887,38 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, short a)
{
/* right border area */
- if (x2<sizex-1)
- sdrawline(x2+a, y1, x2+a, y2);
+ if (x2 < sizex - 1)
+ sdrawline(x2 + a, y1, x2 + a, y2);
/* left border area */
- if (x1>0) /* otherwise it draws the emboss of window over */
- sdrawline(x1+a, y1, x1+a, y2);
+ if (x1 > 0) /* otherwise it draws the emboss of window over */
+ sdrawline(x1 + a, y1, x1 + a, y2);
/* top border area */
- if (y2<sizey-1)
- sdrawline(x1, y2+a, x2, y2+a);
+ if (y2 < sizey - 1)
+ sdrawline(x1, y2 + a, x2, y2 + a);
/* bottom border area */
- if (y1>0)
- sdrawline(x1, y1+a, x2, y1+a);
+ if (y1 > 0)
+ sdrawline(x1, y1 + a, x2, y1 + a);
}
/** screen edges drawing **/
static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
{
- short x1= sa->v1->vec.x;
- short y1= sa->v1->vec.y;
- short x2= sa->v3->vec.x;
- short y2= sa->v3->vec.y;
+ short x1 = sa->v1->vec.x;
+ short y1 = sa->v1->vec.y;
+ short x2 = sa->v3->vec.x;
+ short y2 = sa->v3->vec.y;
short a, rt;
- rt= 0; // CLAMPIS(G.rt, 0, 16);
+ rt = 0; // CLAMPIS(G.rt, 0, 16);
- if (center==0) {
+ if (center == 0) {
cpack(0x505050);
- for (a=-rt; a<=rt; a++)
- if (a!=0)
+ for (a = -rt; a <= rt; a++)
+ if (a != 0)
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, a);
}
else {
@@ -929,10 +933,10 @@ bScreen *ED_screen_duplicate(wmWindow *win, bScreen *sc)
{
bScreen *newsc;
- if (sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
+ if (sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
/* make new empty screen: */
- newsc= ED_screen_add(win, sc->scene, sc->id.name+2);
+ newsc = ED_screen_add(win, sc->scene, sc->id.name + 2);
/* copy all data */
screen_copy(newsc, sc);
@@ -942,11 +946,11 @@ bScreen *ED_screen_duplicate(wmWindow *win, bScreen *sc)
/* screen sets cursor based on swinid */
static void region_cursor_set(wmWindow *win, int swinid)
{
- ScrArea *sa= win->screen->areabase.first;
+ ScrArea *sa = win->screen->areabase.first;
- for (;sa; sa= sa->next) {
- ARegion *ar= sa->regionbase.first;
- for (;ar; ar= ar->next) {
+ for (; sa; sa = sa->next) {
+ ARegion *ar = sa->regionbase.first;
+ for (; ar; ar = ar->next) {
if (ar->swinid == swinid) {
if (ar->type && ar->type->cursor)
ar->type->cursor(win, sa, ar);
@@ -960,25 +964,25 @@ static void region_cursor_set(wmWindow *win, int swinid)
void ED_screen_do_listen(bContext *C, wmNotifier *note)
{
- wmWindow *win= CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
/* generic notes */
switch (note->category) {
case NC_WM:
- if (note->data==ND_FILEREAD)
- win->screen->do_draw= 1;
+ if (note->data == ND_FILEREAD)
+ win->screen->do_draw = 1;
break;
case NC_WINDOW:
- win->screen->do_draw= 1;
+ win->screen->do_draw = 1;
break;
case NC_SCREEN:
- if (note->data==ND_SUBWINACTIVE)
+ if (note->data == ND_SUBWINACTIVE)
uiFreeActiveButtons(C, win->screen);
- if (note->action==NA_EDITED)
- win->screen->do_draw= win->screen->do_refresh= 1;
+ if (note->action == NA_EDITED)
+ win->screen->do_draw = win->screen->do_refresh = 1;
break;
case NC_SCENE:
- if (note->data==ND_MODE)
+ if (note->data == ND_MODE)
region_cursor_set(win, note->swinid);
break;
}
@@ -988,21 +992,21 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
void ED_screen_draw(wmWindow *win)
{
ScrArea *sa;
- ScrArea *sa1= NULL;
- ScrArea *sa2= NULL;
- ScrArea *sa3= NULL;
+ ScrArea *sa1 = NULL;
+ ScrArea *sa2 = NULL;
+ ScrArea *sa3 = NULL;
int dir = -1;
int dira = -1;
wmSubWindowSet(win, win->screen->mainwin);
- for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (sa = win->screen->areabase.first; sa; sa = sa->next) {
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
- if (sa->flag & (AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
+ if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
drawscredge_area(sa, win->sizex, win->sizey, 0);
}
- for (sa= win->screen->areabase.first; sa; sa= sa->next)
+ for (sa = win->screen->areabase.first; sa; sa = sa->next)
drawscredge_area(sa, win->sizex, win->sizey, 1);
/* blended join arrow */
@@ -1040,29 +1044,29 @@ void ED_screen_draw(wmWindow *win)
if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
sdrawline(sa3->totrct.xmin, win->eventstate->y, sa3->totrct.xmax, win->eventstate->y);
glColor4ub(0, 0, 0, 100);
- sdrawline(sa3->totrct.xmin, win->eventstate->y+1, sa3->totrct.xmax, win->eventstate->y+1);
+ sdrawline(sa3->totrct.xmin, win->eventstate->y + 1, sa3->totrct.xmax, win->eventstate->y + 1);
}
else {
sdrawline(win->eventstate->x, sa3->totrct.ymin, win->eventstate->x, sa3->totrct.ymax);
glColor4ub(0, 0, 0, 100);
- sdrawline(win->eventstate->x+1, sa3->totrct.ymin, win->eventstate->x+1, sa3->totrct.ymax);
+ sdrawline(win->eventstate->x + 1, sa3->totrct.ymin, win->eventstate->x + 1, sa3->totrct.ymax);
}
glDisable(GL_BLEND);
}
- win->screen->do_draw= 0;
+ win->screen->do_draw = 0;
}
/* helper call for below, dpi changes headers */
static void screen_refresh_headersizes(void)
{
- const ListBase *lb= BKE_spacetypes_list();
+ const ListBase *lb = BKE_spacetypes_list();
SpaceType *st;
- for (st= lb->first; st; st= st->next) {
- ARegionType *art= BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
- if (art) art->prefsizey= ED_area_headersize();
+ for (st = lb->first; st; st = st->next) {
+ ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
+ if (art) art->prefsizey = ED_area_headersize();
}
}
@@ -1076,21 +1080,21 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
rcti winrct;
winrct.xmin = 0;
- winrct.xmax = win->sizex-1;
+ winrct.xmax = win->sizex - 1;
winrct.ymin = 0;
- winrct.ymax = win->sizey-1;
+ winrct.ymax = win->sizey - 1;
screen_test_scale(win->screen, win->sizex, win->sizey);
- if (win->screen->mainwin==0)
- win->screen->mainwin= wm_subwindow_open(win, &winrct);
+ if (win->screen->mainwin == 0)
+ win->screen->mainwin = wm_subwindow_open(win, &winrct);
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
/* header size depends on DPI, let's verify */
screen_refresh_headersizes();
- for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ for (sa = win->screen->areabase.first; sa; sa = sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
ED_area_initialize(wm, win, sa);
@@ -1104,9 +1108,9 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
if (G.debug & G_DEBUG_EVENTS) {
printf("%s: set screen\n", __func__);
}
- win->screen->do_refresh= 0;
+ win->screen->do_refresh = 0;
- win->screen->context= ed_screen_context;
+ win->screen->context = ed_screen_context;
}
/* file read, set all screens, ... */
@@ -1114,10 +1118,10 @@ void ED_screens_initialize(wmWindowManager *wm)
{
wmWindow *win;
- for (win= wm->windows.first; win; win= win->next) {
+ for (win = wm->windows.first; win; win = win->next) {
- if (win->screen==NULL)
- win->screen= G.main->screen.first;
+ if (win->screen == NULL)
+ win->screen = G.main->screen.first;
ED_screen_refresh(wm, win);
}
@@ -1128,28 +1132,28 @@ void ED_screens_initialize(wmWindowManager *wm)
void ED_region_exit(bContext *C, ARegion *ar)
{
- ARegion *prevar= CTX_wm_region(C);
+ ARegion *prevar = CTX_wm_region(C);
CTX_wm_region_set(C, ar);
WM_event_remove_handlers(C, &ar->handlers);
if (ar->swinid)
wm_subwindow_close(CTX_wm_window(C), ar->swinid);
- ar->swinid= 0;
+ ar->swinid = 0;
if (ar->headerstr)
MEM_freeN(ar->headerstr);
- ar->headerstr= NULL;
+ ar->headerstr = NULL;
CTX_wm_region_set(C, prevar);
}
void ED_area_exit(bContext *C, ScrArea *sa)
{
- ScrArea *prevsa= CTX_wm_area(C);
+ ScrArea *prevsa = CTX_wm_area(C);
ARegion *ar;
if (sa->spacetype == SPACE_FILE) {
- SpaceLink *sl= sa->spacedata.first;
+ SpaceLink *sl = sa->spacedata.first;
if (sl && sl->spacetype == SPACE_FILE) {
ED_fileselect_exit(C, (SpaceFile *)sl);
}
@@ -1159,7 +1163,7 @@ void ED_area_exit(bContext *C, ScrArea *sa)
}
CTX_wm_area_set(C, sa);
- for (ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
ED_region_exit(C, ar);
WM_event_remove_handlers(C, &sa->handlers);
@@ -1168,8 +1172,8 @@ void ED_area_exit(bContext *C, ScrArea *sa)
void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- wmWindow *prevwin= CTX_wm_window(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *prevwin = CTX_wm_window(C);
ScrArea *sa;
ARegion *ar;
@@ -1177,21 +1181,21 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
if (screen->animtimer)
WM_event_remove_timer(wm, window, screen->animtimer);
- screen->animtimer= NULL;
+ screen->animtimer = NULL;
if (screen->mainwin)
wm_subwindow_close(window, screen->mainwin);
- screen->mainwin= 0;
- screen->subwinactive= 0;
+ screen->mainwin = 0;
+ screen->subwinactive = 0;
- for (ar= screen->regionbase.first; ar; ar= ar->next)
+ for (ar = screen->regionbase.first; ar; ar = ar->next)
ED_region_exit(C, ar);
- for (sa= screen->areabase.first; sa; sa= sa->next)
+ for (sa = screen->areabase.first; sa; sa = sa->next)
ED_area_exit(C, sa);
/* mark it available for use for other windows */
- screen->winid= 0;
+ screen->winid = 0;
if (prevwin->screen->temp == 0) {
/* use previous window if possible */
@@ -1209,17 +1213,17 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
/* case when on area-edge or in azones, or outside window */
static void screen_cursor_set(wmWindow *win, wmEvent *event)
{
- AZone *az= NULL;
+ AZone *az = NULL;
ScrArea *sa;
- for (sa= win->screen->areabase.first; sa; sa= sa->next)
- if ((az=is_in_area_actionzone(sa, event->x, event->y)))
+ for (sa = win->screen->areabase.first; sa; sa = sa->next)
+ if ((az = is_in_area_actionzone(sa, event->x, event->y)))
break;
if (sa) {
- if (az->type==AZONE_AREA)
+ if (az->type == AZONE_AREA)
WM_cursor_set(win, CURSOR_EDIT);
- else if (az->type==AZONE_REGION) {
+ else if (az->type == AZONE_REGION) {
if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
WM_cursor_set(win, CURSOR_X_MOVE);
else
@@ -1227,7 +1231,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
}
}
else {
- ScrEdge *actedge= screen_find_active_scredge(win->screen, event->x, event->y);
+ ScrEdge *actedge = screen_find_active_scredge(win->screen, event->x, event->y);
if (actedge) {
if (scredge_is_horizontal(actedge))
@@ -1245,72 +1249,72 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
/* event type is mouse move */
void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
{
- wmWindow *win= CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
if (win->screen) {
- bScreen *scr= win->screen;
+ bScreen *scr = win->screen;
ScrArea *sa;
ARegion *ar;
- int oldswin= scr->subwinactive;
+ int oldswin = scr->subwinactive;
- for (sa= scr->areabase.first; sa; sa= sa->next) {
+ for (sa = scr->areabase.first; sa; sa = sa->next) {
if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
- if (NULL==is_in_area_actionzone(sa, event->x, event->y))
+ if (NULL == is_in_area_actionzone(sa, event->x, event->y))
break;
}
if (sa) {
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (BLI_in_rcti(&ar->winrct, event->x, event->y))
- scr->subwinactive= ar->swinid;
+ scr->subwinactive = ar->swinid;
}
}
else
- scr->subwinactive= scr->mainwin;
+ scr->subwinactive = scr->mainwin;
/* check for redraw headers */
- if (oldswin!=scr->subwinactive) {
+ if (oldswin != scr->subwinactive) {
- for (sa= scr->areabase.first; sa; sa= sa->next) {
- int do_draw= 0;
+ for (sa = scr->areabase.first; sa; sa = sa->next) {
+ int do_draw = 0;
- for (ar= sa->regionbase.first; ar; ar= ar->next)
- if (ar->swinid==oldswin || ar->swinid==scr->subwinactive)
- do_draw= 1;
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (ar->swinid == oldswin || ar->swinid == scr->subwinactive)
+ do_draw = 1;
if (do_draw) {
- for (ar= sa->regionbase.first; ar; ar= ar->next)
- if (ar->regiontype==RGN_TYPE_HEADER)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (ar->regiontype == RGN_TYPE_HEADER)
ED_region_tag_redraw(ar);
}
}
}
/* cursors, for time being set always on edges, otherwise aregion doesnt switch */
- if (scr->subwinactive==scr->mainwin) {
+ if (scr->subwinactive == scr->mainwin) {
screen_cursor_set(win, event);
}
- else if (oldswin!=scr->subwinactive) {
+ else if (oldswin != scr->subwinactive) {
region_cursor_set(win, scr->subwinactive);
- WM_event_add_notifier(C, NC_SCREEN|ND_SUBWINACTIVE, scr);
+ WM_event_add_notifier(C, NC_SCREEN | ND_SUBWINACTIVE, scr);
}
}
}
int ED_screen_area_active(const bContext *C)
{
- wmWindow *win= CTX_wm_window(C);
- bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa= CTX_wm_area(C);
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *sc = CTX_wm_screen(C);
+ ScrArea *sa = CTX_wm_area(C);
if (win && sc && sa) {
- AZone *az= is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
+ AZone *az = is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
ARegion *ar;
if (az && az->type == AZONE_REGION)
return 1;
- for (ar= sa->regionbase.first; ar; ar= ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->swinid == sc->subwinactive)
return 1;
}
@@ -1321,35 +1325,35 @@ int ED_screen_area_active(const bContext *C)
/* Do NOT call in area/region queues! */
void ED_screen_set(bContext *C, bScreen *sc)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- wmWindow *win= CTX_wm_window(C);
- bScreen *oldscreen= CTX_wm_screen(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *oldscreen = CTX_wm_screen(C);
ID *id;
/* validate screen, it's called with notifier reference */
- for (id= CTX_data_main(C)->screen.first; id; id= id->next)
+ for (id = CTX_data_main(C)->screen.first; id; id = id->next)
if (sc == (bScreen *)id)
break;
- if (id==NULL)
+ if (id == NULL)
return;
/* check for valid winid */
- if (sc->winid!=0 && sc->winid!=win->winid)
+ if (sc->winid != 0 && sc->winid != win->winid)
return;
- if (sc->full) { /* find associated full */
+ if (sc->full) { /* find associated full */
bScreen *sc1;
- for (sc1= CTX_data_main(C)->screen.first; sc1; sc1= sc1->id.next) {
- ScrArea *sa= sc1->areabase.first;
- if (sa->full==sc) {
- sc= sc1;
+ for (sc1 = CTX_data_main(C)->screen.first; sc1; sc1 = sc1->id.next) {
+ ScrArea *sa = sc1->areabase.first;
+ if (sa->full == sc) {
+ sc = sc1;
break;
}
}
}
if (oldscreen != sc) {
- wmTimer *wt= oldscreen->animtimer;
+ wmTimer *wt = oldscreen->animtimer;
ScrArea *sa;
/* remove handlers referencing areas in old screen */
@@ -1358,22 +1362,22 @@ void ED_screen_set(bContext *C, bScreen *sc)
}
/* we put timer to sleep, so screen_exit has to think there's no timer */
- oldscreen->animtimer= NULL;
+ oldscreen->animtimer = NULL;
if (wt)
WM_event_timer_sleep(wm, win, wt, 1);
ED_screen_exit(C, win, oldscreen);
- oldscreen->animtimer= wt;
+ oldscreen->animtimer = wt;
- win->screen= sc;
- CTX_wm_window_set(C, win); // stores C->wm.screen... hrmf
+ win->screen = sc;
+ CTX_wm_window_set(C, win); // stores C->wm.screen... hrmf
/* prevent multiwin errors */
- sc->winid= win->winid;
+ sc->winid = win->winid;
ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C));
WM_event_add_notifier(C, NC_WINDOW, NULL);
- WM_event_add_notifier(C, NC_SCREEN|ND_SCREENSET, sc);
+ WM_event_add_notifier(C, NC_SCREEN | ND_SCREENSET, sc);
/* makes button hilites work */
WM_event_add_mousemove(C);
@@ -1384,7 +1388,7 @@ static int ed_screen_used(wmWindowManager *wm, bScreen *sc)
{
wmWindow *win;
- for (win=wm->windows.first; win; win=win->next)
+ for (win = wm->windows.first; win; win = win->next)
if (win->screen == sc)
return 1;
@@ -1394,11 +1398,11 @@ static int ed_screen_used(wmWindowManager *wm, bScreen *sc)
/* only call outside of area/region loops */
void ED_screen_delete(bContext *C, bScreen *sc)
{
- Main *bmain= CTX_data_main(C);
- wmWindowManager *wm= CTX_wm_manager(C);
- wmWindow *win= CTX_wm_window(C);
+ Main *bmain = CTX_data_main(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
bScreen *newsc;
- int delete= 1;
+ int delete = 1;
/* don't allow deleting temp fullscreens for now */
if (sc->full == SCREENFULL) {
@@ -1410,12 +1414,12 @@ void ED_screen_delete(bContext *C, bScreen *sc)
* long as we are able to find a screen that is unused, we
* can safely assume ours is not in use anywhere an delete it */
- for (newsc= sc->id.prev; newsc; newsc=newsc->id.prev)
+ for (newsc = sc->id.prev; newsc; newsc = newsc->id.prev)
if (!ed_screen_used(wm, newsc))
break;
if (!newsc) {
- for (newsc= sc->id.next; newsc; newsc=newsc->id.next)
+ for (newsc = sc->id.next; newsc; newsc = newsc->id.next)
if (!ed_screen_used(wm, newsc))
break;
}
@@ -1432,26 +1436,26 @@ void ED_screen_delete(bContext *C, bScreen *sc)
/* only call outside of area/region loops */
void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
bScreen *sc;
if (screen == NULL)
return;
if (ed_screen_used(CTX_wm_manager(C), screen))
- ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_DO_UNDO);
- for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
- if ((U.flag & USER_SCENEGLOBAL) || sc==screen) {
+ for (sc = CTX_data_main(C)->screen.first; sc; sc = sc->id.next) {
+ if ((U.flag & USER_SCENEGLOBAL) || sc == screen) {
if (scene != sc->scene) {
/* all areas endlocalview */
- // XXX ScrArea *sa= sc->areabase.first;
- // while (sa) {
- // endlocalview(sa);
- // sa= sa->next;
- // }
- sc->scene= scene;
+ // XXX ScrArea *sa= sc->areabase.first;
+ // while (sa) {
+ // endlocalview(sa);
+ // sa= sa->next;
+ // }
+ sc->scene = scene;
}
}
@@ -1460,36 +1464,36 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
// copy_view3d_lock(0); /* space.c */
/* are there cameras in the views that are not in the scene? */
- for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
- if ( (U.flag & USER_SCENEGLOBAL) || sc==screen) {
- ScrArea *sa= sc->areabase.first;
+ for (sc = CTX_data_main(C)->screen.first; sc; sc = sc->id.next) {
+ if ( (U.flag & USER_SCENEGLOBAL) || sc == screen) {
+ ScrArea *sa = sc->areabase.first;
while (sa) {
- SpaceLink *sl= sa->spacedata.first;
+ SpaceLink *sl = sa->spacedata.first;
while (sl) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *) sl;
BKE_screen_view3d_sync(v3d, scene);
if (!v3d->camera || !BKE_scene_base_find(scene, v3d->camera)) {
- v3d->camera= BKE_scene_camera_find(sc->scene);
+ v3d->camera = BKE_scene_camera_find(sc->scene);
// XXX if (sc==curscreen) handle_view3d_lock();
if (!v3d->camera) {
ARegion *ar;
- for (ar=v3d->regionbase.first; ar; ar= ar->next) {
+ for (ar = v3d->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d= ar->regiondata;
+ RegionView3D *rv3d = ar->regiondata;
- if (rv3d->persp==RV3D_CAMOB)
- rv3d->persp= RV3D_PERSP;
+ if (rv3d->persp == RV3D_CAMOB)
+ rv3d->persp = RV3D_PERSP;
}
}
}
}
}
- sl= sl->next;
+ sl = sl->next;
}
- sa= sa->next;
+ sa = sa->next;
}
}
}
@@ -1508,13 +1512,13 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
/* only call outside of area/region loops */
void ED_screen_delete_scene(bContext *C, Scene *scene)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Scene *newscene;
if (scene->id.prev)
- newscene= scene->id.prev;
+ newscene = scene->id.prev;
else if (scene->id.next)
- newscene= scene->id.next;
+ newscene = scene->id.next;
else
return;
@@ -1525,12 +1529,12 @@ void ED_screen_delete_scene(bContext *C, Scene *scene)
ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
{
- wmWindow *win= CTX_wm_window(C);
- bScreen *screen= CTX_wm_screen(C);
- ScrArea *newsa= NULL;
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *screen = CTX_wm_screen(C);
+ ScrArea *newsa = NULL;
- if (!sa || sa->full==NULL) {
- newsa= ED_screen_full_toggle(C, win, sa);
+ if (!sa || sa->full == NULL) {
+ newsa = ED_screen_full_toggle(C, win, sa);
}
if (!newsa) {
@@ -1538,7 +1542,7 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
/* if this has been called from the temporary info header generated in
* temp fullscreen layouts, find the correct fullscreen area to change
* to create a new space inside */
- for (newsa = screen->areabase.first; newsa; newsa=newsa->next) {
+ for (newsa = screen->areabase.first; newsa; newsa = newsa->next) {
if (!(sa->flag & AREA_TEMP_INFO))
break;
}
@@ -1555,7 +1559,7 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
{
- wmWindow *win= CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
ED_area_prevspace(C, sa);
@@ -1566,7 +1570,7 @@ void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
/* restore a screen / area back to default operation, after temp fullscreen modes */
void ED_screen_full_restore(bContext *C, ScrArea *sa)
{
- wmWindow *win= CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
SpaceLink *sl = sa->spacedata.first;
/* if fullscreen area has a secondary space (such as a file browser or fullscreen render
@@ -1579,13 +1583,13 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa)
/* Special check added for non-render image window (back from fullscreen through "Back to Previous" button) */
if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima= sa->spacedata.first;
+ SpaceImage *sima = sa->spacedata.first;
if (!(sima->flag & SI_PREVSPACE) && !(sima->flag & SI_FULLWINDOW))
sima_restore = 1;
}
if (sl->spacetype == SPACE_IMAGE && !sima_restore) {
- SpaceImage *sima= sa->spacedata.first;
+ SpaceImage *sima = sa->spacedata.first;
if (sima->flag & SI_PREVSPACE)
sima->flag &= ~SI_PREVSPACE;
if (sima->flag & SI_FULLWINDOW) {
@@ -1616,7 +1620,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
/* ensure we don't have a button active anymore, can crash when
* switching screens with tooltip open because region and tooltip
* are no longer in the same screen */
- for (ar=sa->regionbase.first; ar; ar=ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
uiFreeBlocks(C, &ar->uiblocks);
/* prevent hanging header prints */
@@ -1627,30 +1631,30 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
ScrArea *old;
/*short fulltype;*/ /*UNUSED*/
- sc= sa->full; /* the old screen to restore */
- oldscreen= win->screen; /* the one disappearing */
+ sc = sa->full; /* the old screen to restore */
+ oldscreen = win->screen; /* the one disappearing */
/*fulltype = sc->full;*/
- sc->full= 0;
+ sc->full = 0;
/* removed: SCREENAUTOPLAY exception here */
/* find old area */
- for (old= sc->areabase.first; old; old= old->next)
+ for (old = sc->areabase.first; old; old = old->next)
if (old->full) break;
- if (old==NULL) {
+ if (old == NULL) {
if (G.debug & G_DEBUG)
printf("%s: something wrong in areafullscreen\n", __func__);
return NULL;
}
- area_copy_data(old, sa, 1); /* 1 = swap spacelist */
+ area_copy_data(old, sa, 1); /* 1 = swap spacelist */
if (sa->flag & AREA_TEMP_INFO) sa->flag &= ~AREA_TEMP_INFO;
- old->full= NULL;
+ old->full = NULL;
/* animtimer back */
- sc->animtimer= oldscreen->animtimer;
- oldscreen->animtimer= NULL;
+ sc->animtimer = oldscreen->animtimer;
+ oldscreen->animtimer = NULL;
ED_screen_set(C, sc);
@@ -1660,43 +1664,43 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
}
else {
ScrArea *newa;
- char newname[MAX_ID_NAME-2];
+ char newname[MAX_ID_NAME - 2];
- oldscreen= win->screen;
+ oldscreen = win->screen;
/* nothing wrong with having only 1 area, as far as I can see...
* is there only 1 area? */
#if 0
- if (oldscreen->areabase.first==oldscreen->areabase.last)
+ if (oldscreen->areabase.first == oldscreen->areabase.last)
return NULL;
#endif
oldscreen->full = SCREENFULL;
- BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name+2, "full");
- sc= ED_screen_add(win, oldscreen->scene, newname);
+ BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name + 2, "full");
+ sc = ED_screen_add(win, oldscreen->scene, newname);
sc->full = SCREENFULL; // XXX
/* timer */
- sc->animtimer= oldscreen->animtimer;
- oldscreen->animtimer= NULL;
+ sc->animtimer = oldscreen->animtimer;
+ oldscreen->animtimer = NULL;
/* returns the top small area */
- newa= area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f, 1);
+ newa = area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f, 1);
ED_area_newspace(C, newa, SPACE_INFO);
/* use random area when we have no active one, e.g. when the
* mouse is outside of the window and we open a file browser */
if (!sa)
- sa= oldscreen->areabase.first;
+ sa = oldscreen->areabase.first;
/* copy area */
- newa= newa->prev;
- area_copy_data(newa, sa, 1); /* 1 = swap spacelist */
+ newa = newa->prev;
+ area_copy_data(newa, sa, 1); /* 1 = swap spacelist */
sa->flag |= AREA_TEMP_INFO;
- sa->full= oldscreen;
- newa->full= oldscreen;
- newa->next->full= oldscreen; // XXX
+ sa->full = oldscreen;
+ newa->full = oldscreen;
+ newa->next->full = oldscreen; // XXX
ED_screen_set(C, sc);
}
@@ -1710,26 +1714,26 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
/* update frame rate info for viewport drawing */
void ED_refresh_viewport_fps(bContext *C)
{
- wmTimer *animtimer= CTX_wm_screen(C)->animtimer;
- Scene *scene= CTX_data_scene(C);
+ wmTimer *animtimer = CTX_wm_screen(C)->animtimer;
+ Scene *scene = CTX_data_scene(C);
/* is anim playback running? */
if (animtimer && (U.uiflag & USER_SHOW_FPS)) {
- ScreenFrameRateInfo *fpsi= scene->fps_info;
+ ScreenFrameRateInfo *fpsi = scene->fps_info;
/* if there isn't any info, init it first */
if (fpsi == NULL)
- fpsi= scene->fps_info= MEM_callocN(sizeof(ScreenFrameRateInfo), "refresh_viewport_fps fps_info");
+ fpsi = scene->fps_info = MEM_callocN(sizeof(ScreenFrameRateInfo), "refresh_viewport_fps fps_info");
/* update the values */
- fpsi->redrawtime= fpsi->lredrawtime;
- fpsi->lredrawtime= animtimer->ltime;
+ fpsi->redrawtime = fpsi->lredrawtime;
+ fpsi->lredrawtime = animtimer->ltime;
}
else {
/* playback stopped or shouldn't be running */
if (scene->fps_info)
MEM_freeN(scene->fps_info);
- scene->fps_info= NULL;
+ scene->fps_info = NULL;
}
}
@@ -1738,56 +1742,56 @@ void ED_refresh_viewport_fps(bContext *C)
*/
void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync, int enable)
{
- bScreen *screen= CTX_wm_screen(C);
- wmWindowManager *wm= CTX_wm_manager(C);
- wmWindow *win= CTX_wm_window(C);
- Scene *scene= CTX_data_scene(C);
+ bScreen *screen = CTX_wm_screen(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
+ Scene *scene = CTX_data_scene(C);
if (screen->animtimer)
WM_event_remove_timer(wm, win, screen->animtimer);
- screen->animtimer= NULL;
+ screen->animtimer = NULL;
if (enable) {
- ScreenAnimData *sad= MEM_callocN(sizeof(ScreenAnimData), "ScreenAnimData");
+ ScreenAnimData *sad = MEM_callocN(sizeof(ScreenAnimData), "ScreenAnimData");
- screen->animtimer= WM_event_add_timer(wm, win, TIMER0, (1.0/FPS));
+ screen->animtimer = WM_event_add_timer(wm, win, TIMER0, (1.0 / FPS));
- sad->ar= CTX_wm_region(C);
+ sad->ar = CTX_wm_region(C);
/* if startframe is larger than current frame, we put currentframe on startframe.
* note: first frame then is not drawn! (ton) */
if (scene->r.sfra > scene->r.cfra) {
- sad->sfra= scene->r.cfra;
- scene->r.cfra= scene->r.sfra;
+ sad->sfra = scene->r.cfra;
+ scene->r.cfra = scene->r.sfra;
}
else
sad->sfra = scene->r.cfra;
- sad->redraws= redraws;
- sad->refresh= refresh;
- sad->flag |= (enable < 0)? ANIMPLAY_FLAG_REVERSE: 0;
- sad->flag |= (sync == 0)? ANIMPLAY_FLAG_NO_SYNC: (sync == 1)? ANIMPLAY_FLAG_SYNC: 0;
+ sad->redraws = redraws;
+ sad->refresh = refresh;
+ sad->flag |= (enable < 0) ? ANIMPLAY_FLAG_REVERSE : 0;
+ sad->flag |= (sync == 0) ? ANIMPLAY_FLAG_NO_SYNC : (sync == 1) ? ANIMPLAY_FLAG_SYNC : 0;
- screen->animtimer->customdata= sad;
+ screen->animtimer->customdata = sad;
}
/* notifier catched by top header, for button */
- WM_event_add_notifier(C, NC_SCREEN|ND_ANIMPLAY, screen);
+ WM_event_add_notifier(C, NC_SCREEN | ND_ANIMPLAY, screen);
}
/* helper for screen_animation_play() - only to be used for TimeLine */
static ARegion *time_top_left_3dwindow(bScreen *screen)
{
- ARegion *aret= NULL;
+ ARegion *aret = NULL;
ScrArea *sa;
- int min= 10000;
+ int min = 10000;
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- if (sa->spacetype==SPACE_VIEW3D) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_VIEW3D) {
ARegion *ar;
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_WINDOW) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
if (ar->winrct.xmin - ar->winrct.ymin < min) {
- aret= ar;
- min= ar->winrct.xmin - ar->winrct.ymin;
+ aret = ar;
+ min = ar->winrct.xmin - ar->winrct.ymin;
}
}
}
@@ -1800,14 +1804,14 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
{
if (screen && screen->animtimer) {
- wmTimer *wt= screen->animtimer;
- ScreenAnimData *sad= wt->customdata;
+ wmTimer *wt = screen->animtimer;
+ ScreenAnimData *sad = wt->customdata;
- sad->redraws= redraws;
- sad->refresh= refresh;
- sad->ar= NULL;
+ sad->redraws = redraws;
+ sad->refresh = refresh;
+ sad->ar = NULL;
if (redraws & TIME_REGION)
- sad->ar= time_top_left_3dwindow(screen);
+ sad->ar = time_top_left_3dwindow(screen);
}
}
@@ -1816,12 +1820,12 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUSED(mute))
{
#ifdef DURIAN_CAMERA_SWITCH
- void *camera= BKE_scene_camera_switch_find(scene);
+ void *camera = BKE_scene_camera_switch_find(scene);
if (camera && scene->camera != camera) {
bScreen *sc;
- scene->camera= camera;
+ scene->camera = camera;
/* are there cameras in the views that are not in the scene? */
- for (sc= bmain->screen.first; sc; sc= sc->id.next) {
+ for (sc = bmain->screen.first; sc; sc = sc->id.next) {
BKE_screen_view3d_scene_sync(sc);
}
}
@@ -1855,7 +1859,7 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
/* update animated texture nodes */
{
Tex *tex;
- for (tex= bmain->tex.first; tex; tex= tex->id.next)
+ for (tex = bmain->tex.first; tex; tex = tex->id.next)
if (tex->use_nodes && tex->nodetree) {
ntreeTexTagAnimated(tex->nodetree);
}
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 90533fd3a12..aa11c3eecdd 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -35,24 +35,24 @@
struct wmWindow;
struct Scene;
-#define AZONESPOT 12
+#define AZONESPOT 12
/* area.c */
-void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
+void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space);
/* screen_edit.c */
-ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
-ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
-int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2);
-int area_getorientation(ScrArea *sa, ScrArea *sb);
-void select_connected_scredge(bScreen *sc, ScrEdge *edge);
-
-void removenotused_scrverts(bScreen *sc);
-void removedouble_scrverts(bScreen *sc);
-void removedouble_scredges(bScreen *sc);
-void removenotused_scredges(bScreen *sc);
-int scredge_is_horizontal(ScrEdge *se);
-ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
+ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
+ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
+int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2);
+int area_getorientation(ScrArea *sa, ScrArea *sb);
+void select_connected_scredge(bScreen *sc, ScrEdge *edge);
+
+void removenotused_scrverts(bScreen *sc);
+void removedouble_scrverts(bScreen *sc);
+void removedouble_scredges(bScreen *sc);
+void removenotused_scredges(bScreen *sc);
+int scredge_is_horizontal(ScrEdge *se);
+ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
@@ -66,7 +66,3 @@ void SCREEN_OT_screenshot(struct wmOperatorType *ot);
void SCREEN_OT_screencast(struct wmOperatorType *ot);
#endif /* __SCREEN_INTERN_H__ */
-
-
-
-
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index a7161d7f01b..256df21b79a 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -78,18 +78,18 @@ typedef struct ScreenshotData {
/* get shot from frontbuffer */
static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy)
{
- wmWindow *win= CTX_wm_window(C);
- int x=0, y=0;
- unsigned int *dumprect= NULL;
-
- x= 0;
- y= 0;
- *dumpsx= win->sizex;
- *dumpsy= win->sizey;
+ wmWindow *win = CTX_wm_window(C);
+ int x = 0, y = 0;
+ unsigned int *dumprect = NULL;
+
+ x = 0;
+ y = 0;
+ *dumpsx = win->sizex;
+ *dumpsy = win->sizey;
if (*dumpsx && *dumpsy) {
- dumprect= MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
+ dumprect = MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
glReadBuffer(GL_FRONT);
glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
glFinish();
@@ -108,17 +108,17 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
/* do redraw so we don't show popups/menus */
WM_redraw_windows(C);
- dumprect= screenshot(C, &dumpsx, &dumpsy);
+ dumprect = screenshot(C, &dumpsx, &dumpsy);
if (dumprect) {
- ScreenshotData *scd= MEM_callocN(sizeof(ScreenshotData), "screenshot");
- ScrArea *sa= CTX_wm_area(C);
+ ScreenshotData *scd = MEM_callocN(sizeof(ScreenshotData), "screenshot");
+ ScrArea *sa = CTX_wm_area(C);
- scd->dumpsx= dumpsx;
- scd->dumpsy= dumpsy;
- scd->dumprect= dumprect;
+ scd->dumpsx = dumpsx;
+ scd->dumpsy = dumpsy;
+ scd->dumprect = dumprect;
if (sa) {
- scd->crop= sa->totrct;
+ scd->crop = sa->totrct;
}
BKE_imformat_defaults(&scd->im_format);
@@ -128,46 +128,46 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
return TRUE;
}
else {
- op->customdata= NULL;
+ op->customdata = NULL;
return FALSE;
}
}
static void screenshot_data_free(wmOperator *op)
{
- ScreenshotData *scd= op->customdata;
+ ScreenshotData *scd = op->customdata;
if (scd) {
if (scd->dumprect)
MEM_freeN(scd->dumprect);
MEM_freeN(scd);
- op->customdata= NULL;
+ op->customdata = NULL;
}
}
static void screenshot_crop(ImBuf *ibuf, rcti crop)
{
- unsigned int *to= ibuf->rect;
- unsigned int *from= ibuf->rect + crop.ymin*ibuf->x + crop.xmin;
- int y, cropw= crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
+ unsigned int *to = ibuf->rect;
+ unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin;
+ int y, cropw = crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
if (cropw > 0 && croph > 0) {
- for (y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
- memmove(to, from, sizeof(unsigned int)*cropw);
+ for (y = 0; y < croph; y++, to += cropw, from += ibuf->x)
+ memmove(to, from, sizeof(unsigned int) * cropw);
- ibuf->x= cropw;
- ibuf->y= croph;
+ ibuf->x = cropw;
+ ibuf->y = croph;
}
}
static int screenshot_exec(bContext *C, wmOperator *op)
{
- ScreenshotData *scd= op->customdata;
+ ScreenshotData *scd = op->customdata;
if (scd == NULL) {
/* when running exec directly */
screenshot_data_create(C, op);
- scd= op->customdata;
+ scd = op->customdata;
}
if (scd) {
@@ -179,8 +179,8 @@ static int screenshot_exec(bContext *C, wmOperator *op)
BLI_path_abs(path, G.main->name);
/* operator ensures the extension */
- ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
- ibuf->rect= scd->dumprect;
+ ibuf = IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
+ ibuf->rect = scd->dumprect;
/* crop to show only single editor */
if (!RNA_boolean_get(op->ptr, "full"))
@@ -266,7 +266,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->flag = 0;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screenshot the whole Blender window");
}
@@ -285,7 +285,7 @@ typedef struct ScreenshotJob {
static void screenshot_freejob(void *sjv)
{
- ScreenshotJob *sj= sjv;
+ ScreenshotJob *sj = sjv;
if (sj->dumprect)
MEM_freeN(sj->dumprect);
@@ -297,15 +297,15 @@ static void screenshot_freejob(void *sjv)
/* called before redraw notifiers, copies a new dumprect */
static void screenshot_updatejob(void *sjv)
{
- ScreenshotJob *sj= sjv;
+ ScreenshotJob *sj = sjv;
unsigned int *dumprect;
- if (sj->dumprect==NULL) {
- dumprect= MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
+ if (sj->dumprect == NULL) {
+ dumprect = MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
glFinish();
- sj->dumprect= dumprect;
+ sj->dumprect = dumprect;
}
}
@@ -313,13 +313,13 @@ static void screenshot_updatejob(void *sjv)
/* only this runs inside thread */
static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress))
{
- ScreenshotJob *sj= sjv;
- RenderData rd= sj->scene->r;
- bMovieHandle *mh= BKE_movie_handle_get(sj->scene->r.im_format.imtype);
+ ScreenshotJob *sj = sjv;
+ RenderData rd = sj->scene->r;
+ bMovieHandle *mh = BKE_movie_handle_get(sj->scene->r.im_format.imtype);
/* we need this as local variables for renderdata */
- rd.frs_sec= U.scrcastfps;
- rd.frs_sec_base= 1.0f;
+ rd.frs_sec = U.scrcastfps;
+ rd.frs_sec_base = 1.0f;
if (BKE_imtype_is_movie(rd.im_format.imtype)) {
if (!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
@@ -328,20 +328,20 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
}
}
else
- mh= NULL;
+ mh = NULL;
- sj->stop= stop;
- sj->do_update= do_update;
+ sj->stop = stop;
+ sj->do_update = do_update;
- *do_update= 1; // wait for opengl rect
+ *do_update = 1; // wait for opengl rect
- while (*stop==0) {
+ while (*stop == 0) {
if (sj->dumprect) {
if (mh) {
if (mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
- sj->dumpsx, sj->dumpsy, &sj->reports))
+ sj->dumpsx, sj->dumpsy, &sj->reports))
{
BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
printf("Appended frame %d\n", rd.cfra);
@@ -351,16 +351,16 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
}
}
else {
- ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
+ ImBuf *ibuf = IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
char name[FILE_MAX];
int ok;
BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE);
- ibuf->rect= sj->dumprect;
- ok= BKE_imbuf_write(ibuf, name, &rd.im_format);
+ ibuf->rect = sj->dumprect;
+ ok = BKE_imbuf_write(ibuf, name, &rd.im_format);
- if (ok==0) {
+ if (ok == 0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
break;
@@ -375,9 +375,9 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
}
MEM_freeN(sj->dumprect);
- sj->dumprect= NULL;
+ sj->dumprect = NULL;
- *do_update= 1;
+ *do_update = 1;
rd.cfra++;
@@ -394,38 +394,38 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
static int screencast_exec(bContext *C, wmOperator *op)
{
- bScreen *screen= CTX_wm_screen(C);
- wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
- ScreenshotJob *sj= MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
+ bScreen *screen = CTX_wm_screen(C);
+ wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
+ ScreenshotJob *sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
/* setup sj */
if (RNA_boolean_get(op->ptr, "full")) {
- wmWindow *win= CTX_wm_window(C);
- sj->x= 0;
- sj->y= 0;
- sj->dumpsx= win->sizex;
- sj->dumpsy= win->sizey;
+ wmWindow *win = CTX_wm_window(C);
+ sj->x = 0;
+ sj->y = 0;
+ sj->dumpsx = win->sizex;
+ sj->dumpsy = win->sizey;
}
else {
- ScrArea *curarea= CTX_wm_area(C);
- sj->x= curarea->totrct.xmin;
- sj->y= curarea->totrct.ymin;
- sj->dumpsx= curarea->totrct.xmax - sj->x;
- sj->dumpsy= curarea->totrct.ymax - sj->y;
+ ScrArea *curarea = CTX_wm_area(C);
+ sj->x = curarea->totrct.xmin;
+ sj->y = curarea->totrct.ymin;
+ sj->dumpsx = curarea->totrct.xmax - sj->x;
+ sj->dumpsy = curarea->totrct.ymax - sj->y;
}
- sj->bmain= CTX_data_main(C);
- sj->scene= CTX_data_scene(C);
+ sj->bmain = CTX_data_main(C);
+ sj->scene = CTX_data_scene(C);
BKE_reports_init(&sj->reports, RPT_PRINT);
/* setup job */
WM_jobs_customdata(steve, sj, screenshot_freejob);
- WM_jobs_timer(steve, 0.1, 0, NC_SCREEN|ND_SCREENCAST);
+ WM_jobs_timer(steve, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
- WM_event_add_notifier(C, NC_SCREEN|ND_SCREENCAST, screen);
+ WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
return OPERATOR_FINISHED;
}
@@ -445,6 +445,3 @@ void SCREEN_OT_screencast(wmOperatorType *ot)
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screencast the whole Blender window");
}
-
-
-