allow select and drag graphs by clicking the upper border too

This commit is contained in:
stefan schippers 2024-03-08 15:08:47 +01:00
parent 064e7accde
commit 0611c7a6e7
2 changed files with 14 additions and 9 deletions

View File

@ -29,7 +29,7 @@
static int waves_selected(int event, KeySym key, int state, int button)
{
int rstate; /* state without ShiftMask */
int i;
int i, check;
int is_inside = 0, skip = 0;
static unsigned int excl = STARTZOOM | STARTRECT | STARTLINE | STARTWIRE |
STARTPAN | STARTSELECT | STARTMOVE | STARTCOPY;
@ -49,9 +49,13 @@ static int waves_selected(int event, KeySym key, int state, int button)
r = &xctx->rect[GRIDLAYER][i];
if(!(r->flags & 1) ) continue;
if(!strboolcmp(get_tok_value(xctx->rect[GRIDLAYER][i].prop_ptr, "lock", 0), "true")) continue;
if( (xctx->ui_state & GRAPHPAN) ||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2 - 40, r->y1 + 20) ||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1 + 20, r->y1, r->x2 - 30, r->y2 - 10) ) {
check =
(event != -3 &&
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1 + 20, r->y1+10, r->x2 - 20, r->y2 - 10)) ||
( event == -3 &&
(POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2 - 40, r->y1 + 20) ||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1 + 20, r->y1, r->x2 - 30, r->y2 - 10)));
if( (xctx->ui_state & GRAPHPAN) || check) {
is_inside = 1;
draw_crosshair(1);
tclvareval(xctx->top_path, ".drw configure -cursor tcross" , NULL);

View File

@ -2232,7 +2232,8 @@ proc graph_edit_wave {n n_wave} {
button .graphdialog.cancel -text Cancel -command {destroy .graphdialog}
for {set i 4} {$i < $cadlayers} {incr i} {
radiobutton .graphdialog.f.r$i -value $i -background [lindex $tctx::colors $i] \
-variable graph_sel_color -command {graph_change_wave_color $graph_sel_wave }
-variable graph_sel_color -command {graph_change_wave_color $graph_sel_wave } \
-selectcolor white -foreground black
pack .graphdialog.f.r$i -side left -fill both -expand yes
}
grid .graphdialog.f - -sticky nsew
@ -2739,7 +2740,7 @@ proc graph_edit_properties {n} {
}
.graphdialog.center.right.rawentry insert 0 [xschem getprop rect 2 $graph_selected rawfile 2]
.graphdialog.center.right.rawentry xview moveto 1
text .graphdialog.center.right.text1 -wrap none -width 50 -height 5 -background grey70 -fg black \
text .graphdialog.center.right.text1 -wrap none -width 50 -height 5 -background grey90 -fg black \
-insertbackground grey40 -exportselection 1 \
-yscrollcommand {.graphdialog.center.right.yscroll set} \
-xscrollcommand {.graphdialog.center.right.xscroll set}
@ -2810,7 +2811,7 @@ proc graph_edit_properties {n} {
for {set i 4} {$i < $cadlayers} {incr i} {
radiobutton .graphdialog.bottom.r$i -value $i -background [lindex $tctx::colors $i] \
-variable graph_sel_color -command graph_change_wave_color
-variable graph_sel_color -command graph_change_wave_color -selectcolor white -foreground black
pack .graphdialog.bottom.r$i -side left
}
@ -2917,7 +2918,7 @@ proc graph_edit_properties {n} {
# top frame
label .graphdialog.top.labsearch -text Search:
entry .graphdialog.top.search -width 10
checkbutton .graphdialog.top.bus -text Bus -padx 2 -variable graph_bus
checkbutton .graphdialog.top.bus -text Bus -padx 2 -variable graph_bus
checkbutton .graphdialog.top.incr -text {Incr. sort} -variable graph_sort -indicatoron 1 \
-command graph_fill_listbox
checkbutton .graphdialog.top.rainbow -text {Rainbow col.} -variable graph_rainbow \
@ -8207,7 +8208,7 @@ if { [info exists has_x]} {
option add *highlightThickness 0 startupFile
option add *highlightColor {grey70} startupFile
option add *insertBackground {white} startupFile
option add *selectColor {black} startupFile ;# checkbuttons, radiobuttons
option add *selectColor {grey10} startupFile ;# checkbuttons, radiobuttons
option add *selectForeground black
option add *selectBackground grey70
}