[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: o_basic.c
User: pcjc2
Date: 07/02/25 08:41:24
Modified: . Tag: noscreen o_basic.c o_complex.c o_find.c
o_move.c o_select.c o_text.c
Log:
Switched over to caching world rather than screen coordinates.
Removed screen coordinates from object datastructures, and renamed
variables storing cached bounds with prefix w_ to differentiate their world
coord usage. Changed s_basic.c to initialise all these variables to zero.
Converted code using those variables to world coordinates as appropriate.
Revision Changes Path
No revision
No revision
1.22.4.2 +98 -70 eda/geda/gaf/gschem/src/o_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_basic.c,v
retrieving revision 1.22.4.1
retrieving revision 1.22.4.2
diff -u -b -r1.22.4.1 -r1.22.4.2
--- o_basic.c 27 Dec 2006 17:37:56 -0000 1.22.4.1
+++ o_basic.c 25 Feb 2007 13:41:24 -0000 1.22.4.2
@@ -284,6 +284,7 @@
/* static is highly temp */
/* you have to make these static... for the once mode */
static int rleft, rtop, rbottom, rright;
+ static int w_rleft, w_rtop, w_rbottom, w_rright;
if (!o_list && !o_glist) {
return;
@@ -313,18 +314,24 @@
gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- }
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ }
+
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
+
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
rleft + diff_x,
@@ -341,17 +348,17 @@
#endif
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
diff_x = w_current->last_x - w_current->start_x;
@@ -359,6 +366,10 @@
gdk_gc_set_foreground(w_current->gc,
x_get_color(
w_current->background_color) );
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->gc, FALSE,
rleft + diff_x,
@@ -410,21 +421,25 @@
} else {
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
gdk_gc_set_foreground(w_current->bounding_xor_gc,
color);
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
rleft + diff_x,
@@ -457,21 +472,25 @@
} else {
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
gdk_gc_set_foreground(w_current->bounding_xor_gc,
color);
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc,
FALSE,
@@ -519,17 +538,17 @@
/*! \todo why are we doing this here...?
* probably a reason */
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
}
@@ -553,17 +572,17 @@
if (firsttime == TRUE) {
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
- } else if (o_glist) {
- get_object_glist_bounds(w_current, o_glist,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
+ } else if (o_glist) {
+ world_get_object_glist_bounds(w_current, o_glist,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
/*printf("once\n");*/
@@ -572,6 +591,10 @@
diff_x = w_current->last_x - w_current->start_x;
diff_y = w_current->last_y - w_current->start_y;
gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
rleft + diff_x,
@@ -605,6 +628,7 @@
{
int diff_x, diff_y;
int rleft, rtop, rright, rbottom;
+ int w_rleft, w_rtop, w_rright, w_rbottom;
if ( (o_list == NULL) && (s_list == NULL)) {
/* this is an error condition */
@@ -618,17 +642,17 @@
}
if (o_list) {
- get_object_list_bounds(w_current, o_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_list_bounds(w_current, o_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
} else if (s_list) {
- get_object_glist_bounds(w_current, s_list,
- &rleft ,
- &rtop ,
- &rright ,
- &rbottom);
+ world_get_object_glist_bounds(w_current, s_list,
+ &w_rleft ,
+ &w_rtop ,
+ &w_rright ,
+ &w_rbottom);
}
diff_x = w_current->last_x - w_current->start_x;
@@ -636,6 +660,10 @@
gdk_gc_set_foreground(w_current->gc,
x_get_color(w_current->background_color) );
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ &rright, &rbottom );
gdk_draw_rectangle(w_current->window, w_current->gc, FALSE,
rleft + diff_x,
rtop + diff_y,
1.28.6.6 +29 -28 eda/geda/gaf/gschem/src/o_complex.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_complex.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_complex.c,v
retrieving revision 1.28.6.5
retrieving revision 1.28.6.6
diff -u -b -r1.28.6.5 -r1.28.6.6
--- o_complex.c 12 Feb 2007 01:53:32 -0000 1.28.6.5
+++ o_complex.c 25 Feb 2007 13:41:24 -0000 1.28.6.6
@@ -50,18 +50,13 @@
o_redraw(w_current, o_current->complex->prim_objs, TRUE);
}
- get_object_list_bounds(w_current, o_current->complex->prim_objs,
+ world_get_object_list_bounds(w_current, o_current->complex->prim_objs,
&left, &top, &right, &bottom);
- o_current->left = left;
- o_current->top = top;
- o_current->right = right;
- o_current->bottom = bottom;
-
- WORLDtoSCREEN(w_current,
- o_current->complex->x,
- o_current->complex->y,
- &o_current->complex->screen_x,
- &o_current->complex->screen_y);
+ o_current->w_left = left;
+ o_current->w_top = top;
+ o_current->w_right = right;
+ o_current->w_bottom = bottom;
+
}
/*! \todo Finish function documentation!!!
@@ -242,6 +237,7 @@
int diff_x, diff_y;
int x, y;
int rleft, rtop, rbottom, rright;
+ int w_rleft, w_rtop, w_rbottom, w_rright;
OBJECT *o_current;
OBJECT *o_start;
OBJECT *o_temp;
@@ -309,10 +305,14 @@
#if 0
printf("inside draw bounding here\n");
#endif
- get_object_glist_bounds(w_current,
+ world_get_object_glist_bounds(w_current,
w_current->page_current->
complex_place_list,
- &rleft, &rtop, &rright, &rbottom);
+ &w_rleft, &w_rtop, &w_rright, &w_rbottom);
+
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop, &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom, &rright, &rbottom );
+
gdk_gc_set_foreground(
w_current->gc,
x_get_color(w_current->background_color));
@@ -409,10 +409,14 @@
#if 0
printf("inside draw bounding here\n");
#endif
- get_object_glist_bounds(w_current,
+ world_get_object_glist_bounds(w_current,
w_current->page_current->complex_place_list,
- &rleft, &rtop,
- &rright, &rbottom);
+ &w_rleft, &w_rtop,
+ &w_rright, &w_rbottom);
+
+ WORLDtoSCREEN( w_current, w_rleft, w_rtop, &rleft, &rtop );
+ WORLDtoSCREEN( w_current, w_rright, w_rbottom, &rright, &rbottom );
+
gdk_gc_set_foreground(
w_current->gc,
x_get_color(w_current->background_color));
@@ -608,7 +612,7 @@
*/
void o_complex_translate_all(TOPLEVEL *w_current, int offset)
{
- int rleft, rtop, rright, rbottom;
+ int w_rleft, w_rtop, w_rright, w_rbottom;
OBJECT *o_current;
int x, y;
@@ -617,18 +621,15 @@
A_PAN_DONT_REDRAW);
o_redraw_all(w_current);
- get_object_list_bounds(w_current, w_current->page_current->object_head,
- &rleft,
- &rtop,
- &rright,
- &rbottom);
+ world_get_object_list_bounds(w_current, w_current->page_current->object_head,
+ &w_rleft,
+ &w_rtop,
+ &w_rright,
+ &w_rbottom);
/*! \todo do we want snap grid here? */
- SCREENtoWORLD(w_current,
- fix_x(w_current, rleft ),
- fix_y(w_current, rbottom),
- &x,
- &y);
+ x = snap_grid( w_current, w_rleft );
+ y = snap_grid( w_current, w_rbottom );
o_current = w_current->page_current->object_head;
while(o_current != NULL) {
1.4.6.2 +16 -10 eda/geda/gaf/gschem/src/o_find.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_find.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_find.c,v
retrieving revision 1.4.6.1
retrieving revision 1.4.6.2
diff -u -b -r1.4.6.1 -r1.4.6.2
--- o_find.c 27 Dec 2006 17:37:56 -0000 1.4.6.1
+++ o_find.c 25 Feb 2007 13:41:24 -0000 1.4.6.2
@@ -40,6 +40,9 @@
{
OBJECT *o_current=NULL;
gboolean object_found = FALSE;
+ int w_x, w_y;
+
+ SCREENtoWORLD( w_current, screen_x, screen_y, &w_x, &w_y );
if (w_current->page_current->object_lastplace == NULL) {
o_current = w_current->page_current->object_head;
@@ -49,9 +52,9 @@
/* do first search */
while (o_current != NULL) {
- if (inside_region(o_current->left, o_current->top,
- o_current->right, o_current->bottom,
- screen_x, screen_y)) {
+ if (inside_region(o_current->w_left, o_current->w_top,
+ o_current->w_right, o_current->w_bottom,
+ w_x, w_y)) {
if (o_current->sel_func != NULL &&
o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
@@ -81,9 +84,9 @@
o_current = w_current->page_current->object_head;
while (o_current != NULL &&
o_current != w_current->page_current->object_lastplace) {
- if (inside_region(o_current->left, o_current->top,
- o_current->right, o_current->bottom,
- screen_x, screen_y)) {
+ if (inside_region(o_current->w_left, o_current->w_top,
+ o_current->w_right, o_current->w_bottom,
+ w_x, w_y)) {
if (o_current->sel_func != NULL &&
o_current->type != OBJ_HEAD &&
@@ -131,19 +134,22 @@
{
OBJECT *o_current=NULL;
GList *s_current;
+ int w_x, w_y;
+
+ SCREENtoWORLD( w_current, screen_x, screen_y, &w_x, &w_y );
s_current = w_current->page_current->selection_list;
/* do first search */
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
- if (inside_region(o_current->left, o_current->top,
- o_current->right, o_current->bottom,
- screen_x, screen_y)) {
+ if (inside_region(o_current->w_left, o_current->w_top,
+ o_current->w_right, o_current->w_bottom,
+ w_x, w_y)) {
#if DEBUG
printf("o_find_selected_object:\n");
printf("Object bounds:\n\tL: %i\tR: %i\n\tT: %i\tB: %i.\n",
- o_current->left, o_current->right, o_current->top, o_current->bottom);
+ o_current->w_left, o_current->w_right, o_current->w_top, o_current->w_bottom);
printf("Screen pointer at: (%i,%i)\n", screen_x, screen_y);
#endif
if (o_current->sel_func != NULL &&
1.29.6.4 +5 -10 eda/geda/gaf/gschem/src/o_move.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_move.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_move.c,v
retrieving revision 1.29.6.3
retrieving revision 1.29.6.4
diff -u -b -r1.29.6.3 -r1.29.6.4
--- o_move.c 12 Feb 2007 01:53:32 -0000 1.29.6.3
+++ o_move.c 25 Feb 2007 13:41:24 -0000 1.29.6.4
@@ -254,23 +254,18 @@
object->complex->x = object->complex->x + diff_x;
object->complex->y = object->complex->y + diff_y;
- WORLDtoSCREEN(w_current, object->complex->x,
- object->complex->y,
- &object->complex->screen_x,
- &object->complex->screen_y);
-
o_move_end_lowlevel(w_current, object->complex->prim_objs,
COMPLEX, diff_x, diff_y,
&other_objects, &connected_objects);
- get_object_list_bounds(w_current, object->complex->prim_objs,
+ world_get_object_list_bounds(w_current, object->complex->prim_objs,
&left, &top, &right, &bottom);
- object->left = left;
- object->top = top;
- object->right = right;
- object->bottom = bottom;
+ object->w_left = left;
+ object->w_top = top;
+ object->w_right = right;
+ object->w_bottom = bottom;
break;
}
1.5.6.3 +8 -8 eda/geda/gaf/gschem/src/o_select.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_select.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_select.c,v
retrieving revision 1.5.6.2
retrieving revision 1.5.6.3
diff -u -b -r1.5.6.2 -r1.5.6.3
--- o_select.c 12 Feb 2007 02:19:38 -0000 1.5.6.2
+++ o_select.c 25 Feb 2007 13:41:24 -0000 1.5.6.3
@@ -414,14 +414,14 @@
if (o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE && w_current->show_hidden_text))) {
- if ( (o_current->left >= w_current->start_x &&
- o_current->top >= w_current->start_y) &&
- (o_current->left >= w_current->start_x &&
- o_current->bottom <= w_current->last_y) &&
- (o_current->right <= w_current->last_x &&
- o_current->top >= w_current->start_y ) &&
- (o_current->right <= w_current->last_x &&
- o_current->bottom <= w_current->last_y) ) {
+ if ( (o_current->w_left >= w_start_x &&
+ o_current->w_top <= w_start_y) &&
+ (o_current->w_left >= w_start_x &&
+ o_current->w_bottom >= w_last_y) &&
+ (o_current->w_right <= w_last_x &&
+ o_current->w_top <= w_start_y ) &&
+ (o_current->w_right <= w_last_x &&
+ o_current->w_bottom >= w_last_y) ) {
o_select_object(w_current, o_current,
MULTIPLE, count);
1.25.2.4 +5 -10 eda/geda/gaf/gschem/src/o_text.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_text.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_text.c,v
retrieving revision 1.25.2.3
retrieving revision 1.25.2.4
diff -u -b -r1.25.2.3 -r1.25.2.4
--- o_text.c 12 Feb 2007 02:19:38 -0000 1.25.2.3
+++ o_text.c 25 Feb 2007 13:41:24 -0000 1.25.2.4
@@ -62,18 +62,13 @@
o_redraw(w_current, o_current->text->prim_objs, TRUE);
- get_object_list_bounds(w_current, o_current->text->prim_objs,
+ world_get_object_list_bounds(w_current, o_current->text->prim_objs,
&left, &top, &right, &bottom);
- o_current->left = left;
- o_current->top = top;
- o_current->right = right;
- o_current->bottom = bottom;
+ o_current->w_left = left;
+ o_current->w_top = top;
+ o_current->w_right = right;
+ o_current->w_bottom = bottom;
- WORLDtoSCREEN(w_current,
- o_current->text->x,
- o_current->text->y,
- &o_current->text->screen_x,
- &o_current->text->screen_y);
}
/*! \todo Finish function documentation!!!
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs