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_console/space_console.c | |
parent | ca8d262e89c25d15368ec4eb2fe80111e732e1f7 (diff) |
style cleanup
Diffstat (limited to 'source/blender/editors/space_console/space_console.c')
-rw-r--r-- | source/blender/editors/space_console/space_console.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 1867f93b1ef..0dbd4876a65 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -54,7 +54,7 @@ #include "UI_resources.h" #include "UI_view2d.h" -#include "console_intern.h" // own include +#include "console_intern.h" // own include /* ******************** default callbacks for console space ***************** */ @@ -63,32 +63,32 @@ static SpaceLink *console_new(const bContext *UNUSED(C)) ARegion *ar; SpaceConsole *sconsole; - sconsole= MEM_callocN(sizeof(SpaceConsole), "initconsole"); - sconsole->spacetype= SPACE_CONSOLE; + sconsole = MEM_callocN(sizeof(SpaceConsole), "initconsole"); + sconsole->spacetype = SPACE_CONSOLE; - sconsole->lheight= 14; + sconsole->lheight = 14; /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for console"); + ar = MEM_callocN(sizeof(ARegion), "header for console"); BLI_addtail(&sconsole->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 text"); + ar = MEM_callocN(sizeof(ARegion), "main area for text"); BLI_addtail(&sconsole->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; + ar->regiontype = RGN_TYPE_WINDOW; /* keep in sync with info */ 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); @@ -99,7 +99,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C)) /* not spacelink itself */ static void console_free(SpaceLink *sl) { - SpaceConsole *sc= (SpaceConsole*) sl; + SpaceConsole *sc = (SpaceConsole *) sl; while (sc->scrollback.first) console_scrollback_free(sc, sc->scrollback.first); @@ -117,13 +117,13 @@ static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa) static SpaceLink *console_duplicate(SpaceLink *sl) { - SpaceConsole *sconsolen= MEM_dupallocN(sl); + SpaceConsole *sconsolen = MEM_dupallocN(sl); /* clear or remove stuff from old */ /* TODO - duplicate?, then we also need to duplicate the py namespace */ - sconsolen->scrollback.first= sconsolen->scrollback.last= NULL; - sconsolen->history.first= sconsolen->history.last= NULL; + sconsolen->scrollback.first = sconsolen->scrollback.last = NULL; + sconsolen->history.first = sconsolen->history.last = NULL; return (SpaceLink *)sconsolen; } @@ -136,13 +136,13 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; - const float prev_y_min= ar->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */ + const float prev_y_min = ar->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); /* always keep the bottom part of the view aligned, less annoying */ if (prev_y_min != ar->v2d.cur.ymin) { - const float cur_y_range= ar->v2d.cur.ymax - ar->v2d.cur.ymin; + const float cur_y_range = ar->v2d.cur.ymax - ar->v2d.cur.ymin; ar->v2d.cur.ymin = prev_y_min; ar->v2d.cur.ymax = prev_y_min + cur_y_range; } @@ -152,7 +152,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ - lb= WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); + lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); WM_event_add_dropbox_handler(&ar->handlers, lb); } @@ -163,7 +163,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { // SpaceConsole *sc= CTX_wm_space_console(C); - if (drag->type==WM_DRAG_ID) + if (drag->type == WM_DRAG_ID) return 1; return 0; } @@ -171,10 +171,10 @@ static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event static void id_drop_copy(wmDrag *drag, wmDropBox *drop) { char text[64]; - ID *id= drag->poin; + ID *id = drag->poin; char id_esc[(sizeof(id->name) - 2) * 2]; - BLI_strescape(id_esc, id->name+2, sizeof(id_esc)); + BLI_strescape(id_esc, id->name + 2, sizeof(id_esc)); BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); @@ -185,14 +185,14 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { // SpaceConsole *sc= CTX_wm_space_console(C); - if (drag->type==WM_DRAG_PATH) + if (drag->type == WM_DRAG_PATH) return 1; return 0; } static void path_drop_copy(wmDrag *drag, wmDropBox *drop) { - char pathname[FILE_MAX+2]; + char pathname[FILE_MAX + 2]; BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); RNA_string_set(drop->ptr, "text", pathname); } @@ -201,7 +201,7 @@ static void path_drop_copy(wmDrag *drag, wmDropBox *drop) /* this region dropbox definition */ static void console_dropboxes(void) { - ListBase *lb= WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); + ListBase *lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); WM_dropbox_add(lb, "CONSOLE_OT_insert", id_drop_poll, id_drop_copy); WM_dropbox_add(lb, "CONSOLE_OT_insert", path_drop_poll, path_drop_copy); @@ -212,11 +212,11 @@ static void console_dropboxes(void) static void console_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceConsole *sc= CTX_wm_space_console(C); - View2D *v2d= &ar->v2d; + SpaceConsole *sc = CTX_wm_space_console(C); + View2D *v2d = &ar->v2d; View2DScrollers *scrollers; - if (sc->scrollback.first==NULL) + if (sc->scrollback.first == NULL) WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL); /* clear and setup matrix */ @@ -235,7 +235,7 @@ static void console_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); } @@ -355,7 +355,7 @@ static void console_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_CONSOLE) { /* generic redraw request */ ED_region_tag_redraw(ar); @@ -367,41 +367,41 @@ static void console_main_area_listener(ARegion *ar, wmNotifier *wmn) /* only called once, from space/spacetypes.c */ void ED_spacetype_console(void) { - SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype console"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype console"); ARegionType *art; - st->spaceid= SPACE_CONSOLE; + st->spaceid = SPACE_CONSOLE; strncpy(st->name, "Console", BKE_ST_MAXNAME); - st->new= console_new; - st->free= console_free; - st->init= console_init; - st->duplicate= console_duplicate; - st->operatortypes= console_operatortypes; - st->keymap= console_keymap; - st->dropboxes= console_dropboxes; + st->new = console_new; + st->free = console_free; + st->init = console_init; + st->duplicate = console_duplicate; + st->operatortypes = console_operatortypes; + st->keymap = console_keymap; + st->dropboxes = console_dropboxes; /* regions: main window */ - art= MEM_callocN(sizeof(ARegionType), "spacetype console region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype console region"); art->regionid = RGN_TYPE_WINDOW; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; - art->init= console_main_area_init; - art->draw= console_main_area_draw; - art->listener= console_main_area_listener; + art->init = console_main_area_init; + art->draw = console_main_area_draw; + art->listener = console_main_area_listener; BLI_addhead(&st->regiontypes, art); /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype console region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype console region"); art->regionid = RGN_TYPE_HEADER; - art->prefsizey= HEADERY; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; - art->init= console_header_area_init; - art->draw= console_header_area_draw; + art->init = console_header_area_init; + art->draw = console_header_area_draw; BLI_addhead(&st->regiontypes, art); |