@@ -97,8 +97,9 @@ static void scope_draw_handle(t_scope *x, int state){
97
97
// always destroy (otherwise it may already exist)
98
98
sys_vgui ("destroy %s\n" , sh -> h_pathname );
99
99
if (state ){
100
- sys_vgui ("canvas %s -width %d -height %d -bg blue -highlightthickness %d -cursor bottom_right_corner\n" ,
101
- sh -> h_pathname , HANDLE_SIZE , HANDLE_SIZE , 2 * x -> x_zoom );
100
+ sys_vgui ("canvas %s -width %d -height %d -bg %s -highlightthickness %d -cursor bottom_right_corner\n" ,
101
+ sh -> h_pathname , HANDLE_SIZE , HANDLE_SIZE ,
102
+ THISGUI -> i_selectcolor -> s_name , 2 * x -> x_zoom );
102
103
int x1 , y1 , x2 , y2 ;
103
104
scope_getrect ((t_gobj * )x , x -> x_glist , & x1 , & y1 , & x2 , & y2 );
104
105
sys_vgui (".x%lx.c create window %d %d -anchor nw -width %d -height %d -window %s -tags all%lx\n" ,
@@ -168,34 +169,36 @@ static void scope_drawfg(t_scope *x, t_canvas *cv, int x1, int y1, int x2, int y
168
169
}
169
170
sys_vgui ("%d %d \\\n" , (int )xx , (int )yy );
170
171
}
171
- sys_vgui ("-fill #%2 .2x%2 .2x%2 .2x -width %d -tags {fg%lx all%lx}\n" ,
172
+ sys_vgui ("-fill #%.2x%.2x%.2x -width %d -tags {fg%lx all%lx}\n" ,
172
173
x -> x_fg [0 ], x -> x_fg [1 ], x -> x_fg [2 ], x -> x_zoom , x , x );
173
174
}
174
175
175
176
static void scope_draw_grid (t_scope * x , t_canvas * cv , int x1 , int y1 , int x2 , int y2 ){
176
177
float dx = (x2 - x1 )* 0.125 , dy = (y2 - y1 )* 0.25 , xx , yy ;
177
178
int i ;
178
179
for (i = 0 , xx = x1 + dx ; i < 7 ; i ++ , xx += dx )
179
- sys_vgui (".x%lx.c create line %f %d %f %d -width %d -tags {gr%lx all%lx} -fill #%2 .2x%2 .2x%2 .2x\n" ,
180
+ sys_vgui (".x%lx.c create line %f %d %f %d -width %d -tags {gr%lx all%lx} -fill #%.2x%.2x%.2x\n" ,
180
181
cv , xx , y1 , xx , y2 , x -> x_zoom , x , x , x -> x_gg [0 ], x -> x_gg [1 ], x -> x_gg [2 ]);
181
182
for (i = 0 , yy = y1 + dy ; i < 3 ; i ++ , yy += dy )
182
- sys_vgui (".x%lx.c create line %d %f %d %f -width %d -tags {gr%lx all%lx} -fill #%2 .2x%2 .2x%2 .2x\n" ,
183
+ sys_vgui (".x%lx.c create line %d %f %d %f -width %d -tags {gr%lx all%lx} -fill #%.2x%.2x%.2x\n" ,
183
184
cv , x1 , yy , x2 , yy , x -> x_zoom , x , x , x -> x_gg [0 ], x -> x_gg [1 ], x -> x_gg [2 ]);
184
185
}
185
186
186
187
static void scope_draw_bg (t_scope * x , t_canvas * cv , int x1 , int y1 , int x2 , int y2 ){
187
- sys_vgui (".x%lx.c create rectangle %d %d %d %d -outline #%2 .2x%2 .2x%2 .2x -fill #%2 .2x%2 .2x%2 .2x -width %d -tags {bg%lx all%lx}\n" ,
188
+ sys_vgui (".x%lx.c create rectangle %d %d %d %d -outline #%.2x%.2x%.2x -fill #%.2x%.2x%.2x -width %d -tags {bg%lx all%lx}\n" ,
188
189
cv , x1 , y1 , x2 , y2 , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ], x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ], x -> x_zoom , x , x );
189
190
}
190
191
191
192
static void scope_draw_inlets (t_scope * x ){
192
193
if (x -> x_edit && x -> x_receive == & s_ ){
193
194
t_canvas * cv = glist_getcanvas (x -> x_glist );
194
195
int xpos = text_xpix (& x -> x_obj , x -> x_glist ), ypos = text_ypix (& x -> x_obj , x -> x_glist );
195
- sys_vgui (".x%lx.c create rectangle %d %d %d %d -fill black -tags {%lx_in1 inlets%lx all%lx}\n" ,
196
- cv , xpos , ypos , xpos + (IOWIDTH * x -> x_zoom ), ypos + (IHEIGHT * x -> x_zoom ), x , x , x );
197
- sys_vgui (".x%lx.c create rectangle %d %d %d %d -fill black -tags {%lx_in2 inlets%lx all%lx}\n" ,
198
- cv , xpos + x -> x_width , ypos , xpos + x -> x_width - (IOWIDTH * x -> x_zoom ), ypos + (IHEIGHT * x -> x_zoom ), x , x , x );
196
+ sys_vgui (".x%lx.c create rectangle %d %d %d %d -fill %s -tags {%lx_in1 inlets%lx all%lx}\n" ,
197
+ cv , xpos , ypos , xpos + (IOWIDTH * x -> x_zoom ), ypos + (IHEIGHT * x -> x_zoom ),
198
+ THISGUI -> i_foregroundcolor -> s_name , x , x , x );
199
+ sys_vgui (".x%lx.c create rectangle %d %d %d %d -fill %s -tags {%lx_in2 inlets%lx all%lx}\n" ,
200
+ cv , xpos + x -> x_width , ypos , xpos + x -> x_width - (IOWIDTH * x -> x_zoom ), ypos + (IHEIGHT * x -> x_zoom ),
201
+ THISGUI -> i_foregroundcolor -> s_name , x , x , x );
199
202
}
200
203
}
201
204
@@ -333,11 +336,12 @@ static void scope_select(t_gobj *z, t_glist *glist, int state){
333
336
t_canvas * cv = glist_getcanvas (glist );
334
337
x -> x_select = state ;
335
338
if (state )
336
- sys_vgui (".x%lx.c itemconfigure bg%lx -outline blue -width %d -fill #%2 .2x%2 .2x%2 .2x\n" ,
337
- cv , x , SCOPE_SELBDWIDTH * x -> x_zoom , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
339
+ sys_vgui (".x%lx.c itemconfigure bg%lx -outline %s -width %d -fill #%.2x%.2x%.2x\n" ,
340
+ cv , x , THISGUI -> i_selectcolor -> s_name , x -> x_zoom , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
338
341
else
339
- sys_vgui (".x%lx.c itemconfigure bg%lx -outline #%2.2x%2.2x%2.2x -width %d -fill #%2.2x%2.2x%2.2x\n" ,
340
- cv , x , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ], x -> x_zoom , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
342
+ sys_vgui (".x%lx.c itemconfigure bg%lx -outline %s -width %d -fill #%.2x%.2x%.2x\n" ,
343
+ cv , x , THISGUI -> i_foregroundcolor -> s_name ,
344
+ x -> x_zoom , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
341
345
}
342
346
343
347
static void scope_delete (t_gobj * z , t_glist * glist ){
@@ -453,7 +457,7 @@ static void scope_fgcolor(t_scope *x, t_floatarg r, t_floatarg g, t_floatarg b){
453
457
if (x -> x_fg [0 ] != red || x -> x_fg [1 ] != green || x -> x_fg [2 ] != blue ){
454
458
x -> x_fg [0 ] = red , x -> x_fg [1 ] = green , x -> x_fg [2 ] = blue ;
455
459
if (gobj_shouldvis ((t_gobj * )x , x -> x_glist ) && glist_isvisible (x -> x_glist ))
456
- sys_vgui (".x%lx.c itemconfigure fg%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
460
+ sys_vgui (".x%lx.c itemconfigure fg%lx -fill #%.2x%.2x%.2x\n" ,
457
461
glist_getcanvas (x -> x_glist ), x , x -> x_fg [0 ], x -> x_fg [1 ], x -> x_fg [2 ]);
458
462
}
459
463
}
@@ -465,7 +469,7 @@ static void scope_frgb(t_scope *x, t_float r, t_float g, t_float b){ // scale is
465
469
if (x -> x_fg [0 ] != red || x -> x_fg [1 ] != green || x -> x_fg [2 ] != blue ){
466
470
x -> x_fg [0 ] = red , x -> x_fg [1 ] = green , x -> x_fg [2 ] = blue ;
467
471
if (glist_isvisible (x -> x_glist ) && gobj_shouldvis ((t_gobj * )x , x -> x_glist ))
468
- sys_vgui (".x%lx.c itemconfigure fg%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
472
+ sys_vgui (".x%lx.c itemconfigure fg%lx -fill #%.2x%.2x%.2x\n" ,
469
473
glist_getcanvas (x -> x_glist ), x , x -> x_fg [0 ], x -> x_fg [1 ], x -> x_fg [2 ]);
470
474
}
471
475
}
@@ -477,7 +481,7 @@ static void scope_bgcolor(t_scope *x, t_float r, t_float g, t_float b){ // scale
477
481
if (x -> x_bg [0 ] != red || x -> x_bg [1 ] != green || x -> x_bg [2 ] != blue ){
478
482
x -> x_bg [0 ] = red , x -> x_bg [1 ] = green , x -> x_bg [2 ] = blue ;
479
483
if (glist_isvisible (x -> x_glist ) && gobj_shouldvis ((t_gobj * )x , x -> x_glist ))
480
- sys_vgui (".x%lx.c itemconfigure bg%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
484
+ sys_vgui (".x%lx.c itemconfigure bg%lx -fill #%.2x%.2x%.2x\n" ,
481
485
glist_getcanvas (x -> x_glist ), x , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
482
486
}
483
487
}
@@ -489,7 +493,7 @@ static void scope_brgb(t_scope *x, t_float r, t_float g, t_float b){ // scale: 0
489
493
if (x -> x_bg [0 ] != red || x -> x_bg [1 ] != green || x -> x_bg [2 ] != blue ){
490
494
x -> x_bg [0 ] = red , x -> x_bg [1 ] = green , x -> x_bg [2 ] = blue ;
491
495
if (glist_isvisible (x -> x_glist ) && gobj_shouldvis ((t_gobj * )x , x -> x_glist ))
492
- sys_vgui (".x%lx.c itemconfigure bg%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
496
+ sys_vgui (".x%lx.c itemconfigure bg%lx -fill #%.2x%.2x%.2x\n" ,
493
497
glist_getcanvas (x -> x_glist ), x , x -> x_bg [0 ], x -> x_bg [1 ], x -> x_bg [2 ]);
494
498
}
495
499
}
@@ -501,7 +505,7 @@ static void scope_gridcolor(t_scope *x, t_float r, t_float g, t_float b){ // sca
501
505
if (x -> x_gg [0 ] != red || x -> x_gg [1 ] != green || x -> x_gg [2 ] != blue ){
502
506
x -> x_gg [0 ] = red , x -> x_gg [1 ] = green , x -> x_gg [2 ] = blue ;
503
507
if (glist_isvisible (x -> x_glist ) && gobj_shouldvis ((t_gobj * )x , x -> x_glist ))
504
- sys_vgui (".x%lx.c itemconfigure gr%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
508
+ sys_vgui (".x%lx.c itemconfigure gr%lx -fill #%.2x%.2x%.2x\n" ,
505
509
glist_getcanvas (x -> x_glist ), x , x -> x_gg [0 ], x -> x_gg [1 ], x -> x_gg [2 ]);
506
510
}
507
511
}
@@ -513,7 +517,7 @@ static void scope_grgb(t_scope *x, t_float r, t_float g, t_float b){ // scale: 0
513
517
if (x -> x_gg [0 ] != red || x -> x_gg [1 ] != green || x -> x_gg [2 ] != blue ){
514
518
x -> x_gg [0 ] = red , x -> x_gg [1 ] = green , x -> x_gg [2 ] = blue ;
515
519
if (glist_isvisible (x -> x_glist ) && gobj_shouldvis ((t_gobj * )x , x -> x_glist ))
516
- sys_vgui (".x%lx.c itemconfigure gr%lx -fill #%2 .2x%2 .2x%2 .2x\n" ,
520
+ sys_vgui (".x%lx.c itemconfigure gr%lx -fill #%.2x%.2x%.2x\n" ,
517
521
glist_getcanvas (x -> x_glist ), x , x -> x_gg [0 ], x -> x_gg [1 ], x -> x_gg [2 ]);
518
522
}
519
523
}
@@ -614,8 +618,9 @@ static void handle__click_callback(t_handle *sh, t_floatarg f){
614
618
else if (!sh -> h_dragon && click ){
615
619
int x1 , y1 , x2 , y2 ;
616
620
scope_getrect ((t_gobj * )x , x -> x_glist , & x1 , & y1 , & x2 , & y2 );
617
- sys_vgui (".x%lx.c create rectangle %d %d %d %d -outline blue -width %d -tags %s\n" ,
618
- x -> x_cv , x1 , y1 , x2 , y2 , SCOPE_SELBDWIDTH , sh -> h_outlinetag );
621
+ sys_vgui (".x%lx.c create rectangle %d %d %d %d -outline %s -width %d -tags %s\n" ,
622
+ x -> x_cv , x1 , y1 , x2 , y2 , THISGUI -> i_selectcolor -> s_name ,
623
+ SCOPE_SELBDWIDTH * x -> x_zoom , sh -> h_outlinetag );
619
624
sh -> h_dragx = sh -> h_dragy = 0 ;
620
625
}
621
626
sh -> h_dragon = click ;
@@ -624,9 +629,10 @@ static void handle__click_callback(t_handle *sh, t_floatarg f){
624
629
static void handle__motion_callback (t_handle * sh , t_floatarg f1 , t_floatarg f2 ){
625
630
if (sh -> h_dragon ){
626
631
t_scope * x = sh -> h_master ;
627
- int dx = (int )f1 , dy = (int )f2 , x1 , y1 , x2 , y2 , newx , newy ;
632
+ int dx = (int )f1 - HANDLE_SIZE , dy = (int )f2 - HANDLE_SIZE ;
633
+ int x1 , y1 , x2 , y2 ;
628
634
scope_getrect ((t_gobj * )x , x -> x_glist , & x1 , & y1 , & x2 , & y2 );
629
- newx = x2 + dx , newy = y2 + dy ;
635
+ int newx = x2 + dx , newy = y2 + dy ;
630
636
if (newx < x1 + SCOPE_MINSIZE * x -> x_zoom )
631
637
newx = x1 + SCOPE_MINSIZE * x -> x_zoom ;
632
638
if (newy < y1 + SCOPE_MINSIZE * x -> x_zoom )
0 commit comments