Whitespace tweaks

This commit is contained in:
Joshua Leung 2012-03-04 02:43:15 +00:00
parent d99888d786
commit 6c37e0a442
2 changed files with 46 additions and 48 deletions

@ -155,7 +155,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
cp= data->coefficients; cp= data->coefficients;
for (i=0; (i < data->arraysize) && (cp); i++, cp++) { for (i=0; (i < data->arraysize) && (cp); i++, cp++) {
/* To align with first line. */ /* To align with first line */
if (i) if (i)
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
else else
@ -208,7 +208,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
cp= data->coefficients; cp= data->coefficients;
for (i=0; (i < data->poly_order) && (cp); i++, cp+=2) { for (i=0; (i < data->poly_order) && (cp); i++, cp+=2) {
/* To align with first line. */ /* To align with first line */
if (i) if (i)
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
else else

@ -33,7 +33,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
@ -51,7 +50,6 @@
#include "RNA_access.h" #include "RNA_access.h"
#include "ED_gpencil.h" #include "ED_gpencil.h"
#include "UI_interface.h" #include "UI_interface.h"
@ -75,7 +73,7 @@ static void gp_ui_activelayer_cb(bContext *C, void *gpd, void *gpl)
{ {
/* make sure the layer we want to remove is the active one */ /* make sure the layer we want to remove is the active one */
gpencil_layer_setactive(gpd, gpl); gpencil_layer_setactive(gpd, gpl);
WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */ WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */
} }
@ -85,7 +83,7 @@ static void gp_ui_dellayer_cb(bContext *C, void *gpd, void *gpl)
/* make sure the layer we want to remove is the active one */ /* make sure the layer we want to remove is the active one */
gpencil_layer_setactive(gpd, gpl); gpencil_layer_setactive(gpd, gpl);
gpencil_layer_delactive(gpd); gpencil_layer_delactive(gpd);
WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */ WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */
} }
@ -102,60 +100,60 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
uiBut *but; uiBut *but;
PointerRNA ptr; PointerRNA ptr;
int icon; int icon;
/* make pointer to layer data */ /* make pointer to layer data */
RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr); RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr);
/* unless button has own callback, it adds this callback to button */ /* unless button has own callback, it adds this callback to button */
block = uiLayoutGetBlock(layout); block = uiLayoutGetBlock(layout);
uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl); uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl);
/* draw header ---------------------------------- */ /* draw header ---------------------------------- */
/* get layout-row + UI-block for header */ /* get layout-row + UI-block for header */
box = uiLayoutBox(layout); box = uiLayoutBox(layout);
row = uiLayoutRow(box, 0); row = uiLayoutRow(box, 0);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
block = uiLayoutGetBlock(row); /* err... */ block = uiLayoutGetBlock(row); /* err... */
uiBlockSetEmboss(block, UI_EMBOSSN); uiBlockSetEmboss(block, UI_EMBOSSN);
/* left-align ............................... */ /* left-align ............................... */
sub = uiLayoutRow(row, 0); sub = uiLayoutRow(row, 0);
/* active */ /* active */
block = uiLayoutGetBlock(sub); block = uiLayoutGetBlock(sub);
icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y,
&gpd->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer")); &gpd->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
/* locked */ /* locked */
icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
uiItemR(sub, &ptr, "lock", 0, "", icon); uiItemR(sub, &ptr, "lock", 0, "", icon);
/* when layer is locked or hidden, only draw header */ /* when layer is locked or hidden, only draw header */
if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) { if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) {
char name[256]; /* gpl->info is 128, but we need space for 'locked/hidden' as well */ char name[256]; /* gpl->info is 128, but we need space for 'locked/hidden' as well */
/* visibility button (only if hidden but not locked!) */ /* visibility button (only if hidden but not locked!) */
if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON);
/* name */ /* name */
if (gpl->flag & GP_LAYER_HIDE) if (gpl->flag & GP_LAYER_HIDE)
BLI_snprintf(name, sizeof(name), IFACE_("%s (Hidden)"), gpl->info); BLI_snprintf(name, sizeof(name), IFACE_("%s (Hidden)"), gpl->info);
else else
BLI_snprintf(name, sizeof(name), IFACE_("%s (Locked)"), gpl->info); BLI_snprintf(name, sizeof(name), IFACE_("%s (Locked)"), gpl->info);
uiItemL(sub, name, ICON_NONE); uiItemL(sub, name, ICON_NONE);
/* delete button (only if hidden but not locked!) */ /* delete button (only if hidden but not locked!) */
if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
/* right-align ............................... */ /* right-align ............................... */
sub = uiLayoutRow(row, 1); sub = uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
block = uiLayoutGetBlock(sub); /* XXX... err... */ block = uiLayoutGetBlock(sub); /* XXX... err... */
but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer"));
uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
@ -166,58 +164,58 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* draw rest of header -------------------------------- */ /* draw rest of header -------------------------------- */
/* visibility button */ /* visibility button */
uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF);
/* frame locking */ /* frame locking */
/* TODO: this needs its own icons... */ /* TODO: this needs its own icons... */
icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
uiItemR(sub, &ptr, "lock_frame", 0, "", icon); uiItemR(sub, &ptr, "lock_frame", 0, "", icon);
uiBlockSetEmboss(block, UI_EMBOSS); uiBlockSetEmboss(block, UI_EMBOSS);
/* name */ /* name */
uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); uiItemR(sub, &ptr, "info", 0, "", ICON_NONE);
/* delete 'button' */ /* delete 'button' */
uiBlockSetEmboss(block, UI_EMBOSSN); uiBlockSetEmboss(block, UI_EMBOSSN);
/* right-align ............................... */ /* right-align ............................... */
sub = uiLayoutRow(row, 1); sub = uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
block = uiLayoutGetBlock(sub); /* XXX... err... */ block = uiLayoutGetBlock(sub); /* XXX... err... */
but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer")); NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer"));
uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
uiBlockSetEmboss(block, UI_EMBOSS); uiBlockSetEmboss(block, UI_EMBOSS);
/* new backdrop ----------------------------------- */ /* new backdrop ----------------------------------- */
box = uiLayoutBox(layout); box = uiLayoutBox(layout);
split = uiLayoutSplit(box, 0.5f, 0); split = uiLayoutSplit(box, 0.5f, 0);
/* draw settings ---------------------------------- */ /* draw settings ---------------------------------- */
/* left column ..................... */ /* left column ..................... */
col = uiLayoutColumn(split, 0); col = uiLayoutColumn(split, 0);
/* color */ /* color */
sub = uiLayoutColumn(col, 1); sub = uiLayoutColumn(col, 1);
uiItemR(sub, &ptr, "color", 0, "", ICON_NONE); uiItemR(sub, &ptr, "color", 0, "", ICON_NONE);
uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE); uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
/* stroke thickness */ /* stroke thickness */
uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
/* debugging options */ /* debugging options */
if (G.f & G_DEBUG) { if (G.f & G_DEBUG) {
uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE);
} }
/* right column ................... */ /* right column ................... */
col = uiLayoutColumn(split, 0); col = uiLayoutColumn(split, 0);
/* onion-skinning */ /* onion-skinning */
sub = uiLayoutColumn(col, 1); sub = uiLayoutColumn(col, 1);
uiItemR(sub, &ptr, "use_onion_skinning", 0, NULL, ICON_NONE); uiItemR(sub, &ptr, "use_onion_skinning", 0, NULL, ICON_NONE);
uiItemR(sub, &ptr, "ghost_range_max", 0, IFACE_("Frames"), ICON_NONE); uiItemR(sub, &ptr, "ghost_range_max", 0, IFACE_("Frames"), ICON_NONE);
/* 3d-view specific drawing options */ /* 3d-view specific drawing options */
if (is_v3d) { if (is_v3d) {
uiItemR(col, &ptr, "show_x_ray", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "show_x_ray", 0, NULL, ICON_NONE);
@ -228,8 +226,8 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* stroke drawing options available */ /* stroke drawing options available */
typedef enum eGP_Stroke_Ops { typedef enum eGP_Stroke_Ops {
STROKE_OPTS_NORMAL = 0, STROKE_OPTS_NORMAL = 0,
STROKE_OPTS_V3D_OFF = 1, STROKE_OPTS_V3D_OFF,
STROKE_OPTS_V3D_ON = 2, STROKE_OPTS_V3D_ON,
} eGP_Stroke_Ops; } eGP_Stroke_Ops;
/* Draw the contents for a grease-pencil panel*/ /* Draw the contents for a grease-pencil panel*/
@ -240,37 +238,37 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
uiLayout *col, *row; uiLayout *col, *row;
short v3d_stroke_opts = STROKE_OPTS_NORMAL; short v3d_stroke_opts = STROKE_OPTS_NORMAL;
const short is_v3d = CTX_wm_view3d(C) != NULL; const short is_v3d = CTX_wm_view3d(C) != NULL;
/* make new PointerRNA for Grease Pencil block */ /* make new PointerRNA for Grease Pencil block */
RNA_id_pointer_create((ID *)gpd, &gpd_ptr); RNA_id_pointer_create((ID *)gpd, &gpd_ptr);
/* draw gpd settings first ------------------------------------- */ /* draw gpd settings first ------------------------------------- */
col = uiLayoutColumn(layout, 0); col = uiLayoutColumn(layout, 0);
/* current Grease Pencil block */ /* current Grease Pencil block */
/* TODO: show some info about who owns this? */ /* TODO: show some info about who owns this? */
uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink"); uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink");
/* add new layer button - can be used even when no data, since it can add a new block too */ /* add new layer button - can be used even when no data, since it can add a new block too */
uiItemO(col, IFACE_("New Layer"), ICON_NONE, "GPENCIL_OT_layer_add"); uiItemO(col, IFACE_("New Layer"), ICON_NONE, "GPENCIL_OT_layer_add");
row = uiLayoutRow(col, 1); row = uiLayoutRow(col, 1);
uiItemO(row, IFACE_("Delete Frame"), ICON_NONE, "GPENCIL_OT_active_frame_delete"); uiItemO(row, IFACE_("Delete Frame"), ICON_NONE, "GPENCIL_OT_active_frame_delete");
uiItemO(row, IFACE_("Convert"), ICON_NONE, "GPENCIL_OT_convert"); uiItemO(row, IFACE_("Convert"), ICON_NONE, "GPENCIL_OT_convert");
/* sanity checks... */ /* sanity checks... */
if (gpd == NULL) if (gpd == NULL)
return; return;
/* draw each layer --------------------------------------------- */ /* draw each layer --------------------------------------------- */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
col = uiLayoutColumn(layout, 1); col = uiLayoutColumn(layout, 1);
gp_drawui_layer(col, gpd, gpl, is_v3d); gp_drawui_layer(col, gpd, gpl, is_v3d);
} }
/* draw gpd drawing settings first ------------------------------------- */ /* draw gpd drawing settings first ------------------------------------- */
col = uiLayoutColumn(layout, 1); col = uiLayoutColumn(layout, 1);
/* label */ /* label */
uiItemL(col, IFACE_("Drawing Settings:"), ICON_NONE); uiItemL(col, IFACE_("Drawing Settings:"), ICON_NONE);
/* check whether advanced 3D-View drawing space options can be used */ /* check whether advanced 3D-View drawing space options can be used */
if (is_v3d) { if (is_v3d) {
if (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW)) if (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW))
@ -278,7 +276,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
else else
v3d_stroke_opts = STROKE_OPTS_V3D_OFF; v3d_stroke_opts = STROKE_OPTS_V3D_OFF;
} }
/* drawing space options */ /* drawing space options */
row= uiLayoutRow(col, 1); row= uiLayoutRow(col, 1);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NONE); uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NONE);
@ -287,7 +285,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
uiLayoutSetActive(row, v3d_stroke_opts); uiLayoutSetActive(row, v3d_stroke_opts);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NONE); uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NONE);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NONE); uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NONE);
row= uiLayoutRow(col, 0); row= uiLayoutRow(col, 0);
uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON); uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON);
uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE); uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE);
@ -299,12 +297,12 @@ void gpencil_panel_standard(const bContext *C, Panel *pa)
{ {
bGPdata **gpd_ptr = NULL; bGPdata **gpd_ptr = NULL;
PointerRNA ptr; PointerRNA ptr;
/* if (v3d->flag2 & V3D_DISPGP)... etc. */ /* if (v3d->flag2 & V3D_DISPGP)... etc. */
/* get pointer to Grease Pencil Data */ /* get pointer to Grease Pencil Data */
gpd_ptr = gpencil_data_get_pointers((bContext *)C, &ptr); gpd_ptr = gpencil_data_get_pointers((bContext *)C, &ptr);
if (gpd_ptr) if (gpd_ptr)
draw_gpencil_panel((bContext *)C, pa->layout, *gpd_ptr, &ptr); draw_gpencil_panel((bContext *)C, pa->layout, *gpd_ptr, &ptr);
} }