diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-28 15:53:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-28 15:53:18 +0400 |
commit | ed61bfc9a6580360805a3daae1003df43a7f2c11 (patch) | |
tree | 29ee3248e82a5109b241127b1c2397ca11bf7bcb /source/blender/editors/space_info | |
parent | ca8d262e89c25d15368ec4eb2fe80111e732e1f7 (diff) |
style cleanup
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/info_draw.c | 134 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 93 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_report.c | 116 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 240 | ||||
-rw-r--r-- | source/blender/editors/space_info/space_info.c | 90 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.c | 84 |
6 files changed, 379 insertions, 378 deletions
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index c06a778951d..2409ab8c4e0 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -66,42 +66,42 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool) { if (report->flag & SELECT) { - fg[0]=255; fg[1]=255; fg[2]=255; + fg[0] = 255; fg[1] = 255; fg[2] = 255; if (bool) { - bg[0]=96; bg[1]=128; bg[2]=255; + bg[0] = 96; bg[1] = 128; bg[2] = 255; } else { - bg[0]=90; bg[1]=122; bg[2]=249; + bg[0] = 90; bg[1] = 122; bg[2] = 249; } } else { - fg[0]=0; fg[1]=0; fg[2]=0; + fg[0] = 0; fg[1] = 0; fg[2] = 0; if (report->type & RPT_ERROR_ALL) { - if (bool) { bg[0]=220; bg[1]=0; bg[2]=0; } - else { bg[0]=214; bg[1]=0; bg[2]=0; } + if (bool) { bg[0] = 220; bg[1] = 0; bg[2] = 0; } + else { bg[0] = 214; bg[1] = 0; bg[2] = 0; } } else if (report->type & RPT_WARNING_ALL) { - if (bool) { bg[0]=220; bg[1]=128; bg[2]=96; } - else { bg[0]=214; bg[1]=122; bg[2]=90; } + if (bool) { bg[0] = 220; bg[1] = 128; bg[2] = 96; } + else { bg[0] = 214; bg[1] = 122; bg[2] = 90; } } #if 0 // XXX: this looks like the selected color, so don't use this else if (report->type & RPT_OPERATOR_ALL) { - if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; } - else { bg[0]=90; bg[1]=122; bg[2]=249; } + if (bool) { bg[0] = 96; bg[1] = 128; bg[2] = 255; } + else { bg[0] = 90; bg[1] = 122; bg[2] = 249; } } #endif else if (report->type & RPT_INFO_ALL) { - if (bool) { bg[0]=0; bg[1]=170; bg[2]=0; } - else { bg[0]=0; bg[1]=164; bg[2]=0; } + if (bool) { bg[0] = 0; bg[1] = 170; bg[2] = 0; } + else { bg[0] = 0; bg[1] = 164; bg[2] = 0; } } else if (report->type & RPT_DEBUG_ALL) { - if (bool) { bg[0]=196; bg[1]=196; bg[2]=196; } - else { bg[0]=190; bg[1]=190; bg[2]=190; } + if (bool) { bg[0] = 196; bg[1] = 196; bg[2] = 196; } + else { bg[0] = 190; bg[1] = 190; bg[2] = 190; } } else { - if (bool) { bg[0]=120; bg[1]=120; bg[2]=120; } - else { bg[0]=114; bg[1]=114; bg[2]=114; } + if (bool) { bg[0] = 120; bg[1] = 120; bg[2] = 120; } + else { bg[0] = 114; bg[1] = 114; bg[2] = 114; } } } } @@ -110,24 +110,24 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo #ifdef USE_INFO_NEWLINE static void report_textview_init__internal(TextViewContext *tvc) { - Report *report= (Report *)tvc->iter; - const char *str= report->message; - const char *next_str= strchr(str + tvc->iter_char, '\n'); + Report *report = (Report *)tvc->iter; + const char *str = report->message; + const char *next_str = strchr(str + tvc->iter_char, '\n'); if (next_str) { - tvc->iter_char_next= (int)(next_str - str); + tvc->iter_char_next = (int)(next_str - str); } else { - tvc->iter_char_next= report->len; + tvc->iter_char_next = report->len; } } static int report_textview_skip__internal(TextViewContext *tvc) { - SpaceInfo *sinfo= (SpaceInfo *)tvc->arg1; - const int report_mask= info_report_mask(sinfo); - while (tvc->iter && (((Report *)tvc->iter)->type & report_mask)==0) { - tvc->iter= (void *)((Link *)tvc->iter)->prev; + SpaceInfo *sinfo = (SpaceInfo *)tvc->arg1; + const int report_mask = info_report_mask(sinfo); + while (tvc->iter && (((Report *)tvc->iter)->type & report_mask) == 0) { + tvc->iter = (void *)((Link *)tvc->iter)->prev; } return (tvc->iter != NULL); } @@ -137,23 +137,23 @@ static int report_textview_skip__internal(TextViewContext *tvc) static int report_textview_begin(TextViewContext *tvc) { // SpaceConsole *sc= (SpaceConsole *)tvc->arg1; - ReportList *reports= (ReportList *)tvc->arg2; + ReportList *reports = (ReportList *)tvc->arg2; - tvc->lheight= 14; //sc->lheight; - tvc->sel_start= 0; - tvc->sel_end= 0; + tvc->lheight = 14; //sc->lheight; + tvc->sel_start = 0; + tvc->sel_end = 0; /* iterator */ - tvc->iter= reports->list.last; + tvc->iter = reports->list.last; - glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0); + glClearColor(120.0 / 255.0, 120.0 / 255.0, 120.0 / 255.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); #ifdef USE_INFO_NEWLINE - tvc->iter_tmp= 0; + tvc->iter_tmp = 0; if (tvc->iter && report_textview_skip__internal(tvc)) { /* init the newline iterator */ - tvc->iter_char= 0; + tvc->iter_char = 0; report_textview_init__internal(tvc); return TRUE; @@ -175,14 +175,14 @@ static void report_textview_end(TextViewContext *UNUSED(tvc)) static int report_textview_step(TextViewContext *tvc) { /* simple case, but no newline support */ - Report *report= (Report *)tvc->iter; + Report *report = (Report *)tvc->iter; if (report->len <= tvc->iter_char_next) { - tvc->iter= (void *)((Link *)tvc->iter)->prev; + tvc->iter = (void *)((Link *)tvc->iter)->prev; if (tvc->iter && report_textview_skip__internal(tvc)) { tvc->iter_tmp++; - tvc->iter_char= 0; /* reset start */ + tvc->iter_char = 0; /* reset start */ report_textview_init__internal(tvc); return TRUE; @@ -193,7 +193,7 @@ static int report_textview_step(TextViewContext *tvc) } else { /* step to the next newline */ - tvc->iter_char= tvc->iter_char_next + 1; + tvc->iter_char = tvc->iter_char_next + 1; report_textview_init__internal(tvc); return TRUE; @@ -202,15 +202,15 @@ static int report_textview_step(TextViewContext *tvc) static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len) { - Report *report= (Report *)tvc->iter; - *line= report->message + tvc->iter_char; - *len= tvc->iter_char_next - tvc->iter_char; + Report *report = (Report *)tvc->iter; + *line = report->message + tvc->iter_char; + *len = tvc->iter_char_next - tvc->iter_char; return 1; } static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]) { - Report *report= (Report *)tvc->iter; + Report *report = (Report *)tvc->iter; info_report_color(fg, bg, report, tvc->iter_tmp % 2); return TVC_LINE_FG | TVC_LINE_BG; } @@ -220,27 +220,27 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char static int report_textview_step(TextViewContext *tvc) { - SpaceInfo *sinfo= (SpaceInfo *)tvc->arg1; - const int report_mask= info_report_mask(sinfo); + SpaceInfo *sinfo = (SpaceInfo *)tvc->arg1; + const int report_mask = info_report_mask(sinfo); do { - tvc->iter= (void *)((Link *)tvc->iter)->prev; - } while (tvc->iter && (((Report *)tvc->iter)->type & report_mask)==0); + tvc->iter = (void *)((Link *)tvc->iter)->prev; + } while (tvc->iter && (((Report *)tvc->iter)->type & report_mask) == 0); return (tvc->iter != NULL); } static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len) { - Report *report= (Report *)tvc->iter; - *line= report->message; - *len= report->len; + Report *report = (Report *)tvc->iter; + *line = report->message; + *len = report->len; return 1; } static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]) { - Report *report= (Report *)tvc->iter; + Report *report = (Report *)tvc->iter; info_report_color(fg, bg, report, tvc->iter_tmp % 2); return TVC_LINE_FG | TVC_LINE_BG; } @@ -251,41 +251,41 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char static int info_textview_main__internal(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick) { - int ret= 0; + int ret = 0; - View2D *v2d= &ar->v2d; + View2D *v2d = &ar->v2d; - TextViewContext tvc= {0}; - tvc.begin= report_textview_begin; - tvc.end= report_textview_end; + TextViewContext tvc = {0}; + tvc.begin = report_textview_begin; + tvc.end = report_textview_end; - tvc.step= report_textview_step; - tvc.line_get= report_textview_line_get; - tvc.line_color= report_textview_line_color; + tvc.step = report_textview_step; + tvc.line_get = report_textview_line_get; + tvc.line_color = report_textview_line_color; - tvc.arg1= sinfo; - tvc.arg2= reports; + tvc.arg1 = sinfo; + tvc.arg2 = reports; /* view */ - tvc.sel_start= 0; - tvc.sel_end= 0; - tvc.lheight= 14; //sc->lheight; + tvc.sel_start = 0; + tvc.sel_end = 0; + tvc.lheight = 14; //sc->lheight; tvc.ymin = v2d->cur.ymin; tvc.ymax = v2d->cur.ymax; - tvc.winx= ar->winx; + tvc.winx = ar->winx; - ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick); + ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick); return ret; } void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y) { - void *mouse_pick= NULL; + void *mouse_pick = NULL; int mval[2]; - mval[0]= 0; - mval[1]= mouse_y; + mval[0] = 0; + mval[1] = mouse_y; info_textview_main__internal(sinfo, ar, reports, 0, mval, &mouse_pick, NULL); return (void *)mouse_pick; diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 3157b920ff0..5256fc8f044 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -70,7 +70,7 @@ static int pack_all_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); packAll(bmain, op->reports); G.fileflags |= G_AUTOPACK; @@ -80,14 +80,14 @@ static int pack_all_exec(bContext *C, wmOperator *op) static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); Image *ima; ImBuf *ibuf; // first check for dirty images - for (ima=bmain->image.first; ima; ima=ima->id.next) { + for (ima = bmain->image.first; ima; ima = ima->id.next) { if (ima->ibufs.first) { /* XXX FIX */ - ibuf= BKE_image_get_ibuf(ima, NULL); + ibuf = BKE_image_get_ibuf(ima, NULL); if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) break; @@ -113,7 +113,7 @@ void FILE_OT_pack_all(wmOperatorType *ot) ot->invoke = pack_all_invoke; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************* unpack all operator *********************/ @@ -129,10 +129,10 @@ static const EnumPropertyItem unpack_all_method_items[] = { static int unpack_all_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - int method= RNA_enum_get(op->ptr, "method"); + Main *bmain = CTX_data_main(C); + int method = RNA_enum_get(op->ptr, "method"); - if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */ + if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */ G.fileflags &= ~G_AUTOPACK; return OPERATOR_FINISHED; @@ -140,7 +140,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); uiPopupMenu *pup; uiLayout *layout; char title[64]; @@ -159,8 +159,8 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) else BLI_snprintf(title, sizeof(title), "Unpack %d files", count); - pup= uiPupMenuBegin(C, title, ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, title, ICON_NONE); + layout = uiPupMenuLayout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); uiItemsEnumO(layout, "FILE_OT_unpack_all", "method"); @@ -181,7 +181,7 @@ void FILE_OT_unpack_all(wmOperatorType *ot) ot->invoke = unpack_all_invoke; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "method", unpack_all_method_items, PF_USE_LOCAL, "Method", "How to unpack"); @@ -191,7 +191,7 @@ void FILE_OT_unpack_all(wmOperatorType *ot) static int make_paths_relative_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); if (!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file"); @@ -216,14 +216,14 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot) ot->exec = make_paths_relative_exec; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************* make paths absolute operator *********************/ static int make_paths_absolute_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); if (!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file"); @@ -248,14 +248,14 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot) ot->exec = make_paths_absolute_exec; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************* report missing files operator *********************/ static int report_missing_files_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); + Main *bmain = CTX_data_main(C); /* run the missing file check */ checkMissingFiles(bmain, op->reports); @@ -280,8 +280,8 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) static int find_missing_files_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - const char *searchpath= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); + Main *bmain = CTX_data_main(C); + const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); findMissingFiles(bmain, searchpath, op->reports); MEM_freeN((void *)searchpath); @@ -306,7 +306,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) ot->invoke = find_missing_files_invoke; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); @@ -321,44 +321,45 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) * inactive regions, so use this for now. --matt */ -#define INFO_TIMEOUT 5.0f -#define INFO_COLOR_TIMEOUT 3.0f -#define ERROR_TIMEOUT 10.0f -#define ERROR_COLOR_TIMEOUT 6.0f -#define COLLAPSE_TIMEOUT 0.25f +#define INFO_TIMEOUT 5.0f +#define INFO_COLOR_TIMEOUT 3.0f +#define ERROR_TIMEOUT 10.0f +#define ERROR_COLOR_TIMEOUT 6.0f +#define COLLAPSE_TIMEOUT 0.25f static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { - wmWindowManager *wm= CTX_wm_manager(C); - ReportList *reports= CTX_wm_reports(C); + wmWindowManager *wm = CTX_wm_manager(C); + ReportList *reports = CTX_wm_reports(C); Report *report; ReportTimerInfo *rti; - float progress=0.0, color_progress=0.0; + float progress = 0.0, color_progress = 0.0; float neutral_col[3] = {0.35, 0.35, 0.35}; - float neutral_grey= 0.6; - float timeout=0.0, color_timeout=0.0; - int send_note= 0; + float neutral_grey = 0.6; + float timeout = 0.0, color_timeout = 0.0; + int send_note = 0; /* escape if not our timer */ - if ( (reports->reporttimer==NULL) || - (reports->reporttimer != event->customdata) || - ((report= BKE_reports_last_displayable(reports))==NULL) /* may have been deleted */ - ) { + if ((reports->reporttimer == NULL) || + (reports->reporttimer != event->customdata) || + ((report = BKE_reports_last_displayable(reports)) == NULL) /* may have been deleted */ + ) + { return OPERATOR_PASS_THROUGH; } rti = (ReportTimerInfo *)reports->reporttimer->customdata; - timeout = (report->type & RPT_ERROR_ALL)?ERROR_TIMEOUT:INFO_TIMEOUT; - color_timeout = (report->type & RPT_ERROR_ALL)?ERROR_COLOR_TIMEOUT:INFO_COLOR_TIMEOUT; + timeout = (report->type & RPT_ERROR_ALL) ? ERROR_TIMEOUT : INFO_TIMEOUT; + color_timeout = (report->type & RPT_ERROR_ALL) ? ERROR_COLOR_TIMEOUT : INFO_COLOR_TIMEOUT; /* clear the report display after timeout */ if ((float)reports->reporttimer->duration > timeout) { WM_event_remove_timer(wm, NULL, reports->reporttimer); reports->reporttimer = NULL; - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); - return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH); + return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); } if (rti->widthfac == 0.0f) { @@ -379,7 +380,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm rti->col[2] = 0.7; } rti->greyscale = 0.75; - rti->widthfac=1.0; + rti->widthfac = 1.0; } progress = (float)reports->reporttimer->duration / timeout; @@ -387,7 +388,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm /* save us from too many draws */ if (color_progress <= 1.0f) { - send_note= 1; + send_note = 1; /* fade colors out sharply according to progress through fade-out duration */ interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress); @@ -395,17 +396,17 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm } /* collapse report at end of timeout */ - if (progress*timeout > timeout - COLLAPSE_TIMEOUT) { - rti->widthfac = (progress*timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT; + if (progress * timeout > timeout - COLLAPSE_TIMEOUT) { + rti->widthfac = (progress * timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT; rti->widthfac = 1.0f - rti->widthfac; - send_note= 1; + send_note = 1; } if (send_note) { - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); } - return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH); + return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); } void INFO_OT_reports_display_update(wmOperatorType *ot) diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 4e6ccf2f2b1..46cd2530063 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -53,16 +53,16 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo)) #if 0 int report_mask = 0; - if (sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL; - if (sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL; - if (sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL; - if (sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL; - if (sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL; + if (sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL; + if (sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL; + if (sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL; + if (sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL; + if (sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL; return report_mask; #endif - return RPT_DEBUG_ALL|RPT_INFO_ALL|RPT_OPERATOR_ALL|RPT_WARNING_ALL|RPT_ERROR_ALL; + return RPT_DEBUG_ALL | RPT_INFO_ALL | RPT_OPERATOR_ALL | RPT_WARNING_ALL | RPT_ERROR_ALL; } // TODO, get this working again! @@ -74,9 +74,9 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) // Report *report; #if 0 - sc->type= CONSOLE_TYPE_PYTHON; + sc->type = CONSOLE_TYPE_PYTHON; - for (report=reports->list.last; report; report=report->prev) { + for (report = reports->list.last; report; report = report->prev) { if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) { console_history_add_str(sc, report->message, 0); WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); @@ -85,7 +85,7 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) } } - sc->type= CONSOLE_TYPE_REPORT; + sc->type = CONSOLE_TYPE_REPORT; #endif ED_area_tag_redraw(CTX_wm_area(C)); @@ -111,8 +111,8 @@ void INFO_OT_report_replay(wmOperatorType *ot) static int select_report_pick_exec(bContext *C, wmOperator *op) { - int report_index= RNA_int_get(op->ptr, "report_index"); - Report *report= BLI_findlink(&CTX_wm_reports(C)->list, report_index); + int report_index = RNA_int_get(op->ptr, "report_index"); + Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index); if (!report) return OPERATOR_CANCELLED; @@ -126,15 +126,15 @@ static int select_report_pick_exec(bContext *C, wmOperator *op) static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - ARegion *ar= CTX_wm_region(C); - ReportList *reports= CTX_wm_reports(C); + SpaceInfo *sinfo = CTX_wm_space_info(C); + ARegion *ar = CTX_wm_region(C); + ReportList *reports = CTX_wm_reports(C); Report *report; /* uses opengl */ wmSubWindowSet(CTX_wm_window(C), ar->swinid); - report= info_text_pick(sinfo, ar, reports, event->mval[1]); + report = info_text_pick(sinfo, ar, reports, event->mval[1]); RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report)); @@ -165,28 +165,28 @@ void INFO_OT_select_pick(wmOperatorType *ot) static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - ReportList *reports= CTX_wm_reports(C); - int report_mask= info_report_mask(sinfo); - int deselect= 0; + SpaceInfo *sinfo = CTX_wm_space_info(C); + ReportList *reports = CTX_wm_reports(C); + int report_mask = info_report_mask(sinfo); + int deselect = 0; Report *report; - for (report=reports->list.last; report; report=report->prev) { + for (report = reports->list.last; report; report = report->prev) { if ((report->type & report_mask) && (report->flag & SELECT)) { - deselect= 1; + deselect = 1; break; } } if (deselect) { - for (report=reports->list.last; report; report=report->prev) + for (report = reports->list.last; report; report = report->prev) if (report->type & report_mask) report->flag &= ~SELECT; } else { - for (report=reports->list.last; report; report=report->prev) + for (report = reports->list.last; report; report = report->prev) if (report->type & report_mask) report->flag |= SELECT; } @@ -216,11 +216,11 @@ void INFO_OT_select_all_toggle(wmOperatorType *ot) /* borderselect operator */ static int borderselect_exec(bContext *C, wmOperator *op) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - ARegion *ar= CTX_wm_region(C); - ReportList *reports= CTX_wm_reports(C); - int report_mask= info_report_mask(sinfo); - int extend= RNA_boolean_get(op->ptr, "extend"); + SpaceInfo *sinfo = CTX_wm_space_info(C); + ARegion *ar = CTX_wm_region(C); + ReportList *reports = CTX_wm_reports(C); + int report_mask = info_report_mask(sinfo); + int extend = RNA_boolean_get(op->ptr, "extend"); Report *report_min, *report_max, *report; //View2D *v2d= UI_view2d_fromcontext(C); @@ -228,7 +228,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) rcti rect; //rctf rectf, rq; - short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); + short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); //int mval[2]; rect.xmin = RNA_int_get(op->ptr, "xmin"); @@ -237,54 +237,54 @@ static int borderselect_exec(bContext *C, wmOperator *op) rect.ymax = RNA_int_get(op->ptr, "ymax"); #if 0 - mval[0]= rect.xmin; - mval[1]= rect.ymin; + mval[0] = rect.xmin; + mval[1] = rect.ymin; UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin); - mval[0]= rect.xmax; - mval[1]= rect.ymax; + mval[0] = rect.xmax; + mval[1] = rect.ymax; UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax); #endif if (!extend) { - for (report= reports->list.first; report; report= report->next) { + for (report = reports->list.first; report; report = report->next) { - if ((report->type & report_mask)==0) + if ((report->type & report_mask) == 0) continue; report->flag &= ~SELECT; } } - report_min= info_text_pick(sinfo, ar, reports, rect.ymax); - report_max= info_text_pick(sinfo, ar, reports, rect.ymin); + report_min = info_text_pick(sinfo, ar, reports, rect.ymax); + report_max = info_text_pick(sinfo, ar, reports, rect.ymin); /* get the first report if none found */ - if (report_min==NULL) { + if (report_min == NULL) { // printf("find_min\n"); - for (report=reports->list.first; report; report=report->next) { + for (report = reports->list.first; report; report = report->next) { if (report->type & report_mask) { - report_min= report; + report_min = report; break; } } } - if (report_max==NULL) { + if (report_max == NULL) { // printf("find_max\n"); - for (report=reports->list.last; report; report=report->prev) { + for (report = reports->list.last; report; report = report->prev) { if (report->type & report_mask) { - report_max= report; + report_max = report; break; } } } - if (report_min==NULL || report_max==NULL) + if (report_min == NULL || report_max == NULL) return OPERATOR_CANCELLED; - for (report= report_min; (report != report_max->next); report= report->next) { + for (report = report_min; (report != report_max->next); report = report->next) { - if ((report->type & report_mask)==0) + if ((report->type & report_mask) == 0) continue; if (selecting) @@ -326,16 +326,16 @@ void INFO_OT_select_border(wmOperatorType *ot) static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - ReportList *reports= CTX_wm_reports(C); - int report_mask= info_report_mask(sinfo); + SpaceInfo *sinfo = CTX_wm_space_info(C); + ReportList *reports = CTX_wm_reports(C); + int report_mask = info_report_mask(sinfo); Report *report, *report_next; - for (report=reports->list.first; report; ) { + for (report = reports->list.first; report; ) { - report_next=report->next; + report_next = report->next; if ((report->type & report_mask) && (report->flag & SELECT)) { BLI_remlink(&reports->list, report); @@ -343,7 +343,7 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) MEM_freeN(report); } - report= report_next; + report = report_next; } ED_area_tag_redraw(CTX_wm_area(C)); @@ -371,23 +371,23 @@ void INFO_OT_report_delete(wmOperatorType *ot) static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - ReportList *reports= CTX_wm_reports(C); - int report_mask= info_report_mask(sinfo); + SpaceInfo *sinfo = CTX_wm_space_info(C); + ReportList *reports = CTX_wm_reports(C); + int report_mask = info_report_mask(sinfo); Report *report; - DynStr *buf_dyn= BLI_dynstr_new(); + DynStr *buf_dyn = BLI_dynstr_new(); char *buf_str; - for (report=reports->list.first; report; report= report->next) { + for (report = reports->list.first; report; report = report->next) { if ((report->type & report_mask) && (report->flag & SELECT)) { BLI_dynstr_append(buf_dyn, report->message); BLI_dynstr_append(buf_dyn, "\n"); } } - buf_str= BLI_dynstr_get_cstring(buf_dyn); + buf_str = BLI_dynstr_get_cstring(buf_dyn); BLI_dynstr_free(buf_dyn); WM_clipboard_text_set(buf_str, 0); diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index a736fd01b2c..1c2f43f67a4 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -68,78 +68,78 @@ typedef struct SceneStats { static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) { - switch(ob->type) { - case OB_MESH: { - /* we assume derivedmesh is already built, this strictly does stats now. */ - DerivedMesh *dm= ob->derivedFinal; - int totvert, totedge, totface; - - stats->totmesh +=totob; - - if (dm) { - totvert = dm->getNumVerts(dm); - totedge = dm->getNumEdges(dm); - totface = dm->getNumPolys(dm); - - stats->totvert += totvert*totob; - stats->totedge += totedge*totob; - stats->totface += totface*totob; - - if (sel) { - stats->totvertsel += totvert; - stats->totfacesel += totface; + switch (ob->type) { + case OB_MESH: { + /* we assume derivedmesh is already built, this strictly does stats now. */ + DerivedMesh *dm = ob->derivedFinal; + int totvert, totedge, totface; + + stats->totmesh += totob; + + if (dm) { + totvert = dm->getNumVerts(dm); + totedge = dm->getNumEdges(dm); + totface = dm->getNumPolys(dm); + + stats->totvert += totvert * totob; + stats->totedge += totedge * totob; + stats->totface += totface * totob; + + if (sel) { + stats->totvertsel += totvert; + stats->totfacesel += totface; + } } + break; } - break; - } - case OB_LAMP: - stats->totlamp += totob; - break; - case OB_SURF: - case OB_CURVE: - case OB_FONT: { - int tot= 0, totf= 0; + case OB_LAMP: + stats->totlamp += totob; + break; + case OB_SURF: + case OB_CURVE: + case OB_FONT: { + int tot = 0, totf = 0; - stats->totcurve += totob; + stats->totcurve += totob; - if (ob->disp.first) - count_displist(&ob->disp, &tot, &totf); + if (ob->disp.first) + count_displist(&ob->disp, &tot, &totf); - tot *= totob; - totf *= totob; + tot *= totob; + totf *= totob; - stats->totvert+= tot; - stats->totface+= totf; + stats->totvert += tot; + stats->totface += totf; - if (sel) { - stats->totvertsel += tot; - stats->totfacesel += totf; + if (sel) { + stats->totvertsel += tot; + stats->totfacesel += totf; + } + break; } - break; - } - case OB_MBALL: { - int tot= 0, totf= 0; + case OB_MBALL: { + int tot = 0, totf = 0; - count_displist(&ob->disp, &tot, &totf); + count_displist(&ob->disp, &tot, &totf); - tot *= totob; - totf *= totob; + tot *= totob; + totf *= totob; - stats->totvert += tot; - stats->totface += totf; + stats->totvert += tot; + stats->totface += totf; - if (sel) { - stats->totvertsel += tot; - stats->totfacesel += totf; + if (sel) { + stats->totvertsel += tot; + stats->totfacesel += totf; + } + break; } - break; - } } } static void stats_object_edit(Object *obedit, SceneStats *stats) { - if (obedit->type==OB_MESH) { + if (obedit->type == OB_MESH) { BMEditMesh *em = BMEdit_FromObject(obedit); stats->totvert = em->bm->totvert; @@ -151,12 +151,12 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) stats->totface = em->bm->totface; stats->totfacesel = em->bm->totfacesel; } - else if (obedit->type==OB_ARMATURE) { + else if (obedit->type == OB_ARMATURE) { /* Armature Edit */ - bArmature *arm= obedit->data; + bArmature *arm = obedit->data; EditBone *ebo; - for (ebo=arm->edbo->first; ebo; ebo=ebo->next) { + for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { stats->totbone++; if ((ebo->flag & BONE_CONNECTED) && ebo->parent) @@ -170,27 +170,27 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) if (ebo->flag & BONE_SELECTED) stats->totbonesel++; /* if this is a connected child and it's parent is being moved, remove our root */ - if ((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL)) + if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL)) stats->totvertsel--; - stats->totvert+=2; + stats->totvert += 2; } } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { /* OB_FONT has no cu->editnurb */ /* Curve Edit */ - Curve *cu= obedit->data; + Curve *cu = obedit->data; Nurb *nu; BezTriple *bezt; BPoint *bp; int a; - ListBase *nurbs= curve_editnurbs(cu); + ListBase *nurbs = curve_editnurbs(cu); - for (nu=nurbs->first; nu; nu=nu->next) { + for (nu = nurbs->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; + bezt = nu->bezt; + a = nu->pntsu; while (a--) { - stats->totvert+=3; + stats->totvert += 3; if (bezt->f1) stats->totvertsel++; if (bezt->f2) stats->totvertsel++; if (bezt->f3) stats->totvertsel++; @@ -198,8 +198,8 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } } else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; + bp = nu->bp; + a = nu->pntsu * nu->pntsv; while (a--) { stats->totvert++; if (bp->f1 & SELECT) stats->totvertsel++; @@ -208,26 +208,26 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) } } } - else if (obedit->type==OB_MBALL) { + else if (obedit->type == OB_MBALL) { /* MetaBall Edit */ - MetaBall *mball= obedit->data; + MetaBall *mball = obedit->data; MetaElem *ml; - for (ml= mball->editelems->first; ml; ml=ml->next) { + for (ml = mball->editelems->first; ml; ml = ml->next) { stats->totvert++; if (ml->flag & SELECT) stats->totvertsel++; } } - else if (obedit->type==OB_LATTICE) { + else if (obedit->type == OB_LATTICE) { /* Lattice Edit */ - Lattice *lt= obedit->data; - Lattice *editlatt= lt->editlatt->latt; + Lattice *lt = obedit->data; + Lattice *editlatt = lt->editlatt->latt; BPoint *bp; int a; - bp= editlatt->def; + bp = editlatt->def; - a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; + a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw; while (a--) { stats->totvert++; if (bp->f1 & SELECT) stats->totvertsel++; @@ -239,10 +239,10 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) static void stats_object_pose(Object *ob, SceneStats *stats) { if (ob->pose) { - bArmature *arm= ob->data; + bArmature *arm = ob->data; bPoseChannel *pchan; - for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { stats->totbone++; if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) if (pchan->bone->layer & arm->layer) @@ -260,22 +260,22 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) ParticleSystem *psys; ParticleSettings *part; - for (psys=ob->particlesystem.first; psys; psys=psys->next) { - part=psys->part; + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + part = psys->part; - if (part->draw_as==PART_DRAW_OB && part->dup_ob) { - int tot=count_particles(psys); + if (part->draw_as == PART_DRAW_OB && part->dup_ob) { + int tot = count_particles(psys); stats_object(part->dup_ob, 0, tot, stats); } - else if (part->draw_as==PART_DRAW_GR && part->dup_group) { + else if (part->draw_as == PART_DRAW_GR && part->dup_group) { GroupObject *go; - int tot, totgroup=0, cur=0; + int tot, totgroup = 0, cur = 0; - for (go= part->dup_group->gobject.first; go; go=go->next) + for (go = part->dup_group->gobject.first; go; go = go->next) totgroup++; - for (go= part->dup_group->gobject.first; go; go=go->next) { - tot=count_particles_mod(psys,totgroup,cur); + for (go = part->dup_group->gobject.first; go; go = go->next) { + tot = count_particles_mod(psys, totgroup, cur); stats_object(go->ob, 0, tot, stats); cur++; } @@ -285,22 +285,22 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) stats_object(ob, base->flag & SELECT, 1, stats); stats->totobj++; } - else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) { + else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES))) { /* Dupli Verts/Faces */ - int tot= count_duplilist(ob->parent); - stats->totobj+=tot; + int tot = count_duplilist(ob->parent); + stats->totobj += tot; stats_object(ob, base->flag & SELECT, tot, stats); } else if (ob->transflag & OB_DUPLIFRAMES) { /* Dupli Frames */ - int tot= count_duplilist(ob); - stats->totobj+=tot; + int tot = count_duplilist(ob); + stats->totobj += tot; stats_object(ob, base->flag & SELECT, tot, stats); } else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { /* Dupli Group */ - int tot= count_duplilist(ob); - stats->totobj+=tot; + int tot = count_duplilist(ob); + stats->totobj += tot; stats_object(ob, base->flag & SELECT, tot, stats); } else { @@ -313,8 +313,8 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) /* Statistics displayed in info header. Called regularly on scene changes. */ static void stats_update(Scene *scene) { - SceneStats stats= {0}; - Object *ob= (scene->basact)? scene->basact->object: NULL; + SceneStats stats = {0}; + Object *ob = (scene->basact) ? scene->basact->object : NULL; Base *base; if (scene->obedit) { @@ -327,78 +327,78 @@ static void stats_update(Scene *scene) } else { /* Objects */ - for (base= scene->base.first; base; base=base->next) + for (base = scene->base.first; base; base = base->next) if (scene->lay & base->lay) stats_dupli_object(base, base->object, &stats); } if (!scene->stats) - scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats"); + scene->stats = MEM_callocN(sizeof(SceneStats), "SceneStats"); - *(scene->stats)= stats; + *(scene->stats) = stats; } static void stats_string(Scene *scene) { - SceneStats *stats= scene->stats; - Object *ob= (scene->basact)? scene->basact->object: NULL; + SceneStats *stats = scene->stats; + Object *ob = (scene->basact) ? scene->basact->object : NULL; uintptr_t mem_in_use, mmap_in_use; char memstr[64]; char *s; - mem_in_use= MEM_get_memory_in_use(); - mmap_in_use= MEM_get_mapped_memory_in_use(); + mem_in_use = MEM_get_memory_in_use(); + mmap_in_use = MEM_get_mapped_memory_in_use(); /* get memory statistics */ - s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0); + s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0); if (mmap_in_use) - sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0); + sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0); - s= stats->infostr; + s = stats->infostr; - s+= sprintf(s, "%s | ", versionstr); + s += sprintf(s, "%s | ", versionstr); if (scene->obedit) { if (ob_get_keyblock(scene->obedit)) - s+= sprintf(s, "(Key) "); + s += sprintf(s, "(Key) "); - if (scene->obedit->type==OB_MESH) { + if (scene->obedit->type == OB_MESH) { if (scene->toolsettings->selectmode & SCE_SELECT_VERTEX) - s+= sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d", - stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); + s += sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d", + stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); else if (scene->toolsettings->selectmode & SCE_SELECT_EDGE) - s+= sprintf(s, "Ed:%d-%d | Fa:%d-%d", - stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); + s += sprintf(s, "Ed:%d-%d | Fa:%d-%d", + stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface); else - s+= sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface); + s += sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface); } - else if (scene->obedit->type==OB_ARMATURE) { - s+= sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone); + else if (scene->obedit->type == OB_ARMATURE) { + s += sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone); } else { - s+= sprintf(s, "Ve:%d-%d", stats->totvertsel, stats->totvert); + s += sprintf(s, "Ve:%d-%d", stats->totvertsel, stats->totvert); } strcat(s, memstr); } else if (ob && (ob->mode & OB_MODE_POSE)) { s += sprintf(s, "Bo:%d-%d %s", - stats->totbonesel, stats->totbone, memstr); + stats->totbonesel, stats->totbone, memstr); } else { s += sprintf(s, "Ve:%d | Fa:%d | Ob:%d-%d | La:%d%s", - stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr); + stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr); } if (ob) - sprintf(s, " | %s", ob->id.name+2); + sprintf(s, " | %s", ob->id.name + 2); } void ED_info_stats_clear(Scene *scene) { if (scene->stats) { MEM_freeN(scene->stats); - scene->stats= NULL; + scene->stats = NULL; } } diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 9dc58537145..7cb89b6bc6b 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -57,7 +57,7 @@ #include "UI_interface.h" #include "UI_view2d.h" -#include "info_intern.h" // own include +#include "info_intern.h" /* own include */ /* ******************** default callbacks for info space ***************** */ @@ -66,31 +66,31 @@ static SpaceLink *info_new(const bContext *UNUSED(C)) ARegion *ar; SpaceInfo *sinfo; - sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo"); - sinfo->spacetype= SPACE_INFO; + sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo"); + sinfo->spacetype = SPACE_INFO; - sinfo->rpt_mask= INFO_RPT_OP; + sinfo->rpt_mask = INFO_RPT_OP; /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for info"); + ar = MEM_callocN(sizeof(ARegion), "header for info"); BLI_addtail(&sinfo->regionbase, ar); - ar->regiontype= RGN_TYPE_HEADER; - ar->alignment= RGN_ALIGN_BOTTOM; + ar->regiontype = RGN_TYPE_HEADER; + ar->alignment = RGN_ALIGN_BOTTOM; /* main area */ - ar= MEM_callocN(sizeof(ARegion), "main area for info"); + ar = MEM_callocN(sizeof(ARegion), "main area for info"); BLI_addtail(&sinfo->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; + ar->regiontype = RGN_TYPE_WINDOW; /* keep in sync with console */ ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */ + ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */ ar->v2d.keepofs |= V2D_LOCKOFS_X; - ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT); - ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS; - ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f; + ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); + ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; + ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ //ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM); @@ -114,7 +114,7 @@ static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) static SpaceLink *info_duplicate(SpaceLink *sl) { - SpaceInfo *sinfon= MEM_dupallocN(sl); + SpaceInfo *sinfon = MEM_dupallocN(sl); /* clear or remove stuff from old */ @@ -137,17 +137,17 @@ static void info_main_area_init(wmWindowManager *wm, ARegion *ar) static void info_textview_update_rect(const bContext *C, ARegion *ar) { - SpaceInfo *sinfo= CTX_wm_space_info(C); - View2D *v2d= &ar->v2d; + SpaceInfo *sinfo = CTX_wm_space_info(C); + View2D *v2d = &ar->v2d; - UI_view2d_totRect_set(v2d, ar->winx-1, info_textview_height(sinfo, ar, CTX_wm_reports(C))); + UI_view2d_totRect_set(v2d, ar->winx - 1, info_textview_height(sinfo, ar, CTX_wm_reports(C))); } static void info_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceInfo *sinfo= CTX_wm_space_info(C); - View2D *v2d= &ar->v2d; + SpaceInfo *sinfo = CTX_wm_space_info(C); + View2D *v2d = &ar->v2d; View2DScrollers *scrollers; /* clear and setup matrix */ @@ -169,7 +169,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP); + scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } @@ -231,7 +231,7 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) // SpaceInfo *sinfo= sa->spacedata.first; /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SPACE: if (wmn->data == ND_SPACE_INFO_REPORT) { /* redraw also but only for report view, could do less redraws by checking the type */ @@ -244,7 +244,7 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) static void info_header_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCREEN: if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) ED_region_tag_redraw(ar); @@ -254,7 +254,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; case NC_SCENE: - if (wmn->data==ND_RENDER_RESULT) + if (wmn->data == ND_RENDER_RESULT) ED_region_tag_redraw(ar); break; case NC_SPACE: @@ -271,7 +271,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; - uiLayout *layout= menu->layout; + uiLayout *layout = menu->layout; uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); if (G.recent_files.first) { for (recent = G.recent_files.first; (recent); recent = recent->next) { @@ -287,49 +287,49 @@ static void recent_files_menu_register(void) { MenuType *mt; - mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); + mt = MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); strcpy(mt->label, N_("Open Recent...")); - mt->draw= recent_files_menu_draw; + mt->draw = recent_files_menu_draw; WM_menutype_add(mt); } /* only called once, from space/spacetypes.c */ void ED_spacetype_info(void) { - SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype info"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info"); ARegionType *art; - st->spaceid= SPACE_INFO; + st->spaceid = SPACE_INFO; strncpy(st->name, "Info", BKE_ST_MAXNAME); - st->new= info_new; - st->free= info_free; - st->init= info_init; - st->duplicate= info_duplicate; - st->operatortypes= info_operatortypes; - st->keymap= info_keymap; + st->new = info_new; + st->free = info_free; + st->init = info_init; + st->duplicate = info_duplicate; + st->operatortypes = info_operatortypes; + st->keymap = info_keymap; /* regions: main window */ - art= MEM_callocN(sizeof(ARegionType), "spacetype info region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype info region"); art->regionid = RGN_TYPE_WINDOW; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; - art->init= info_main_area_init; - art->draw= info_main_area_draw; - art->listener= info_main_area_listener; + art->init = info_main_area_init; + art->draw = info_main_area_draw; + art->listener = info_main_area_listener; BLI_addhead(&st->regiontypes, art); /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype info region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype info region"); art->regionid = RGN_TYPE_HEADER; - art->prefsizey= HEADERY; + art->prefsizey = HEADERY; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER; - art->listener= info_header_listener; - art->init= info_header_area_init; - art->draw= info_header_area_draw; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; + art->listener = info_header_listener; + art->init = info_header_area_init; + art->draw = info_header_area_draw; BLI_addhead(&st->regiontypes, art); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index c55ba069e11..4ba196276da 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -47,7 +47,7 @@ static void console_font_begin(TextViewContext *sc) { - BLF_size(blf_mono_font, sc->lheight-2, 72); + BLF_size(blf_mono_font, sc->lheight - 2, 72); } typedef struct ConsoleDrawContext { @@ -71,14 +71,14 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_halftone); - glEnable( GL_BLEND ); + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4ub(255, 255, 255, 96); - glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2); + glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2); glDisable(GL_POLYGON_STIPPLE); - glDisable( GL_BLEND ); + glDisable(GL_BLEND); } } @@ -89,13 +89,13 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str_len, unsigned char *fg, unsigned char *bg) { #define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value) - int rct_ofs= cdc->lheight/4; - int tot_lines = (str_len/cdc->console_width)+1; /* total number of lines for wrapping */ - int y_next = (str_len > cdc->console_width) ? cdc->xy[1]+cdc->lheight*tot_lines : cdc->xy[1]+cdc->lheight; - const int mono= blf_mono_font; + int rct_ofs = cdc->lheight / 4; + int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */ + int y_next = (str_len > cdc->console_width) ? cdc->xy[1] + cdc->lheight * tot_lines : cdc->xy[1] + cdc->lheight; + const int mono = blf_mono_font; /* just advance the height */ - if (cdc->draw==0) { + if (cdc->draw == 0) { if (cdc->pos_pick && (cdc->mval[1] != INT_MAX)) { if (cdc->xy[1] <= cdc->mval[1]) { if ((y_next >= cdc->mval[1])) { @@ -103,7 +103,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str /* wrap */ if (str_len > cdc->console_width) - ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines)))); + ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next - cdc->xy[1])) * tot_lines)))); CLAMP(ofs, 0, str_len); *cdc->pos_pick += str_len - ofs; @@ -113,12 +113,12 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } } - cdc->xy[1]= y_next; + cdc->xy[1] = y_next; return 1; } - else if (y_next-cdc->lheight < cdc->ymin) { + else if (y_next - cdc->lheight < cdc->ymin) { /* have not reached the drawable area so don't break */ - cdc->xy[1]= y_next; + cdc->xy[1] = y_next; /* adjust selection even if not drawing */ if (cdc->sel[0] != cdc->sel[1]) { @@ -129,8 +129,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } if (str_len > cdc->console_width) { /* wrap? */ - const int initial_offset= ((tot_lines-1) * cdc->console_width); - const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */ + const int initial_offset = ((tot_lines - 1) * cdc->console_width); + const char *line_stride = str + initial_offset; /* advance to the last line and draw it first */ int sel_orig[2]; copy_v2_v2_int(sel_orig, cdc->sel); @@ -141,7 +141,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { glColor3ubv(bg); - glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs); + glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines)) + rct_ofs); } glColor3ubv(fg); @@ -187,7 +187,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { glColor3ubv(bg); - glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs); + glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, cdc->xy[1] + cdc->lheight - rct_ofs); } glColor3ubv(fg); @@ -198,8 +198,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (cdc->sel[0] != cdc->sel[1]) { int isel[2]; - isel[0]= str_len - cdc->sel[1]; - isel[1]= str_len - cdc->sel[0]; + isel[0] = str_len - cdc->sel[1]; + isel[1] = str_len - cdc->sel[0]; // glColor4ub(255, 255, 0, 96); // debug console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); @@ -221,17 +221,17 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick) { - ConsoleDrawContext cdc= {0}; + ConsoleDrawContext cdc = {0}; - int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN + tvc->lheight/6; + int x_orig = CONSOLE_DRAW_MARGIN, y_orig = CONSOLE_DRAW_MARGIN + tvc->lheight / 6; int xy[2], y_prev; - int sel[2]= {-1, -1}; /* defaults disabled */ + int sel[2] = {-1, -1}; /* defaults disabled */ unsigned char fg[3], bg[3]; - const int mono= blf_mono_font; + const int mono = blf_mono_font; console_font_begin(tvc); - xy[0]= x_orig; xy[1]= y_orig; + xy[0] = x_orig; xy[1] = y_orig; if (mval[1] != INT_MAX) mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN); @@ -240,28 +240,28 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick *pos_pick = 0; /* constants for the sequencer context */ - cdc.cwidth= (int)BLF_fixed_width(mono); + cdc.cwidth = (int)BLF_fixed_width(mono); assert(cdc.cwidth > 0); - cdc.lheight= tvc->lheight; - cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth; + cdc.lheight = tvc->lheight; + cdc.console_width = (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth; CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */ - cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL); + cdc.winx = tvc->winx - (CONSOLE_DRAW_MARGIN + CONSOLE_DRAW_SCROLL); cdc.ymin = tvc->ymin; cdc.ymax = tvc->ymax; - cdc.xy= xy; - cdc.sel= sel; - cdc.pos_pick= pos_pick; - cdc.mval= mval; - cdc.draw= draw; + cdc.xy = xy; + cdc.sel = sel; + cdc.pos_pick = pos_pick; + cdc.mval = mval; + cdc.draw = draw; /* shouldnt be needed */ - tvc->cwidth= cdc.cwidth; - tvc->console_width= cdc.console_width; - tvc->iter_index= 0; + tvc->cwidth = cdc.cwidth; + tvc->console_width = cdc.console_width; + tvc->iter_index = 0; if (tvc->sel_start != tvc->sel_end) { - sel[0]= tvc->sel_start; - sel[1]= tvc->sel_end; + sel[0] = tvc->sel_start; + sel[1] = tvc->sel_end; } if (tvc->begin(tvc)) { @@ -269,12 +269,12 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick do { const char *ext_line; int ext_len; - int color_flag= 0; + int color_flag = 0; - y_prev= xy[1]; + y_prev = xy[1]; if (draw) - color_flag= tvc->line_color(tvc, fg, bg); + color_flag = tvc->line_color(tvc, fg, bg); tvc->line_get(tvc, &ext_line, &ext_len); @@ -286,7 +286,7 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick } if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) { - *mouse_pick= (void *)tvc->iter; + *mouse_pick = (void *)tvc->iter; break; } |