diff options
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 1086 |
1 files changed, 543 insertions, 543 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index bb534d2b916..52e1f90606f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -78,35 +78,35 @@ #include "wm_window.h" -#include "screen_intern.h" /* own module include */ +#include "screen_intern.h" /* own module include */ -#define KM_MODAL_CANCEL 1 -#define KM_MODAL_APPLY 2 -#define KM_MODAL_STEP10 3 -#define KM_MODAL_STEP10_OFF 4 +#define KM_MODAL_CANCEL 1 +#define KM_MODAL_APPLY 2 +#define KM_MODAL_STEP10 3 +#define KM_MODAL_STEP10_OFF 4 /* ************** Exported Poll tests ********************** */ int ED_operator_regionactive(bContext *C) { - if (CTX_wm_window(C)==NULL) return 0; - if (CTX_wm_screen(C)==NULL) return 0; - if (CTX_wm_region(C)==NULL) return 0; + if (CTX_wm_window(C) == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; + if (CTX_wm_region(C) == NULL) return 0; return 1; } int ED_operator_areaactive(bContext *C) { - if (CTX_wm_window(C)==NULL) return 0; - if (CTX_wm_screen(C)==NULL) return 0; - if (CTX_wm_area(C)==NULL) return 0; + if (CTX_wm_window(C) == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; + if (CTX_wm_area(C) == NULL) return 0; return 1; } int ED_operator_screenactive(bContext *C) { - if (CTX_wm_window(C)==NULL) return 0; - if (CTX_wm_screen(C)==NULL) return 0; + if (CTX_wm_window(C) == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; return 1; } @@ -114,8 +114,8 @@ int ED_operator_screenactive(bContext *C) static int ED_operator_screenactive_norender(bContext *C) { if (G.rendering) return 0; - if (CTX_wm_window(C)==NULL) return 0; - if (CTX_wm_screen(C)==NULL) return 0; + if (CTX_wm_window(C) == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; return 1; } @@ -134,28 +134,28 @@ static int screen_active_editable(bContext *C) /* when mouse is over area-edge */ int ED_operator_screen_mainwinactive(bContext *C) { - if (CTX_wm_window(C)==NULL) return 0; - if (CTX_wm_screen(C)==NULL) return 0; - if (CTX_wm_screen(C)->subwinactive!=CTX_wm_screen(C)->mainwin) return 0; + if (CTX_wm_window(C) == NULL) return 0; + if (CTX_wm_screen(C) == NULL) return 0; + if (CTX_wm_screen(C)->subwinactive != CTX_wm_screen(C)->mainwin) return 0; return 1; } int ED_operator_scene_editable(bContext *C) { - Scene *scene= CTX_data_scene(C); - if (scene && scene->id.lib==NULL) + Scene *scene = CTX_data_scene(C); + if (scene && scene->id.lib == NULL) return 1; return 0; } int ED_operator_objectmode(bContext *C) { - Scene *scene= CTX_data_scene(C); - Object *obact= CTX_data_active_object(C); + Scene *scene = CTX_data_scene(C); + Object *obact = CTX_data_active_object(C); - if (scene==NULL || scene->id.lib) + if (scene == NULL || scene->id.lib) return 0; - if ( CTX_data_edit_object(C) ) + if (CTX_data_edit_object(C) ) return 0; /* add a check for ob->mode too? */ @@ -169,7 +169,7 @@ int ED_operator_objectmode(bContext *C) static int ed_spacetype_test(bContext *C, int type) { if (ED_operator_areaactive(C)) { - SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C); + SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C); return sl && (sl->spacetype == type); } return 0; @@ -193,7 +193,7 @@ int ED_operator_region_view3d_active(bContext *C) int ED_operator_animview_active(bContext *C) { if (ED_operator_areaactive(C)) { - SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C); + SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C); if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME))) return TRUE; } @@ -216,7 +216,7 @@ int ED_operator_outliner_active_no_editobject(bContext *C) { if (ed_spacetype_test(C, SPACE_OUTLINER)) { Object *ob = ED_object_active_context(C); - Object *obedit= CTX_data_edit_object(C); + Object *obedit = CTX_data_edit_object(C); if (ob && ob == obedit) return 0; else @@ -242,7 +242,7 @@ int ED_operator_buttons_active(bContext *C) int ED_operator_node_active(bContext *C) { - SpaceNode *snode= CTX_wm_space_node(C); + SpaceNode *snode = CTX_wm_space_node(C); if (snode && snode->edittree) return 1; @@ -313,8 +313,8 @@ int ED_operator_object_active_editable_font(bContext *C) int ED_operator_editmesh(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_MESH) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_MESH) return NULL != BMEdit_FromObject(obedit); return 0; } @@ -335,19 +335,19 @@ int ED_operator_editmesh_region_view3d(bContext *C) int ED_operator_editarmature(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_ARMATURE) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_ARMATURE) return NULL != ((bArmature *)obedit->data)->edbo; return 0; } int ED_operator_posemode(bContext *C) { - Object *obact= CTX_data_active_object(C); + Object *obact = CTX_data_active_object(C); if (obact && !(obact->mode & OB_MODE_EDIT)) { Object *obpose; - if ((obpose= BKE_object_pose_armature_get(obact))) { + if ((obpose = BKE_object_pose_armature_get(obact))) { if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { return 1; } @@ -360,8 +360,8 @@ int ED_operator_posemode(bContext *C) /* wrapper for ED_space_image_show_uvedit */ int ED_operator_uvedit(bContext *C) { - SpaceImage *sima= CTX_wm_space_image(C); - Object *obedit= CTX_data_edit_object(C); + SpaceImage *sima = CTX_wm_space_image(C); + Object *obedit = CTX_data_edit_object(C); return ED_space_image_show_uvedit(sima, obedit); } @@ -383,7 +383,7 @@ int ED_operator_uvmap(bContext *C) int ED_operator_editsurfcurve(bContext *C) { - Object *obedit= CTX_data_edit_object(C); + Object *obedit = CTX_data_edit_object(C); if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) return NULL != ((Curve *)obedit->data)->editnurb; return 0; @@ -400,51 +400,51 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C) int ED_operator_editcurve(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_CURVE) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_CURVE) return NULL != ((Curve *)obedit->data)->editnurb; return 0; } int ED_operator_editcurve_3d(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_CURVE) { - Curve *cu= (Curve *)obedit->data; + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_CURVE) { + Curve *cu = (Curve *)obedit->data; - return (cu->flag&CU_3D) && (NULL != cu->editnurb); + return (cu->flag & CU_3D) && (NULL != cu->editnurb); } return 0; } int ED_operator_editsurf(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_SURF) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_SURF) return NULL != ((Curve *)obedit->data)->editnurb; return 0; } int ED_operator_editfont(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_FONT) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_FONT) return NULL != ((Curve *)obedit->data)->editfont; return 0; } int ED_operator_editlattice(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_LATTICE) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_LATTICE) return NULL != ((Lattice *)obedit->data)->editlatt; return 0; } int ED_operator_editmball(bContext *C) { - Object *obedit= CTX_data_edit_object(C); - if (obedit && obedit->type==OB_MBALL) + Object *obedit = CTX_data_edit_object(C); + if (obedit && obedit->type == OB_MBALL) return NULL != ((MetaBall *)obedit->data)->editelems; return 0; } @@ -482,11 +482,11 @@ typedef struct sActionzoneData { /* used by other operators too */ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y) { - ScrArea *sa= NULL; - sa= scr->areabase.first; + ScrArea *sa = NULL; + sa = scr->areabase.first; while (sa) { if (BLI_in_rcti(&sa->totrct, x, y)) break; - sa= sa->next; + sa = sa->next; } return sa; @@ -495,15 +495,15 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y) /* quick poll to save operators to be created and handled */ static int actionzone_area_poll(bContext *C) { - wmWindow *win= CTX_wm_window(C); - ScrArea *sa= CTX_wm_area(C); + wmWindow *win = CTX_wm_window(C); + ScrArea *sa = CTX_wm_area(C); if (sa && win) { AZone *az; - int x= win->eventstate->x; - int y= win->eventstate->y; + int x = win->eventstate->x; + int y = win->eventstate->y; - for (az= sa->actionzones.first; az; az= az->next) + for (az = sa->actionzones.first; az; az = az->next) if (BLI_in_rcti(&az->rect, x, y)) return 1; } @@ -512,15 +512,15 @@ static int actionzone_area_poll(bContext *C) AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) { - AZone *az= NULL; + AZone *az = NULL; - for (az= sa->actionzones.first; az; az= az->next) { + for (az = sa->actionzones.first; az; az = az->next) { if (BLI_in_rcti(&az->rect, x, y)) { if (az->type == AZONE_AREA) { /* no triangle intersect but a hotspot circle based on corner */ - int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1); + int radius = (x - az->x1) * (x - az->x1) + (y - az->y1) * (y - az->y1); - if (radius <= AZONESPOT*AZONESPOT) + if (radius <= AZONESPOT * AZONESPOT) break; } else if (az->type == AZONE_REGION) { @@ -537,47 +537,47 @@ static void actionzone_exit(wmOperator *op) { if (op->customdata) MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata = NULL; } /* send EVT_ACTIONZONE event */ static void actionzone_apply(bContext *C, wmOperator *op, int type) { wmEvent event; - wmWindow *win= CTX_wm_window(C); - sActionzoneData *sad= op->customdata; + wmWindow *win = CTX_wm_window(C); + sActionzoneData *sad = op->customdata; - sad->modifier= RNA_int_get(op->ptr, "modifier"); + sad->modifier = RNA_int_get(op->ptr, "modifier"); - event= *(win->eventstate); /* XXX huh huh? make api call */ - if (type==AZONE_AREA) - event.type= EVT_ACTIONZONE_AREA; + event = *(win->eventstate); /* XXX huh huh? make api call */ + if (type == AZONE_AREA) + event.type = EVT_ACTIONZONE_AREA; else - event.type= EVT_ACTIONZONE_REGION; - event.customdata= op->customdata; - event.customdatafree= TRUE; - op->customdata= NULL; + event.type = EVT_ACTIONZONE_REGION; + event.customdata = op->customdata; + event.customdatafree = TRUE; + op->customdata = NULL; wm_event_add(win, &event); } static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) { - AZone *az= is_in_area_actionzone(CTX_wm_area(C), event->x, event->y); + AZone *az = is_in_area_actionzone(CTX_wm_area(C), event->x, event->y); sActionzoneData *sad; /* quick escape */ - if (az==NULL) + if (az == NULL) return OPERATOR_PASS_THROUGH; /* ok we do the actionzone */ - sad= op->customdata= MEM_callocN(sizeof(sActionzoneData), "sActionzoneData"); - sad->sa1= CTX_wm_area(C); - sad->az= az; - sad->x= event->x; sad->y= event->y; + sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData"); + sad->sa1 = CTX_wm_area(C); + sad->az = az; + sad->x = event->x; sad->y = event->y; /* region azone directly reacts on mouse clicks */ - if (sad->az->type==AZONE_REGION) { + if (sad->az->type == AZONE_REGION) { actionzone_apply(C, op, AZONE_REGION); actionzone_exit(op); return OPERATOR_FINISHED; @@ -593,30 +593,30 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) { - sActionzoneData *sad= op->customdata; + sActionzoneData *sad = op->customdata; int deltax, deltay; - int mindelta= sad->az->type==AZONE_REGION?1:12; + int mindelta = sad->az->type == AZONE_REGION ? 1 : 12; switch (event->type) { case MOUSEMOVE: /* calculate gesture direction */ - deltax= (event->x - sad->x); - deltay= (event->y - sad->y); + deltax = (event->x - sad->x); + deltay = (event->y - sad->y); if (deltay > ABS(deltax)) - sad->gesture_dir= 'n'; + sad->gesture_dir = 'n'; else if (deltax > ABS(deltay)) - sad->gesture_dir= 'e'; + sad->gesture_dir = 'e'; else if (deltay < -ABS(deltax)) - sad->gesture_dir= 's'; + sad->gesture_dir = 's'; else - sad->gesture_dir= 'w'; + sad->gesture_dir = 'w'; /* gesture is large enough? */ if (ABS(deltax) > mindelta || ABS(deltay) > mindelta) { /* second area, for join */ - sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); + sad->sa2 = screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* apply sends event */ actionzone_apply(C, op, sad->az->type); actionzone_exit(op); @@ -688,16 +688,16 @@ typedef struct sAreaSwapData { static int area_swap_init(wmOperator *op, wmEvent *event) { - sAreaSwapData *sd= NULL; - sActionzoneData *sad= event->customdata; + sAreaSwapData *sd = NULL; + sActionzoneData *sad = event->customdata; - if (sad==NULL || sad->sa1==NULL) + if (sad == NULL || sad->sa1 == NULL) return 0; - sd= MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData"); - sd->sa1= sad->sa1; - sd->sa2= sad->sa2; - op->customdata= sd; + sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData"); + sd->sa1 = sad->sa1; + sd->sa2 = sad->sa2; + op->customdata = sd; return 1; } @@ -708,7 +708,7 @@ static void area_swap_exit(bContext *C, wmOperator *op) WM_cursor_restore(CTX_wm_window(C)); if (op->customdata) MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata = NULL; } static int area_swap_cancel(bContext *C, wmOperator *op) @@ -733,15 +733,15 @@ static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event) static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event) { - sActionzoneData *sad= op->customdata; + sActionzoneData *sad = op->customdata; switch (event->type) { case MOUSEMOVE: /* second area, for join */ - sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); + sad->sa2 = screen_areahascursor(CTX_wm_screen(C), event->x, event->y); break; case LEFTMOUSE: /* release LMB */ - if (event->val==KM_RELEASE) { + if (event->val == KM_RELEASE) { if (!sad->sa2 || sad->sa1 == sad->sa2) { return area_swap_cancel(C, op); @@ -754,7 +754,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event) area_swap_exit(C, op); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -790,35 +790,35 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) ScrArea *sa; rcti rect; - win= CTX_wm_window(C); - sc= CTX_wm_screen(C); - sa= CTX_wm_area(C); + win = CTX_wm_window(C); + sc = CTX_wm_screen(C); + sa = CTX_wm_area(C); /* XXX hrmf! */ - if (event->type==EVT_ACTIONZONE_AREA) { - sActionzoneData *sad= event->customdata; + if (event->type == EVT_ACTIONZONE_AREA) { + sActionzoneData *sad = event->customdata; - if (sad==NULL) + if (sad == NULL) return OPERATOR_PASS_THROUGH; - sa= sad->sa1; + sa = sad->sa1; } /* poll() checks area context, but we don't accept full-area windows */ if (sc->full != SCREENNORMAL) { - if (event->type==EVT_ACTIONZONE_AREA) + if (event->type == EVT_ACTIONZONE_AREA) actionzone_exit(op); return OPERATOR_CANCELLED; } /* adds window to WM */ - rect= sa->totrct; + rect = sa->totrct; BLI_translate_rcti(&rect, win->posx, win->posy); - newwin= WM_window_open(C, &rect); + newwin = WM_window_open(C, &rect); /* allocs new screen and adds to newly created window, using window size */ - newsc= ED_screen_add(newwin, CTX_data_scene(C), sc->id.name+2); - newwin->screen= newsc; + newsc = ED_screen_add(newwin, CTX_data_scene(C), sc->id.name + 2); + newwin->screen = newsc; /* copy area to new screen */ area_copy_data((ScrArea *)newsc->areabase.first, sa, 0); @@ -826,9 +826,9 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_area_tag_redraw((ScrArea *)newsc->areabase.first); /* screen, areas init */ - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); - if (event->type==EVT_ACTIONZONE_AREA) + if (event->type == EVT_ACTIONZONE_AREA) actionzone_exit(op); return OPERATOR_FINISHED; @@ -848,7 +848,7 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot) /* ************** move area edge operator *********************************** */ /* operator state vars used: - * x, y mouse coord near edge + * x, y mouse coord near edge * delta movement of edge * * functions: @@ -884,56 +884,56 @@ typedef struct sAreaMoveData { static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller) { ScrArea *sa; - int areaminy= ED_area_headersize()+1; + int areaminy = ED_area_headersize() + 1; /* we check all areas and test for free space with MINSIZE */ - *bigger= *smaller= 100000; + *bigger = *smaller = 100000; - for (sa= sc->areabase.first; sa; sa= sa->next) { - if (dir=='h') { - int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy; + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (dir == 'h') { + int y1 = sa->v2->vec.y - sa->v1->vec.y - areaminy; /* if top or down edge selected, test height */ if (sa->v1->flag && sa->v4->flag) - *bigger= MIN2(*bigger, y1); + *bigger = MIN2(*bigger, y1); else if (sa->v2->flag && sa->v3->flag) - *smaller= MIN2(*smaller, y1); + *smaller = MIN2(*smaller, y1); } else { - int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX; + int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX; /* if left or right edge selected, test width */ if (sa->v1->flag && sa->v2->flag) - *bigger= MIN2(*bigger, x1); + *bigger = MIN2(*bigger, x1); else if (sa->v3->flag && sa->v4->flag) - *smaller= MIN2(*smaller, x1); + *smaller = MIN2(*smaller, x1); } } } /* validate selection inside screen, set variables OK */ /* return 0: init failed */ -static int area_move_init (bContext *C, wmOperator *op) +static int area_move_init(bContext *C, wmOperator *op) { - bScreen *sc= CTX_wm_screen(C); + bScreen *sc = CTX_wm_screen(C); ScrEdge *actedge; sAreaMoveData *md; int x, y; /* required properties */ - x= RNA_int_get(op->ptr, "x"); - y= RNA_int_get(op->ptr, "y"); + x = RNA_int_get(op->ptr, "x"); + y = RNA_int_get(op->ptr, "y"); /* setup */ - actedge= screen_find_active_scredge(sc, x, y); - if (actedge==NULL) return 0; + actedge = screen_find_active_scredge(sc, x, y); + if (actedge == NULL) return 0; - md= MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData"); - op->customdata= md; + md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData"); + op->customdata = md; - md->dir= scredge_is_horizontal(actedge)?'h':'v'; - if (md->dir=='h') md->origval= actedge->v1->vec.y; - else md->origval= actedge->v1->vec.x; + md->dir = scredge_is_horizontal(actedge) ? 'h' : 'v'; + if (md->dir == 'h') md->origval = actedge->v1->vec.y; + else md->origval = actedge->v1->vec.x; select_connected_scredge(sc, actedge); /* now all vertices with 'flag==1' are the ones that can be moved. */ @@ -946,48 +946,48 @@ static int area_move_init (bContext *C, wmOperator *op) /* moves selected screen edge amount of delta, used by split & move */ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bigger, int smaller) { - wmWindow *win= CTX_wm_window(C); - bScreen *sc= CTX_wm_screen(C); + wmWindow *win = CTX_wm_window(C); + bScreen *sc = CTX_wm_screen(C); ScrVert *v1; ScrArea *sa; - int areaminy= ED_area_headersize()+1; + int areaminy = ED_area_headersize() + 1; - delta= CLAMPIS(delta, -smaller, bigger); + delta = CLAMPIS(delta, -smaller, bigger); - for (v1= sc->vertbase.first; v1; v1= v1->next) { + for (v1 = sc->vertbase.first; v1; v1 = v1->next) { if (v1->flag) { /* that way a nice AREAGRID */ - if ((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) { - v1->vec.x= origval + delta; - if (delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID); + if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < win->sizex - 1) { + v1->vec.x = origval + delta; + if (delta != bigger && delta != -smaller) v1->vec.x -= (v1->vec.x % AREAGRID); } - if ((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) { - v1->vec.y= origval + delta; + if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < win->sizey - 1) { + v1->vec.y = origval + delta; - v1->vec.y+= AREAGRID-1; - v1->vec.y-= (v1->vec.y % AREAGRID); + v1->vec.y += AREAGRID - 1; + v1->vec.y -= (v1->vec.y % AREAGRID); /* prevent too small top header */ - if (v1->vec.y > win->sizey-areaminy) - v1->vec.y= win->sizey-areaminy; + if (v1->vec.y > win->sizey - areaminy) + v1->vec.y = win->sizey - areaminy; } } } - for (sa= sc->areabase.first; sa; sa= sa->next) { + for (sa = sc->areabase.first; sa; sa = sa->next) { if (sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag) ED_area_tag_redraw(sa); } - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); /* redraw everything */ + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* redraw everything */ } static void area_move_apply(bContext *C, wmOperator *op) { - sAreaMoveData *md= op->customdata; + sAreaMoveData *md = op->customdata; int delta; - delta= RNA_int_get(op->ptr, "delta"); + delta = RNA_int_get(op->ptr, "delta"); area_move_apply_do(C, md->origval, delta, md->dir, md->bigger, md->smaller); } @@ -995,7 +995,7 @@ static void area_move_exit(bContext *C, wmOperator *op) { if (op->customdata) MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata = NULL; /* this makes sure aligned edges will result in aligned grabbing */ removedouble_scrverts(CTX_wm_screen(C)); @@ -1041,18 +1041,18 @@ static int area_move_cancel(bContext *C, wmOperator *op) /* modal callback for while moving edges */ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event) { - sAreaMoveData *md= op->customdata; + sAreaMoveData *md = op->customdata; int delta, x, y; /* execute the events */ switch (event->type) { case MOUSEMOVE: - x= RNA_int_get(op->ptr, "x"); - y= RNA_int_get(op->ptr, "y"); + x = RNA_int_get(op->ptr, "x"); + y = RNA_int_get(op->ptr, "y"); - delta= (md->dir == 'v')? event->x - x: event->y - y; - if (md->step) delta= delta - (delta % md->step); + delta = (md->dir == 'v') ? event->x - x : event->y - y; + if (md->step) delta = delta - (delta % md->step); RNA_int_set(op->ptr, "delta", delta); area_move_apply(C, op); @@ -1069,10 +1069,10 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event) return area_move_cancel(C, op); case KM_MODAL_STEP10: - md->step= 10; + md->step = 10; break; case KM_MODAL_STEP10_OFF: - md->step= 0; + md->step = 0; break; } } @@ -1109,7 +1109,7 @@ static void SCREEN_OT_area_move(wmOperatorType *ot) * dir direction 'v' or 'h' * * operator customdata: - * area pointer to (active) area + * area pointer to (active) area * x, y last used mouse pos * (more, see below) * @@ -1137,21 +1137,21 @@ static void SCREEN_OT_area_move(wmOperatorType *ot) * call exit() or cancel() and remove handler */ -#define SPLIT_STARTED 1 -#define SPLIT_PROGRESS 2 +#define SPLIT_STARTED 1 +#define SPLIT_PROGRESS 2 typedef struct sAreaSplitData { - int x, y; /* last used mouse position */ - - int origval; /* for move areas */ - int bigger, smaller; /* constraints for moving new edge */ - int delta; /* delta move edge */ - int origmin, origsize; /* to calculate fac, for property storage */ - int previewmode; /* draw previewline, then split */ + int x, y; /* last used mouse position */ - ScrEdge *nedge; /* new edge */ - ScrArea *sarea; /* start area */ - ScrArea *narea; /* new area */ + int origval; /* for move areas */ + int bigger, smaller; /* constraints for moving new edge */ + int delta; /* delta move edge */ + int origmin, origsize; /* to calculate fac, for property storage */ + int previewmode; /* draw previewline, then split */ + + ScrEdge *nedge; /* new edge */ + ScrArea *sarea; /* start area */ + ScrArea *narea; /* new area */ } sAreaSplitData; @@ -1161,15 +1161,15 @@ static int area_split_menu_init(bContext *C, wmOperator *op) sAreaSplitData *sd; /* custom data */ - sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split"); - op->customdata= sd; + sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split"); + op->customdata = sd; - sd->sarea= CTX_wm_area(C); + sd->sarea = CTX_wm_area(C); if (sd->sarea) { - int dir= RNA_enum_get(op->ptr, "direction"); + int dir = RNA_enum_get(op->ptr, "direction"); - if (dir=='h') + if (dir == 'h') sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H; else sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V; @@ -1180,28 +1180,28 @@ static int area_split_menu_init(bContext *C, wmOperator *op) /* generic init, no UI stuff here, assumes active area */ static int area_split_init(bContext *C, wmOperator *op) { - ScrArea *sa= CTX_wm_area(C); + ScrArea *sa = CTX_wm_area(C); sAreaSplitData *sd; - int areaminy= ED_area_headersize()+1; + int areaminy = ED_area_headersize() + 1; int dir; /* required context */ - if (sa==NULL) return 0; + if (sa == NULL) return 0; /* required properties */ - dir= RNA_enum_get(op->ptr, "direction"); + dir = RNA_enum_get(op->ptr, "direction"); /* minimal size */ - if (dir=='v' && sa->winx < 2*AREAMINX) return 0; - if (dir=='h' && sa->winy < 2*areaminy) return 0; + if (dir == 'v' && sa->winx < 2 * AREAMINX) return 0; + if (dir == 'h' && sa->winy < 2 * areaminy) return 0; /* custom data */ - sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split"); - op->customdata= sd; + sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split"); + op->customdata = sd; - sd->sarea= sa; - sd->origsize= dir=='v' ? sa->winx:sa->winy; - sd->origmin = dir=='v' ? sa->totrct.xmin:sa->totrct.ymin; + sd->sarea = sa; + sd->origsize = dir == 'v' ? sa->winx : sa->winy; + sd->origmin = dir == 'v' ? sa->totrct.xmin : sa->totrct.ymin; return 1; } @@ -1210,25 +1210,25 @@ static int area_split_init(bContext *C, wmOperator *op) /* used with split operator */ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb) { - ScrVert *sav1= sa->v1; - ScrVert *sav2= sa->v2; - ScrVert *sav3= sa->v3; - ScrVert *sav4= sa->v4; - ScrVert *sbv1= sb->v1; - ScrVert *sbv2= sb->v2; - ScrVert *sbv3= sb->v3; - ScrVert *sbv4= sb->v4; + ScrVert *sav1 = sa->v1; + ScrVert *sav2 = sa->v2; + ScrVert *sav3 = sa->v3; + ScrVert *sav4 = sa->v4; + ScrVert *sbv1 = sb->v1; + ScrVert *sbv2 = sb->v2; + ScrVert *sbv3 = sb->v3; + ScrVert *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 screen_findedge(screen, sav1, sav2); } - 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 screen_findedge(screen, sav2, sav3); } - 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 screen_findedge(screen, sav3, sav4); } - 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 screen_findedge(screen, sav1, sav4); } @@ -1239,35 +1239,35 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb) /* do the split, return success */ static int area_split_apply(bContext *C, wmOperator *op) { - bScreen *sc= CTX_wm_screen(C); - sAreaSplitData *sd= (sAreaSplitData *)op->customdata; + bScreen *sc = CTX_wm_screen(C); + sAreaSplitData *sd = (sAreaSplitData *)op->customdata; float fac; int dir; - fac= RNA_float_get(op->ptr, "factor"); - dir= RNA_enum_get(op->ptr, "direction"); + fac = RNA_float_get(op->ptr, "factor"); + dir = RNA_enum_get(op->ptr, "direction"); - sd->narea= area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */ + sd->narea = area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */ if (sd->narea) { ScrVert *sv; - sd->nedge= area_findsharededge(sc, sd->sarea, sd->narea); + sd->nedge = area_findsharededge(sc, sd->sarea, sd->narea); /* select newly created edge, prepare for moving edge */ - for (sv= sc->vertbase.first; sv; sv= sv->next) + for (sv = sc->vertbase.first; sv; sv = sv->next) sv->flag = 0; - sd->nedge->v1->flag= 1; - sd->nedge->v2->flag= 1; + sd->nedge->v1->flag = 1; + sd->nedge->v2->flag = 1; - if (dir=='h') sd->origval= sd->nedge->v1->vec.y; - else sd->origval= sd->nedge->v1->vec.x; + if (dir == 'h') sd->origval = sd->nedge->v1->vec.y; + else sd->origval = sd->nedge->v1->vec.x; ED_area_tag_redraw(sd->sarea); ED_area_tag_redraw(sd->narea); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return 1; } @@ -1278,19 +1278,19 @@ static int area_split_apply(bContext *C, wmOperator *op) static void area_split_exit(bContext *C, wmOperator *op) { if (op->customdata) { - sAreaSplitData *sd= (sAreaSplitData *)op->customdata; + sAreaSplitData *sd = (sAreaSplitData *)op->customdata; if (sd->sarea) ED_area_tag_redraw(sd->sarea); if (sd->narea) ED_area_tag_redraw(sd->narea); if (sd->sarea) - sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V); + sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V); MEM_freeN(op->customdata); op->customdata = NULL; } WM_cursor_restore(CTX_wm_window(C)); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* this makes sure aligned edges will result in aligned grabbing */ removedouble_scrverts(CTX_wm_screen(C)); @@ -1308,28 +1308,28 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) if (CTX_wm_screen(C)->full != SCREENNORMAL) return OPERATOR_CANCELLED; - if (event->type==EVT_ACTIONZONE_AREA) { - sActionzoneData *sad= event->customdata; + if (event->type == EVT_ACTIONZONE_AREA) { + sActionzoneData *sad = event->customdata; - if (sad->modifier>0) { + if (sad->modifier > 0) { return OPERATOR_PASS_THROUGH; } /* verify *sad itself */ - if (sad==NULL || sad->sa1==NULL || sad->az==NULL) + if (sad == NULL || sad->sa1 == NULL || sad->az == NULL) return OPERATOR_PASS_THROUGH; /* is this our *sad? if areas not equal it should be passed on */ - if (CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2) + if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2) return OPERATOR_PASS_THROUGH; /* prepare operator state vars */ - if (sad->gesture_dir=='n' || sad->gesture_dir=='s') { - dir= 'h'; + if (sad->gesture_dir == 'n' || sad->gesture_dir == 's') { + dir = 'h'; RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx); } else { - dir= 'v'; + dir = 'v'; RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); } RNA_enum_set(op->ptr, "direction", dir); @@ -1345,20 +1345,20 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) /* retrieve initial mouse coord, so we can find the active edge */ if (RNA_struct_property_is_set(op->ptr, "mouse_x")) - x= RNA_int_get(op->ptr, "mouse_x"); + x = RNA_int_get(op->ptr, "mouse_x"); else - x= event->x; + x = event->x; if (RNA_struct_property_is_set(op->ptr, "mouse_y")) - y= RNA_int_get(op->ptr, "mouse_y"); + y = RNA_int_get(op->ptr, "mouse_y"); else - y= event->x; + y = event->x; - actedge= screen_find_active_scredge(CTX_wm_screen(C), x, y); - if (actedge==NULL) + actedge = screen_find_active_scredge(CTX_wm_screen(C), x, y); + if (actedge == NULL) return OPERATOR_CANCELLED; - dir= scredge_is_horizontal(actedge)?'v':'h'; + dir = scredge_is_horizontal(actedge) ? 'v' : 'h'; RNA_enum_set(op->ptr, "direction", dir); @@ -1368,12 +1368,12 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) } - sd= (sAreaSplitData *)op->customdata; + sd = (sAreaSplitData *)op->customdata; - sd->x= event->x; - sd->y= event->y; + sd->x = event->x; + sd->y = event->y; - if (event->type==EVT_ACTIONZONE_AREA) { + if (event->type == EVT_ACTIONZONE_AREA) { /* do the split */ if (area_split_apply(C, op)) { @@ -1386,7 +1386,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) } } else { - sd->previewmode= 1; + sd->previewmode = 1; /* add temp handler for edge move or cancel */ WM_event_add_modal_handler(C, op); @@ -1413,7 +1413,7 @@ static int area_split_exec(bContext *C, wmOperator *op) static int area_split_cancel(bContext *C, wmOperator *op) { - sAreaSplitData *sd= (sAreaSplitData *)op->customdata; + sAreaSplitData *sd = (sAreaSplitData *)op->customdata; if (sd->previewmode) { } @@ -1433,44 +1433,44 @@ static int area_split_cancel(bContext *C, wmOperator *op) static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event) { - sAreaSplitData *sd= (sAreaSplitData *)op->customdata; + sAreaSplitData *sd = (sAreaSplitData *)op->customdata; float fac; int dir; /* execute the events */ switch (event->type) { case MOUSEMOVE: - dir= RNA_enum_get(op->ptr, "direction"); + dir = RNA_enum_get(op->ptr, "direction"); - sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval; - if (sd->previewmode==0) + sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval; + if (sd->previewmode == 0) area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller); else { if (sd->sarea) { - sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V); + sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V); ED_area_tag_redraw(sd->sarea); } - sd->sarea= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */ + sd->sarea = screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */ if (sd->sarea) { ED_area_tag_redraw(sd->sarea); - if (dir=='v') { - sd->origsize= sd->sarea->winx; - sd->origmin= sd->sarea->totrct.xmin; + if (dir == 'v') { + sd->origsize = sd->sarea->winx; + sd->origmin = sd->sarea->totrct.xmin; sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V; } else { - sd->origsize= sd->sarea->winy; - sd->origmin= sd->sarea->totrct.ymin; + sd->origsize = sd->sarea->winy; + sd->origmin = sd->sarea->totrct.ymin; sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H; } } - CTX_wm_window(C)->screen->do_draw= 1; + CTX_wm_window(C)->screen->do_draw = 1; } - fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin; + fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin; RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize); break; @@ -1482,7 +1482,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } else { - if (event->val==KM_RELEASE) { /* mouse up */ + if (event->val == KM_RELEASE) { /* mouse up */ area_split_exit(C, op); return OPERATOR_FINISHED; } @@ -1491,17 +1491,17 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: case TABKEY: - if (sd->previewmode==0) { + if (sd->previewmode == 0) { } else { dir = RNA_enum_get(op->ptr, "direction"); - if (event->val==KM_PRESS) { + if (event->val == KM_PRESS) { if (sd->sarea) { - sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V); + sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V); ED_area_tag_redraw(sd->sarea); - if (dir=='v') { + if (dir == 'v') { RNA_enum_set(op->ptr, "direction", 'h'); sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H; @@ -1528,9 +1528,10 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event) } static EnumPropertyItem prop_direction_items[] = { -{'h', "HORIZONTAL", 0, "Horizontal", ""}, -{'v', "VERTICAL", 0, "Vertical", ""}, -{0, NULL, 0, NULL, NULL}}; + {'h', "HORIZONTAL", 0, "Horizontal", ""}, + {'v', "VERTICAL", 0, "Vertical", ""}, + {0, NULL, 0, NULL, NULL} +}; static void SCREEN_OT_area_split(wmOperatorType *ot) { @@ -1574,16 +1575,16 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) ARegion *ar; int dist; - if (edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) { + if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) { dist = sa->totrct.xmax - sa->totrct.xmin; } - else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ + else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ dist = sa->totrct.ymax - sa->totrct.ymin; } /* subtractwidth of regions on opposite side * prevents dragging regions into other opposite regions */ - for (ar=sa->regionbase.first; ar; ar=ar->next) { + for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar == scalear) continue; @@ -1609,10 +1610,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event) { - sActionzoneData *sad= event->customdata; + sActionzoneData *sad = event->customdata; AZone *az; - if (event->type!=EVT_ACTIONZONE_REGION) { + if (event->type != EVT_ACTIONZONE_REGION) { BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone"); return OPERATOR_CANCELLED; } @@ -1620,31 +1621,31 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event) az = sad->az; if (az->ar) { - RegionMoveData *rmd= MEM_callocN(sizeof(RegionMoveData), "RegionMoveData"); + RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData"); int maxsize; - op->customdata= rmd; + op->customdata = rmd; rmd->az = az; - rmd->ar= az->ar; + rmd->ar = az->ar; rmd->sa = sad->sa1; - rmd->edge= az->edge; - rmd->origx= event->x; - rmd->origy= event->y; + rmd->edge = az->edge; + rmd->origx = event->x; + rmd->origy = event->y; rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge); /* if not set we do now, otherwise it uses type */ - if (rmd->ar->sizex==0) - rmd->ar->sizex= rmd->ar->type->prefsizex; - if (rmd->ar->sizey==0) - rmd->ar->sizey= rmd->ar->type->prefsizey; + if (rmd->ar->sizex == 0) + rmd->ar->sizex = rmd->ar->type->prefsizex; + if (rmd->ar->sizey == 0) + rmd->ar->sizey = rmd->ar->type->prefsizey; /* now copy to regionmovedata */ - if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) { - rmd->origval= rmd->ar->sizex; + if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { + rmd->origval = rmd->ar->sizex; } else { - rmd->origval= rmd->ar->sizey; + rmd->origval = rmd->ar->sizey; } /* limit headers to standard height for now */ @@ -1666,16 +1667,16 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event) static int region_scale_get_maxsize(RegionMoveData *rmd) { - int maxsize= 0; + int maxsize = 0; - if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) { + if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { return rmd->sa->winx - UI_UNIT_X; } if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) { /* this calculation seems overly verbose * can someone explain why this method is necessary? - campbell */ - maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4); + maxsize = rmd->maxsize - ((rmd->sa->headertype == HEADERTOP) ? UI_UNIT_Y * 2 : UI_UNIT_Y) - (UI_UNIT_Y / 4); } return maxsize; @@ -1683,19 +1684,19 @@ static int region_scale_get_maxsize(RegionMoveData *rmd) static void region_scale_validate_size(RegionMoveData *rmd) { - if ((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) { - short *size, maxsize= -1; + if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) { + short *size, maxsize = -1; - if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) - size= &rmd->ar->sizex; + if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) + size = &rmd->ar->sizex; else - size= &rmd->ar->sizey; + size = &rmd->ar->sizey; - maxsize= region_scale_get_maxsize(rmd); + maxsize = region_scale_get_maxsize(rmd); if (*size > maxsize && maxsize > 0) - *size= maxsize; + *size = maxsize; } } @@ -1707,22 +1708,22 @@ static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd) static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) { - RegionMoveData *rmd= op->customdata; + RegionMoveData *rmd = op->customdata; int delta; /* execute the events */ switch (event->type) { case MOUSEMOVE: - if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) { - delta= event->x - rmd->origx; - if (rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta; + if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) { + delta = event->x - rmd->origx; + if (rmd->edge == AE_LEFT_TO_TOPRIGHT) delta = -delta; - rmd->ar->sizex= rmd->origval + delta; + rmd->ar->sizex = rmd->origval + delta; CLAMP(rmd->ar->sizex, 0, rmd->maxsize); if (rmd->ar->sizex < UI_UNIT_X) { - rmd->ar->sizex= rmd->origval; + rmd->ar->sizex = rmd->origval; if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) region_scale_toggle_hidden(C, rmd); } @@ -1730,33 +1731,33 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) region_scale_toggle_hidden(C, rmd); } else { - int maxsize= region_scale_get_maxsize(rmd); - delta= event->y - rmd->origy; - if (rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta; + int maxsize = region_scale_get_maxsize(rmd); + delta = event->y - rmd->origy; + if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) delta = -delta; - rmd->ar->sizey= rmd->origval + delta; + rmd->ar->sizey = rmd->origval + delta; CLAMP(rmd->ar->sizey, 0, rmd->maxsize); /* note, 'UI_UNIT_Y/4' means you need to drag the header almost * all the way down for it to become hidden, this is done * otherwise its too easy to do this by accident */ - if (rmd->ar->sizey < UI_UNIT_Y/4) { - rmd->ar->sizey= rmd->origval; + if (rmd->ar->sizey < UI_UNIT_Y / 4) { + rmd->ar->sizey = rmd->origval; if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) region_scale_toggle_hidden(C, rmd); } else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) - rmd->ar->sizey= maxsize; + rmd->ar->sizey = maxsize; else if (rmd->ar->flag & RGN_FLAG_HIDDEN) region_scale_toggle_hidden(C, rmd); } ED_area_tag_redraw(rmd->sa); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); break; case LEFTMOUSE: - if (event->val==KM_RELEASE) { + if (event->val == KM_RELEASE) { if (ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) { if (rmd->ar->flag & RGN_FLAG_HIDDEN) { @@ -1767,7 +1768,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) } ED_area_tag_redraw(rmd->sa); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } MEM_freeN(op->customdata); op->customdata = NULL; @@ -1813,8 +1814,8 @@ static void SCREEN_OT_region_scale(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int frame_offset_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); int delta; delta = RNA_int_get(op->ptr, "delta"); @@ -1825,7 +1826,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op) sound_seek_scene(bmain, scene); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C)); return OPERATOR_FINISHED; } @@ -1849,9 +1850,9 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int frame_jump_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - wmTimer *animtimer= CTX_wm_screen(C)->animtimer; + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + wmTimer *animtimer = CTX_wm_screen(C)->animtimer; /* Don't change CFRA directly if animtimer is running as this can cause * first/last frame not to be actually shown (bad since for example physics @@ -1863,19 +1864,19 @@ static int frame_jump_exec(bContext *C, wmOperator *op) sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME; if (RNA_boolean_get(op->ptr, "end")) - sad->nextfra= PEFRA; + sad->nextfra = PEFRA; else - sad->nextfra= PSFRA; + sad->nextfra = PSFRA; } else { if (RNA_boolean_get(op->ptr, "end")) - CFRA= PEFRA; + CFRA = PEFRA; else - CFRA= PSFRA; + CFRA = PSFRA; sound_seek_scene(bmain, scene); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } return OPERATOR_FINISHED; @@ -1902,21 +1903,21 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int keyframe_jump_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - bDopeSheet ads= {NULL}; + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + Object *ob = CTX_data_active_object(C); + bDopeSheet ads = {NULL}; DLRBT_Tree keys; ActKeyColumn *ak; float cfra; - short next= RNA_boolean_get(op->ptr, "next"); + short next = RNA_boolean_get(op->ptr, "next"); short done = 0; /* sanity checks */ if (scene == NULL) return OPERATOR_CANCELLED; - cfra= (float)(CFRA); + cfra = (float)(CFRA); /* init binarytree-list for getting keyframes */ BLI_dlrbTree_init(&keys); @@ -1933,14 +1934,14 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) /* find matching keyframe in the right direction */ do { if (next) - ak= (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra); + ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra); else - ak= (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra); + ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra); if (ak) { if (CFRA != (int)ak->cfra) { /* this changes the frame, so set the frame and we're done */ - CFRA= (int)ak->cfra; + CFRA = (int)ak->cfra; done = 1; } else { @@ -1959,7 +1960,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) sound_seek_scene(bmain, scene); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); return OPERATOR_FINISHED; } @@ -1985,35 +1986,35 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ static int screen_set_exec(bContext *C, wmOperator *op) { - bScreen *screen= CTX_wm_screen(C); - bScreen *screen_prev= screen; + bScreen *screen = CTX_wm_screen(C); + bScreen *screen_prev = screen; - ScrArea *sa= CTX_wm_area(C); - int tot= BLI_countlist(&CTX_data_main(C)->screen); - int delta= RNA_int_get(op->ptr, "delta"); + ScrArea *sa = CTX_wm_area(C); + int tot = BLI_countlist(&CTX_data_main(C)->screen); + int delta = RNA_int_get(op->ptr, "delta"); /* temp screens are for userpref or render display */ if (screen->temp) return OPERATOR_CANCELLED; - if (delta==1) { + if (delta == 1) { while (tot--) { - screen= screen->id.next; - if (screen==NULL) screen= CTX_data_main(C)->screen.first; - if (screen->winid==0 && screen->full==0 && screen != screen_prev) + screen = screen->id.next; + if (screen == NULL) screen = CTX_data_main(C)->screen.first; + if (screen->winid == 0 && screen->full == 0 && screen != screen_prev) break; } } - else if (delta== -1) { + else if (delta == -1) { while (tot--) { - screen= screen->id.prev; - if (screen==NULL) screen= CTX_data_main(C)->screen.last; - if (screen->winid==0 && screen->full==0 && screen != screen_prev) + screen = screen->id.prev; + if (screen == NULL) screen = CTX_data_main(C)->screen.last; + if (screen->winid == 0 && screen->full == 0 && screen != screen_prev) break; } } else { - screen= NULL; + screen = NULL; } if (screen && screen_prev != screen) { @@ -2048,15 +2049,15 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa=NULL; + ScrArea *sa = NULL; /* search current screen for 'fullscreen' areas */ /* prevents restoring info header, when mouse is over it */ - for (sa=screen->areabase.first; sa; sa=sa->next) { + for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->full) break; } - if (sa==NULL) sa= CTX_wm_area(C); + if (sa == NULL) sa = CTX_wm_area(C); ED_screen_full_toggle(C, CTX_wm_window(C), sa); return OPERATOR_FINISHED; @@ -2105,11 +2106,10 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) * call exit() and remove handler when LMB confirm */ -typedef struct sAreaJoinData -{ - ScrArea *sa1; /* first area to be considered */ - ScrArea *sa2; /* second area to be considered */ - ScrArea *scr; /* designed for removal */ +typedef struct sAreaJoinData { + ScrArea *sa1; /* first area to be considered */ + ScrArea *sa2; /* second area to be considered */ + ScrArea *scr; /* designed for removal */ } sAreaJoinData; @@ -2120,40 +2120,40 @@ typedef struct sAreaJoinData static int area_join_init(bContext *C, wmOperator *op) { ScrArea *sa1, *sa2; - sAreaJoinData* jd= NULL; + sAreaJoinData *jd = NULL; int x1, y1; int x2, y2; - int shared= 0; + int shared = 0; /* required properties, make negative to get return 0 if not set by caller */ - x1= RNA_int_get(op->ptr, "min_x"); - y1= RNA_int_get(op->ptr, "min_y"); - x2= RNA_int_get(op->ptr, "max_x"); - y2= RNA_int_get(op->ptr, "max_y"); + x1 = RNA_int_get(op->ptr, "min_x"); + y1 = RNA_int_get(op->ptr, "min_y"); + x2 = RNA_int_get(op->ptr, "max_x"); + y2 = RNA_int_get(op->ptr, "max_y"); sa1 = screen_areahascursor(CTX_wm_screen(C), x1, y1); sa2 = screen_areahascursor(CTX_wm_screen(C), x2, y2); - if (sa1==NULL || sa2==NULL || sa1==sa2) + if (sa1 == NULL || sa2 == NULL || sa1 == sa2) return 0; /* do areas share an edge? */ - if (sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++; - if (sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++; - if (sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++; - if (sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++; - if (shared!=2) { + if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++; + if (sa1->v2 == sa2->v1 || sa1->v2 == sa2->v2 || sa1->v2 == sa2->v3 || sa1->v2 == sa2->v4) shared++; + if (sa1->v3 == sa2->v1 || sa1->v3 == sa2->v2 || sa1->v3 == sa2->v3 || sa1->v3 == sa2->v4) shared++; + if (sa1->v4 == sa2->v1 || sa1->v4 == sa2->v2 || sa1->v4 == sa2->v3 || sa1->v4 == sa2->v4) shared++; + if (shared != 2) { printf("areas don't share edge\n"); return 0; } - jd = (sAreaJoinData*)MEM_callocN(sizeof (sAreaJoinData), "op_area_join"); + jd = (sAreaJoinData *)MEM_callocN(sizeof (sAreaJoinData), "op_area_join"); jd->sa1 = sa1; jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM; jd->sa2 = sa2; jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - op->customdata= jd; + op->customdata = jd; return 1; } @@ -2204,19 +2204,19 @@ static int area_join_exec(bContext *C, wmOperator *op) static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if (event->type==EVT_ACTIONZONE_AREA) { - sActionzoneData *sad= event->customdata; + if (event->type == EVT_ACTIONZONE_AREA) { + sActionzoneData *sad = event->customdata; - if (sad->modifier>0) { + if (sad->modifier > 0) { return OPERATOR_PASS_THROUGH; } /* verify *sad itself */ - if (sad==NULL || sad->sa1==NULL || sad->sa2==NULL) + if (sad == NULL || sad->sa1 == NULL || sad->sa2 == NULL) return OPERATOR_PASS_THROUGH; /* is this our *sad? if areas equal it should be passed on */ - if (sad->sa1==sad->sa2) + if (sad->sa1 == sad->sa2) return OPERATOR_PASS_THROUGH; /* prepare operator state vars */ @@ -2259,7 +2259,7 @@ static int area_join_cancel(bContext *C, wmOperator *op) /* modal callback while selecting area (space) that will be removed */ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) { - bScreen *sc= CTX_wm_screen(C); + bScreen *sc = CTX_wm_screen(C); sAreaJoinData *jd = (sAreaJoinData *)op->customdata; /* execute the events */ @@ -2301,7 +2301,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) } else { /* we are back in the area previously selected for keeping - * we swap the areas if possible to allow user to choose */ + * we swap the areas if possible to allow user to choose */ if (jd->sa2 != NULL) { if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; @@ -2326,14 +2326,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) } } } - break; + break; case LEFTMOUSE: - if (event->val==KM_RELEASE) { + if (event->val == KM_RELEASE) { ED_area_tag_redraw(jd->sa1); ED_area_tag_redraw(jd->sa2); area_join_apply(C, op); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); area_join_exit(C, op); return OPERATOR_FINISHED; } @@ -2362,7 +2362,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) ot->poll = screen_active_editable; ot->cancel = area_join_cancel; - ot->flag = OPTYPE_BLOCKING|OPTYPE_INTERNAL; + ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; /* rna */ RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX); @@ -2378,20 +2378,20 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even uiPopupMenu *pup; uiLayout *layout; PointerRNA ptr1, ptr2; - ScrEdge *actedge= screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y); + ScrEdge *actedge = screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y); - if (actedge==NULL) return OPERATOR_CANCELLED; + if (actedge == NULL) return OPERATOR_CANCELLED; - pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); + layout = uiPupMenuLayout(pup); WM_operator_properties_create(&ptr1, "SCREEN_OT_area_join"); /* mouse cursor on edge, '4' can fail on wide edges... */ - RNA_int_set(&ptr1, "min_x", event->x+4); - RNA_int_set(&ptr1, "min_y", event->y+4); - RNA_int_set(&ptr1, "max_x", event->x-4); - RNA_int_set(&ptr1, "max_y", event->y-4); + RNA_int_set(&ptr1, "min_x", event->x + 4); + RNA_int_set(&ptr1, "min_y", event->y + 4); + RNA_int_set(&ptr1, "max_x", event->x - 4); + RNA_int_set(&ptr1, "max_y", event->y - 4); WM_operator_properties_create(&ptr2, "SCREEN_OT_area_split"); @@ -2426,18 +2426,18 @@ static void SCREEN_OT_area_options(wmOperatorType *ot) static int spacedata_cleanup(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); bScreen *screen; ScrArea *sa; - int tot= 0; + int tot = 0; - for (screen= bmain->screen.first; screen; screen= screen->id.next) { - for (sa= screen->areabase.first; sa; sa= sa->next) { + for (screen = bmain->screen.first; screen; screen = screen->id.next) { + for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->spacedata.first != sa->spacedata.last) { - SpaceLink *sl= sa->spacedata.first; + SpaceLink *sl = sa->spacedata.first; BLI_remlink(&sa->spacedata, sl); - tot+= BLI_countlist(&sa->spacedata); + tot += BLI_countlist(&sa->spacedata); BKE_spacedata_freelist(&sa->spacedata); BLI_addtail(&sa->spacedata, sl); } @@ -2465,7 +2465,7 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { - wmOperator *lastop= CTX_wm_manager(C)->operators.last; + wmOperator *lastop = CTX_wm_manager(C)->operators.last; if (lastop) WM_operator_repeat(C, lastop); @@ -2489,20 +2489,20 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - wmWindowManager *wm= CTX_wm_manager(C); + wmWindowManager *wm = CTX_wm_manager(C); wmOperator *lastop; uiPopupMenu *pup; uiLayout *layout; int items, i; - items= BLI_countlist(&wm->operators); - if (items==0) + items = BLI_countlist(&wm->operators); + if (items == 0) return OPERATOR_CANCELLED; - pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); + layout = uiPupMenuLayout(pup); - for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--) + for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) uiItemIntO(layout, lastop->type->name, ICON_NONE, op->type->idname, "index", i); uiPupMenuEnd(C, pup); @@ -2512,9 +2512,9 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev static int repeat_history_exec(bContext *C, wmOperator *op) { - wmWindowManager *wm= CTX_wm_manager(C); + wmWindowManager *wm = CTX_wm_manager(C); - op= BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index")); + op = BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index")); if (op) { /* let's put it as last operator in list */ BLI_remlink(&wm->operators, op); @@ -2546,7 +2546,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { - wmOperator *lastop= WM_operator_last_redo(C); + wmOperator *lastop = WM_operator_last_redo(C); if (lastop) WM_operator_redo_popup(C, lastop); @@ -2572,27 +2572,27 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot) /* insert a region in the area region list */ static int region_quadview_exec(bContext *C, wmOperator *op) { - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); /* some rules... */ - if (ar->regiontype!=RGN_TYPE_WINDOW) + if (ar->regiontype != RGN_TYPE_WINDOW) BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-splitted"); - else if (ar->alignment==RGN_ALIGN_QSPLIT) { - ScrArea *sa= CTX_wm_area(C); + else if (ar->alignment == RGN_ALIGN_QSPLIT) { + ScrArea *sa = CTX_wm_area(C); ARegion *arn; /* keep current region */ - ar->alignment= 0; + ar->alignment = 0; - if (sa->spacetype==SPACE_VIEW3D) { - RegionView3D *rv3d= ar->regiondata; - rv3d->viewlock= 0; + if (sa->spacetype == SPACE_VIEW3D) { + RegionView3D *rv3d = ar->regiondata; + rv3d->viewlock = 0; rv3d->rflag &= ~RV3D_CLIPPING; } - for (ar= sa->regionbase.first; ar; ar= arn) { - arn= ar->next; - if (ar->alignment==RGN_ALIGN_QSPLIT) { + for (ar = sa->regionbase.first; ar; ar = arn) { + arn = ar->next; + if (ar->alignment == RGN_ALIGN_QSPLIT) { ED_region_exit(C, ar); BKE_area_region_free(sa->type, ar); BLI_remlink(&sa->regionbase, ar); @@ -2600,24 +2600,24 @@ static int region_quadview_exec(bContext *C, wmOperator *op) } } ED_area_tag_redraw(sa); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } else if (ar->next) BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-splitted"); else { - ScrArea *sa= CTX_wm_area(C); + ScrArea *sa = CTX_wm_area(C); ARegion *newar; int count; - ar->alignment= RGN_ALIGN_QSPLIT; + ar->alignment = RGN_ALIGN_QSPLIT; - for (count=0; count<3; count++) { - newar= BKE_area_region_copy(sa->type, ar); + for (count = 0; count < 3; count++) { + newar = BKE_area_region_copy(sa->type, ar); BLI_addtail(&sa->regionbase, newar); } /* lock views and set them */ - if (sa->spacetype==SPACE_VIEW3D) { + if (sa->spacetype == SPACE_VIEW3D) { /* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set, * otherwise when restoring rv3d->localvd the 'viewquat' won't * match the 'view', set on entering localview See: [#26315], @@ -2626,31 +2626,31 @@ static int region_quadview_exec(bContext *C, wmOperator *op) * localview with a 4-split would assign these view locks */ RegionView3D *rv3d; - rv3d= ar->regiondata; - rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_FRONT; rv3d->persp= RV3D_ORTHO; + rv3d = ar->regiondata; + rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_FRONT; rv3d->persp = RV3D_ORTHO; ED_view3d_lock(rv3d); - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); } - ar= ar->next; - rv3d= ar->regiondata; - rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_TOP; rv3d->persp= RV3D_ORTHO; + ar = ar->next; + rv3d = ar->regiondata; + rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_TOP; rv3d->persp = RV3D_ORTHO; ED_view3d_lock(rv3d); - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); } - ar= ar->next; - rv3d= ar->regiondata; - rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_RIGHT; rv3d->persp= RV3D_ORTHO; + ar = ar->next; + rv3d = ar->regiondata; + rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_RIGHT; rv3d->persp = RV3D_ORTHO; ED_view3d_lock(rv3d); - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); } - ar= ar->next; - rv3d= ar->regiondata; - rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB; + ar = ar->next; + rv3d = ar->regiondata; + rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB; ED_view3d_lock(rv3d); - if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} + if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); } } ED_area_tag_redraw(sa); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } @@ -2678,22 +2678,22 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) /* flip a region alignment */ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) { - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); if (!ar) return OPERATOR_CANCELLED; - if (ar->alignment==RGN_ALIGN_TOP) - ar->alignment= RGN_ALIGN_BOTTOM; - else if (ar->alignment==RGN_ALIGN_BOTTOM) - ar->alignment= RGN_ALIGN_TOP; - else if (ar->alignment==RGN_ALIGN_LEFT) - ar->alignment= RGN_ALIGN_RIGHT; - else if (ar->alignment==RGN_ALIGN_RIGHT) - ar->alignment= RGN_ALIGN_LEFT; + if (ar->alignment == RGN_ALIGN_TOP) + ar->alignment = RGN_ALIGN_BOTTOM; + else if (ar->alignment == RGN_ALIGN_BOTTOM) + ar->alignment = RGN_ALIGN_TOP; + else if (ar->alignment == RGN_ALIGN_LEFT) + ar->alignment = RGN_ALIGN_RIGHT; + else if (ar->alignment == RGN_ALIGN_RIGHT) + ar->alignment = RGN_ALIGN_LEFT; ED_area_tag_redraw(CTX_wm_area(C)); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -2717,14 +2717,14 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) /* flip a header region alignment */ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) { - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); /* find the header region * - try context first, but upon failing, search all regions in area... */ if ((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) { - ScrArea *sa= CTX_wm_area(C); - ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ScrArea *sa = CTX_wm_area(C); + ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* don't do anything if no region */ if (ar == NULL) @@ -2732,18 +2732,18 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) } /* copied from SCREEN_OT_region_flip */ - if (ar->alignment==RGN_ALIGN_TOP) - ar->alignment= RGN_ALIGN_BOTTOM; - else if (ar->alignment==RGN_ALIGN_BOTTOM) - ar->alignment= RGN_ALIGN_TOP; - else if (ar->alignment==RGN_ALIGN_LEFT) - ar->alignment= RGN_ALIGN_RIGHT; - else if (ar->alignment==RGN_ALIGN_RIGHT) - ar->alignment= RGN_ALIGN_LEFT; + if (ar->alignment == RGN_ALIGN_TOP) + ar->alignment = RGN_ALIGN_BOTTOM; + else if (ar->alignment == RGN_ALIGN_BOTTOM) + ar->alignment = RGN_ALIGN_TOP; + else if (ar->alignment == RGN_ALIGN_LEFT) + ar->alignment = RGN_ALIGN_RIGHT; + else if (ar->alignment == RGN_ALIGN_RIGHT) + ar->alignment = RGN_ALIGN_LEFT; ED_area_tag_redraw(CTX_wm_area(C)); - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -2767,13 +2767,13 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot) static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { - ScrArea *sa= CTX_wm_area(C); - ARegion *ar= CTX_wm_region(C); + ScrArea *sa = CTX_wm_area(C); + ARegion *ar = CTX_wm_region(C); uiPopupMenu *pup; uiLayout *layout; - pup= uiPupMenuBegin(C, "Header", ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, "Header", ICON_NONE); + layout = uiPupMenuLayout(pup); // XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator if (ar->alignment == RGN_ALIGN_TOP) @@ -2823,7 +2823,7 @@ static int match_area_with_refresh(int spacetype, int refresh) static int match_region_with_redraws(int spacetype, int regiontype, int redraws) { - if (regiontype==RGN_TYPE_WINDOW) { + if (regiontype == RGN_TYPE_WINDOW) { switch (spacetype) { case SPACE_VIEW3D: @@ -2838,7 +2838,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) break; case SPACE_TIME: /* if only 1 window or 3d windows, we do timeline too */ - if (redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN)) + if (redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) return 1; break; case SPACE_BUTS: @@ -2846,7 +2846,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 1; break; case SPACE_SEQ: - if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN)) + if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) return 1; break; case SPACE_NODE: @@ -2864,8 +2864,8 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) } } - else if (regiontype==RGN_TYPE_UI) { - if (spacetype==SPACE_CLIP) { + else if (regiontype == RGN_TYPE_UI) { + if (spacetype == SPACE_CLIP) { /* Track Preview button is on Properties Editor in SpaceClip, * and it's very common case when users want it be refreshing * during playback, so asking people to enable special option @@ -2877,14 +2877,14 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) if (redraws & TIME_ALL_BUTS_WIN) return 1; } - else if (regiontype==RGN_TYPE_HEADER) { - if (spacetype==SPACE_TIME) + else if (regiontype == RGN_TYPE_HEADER) { + if (spacetype == SPACE_TIME) return 1; } - else if (regiontype==RGN_TYPE_PREVIEW) { + else if (regiontype == RGN_TYPE_PREVIEW) { switch (spacetype) { case SPACE_SEQ: - if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN)) + if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) return 1; break; case SPACE_CLIP: @@ -2896,21 +2896,21 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { - bScreen *screen= CTX_wm_screen(C); + bScreen *screen = CTX_wm_screen(C); - if (screen->animtimer && screen->animtimer==event->customdata) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - wmTimer *wt= screen->animtimer; - ScreenAnimData *sad= wt->customdata; + if (screen->animtimer && screen->animtimer == event->customdata) { + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + wmTimer *wt = screen->animtimer; + ScreenAnimData *sad = wt->customdata; ScrArea *sa; int sync; float time; /* sync, don't sync, or follow scene setting */ - if (sad->flag & ANIMPLAY_FLAG_SYNC) sync= 1; - else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0; - else sync= (scene->flag & SCE_FRAME_DROP); + if (sad->flag & ANIMPLAY_FLAG_SYNC) sync = 1; + else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync = 0; + else sync = (scene->flag & SCE_FRAME_DROP); if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == FALSE && @@ -2945,13 +2945,13 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e /* jump back to end? */ if (PRVRANGEON) { if (scene->r.cfra < scene->r.psfra) { - scene->r.cfra= scene->r.pefra; + scene->r.cfra = scene->r.pefra; sad->flag |= ANIMPLAY_FLAG_JUMPED; } } else { if (scene->r.cfra < scene->r.sfra) { - scene->r.cfra= scene->r.efra; + scene->r.cfra = scene->r.efra; sad->flag |= ANIMPLAY_FLAG_JUMPED; } } @@ -2960,13 +2960,13 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e /* jump back to start? */ if (PRVRANGEON) { if (scene->r.cfra > scene->r.pefra) { - scene->r.cfra= scene->r.psfra; + scene->r.cfra = scene->r.psfra; sad->flag |= ANIMPLAY_FLAG_JUMPED; } } else { if (scene->r.cfra > scene->r.efra) { - scene->r.cfra= scene->r.sfra; + scene->r.cfra = scene->r.sfra; sad->flag |= ANIMPLAY_FLAG_JUMPED; } } @@ -2985,14 +2985,14 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e /* since we follow drawflags, we can't send notifier but tag regions ourselves */ ED_update_for_newframe(CTX_data_main(C), scene, screen, 1); - for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sa = screen->areabase.first; sa; sa = sa->next) { ARegion *ar; - for (ar= sa->regionbase.first; ar; ar= ar->next) { - if (ar==sad->ar) + for (ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar == sad->ar) ED_region_tag_redraw(ar); else - if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) - ED_region_tag_redraw(ar); + if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) + ED_region_tag_redraw(ar); } if (match_area_with_refresh(sa->spacetype, sad->refresh)) @@ -3009,7 +3009,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e * since the frames-per-second value may have been changed */ // TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? - wt->timestep= (1.0/FPS); + wt->timestep = (1.0 / FPS); return OPERATOR_FINISHED; } @@ -3035,7 +3035,7 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) /* toggle operator */ int ED_screen_animation_play(bContext *C, int sync, int mode) { - bScreen *screen= CTX_wm_screen(C); + bScreen *screen = CTX_wm_screen(C); Scene *scene = CTX_data_scene(C); if (screen->animtimer) { @@ -3044,7 +3044,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) sound_stop_scene(scene); } else { - int refresh= SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ + int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ if (mode == 1) // XXX only play audio forwards!? sound_play_scene(scene); @@ -3052,10 +3052,10 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); if (screen->animtimer) { - wmTimer *wt= screen->animtimer; - ScreenAnimData *sad= wt->customdata; + wmTimer *wt = screen->animtimer; + ScreenAnimData *sad = wt->customdata; - sad->ar= CTX_wm_region(C); + sad->ar = CTX_wm_region(C); } } @@ -3064,11 +3064,11 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) static int screen_animation_play_exec(bContext *C, wmOperator *op) { - int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; - int sync= -1; + int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; + int sync = -1; if (RNA_struct_property_is_set(op->ptr, "sync")) - sync= (RNA_boolean_get(op->ptr, "sync")); + sync = (RNA_boolean_get(op->ptr, "sync")); return ED_screen_animation_play(C, sync, mode); } @@ -3095,19 +3095,19 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) static int screen_animation_cancel_exec(bContext *C, wmOperator *op) { - bScreen *screen= CTX_wm_screen(C); + bScreen *screen = CTX_wm_screen(C); if (screen->animtimer) { if (RNA_boolean_get(op->ptr, "restore_frame")) { - ScreenAnimData *sad= screen->animtimer->customdata; - Scene *scene= CTX_data_scene(C); + ScreenAnimData *sad = screen->animtimer->customdata; + Scene *scene = CTX_data_scene(C); /* reset current frame before stopping, and just send a notifier to deal with the rest * (since playback still needs to be stopped) */ - scene->r.cfra= sad->sfra; + scene->r.cfra = sad->sfra; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } /* call the other "toggling" operator to clean up now */ @@ -3155,11 +3155,11 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) #if 0 static int border_select_do(bContext *C, wmOperator *op) { - int event_type= RNA_int_get(op->ptr, "event_type"); + int event_type = RNA_int_get(op->ptr, "event_type"); - if (event_type==LEFTMOUSE) + if (event_type == LEFTMOUSE) printf("border select do select\n"); - else if (event_type==RIGHTMOUSE) + else if (event_type == RIGHTMOUSE) printf("border select deselect\n"); else printf("border select do something\n"); @@ -3197,10 +3197,10 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) static int fullscreen_back_exec(bContext *C, wmOperator *op) { bScreen *screen = CTX_wm_screen(C); - ScrArea *sa=NULL; + ScrArea *sa = NULL; /* search current screen for 'fullscreen' areas */ - for (sa=screen->areabase.first; sa; sa=sa->next) { + for (sa = screen->areabase.first; sa; sa = sa->next) { if (sa->full) break; } if (!sa) { @@ -3232,12 +3232,12 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev rcti rect; int sizex, sizey; - sizex= 800; - sizey= 480; + sizex = 800; + sizey = 480; /* some magic to calculate postition */ - rect.xmin = event->x + CTX_wm_window(C)->posx - sizex/2; - rect.ymin = event->y + CTX_wm_window(C)->posy - sizey/2; + rect.xmin = event->x + CTX_wm_window(C)->posx - sizex / 2; + rect.ymin = event->y + CTX_wm_window(C)->posy - sizey / 2; rect.xmax = rect.xmin + sizex; rect.ymax = rect.ymin + sizey; @@ -3264,11 +3264,11 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) static int screen_new_exec(bContext *C, wmOperator *UNUSED(op)) { - wmWindow *win= CTX_wm_window(C); - bScreen *sc= CTX_wm_screen(C); + wmWindow *win = CTX_wm_window(C); + bScreen *sc = CTX_wm_screen(C); - sc= ED_screen_duplicate(win, sc); - WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, sc); + sc = ED_screen_duplicate(win, sc); + WM_event_add_notifier(C, NC_SCREEN | ND_SCREENBROWSE, sc); return OPERATOR_FINISHED; } @@ -3285,16 +3285,16 @@ static void SCREEN_OT_new(wmOperatorType *ot) ot->poll = WM_operator_winactive; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************* delete screen operator *********************/ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) { - bScreen *sc= CTX_wm_screen(C); + bScreen *sc = CTX_wm_screen(C); - WM_event_add_notifier(C, NC_SCREEN|ND_SCREENDELETE, sc); + WM_event_add_notifier(C, NC_SCREEN | ND_SCREENDELETE, sc); return OPERATOR_FINISHED; } @@ -3310,22 +3310,22 @@ static void SCREEN_OT_delete(wmOperatorType *ot) ot->exec = screen_delete_exec; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************* new scene operator *********************/ static int scene_new_exec(bContext *C, wmOperator *op) { - Scene *newscene, *scene= CTX_data_scene(C); - Main *bmain= CTX_data_main(C); - int type= RNA_enum_get(op->ptr, "type"); + Scene *newscene, *scene = CTX_data_scene(C); + Main *bmain = CTX_data_main(C); + int type = RNA_enum_get(op->ptr, "type"); if (type == SCE_COPY_NEW) { - newscene= BKE_scene_add("Scene"); + newscene = BKE_scene_add("Scene"); } else { /* different kinds of copying */ - newscene= BKE_scene_copy(scene, type); + newscene = BKE_scene_copy(scene, type); /* these can't be handled in blenkernel curently, so do them here */ if (type == SCE_COPY_LINK_DATA) { @@ -3338,14 +3338,14 @@ static int scene_new_exec(bContext *C, wmOperator *op) ED_screen_set_scene(C, CTX_wm_screen(C), newscene); - WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); + WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, newscene); return OPERATOR_FINISHED; } static void SCENE_OT_new(wmOperatorType *ot) { - static EnumPropertyItem type_items[]= { + static EnumPropertyItem type_items[] = { {SCE_COPY_NEW, "NEW", 0, "New", "Add new scene"}, {SCE_COPY_EMPTY, "EMPTY", 0, "Copy Settings", "Make a copy without any objects"}, {SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene"}, @@ -3363,7 +3363,7 @@ static void SCENE_OT_new(wmOperatorType *ot) ot->invoke = WM_menu_invoke; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); @@ -3373,14 +3373,14 @@ static void SCENE_OT_new(wmOperatorType *ot) static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); ED_screen_delete_scene(C, scene); if (G.debug & G_DEBUG) printf("scene delete %p\n", scene); - WM_event_add_notifier(C, NC_SCENE|NA_REMOVED, scene); + WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, scene); return OPERATOR_FINISHED; } @@ -3396,7 +3396,7 @@ static void SCENE_OT_delete(wmOperatorType *ot) ot->exec = scene_delete_exec; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* **************** Assigning operatortypes to global list, adding handlers **************** */ @@ -3465,7 +3465,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf) wmKeyMap *keymap; /* Standard Modal keymap ------------------------------------------------ */ - keymap= WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items); + keymap = WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items); WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, KM_MODAL_APPLY); @@ -3481,8 +3481,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf) static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { - if (drag->type==WM_DRAG_PATH) { - if (drag->icon==ICON_FILE_BLEND) + if (drag->type == WM_DRAG_PATH) { + if (drag->icon == ICON_FILE_BLEND) return 1; } return 0; @@ -3492,7 +3492,7 @@ static void open_file_drop_copy(wmDrag *drag, wmDropBox *drop) { /* copy drag path to properties */ RNA_string_set(drop->ptr, "filepath", drag->path); - drop->opcontext= WM_OP_EXEC_DEFAULT; + drop->opcontext = WM_OP_EXEC_DEFAULT; } @@ -3543,7 +3543,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0); /* tests */ - WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); + WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", F3KEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0); @@ -3558,12 +3558,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* undo */ #ifdef __APPLE__ WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0); - WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0); - WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0); + WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0); + WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); - WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); + WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); + WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); /* render */ @@ -3578,7 +3578,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) #ifdef __APPLE__ WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", COMMAKEY, KM_PRESS, KM_OSKEY, 0); #endif - WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); + WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); /* Anim Playback ------------------------------------------------ */ @@ -3593,8 +3593,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", TRUE); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", FALSE); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", TRUE); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", FALSE); @@ -3612,7 +3612,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* play (forward and backwards) */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0)->ptr, "reverse", TRUE); WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0); @@ -3622,17 +3622,17 @@ void ED_keymap_screen(wmKeyConfig *keyconf) #if 0 // XXX: disabled for restoring later... bad implementation keymap = WM_keymap_find(keyconf, "Frames", 0, 0); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE); + RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", LEFTARROWKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "reverse", TRUE); - RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE); + RNA_boolean_set(kmi->ptr, "reverse", TRUE); + RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE); WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", DOWNARROWKEY, KM_PRESS, KM_ALT, 0); #endif /* dropbox for entire window */ - lb= WM_dropboxmap_find("Window", 0, 0); + lb = WM_dropboxmap_find("Window", 0, 0); WM_dropbox_add(lb, "WM_OT_open_mainfile", open_file_drop_poll, open_file_drop_copy); keymap_modal_set(keyconf); |