From 6035b3e0c73a3ec702cda9e5b635bbb1c02e6891 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 27 Jul 2008 04:39:55 +0000 Subject: [PATCH] Grease-Pencil: * UI - added delete button for hidden layers * Renamed the two hardcoded defines added for testing distances to their more formal nomenclature. --- source/blender/src/drawgpencil.c | 7 ++++++- source/blender/src/gpencil.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c index 7abb922f67e..e07dec90629 100644 --- a/source/blender/src/drawgpencil.c +++ b/source/blender/src/drawgpencil.c @@ -187,10 +187,15 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short sprintf(name, "%s (Locked)", gpl->info); uiDefBut(block, LABEL, 1, name, *xco+35, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)"); + /* delete button (only if hidden but not locked!) */ + if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) { + but= uiDefIconBut(block, BUT, B_REDR, ICON_X, *xco+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer"); + uiButSetFunc(but, gp_ui_dellayer_cb, gpd, NULL); + } uiBlockSetEmboss(block, UI_EMBOSS); } else { - height= 100; + height= 97; /* draw rest of header */ { diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c index 2f2913f13e1..24ed6a7b0ba 100644 --- a/source/blender/src/gpencil.c +++ b/source/blender/src/gpencil.c @@ -664,11 +664,12 @@ void gpencil_delete_menu (void) /* maximum sizes of gp-session buffer */ #define GP_STROKE_BUFFER_MAX 5000 - /* 'Hardcoded' sensitivity thresholds... */ -/* minimum number of pixels mouse should move before new point created */ -#define MIN_MMOVE_PX 3 -/* minimum length of new segment before new point can be added */ -#define MIN_MDIST_PX 20 +/* Hardcoded sensitivity thresholds... */ +// TODO: one day, these might be added to the UI if it is necessary + /* minimum number of pixels mouse should move before new point created */ +#define MIN_MANHATTEN_PX 3 + /* minimum length of new segment before new point can be added */ +#define MIN_EUCLIDEAN_PX 20 /* ------ */ @@ -890,11 +891,11 @@ static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2]) short dy= abs(mval[1] - pmval[1]); /* check if mouse moved at least certain distance on both axes (best case) */ - if ((dx > MIN_MMOVE_PX) && (dy > MIN_MMOVE_PX)) + if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX)) return 1; /* check if the distance since the last point is significant enough */ - else if (sqrt(dx*dx + dy*dy) > MIN_MDIST_PX) + else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX) return 1; /* mouse 'didn't move' */