[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_hook.c
User: pcjc2
Date: 07/04/17 12:18:57
Modified: . Tag: noscreen g_hook.c g_register.c globals.c
i_callbacks.c o_complex.c o_misc.c x_compselect.c
x_dialog.c x_event.c
Log:
Sync with trunk
Revision Changes Path
No revision
No revision
1.13.2.4 +95 -43 eda/geda/gaf/gschem/src/g_hook.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_hook.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_hook.c,v
retrieving revision 1.13.2.3
retrieving revision 1.13.2.4
diff -u -b -r1.13.2.3 -r1.13.2.4
--- g_hook.c 12 Apr 2007 18:43:09 -0000 1.13.2.3
+++ g_hook.c 17 Apr 2007 16:18:56 -0000 1.13.2.4
@@ -32,6 +32,21 @@
#include <dmalloc.h>
#endif
+/* Private function declarations */
+static void custom_world_get_single_object_bounds
+ (TOPLEVEL *w_current, OBJECT *o_current,
+ int *left, int *top,
+ int *right, int *bottom,
+ GList *exclude_attrib_list,
+ GList *exclude_obj_type_list);
+
+static void custom_world_get_object_list_bounds
+ (TOPLEVEL *w_current, OBJECT *o_current,
+ int *left, int *top,
+ int *right, int *bottom,
+ GList *exclude_attrib_list,
+ GList *exclude_obj_type_list);
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
@@ -389,13 +404,13 @@
* \param [out] bottom Bottom bound of the object.
*
*/
-static void custom_world_get_complex_bounds (TOPLEVEL *w_current, OBJECT *o_current,
+static void custom_world_get_single_object_bounds
+ (TOPLEVEL *w_current, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
GList *exclude_obj_type_list) {
OBJECT *obj_ptr = NULL;
- ATTRIB *attr_ptr = NULL;
int rleft, rright, rbottom, rtop;
char *text_value;
char *name_ptr, *value_ptr, aux_ptr[2];
@@ -405,21 +420,12 @@
*top = rtop = w_current->init_bottom;;
*right = *bottom = rright = rbottom = 0;
- if (o_current->type == OBJ_PIN) {
- attr_ptr = o_current->attribs;
- if (attr_ptr)
- obj_ptr = attr_ptr->object;
- else
- obj_ptr = NULL;
- } else {
obj_ptr = o_current;
- }
-
- while (obj_ptr != NULL) {
sprintf(aux_ptr, "%c", obj_ptr->type);
include_text = TRUE;
+ if (!g_list_find_custom(exclude_obj_type_list, aux_ptr,
+ (GCompareFunc) &strcmp)) {
- if (!g_list_find_custom(exclude_obj_type_list, aux_ptr, (GCompareFunc) &strcmp)) {
switch(obj_ptr->type) {
case (OBJ_PIN):
world_get_single_object_bounds (w_current, obj_ptr,
@@ -432,8 +438,10 @@
g_list_find_custom(exclude_attrib_list, name_ptr, (GCompareFunc) &strcmp)) {
include_text = FALSE;
}
- if (g_list_find_custom(exclude_attrib_list, "all", (GCompareFunc) &strcmp))
+ if (g_list_find_custom(exclude_attrib_list, "all",
+ (GCompareFunc) &strcmp)) {
include_text = FALSE;
+ }
if (include_text) {
world_get_single_object_bounds (w_current, obj_ptr,
&rleft, &rtop, &rright, &rbottom);
@@ -444,7 +452,7 @@
break;
case (OBJ_COMPLEX):
case (OBJ_PLACEHOLDER):
- custom_world_get_complex_bounds(w_current,
+ custom_world_get_object_list_bounds(w_current,
o_current->complex->prim_objs,
left, top, right, bottom,
exclude_attrib_list,
@@ -456,25 +464,69 @@
&rleft, &rtop, &rright, &rbottom);
break;
}
- }
if (rleft < *left) *left = rleft;
if (rtop < *top) *top = rtop;
if (rright > *right) *right = rright;
if (rbottom > *bottom) *bottom = rbottom;
- if (o_current->type == OBJ_PIN) {
- attr_ptr = attr_ptr->next;
- if (attr_ptr)
- obj_ptr = attr_ptr->object;
- else
- obj_ptr = NULL;
+ /* If it's a pin object, check the pin attributes */
+ if (obj_ptr->type == OBJ_PIN) {
+ ATTRIB *a_current = obj_ptr->attribs;
+ while (a_current) {
+ g_assert(a_current->object);
+
+ if (a_current->object->type == OBJ_TEXT) {
+ custom_world_get_single_object_bounds(w_current,
+ a_current->object,
+ &rleft, &rtop,
+ &rright, &rbottom,
+ exclude_attrib_list,
+ exclude_obj_type_list);
+ if (rleft < *left) *left = rleft;
+ if (rtop < *top) *top = rtop;
+ if (rright > *right) *right = rright;
+ if (rbottom > *bottom) *bottom = rbottom;
}
- else {
- obj_ptr = obj_ptr->next;
+
+ a_current = a_current->next;
}
}
}
+}
+
+static void custom_world_get_object_list_bounds
+ (TOPLEVEL *w_current, OBJECT *o_current,
+ int *left, int *top,
+ int *right, int *bottom,
+ GList *exclude_attrib_list,
+ GList *exclude_obj_type_list) {
+
+ OBJECT *obj_ptr=NULL;
+ int rleft, rtop, rright, rbottom;
+
+ *left = rleft = 999999;
+ *top = rtop = 9999999;
+ *right = rright = 0;
+ *bottom = rbottom = 0;
+
+
+ obj_ptr = o_current;
+
+ while ( obj_ptr != NULL ) {
+ custom_world_get_single_object_bounds(w_current, obj_ptr, &rleft, &rtop,
+ &rright, &rbottom,
+ exclude_attrib_list,
+ exclude_obj_type_list);
+ if (rleft < *left) *left = rleft;
+ if (rtop < *top) *top = rtop;
+ if (rright > *right) *right = rright;
+ if (rbottom > *bottom) *bottom = rbottom;
+
+
+ obj_ptr=obj_ptr->next;
+ }
+}
/*! \brief Get the object bounds of the given object, excluding the object
* types or the attributes given as parameters.
@@ -542,7 +594,7 @@
if (g_list_find_custom(exclude_attrib_list, "all", (GCompareFunc) &strcmp))
exclude_all_attribs = TRUE;
- custom_world_get_complex_bounds (w_current, object,
+ custom_world_get_single_object_bounds (w_current, object,
&left, &top,
&right, &bottom,
exclude_attrib_list,
1.49.2.5 +2 -1 eda/geda/gaf/gschem/src/g_register.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_register.c,v
retrieving revision 1.49.2.4
retrieving revision 1.49.2.5
diff -u -b -r1.49.2.4 -r1.49.2.5
--- g_register.c 26 Mar 2007 19:13:13 -0000 1.49.2.4
+++ g_register.c 17 Apr 2007 16:18:56 -0000 1.49.2.5
@@ -365,5 +365,6 @@
rotate_pin_hook = scm_create_hook ("rotate-pin-hook", 1);
add_attribute_hook = scm_create_hook ("add-attribute-hook", 1);
new_page_hook = scm_create_hook ("new-page-hook", 1);
-
+ complex_place_list_changed_hook =
+ scm_create_hook ("complex-place-list-changed-hook", 1);
}
1.18.6.2 +1 -0 eda/geda/gaf/gschem/src/globals.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globals.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/globals.c,v
retrieving revision 1.18.6.1
retrieving revision 1.18.6.2
diff -u -b -r1.18.6.1 -r1.18.6.2
--- globals.c 11 Feb 2007 23:58:56 -0000 1.18.6.1
+++ globals.c 17 Apr 2007 16:18:56 -0000 1.18.6.2
@@ -81,6 +81,7 @@
SCM add_component_object_hook;
SCM mirror_component_object_hook;
SCM rotate_component_object_hook;
+SCM complex_place_list_changed_hook;
SCM copy_component_hook;
SCM move_component_hook;
SCM add_pin_hook;
1.70.2.6 +17 -0 eda/geda/gaf/gschem/src/i_callbacks.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_callbacks.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_callbacks.c,v
retrieving revision 1.70.2.5
retrieving revision 1.70.2.6
diff -u -b -r1.70.2.5 -r1.70.2.6
--- i_callbacks.c 23 Feb 2007 23:32:12 -0000 1.70.2.5
+++ i_callbacks.c 17 Apr 2007 16:18:56 -0000 1.70.2.6
@@ -3508,9 +3508,26 @@
DEFINE_I_CALLBACK(cancel)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GValue value = { 0, };
exit_if_null(w_current);
+ if (w_current->event_state == ENDCOMP &&
+ w_current->cswindow) {
+ /* user hit escape key when placing components */
+
+ /* delete the complex place list */
+ g_list_free(w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
+ o_redraw_all(w_current);
+
+ /* Present the component selector again */
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, FALSE);
+ g_object_set_property (G_OBJECT(w_current->cswindow), "hidden", &value);
+ return;
+ }
+
if ( (w_current->inside_action) &&
(w_current->rotated_inside != 0)) {
o_undo_callback(w_current, UNDO_ACTION);
1.28.6.8 +29 -0 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.7
retrieving revision 1.28.6.8
diff -u -b -r1.28.6.7 -r1.28.6.8
--- o_complex.c 25 Feb 2007 14:37:38 -0000 1.28.6.7
+++ o_complex.c 17 Apr 2007 16:18:56 -0000 1.28.6.8
@@ -158,12 +158,41 @@
}
}
+ /* Run the complex place list changed hook */
+ o_complex_place_changed_run_hook (w_current);
+
o_drawbounding(w_current,
NULL,
w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
+/*! \brief Run the complex place list changed hook.
+ * \par Function Description
+ * The complex place list is usually used when placing new components
+ * in the schematic. This function should be called whenever that list
+ * is modified.
+ * \param [in] w_current TOPLEVEL structure.
+ *
+ */
+void o_complex_place_changed_run_hook(TOPLEVEL *w_current) {
+ GList *ptr = NULL;
+
+ /* Run the complex place list changed hook */
+ if (scm_hook_empty_p(complex_place_list_changed_hook) == SCM_BOOL_F &&
+ w_current->page_current->complex_place_list != NULL) {
+ ptr = w_current->page_current->complex_place_list;
+ while (ptr) {
+ scm_run_hook(complex_place_list_changed_hook,
+ scm_cons (g_make_object_smob
+ (w_current,
+ (OBJECT *) ptr->data), SCM_EOL));
+ ptr = ptr->next;
+ }
+
+ }
+}
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
1.36.2.6 +5 -0 eda/geda/gaf/gschem/src/o_misc.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_misc.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_misc.c,v
retrieving revision 1.36.2.5
retrieving revision 1.36.2.6
diff -u -b -r1.36.2.5 -r1.36.2.6
--- o_misc.c 24 Mar 2007 00:54:20 -0000 1.36.2.5
+++ o_misc.c 17 Apr 2007 16:18:56 -0000 1.36.2.6
@@ -1132,6 +1132,11 @@
&name, &value);
attrfound = o_attrib_search_name_single(o_current, name, NULL);
+
+ /* free these now since they are no longer being used */
+ if (name) { g_free(name); }
+ if (value) { g_free(value); }
+
if (attrfound == NULL) {
/* attribute with same name not found in old component: */
/* add new attribute to old component */
1.11.2.3 +47 -4 eda/geda/gaf/gschem/src/x_compselect.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_compselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -u -b -r1.11.2.2 -r1.11.2.3
--- x_compselect.c 11 Feb 2007 23:58:57 -0000 1.11.2.2
+++ x_compselect.c 17 Apr 2007 16:18:56 -0000 1.11.2.3
@@ -82,6 +82,7 @@
{
Compselect *compselect = (Compselect*)dialog;
TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
+ GValue value = { 0, };
switch (arg1) {
case GTK_RESPONSE_APPLY: {
@@ -148,11 +149,33 @@
break;
}
+ case GTK_RESPONSE_OK:
+ /* Response when clicking on the "hide" button */
+
+ /* If there is no component in the complex place list, set the current one */
+ if (toplevel->page_current->complex_place_list == NULL) {
+ gtk_dialog_response (GTK_DIALOG (compselect), GTK_RESPONSE_APPLY);
+ }
+
+ /* Hide the component selector */
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean(&value, TRUE);
+ g_object_set_property (G_OBJECT(compselect), "hidden", &value);
+ break;
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
g_assert (GTK_WIDGET (dialog) == toplevel->cswindow);
gtk_widget_destroy (GTK_WIDGET (dialog));
toplevel->cswindow = NULL;
+
+ /* Free the complex place list */
+ g_list_free(toplevel->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list = NULL;
+
+ /* return to the default state */
+ i_set_state(toplevel, SELECT);
+ i_update_toolbar(toplevel);
+
break;
default:
g_assert_not_reached ();
@@ -208,14 +231,14 @@
gtk_widget_destroy (toplevel->cswindow);
toplevel->cswindow = NULL;
}
-
}
enum {
PROP_FILENAME=1,
- PROP_BEHAVIOR
+ PROP_BEHAVIOR,
+ PROP_HIDDEN
};
static GObjectClass *compselect_parent_class = NULL;
@@ -647,6 +670,13 @@
COMPSELECT_TYPE_BEHAVIOR,
COMPSELECT_BEHAVIOR_REFERENCE,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ gobject_class, PROP_HIDDEN,
+ g_param_spec_boolean ("hidden",
+ "",
+ "",
+ FALSE,
+ G_PARAM_READWRITE));
}
@@ -884,8 +914,11 @@
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
/* - update button */
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
+ /* Initialize the hidden property */
+ compselect->hidden = FALSE;
}
static void
@@ -914,6 +947,13 @@
gtk_combo_box_set_active (compselect->combobox_behaviors,
g_value_get_enum (value));
break;
+ case PROP_HIDDEN:
+ compselect->hidden = g_value_get_boolean(value);
+ if (compselect->hidden)
+ gtk_widget_hide(GTK_WIDGET(compselect));
+ else
+ gtk_window_present (GTK_WINDOW(compselect));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -960,6 +1000,9 @@
gtk_combo_box_get_active (
compselect->combobox_behaviors));
break;
+ case PROP_HIDDEN:
+ g_value_set_boolean(value, compselect->hidden);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
1.68.2.7 +1 -0 eda/geda/gaf/gschem/src/x_dialog.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_dialog.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_dialog.c,v
retrieving revision 1.68.2.6
retrieving revision 1.68.2.7
diff -u -b -r1.68.2.6 -r1.68.2.7
--- x_dialog.c 6 Apr 2007 17:29:13 -0000 1.68.2.6
+++ x_dialog.c 17 Apr 2007 16:18:56 -0000 1.68.2.7
@@ -1712,6 +1712,7 @@
size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin_size));
w_current->snap_size = size;
+ o_redraw_all(w_current);
w_current->page_current->CHANGED=1; /* maybe remove those two lines */
o_undo_savestate(w_current, UNDO_ALL);
break;
1.41.6.7 +3 -0 eda/geda/gaf/gschem/src/x_event.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_event.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_event.c,v
retrieving revision 1.41.6.6
retrieving revision 1.41.6.7
diff -u -b -r1.41.6.6 -r1.41.6.7
--- x_event.c 24 Feb 2007 17:14:34 -0000 1.41.6.6
+++ x_event.c 17 Apr 2007 16:18:56 -0000 1.41.6.7
@@ -805,6 +805,9 @@
o_complex_place_rotate(w_current);
+ /* Run the complex place list changed hook */
+ o_complex_place_changed_run_hook (w_current);
+
o_drawbounding(w_current,
NULL,
w_current->page_current->complex_place_list,
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs