Grease-Pencil:

* UI - added delete button for hidden layers
* Renamed the two hardcoded defines added for testing distances to their more formal nomenclature.
This commit is contained in:
Joshua Leung 2008-07-27 04:39:55 +00:00
parent b24485ab92
commit 6035b3e0c7
2 changed files with 14 additions and 8 deletions

@ -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 */
{

@ -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' */