From a6ebffe182e3867b8a365499c7eb990fb277cbe7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Mar 2012 01:51:25 +0000 Subject: style cleanup: interface --- source/blender/editors/interface/interface_ops.c | 126 +++++++++++------------ 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'source/blender/editors/interface/interface_ops.c') diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 4e97a38fe25..34116f24901 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -78,7 +78,7 @@ static int eyedropper_init(bContext *C, wmOperator *op) { Eyedropper *eye; - op->customdata= eye= MEM_callocN(sizeof(Eyedropper), "Eyedropper"); + op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper"); uiContextActiveProperty(C, &eye->ptr, &eye->prop, &eye->index); @@ -91,7 +91,7 @@ static void eyedropper_exit(bContext *C, wmOperator *op) if (op->customdata) MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata = NULL; } static int eyedropper_cancel(bContext *C, wmOperator *op) @@ -130,12 +130,12 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event) { Eyedropper *eye = (Eyedropper *)op->customdata; - switch(event->type) { + switch (event->type) { case ESCKEY: case RIGHTMOUSE: return eyedropper_cancel(C, op); case LEFTMOUSE: - if (event->val==KM_RELEASE) { + if (event->val == KM_RELEASE) { eyedropper_sample(C, eye, event->x, event->y); eyedropper_exit(C, op); return OPERATOR_FINISHED; @@ -165,7 +165,7 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) } /* Repeat operator */ -static int eyedropper_exec (bContext *C, wmOperator *op) +static int eyedropper_exec(bContext *C, wmOperator *op) { /* init */ if (eyedropper_init(C, op)) { @@ -239,14 +239,14 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) PointerRNA ptr; PropertyRNA *prop; char *path; - int success= 0; + int success = 0; int index; /* try to create driver using property retrieved from UI */ uiContextActiveProperty(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop) { - path= RNA_path_from_ID_to_property(&ptr, prop); + path = RNA_path_from_ID_to_property(&ptr, prop); if (path) { WM_clipboard_text_set(path, FALSE); @@ -255,7 +255,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) } /* since we're just copying, we don't really need to do anything else...*/ - return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; + return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } static void UI_OT_copy_data_path_button(wmOperatorType *ot) @@ -290,7 +290,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) { PointerRNA ptr; PropertyRNA *prop; - int success= 0; + int success = 0; int index, all = RNA_boolean_get(op->ptr, "all"); /* try to reset the nominated setting to its default value */ @@ -298,14 +298,14 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) /* if there is a valid property that is editable... */ if (ptr.data && prop && RNA_property_editable(&ptr, prop)) { - if (RNA_property_reset(&ptr, prop, (all)? -1: index)) { + if (RNA_property_reset(&ptr, prop, (all) ? -1 : index)) { /* perform updates required for this property */ RNA_property_update(C, &ptr, prop); /* as if we pressed the button */ uiContextActivePropertyHandle(C); - success= 1; + success = 1; } } @@ -313,7 +313,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) * edits on the screen or on operator settings. * it might be better to move undo's inline - campbell */ if (success) { - ID *id= ptr.id.data; + ID *id = ptr.id.data; if (id && ID_CHECK_UNDO(id)) { /* do nothing, go ahead with undo */ } @@ -323,7 +323,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) } /* end hack */ - return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; + return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } static void UI_OT_reset_default_button(wmOperatorType *ot) @@ -366,7 +366,7 @@ static int copy_to_selected_button_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; - int index, success= 0; + int index, success = 0; uiContextActiveProperty(C, &ptr, &prop, &index); @@ -375,9 +375,9 @@ static int copy_to_selected_button_poll(bContext *C) ListBase lb; if (copy_to_selected_list(C, &ptr, &lb)) { - for (link= lb.first; link; link=link->next) + for (link = lb.first; link; link = link->next) if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) - success= 1; + success = 1; BLI_freelistN(&lb); } @@ -390,7 +390,7 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) { PointerRNA ptr; PropertyRNA *prop; - int success= 0; + int success = 0; int index, all = RNA_boolean_get(op->ptr, "all"); /* try to reset the nominated setting to its default value */ @@ -402,11 +402,11 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) ListBase lb; if (copy_to_selected_list(C, &ptr, &lb)) { - for (link= lb.first; link; link=link->next) { + for (link = lb.first; link; link = link->next) { if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) { - if (RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) { + if (RNA_property_copy(&link->ptr, &ptr, prop, (all) ? -1 : index)) { RNA_property_update(C, &link->ptr, prop); - success= 1; + success = 1; } } } @@ -415,7 +415,7 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) } } - return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; + return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } static void UI_OT_copy_to_selected_button(wmOperatorType *ot) @@ -430,7 +430,7 @@ static void UI_OT_copy_to_selected_button(wmOperatorType *ot) ot->exec = copy_to_selected_button_exec; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array"); @@ -460,7 +460,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) * - if commandline debug option enabled, show debug reports too * - otherwise, up to info (which is what users normally see) */ - str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO); + str = BKE_reports_string(reports, (G.f & G_DEBUG) ? RPT_DEBUG : RPT_INFO); if (str) { write_text(txt, str); @@ -502,7 +502,7 @@ struct uiEditSourceButStore { } uiEditSourceButStore; /* should only ever be set while the edit source operator is running */ -static struct uiEditSourceStore *ui_editsource_info= NULL; +static struct uiEditSourceStore *ui_editsource_info = NULL; int UI_editsource_enable_check(void) { @@ -513,7 +513,7 @@ static void ui_editsource_active_but_set(uiBut *but) { BLI_assert(ui_editsource_info == NULL); - ui_editsource_info= MEM_callocN(sizeof(uiEditSourceStore), __func__); + ui_editsource_info = MEM_callocN(sizeof(uiEditSourceStore), __func__); memcpy(&ui_editsource_info->but_orig, but, sizeof(uiBut)); ui_editsource_info->hash = BLI_ghash_new(BLI_ghashutil_ptrhash, @@ -525,7 +525,7 @@ static void ui_editsource_active_but_clear(void) { BLI_ghash_free(ui_editsource_info->hash, NULL, (GHashValFreeFP)MEM_freeN); MEM_freeN(ui_editsource_info); - ui_editsource_info= NULL; + ui_editsource_info = NULL; } static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b) @@ -538,16 +538,16 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b) /* this just needs to be a 'good-enough' comparison so we can know beyond * reasonable doubt that these buttons are the same between redraws. * if this fails it only means edit-source fails - campbell */ - if ( (but_a->x1 == but_b->x1) && - (but_a->x2 == but_b->x2) && - (but_a->y1 == but_b->y1) && - (but_a->y2 == but_b->y2) && - (but_a->type == but_b->type) && - (but_a->rnaprop == but_b->rnaprop) && - (but_a->optype == but_b->optype) && - (but_a->unit_type == but_b->unit_type) && - strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0 - ) { + if ((but_a->x1 == but_b->x1) && + (but_a->x2 == but_b->x2) && + (but_a->y1 == but_b->y1) && + (but_a->y2 == but_b->y2) && + (but_a->type == but_b->type) && + (but_a->rnaprop == but_b->rnaprop) && + (but_a->optype == but_b->optype) && + (but_a->unit_type == but_b->unit_type) && + (strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0)) + { return TRUE; } else { @@ -559,10 +559,10 @@ void UI_editsource_active_but_test(uiBut *but) { extern void PyC_FileAndNum_Safe(const char **filename, int *lineno); - struct uiEditSourceButStore *but_store= MEM_callocN(sizeof(uiEditSourceButStore), __func__); + struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__); const char *fn; - int lineno= -1; + int lineno = -1; #if 0 printf("comparing buttons: '%s' == '%s'\n", @@ -573,12 +573,12 @@ void UI_editsource_active_but_test(uiBut *but) if (lineno != -1) { BLI_strncpy(but_store->py_dbg_fn, fn, - sizeof(but_store->py_dbg_fn)); - but_store->py_dbg_ln= lineno; + sizeof(but_store->py_dbg_fn)); + but_store->py_dbg_ln = lineno; } else { - but_store->py_dbg_fn[0]= '\0'; - but_store->py_dbg_ln= -1; + but_store->py_dbg_fn[0] = '\0'; + but_store->py_dbg_ln = -1; } BLI_ghash_insert(ui_editsource_info->hash, but, but_store); @@ -589,17 +589,17 @@ void UI_editsource_active_but_test(uiBut *but) static int editsource_text_edit(bContext *C, wmOperator *op, char filepath[FILE_MAX], int line) { - struct Main *bmain= CTX_data_main(C); + struct Main *bmain = CTX_data_main(C); Text *text; - for (text=bmain->text.first; text; text=text->id.next) { + for (text = bmain->text.first; text; text = text->id.next) { if (text->name && BLI_path_cmp(text->name, filepath) == 0) { break; } } if (text == NULL) { - text= add_text(filepath, bmain->name); + text = add_text(filepath, bmain->name); } if (text == NULL) { @@ -610,10 +610,10 @@ static int editsource_text_edit(bContext *C, wmOperator *op, else { /* naughty!, find text area to set, not good behavior * but since this is a dev tool lets allow it - campbell */ - ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); + ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); if (sa) { - SpaceText *st= sa->spacedata.first; - st->text= text; + SpaceText *st = sa->spacedata.first; + st->text = text; } else { BKE_reportf(op->reports, RPT_INFO, @@ -621,7 +621,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, } txt_move_toline(text, line - 1, FALSE); - WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); + WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text); } return OPERATOR_FINISHED; @@ -629,13 +629,13 @@ static int editsource_text_edit(bContext *C, wmOperator *op, static int editsource_exec(bContext *C, wmOperator *op) { - uiBut *but= uiContextActiveButton(C); + uiBut *but = uiContextActiveButton(C); if (but) { GHashIterator ghi; - struct uiEditSourceButStore *but_store= NULL; + struct uiEditSourceButStore *but_store = NULL; - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); int ret; /* needed else the active button does not get tested */ @@ -650,12 +650,12 @@ static int editsource_exec(bContext *C, wmOperator *op) ED_region_do_draw(C, ar); for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash); - !BLI_ghashIterator_isDone(&ghi); - BLI_ghashIterator_step(&ghi)) + !BLI_ghashIterator_isDone(&ghi); + BLI_ghashIterator_step(&ghi)) { - uiBut *but= BLI_ghashIterator_getKey(&ghi); + uiBut *but = BLI_ghashIterator_getKey(&ghi); if (but && ui_editsource_uibut_match(&ui_editsource_info->but_orig, but)) { - but_store= BLI_ghashIterator_getValue(&ghi); + but_store = BLI_ghashIterator_getValue(&ghi); break; } @@ -663,20 +663,20 @@ static int editsource_exec(bContext *C, wmOperator *op) if (but_store) { if (but_store->py_dbg_ln != -1) { - ret= editsource_text_edit(C, op, - but_store->py_dbg_fn, - but_store->py_dbg_ln); + ret = editsource_text_edit(C, op, + but_store->py_dbg_fn, + but_store->py_dbg_ln); } else { BKE_report(op->reports, RPT_ERROR, - "Active button isn't from a script, cant edit source."); - ret= OPERATOR_CANCELLED; + "Active button isn't from a script, cant edit source."); + ret = OPERATOR_CANCELLED; } } else { BKE_report(op->reports, RPT_ERROR, - "Active button match can't be found."); - ret= OPERATOR_CANCELLED; + "Active button match can't be found."); + ret = OPERATOR_CANCELLED; } -- cgit v1.2.3