diff options
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/info_draw.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_report.c | 64 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 114 | ||||
-rw-r--r-- | source/blender/editors/space_info/space_info.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.c | 51 |
6 files changed, 148 insertions, 144 deletions
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 19bbc33e606..c06a778951d 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -65,9 +65,9 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool) { - if(report->flag & SELECT) { + if (report->flag & SELECT) { fg[0]=255; fg[1]=255; fg[2]=255; - if(bool) { + if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; } else { @@ -114,7 +114,7 @@ static void report_textview_init__internal(TextViewContext *tvc) const char *str= report->message; const char *next_str= strchr(str + tvc->iter_char, '\n'); - if(next_str) { + if (next_str) { tvc->iter_char_next= (int)(next_str - str); } else { @@ -151,7 +151,7 @@ static int report_textview_begin(TextViewContext *tvc) #ifdef USE_INFO_NEWLINE tvc->iter_tmp= 0; - if(tvc->iter && report_textview_skip__internal(tvc)) { + if (tvc->iter && report_textview_skip__internal(tvc)) { /* init the newline iterator */ tvc->iter_char= 0; report_textview_init__internal(tvc); @@ -177,9 +177,9 @@ static int report_textview_step(TextViewContext *tvc) /* simple case, but no newline support */ Report *report= (Report *)tvc->iter; - if(report->len <= tvc->iter_char_next) { + if (report->len <= tvc->iter_char_next) { tvc->iter= (void *)((Link *)tvc->iter)->prev; - if(tvc->iter && report_textview_skip__internal(tvc)) { + if (tvc->iter && report_textview_skip__internal(tvc)) { tvc->iter_tmp++; tvc->iter_char= 0; /* reset start */ diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index bceb7c3d747..3157b920ff0 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -85,16 +85,16 @@ static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) ImBuf *ibuf; // first check for dirty images - for(ima=bmain->image.first; ima; ima=ima->id.next) { - if(ima->ibufs.first) { /* XXX FIX */ + for (ima=bmain->image.first; ima; ima=ima->id.next) { + if (ima->ibufs.first) { /* XXX FIX */ ibuf= BKE_image_get_ibuf(ima, NULL); - if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) + if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) break; } } - if(ima) { + if (ima) { uiPupMenuOkee(C, "FILE_OT_pack_all", "Some images are painted on. These changes will be lost. Continue?"); return OPERATOR_CANCELLED; } @@ -132,7 +132,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) 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; @@ -148,13 +148,13 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) count = countPackedFiles(bmain); - if(!count) { + if (!count) { BKE_report(op->reports, RPT_WARNING, "No packed files. Autopack disabled"); G.fileflags &= ~G_AUTOPACK; return OPERATOR_CANCELLED; } - if(count == 1) + if (count == 1) strcpy(title, "Unpack 1 file"); else BLI_snprintf(title, sizeof(title), "Unpack %d files", count); @@ -193,7 +193,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); - if(!G.relbase_valid) { + if (!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file"); return OPERATOR_CANCELLED; } @@ -225,7 +225,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); - if(!G.relbase_valid) { + if (!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file"); return OPERATOR_CANCELLED; } @@ -339,7 +339,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm int send_note= 0; /* escape if not our timer */ - if( (reports->reporttimer==NULL) || + if ( (reports->reporttimer==NULL) || (reports->reporttimer != event->customdata) || ((report= BKE_reports_last_displayable(reports))==NULL) /* may have been deleted */ ) { @@ -363,15 +363,17 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm if (rti->widthfac == 0.0f) { /* initialize colors based on report type */ - if(report->type & RPT_ERROR_ALL) { + if (report->type & RPT_ERROR_ALL) { rti->col[0] = 1.0; rti->col[1] = 0.2; rti->col[2] = 0.0; - } else if(report->type & RPT_WARNING_ALL) { + } + else if (report->type & RPT_WARNING_ALL) { rti->col[0] = 1.0; rti->col[1] = 1.0; rti->col[2] = 0.0; - } else if(report->type & RPT_INFO_ALL) { + } + else if (report->type & RPT_INFO_ALL) { rti->col[0] = 0.3; rti->col[1] = 0.45; rti->col[2] = 0.7; @@ -384,7 +386,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm color_progress = (float)reports->reporttimer->duration / color_timeout; /* save us from too many draws */ - if(color_progress <= 1.0f) { + if (color_progress <= 1.0f) { send_note= 1; /* fade colors out sharply according to progress through fade-out duration */ @@ -399,7 +401,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm send_note= 1; } - if(send_note) { + if (send_note) { WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL); } diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 17b1c3fa269..4e6ccf2f2b1 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -53,11 +53,11 @@ 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 @@ -76,8 +76,8 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) #if 0 sc->type= CONSOLE_TYPE_PYTHON; - for(report=reports->list.last; report; report=report->prev) { - if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) { + 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); @@ -114,7 +114,7 @@ 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); - if(!report) + if (!report) return OPERATOR_CANCELLED; report->flag ^= SELECT; /* toggle */ @@ -172,22 +172,22 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op)) Report *report; - for(report=reports->list.last; report; report=report->prev) { - if((report->type & report_mask) && (report->flag & SELECT)) { + for (report=reports->list.last; report; report=report->prev) { + if ((report->type & report_mask) && (report->flag & SELECT)) { deselect= 1; break; } } - if(deselect) { - for(report=reports->list.last; report; report=report->prev) - if(report->type & report_mask) + if (deselect) { + 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) - if(report->type & report_mask) + for (report=reports->list.last; report; report=report->prev) + if (report->type & report_mask) report->flag |= SELECT; } @@ -245,10 +245,10 @@ static int borderselect_exec(bContext *C, wmOperator *op) 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) { + if (!extend) { + 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; @@ -259,35 +259,35 @@ static int borderselect_exec(bContext *C, wmOperator *op) 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) { - if(report->type & report_mask) { + for (report=reports->list.first; report; report=report->next) { + if (report->type & report_mask) { 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) { - if(report->type & report_mask) { + for (report=reports->list.last; report; report=report->prev) { + if (report->type & report_mask) { 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) + if (selecting) report->flag |= SELECT; else report->flag &= ~SELECT; @@ -333,11 +333,11 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) Report *report, *report_next; - for(report=reports->list.first; report; ) { + for (report=reports->list.first; report; ) { report_next=report->next; - if((report->type & report_mask) && (report->flag & SELECT)) { + if ((report->type & report_mask) && (report->flag & SELECT)) { BLI_remlink(&reports->list, report); MEM_freeN((void *)report->message); MEM_freeN(report); @@ -380,8 +380,8 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) DynStr *buf_dyn= BLI_dynstr_new(); char *buf_str; - for(report=reports->list.first; report; report= report->next) { - if((report->type & report_mask) && (report->flag & SELECT)) { + 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"); } diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index ea28057968a..59e4a1aaf04 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -76,7 +76,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totmesh +=totob; - if(dm) { + if (dm) { totvert = dm->getNumVerts(dm); totedge = dm->getNumEdges(dm); totface = dm->getNumPolys(dm); @@ -85,7 +85,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totedge += totedge*totob; stats->totface += totface*totob; - if(sel) { + if (sel) { stats->totvertsel += totvert; stats->totfacesel += totface; } @@ -102,7 +102,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totcurve += totob; - if(ob->disp.first) + if (ob->disp.first) count_displist(&ob->disp, &tot, &totf); tot *= totob; @@ -111,7 +111,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totvert+= tot; stats->totface+= totf; - if(sel) { + if (sel) { stats->totvertsel += tot; stats->totfacesel += totf; } @@ -128,7 +128,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) stats->totvert += tot; stats->totface += totf; - if(sel) { + if (sel) { stats->totvertsel += tot; stats->totfacesel += totf; } @@ -139,7 +139,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) 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,26 +151,26 @@ 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; 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) + if ((ebo->flag & BONE_CONNECTED) && ebo->parent) stats->totvert--; - if(ebo->flag & BONE_TIPSEL) + if (ebo->flag & BONE_TIPSEL) stats->totvertsel++; - if(ebo->flag & BONE_ROOTSEL) + if (ebo->flag & BONE_ROOTSEL) stats->totvertsel++; - if(ebo->flag & BONE_SELECTED) stats->totbonesel++; + 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; @@ -185,40 +185,40 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) int a; ListBase *nurbs= curve_editnurbs(cu); - for(nu=nurbs->first; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) { + for (nu=nurbs->first; nu; nu=nu->next) { + if (nu->type == CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; - while(a--) { + while (a--) { stats->totvert+=3; - if(bezt->f1) stats->totvertsel++; - if(bezt->f2) stats->totvertsel++; - if(bezt->f3) stats->totvertsel++; + if (bezt->f1) stats->totvertsel++; + if (bezt->f2) stats->totvertsel++; + if (bezt->f3) stats->totvertsel++; bezt++; } } else { bp= nu->bp; a= nu->pntsu*nu->pntsv; - while(a--) { + while (a--) { stats->totvert++; - if(bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) stats->totvertsel++; bp++; } } } } - else if(obedit->type==OB_MBALL) { + else if (obedit->type==OB_MBALL) { /* MetaBall Edit */ 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++; + 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; @@ -228,9 +228,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) bp= editlatt->def; a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; - while(a--) { + while (a--) { stats->totvert++; - if(bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) stats->totvertsel++; bp++; } } @@ -238,14 +238,14 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) static void stats_object_pose(Object *ob, SceneStats *stats) { - if(ob->pose) { + if (ob->pose) { 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) + if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) + if (pchan->bone->layer & arm->layer) stats->totbonesel++; } } @@ -253,28 +253,28 @@ static void stats_object_pose(Object *ob, SceneStats *stats) static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) { - if(base->flag & SELECT) stats->totobjsel++; + if (base->flag & SELECT) stats->totobjsel++; - if(ob->transflag & OB_DUPLIPARTS) { + if (ob->transflag & OB_DUPLIPARTS) { /* Dupli Particles */ ParticleSystem *psys; ParticleSettings *part; - for(psys=ob->particlesystem.first; psys; psys=psys->next){ + for (psys=ob->particlesystem.first; psys; psys=psys->next) { part=psys->part; - if(part->draw_as==PART_DRAW_OB && part->dup_ob){ + 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; - 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) { + 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,19 +285,19 @@ 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; stats_object(ob, base->flag & SELECT, tot, stats); } - else if(ob->transflag & OB_DUPLIFRAMES) { + else if (ob->transflag & OB_DUPLIFRAMES) { /* Dupli Frames */ 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) { + else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { /* Dupli Group */ int tot= count_duplilist(ob); stats->totobj+=tot; @@ -317,22 +317,22 @@ static void stats_update(Scene *scene) Object *ob= (scene->basact)? scene->basact->object: NULL; Base *base; - if(scene->obedit) { + if (scene->obedit) { /* Edit Mode */ stats_object_edit(scene->obedit, &stats); } - else if(ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { /* Pose Mode */ stats_object_pose(ob, &stats); } else { /* Objects */ - for(base= scene->base.first; base; base=base->next) - if(scene->lay & base->lay) + for (base= scene->base.first; base; base=base->next) + if (scene->lay & base->lay) stats_dupli_object(base, base->object, &stats); } - if(!scene->stats) + if (!scene->stats) scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats"); *(scene->stats)= stats; @@ -351,28 +351,28 @@ static void stats_string(Scene *scene) /* get memory statistics */ s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0); - if(mmap_in_use) + if (mmap_in_use) sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0); s= stats->infostr; s+= sprintf(s, "%s | ", versionstr); - if(scene->obedit) { - if(ob_get_keyblock(scene->obedit)) + if (scene->obedit) { + if (ob_get_keyblock(scene->obedit)) s+= sprintf(s, "(Key) "); - if(scene->obedit->type==OB_MESH) { - if(scene->toolsettings->selectmode & SCE_SELECT_VERTEX) + 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); - else if(scene->toolsettings->selectmode & SCE_SELECT_EDGE) + 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); else s+= sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface); } - else if(scene->obedit->type==OB_ARMATURE) { + 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 { @@ -381,7 +381,7 @@ static void stats_string(Scene *scene) strcat(s, memstr); } - else if(ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (ob->mode & OB_MODE_POSE)) { s += sprintf(s, "Bo:%d-%d %s", stats->totbonesel, stats->totbone, memstr); } @@ -390,13 +390,13 @@ static void stats_string(Scene *scene) stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr); } - if(ob) + if (ob) sprintf(s, " | %s", ob->id.name+2); } void ED_info_stats_clear(Scene *scene) { - if(scene->stats) { + if (scene->stats) { MEM_freeN(scene->stats); scene->stats= NULL; } @@ -404,7 +404,7 @@ void ED_info_stats_clear(Scene *scene) const char *ED_info_stats_string(Scene *scene) { - if(!scene->stats) + if (!scene->stats) stats_update(scene); stats_string(scene); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 2d3eb68c84d..9dc58537145 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -155,7 +155,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* quick way to avoid drawing if not bug enough */ - if(ar->winy < 16) + if (ar->winy < 16) return; info_textview_update_rect(C, ar); @@ -233,7 +233,7 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) /* context changes */ switch(wmn->category) { case NC_SPACE: - if(wmn->data == ND_SPACE_INFO_REPORT) { + if (wmn->data == ND_SPACE_INFO_REPORT) { /* redraw also but only for report view, could do less redraws by checking the type */ ED_region_tag_redraw(ar); } @@ -246,23 +246,23 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) /* context changes */ switch(wmn->category) { case NC_SCREEN: - if(ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) + if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) ED_region_tag_redraw(ar); break; case NC_WM: - if(wmn->data == ND_JOB) + if (wmn->data == ND_JOB) 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: - if(wmn->data == ND_SPACE_INFO) + if (wmn->data == ND_SPACE_INFO) ED_region_tag_redraw(ar); break; case NC_ID: - if(wmn->action == NA_RENAME) + if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); } @@ -274,10 +274,11 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) 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) { + for (recent = G.recent_files.first; (recent); recent = recent->next) { uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } - } else { + } + else { uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE); } } diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 5b461d8a518..04bb97ee431 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -65,7 +65,7 @@ typedef struct ConsoleDrawContext { static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { - if(sel[0] <= str_len_draw && sel[1] >= 0) { + if (sel[0] <= str_len_draw && sel[1] >= 0) { int sta = MAX2(sel[0], 0); int end = MIN2(sel[1], str_len_draw); @@ -95,19 +95,20 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str const int mono= blf_mono_font; /* just advance the height */ - 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])) { + 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])) { int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth)); /* wrap */ - if(str_len > cdc->console_width) + 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)))); CLAMP(ofs, 0, str_len); *cdc->pos_pick += str_len - ofs; - } else + } + else *cdc->pos_pick += str_len + 1; } } @@ -120,14 +121,14 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->xy[1]= y_next; /* adjust selection even if not drawing */ - if(cdc->sel[0] != cdc->sel[1]) { + if (cdc->sel[0] != cdc->sel[1]) { STEP_SEL(-(str_len + 1)); } return 1; } - if(str_len > cdc->console_width) { /* wrap? */ + 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 */ @@ -138,7 +139,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->sel[0] = str_len - sel_orig[1]; cdc->sel[1] = str_len - sel_orig[0]; - if(bg) { + if (bg) { glColor3ubv(bg); glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs); } @@ -149,7 +150,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str BLF_position(mono, cdc->xy[0], cdc->xy[1], 0); BLF_draw(mono, line_stride, str_len - initial_offset); - if(cdc->sel[0] != cdc->sel[1]) { + if (cdc->sel[0] != cdc->sel[1]) { STEP_SEL(-initial_offset); // glColor4ub(255, 0, 0, 96); // debug console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); @@ -161,11 +162,11 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str line_stride -= cdc->console_width; - for(; line_stride >= str; line_stride -= cdc->console_width) { + for (; line_stride >= str; line_stride -= cdc->console_width) { BLF_position(mono, cdc->xy[0], cdc->xy[1], 0); BLF_draw(mono, line_stride, cdc->console_width); - if(cdc->sel[0] != cdc->sel[1]) { + if (cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); @@ -175,7 +176,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->xy[1] += cdc->lheight; /* check if were out of view bounds */ - if(cdc->xy[1] > cdc->ymax) + if (cdc->xy[1] > cdc->ymax) return 0; } @@ -184,7 +185,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } else { /* simple, no wrap */ - if(bg) { + if (bg) { glColor3ubv(bg); glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs); } @@ -194,7 +195,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str BLF_position(mono, cdc->xy[0], cdc->xy[1], 0); BLF_draw(mono, str, str_len); - if(cdc->sel[0] != cdc->sel[1]) { + if (cdc->sel[0] != cdc->sel[1]) { int isel[2]; isel[0]= str_len - cdc->sel[1]; @@ -207,7 +208,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->xy[1] += cdc->lheight; - if(cdc->xy[1] > cdc->ymax) + if (cdc->xy[1] > cdc->ymax) return 0; } @@ -232,10 +233,10 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick xy[0]= x_orig; xy[1]= y_orig; - if(mval[1] != INT_MAX) + if (mval[1] != INT_MAX) mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN); - if(pos_pick) + if (pos_pick) *pos_pick = 0; /* constants for the sequencer context */ @@ -258,12 +259,12 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick tvc->console_width= cdc.console_width; tvc->iter_index= 0; - if(tvc->sel_start != tvc->sel_end) { + if (tvc->sel_start != tvc->sel_end) { sel[0]= tvc->sel_start; sel[1]= tvc->sel_end; } - if(tvc->begin(tvc)) { + if (tvc->begin(tvc)) { do { const char *ext_line; @@ -272,19 +273,19 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick y_prev= xy[1]; - if(draw) + if (draw) color_flag= tvc->line_color(tvc, fg, bg); tvc->line_get(tvc, &ext_line, &ext_len); - if(!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) { + if (!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) { /* when drawing, if we pass v2d->cur.ymax, then quit */ - if(draw) { + if (draw) { break; /* past the y limits */ } } - if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) { + if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) { *mouse_pick= (void *)tvc->iter; break; } |