Commit 1244f96f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

clean up g_mycanvas.c

parent 96288646
......@@ -2428,52 +2428,49 @@ function gui_iemgui_label_show_drag_handle(cid, tag, state, x, y) {
}
}
function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) {
function gui_create_mycanvas(c,id,x_color,x1,y1,x2_vis,y2_vis,x2,y2) {
var rect_vis, rect, g;
rect_vis = create_item(cid,"rect", {
rect_vis = create_item(c, "rect", {
width: x2_vis - x1,
height: y2_vis - y1,
fill: color,
stroke: color,
id: tag + "rect"
fill: x2h(x_color),
stroke: x2h(x_color),
id: id + "rect"
}
);
// we use a drag_handle-- unlike a 'border' it takes
// the same color as the visible rectangle when deselected
rect = create_item(cid,"rect", {
rect = create_item(c, "rect", {
width: x2 - x1,
height: y2 - y1,
fill: "none",
stroke: color,
id: tag + "drag_handle",
stroke: x2h(x_color),
id: id + "drag_handle",
"class": "border mycanvas_border"
}
);
g = get_gobj(cid,tag);
g = get_gobj(c, id);
g.appendChild(rect_vis);
g.appendChild(rect);
}
function gui_update_mycanvas(cid, tag, color, selected) {
var r = get_item(cid, tag + "rect"),
h = get_item(cid, tag + "drag_handle");
configure_item(r, { fill: color, stroke: color });
function gui_update_mycanvas(c, id, x_color, selected) {
var r = get_item(c, id + "rect"),
h = get_item(c, id + "drag_handle");
configure_item(r, {
fill: x2h(x_color),
stroke: x2h(x_color)
});
}
function gui_mycanvas_coords(cid, tag, vis_width, vis_height, select_width, select_height) {
var r = get_item(cid, tag + "rect"),
h = get_item(cid, tag + "drag_handle");
function gui_mycanvas_coords(c, id, vis_width, vis_height, select_width, select_height) {
var r = get_item(c, id + "rect"),
h = get_item(c, id + "drag_handle");
configure_item(r, { width: vis_width, height: vis_height });
configure_item(h, { width: select_width, height: select_height });
}
// Not needed anymore
function gui_mycanvas_select_color(cid,tag,color) {
//var item = get_item(cid,tag + "drag_handle");
//configure_item(item, {stroke: color});
}
function gui_create_scalar(cid, tag, isselected, t1, t2, t3, t4, t5, t6,
is_toplevel) {
// we should probably use create_gobj here, but we"re doing some initial
......
......@@ -25,12 +25,10 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_text_create_gobj", "xxsiii", canvas,
x, "iemgui", x1, y1, glist_istoplevel(canvas));
gui_vmess("gui_create_mycanvas", "xxsiiiiii", canvas,
x, colorbuf, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h,
gui_vmess("gui_create_mycanvas", "xxxiiiiii", canvas,
x, x->x_gui.x_bcol, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h,
x1+x->x_gui.x_w, y1+x->x_gui.x_h);
}
......@@ -50,21 +48,14 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
{
t_canvas *canvas=glist_getcanvas(glist);
int isselected;
char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol);
isselected = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
gui_vmess("gui_update_mycanvas", "xxsi",
canvas, x, bcol, isselected);
gui_vmess("gui_update_mycanvas", "xxxi",
canvas, x, x->x_gui.x_bcol, isselected);
}
void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
{
t_canvas *canvas=glist_getcanvas(glist);
if (x->x_gui.x_glist != glist_getcanvas(glist)) return;
char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_mycanvas_select_color", "xxs",
canvas, x,
x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas ?
"blue" : bcol);
/* No longer needed */
}
static void my_canvas__clickhook(t_scalehandle *sh, int newstate)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment