From 66fc247d3ea6a75d045f9e2f8a7977212c3b900e Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 26 Jul 2015 15:33:14 -0400 Subject: [PATCH] flesh out default css by porting the rest of the Pd-l2ork colors fix display bug with cord inspector flash (plus adding it to the css) --- pd/nw/css/default.css | 30 ++++++++++++++++++++++++++++-- pd/nw/pdgui.js | 20 +++++++++++++------- pd/src/g_magicglass.c | 8 ++++++-- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/pd/nw/css/default.css b/pd/nw/css/default.css index 54f2e7544..6b12fe7cf 100644 --- a/pd/nw/css/default.css +++ b/pd/nw/css/default.css @@ -14,6 +14,11 @@ user-select: none; } +::selection { + background: #c3c3c3; + color: black; +} + /* The main Pd Window */ #console_body { @@ -49,6 +54,10 @@ font-family: "DejaVu Sans Mono"; } +#selection_rectangle { + stroke: #e87216; +} + .cord.signal { stroke-width: 2; stroke: #808095; @@ -59,6 +68,19 @@ stroke: #565; } +#cord_inspector_rect { + fill: black; + stroke: black; +} + +#cord_inspector_text { + fill: white; +} + +#cord_inspector_text.flash { + fill: #e87216; +} + #new_object_textentry { /* max-width: 10ch; */ min-width: 3ch; @@ -125,6 +147,10 @@ text { stroke: #ccc; } +.iemgui .border { + stroke: black; +} + /* border color for selected objects * an element with the class 'border' * the element is contained within a parent element of class 'selected' @@ -134,7 +160,7 @@ text { canvas. */ :not(.gop).selected .border { - stroke: blue; + stroke: #e87216; display: inline; } @@ -146,7 +172,7 @@ text { /* for an object that didn't create */ .obj .border.broken_border { fill: #f7f7f7; - stroke: red; + stroke: #f00; stroke-dasharray: 3 2; } diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index a1b783243..0b16c4175 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -2348,7 +2348,7 @@ function gui_create_selection_rectangle(cid, x1, y1, x2, y2) { var rect = create_item(cid, 'polygon', { points: points_array.join(" "), fill: 'none', - stroke: 'black', +// stroke: 'black', // set in css now 'shape-rendering': 'optimizeSpeed', 'stroke-width': 1, id: 'selection_rectangle', @@ -3450,6 +3450,7 @@ function gui_cord_inspector_update(cid, text, basex, basey, bg_size, y1, y2, mov gobj.setAttributeNS(null, 'transform', 'translate(' + (basex + 10.5) + ',' + (basey + 0.5) + ')'); gobj.setAttributeNS(null, 'pointer-events', 'none'); + gobj.classList.remove('flash'); var rect = get_item(cid, 'cord_inspector_rect'); var poly = get_item(cid, 'cord_inspector_polygon'); var svg_text = get_item(cid, 'cord_inspector_text'); @@ -3458,9 +3459,9 @@ function gui_cord_inspector_update(cid, text, basex, basey, bg_size, y1, y2, mov x: 13, y: y1 - basey, width: bg_size - basex, - height: y2 - basey + 10, - fill: 'none', - stroke: 'black' + height: y2 - basey + 10 +// fill: 'none', // set in css now +// stroke: 'black' // set in css now }); var polypoints_array = [8,0,13,5,13,-5]; configure_item(poly, { @@ -3469,7 +3470,7 @@ function gui_cord_inspector_update(cid, text, basex, basey, bg_size, y1, y2, mov configure_item(svg_text, { x: 20, y: 5, - fill: 'black' +// fill: 'black' // set in css now }); // set the text svg_text.textContent = text; @@ -3484,10 +3485,15 @@ function gui_erase_cord_inspector(cid) { } } -function gui_cord_inspector_flash(cid) { +function gui_cord_inspector_flash(cid, state) { var ct = get_item(cid, 'cord_inspector_text'); if (ct !== null) { - configure_item(ct, { fill: 'red' }); + if (state === 1) { + ct.classList.add('flash'); + } else { + ct.classList.remove('flash'); + } +// configure_item(ct, { fill: 'red' }); } else { gui_post("gui_cord_inspector_flash: trying to flash a non-existent cord inspector!"); } diff --git a/pd/src/g_magicglass.c b/pd/src/g_magicglass.c index 0afa60871..ffe450b22 100644 --- a/pd/src/g_magicglass.c +++ b/pd/src/g_magicglass.c @@ -73,6 +73,7 @@ void magicGlass_updateText(t_magicGlass *x, int moved) else { color = "$pd_colors(magic_glass_flash)"; + gui_vmess("gui_cord_inspector_flash", "xi", x->x_c, 1); clock_delay(x->x_flashClock, MG_CLOCK_FLASH_DELAY); } sys_vgui(".x%x.c itemconfigure magicGlassText -text {%s} " @@ -162,14 +163,17 @@ void magicGlass_undraw(t_magicGlass *x) x->x_c); } +/* Note: this is a misnomer. This actually changes + the text back to the original color _after_ the + flash happened. (Unflash?) */ void magicGlass_flashText(t_magicGlass *x) { //fprintf(stderr,"magicglass_flashText\n"); //sys_vgui(".x%x.c itemconfigure magicGlassText " // "-fill $pd_colors(magic_glass_text)\n", // x->x_c); - gui_vmess("gui_cord_inspector_flash", "x", - x->x_c); + gui_vmess("gui_cord_inspector_flash", "xi", + x->x_c, 0); } void magicGlass_clearText(t_magicGlass *x) -- GitLab