Index: trunk/src_plugins/shape/shape.c =================================================================== --- trunk/src_plugins/shape/shape.c (revision 22423) +++ trunk/src_plugins/shape/shape.c (revision 22424) @@ -45,6 +45,8 @@ #include "rotate.h" #include "tool.h" +const char *pcb_shape_corner_name[] = {"Rn", "Ch", "Sq", NULL}; + const char *pcb_shape_cookie = "shape plugin"; static pcb_layer_t pcb_shape_current_layer_; pcb_layer_t *pcb_shape_current_layer = &pcb_shape_current_layer_; @@ -129,7 +131,7 @@ #define CORNER(outx, outy, rect_signx, rect_signy, rsignx, rsigny) \ outx = pcb_round((double)cx + rect_signx * (double)w/2 + rsignx*rx); \ outy = pcb_round((double)cy + rect_signy * (double)h/2 + rsigny*ry); -static pcb_poly_t *roundrect(pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy) +static pcb_poly_t *roundrect(pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4]) { pcb_poly_t *p; pcb_coord_t maxr = (w < h ? w : h) / 2, x, y, ex, ey, acx, acy; @@ -218,7 +220,7 @@ return any_poly_place(data, layer, p); } -static pcb_poly_t *roundrect_place(pcb_data_t *data, pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy) +static pcb_poly_t *roundrect_place(pcb_data_t *data, pcb_layer_t *layer, pcb_coord_t w, pcb_coord_t h, pcb_coord_t rx, pcb_coord_t ry, double rot_deg, pcb_coord_t cx, pcb_coord_t cy, pcb_shape_corner_t corner[4]) { pcb_poly_t *p; @@ -225,7 +227,7 @@ if (layer == pcb_shape_current_layer) layer = CURRENT; - p = roundrect(layer, w, h, rx, ry, rot_deg, cx, cy); + p = roundrect(layer, w, h, rx, ry, rot_deg, cx, cy, corner); return any_poly_place(data, layer, p); } @@ -403,6 +405,7 @@ pcb_coord_t x = 0, y = 0, w, h, rx, ry; double rot = 0.0; char *end; + pcb_shape_corner_t corner[4] = { PCB_CORN_ROUND, PCB_CORN_ROUND, PCB_CORN_ROUND, PCB_CORN_ROUND}; if (argc < 2) { pcb_message(PCB_MSG_ERROR, "roundrect() needs at least one parameters\n"); @@ -467,7 +470,7 @@ if ((data == PCB->Data) && (!have_coords)) pcb_hid_get_coords("Click on the center of the polygon", &x, &y, 0); - if (roundrect_place(data, CURRENT, w, h, rx, ry, rot, x, y) == NULL) + if (roundrect_place(data, CURRENT, w, h, rx, ry, rot, x, y, corner) == NULL) pcb_message(PCB_MSG_ERROR, "roundrect(): failed to create the polygon\n"); PCB_ACT_IRES(0); Index: trunk/src_plugins/shape/shape.h =================================================================== --- trunk/src_plugins/shape/shape.h (revision 22423) +++ trunk/src_plugins/shape/shape.h (revision 22424) @@ -36,6 +36,13 @@ void pcb_shape_dialog(pcb_board_t *pcb, pcb_data_t *data, pcb_layer_t *layer, pcb_bool modal); +typedef enum { + PCB_CORN_ROUND, + PCB_CORN_CHAMF, + PCB_CORN_SQUARE +} pcb_shape_corner_t; +extern const char *pcb_shape_corner_name[]; + #endif Index: trunk/src_plugins/shape/shape_dialog.c =================================================================== --- trunk/src_plugins/shape/shape_dialog.c (revision 22423) +++ trunk/src_plugins/shape/shape_dialog.c (revision 22424) @@ -14,7 +14,7 @@ int prx, pry, corners, pcx, pcy, prot, pell; /* roundrect */ - int w, h, rrect, rcx, rcy, rx, ry, rrot, rell; + int w, h, rrect, rcx, rcy, rx, ry, rrot, rell, corner[4]; /* circle */ int dia, ccx, ccy; @@ -66,6 +66,8 @@ static void shp_chg_roundrect(void *hid_ctx, void *caller_data, pcb_hid_attribute_t *attr) { ctx_t *shp = caller_data; + pcb_shape_corner_t corner[4]; + int n; /* elliptical logics */ if (!shp->dlg[shp->rell].default_val.int_value) { @@ -83,6 +85,9 @@ else pcb_gui->attr_dlg_widget_state(hid_ctx, shp->h, pcb_true); + for(n = 0; n < 4; n++) + corner[n] = shp->dlg[shp->corner[n]].default_val.int_value; + del_obj(shp); shp->obj = (pcb_any_obj_t *)roundrect_place( shp->data, shp->layer, @@ -89,7 +94,8 @@ shp->dlg[shp->w].default_val.coord_value, shp->dlg[shp->h].default_val.coord_value, shp->dlg[shp->rx].default_val.coord_value, shp->dlg[shp->ry].default_val.coord_value, shp->dlg[shp->rrot].default_val.real_value, - shp->dlg[shp->rcx].default_val.coord_value, shp->dlg[shp->rcy].default_val.coord_value); + shp->dlg[shp->rcx].default_val.coord_value, shp->dlg[shp->rcy].default_val.coord_value, + corner); } static void shp_chg_circle(void *hid_ctx, void *caller_data, pcb_hid_attribute_t *attr) @@ -307,6 +313,24 @@ PCB_DAD_LABEL(shp->dlg, "y (vertical)"); PCB_DAD_END(shp->dlg); PCB_DAD_END(shp->dlg); + + PCB_DAD_LABEL(shp->dlg, "Corner style:"); + PCB_DAD_BEGIN_HBOX(shp->dlg); + PCB_DAD_BEGIN_TABLE(shp->dlg, 2); + PCB_DAD_ENUM(shp->dlg, pcb_shape_corner_name); + shp->corner[0] = PCB_DAD_CURRENT(shp->dlg); + PCB_DAD_CHANGE_CB(shp->dlg, shp_chg_regpoly); + PCB_DAD_ENUM(shp->dlg, pcb_shape_corner_name); + shp->corner[1] = PCB_DAD_CURRENT(shp->dlg); + PCB_DAD_CHANGE_CB(shp->dlg, shp_chg_regpoly); + PCB_DAD_ENUM(shp->dlg, pcb_shape_corner_name); + shp->corner[2] = PCB_DAD_CURRENT(shp->dlg); + PCB_DAD_CHANGE_CB(shp->dlg, shp_chg_regpoly); + PCB_DAD_ENUM(shp->dlg, pcb_shape_corner_name); + shp->corner[3] = PCB_DAD_CURRENT(shp->dlg); + PCB_DAD_CHANGE_CB(shp->dlg, shp_chg_regpoly); + PCB_DAD_END(shp->dlg); + PCB_DAD_END(shp->dlg); PCB_DAD_END(shp->dlg); /* circle tab */