Hi, I was trying to get this bug fixed: http://sourceforge.net/tracker/index.php?func=detail&aid=1443979&group_id=161080&atid=818426
It's a new feature allowing rotating the selection with middle mouse while moving. I got something working, but I'm not quite happy with it. Please see my current work status in the attached patch. The problem is in x_event.nw near line 792. If I do a: else if (w_current->event_state == ENDMOVE) { o_drawbounding(w_current, NULL, w_current->page_current->selection2_head->next, x_get_darkcolor(w_current->bb_color), TRUE); o_rotate_90(w_current, w_current->page_current->selection2_head->next, fix_x(w_current, mouse_x), fix_y(w_current, mouse_y)); o_drawbounding(w_current, NULL, w_current->page_current->selection2_head->next, x_get_darkcolor(w_current->bb_color), TRUE); return(0); } Then I get some garbage in the screen, and the rotation is not done correctly, because the object coordinates have not been updated while moving the mouse in the screen (the o_rotate_90 function calculates the rotation of the objects like they were at the beginning of the move command). I confirmed it and got it more or less working with: else if (w_current->event_state == ENDMOVE) { o_move_end(w_current); o_rotate_90(w_current, w_current->page_current->selection2_head->next, fix_x(w_current, mouse_x), fix_y(w_current, mouse_y)); o_move_start(w_current, fix_x(w_current, mouse_x), fix_y(w_current, mouse_y)); w_current->event_state = ENDMOVE; return(0); } Now the rotation is done correctly, but I can see some grips drawing and erasing, and I think that maybe there is a simple solution. Can someone give me a clue? Thanks, Carlos
? x_close_confirm.nw Index: x_event.nw =================================================================== RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_event.nw,v retrieving revision 1.22 diff -u -r1.22 x_event.nw --- x_event.nw 14 Apr 2006 11:49:27 -0000 1.22 +++ x_event.nw 1 May 2006 19:33:39 -0000 @@ -74,6 +74,7 @@ #include <dmalloc.h> #endif +#define DEBUG 1 @ @@ -173,7 +174,9 @@ global_window_current = w_current; #if DEBUG - printf("pressed! %d \n", event_state); + printf("pressed button %d! \n", event->button); + printf("event state: %d \n", event->state); + printf("w_current state: %d \n", w_current->event_state); #endif if (event->type == GDK_2BUTTON_PRESS && @@ -489,10 +492,14 @@ /* try this out and see how it behaves */ if (w_current->inside_action) { + printf("Pressed button 2.\n"); if (w_current->event_state == ENDCOMP || - w_current->event_state == ENDTEXT ) { + w_current->event_state == ENDTEXT || + w_current->event_state == ENDMOVE) { + printf("state was ENDCOMP or ENDTEXT or ENDMOVE.\n"); return(0); } else { + printf("state was NOT ENDCOMP or ENDTEXT or ENDMOVE.\n"); i_callback_cancel(w_current, 0, NULL); return(0); } @@ -665,7 +672,7 @@ global_window_current = w_current; #if DEBUG - printf("released! %d \n", event_state); + printf("released! %d \n", w_current->event_state); #endif w_current->SHIFTKEY = (event->state & GDK_SHIFT_MASK ) ? 1 : 0; @@ -756,8 +763,10 @@ } } else if (event->button == 2) { + printf("Released button 2.\n"); if (w_current->inside_action) { + printf("Released button 2 inside action: %d.\n", w_current->event_state); if (w_current->event_state == ENDCOMP) { o_drawbounding(w_current, w_current->page_current-> @@ -767,8 +776,8 @@ w_current->complex_rotate = (w_current->complex_rotate + 90) % 360; - o_complex_place_rotate(w_current); - + o_complex_place_rotate(w_current); + o_drawbounding(w_current, w_current->page_current-> complex_place_head->next, @@ -792,6 +801,32 @@ return(0); } + else if (w_current->event_state == ENDMOVE) { + printf("Rotating while moving.\n"); + printf("w_current->last_* = (%i,%i)\n", w_current->last_x, + w_current->last_y); + printf("event coords: (%i,%i)\n", (int) event->x, (int) event->y); + printf("Mouse coords: (%i,%i)\n", (int) mouse_x, (int) mouse_y); + /* + o_drawbounding(w_current, NULL, + w_current->page_current->selection2_head->next, + x_get_darkcolor(w_current->bb_color), TRUE); + */ + /* skip over head node */ + o_move_end(w_current); + o_rotate_90(w_current, w_current->page_current->selection2_head->next, + fix_x(w_current, mouse_x), + fix_y(w_current, mouse_y)); + o_move_start(w_current, fix_x(w_current, mouse_x), + fix_y(w_current, mouse_y)); + w_current->event_state = ENDMOVE; + /* + o_drawbounding(w_current, NULL, + w_current->page_current->selection2_head->next, + x_get_darkcolor(w_current->bb_color), TRUE); + */ + return(0); + } } switch(w_current->middle_button) { @@ -1323,7 +1358,7 @@ w_current->win_height = w_current->drawing_area->allocation.height; #if DEBUG - printf("manual: %d %d\n", win_width, win_height); + printf("manual: %d %d\n", w_current->win_width, w_current->win_height); #endif w_current->width = w_current->win_width; @@ -1337,11 +1372,11 @@ w_current->page_current->bottom); #if DEBUG - printf("Coord aspect: %f Window aspect: %f\n", - coord_aspectratio, - (float) win_width / (float) win_height); - printf("w: %d h: %d\n", width, height); - printf("aw: %d ah: %d\n", win_width, win_height); + printf("Window aspect: %f\n", + (float) w_current->win_width / (float) w_current->win_height); + /* No longer used? + printf("w: %d h: %d\n", width, height); */ + printf("aw: %d ah: %d\n", w_current->win_width, w_current->win_height); #endif /* I'm assuming that the backingstore pixmap is of the right @@ -1430,7 +1465,8 @@ #if DEBUG printf("vrange %f %f\n", vadjustment->lower, vadjustment->upper); printf("vvalue %f\n", vadjustment->value); - printf("actual: %d %d\n", top, bottom); + printf("actual: %d %d\n", w_current->page_current->top, + w_current->page_current->bottom); #endif if (!w_current->DONT_REDRAW) {