[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_hook.c
User: pcjc2
Date: 06/12/27 12:37:58
Modified: . Tag: noscreen g_hook.c i_basic.c i_callbacks.c
o_attrib.c o_basic.c o_buffer.c o_bus.c o_complex.c
o_copy.c o_delete.c o_find.c o_grips.c o_misc.c
o_move.c o_net.c o_picture.c o_select.c o_slot.c
o_text.c x_attribedit.c x_autonumber.c
x_compselect.c x_dialog.c x_event.c x_image.c
x_multiattrib.c x_print.c
Log:
sync with trunk
Revision Changes Path
No revision
No revision
1.13.2.1 +77 -42 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
retrieving revision 1.13.2.1
diff -u -b -r1.13 -r1.13.2.1
--- g_hook.c 14 Dec 2006 19:00:16 -0000 1.13
+++ g_hook.c 27 Dec 2006 17:37:56 -0000 1.13.2.1
@@ -379,20 +379,26 @@
return SCM_BOOL_T;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Get the object bounds of the given object, excluding the object
+ * types given as parameters.
* \par Function Description
+ * Get the object bounds without considering the attributes in
+ * exclude_attrib_list, neither the object types included in
+ * exclude_obj_type_list
+ * \param [in] w_current TOPLEVEL structure.
+ * \param [in] o_current The object we want to know the bounds of.
+ * \param [in] exclude_attrib_list A list with the attribute names we don't
+ * want to include when calculing the bounds.
+ * \param [in] exclude_obj_type_list A list with the object types we don't
+ * want to include when calculing the bounds.
+ * The object types are those used in (OBJECT *)->type converted into strings.
+ * \param [out] left Left bound of the object.
+ * \param [out] top Top bound of the object.
+ * \param [out] right Right bound of the object.
+ * \param [out] bottom Bottom bound of the object.
*
*/
-/*! \bug FIXME
- * Returns a list of the bounds of the <B>object smob</B>.
- * The list has the format: ( (left right) (top bottom) )
- * I got top and bottom values reversed from world_get_complex_bounds,
- * so don\'t rely on the position in the list.
- */
-SCM g_get_object_bounds (SCM object_smob, SCM scm_exclude_attribs, SCM scm_exclude_object_type)
-{
- void custom_world_get_complex_bounds (TOPLEVEL *w_current, OBJECT *o_current,
+static void custom_world_get_complex_bounds (TOPLEVEL *w_current, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
@@ -479,6 +485,26 @@
}
}
+/*! \brief Get the object bounds of the given object, excluding the object
+ * types or the attributes given as parameters.
+ * \par Function Description
+ * Get the object bounds without considering the attributes in
+ * scm_exclude_attribs, neither the object types included in
+ * scm_exclude_object_type
+ * \param [in] object_smob The object we want to know the bounds of.
+ * \param [in] exclude_attrib_list A list with the attribute names we don't
+ * want to include when calculing the bounds.
+ * \param [in] exclude_obj_type_list A list with the object types we don't
+ * want to include when calculing the bounds.
+ * The object types are those used in (OBJECT *)->type converted into strings.
+ * \return a list of the bounds of the <B>object smob</B>.
+ * The list has the format: ( (left right) (top bottom) )
+ * I got top and bottom values reversed from world_get_complex_bounds,
+ * so don\'t rely on the position in the list.
+ */
+SCM g_get_object_bounds (SCM object_smob, SCM scm_exclude_attribs, SCM scm_exclude_object_type)
+{
+
TOPLEVEL *w_current=NULL;
OBJECT *object=NULL;
int left=0, right=0, bottom=0, top=0;
@@ -586,6 +612,9 @@
* \param [in] angle Angle of rotation of the symbol.
* \param [in] selectable True if the symbol is selectable, false otherwise.
* \param [in] mirror True if the symbol is mirrored, false otherwise.
+ * If scm_comp_name is a scheme empty list, SCM_BOOL_F, or an empty
+ * string (""), then g_add_component returns SCM_BOOL_F without writing
+ * to the log.
* \return TRUE if the component was added, FALSE otherwise.
*
*/
@@ -600,14 +629,20 @@
GSList *clibs = NULL;
OBJECT *new_object;
+ /* Return if scm_comp_name is NULL (an empty list) or scheme's FALSE */
+ if (SCM_NULLP(scm_comp_name) ||
+ (SCM_BOOLP(scm_comp_name) && !(SCM_NFALSEP(scm_comp_name))) ) {
+ return SCM_BOOL_F;
+ }
+
/* Get w_current and the page */
SCM_ASSERT (g_get_data_from_page_smob (page_smob, &w_current, &page),
- page_smob, SCM_ARG1, "add-component");
+ page_smob, SCM_ARG1, "add-component-at-xy");
/* Check the arguments */
SCM_ASSERT (SCM_STRINGP(scm_comp_name), scm_comp_name,
- SCM_ARG2, "add-component");
+ SCM_ARG2, "add-component-at-xy");
SCM_ASSERT ( SCM_INUMP(scm_x), scm_x,
- SCM_ARG3, "add-component");
+ SCM_ARG3, "add-component-at-xy");
SCM_ASSERT ( SCM_INUMP(scm_y), scm_y,
SCM_ARG4, "add-component-at-xy");
SCM_ASSERT ( SCM_INUMP(scm_angle), scm_angle,
@@ -638,7 +673,9 @@
s_log_message ("add-component-at-xy: Component with name [%s] not found.\n",
comp_name);
return SCM_BOOL_F;
- } else {
+ }
+
+ g_assert(clibs != NULL);
if (g_slist_next (clibs)) {
s_log_message ("add-component-at-xy: More than one component found with name [%s]\n",
comp_name);
@@ -648,14 +685,15 @@
clib = (gchar*)clibs->data;
new_object = page->object_tail = o_complex_add(w_current,
- page->object_tail, 'C',
+ page->object_tail, NULL,
+ 'C',
WHITE,
x, y,
angle, mirror,
clib, comp_name,
selectable, FALSE);
-/*
+ /*
* For now, do not redraw the newly added complex, since this might cause
* flicker if you are zoom/panning right after this function executes
*/
@@ -666,9 +704,6 @@
#endif
return SCM_BOOL_T;
- }
-
- return SCM_BOOL_F;
}
/*! \brief Return the objects in a page.
1.16.2.1 +5 -2 eda/geda/gaf/gschem/src/i_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_basic.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -b -r1.16 -r1.16.2.1
--- i_basic.c 7 Dec 2006 04:24:17 -0000 1.16
+++ i_basic.c 27 Dec 2006 17:37:56 -0000 1.16.2.1
@@ -425,7 +425,10 @@
* should be based on what is in the selection list
*/
- if (o_selection_return_num(w_current->page_current->selection2_head)) {
+ g_assert(w_current != NULL);
+ g_assert(w_current->page_current != NULL);
+
+ if (w_current->page_current->selection_list != NULL) {
/* since one or more things are selected, we set these TRUE */
/* These strings should NOT be internationalized */
x_menus_sensitivity(w_current, "Edit/Cut Buffer", TRUE);
1.70.2.1 +77 -57 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
retrieving revision 1.70.2.1
diff -u -b -r1.70 -r1.70.2.1
--- i_callbacks.c 5 Dec 2006 03:04:31 -0000 1.70
+++ i_callbacks.c 27 Dec 2006 17:37:56 -0000 1.70.2.1
@@ -799,7 +799,7 @@
exit_if_null(w_current);
i_update_middle_button(w_current, i_callback_edit_edit, _("Edit"));
- o_edit(w_current, w_current->page_current->selection2_head->next);
+ o_edit(w_current, w_current->page_current->selection_list);
}
/*! \todo Finish function documentation!!!
@@ -884,18 +884,19 @@
DEFINE_I_CALLBACK(edit_rotate_90_hotkey)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
- SELECTION *s_current;
+ GList *object_list;
exit_if_null(w_current);
o_redraw_cleanstates(w_current);
- if (w_current->page_current->selection2_head) {
- s_current = w_current->page_current->selection2_head->next;
+ object_list = w_current->page_current->selection_list;
+
+ if (object_list) {
i_update_middle_button(w_current,
i_callback_edit_rotate_90_hotkey, _("Rotate"));
/* Allow o_rotate_90 to redraw the objects */
w_current->DONT_REDRAW = 0;
- o_rotate_90(w_current, s_current, mouse_x, mouse_y);
+ o_rotate_90(w_current, object_list, mouse_x, mouse_y);
}
w_current->event_state = SELECT;
@@ -926,19 +927,20 @@
DEFINE_I_CALLBACK(edit_mirror_hotkey)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
- OBJECT *object;
+ GList *object_list;
exit_if_null(w_current);
o_redraw_cleanstates(w_current);
- object = o_select_return_first_object(w_current);
- if (object) {
+ object_list = w_current->page_current->selection_list;
+
+ if (object_list) {
i_update_middle_button(w_current,
i_callback_edit_mirror_hotkey, _("Mirror"));
o_mirror(w_current,
- w_current->page_current->selection2_head->next,
+ object_list,
mouse_x, mouse_y);
}
@@ -1025,6 +1027,7 @@
DEFINE_I_CALLBACK(edit_embed)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ OBJECT *o_current;
exit_if_null(w_current);
@@ -1032,14 +1035,15 @@
/* anything selected ? */
if (o_select_selected(w_current)) {
/* yes, embed each selected component */
- SELECTION *s_current =
- w_current->page_current->selection2_head->next;
+ GList *s_current =
+ w_current->page_current->selection_list;
while (s_current != NULL) {
- g_assert (s_current->selected_object != NULL);
- if ( (s_current->selected_object->type == OBJ_COMPLEX) ||
- (s_current->selected_object->type == OBJ_PICTURE) ) {
- o_embed (w_current, s_current->selected_object);
+ o_current = (OBJECT *) s_current->data;
+ g_assert (o_current != NULL);
+ if ( (o_current->type == OBJ_COMPLEX) ||
+ (o_current->type == OBJ_PICTURE) ) {
+ o_embed (w_current, o_current);
}
s_current = s_current->next;
}
@@ -1061,6 +1065,7 @@
DEFINE_I_CALLBACK(edit_unembed)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ OBJECT *o_current;
exit_if_null(w_current);
@@ -1068,14 +1073,15 @@
/* anything selected ? */
if (o_select_selected(w_current)) {
/* yes, unembed each selected component */
- SELECTION *s_current =
- w_current->page_current->selection2_head->next;
+ GList *s_current =
+ w_current->page_current->selection_list;
while (s_current != NULL) {
- g_assert (s_current->selected_object != NULL);
- if ( (s_current->selected_object->type == OBJ_COMPLEX) ||
- (s_current->selected_object->type == OBJ_PICTURE) ) {
- o_unembed (w_current, s_current->selected_object);
+ o_current = (OBJECT *) s_current->data;
+ g_assert (o_current != NULL);
+ if ( (o_current->type == OBJ_COMPLEX) ||
+ (o_current->type == OBJ_PICTURE) ) {
+ o_unembed (w_current, o_current);
}
s_current = s_current->next;
}
@@ -1097,6 +1103,7 @@
DEFINE_I_CALLBACK(edit_update)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ OBJECT *o_current;
exit_if_null(w_current);
@@ -1104,14 +1111,14 @@
/* anything selected ? */
if (o_select_selected(w_current)) {
/* yes, update each selected component */
- SELECTION *s_current =
- w_current->page_current->selection2_head->next;
+ GList *s_current =
+ w_current->page_current->selection_list;
while (s_current != NULL) {
- g_assert (s_current->selected_object != NULL);
- if (s_current->selected_object->type == OBJ_COMPLEX) {
- o_update_component (w_current,
- s_current->selected_object);
+ o_current = (OBJECT *) s_current->data;
+ g_assert (o_current != NULL);
+ if (o_current->type == OBJ_COMPLEX) {
+ o_update_component (w_current, o_current);
}
s_current = s_current->next;
}
@@ -1259,13 +1266,13 @@
/* anything selected ? */
if (o_select_selected(w_current)) {
- SELECTION *s_current =
- w_current->page_current->selection2_head->next;
+ GList *s_current =
+ w_current->page_current->selection_list;
GList *objects = NULL;
/* yes, build a list of relevant objects */
while (s_current != NULL) {
- OBJECT *o_current = s_current->selected_object;
+ OBJECT *o_current = (OBJECT *) s_current->data;
if (o_current->type == OBJ_LINE ||
o_current->type == OBJ_BOX ||
@@ -1302,13 +1309,13 @@
/* anything selected ? */
if (o_select_selected(w_current)) {
- SELECTION *s_current =
- w_current->page_current->selection2_head->next;
+ GList *s_current =
+ w_current->page_current->selection_list;
GList *objects = NULL;
/* yes, build a list of relevant objects */
while (s_current != NULL) {
- OBJECT *o_current = s_current->selected_object;
+ OBJECT *o_current = (OBJECT *) s_current->data;
if (o_current->type == OBJ_BOX ||
o_current->type == OBJ_CIRCLE) {
@@ -1854,7 +1861,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_copy1, _("Copy 1"));
@@ -1873,7 +1880,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_copy2, _("Copy 2"));
@@ -1892,7 +1899,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_copy3, _("Copy 3"));
@@ -1911,7 +1918,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_copy4, _("Copy 4"));
@@ -1930,7 +1937,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_copy5, _("Copy 5"));
@@ -1949,7 +1956,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_cut1, _("Cut 1"));
@@ -1968,7 +1975,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_cut2, _("Cut 2"));
@@ -1987,7 +1994,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_cut3, _("Cut 3"));
@@ -2006,7 +2013,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_cut4, _("Cut 4"));
@@ -2025,7 +2032,7 @@
exit_if_null(w_current);
- if (w_current->page_current->selection2_head->next == NULL)
+ if (w_current->page_current->selection_list == NULL)
return;
i_update_middle_button(w_current, i_callback_buffer_cut5, _("Cut 5"));
@@ -3066,7 +3073,7 @@
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
OBJECT *first_object;
- SELECTION *s_current;
+ GList *s_current;
exit_if_null(w_current);
@@ -3082,12 +3089,12 @@
_("Attach"));
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
if (!s_current) {
return;
}
- first_object = s_current->selected_object;
+ first_object = (OBJECT *) s_current->data;
if (!first_object) {
return;
}
@@ -3095,10 +3102,10 @@
/* skip over first object */
s_current = s_current->next;
while (s_current != NULL) {
- if (s_current->selected_object) {
+ if (s_current->data) {
o_attrib_attach(w_current,
w_current->page_current->object_head,
- s_current->selected_object,
+ (OBJECT *)s_current->data,
first_object);
w_current->page_current->CHANGED=1;
}
@@ -3115,7 +3122,7 @@
DEFINE_I_CALLBACK(attributes_detach)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
- SELECTION *s_current;
+ GList *s_current;
OBJECT *o_current;
exit_if_null(w_current);
@@ -3131,9 +3138,9 @@
_("Detach"));
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- o_current = s_current->selected_object;
+ o_current = (OBJECT *) s_current->data;
if (o_current) {
if (o_current->attribs) {
o_attrib_free_all(w_current,
@@ -3173,7 +3180,7 @@
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
w_current->page_current->
- selection2_head->next,
+ selection_list,
SHOW_NAME);
}
}
@@ -3204,7 +3211,7 @@
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
w_current->page_current->
- selection2_head->next,
+ selection_list,
SHOW_VALUE);
}
}
@@ -3235,7 +3242,7 @@
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
w_current->page_current->
- selection2_head->next,
+ selection_list,
SHOW_NAME_VALUE);
}
}
@@ -3267,7 +3274,7 @@
if (object != NULL) {
o_attrib_toggle_visibility(w_current,
w_current->page_current->
- selection2_head->next);
+ selection_list);
}
}
@@ -3505,8 +3512,21 @@
* so lets be sure to clean up the complex_place_head
* structure and also clean up the attrib_place_head.
* remember these don't remove the head structure */
- o_list_delete_rest(w_current,
- w_current->page_current->complex_place_head);
+
+ /* If it is a move command, then free the complex place list WITHOUT
+ freeing the individual objects. */
+ if ( (w_current->inside_action) &&
+ ((w_current->event_state == ENDCOPY) ||
+ (w_current->event_state == ENDMCOPY)) ) {
+ s_delete_object_glist(w_current,
+ w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
+ }
+ else {
+ g_list_free(w_current->page_current->complex_place_list);
+ }
+ w_current->page_current->complex_place_list = NULL;
+
o_list_delete_rest(w_current,
w_current->page_current->attrib_place_head);
1.25.6.1 +17 -17 eda/geda/gaf/gschem/src/o_attrib.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_attrib.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_attrib.c,v
retrieving revision 1.25
retrieving revision 1.25.6.1
diff -u -b -r1.25 -r1.25.6.1
--- o_attrib.c 6 Aug 2006 16:07:54 -0000 1.25
+++ o_attrib.c 27 Dec 2006 17:37:56 -0000 1.25.6.1
@@ -51,12 +51,12 @@
*
* \todo get a better name
*/
-void o_attrib_add_selected(TOPLEVEL *w_current, SELECTION* selection_list,
+void o_attrib_add_selected(TOPLEVEL *w_current, GList** selection_list_ptr,
OBJECT *selected)
{
ATTRIB *a_current;
- if (!selection_list) return;
+ if (!(*selection_list_ptr)) return;
/* deal with attributes here? */
if (selected->attribs != NULL) {
@@ -69,7 +69,7 @@
/* make sure object isn't selected already */
if (a_current->object->saved_color == -1) {
- o_selection_add(selection_list,
+ o_selection_add(selection_list_ptr,
/* w_current->page_current->
selection2_head,*/
a_current->object);
@@ -90,9 +90,9 @@
* \par Function Description
*
*/
-void o_attrib_toggle_visibility(TOPLEVEL *w_current, SELECTION *list)
+void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object = NULL;
if (list == NULL) {
@@ -102,7 +102,7 @@
s_current = list;
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object == NULL) {
fprintf(stderr, _("Got NULL in o_attrib_toggle_visibility\n"));
exit(-1);
@@ -154,9 +154,9 @@
*
*/
void o_attrib_toggle_show_name_value(TOPLEVEL *w_current,
- SELECTION *list, int new_show_name_value)
+ GList *list, int new_show_name_value)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object = NULL;
if (list == NULL) {
@@ -166,7 +166,7 @@
s_current = list;
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object == NULL) {
fprintf(stderr, _("Got NULL in o_attrib_toggle_show_name_value\n"));
@@ -334,7 +334,7 @@
/* here is where you attach the stuff */
/* if an object is selected, else just place it */
/* selection_head should never be null since it has a head struct */
- object = o_select_return_first_object(w_current);
+ object = (OBJECT *) g_list_first (w_current->page_current->selection_list)->data;
if (object != NULL) {
/* should attribute be selected? probably */
/* this is probably okay, NEWSEL, since tail is a single obj */
@@ -344,7 +344,7 @@
object);
}
- o_selection_add(w_current->page_current->selection2_head,
+ o_selection_add(&(w_current->page_current->selection_list),
w_current->page_current->object_tail);
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -471,7 +471,7 @@
o_current);
}
- o_selection_add(w_current->page_current->selection2_head,
+ o_selection_add(&(w_current->page_current->selection_list),
w_current->page_current->object_tail);
o_text_erase(w_current, w_current->page_current->object_tail);
1.22.4.1 +128 -130 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
retrieving revision 1.22.4.1
diff -u -b -r1.22 -r1.22.4.1
--- o_basic.c 21 Oct 2006 19:23:44 -0000 1.22
+++ o_basic.c 27 Dec 2006 17:37:56 -0000 1.22.4.1
@@ -62,7 +62,7 @@
case(ENDCOPY):
case(ENDMCOPY):
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
@@ -70,8 +70,8 @@
case(DRAWCOMP):
case(ENDCOMP):
o_drawbounding(w_current,
- w_current->page_current->complex_place_head->next,
NULL,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
@@ -106,7 +106,9 @@
x_repaint_background(w_current);
}
- o_recalc(w_current, w_current->page_current->object_head);
+ o_recalc_object_list(w_current, w_current->page_current->object_head);
+ /* Uncomment this when using the complex_place_list for moving and copying */
+ /* o_recalc_object_glist(w_current, w_current->page_current->complex_place_list); */
draw_selected = !(w_current->inside_action &&
((w_current->event_state == MOVE) ||
@@ -154,8 +156,8 @@
{
if (!w_current->SHIFTKEY) {
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current, w_current->page_current->
- selection2_head);
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
}
}
@@ -193,15 +195,15 @@
*/
void o_draw_selected(TOPLEVEL *w_current)
{
- SELECTION* s_current;
+ GList* s_current;
OBJECT* o_current;
if (w_current->inside_redraw) {
return;
}
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- o_current=s_current->selected_object;
+ o_current = (OBJECT *) s_current->data;
if (o_current) {
o_redraw_single(w_current, o_current);
@@ -219,15 +221,15 @@
*/
void o_erase_selected(TOPLEVEL *w_current)
{
- SELECTION* s_current;
+ GList* s_current;
OBJECT* o_current;
if (w_current->inside_redraw) {
return;
}
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- o_current=s_current->selected_object;
+ o_current = (OBJECT *) s_current->data;
if (o_current) {
o_cue_erase_single(w_current, o_current);
@@ -273,7 +275,7 @@
*/
/* both outline and boundingbox work! */
/* name is blah */
-void o_drawbounding(TOPLEVEL *w_current, OBJECT *o_list, SELECTION *s_list,
+void o_drawbounding(TOPLEVEL *w_current, OBJECT *o_list, GList *o_glist,
GdkColor *color, int firsttime)
{
int diff_x, diff_y;
@@ -283,7 +285,7 @@
/* you have to make these static... for the once mode */
static int rleft, rtop, rbottom, rright;
- if (!o_list && !s_list) {
+ if (!o_list && !o_glist) {
return;
}
@@ -304,29 +306,25 @@
diff_x,
diff_y,
o_list);
- } else if (s_list) {
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current, diff_x, diff_y, o_glist);
}
gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
&rbottom);
}
-
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
rleft + diff_x,
@@ -343,13 +341,13 @@
#endif
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
@@ -373,12 +371,11 @@
diff_x,
diff_y,
o_list);
- } else if (s_list) {
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
}
+
}
w_current->last_drawb_mode = w_current->actionfeedback_mode;
@@ -406,21 +403,20 @@
diff_x,
diff_y,
o_list);
- } else if (s_list) {
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
}
+
} else {
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
@@ -454,26 +450,26 @@
diff_x,
diff_y,
o_list);
- } else if (s_list) {
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
}
+
} else {
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
&rbottom);
}
+
gdk_gc_set_foreground(w_current->bounding_xor_gc,
color);
gdk_draw_rectangle(w_current->window,
@@ -512,32 +508,30 @@
diff_x,
diff_y,
o_list);
- } else if (s_list) {
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
- o_complex_translate_display_selection(w_current,
- diff_x,
- diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
}
+
} else {
/*! \todo why are we doing this here...?
* probably a reason */
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
&rbottom);
}
+
}
if (w_current->netconn_rubberband) {
o_move_stretch_rubberband(w_current);
@@ -559,18 +553,19 @@
if (firsttime == TRUE) {
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
- } else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ } else if (o_glist) {
+ get_object_glist_bounds(w_current, o_glist,
&rleft ,
&rtop ,
&rright ,
&rbottom);
}
+
/*printf("once\n");*/
}
@@ -595,9 +590,9 @@
*/
if (o_list) {
o_complex_translate2(w_current, diff_x, diff_y, o_list);
- } else if (s_list) {
- o_complex_translate_selection(w_current, diff_x, diff_y,
- s_list);
+ } else if (o_glist) {
+ o_complex_translate_display_object_glist(w_current,
+ diff_x, diff_y, o_glist);
}
}
@@ -606,12 +601,12 @@
* \par Function Description
*
*/
-void o_erasebounding(TOPLEVEL *w_current, OBJECT *o_list, SELECTION *s_list)
+void o_erasebounding(TOPLEVEL *w_current, OBJECT *o_list, GList *s_list)
{
int diff_x, diff_y;
int rleft, rtop, rright, rbottom;
- if (o_list == NULL) {
+ if ( (o_list == NULL) && (s_list == NULL)) {
/* this is an error condition */
w_current->event_state = SELECT;
w_current->inside_action = 0;
@@ -623,13 +618,13 @@
}
if (o_list) {
- get_complex_bounds(w_current, o_list,
+ get_object_list_bounds(w_current, o_list,
&rleft ,
&rtop ,
&rright ,
&rbottom);
} else if (s_list) {
- get_complex_bounds_selection(w_current, s_list,
+ get_object_glist_bounds(w_current, s_list,
&rleft ,
&rtop ,
&rright ,
@@ -764,8 +759,11 @@
* so lets be sure to clean up the complex_place_head
* structure and also clean up the attrib_place_head.
* remember these don't remove the head structure */
- o_list_delete_rest(w_current,
- w_current->page_current->complex_place_head);
+ /* The complex place is a reference to the real objects, so don't
+ free the objects here */
+ g_list_free (w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
+
o_list_delete_rest(w_current,
w_current->page_current->attrib_place_head);
1.8.6.1 +11 -13 eda/geda/gaf/gschem/src/o_buffer.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_buffer.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_buffer.c,v
retrieving revision 1.8
retrieving revision 1.8.6.1
diff -u -b -r1.8 -r1.8.6.1
--- o_buffer.c 21 Oct 2006 13:56:24 -0000 1.8
+++ o_buffer.c 27 Dec 2006 17:37:56 -0000 1.8.6.1
@@ -35,14 +35,14 @@
*/
void o_buffer_copy(TOPLEVEL *w_current, int buf_num)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
if (buf_num < 0 || buf_num > MAX_BUFFERS) {
fprintf(stderr, _("Got an invalid buffer_number [o_buffer_copy]\n"));
return;
}
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
if (object_buffer[buf_num] == NULL) {
object_buffer[buf_num] = s_basic_init_object("buffer0_head");
@@ -73,14 +73,14 @@
*/
void o_buffer_cut(TOPLEVEL *w_current, int buf_num)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
if (buf_num < 0 || buf_num > MAX_BUFFERS) {
fprintf(stderr, _("Got an invalid buffer_number [o_buffer_cut]\n"));
return;
}
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
if (object_buffer[buf_num] == NULL) {
object_buffer[buf_num] = s_basic_init_object("buffer0_head");
@@ -165,7 +165,7 @@
int w_diff_x, w_diff_y;
OBJECT *o_current;
OBJECT *o_saved;
- SELECTION *temp_list;
+ GList *temp_list;
PAGE *p_current;
GList *connected_objects = NULL;
@@ -205,11 +205,11 @@
p_current->object_tail = return_tail(p_current->object_head);
o_current = o_saved->next;
- temp_list = o_selection_new_head();
+ temp_list = NULL;
/* now add new objects to the selection list */
while (o_current != NULL) {
- o_selection_add(temp_list, o_current);
+ o_selection_add(&temp_list, o_current);
s_conn_update_object(w_current, o_current);
if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PLACEHOLDER) {
connected_objects = s_conn_return_complex_others(
@@ -229,12 +229,10 @@
connected_objects = NULL;
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
- o_selection_destroy_head(w_current->page_current->selection2_head);
- w_current->page_current->selection2_head = temp_list;
- w_current->page_current->selection2_tail = o_selection_return_tail(
- temp_list);
+
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
+ w_current->page_current->selection_list = temp_list;
w_current->page_current->CHANGED = 1;
o_redraw(w_current, o_saved->next, TRUE); /* only redraw new objects */
1.21.6.1 +1 -1 eda/geda/gaf/gschem/src/o_bus.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_bus.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_bus.c,v
retrieving revision 1.21
retrieving revision 1.21.6.1
diff -u -b -r1.21 -r1.21.6.1
--- o_bus.c 21 Oct 2006 13:56:24 -0000 1.21
+++ o_bus.c 27 Dec 2006 17:37:56 -0000 1.21.6.1
@@ -270,7 +270,7 @@
#if 0 /* not ready for prime time use */
/* new bus extenstion stuff */
- o_current = w_current->page_current->selection_head->next;
+ o_current = w_current->page_current->selection_list;
if (o_current != NULL && w_current->event_state == STARTDRAWNET) {
if (o_current->type == OBJ_BUS) {
if (o_current->line) {
1.28.6.1 +99 -108 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
retrieving revision 1.28.6.1
diff -u -b -r1.28 -r1.28.6.1
--- o_complex.c 21 Oct 2006 13:56:25 -0000 1.28
+++ o_complex.c 27 Dec 2006 17:37:56 -0000 1.28.6.1
@@ -42,11 +42,15 @@
{
int left, right, top, bottom;
+ g_return_if_fail (o_current != NULL);
+ g_return_if_fail (o_current->complex != NULL);
+ g_return_if_fail (o_current->complex->prim_objs != NULL);
+
if (!w_current->DONT_REDRAW) {
o_redraw(w_current, o_current->complex->prim_objs, TRUE);
}
- get_complex_bounds(w_current, o_current->complex->prim_objs,
+ get_object_list_bounds(w_current, o_current->complex->prim_objs,
&left, &top, &right, &bottom);
o_current->left = left;
o_current->top = top;
@@ -154,10 +158,8 @@
w_current->DONT_DRAW_CONN = 1;
w_current->ADDING_SEL = 1; /* reuse this flag, rename later hack */
- w_current->page_current->complex_place_tail =
- (OBJECT *) o_complex_add(
- w_current,
- w_current->page_current->complex_place_head,
+ o_complex_add(w_current, NULL,
+ &(w_current->page_current->complex_place_list),
OBJ_COMPLEX, WHITE, x, y, 0, 0,
w_current->internal_clib,
w_current->internal_basename, 1, TRUE);
@@ -172,8 +174,8 @@
}
o_drawbounding(w_current,
- w_current->page_current->complex_place_head->next,
NULL,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
@@ -185,19 +187,21 @@
void o_complex_place_rotate(TOPLEVEL *w_current)
{
OBJECT *o_current;
+ GList *ptr;
int screen_x_local = -1;
int screen_y_local = -1;
int new_angle;
- o_current = w_current->page_current->complex_place_head->next;
- while(o_current) {
+ ptr = w_current->page_current->complex_place_list;
+ while(ptr) {
+ o_current = (OBJECT *) ptr->data;
switch(o_current->type) {
case(OBJ_COMPLEX):
screen_x_local = o_current->complex->screen_x;
screen_y_local = o_current->complex->screen_y;
break;
}
- o_current = o_current->next;
+ ptr = ptr->next;
}
if (screen_x_local == -1) {
@@ -205,8 +209,9 @@
return;
}
- o_current = w_current->page_current->complex_place_head->next;
- while(o_current) {
+ ptr = w_current->page_current->complex_place_list;
+ while(ptr) {
+ o_current = (OBJECT *) ptr->data;
switch(o_current->type) {
case(OBJ_TEXT):
@@ -222,7 +227,7 @@
break;
}
- o_current = o_current->next;
+ ptr = ptr->next;
}
}
@@ -298,19 +303,18 @@
printf("inside draw outline here\n");
#endif
/* erase outline */
- o_complex_translate_display(
- w_current,
+
+ o_complex_translate_display_object_glist(w_current,
diff_x, diff_y,
w_current->page_current->
- complex_place_head->next);
+ complex_place_list);
} else {
#if 0
printf("inside draw bounding here\n");
#endif
- get_complex_bounds(
- w_current,
+ get_object_glist_bounds(w_current,
w_current->page_current->
- complex_place_head->next,
+ complex_place_list,
&rleft, &rtop, &rright, &rbottom);
gdk_gc_set_foreground(
w_current->gc,
@@ -327,16 +331,15 @@
w_current->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
- o_list_delete_rest(w_current, w_current->page_current->
- complex_place_head);
+ s_delete_object_glist(w_current, w_current->page_current->
+ complex_place_list);
return;
}
o_temp = w_current->page_current->object_tail;
w_current->page_current->object_tail =
- o_complex_add(
- w_current,
- w_current->page_current->object_tail,
+ o_complex_add(w_current,
+ w_current->page_current->object_tail, NULL,
OBJ_COMPLEX, WHITE, x, y, w_current->complex_rotate, 0,
w_current->internal_clib,
w_current->internal_basename, 1, TRUE);
@@ -361,7 +364,6 @@
}
/* 1 should be define fix everywhere hack */
-
o_current = w_current->page_current->object_tail;
if (scm_hook_empty_p(add_component_hook) == SCM_BOOL_F &&
@@ -403,17 +405,15 @@
printf("inside draw outline here\n");
#endif
/* erase outline */
- o_complex_translate_display(
- w_current,
+ o_complex_translate_display_object_glist(w_current,
diff_x, diff_y,
- w_current->page_current->complex_place_head->next);
+ w_current->page_current->complex_place_list);
} else {
#if 0
printf("inside draw bounding here\n");
#endif
- get_complex_bounds(
- w_current,
- w_current->page_current->complex_place_head->next,
+ get_object_glist_bounds(w_current,
+ w_current->page_current->complex_place_list,
&rleft, &rtop,
&rright, &rbottom);
gdk_gc_set_foreground(
@@ -428,19 +428,19 @@
/*! \todo redraw has to happen at the end of all this hack or
* maybe not? */
- o_list_delete_rest(w_current,
- w_current->page_current->complex_place_head);
+ g_list_free(w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
/* This doesn't allow anything else to be in the selection
* list when you add a component */
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
- o_selection_add(w_current->page_current->selection2_head,
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
+ o_selection_add(&(w_current->page_current->selection_list),
w_current->page_current->object_tail);
/* the o_redraw_selected is in x_events.c after this call
* returns */
- o_attrib_add_selected(w_current, w_current->page_current->selection2_head,
+ o_attrib_add_selected(w_current, &(w_current->page_current->selection_list),
w_current->page_current->object_tail);
s_conn_update_complex(w_current, o_current->complex->prim_objs);
@@ -464,8 +464,8 @@
void o_complex_rubbercomplex(TOPLEVEL *w_current)
{
o_drawbounding(w_current,
- w_current->page_current->complex_place_head->next,
NULL,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
}
@@ -474,12 +474,11 @@
* \par Function Description
*
*/
-void o_complex_translate_display(TOPLEVEL *w_current,
- int x1, int y1, OBJECT *complex)
+void
+o_complex_translate_display_single_object(TOPLEVEL *w_current,
+ int x1, int y1, OBJECT *o_current)
{
- OBJECT *o_current = complex;
-
- while (o_current != NULL) {
+ if (o_current != NULL) {
switch(o_current->type) {
case(OBJ_LINE):
o_line_draw_xor(w_current, x1, y1, o_current);
@@ -523,6 +522,41 @@
o_arc_draw_xor(w_current, x1, y1, o_current);
break;
}
+ }
+}
+
+/*! \todo Finish function documentation!!!
+ * \brief
+ * \par Function Description
+ *
+ */
+void
+o_complex_translate_display_object_glist(TOPLEVEL *w_current,
+ int x1, int y1, GList *object_list)
+{
+ GList *ptr = object_list;
+
+ while (ptr != NULL) {
+ o_complex_translate_display_single_object (w_current, x1, y1,
+ (OBJECT *)ptr->data);
+ ptr = ptr->next;
+ }
+}
+
+
+/*! \todo Finish function documentation!!!
+ * \brief
+ * \par Function Description
+ *
+ */
+void
+o_complex_translate_display(TOPLEVEL *w_current,
+ int x1, int y1, OBJECT *complex)
+{
+ OBJECT *o_current = complex;
+
+ while (o_current != NULL) {
+ o_complex_translate_display_single_object (w_current, x1, y1, o_current);
o_current = o_current->next;
}
}
@@ -533,63 +567,20 @@
*
*/
void o_complex_translate_display_selection(TOPLEVEL *w_current,
- int x1, int y1, SELECTION *head)
+ int x1, int y1, GList *head)
{
- SELECTION *s_current = head;
+ GList *s_current = head;
OBJECT *o_current;
while (s_current != NULL) {
- o_current = s_current->selected_object;
+ o_current = (OBJECT *) s_current->data;
if (!o_current) {
fprintf(stderr, _("Got NULL in o_complex_translate_display_selection\n"));
exit(-1);
}
-
- switch(o_current->type) {
- case(OBJ_LINE):
- o_line_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_NET):
- o_net_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_BUS):
- o_bus_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_BOX):
- o_box_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_PICTURE):
- o_picture_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_CIRCLE):
- o_circle_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_COMPLEX):
- case(OBJ_PLACEHOLDER):
- o_complex_draw_xor(w_current, x1, y1,
- o_current->complex->prim_objs);
- break;
-
- case(OBJ_TEXT):
- o_text_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_PIN):
- o_pin_draw_xor(w_current, x1, y1, o_current);
- break;
-
- case(OBJ_ARC):
- o_arc_draw_xor(w_current, x1, y1, o_current);
- break;
- }
+ o_complex_translate_display_single_object (w_current, x1, y1, o_current);
s_current = s_current->next;
}
}
@@ -629,7 +620,7 @@
A_PAN_DONT_REDRAW);
o_redraw_all(w_current);
- get_complex_bounds(w_current, w_current->page_current->object_head,
+ get_object_list_bounds(w_current, w_current->page_current->object_head,
&rleft,
&rtop,
&rright,
@@ -700,7 +691,7 @@
*
*/
void o_complex_translate_selection(TOPLEVEL *w_current, int dx, int dy,
- SELECTION *head)
+ GList *head)
{
if (head == NULL) {
printf(_("Got NULL in o_complex_translate_selection!\n"));
@@ -906,7 +897,7 @@
new_obj = o_complex_add(w_current,
- list, object->type,
+ list, NULL, object->type,
color,
x, y,
object->complex->angle,
1.26.6.1 +28 -31 eda/geda/gaf/gschem/src/o_copy.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_copy.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_copy.c,v
retrieving revision 1.26
retrieving revision 1.26.6.1
diff -u -b -r1.26 -r1.26.6.1
--- o_copy.c 6 Aug 2006 16:45:29 -0000 1.26
+++ o_copy.c 27 Dec 2006 17:37:56 -0000 1.26.6.1
@@ -37,7 +37,7 @@
*/
void o_copy_start(TOPLEVEL *w_current, int x, int y)
{
- if (w_current->page_current->selection2_head->next != NULL) {
+ if (w_current->page_current->selection_list != NULL) {
/* This is commented out since it breaks the copy of objects. See below. */
#if 0
@@ -53,7 +53,7 @@
w_current->last_x = w_current->start_x = fix_x(w_current, x);
w_current->last_y = w_current->start_y = fix_y(w_current, y);
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), TRUE);
w_current->inside_action = 1;
}
@@ -66,8 +66,8 @@
*/
void o_copy_end(TOPLEVEL *w_current)
{
- SELECTION *temp_list = NULL;
- SELECTION *s_current = NULL;
+ GList *temp_list = NULL;
+ GList *s_current = NULL;
GList *new_objects = NULL;
GList *connected_objects=NULL;
OBJECT *new_object = NULL;
@@ -108,18 +108,19 @@
diff_y = ly - sy;
/* skip over head node */
- s_current = w_current->page_current->selection2_head->next;
- temp_list = o_selection_new_head();
+ s_current = w_current->page_current->selection_list;
+ temp_list = NULL;
new_objects_head = s_basic_init_object("object_head");
while(s_current != NULL) {
- if (s_current->selected_object == NULL) {
+ object = (OBJECT *) s_current->data;
+
+ if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object in o_copy_end!\n"));
exit(-1);
}
- object = s_current->selected_object;
switch(object->type) {
case(OBJ_NET):
@@ -143,7 +144,7 @@
diff_x, diff_y,
new_object);
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_net_draw(w_current, new_object);
@@ -174,7 +175,7 @@
diff_x, diff_y,
new_object);
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_pin_draw(w_current, new_object);
@@ -204,7 +205,7 @@
diff_x, diff_y,
new_object);
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_bus_draw(w_current, new_object);
@@ -244,7 +245,7 @@
diff_y,
new_object);
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
/* NEWSEL: this needs to be fixed too */
/* this may not be needed anymore? */
@@ -275,7 +276,7 @@
new_object);
w_current->ADDING_SEL=0;
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_line_draw(w_current, new_object);
break;
@@ -297,7 +298,7 @@
new_object);
w_current->ADDING_SEL=0;
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_box_draw(w_current, new_object);
@@ -320,7 +321,7 @@
new_object);
w_current->ADDING_SEL=0;
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_picture_draw(w_current, new_object);
@@ -344,7 +345,7 @@
new_object);
w_current->ADDING_SEL=0;
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_circle_draw(w_current, new_object);
break;
@@ -367,7 +368,7 @@
new_object);
w_current->ADDING_SEL=0;
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = object->saved_color;
o_arc_draw(w_current, new_object);
break;
@@ -381,15 +382,16 @@
}
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while(s_current != NULL) {
- if (s_current->selected_object == NULL) {
+ object = (OBJECT *) s_current->data;
+
+ if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object in o_copy_end!\n"));
exit(-1);
}
- object = s_current->selected_object;
switch(object->type) {
case(OBJ_TEXT):
@@ -440,7 +442,7 @@
color = object->saved_color;
}
- o_selection_add(temp_list, new_object);
+ o_selection_add(&temp_list, new_object);
new_object->saved_color = color;
/* signify that object is no longer an attribute */
@@ -506,20 +508,15 @@
/* erase the bounding box */
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
- o_selection_destroy_head(w_current->page_current->selection2_head);
- w_current->page_current->selection2_head = temp_list;
- w_current->page_current->selection2_tail = o_selection_return_tail(
- temp_list);
-#if DEBUG
- o_selection_print_all(w_current->page_current->selection2_head);
-#endif
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
+ w_current->page_current->selection_list = NULL;
+ w_current->page_current->selection_list = temp_list;
w_current->page_current->CHANGED = 1;
1.22.6.1 +8 -10 eda/geda/gaf/gschem/src/o_delete.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_delete.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_delete.c,v
retrieving revision 1.22
retrieving revision 1.22.6.1
diff -u -b -r1.22 -r1.22.6.1
--- o_delete.c 6 Aug 2006 16:45:29 -0000 1.22
+++ o_delete.c 27 Dec 2006 17:37:56 -0000 1.22.6.1
@@ -232,7 +232,7 @@
*/
void o_delete(TOPLEVEL *w_current)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object = NULL;
object = o_select_return_first_object(w_current);
@@ -245,16 +245,12 @@
/* skip over head node */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while(s_current != NULL) {
- object = s_current->selected_object;
- if (object == NULL) {
- fprintf(stderr,
- _("ERROR: NULL object in o_delete_end!\n"));
- exit(-1);
- }
+ object = (OBJECT *) s_current->data;
+ g_assert (object != NULL);
switch(object->type) {
case(OBJ_LINE):
@@ -303,8 +299,10 @@
w_current->inside_action = 0;
- o_selection_destroy_all(w_current->page_current->selection2_head);
- w_current->page_current->selection2_head = o_selection_new_head();
+ /* Objects have been deleted. Free the list, without freeing again
+ the objects */
+ g_list_free(w_current->page_current->selection_list);
+ w_current->page_current->selection_list = NULL;
w_current->page_current->CHANGED=1;
/* no longer needed */
1.4.6.1 +6 -13 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
retrieving revision 1.4.6.1
diff -u -b -r1.4 -r1.4.6.1
--- o_find.c 14 Jul 2006 02:23:55 -0000 1.4
+++ o_find.c 27 Dec 2006 17:37:56 -0000 1.4.6.1
@@ -69,7 +69,6 @@
return object_found;
}
}
-
o_current = o_current->next;
}
@@ -112,12 +111,9 @@
the caller allows it */
if (change_selection && (!w_current->SHIFTKEY)) {
-#if DEBUG
- o_selection_print_all( w_current->page_current->selection2_head);
-#endif
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
}
i_update_menus(w_current);
@@ -134,15 +130,12 @@
int screen_x, int screen_y)
{
OBJECT *o_current=NULL;
- SELECTION *s_current;
-
- g_assert (w_current->page_current->selection2_head != NULL);
+ GList *s_current;
- /* Skip the head node */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
/* do first search */
while (s_current != NULL) {
- o_current = s_current->selected_object;
+ 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)) {
1.12.6.1 +5 -6 eda/geda/gaf/gschem/src/o_grips.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_grips.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_grips.c,v
retrieving revision 1.12
retrieving revision 1.12.6.1
diff -u -b -r1.12 -r1.12.6.1
--- o_grips.c 21 Oct 2006 13:56:25 -0000 1.12
+++ o_grips.c 27 Dec 2006 17:37:56 -0000 1.12.6.1
@@ -86,7 +86,7 @@
{
OBJECT *object=NULL;
OBJECT *found=NULL;
- SELECTION *s_current;
+ GList *s_current;
int size, x2size;
if (!whichone) {
@@ -99,12 +99,11 @@
x2size = size * 2;
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
- while (s_current) {
- if (s_current->selected_object) {
- object = s_current->selected_object;
+ s_current = w_current->page_current->selection_list;
+ while (s_current != NULL) {
+ object = (OBJECT *) s_current->data;
+ if (object) {
switch(object->type) {
-
case(OBJ_ARC):
/* check the grips of the arc object */
found = o_grips_search_arc(w_current, object,
1.36.2.1 +24 -55 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
retrieving revision 1.36.2.1
diff -u -b -r1.36 -r1.36.2.1
--- o_misc.c 12 Dec 2006 18:11:39 -0000 1.36
+++ o_misc.c 27 Dec 2006 17:37:56 -0000 1.36.2.1
@@ -47,14 +47,10 @@
* \par Function Description
*
*/
-void o_edit(TOPLEVEL *w_current, SELECTION *list)
+void o_edit(TOPLEVEL *w_current, GList *list)
{
char *equal_ptr;
OBJECT *o_current;
-#if 0 /* was HAS_LIBGTKEXTRA, no longer user */
- SELECTION *s_current;
- int object_count=0;
-#endif
int num_lines = 0;
if (list == NULL) {
@@ -63,38 +59,12 @@
return;
}
- o_current = list->selected_object;
+ o_current = (OBJECT *) list->data;
if (o_current == NULL) {
fprintf(stderr, _("Got an unexpected NULL in o_edit\n"));
exit(-1);
}
-#if 0 /* was HAS_LIBGTKEXTRA, no longer used */
- /* count up how many non-text objects exist in the selection */
- /* list. Why? Because if there are multiple objects, invoke the */
- /* multi_multi_edit dialog box */
- s_current = list;
- while (s_current != NULL) {
- if (s_current->selected_object) {
- if (s_current->selected_object->type != OBJ_TEXT) {
- object_count++;
- }
- }
- s_current=s_current->next;
- }
-
- /* now decide what we want to do, either single edit or */
- /* multi multi edit */
- if (object_count == 1 && o_current->type != OBJ_TEXT) {
- x_multiattrib_open (w_current, o_current);
- return;
- } else if ( object_count > 1 ) {
- x_multiattrib_open (w_current, o_current);
- return;
- }
-#endif
-
-
/* for now deal with only the first item */
switch(o_current->type) {
@@ -155,13 +125,13 @@
void o_lock(TOPLEVEL *w_current)
{
OBJECT *object = NULL;
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object) {
/* check to see if locked_color is already being used */
if (object->locked_color == -1) {
@@ -194,12 +164,12 @@
void o_unlock(TOPLEVEL *w_current)
{
OBJECT *object = NULL;
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object) {
/* only unlock if sel_func is not set to something */
if (object->sel_func == NULL) {
@@ -232,11 +202,11 @@
* \param [in] centerx Center x coordinate of rotation.
* \param [in] centery Center y coordinate of rotation.
*/
-void o_rotate_90(TOPLEVEL *w_current, SELECTION *list,
+void o_rotate_90(TOPLEVEL *w_current, GList *list,
int centerx, int centery)
{
OBJECT *object;
- SELECTION *s_current;
+ GList *s_current;
int new_angle;
GList *other_objects=NULL;
GList *connected_objects=NULL;
@@ -252,7 +222,7 @@
s_current = list;
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (!object) {
fprintf(stderr, _("ERROR: NULL object in o_rotate_90!\n"));
@@ -501,7 +471,7 @@
an object and all its attributes (text) */
s_current = list;
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (!object) {
fprintf(stderr, _("ERROR: NULL object in o_rotate_90!\n"));
@@ -663,10 +633,10 @@
* \par Function Description
*
*/
-void o_mirror(TOPLEVEL *w_current, SELECTION *list, int centerx, int centery)
+void o_mirror(TOPLEVEL *w_current, GList *list, int centerx, int centery)
{
OBJECT *object;
- SELECTION *s_current;
+ GList *s_current;
OBJECT *o_current = NULL;
GList *other_objects=NULL;
GList *connected_objects=NULL;
@@ -681,7 +651,7 @@
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (!object) {
fprintf(stderr, _("ERROR: NULL object in o_mirror!\n"));
@@ -859,7 +829,7 @@
an object and all its attributes (text) */
s_current = list;
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (!object) {
fprintf(stderr, _("ERROR: NULL object in o_rotate_90!\n"));
@@ -1078,11 +1048,6 @@
if (o_current->type == OBJ_TEXT) {
/* replaced strcmp with strstr to simplify the search */
if (strstr(o_current->text->string,stext)) {
- /* printf(_("Found %s\n"), stext);
- if (!o_current->selected&&(!descend)) {
- o_selection_add(w_current->page_current->selection2_head,
- o_current);
- } */
if (!skiplast) {
#if 0 /* replaced by code below by avh, might not quite be right though */
@@ -1214,6 +1179,8 @@
gboolean is_embedded;
gchar *basename, *clib;
+ g_return_if_fail (o_current != NULL);
+
is_embedded = o_complex_is_embedded (o_current);
/* identify symbol name */
@@ -1246,13 +1213,14 @@
o_erase_single (w_current, o_current);
/* delete its connections */
s_conn_remove_complex (w_current, o_current);
- /* and unselect but keep it in the selection list */
- o_selection_unselect (o_current);
+ /* and unselect it */
+ o_selection_remove (&(w_current->page_current->selection_list),
+ o_current);
/* build a temporary list and add a complex to this list */
tmp_list = s_basic_init_object ("update component");
new_complex = o_complex_add (w_current,
- tmp_list,
+ tmp_list, NULL,
OBJ_COMPLEX,
WHITE,
o_current->complex->x,
@@ -1314,7 +1282,8 @@
s_delete_list_fromstart (w_current, tmp_list);
/* reconnect, re-select and redraw */
s_conn_update_complex (w_current, o_current->complex->prim_objs);
- o_selection_select (o_current, SELECT_COLOR);
+ o_selection_add (&(w_current->page_current->selection_list),
+ o_current);
o_redraw_single (w_current, o_current);
if (is_embedded) {
1.29.6.1 +19 -16 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
retrieving revision 1.29.6.1
diff -u -b -r1.29 -r1.29.6.1
--- o_move.c 6 Aug 2006 16:45:29 -0000 1.29
+++ o_move.c 27 Dec 2006 17:37:56 -0000 1.29.6.1
@@ -36,7 +36,7 @@
*/
void o_move_start(TOPLEVEL * w_current, int x, int y)
{
- if (w_current->page_current->selection2_head->next != NULL) {
+ if (w_current->page_current->selection_list != NULL) {
/* Save the current state. When rotating the selection when moving,
we have to come back to here */
@@ -50,7 +50,7 @@
o_erase_selected(w_current);
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), TRUE);
if (w_current->netconn_rubberband) {
@@ -58,6 +58,7 @@
o_move_stretch_rubberband(w_current);
}
+ o_select_move_to_place_list(w_current);
w_current->inside_action = 1;
}
}
@@ -165,7 +166,7 @@
*/
void o_move_end(TOPLEVEL * w_current)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object;
int diff_x, diff_y;
int screen_diff_x, screen_diff_y;
@@ -207,22 +208,23 @@
if (w_current->actionfeedback_mode == OUTLINE) {
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
/* skip over head node */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- if (s_current->selected_object == NULL) {
+ object = (OBJECT *) s_current->data;
+
+ if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object in o_move_end!\n"));
exit(-1);
}
- object = s_current->selected_object;
switch (object->type) {
case (OBJ_NET):
case (OBJ_PIN):
@@ -264,7 +266,7 @@
&other_objects, &connected_objects);
- get_complex_bounds(w_current, object->complex->prim_objs,
+ get_object_list_bounds(w_current, object->complex->prim_objs,
&left, &top, &right, &bottom);
object->left = left;
@@ -284,7 +286,7 @@
/* erase the bounding box */
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), FALSE);
}
@@ -313,6 +315,8 @@
g_list_free(rubbernet_other_objects);
g_list_free(rubbernet_connected_objects);
+ g_list_free(w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
}
/*! \todo Finish function documentation!!!
@@ -418,7 +422,7 @@
*/
void o_move_prep_rubberband(TOPLEVEL * w_current)
{
- SELECTION *s_current;
+ GList *s_current;
OBJECT *object;
OBJECT *o_current;
@@ -433,10 +437,9 @@
printf("\n\n\n");
#endif
- /* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object) {
switch (object->type) {
case (OBJ_NET):
1.29.6.1 +2 -1 eda/geda/gaf/gschem/src/o_net.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_net.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_net.c,v
retrieving revision 1.29
retrieving revision 1.29.6.1
diff -u -b -r1.29 -r1.29.6.1
--- o_net.c 21 Oct 2006 13:56:26 -0000 1.29
+++ o_net.c 27 Dec 2006 17:37:56 -0000 1.29.6.1
@@ -317,7 +317,7 @@
#if 0 /* not ready for prime time use */
/* new net extenstion stuff */
- o_current = w_current->page_current->selection_head->next;
+ o_current = (OBJECT *) w_current->page_current->selection_list->data;
if (o_current != NULL && w_current->event_state == STARTDRAWNET) {
if (o_current->type == OBJ_NET) {
if (o_current->line) {
@@ -1133,6 +1133,7 @@
(OBJECT *) o_complex_add(
w_current,
w_current->page_current->object_tail,
+ NULL,
OBJ_COMPLEX, WHITE,
rippers[i].x[0], rippers[i].y[0],
complex_angle, 0,
1.6.6.1 +9 -3 eda/geda/gaf/gschem/src/o_picture.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_picture.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_picture.c,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -b -r1.6 -r1.6.6.1
--- o_picture.c 21 Oct 2006 13:56:26 -0000 1.6
+++ o_picture.c 27 Dec 2006 17:37:56 -0000 1.6.6.1
@@ -178,6 +178,9 @@
gtk_window_position(GTK_WINDOW (w_current->pfswindow),
GTK_WIN_POS_NONE);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(w_current->main_window));
+
g_signal_connect (G_OBJECT (file_selector), "destroy",
G_CALLBACK (picture_selection_cancel), w_current);
@@ -737,7 +740,7 @@
const gchar *selected_filename;
GdkPixbuf *pixbuf;
GError *error;
- SELECTION *list;
+ GList *list;
selected_filename = (char *) g_strdup(gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selector)));
#if DEBUG
@@ -775,11 +778,11 @@
w_current->inside_action = 0;
- list = w_current->page_current->selection2_head->next;
+ list = w_current->page_current->selection_list;
while (list != NULL) {
OBJECT *object;
- object = list->selected_object;
+ object = (OBJECT *) list->data;
if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object!\n"));
exit(-1);
@@ -851,6 +854,9 @@
gtk_window_position(GTK_WINDOW(w_current->pcfswindow),
GTK_WIN_POS_NONE);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(w_current->main_window));
+
g_signal_connect (G_OBJECT(file_selector), "destroy",
G_CALLBACK(picture_change_selection_cancel),
w_current);
1.5.6.1 +52 -34 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
retrieving revision 1.5.6.1
diff -u -b -r1.5 -r1.5.6.1
--- o_select.c 21 Oct 2006 13:56:26 -0000 1.5
+++ o_select.c 27 Dec 2006 17:37:56 -0000 1.5.6.1
@@ -162,8 +162,8 @@
/* result: remove all objects from selection */
if (count == 0 && !CONTROLKEY) {
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
}
break;
@@ -171,7 +171,7 @@
/* object not select, add it to the selection list */
o_select_run_hooks(w_current, o_current, 1);
- o_selection_add(w_current->page_current->selection2_head,
+ o_selection_add(&(w_current->page_current->selection_list),
o_current);
break;
@@ -187,8 +187,7 @@
/* result: remove object from selection */
if (type != MULTIPLE) {
o_select_run_hooks(w_current, o_current, 0);
- o_selection_remove(
- w_current->page_current->selection2_head,
+ o_selection_remove(&(w_current->page_current->selection_list),
o_current);
}
@@ -203,12 +202,11 @@
/* 2nd result: add object to selection */
if (type == MULTIPLE && count == 0 && !CONTROLKEY) {
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
o_select_run_hooks(w_current, o_current, 1);
- o_selection_add(
- w_current->page_current->selection2_head,
+ o_selection_add(&(w_current->page_current->selection_list),
o_current);
}
@@ -218,19 +216,17 @@
/* 2nd result: add object to selection list */
if (type == SINGLE && !CONTROLKEY) {
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
o_select_run_hooks (w_current, o_current, 1);
- o_selection_add(
- w_current->page_current->selection2_head,
+ o_selection_add(&(w_current->page_current->selection_list),
o_current);
}
if (CONTROLKEY) {
o_select_run_hooks(w_current, o_current, 0);
- o_selection_remove(
- w_current->page_current->selection2_head,
+ o_selection_remove(&(w_current->page_current->selection_list),
o_current);
}
@@ -240,7 +236,7 @@
}
/* do the attributes */
- o_attrib_add_selected(w_current, w_current->page_current->selection2_head,
+ o_attrib_add_selected(w_current, &(w_current->page_current->selection_list),
o_current);
/* finally redraw object */
@@ -436,8 +432,8 @@
/* key was pressed */
if (count == 0 && !SHIFTKEY) {
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
}
i_update_menus(w_current);
}
@@ -446,8 +442,10 @@
/* This function always looks at the current page selection list */
OBJECT *o_select_return_first_object(TOPLEVEL *w_current)
{
- return(o_selection_return_first_object(w_current->page_current->
- selection2_head));
+ if (! (w_current && w_current->page_current && w_current->page_current->selection_list))
+ return NULL;
+ else
+ return((OBJECT *) g_list_first(w_current->page_current->selection_list)->data);
}
/*! \todo Finish function documentation!!!
@@ -459,16 +457,9 @@
*/
int o_select_selected(TOPLEVEL *w_current)
{
- SELECTION *head;
-
- head = w_current->page_current->selection2_head;
- if (head) {
- if (head->next) {
- if (head->next->selected_object) {
+ if (w_current->page_current->selection_list) {
return(TRUE);
}
- }
- }
return(FALSE);
}
@@ -480,6 +471,33 @@
void o_select_unselect_all(TOPLEVEL *w_current)
{
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
+ o_selection_unselect_list (w_current,
+ &(w_current->page_current->selection_list));
+}
+
+/*! \todo Finish function documentation!!!
+ * \brief
+ * \par Function Description
+ *
+ */
+void
+o_select_move_to_place_list(TOPLEVEL *w_current)
+{
+ GList *selection;
+ OBJECT *o_current;
+
+ selection= w_current->page_current->selection_list;
+
+ if (!selection) {
+ return;
+ }
+
+ while (selection) {
+ o_current = (OBJECT *) selection->data;
+ if (o_current) {
+ w_current->page_current->complex_place_list = g_list_append(w_current->page_current->complex_place_list,
+ o_current);
+ }
+ selection = selection->next;
+ }
}
1.21.2.1 +1 -1 eda/geda/gaf/gschem/src/o_slot.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_slot.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_slot.c,v
retrieving revision 1.21
retrieving revision 1.21.2.1
diff -u -b -r1.21 -r1.21.2.1
--- o_slot.c 12 Dec 2006 18:11:39 -0000 1.21
+++ o_slot.c 27 Dec 2006 17:37:56 -0000 1.21.2.1
@@ -232,7 +232,7 @@
o_erase_selected(w_current);
o_attrib_slot_copy(w_current, object,
- w_current->page_current->selection_head->next);
+ w_current->page_current->selection_list);
o_redraw_single(w_current,object);
#endif
1.25.2.1 +10 -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
retrieving revision 1.25.2.1
diff -u -b -r1.25 -r1.25.2.1
--- o_text.c 7 Nov 2006 20:10:24 -0000 1.25
+++ o_text.c 27 Dec 2006 17:37:56 -0000 1.25.2.1
@@ -62,7 +62,7 @@
o_redraw(w_current, o_current->text->prim_objs, TRUE);
- get_complex_bounds(w_current, o_current->text->prim_objs,
+ get_object_list_bounds(w_current, o_current->text->prim_objs,
&left, &top, &right, &bottom);
o_current->left = left;
o_current->top = top;
@@ -580,9 +580,9 @@
w_current->page_current->CHANGED=1;
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->selection2_head);
- o_selection_add(w_current->page_current->selection2_head,
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
+ o_selection_add(&(w_current->page_current->selection_list),
w_current->page_current->object_tail);
@@ -635,15 +635,15 @@
int text_alignment)
{
OBJECT *object;
- SELECTION *s_current;
+ GList *s_current;
int numselect;
/* skip over head */
- s_current = w_current->page_current->selection2_head->next;
- numselect = o_selection_return_num(w_current->page_current->selection2_head);
+ s_current = w_current->page_current->selection_list;
+ numselect = g_list_length(w_current->page_current->selection_list);
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object) {
if (object->type == OBJ_TEXT) {
1.5.6.1 +11 -9 eda/geda/gaf/gschem/src/x_attribedit.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_attribedit.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_attribedit.c,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -b -r1.5 -r1.5.6.1
--- x_attribedit.c 21 Oct 2006 01:46:29 -0000 1.5
+++ x_attribedit.c 27 Dec 2006 17:37:56 -0000 1.5.6.1
@@ -93,7 +93,7 @@
GtkWidget *overwritebutton;
OBJECT *attribptr;
OBJECT *object;
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
ATTRIB *a_current = NULL, *a_sav;
int vis, show;
int invocation_flag;
@@ -146,19 +146,19 @@
int world_x, world_y;
OBJECT *new = NULL;
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *)s_current->data;
if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object!\n"));
exit(-1);
}
- if (!s_current->selected_object->attached_to) {
+ if (!object->attached_to) {
nsel++;
}
s_current = s_current->next;
}
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
if (nsel > 1) {
addtoallbutton =
@@ -196,7 +196,7 @@
while (s_current != NULL) {
gboolean replaced;
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object && !object->attached_to && object->type != OBJ_TEXT ) {
addmask = 4;
if (object->type == OBJ_COMPLEX || object->type == OBJ_PLACEHOLDER) {
@@ -338,7 +338,7 @@
GtkWidget *overwritebutton;
/* gschem specific */
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
GList *combo_items = NULL;
char* string = NULL;
int nsel=0, i, len;
@@ -351,9 +351,9 @@
return;
/* gschem specific */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while (s_current != NULL) {
- if (!s_current->selected_object->attached_to) {
+ if (!((OBJECT *) s_current->data)->attached_to) {
nsel++;
}
s_current = s_current->next;
@@ -363,6 +363,8 @@
gtk_window_set_title (GTK_WINDOW (aewindow), _("Single Attribute Editor"));
gtk_window_set_position (GTK_WINDOW (aewindow), GTK_WIN_POS_MOUSE);
gtk_window_set_modal (GTK_WINDOW (aewindow), TRUE);
+ gtk_window_set_transient_for(GTK_WINDOW(aewindow),
+ GTK_WINDOW(w_current->main_window));
table1 = gtk_table_new (3, 1, FALSE);
gtk_widget_ref (table1);
1.2.2.1 +8 -6 eda/geda/gaf/gschem/src/x_autonumber.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_autonumber.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_autonumber.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -b -r1.2 -r1.2.2.1
--- x_autonumber.c 12 Dec 2006 18:11:39 -0000 1.2
+++ x_autonumber.c 27 Dec 2006 17:37:56 -0000 1.2.2.1
@@ -345,11 +345,11 @@
isnumbered = 0;
}
else {
- if (!isdigit(o_current->text->string[len])) /* has at least one digit */
+ if (!isdigit( (int) (o_current->text->string[len]) )) /* has at least one digit */
return AUTONUMBER_IGNORE;
for (i=len+1; o_current->text->string[i]; i++) /* and only digits */
- if (!isdigit(o_current->text->string[i]))
+ if (!isdigit( (int) (o_current->text->string[i]) ))
return AUTONUMBER_IGNORE;
}
@@ -582,7 +582,8 @@
if (slot_str != NULL && o_slot != NULL) {
g_free(slot_str);
/* delete the slot attribute */
- o_selection_remove (autotext->toplevel->page_current->selection2_head, o_slot);
+ o_selection_remove (&(autotext->toplevel->page_current->selection_list),
+ o_slot);
o_delete_text (autotext->toplevel, o_slot);
/* redraw the slotted object. So that the pinnumbers appear as with slot=1 */
/* --> No: should be done by o_delete_text as several dialog use it. */
@@ -688,7 +689,7 @@
in the searchtext list */
if (strlen(scope_text) == 0) {
- s_log_message(_("No searchstring given in autonumber text."));
+ s_log_message(_("No searchstring given in autonumber text.\n"));
return; /* error */
}
else if (g_str_has_suffix(scope_text,"?") == TRUE) {
@@ -715,7 +716,7 @@
for (i = strlen(o_current->text->string)-1;
(i >= strlen(searchtext))
&& (o_current->text->string[i] == '?'
- || isdigit(o_current->text->string[i]));
+ || isdigit( (int) (o_current->text->string[i]) ));
i--)
; /* void */
@@ -1079,7 +1080,8 @@
/* Search text history */
widget = lookup_widget(autotext->dialog, "scope_text");
- text=gtk_combo_box_get_active_text( GTK_COMBO_BOX(widget) );
+ widget = gtk_bin_get_child(GTK_BIN(widget));
+ text = g_strdup(gtk_entry_get_text( GTK_ENTRY(widget)));
autotext->scope_text=autonumber_history_add(autotext->scope_text, text);
1.11.2.1 +10 -7 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
retrieving revision 1.11.2.1
diff -u -b -r1.11 -r1.11.2.1
--- x_compselect.c 9 Dec 2006 19:03:12 -0000 1.11
+++ x_compselect.c 27 Dec 2006 17:37:56 -0000 1.11.2.1
@@ -133,13 +133,14 @@
diff_x = toplevel->last_x - toplevel->start_x;
diff_y = toplevel->last_y - toplevel->start_y;
- o_complex_translate_display(toplevel,
+ o_complex_translate_display_object_glist(toplevel,
diff_x, diff_y,
- toplevel->page_current->complex_place_head);
+ toplevel->page_current->complex_place_list);
}
- o_list_delete_rest(toplevel,
- toplevel->page_current->complex_place_head);
+ g_list_free(toplevel->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list = NULL;
+
o_complex_set_filename(toplevel, toplevel->current_clib,
toplevel->current_basename);
@@ -186,8 +187,10 @@
gtk_widget_show (toplevel->cswindow);
} else {
- gdk_window_raise (toplevel->cswindow->window);
+ gtk_window_present (GTK_WINDOW(toplevel->cswindow));
}
+ gtk_editable_select_region(GTK_EDITABLE(COMPSELECT(toplevel->cswindow)->entry_filter), 0, -1);
+ gtk_widget_grab_focus (GTK_WIDGET(COMPSELECT(toplevel->cswindow)->entry_filter));
}
/*! \brief Closes the component selection dialog.
1.68.2.1 +783 -1170 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
retrieving revision 1.68.2.1
diff -u -b -r1.68 -r1.68.2.1
--- x_dialog.c 12 Dec 2006 18:11:40 -0000 1.68
+++ x_dialog.c 27 Dec 2006 17:37:56 -0000 1.68.2.1
@@ -42,10 +42,6 @@
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
-#define DIALOG_BORDER_SPACING 10
-#define DIALOG_ELEMENT_SPACING 10
-
-
static GtkWidget* create_menu_linetype (TOPLEVEL *w_current);
static gint line_type_dialog_linetype_change (GtkWidget *w, gpointer data);
static void line_type_dialog_ok (GtkWidget *w, gpointer data);
@@ -90,26 +86,10 @@
}
/***************** Start of Text Input dialog box *********************/
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int text_input_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- text_input_dialog_close(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief worker function for the text entry dialog
* \par Function Description
- *
+ * This function applies the text from the text entry dialog.
*/
void text_input_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
{
@@ -145,92 +125,84 @@
break;
}
- o_attrib_set_string(w_current, string);
- w_current->page_current->CHANGED=1;
- gtk_text_buffer_set_text(textbuffer, w_current->current_attribute, -1);
+ /* select the text, so you can continue immediatly writing the next text */
select_all_text_in_textview(GTK_TEXT_VIEW(tientry));
gtk_widget_grab_focus(tientry);
+ o_attrib_set_string(w_current, string);
+ w_current->page_current->CHANGED=1;
w_current->event_state = DRAWTEXT;
w_current->inside_action = 1;
}
-
-#if 0
- gtk_grab_remove(w_current->tiwindow);
- gtk_widget_destroy(w_current->tiwindow);
- w_current->tiwindow = NULL;
-#endif
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief response function for the text entry dialog
* \par Function Description
- *
+ * Callback function for the text entry dialog.
*/
-void text_input_dialog_close(GtkWidget *w, TOPLEVEL *w_current)
+void text_input_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
{
+ switch(response) {
+ case GTK_RESPONSE_ACCEPT:
+ text_input_dialog_apply(widget, w_current);
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
-#if 0
- gtk_grab_remove(w_current->tiwindow);
-#endif
gtk_widget_destroy(w_current->tiwindow);
w_current->tiwindow=NULL;
+ break;
+ default:
+ printf("text_edit_dialog_response(): strange signal %d\n", response);
+ }
}
-/*! \todo Finish function documentation!!!
- * \brief
+
+/*! \brief create or present the text entry dialog
* \par Function Description
- *
+ * This function creates or raises the modal text entry dialog
*/
void text_input_dialog (TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *tientry = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttoncancel = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
GtkWidget *viewport1 = NULL;
GtkWidget *scrolled_window = NULL;
PangoTabArray *tab_array;
int real_tab_width;
- if (!w_current->tiwindow) {
- w_current->tiwindow = x_create_dialog_box(&vbox, &action_area);
-
-#if 0
- gtk_window_position(GTK_WINDOW (w_current->tiwindow),
- GTK_WIN_POS_MOUSE);
-#endif
-
- /*gtk_widget_set_usize(w_current->tiwindow, 400,130); no longer fixed size*/
+ if (!w_current->tiwindow) { /* dialog not created yet */
+ w_current->tiwindow = gtk_dialog_new_with_buttons(_("Text Entry..."),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* NON_MODAL */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_APPLY,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
gtk_window_position(GTK_WINDOW (w_current->tiwindow),
GTK_WIN_POS_NONE);
- gtk_signal_connect(GTK_OBJECT (w_current->tiwindow),
- "destroy", GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tiwindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tiwindow),
- "key_press_event",
- (GtkSignalFunc) text_input_dialog_keypress, w_current);
+ gtk_signal_connect(GTK_OBJECT (w_current->tiwindow), "response",
+ GTK_SIGNAL_FUNC(text_input_dialog_response),
+ w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT (w_current->tiwindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tiwindow);
-#endif
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tiwindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW (w_current->tiwindow),
- _("Text Entry..."));
- gtk_container_border_width(
- GTK_CONTAINER (w_current->tiwindow), 5);
-
- label = gtk_label_new (_("Enter text, click apply,\nmove cursor into window, click to place text.\nMiddle button to rotate while placing."));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 5);
- gtk_widget_show (label);
+ gtk_container_border_width(GTK_CONTAINER (w_current->tiwindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->tiwindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox),DIALOG_V_SPACING);
+
+ label = gtk_label_new (_("Enter text, click apply,\n"
+ "move cursor into window, click to place text.\n"
+ "Middle button to rotate while placing."));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
viewport1 = gtk_viewport_new (NULL, NULL);
gtk_widget_show (viewport1);
@@ -240,8 +212,7 @@
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (viewport1), scrolled_window);
- gtk_box_pack_start( GTK_BOX(vbox), viewport1, TRUE, TRUE, 10);
- gtk_widget_show(scrolled_window);
+ gtk_box_pack_start( GTK_BOX(vbox), viewport1, TRUE, TRUE, 0);
tientry = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(tientry), TRUE);
@@ -264,42 +235,19 @@
pango_tab_array_free (tab_array);
gtk_container_add(GTK_CONTAINER(scrolled_window), tientry);
- gtk_widget_show(tientry);
- gtk_widget_grab_focus(tientry);
gtk_object_set_data(GTK_OBJECT(w_current->tiwindow),
"tientry",tientry);
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (buttoncancel), "clicked",
- GTK_SIGNAL_FUNC(text_input_dialog_close),
- w_current);
- gtk_widget_show (buttoncancel);
-
- buttonok = gtk_button_new_from_stock (GTK_STOCK_APPLY);
- GTK_WIDGET_SET_FLAGS (buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonok), "clicked",
- GTK_SIGNAL_FUNC(text_input_dialog_apply),
- w_current);
- gtk_widget_show (buttonok);
- gtk_widget_grab_default (buttonok);
-
+ gtk_widget_show_all (w_current->tiwindow);
}
-
- if (!GTK_WIDGET_VISIBLE (w_current->tiwindow)) {
- gtk_widget_show (w_current->tiwindow);
-#if 0
- gtk_grab_add (w_current->tiwindow);
-#endif
- } else {
- gdk_window_raise(w_current->tiwindow->window);
+ else { /* dialog already created */
+ gtk_window_present (GTK_WINDOW(w_current->tiwindow));
}
+
+ /* always select the text in the entry */
+ tientry = gtk_object_get_data(GTK_OBJECT(w_current->tiwindow),"tientry");
+ select_all_text_in_textview(GTK_TEXT_VIEW(tientry));
+ gtk_widget_grab_focus(tientry);
}
/***************** End of Text Input dialog box ***********************/
@@ -448,7 +396,6 @@
* \par Function Description
* This function applies the user settings to the selected text objects
* and closes the dialog
- * \todo Check why we have no color attribute in that dialog
*/
void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
{
@@ -462,7 +409,7 @@
GtkTextIter start, end;
GtkWidget *widget;
- num_selected = o_selection_return_num(w_current->page_current->selection2_head);
+ num_selected = g_list_length(w_current->page_current->selection_list);
/* text string entry will only show up if one object is selected */
if (num_selected == 1) {
@@ -490,63 +437,52 @@
new_text_alignment = w_current->text_alignment;
o_text_edit_end(w_current, text_string, len, text_size, new_text_alignment);
-
- i_set_state(w_current, SELECT);
- i_update_toolbar(w_current);
- gtk_widget_destroy(w_current->tewindow);
- w_current->tewindow = NULL;
-}
-
-/*!
- * \brief Cancel function for the text property dialog
- * \par Function Description
- * Just close the dialog and clean up.
- * \todo join the function into text_edit_dialog_response()
- */
-void text_edit_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
-{
- i_set_state(w_current, SELECT);
- i_update_toolbar(w_current);
- gtk_widget_destroy(w_current->tewindow);
- w_current->tewindow = NULL;
}
/*! \brief Response function for the text property dialog
* \par Function Description
* This function receives the user response of the text property dialog.
- * The response is either <b>OK</b> or <b>Cancel</b>
+ * The response is either <b>OK</b>, <b>Cancel</b> or delete.
*
*/
void text_edit_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
{
switch(response) {
- case GTK_RESPONSE_REJECT:
- case GTK_RESPONSE_DELETE_EVENT:
- text_edit_dialog_cancel(widget, w_current);
- break;
case GTK_RESPONSE_ACCEPT:
text_edit_dialog_ok(widget, w_current);
break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
default:
printf("text_edit_dialog_response(): strange signal %d\n", response);
}
+ /* clean up */
+ i_set_state(w_current, SELECT);
+ i_update_toolbar(w_current);
+ gtk_widget_destroy(w_current->tewindow);
+ w_current->tewindow = NULL;
}
/*! \brief Create the edit text properties dialog
* \par Function Description
* This Function creates the dialog to edit text properties.
* \todo Check why there's no color in the calling parameters
+ * \todo If more than one text element is selected, add an unchanged option
*/
void text_edit_dialog (TOPLEVEL *w_current, char *string, int text_size,
int text_alignment)
{
GtkWidget *label = NULL;
+ GtkWidget *table;
GtkWidget *vbox;
GtkWidget *optionmenu = NULL;
GtkWidget *align_menu = NULL;
GtkWidget *viewport1 = NULL;
GtkWidget *textentry = NULL;
GtkWidget *sizeentry = NULL;
+ GtkWidget *alignment;
GtkWidget *scrolled_window = NULL;
GtkTextBuffer *textbuffer;
char *text_size_string;
@@ -574,19 +510,24 @@
vbox = GTK_DIALOG(w_current->tewindow)->vbox;
- gtk_container_set_border_width(GTK_CONTAINER(w_current->tewindow),5);
- gtk_box_set_spacing(GTK_BOX(vbox),5);
+ gtk_container_set_border_width(GTK_CONTAINER(w_current->tewindow),DIALOG_BORDER_SPACING);
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
/* add a text box if only one object is selected */
- num_selected = o_selection_return_num(w_current->page_current->selection2_head);
+ num_selected = g_list_length(w_current->page_current->selection_list);
+
if (num_selected == 1) {
- label = gtk_label_new (_("Text Content:"));
+ label = gtk_label_new (_("<b>Text Content</b>"));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label),0,0);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
+
+ alignment = gtk_alignment_new(0,0,1,1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
+ DIALOG_INDENTATION, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0);
viewport1 = gtk_viewport_new (NULL, NULL);
- gtk_widget_show (viewport1);
gtk_widget_set_size_request(GTK_WIDGET(viewport1),-1,75);
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
@@ -594,8 +535,7 @@
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (viewport1), scrolled_window);
- gtk_box_pack_start( GTK_BOX(vbox), viewport1, TRUE, TRUE, 0);
- gtk_widget_show(scrolled_window);
+ gtk_container_add( GTK_CONTAINER(alignment), viewport1);
textentry = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(textentry), TRUE);
@@ -605,39 +545,47 @@
/* See first the code in text_input_dialog and get it working before adding it here. */
gtk_container_add(GTK_CONTAINER(scrolled_window), textentry);
- gtk_widget_show (textentry);
gtk_widget_grab_focus(textentry);
GLADE_HOOKUP_OBJECT(w_current->tewindow, textentry,"textentry");
}
- label = gtk_label_new(_("Text Color:"));
+ label = gtk_label_new(_("<b>Text Properties</b>"));
+ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label),0,0);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
- gtk_widget_show(label);
+
+ alignment = gtk_alignment_new(0,0,1,1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
+ DIALOG_INDENTATION, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
+
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
+ gtk_container_add(GTK_CONTAINER(alignment), table);
+
+ label = gtk_label_new(_("Color:"));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_table_attach(GTK_TABLE(table), label, 0,1,0,1, GTK_FILL,0,0,0);
optionmenu = gtk_option_menu_new();
gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu),
create_color_menu(w_current, &select_index));
gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), select_index);
+ gtk_table_attach_defaults(GTK_TABLE(table), optionmenu, 1,2,0,1);
- gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 0);
- gtk_widget_show(optionmenu);
-
- label = gtk_label_new (_("Text Size:"));
+ label = gtk_label_new(_("Size:"));
gtk_misc_set_alignment(GTK_MISC(label),0,0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
+ gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2, GTK_FILL,0,0,0);
sizeentry = gtk_entry_new_with_max_length (10);
gtk_editable_select_region(GTK_EDITABLE (sizeentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox),
- sizeentry, FALSE, FALSE, 5);
- gtk_widget_show (sizeentry);
+ gtk_table_attach_defaults(GTK_TABLE(table), sizeentry, 1,2,1,2);
+ gtk_entry_set_activates_default(GTK_ENTRY(sizeentry), TRUE);
- label = gtk_label_new (_("Text Alignment:"));
+ label = gtk_label_new(_("Alignment:"));
gtk_misc_set_alignment(GTK_MISC(label),0,0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
+ gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3, GTK_FILL,0,0,0);
optionmenu = gtk_option_menu_new ();
align_menu = create_menu_alignment (w_current);
@@ -648,15 +596,16 @@
w_current->text_alignment = text_alignment;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_menu_get_active(GTK_MENU(align_menu))),
TRUE);
+ gtk_table_attach_defaults(GTK_TABLE(table), optionmenu, 1,2,2,3);
GLADE_HOOKUP_OBJECT(w_current->tewindow, sizeentry,"sizeentry");
+ gtk_widget_show_all(w_current->tewindow);
+ }
- gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 0);
- gtk_widget_show(optionmenu);
+ else { /* dialog already there */
+ gtk_window_present(GTK_WINDOW(w_current->tewindow));
}
- if (!GTK_WIDGET_VISIBLE (w_current->tewindow)) {
- gtk_widget_show (w_current->tewindow);
if (string != NULL) {
if (num_selected == 1) { /* only if one thing is selected */
textentry = g_object_get_data (G_OBJECT (w_current->tewindow), "textentry");
@@ -671,7 +620,6 @@
gtk_entry_set_text(GTK_ENTRY(sizeentry),
text_size_string);
g_free(text_size_string);
- }
}
/***************** End of Text Edit dialog box ************************/
@@ -920,16 +868,16 @@
gtk_container_border_width(GTK_CONTAINER(dialog),
DIALOG_BORDER_SPACING);
vbox = GTK_DIALOG(dialog)->vbox;
- gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_ELEMENT_SPACING);
-
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- label = gtk_label_new(_("Line Properties:"));
+ /* Don't know whether to set the headline or not (Werner) */
+ /* label = gtk_label_new(_("Line Properties:"));
gtk_misc_set_alignment(GTK_MISC(label),0,0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); */
table = gtk_table_new (4, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_ELEMENT_SPACING);
- gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_ELEMENT_SPACING);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
label = gtk_label_new (_("Width:"));
@@ -1027,13 +975,11 @@
line_type_dialog_linetype_change(optionmenu, line_type_data);
gtk_widget_grab_focus(width_entry);
- gtk_grab_add (dialog);
+ gtk_widget_show_all (dialog);
g_free (width_str);
g_free (space_str);
g_free (length_str);
-
- gtk_widget_show_all (dialog);
}
/***************** End of Line Type / Width dialog box ****************/
@@ -1258,10 +1204,10 @@
g_free (fill_type_data);
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Creates the fill type dialog
* \par Function Description
- *
+ * This function creates the fill type dialog. It operates on a list
+ * of objects.
*/
void fill_type_dialog(TOPLEVEL *w_current, GList *objects)
{
@@ -1301,16 +1247,16 @@
gtk_container_border_width(GTK_CONTAINER(dialog), DIALOG_BORDER_SPACING);
vbox = GTK_DIALOG(dialog)->vbox;
- gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_ELEMENT_SPACING);
-
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- label = gtk_label_new(_("Fill Properties:"));
+ /* Don't know whether to use the headline or not (Werner) */
+ /* label = gtk_label_new(_("Fill Properties:"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
- gtk_box_pack_start(GTK_BOX(vbox),label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox),label, FALSE, FALSE, 0); */
table = gtk_table_new (6, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_ELEMENT_SPACING);
- gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_ELEMENT_SPACING);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
label = gtk_label_new (_("Fill Type:"));
@@ -1436,172 +1382,125 @@
fill_type_dialog_filltype_change(optionmenu, fill_type_data);
gtk_widget_grab_focus(width_entry);
- gtk_grab_add (dialog);
+ gtk_widget_show_all (dialog);
g_free (width_str);
g_free (angle1_str);
g_free (pitch1_str);
g_free (angle2_str);
g_free (pitch2_str);
-
- gtk_widget_show_all (dialog);
-
}
/***************** End of Fill Type dialog box ***********************/
/***************** Start of Arc dialog box ***************************/
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int arc_angles_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- arc_angles_dialog_cancel(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief response function for the arc angle dialog
* \par Function Description
- *
+ * The response function of th arc angle dialog takes the content of
+ * the dialog and applies it on the current arc.
+ * If the dialog is closed or canceled the function destroys the dialog.
*/
-void arc_angles_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
+void arc_angle_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- char *string_start = NULL;
- char *string_sweep = NULL;
+ GtkWidget *spinentry;
+ gint start_angle, sweep_angle;
- string_start = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->aaentry_start));
- string_sweep = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->aaentry_sweep));
+ switch (response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
+ case GTK_RESPONSE_ACCEPT:
+ spinentry = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_start");
+ start_angle = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spinentry));
+ spinentry = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_sweep");
+ sweep_angle = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spinentry));
- if ( (string_start[0] != '\0') && (string_sweep[0] != '\0') ) {
- /*! \todo put error detection */
- /* pb20011125 - o_arc_end4 accepts the final angles as param */
- o_arc_end4(w_current, atoi(string_start), atoi(string_sweep));
+ o_arc_end4(w_current, start_angle, sweep_angle);
+ break;
+ default:
+ printf("arc_angle_dialog_response(): strange signal %d\n",response);
}
- gtk_grab_remove(w_current->aawindow);
- gtk_widget_destroy(w_current->aawindow);
- w_current->aawindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void arc_angles_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
-{
- gtk_grab_remove(w_current->aawindow);
gtk_widget_destroy(w_current->aawindow);
w_current->aawindow = NULL;
-
w_current->event_state = DRAWARC;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Creates the arc angle dialog
* \par Function Description
- *
+ * This function create the arc angle dialog.
*/
void arc_angle_dialog (TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttoncancel = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
+ GtkWidget *alignment, *table;
+ GtkWidget *spin_start, *spin_sweep;
if (!w_current->aawindow) {
- w_current->aawindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->aawindow = gtk_dialog_new_with_buttons(_("Arc Params"),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
gtk_window_position(GTK_WINDOW(w_current->aawindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT(w_current->aawindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->aawindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->aawindow),
- "key_press_event",
- (GtkSignalFunc) arc_angles_dialog_keypress, w_current);
+ gtk_signal_connect(GTK_OBJECT(w_current->aawindow), "response",
+ GTK_SIGNAL_FUNC(arc_angle_dialog_response), w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->aawindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->aawindow);
-#endif
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->aawindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW(w_current->aawindow),
- _("Arc Params"));
- gtk_container_border_width(GTK_CONTAINER(w_current->aawindow),
- 10);
-
- label = gtk_label_new (_("Start Angle"));
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- w_current->aaentry_start = gtk_entry_new_with_max_length (4);
- gtk_editable_select_region(
- GTK_EDITABLE(w_current->aaentry_start), 0, -1);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- w_current->aaentry_start, FALSE, FALSE, 5);
- gtk_widget_show(w_current->aaentry_start);
- gtk_widget_grab_focus(w_current->aaentry_start);
-
- label = gtk_label_new(_("Degrees of Sweep"));
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show(label);
+ gtk_container_border_width(GTK_CONTAINER(w_current->aawindow), DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->aawindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
+
+
+ alignment = gtk_alignment_new(0,0,1,1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
+ 0 /*DIALOG_INDENTATION */, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
+ gtk_container_add(GTK_CONTAINER(alignment), table);
- w_current->aaentry_sweep = gtk_entry_new_with_max_length (4);
- gtk_editable_select_region(
- GTK_EDITABLE(w_current->aaentry_sweep), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox),
- w_current->aaentry_sweep, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->aaentry_sweep),
- "activate",
- GTK_SIGNAL_FUNC(arc_angles_dialog_ok),
- w_current);
- gtk_widget_show(w_current->aaentry_sweep);
+ label = gtk_label_new (_("Start Angle:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label, 0,1,0,1, GTK_FILL,0,0,0);
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (buttoncancel), "clicked",
- GTK_SIGNAL_FUNC(arc_angles_dialog_cancel),
- w_current);
- gtk_widget_show (buttoncancel);
+ spin_start = gtk_spin_button_new_with_range(-360,360,1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_start),0);
+ gtk_widget_grab_focus(spin_start);
+ gtk_entry_set_activates_default(GTK_ENTRY(spin_start), TRUE);
+ gtk_table_attach_defaults(GTK_TABLE(table), spin_start, 1,2,0,1);
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start (
- GTK_BOX(action_area),
- buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonok), "clicked",
- GTK_SIGNAL_FUNC(arc_angles_dialog_ok),
- w_current);
- gtk_widget_show (buttonok);
- gtk_widget_grab_default (buttonok);
+ label = gtk_label_new(_("Degrees of Sweep:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2, GTK_FILL,0,0,0);
+ spin_sweep = gtk_spin_button_new_with_range(-360,360,1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_sweep), 90);
+ gtk_widget_grab_focus(spin_sweep);
+ gtk_entry_set_activates_default(GTK_ENTRY(spin_sweep), TRUE);
+ gtk_table_attach_defaults(GTK_TABLE(table), spin_sweep, 1,2,1,2);
+
+ GLADE_HOOKUP_OBJECT(w_current->aawindow, spin_start,"spin_start");
+ GLADE_HOOKUP_OBJECT(w_current->aawindow, spin_sweep,"spin_sweep");
+ gtk_widget_show_all (w_current->aawindow);
}
- if (!GTK_WIDGET_VISIBLE (w_current->aawindow)) {
- gtk_widget_show (w_current->aawindow);
- gtk_grab_add (w_current->aawindow);
+ else { /* dialog already created */
+ gtk_window_present (GTK_WINDOW(w_current->aawindow));
}
}
@@ -1612,7 +1511,7 @@
/*! \brief response function for the translate dialog
* \par Function Description
* This function takes the user action and applies it.
- * \todo improve put error detection
+ * \todo improve error detection / use a spin button?
*/
void translate_dialog_response(GtkWidget *widget, gint response,
TOPLEVEL *w_current)
@@ -1633,7 +1532,7 @@
}
break;
default:
- printf("slot_edit_dialog_response(): strange signal %d\n",response);
+ printf("translate_edit_dialog_response(): strange signal %d\n",response);
}
i_set_state(w_current, SELECT);
@@ -1671,12 +1570,13 @@
gtk_dialog_set_default_response(GTK_DIALOG(w_current->trwindow),
GTK_RESPONSE_ACCEPT);
- gtk_container_border_width(GTK_CONTAINER(w_current->trwindow), DIALOG_BORDER_SPACING);
+ gtk_container_border_width(GTK_CONTAINER(w_current->trwindow),
+ DIALOG_BORDER_SPACING);
vbox = GTK_DIALOG(w_current->trwindow)->vbox;
- gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_ELEMENT_SPACING);
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new(_("Offset to translate?\n(0 for origin)"));
- gtk_misc_set_padding(GTK_MISC (label), 10, 10);
+ gtk_misc_set_alignment(GTK_MISC (label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
textentry = gtk_entry_new_with_max_length (10);
@@ -1686,10 +1586,11 @@
gtk_box_pack_start(GTK_BOX(vbox),textentry, FALSE, FALSE, 0);
GLADE_HOOKUP_OBJECT(w_current->trwindow, textentry, "textentry");
+ gtk_widget_show_all (w_current->trwindow);
}
- if (!GTK_WIDGET_VISIBLE (w_current->trwindow)) {
- gtk_widget_show_all (w_current->trwindow);
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->trwindow));
}
}
@@ -1697,309 +1598,200 @@
/***************** Start of Text size dialog box *********************/
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int text_size_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- text_size_dialog_cancel(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief response function for the text size dialog
* \par Function Description
- *
+ * This function takes the user input and applies it to gschem
*/
-void text_size_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
+void text_size_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- char *string = NULL;
- int size;
+ GtkWidget *spin_size;
+ gint size;
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
+ size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin_size));
- if ((string[0] != '\0')) {
- size = atoi(string);
- if (size) {
w_current->text_size = size;
w_current->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
- }
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
+ default:
+ printf("text_size_dialog_response(): strange signal %d\n",response);
}
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void text_size_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
-{
+ /* clean up */
i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
- gtk_grab_remove(w_current->tswindow);
gtk_widget_destroy(w_current->tswindow);
w_current->tswindow = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the text size dialog
* \par Function Description
- *
+ * This function creates the text size dialog.
*/
void text_size_dialog (TOPLEVEL *w_current)
{
- char *string;
- int len;
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttoncancel = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
+ GtkWidget *spin_size;
if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
-
- gtk_window_position(GTK_WINDOW(w_current->tswindow),
- GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
+ w_current->tswindow = gtk_dialog_new_with_buttons(_("Text Size"),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "key_press_event",
- (GtkSignalFunc) text_size_dialog_keypress, w_current);
+ gtk_window_position(GTK_WINDOW(w_current->tswindow),
+ GTK_WIN_POS_MOUSE);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT (w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
+ gtk_signal_connect(GTK_OBJECT(w_current->tswindow), "response",
+ GTK_SIGNAL_FUNC(text_size_dialog_response),
+ w_current);
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tswindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW (w_current->tswindow),
- _("Text Size"));
gtk_container_border_width(GTK_CONTAINER(w_current->tswindow),
- 10);
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->tswindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- label = gtk_label_new (_("Enter new text size"));
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- w_current->tsentry = gtk_entry_new_with_max_length (10);
- gtk_editable_select_region(
- GTK_EDITABLE(w_current->tsentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox),
- w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(text_size_dialog_ok),
- w_current);
- gtk_widget_show (w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
+ label = gtk_label_new (_("Enter new text size:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttoncancel), "clicked",
- GTK_SIGNAL_FUNC(text_size_dialog_cancel),
- w_current);
- gtk_widget_show (buttoncancel);
+ spin_size = gtk_spin_button_new_with_range(2,10000,2);
+ gtk_editable_select_region( GTK_EDITABLE(spin_size), 0, -1);
+ gtk_box_pack_start(GTK_BOX(vbox), spin_size, FALSE, FALSE, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(spin_size), TRUE);
+ gtk_widget_grab_focus(spin_size);
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonok), "clicked",
- GTK_SIGNAL_FUNC(text_size_dialog_ok),
- w_current);
- gtk_widget_show (buttonok);
- gtk_widget_grab_default (buttonok);
+ GLADE_HOOKUP_OBJECT(w_current->tswindow, spin_size, "spin_size");
+ gtk_widget_show_all(w_current->tswindow);
}
- if (!GTK_WIDGET_VISIBLE (w_current->tswindow)) {
- string = g_strdup_printf("%d", w_current->text_size);
- len = strlen(string);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), string);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show (w_current->tswindow);
- gtk_grab_add(w_current->tswindow);
- g_free(string);
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->tswindow));
}
+
+ /* always set the current text size to the dialog */
+ spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_size), w_current->text_size);
+ gtk_editable_select_region(GTK_EDITABLE(spin_size), 0, -1);
}
/***************** End of Text size dialog box ***********************/
/***************** Start of Snap size dialog box *********************/
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int snap_size_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- snap_size_dialog_cancel(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief response function for the snap size dialog
* \par Function Description
- *
+ * This is the response function for the snap size dialog.
+ * It sets the given snap size to gschem.
*/
-void snap_size_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
+void snap_size_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- char *string = NULL;
- int size;
+ GtkWidget *spin_size;
+ gint size;
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
+ size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin_size));
- if ((string[0] != '\0')) {
- size = atoi(string);
- if (size) {
w_current->snap_size = size;
- }
+ w_current->page_current->CHANGED=1; /* maybe remove those two lines */
+ o_undo_savestate(w_current, UNDO_ALL);
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
+ default:
+ printf("snap_size_dialog_response(): strange signal %d\n",response);
}
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void snap_size_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
-{
+ /* clean up */
i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
- gtk_grab_remove(w_current->tswindow);
gtk_widget_destroy(w_current->tswindow);
w_current->tswindow = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the snap size dialog
* \par Function Description
- *
+ * This function creates the snap size dialog.
*/
void snap_size_dialog (TOPLEVEL *w_current)
{
- char *string;
- int len;
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttoncancel = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
+ GtkWidget *spin_size;
if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->tswindow = gtk_dialog_new_with_buttons(_("Snap Size"),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
- gtk_window_position(GTK_WINDOW (w_current->tswindow),
+ gtk_window_position(GTK_WINDOW(w_current->tswindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "key_press_event",
- (GtkSignalFunc) snap_size_dialog_keypress, w_current);
-
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
+ gtk_signal_connect(GTK_OBJECT(w_current->tswindow), "response",
+ GTK_SIGNAL_FUNC(snap_size_dialog_response),
+ w_current);
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tswindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW (w_current->tswindow),
- _("Snap Grid"));
gtk_container_border_width(GTK_CONTAINER(w_current->tswindow),
- 10);
-
- label = gtk_label_new(_("Enter new snap grid spacing"));
- gtk_misc_set_padding(GTK_MISC (label), 10, 10);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show(label);
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->tswindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- w_current->tsentry = gtk_entry_new_with_max_length (10);
- gtk_editable_select_region(GTK_EDITABLE(w_current->tsentry),
- 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox),
- w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(snap_size_dialog_ok),
- w_current);
- gtk_widget_show(w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
+ label = gtk_label_new (_("Enter new snap grid spacing:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttoncancel), "clicked",
- GTK_SIGNAL_FUNC(snap_size_dialog_cancel),
- w_current);
- gtk_widget_show(buttoncancel);
+ spin_size = gtk_spin_button_new_with_range(0,100000,5);
+ gtk_editable_select_region( GTK_EDITABLE(spin_size), 0, -1);
+ gtk_box_pack_start(GTK_BOX(vbox), spin_size, FALSE, FALSE, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(spin_size), TRUE);
+ gtk_widget_grab_focus(spin_size);
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonok), "clicked",
- GTK_SIGNAL_FUNC(snap_size_dialog_ok),
- w_current);
- gtk_widget_show (buttonok);
- gtk_widget_grab_default (buttonok);
+ GLADE_HOOKUP_OBJECT(w_current->tswindow, spin_size, "spin_size");
+ gtk_widget_show_all(w_current->tswindow);
}
- if (!GTK_WIDGET_VISIBLE (w_current->tswindow)) {
- string = g_strdup_printf("%d", w_current->snap_size);
- len = strlen(string);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), string);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show (w_current->tswindow);
- gtk_grab_add (w_current->tswindow);
- g_free(string);
+ else { /* dialog already there */
+ gtk_window_present(GTK_WINDOW(w_current->tswindow));
}
+
+ /* always set the current gschem value to the dialog entry */
+ spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_size), w_current->snap_size);
+ gtk_editable_select_region(GTK_EDITABLE(spin_size), 0, -1);
}
/***************** End of Snap size dialog box ***********************/
/***************** Start of slot edit dialog box *********************/
-/*! \todo response function for the slot edit dialog
- * \brief
+/*! \brief response function for the slot edit dialog
* \par Function Description
* The function takes the dialog entry and applies the new slot to the
* symbol.
@@ -2066,7 +1858,7 @@
gtk_container_border_width(GTK_CONTAINER(w_current->sewindow),
DIALOG_BORDER_SPACING);
vbox = GTK_DIALOG(w_current->sewindow)->vbox;
- gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_ELEMENT_SPACING);
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new (_("Edit slot number:"));
gtk_misc_set_alignment(GTK_MISC(label),0,0);
@@ -2082,163 +1874,117 @@
gtk_widget_show_all (w_current->sewindow);
}
+ else { /* dialog already created */
+ gtk_window_present (GTK_WINDOW(w_current->sewindow));
+ }
+
+ /* always set the current text and select the number of the slot */
if (string != NULL) {
textentry = g_object_get_data(G_OBJECT(w_current->sewindow),"textentry");
gtk_entry_set_text(GTK_ENTRY(textentry), string);
gtk_entry_select_region(GTK_ENTRY(textentry),
strlen("slot="), strlen(string));
}
-
- if (!GTK_WIDGET_VISIBLE (w_current->sewindow)) {
- gtk_widget_show_all (w_current->sewindow);
- gtk_window_activate_focus (GTK_WINDOW(w_current->sewindow));
- }
}
/***************** End of Slot Edit dialog box ***********************/
/***************** Start of help/about dialog box ********************/
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the about dialog
* \par Function Description
+ * This function destoys the about dialg.
*/
-int about_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
+void about_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- about_dialog_close(NULL, w_current);
- return TRUE;
+ switch (response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
+ default:
+ printf("about_dialog_response(): strange signal %d\n",response);
}
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void about_dialog_close(GtkWidget *w, TOPLEVEL *w_current)
-{
gtk_widget_destroy(w_current->abwindow);
w_current->abwindow = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the about dialog and show it
* \par Function Description
- *
+ * This function creates the about dialog.
*/
void about_dialog (TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
- GtkWidget *buttonclose = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
char *string;
if (!w_current->abwindow) {
- w_current->abwindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->abwindow = gtk_dialog_new_with_buttons(_("About..."),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ NULL);
gtk_window_position (GTK_WINDOW (w_current->abwindow),
GTK_WIN_POS_MOUSE);
- gtk_window_set_title (GTK_WINDOW (w_current->abwindow),
- _("About..."));
- gtk_container_border_width (GTK_CONTAINER (
- w_current->abwindow), 5);
-
- gtk_signal_connect (GTK_OBJECT (w_current->abwindow),
- "destroy", GTK_SIGNAL_FUNC(destroy_window),
- &w_current->abwindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->abwindow),
- "key_press_event",
- (GtkSignalFunc) about_dialog_keypress, w_current);
+ gtk_signal_connect (GTK_OBJECT (w_current->abwindow), "response",
+ GTK_SIGNAL_FUNC(about_dialog_response),
+ w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect (GTK_OBJECT (w_current->abwindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->abwindow);
-#endif
+ gtk_container_border_width (GTK_CONTAINER(w_current->abwindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->abwindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- string = g_strdup_printf( _("gEDA : GPL Electronic Design Automation"));
- label = gtk_label_new (string);
- g_free(string);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 5);
- gtk_widget_show (label);
+ label = gtk_label_new ( _("<b>gEDA: GPL Electronic Design Automation</b>"));
+ gtk_label_set_use_markup (GTK_LABEL(label), TRUE);
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- string = g_strdup_printf(_("gschem version %s%s"), VERSION, CUSTOM_VERSION);
+ string = g_strdup_printf(_("<b>gschem version %s%s</b>"), VERSION, CUSTOM_VERSION);
label = gtk_label_new (string);
+ gtk_label_set_use_markup (GTK_LABEL(label), TRUE);
g_free(string);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 5);
- gtk_widget_show (label);
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- string = g_strdup_printf( _("Written by:\nAles V. Hvezda\nahvezda@xxxxxxxxxxxxx\nAnd many others (See AUTHORS file)"));
- label = gtk_label_new (string);
- g_free(string);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- label, TRUE, TRUE, 5);
- gtk_widget_show (label);
-
- buttonclose = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttonclose, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonclose, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonclose), "clicked",
- GTK_SIGNAL_FUNC(about_dialog_close),
- w_current);
- gtk_widget_show(buttonclose);
+ label = gtk_label_new ( _("Written by:\n"
+ "Ales V. Hvezda\n"
+ "ahvezda@xxxxxxxxxxxxx\n"
+ "And many others (See AUTHORS file)"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+ gtk_widget_show_all(w_current->abwindow);
}
- if (!GTK_WIDGET_VISIBLE(w_current->abwindow)) {
- gtk_widget_show(w_current->abwindow);
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->abwindow));
}
}
/***************** End of help/about dialog box *********************/
/***************** Start of coord dialog box ************************/
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int coord_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- coord_dialog_close(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the coord dialog
* \par Function Description
- *
+ * This function destroys the coord dialog box and does some cleanup.
*/
-void coord_dialog_close(GtkWidget *w, TOPLEVEL *w_current)
+void coord_dialog_response(GtkWidget *w, gint response, TOPLEVEL *w_current)
{
gtk_widget_destroy(w_current->cowindow);
w_current->cowindow = NULL;
+ w_current->coord_world = NULL;
+ w_current->coord_screen = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Update the coordinates in the coord dialog box.
* \par Function Description
- *
+ * This function takes the screen coordinates and prints the
+ * screen and the world coordinates in the coord dialog.
*/
void coord_display_update(TOPLEVEL *w_current, int x, int y)
{
@@ -2256,90 +2002,64 @@
g_free(string);
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the coord dialog
* \par Function Description
- *
+ * This function creates the coord dialog box.
*/
void coord_dialog (TOPLEVEL *w_current, int x, int y)
{
- GtkWidget *buttonclose = NULL;
GtkWidget *frame;
- GtkWidget *vbox2;
+ GtkWidget *vbox;
if (!w_current->cowindow) {
- w_current->cowindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_position (GTK_WINDOW (w_current->cowindow),
- GTK_WIN_POS_MOUSE);
-
- gtk_window_set_title (GTK_WINDOW (w_current->cowindow),
- _("Coords"));
- gtk_container_border_width (GTK_CONTAINER (
- w_current->cowindow), 5);
-
- gtk_signal_connect (GTK_OBJECT (w_current->cowindow),
- "destroy", GTK_SIGNAL_FUNC(destroy_window),
- &w_current->cowindow);
+ w_current->cowindow = gtk_dialog_new_with_buttons(_("Coords"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* Not modal GTK_DIALOG_MODAL */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ NULL);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect (GTK_OBJECT (w_current->cowindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->cowindow);
-#endif
+ gtk_window_position (GTK_WINDOW (w_current->cowindow),
+ GTK_WIN_POS_NONE);
- gtk_signal_connect(GTK_OBJECT(w_current->cowindow),
- "key_press_event",
- (GtkSignalFunc) coord_dialog_keypress, w_current);
+ gtk_signal_connect (GTK_OBJECT (w_current->cowindow), "response",
+ GTK_SIGNAL_FUNC(coord_dialog_response),
+ w_current);
+ gtk_container_border_width (GTK_CONTAINER(w_current->cowindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->cowindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- vbox2 = gtk_vbox_new (FALSE, 5);
- gtk_container_add (GTK_CONTAINER (w_current->cowindow), vbox2);
- gtk_widget_show(vbox2);
frame = gtk_frame_new (_("Screen"));
- w_current->coord_screen =
- gtk_label_new("(########, ########)");
- gtk_label_set_justify(
- GTK_LABEL(w_current->coord_screen), GTK_JUSTIFY_LEFT);
+ w_current->coord_screen = gtk_label_new("(########, ########)");
+ gtk_label_set_justify( GTK_LABEL(w_current->coord_screen), GTK_JUSTIFY_LEFT);
gtk_misc_set_padding(GTK_MISC(w_current->coord_screen),
- 10, 10);
+ DIALOG_H_SPACING, DIALOG_V_SPACING);
gtk_container_add(GTK_CONTAINER (frame),
w_current->coord_screen);
- gtk_box_pack_start(GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
- gtk_widget_show(w_current->coord_screen);
- gtk_widget_show(frame);
+ gtk_box_pack_start(GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new (_("World"));
- w_current->coord_world =
- gtk_label_new ("(########, ########)");
- gtk_misc_set_padding(GTK_MISC(w_current->coord_world), 10, 10);
+ w_current->coord_world = gtk_label_new ("(########, ########)");
+ gtk_misc_set_padding(GTK_MISC(w_current->coord_world),
+ DIALOG_H_SPACING, DIALOG_V_SPACING);
gtk_label_set_justify(GTK_LABEL(w_current->coord_world),
GTK_JUSTIFY_LEFT);
gtk_container_add(GTK_CONTAINER (frame),
w_current->coord_world);
- gtk_box_pack_start(GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
- gtk_widget_show(w_current->coord_world);
- gtk_widget_show(frame);
-
- buttonclose = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttonclose, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX ( vbox2 ),
- buttonclose, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonclose), "clicked",
- GTK_SIGNAL_FUNC(coord_dialog_close),
- w_current);
- gtk_widget_show(buttonclose);
- gtk_widget_grab_default (buttonclose);
+ gtk_box_pack_start(GTK_BOX (vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show_all(w_current->cowindow);
}
- if (!GTK_WIDGET_VISIBLE (w_current->cowindow)) {
- gtk_widget_show (w_current->cowindow);
- coord_display_update(w_current, x, y);
- } else {
- gdk_window_raise(w_current->cowindow->window);
+ else { /* window already creatad */
+ gtk_window_present(GTK_WINDOW(w_current->cowindow));
}
+
+ /* always update the coords when the dialog is requested */
+ coord_display_update(w_current, x, y);
}
/***************** End of coord dialog box **************************/
@@ -2438,12 +2158,10 @@
return(string);
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create a OptionMenu with the gschem colors.
* \par Function Description
- *
- * \note
- * This is from gtktest.c
+ * This Function creates a GtkOptionMenu with the color list.
+ * It selects the color of the first selected object.
*/
static GtkWidget *create_color_menu (TOPLEVEL * w_current, int * select_index)
{
@@ -2458,18 +2176,17 @@
/* first lets see if we have a selected object, if so select its color */
int select_col = -1;
int item_index = 0;
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object = NULL;
menu = gtk_menu_new ();
group = NULL;
- /* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
if (s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object == NULL) {
fprintf(stderr, "no object selected - WHEE!\n");
}else{
@@ -2538,15 +2255,14 @@
*/
void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
{
- SELECTION *s_current = NULL;
+ GList *s_current = NULL;
OBJECT *object = NULL;
- /* skip over head */
- s_current = w_current->page_current->selection2_head->next;
+ s_current = w_current->page_current->selection_list;
while(s_current != NULL) {
- object = s_current->selected_object;
+ object = (OBJECT *) s_current->data;
if (object == NULL) {
fprintf(stderr, _("ERROR: NULL object in color_edit_dialog_apply!\n"));
exit(-1);
@@ -2633,7 +2349,7 @@
gtk_container_border_width(GTK_CONTAINER(w_current->clwindow),
DIALOG_BORDER_SPACING);
vbox = GTK_DIALOG(w_current->clwindow)->vbox;
- gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_ELEMENT_SPACING);
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new(_("Object color:"));
gtk_misc_set_alignment(GTK_MISC(label),0,0);
@@ -2648,9 +2364,8 @@
gtk_widget_show_all(w_current->clwindow);
}
- if (w_current->clwindow) {
- gtk_widget_show_all(w_current->clwindow);
- gtk_window_activate_focus(GTK_WINDOW(w_current->clwindow));
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->clwindow));
}
}
@@ -2658,173 +2373,167 @@
/***************** Start of help/keymapping dialog box **************/
-#define MAX_HOTKEY_BUFFER 256
-static char *hotkey_strings[MAX_HOTKEY_BUFFER];
-static int hotkey_counter=0;
+static GList *hotkeys = NULL;
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int x_dialog_hotkeys_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- x_dialog_hotkeys_close(NULL, w_current);
- return TRUE;
- }
+typedef struct _HOTKEY ST_HOTKEY;
- return FALSE;
-}
+struct _HOTKEY {
+ gchar *name;
+ gchar *value;
+};
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void x_dialog_hotkeys_close (GtkWidget *w, TOPLEVEL *w_current)
-{
- gtk_widget_destroy(w_current->hkwindow);
- w_current->hkwindow = NULL;
-}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Clear the hotkey list of the hotkeys dialog
* \par Function Description
- *
+ * This function free's all elements allocated by the hotkey dialog
*/
void x_dialog_hotkeys_free_all(void)
{
- int i;
+ GList *item;
+ ST_HOTKEY *hotkey;
- for (i = 0 ; i < hotkey_counter; i++) {
- if (hotkey_strings[i]) {
- g_free(hotkey_strings[i]);
- }
+ for (item = hotkeys; item != NULL; item = g_list_next(item)) {
+ hotkey = item->data;
+ g_free(hotkey->name);
+ g_free(hotkey->value);
+ g_free(hotkey);
}
+ g_list_free(hotkeys);
+ hotkeys = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Insert a hotkey string into the dialog hotkey list
* \par Function Description
- *
+ * This function splits the given hotkey string and adds it to the hotkey
+ * list.
+ * \todo Change the function and its callers to f(char *name, char *value).
*/
void x_dialog_hotkeys_fill(char *string)
{
+ ST_HOTKEY *hotkey;
+ gchar **token;
- if (hotkey_counter > MAX_HOTKEY_BUFFER-1) {
- printf(_("Ran out of space in the hotkey buffer...\n"));
- return;
- }
+ hotkey = g_new(ST_HOTKEY, 1);
+ token = g_strsplit(string, ":", 2);
- hotkey_strings[hotkey_counter] = (char *) g_malloc(sizeof(char)*(
- strlen(string)+1));
- ;
- strcpy(hotkey_strings[hotkey_counter], string);
- hotkey_counter++;
+ if (token[0] != NULL) {
+ hotkey->name = g_strdup(token[0]);
+ if (token[1] != NULL) {
+ g_strstrip(token[1]);
+ hotkey->value = g_strdup(token[1]);
+ hotkeys = g_list_append(hotkeys, hotkey);
+ }
+ else {
+ g_free(hotkey->name);
+ }
+ }
+ g_strfreev(token);
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the hotkey dialog
* \par Function Description
- *
+ * This function destroys the hotkey dialog and does some cleanup.
*/
-void x_dialog_hotkeys (TOPLEVEL *w_current)
+void x_dialog_hotkeys_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- GtkWidget *buttonclose = NULL;
- GtkWidget *vbox, *action_area, *scrolled_win, *list;
- GtkWidget *item;
- int i;
-
- if (!w_current->hkwindow) {
+ switch(response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ /* void */
+ break;
+ default:
+ printf("x_dialog_hotkeys_response(): strange signal %d\n", response);
+ }
+ /* clean up */
+ gtk_widget_destroy(w_current->hkwindow);
+ w_current->hkwindow = NULL;
+}
+/*! \brief Creates the hotkeys dialog
+ * \par Function Description
+ * This function creates the hotkey dialog and puts the list of hotkeys
+ * into it.
+ */
+void x_dialog_hotkeys (TOPLEVEL *w_current)
+{
+ GtkWidget *vbox, *scrolled_win;
+ GtkListStore *store;
+ GtkWidget *treeview;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ ST_HOTKEY *hotkey;
+ GList *item;
- w_current->hkwindow = x_create_dialog_box(&vbox, &action_area);
+ if (!w_current->hkwindow) {
+ w_current->hkwindow = gtk_dialog_new_with_buttons(_("Hotkeys"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* not modal */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ NULL);
gtk_window_position (GTK_WINDOW (w_current->hkwindow),
- GTK_WIN_POS_MOUSE);
+ GTK_WIN_POS_NONE);
- gtk_window_set_title (GTK_WINDOW (w_current->hkwindow),
- _("Hotkeys..."));
- gtk_container_border_width (GTK_CONTAINER (
- w_current->hkwindow), 5);
+ gtk_signal_connect (GTK_OBJECT (w_current->hkwindow), "response",
+ GTK_SIGNAL_FUNC(x_dialog_hotkeys_response),
+ w_current);
- gtk_widget_set_usize(w_current->hkwindow, 300,300);
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->hkwindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_signal_connect (GTK_OBJECT (w_current->hkwindow),
- "destroy", GTK_SIGNAL_FUNC(destroy_window),
- &w_current->hkwindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->hkwindow),
- "key_press_event",
- (GtkSignalFunc) x_dialog_hotkeys_keypress, w_current);
+ gtk_container_border_width (GTK_CONTAINER (w_current->hkwindow),
+ DIALOG_BORDER_SPACING);
+ gtk_widget_set_usize(w_current->hkwindow, 300,300);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect (GTK_OBJECT (w_current->hkwindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->hkwindow);
-#endif
+ vbox = GTK_DIALOG(w_current->hkwindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
- gtk_widget_set_usize (scrolled_win, -1, 300);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_widget_show (scrolled_win);
- list = gtk_list_new ();
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
- gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW (scrolled_win), list);
- gtk_container_set_focus_vadjustment
- (GTK_CONTAINER (list),
- gtk_scrolled_window_get_vadjustment
- (GTK_SCROLLED_WINDOW (scrolled_win)));
- gtk_container_set_focus_hadjustment
- (GTK_CONTAINER (list),
- gtk_scrolled_window_get_hadjustment
- (GTK_SCROLLED_WINDOW (scrolled_win)));
- gtk_widget_show(list);
-
- item = gtk_list_item_new_with_label (
- _("Function : keystroke(s)"));
- gtk_container_add (GTK_CONTAINER (list), item);
- gtk_widget_show(item);
-
- item = gtk_list_item_new_with_label (" ");
- gtk_container_add (GTK_CONTAINER (list), item);
- gtk_widget_show(item);
-
- for (i = 0 ; i < hotkey_counter; i++) {
-
- if (hotkey_strings[i]) {
- item = gtk_list_item_new_with_label (
- hotkey_strings[i]);
- gtk_container_add (GTK_CONTAINER (list), item);
- gtk_widget_show(item);
- }
+ /* the model */
+ store = gtk_list_store_new (2,G_TYPE_STRING, G_TYPE_STRING);
+ for (item=hotkeys; item != NULL; item =g_list_next(item)) {
+ hotkey = item->data;
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, hotkey->name,
+ 1, hotkey->value,
+ -1);
}
- buttonclose = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttonclose, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonclose, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (buttonclose), "clicked",
- GTK_SIGNAL_FUNC(x_dialog_hotkeys_close),
- w_current);
- gtk_widget_show(buttonclose);
+ /* the tree view */
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ gtk_container_add(GTK_CONTAINER(scrolled_win), treeview);
+
+ /* the columns */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Function",
+ renderer,
+ "text",
+ 0,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Keystroke(s)",
+ renderer,
+ "text",
+ 1,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
+ /* show all recursively */
+ gtk_widget_show_all(w_current->hkwindow);
}
- if (!GTK_WIDGET_VISIBLE(w_current->hkwindow)) {
- gtk_widget_show(w_current->hkwindow);
- } else {
- gdk_window_raise(w_current->hkwindow->window);
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->hkwindow));
}
}
@@ -3173,39 +2882,28 @@
/*********** End of generic text input dialog box *******/
/*********** Start of find text dialog box *******/
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-int find_text_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- find_text_done(NULL, w_current);
- return TRUE;
- }
- return FALSE;
-}
-
-GtkWidget *checkdescend = NULL;
int start_find;
OBJECT *remember_page;
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief response function for the find text dialog
* \par Function Description
- *
+ * This function takes the string the user likes to find and searches it
+ * in the schematic.
*/
-void find_text_ok(GtkWidget * w, TOPLEVEL * w_current)
+void find_text_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- char *string = NULL;
- int done;
-
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
+ GtkWidget *textentry;
+ GtkWidget *checkdescend;
+ gchar *string;
+ gint done=0, close=0;
- /* descend = gtk_object_get_data(GTK_OBJECT(w_current->tsentry),"descend");*/
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ textentry = g_object_get_data(G_OBJECT(w_current->tfindwindow),"textentry");
+ string = (gchar*) gtk_entry_get_text(GTK_ENTRY(textentry));
+ checkdescend = g_object_get_data(G_OBJECT(w_current->tfindwindow),"checkdescend");
strncpy(generic_textstring, string, 256);
@@ -3219,38 +2917,33 @@
!start_find);
if (done) {
o_redraw_all_fast(w_current);
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
+ close = 1;
}
start_find = 0;
-
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void find_text_done(GtkWidget * w, TOPLEVEL * w_current)
-{
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ close = 1;
+ break;
+ default:
+ printf("find_text_dialog_response(): strange signal %d\n", response);
+ }
+ if (close) {
+ gtk_widget_destroy(w_current->tfindwindow);
+ w_current->tfindwindow = NULL;
+ }
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the text find dialog
* \par Function Description
- *
+ * This function creates the text find dialog.
*/
void find_text_dialog(TOPLEVEL * w_current)
{
- int len;
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttondone = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
+ GtkWidget *checkdescend;
+ GtkWidget *textentry;
OBJECT *object = NULL;
start_find = 1;
@@ -3261,340 +2954,260 @@
}
}
+ if (!w_current->tfindwindow) {
+ w_current->tfindwindow = gtk_dialog_new_with_buttons(_("Find Text"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* not modal GTK_DIALOG_MODAL */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_FIND,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
-
- if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
-
- gtk_window_position(GTK_WINDOW(w_current->tswindow),
+ gtk_window_position(GTK_WINDOW(w_current->tfindwindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "key_press_event",
- (GtkSignalFunc) find_text_keypress, w_current);
+ gtk_signal_connect(GTK_OBJECT(w_current->tfindwindow), "response",
+ GTK_SIGNAL_FUNC(find_text_dialog_response),
+ w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tfindwindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW(w_current->tswindow), _("Find text"));
- gtk_container_border_width(GTK_CONTAINER(w_current->tswindow), 10);
- gtk_box_set_spacing(GTK_BOX(vbox),10);
+ gtk_container_border_width(GTK_CONTAINER(w_current->tfindwindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->tfindwindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new(_("Text to find:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gtk_widget_show(label);
- w_current->tsentry = gtk_entry_new_with_max_length(20);
- gtk_editable_select_region(GTK_EDITABLE(w_current->tsentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox), w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(find_text_ok), w_current);
- gtk_widget_show(w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
+ textentry = gtk_entry_new_with_max_length(20);
+ gtk_editable_select_region(GTK_EDITABLE(textentry), 0, -1);
+ gtk_box_pack_start(GTK_BOX(vbox), textentry, FALSE, FALSE, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(textentry), TRUE);
+ gtk_widget_grab_focus(textentry);
- checkdescend =
- gtk_check_button_new_with_label(_("descend into hierarchy"));
- /* gtk_object_set_data (GTK_OBJECT (w_current->tswindow), "descend", w_current->preview_checkbox);*/
+ checkdescend = gtk_check_button_new_with_label(_("descend into hierarchy"));
gtk_box_pack_start(GTK_BOX(vbox), checkdescend, TRUE, TRUE, 0);
- buttondone = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS(buttondone, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(action_area), buttondone, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(buttondone), "clicked",
- GTK_SIGNAL_FUNC(find_text_done), w_current);
+ GLADE_HOOKUP_OBJECT(w_current->tfindwindow, textentry, "textentry");
+ GLADE_HOOKUP_OBJECT(w_current->tfindwindow, checkdescend, "checkdescend");
- buttonok = gtk_button_new_from_stock (GTK_STOCK_FIND);
- GTK_WIDGET_SET_FLAGS(buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(action_area), buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(buttonok), "clicked",
- GTK_SIGNAL_FUNC(find_text_ok), w_current);
-
-
-
- gtk_widget_show(buttonok);
- gtk_widget_show(buttondone);
- gtk_widget_show(checkdescend);
- gtk_widget_grab_default(buttonok);
+ gtk_widget_show_all(w_current->tfindwindow);
}
- if (!GTK_WIDGET_VISIBLE(w_current->tswindow)) {
- len = strlen(generic_textstring);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), generic_textstring);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show(w_current->tswindow);
- gtk_grab_add(w_current->tswindow);
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->tfindwindow));
}
+
+ /* always select the text string in the entry */
+ textentry = g_object_get_data (G_OBJECT (w_current->tfindwindow), "textentry");
+ gtk_entry_set_text(GTK_ENTRY(textentry), generic_textstring);
+ gtk_entry_select_region(GTK_ENTRY(textentry), 0, -1);
}
/*********** End of find text dialog box *******/
/*********** Start of hide text dialog box *******/
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the hide text dialog
* \par Function Description
- *
+ * This is the response function of the hide text dialog. It takes the user input
+ * and hides all text elements that starts with the searchtext.
*/
-int hide_text_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
+void hide_text_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- hide_text_done(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
+ GtkWidget *textentry;
+ gchar *string;
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void hide_text_ok(GtkWidget * w, TOPLEVEL * w_current)
-{
- char *string = NULL;
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ textentry = g_object_get_data(G_OBJECT(w_current->thidewindow),"textentry");
+ string = (gchar*) gtk_entry_get_text(GTK_ENTRY(textentry));
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
strncpy(generic_textstring, string, 256);
-
o_edit_hide_specific_text(w_current,
w_current->page_current->object_head, string);
-
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void hide_text_done(GtkWidget * w, TOPLEVEL * w_current)
-{
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ gtk_widget_destroy(w_current->thidewindow);
+ w_current->thidewindow = NULL;
+ break;
+ default:
+ printf("show_text_dialog_response(): strange signal %d\n",response);
+ }
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Creates the hide text dialog
* \par Function Description
- *
+ * This function creates the hide text dialog.
*/
void hide_text_dialog(TOPLEVEL * w_current)
{
- int len;
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *textentry;
+ GtkWidget *vbox;
- if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
+ if (!w_current->thidewindow) {
+ w_current->thidewindow = gtk_dialog_new_with_buttons(_("Hide Text"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* not modal GTK_DIALOG_MODAL, */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_APPLY,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
- gtk_window_position(GTK_WINDOW(w_current->tswindow),
+ gtk_window_position(GTK_WINDOW(w_current->thidewindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "key_press_event",
- (GtkSignalFunc) hide_text_keypress, w_current);
+ gtk_signal_connect(GTK_OBJECT(w_current->thidewindow), "response",
+ GTK_SIGNAL_FUNC(hide_text_dialog_response),
+ w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->thidewindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW(w_current->tswindow), _("Hide text"));
- gtk_container_border_width(GTK_CONTAINER(w_current->tswindow), 10);
+ gtk_container_border_width(GTK_CONTAINER(w_current->thidewindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->thidewindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new(_("Hide text starting with:"));
- gtk_misc_set_padding(GTK_MISC(label), 20, 20);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gtk_widget_show(label);
- w_current->tsentry = gtk_entry_new_with_max_length(20);
- gtk_editable_select_region(GTK_EDITABLE(w_current->tsentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox), w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(hide_text_ok), w_current);
- gtk_widget_show(w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
+ textentry = gtk_entry_new_with_max_length(20);
+ gtk_box_pack_start(GTK_BOX(vbox), textentry, FALSE, FALSE, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(textentry), TRUE);
+ gtk_widget_grab_focus(textentry);
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS(buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(action_area), buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(buttonok), "clicked",
- GTK_SIGNAL_FUNC(hide_text_ok), w_current);
- gtk_widget_show(buttonok);
- gtk_widget_grab_default(buttonok);
+ GLADE_HOOKUP_OBJECT(w_current->thidewindow, textentry, "textentry");
+ gtk_widget_show_all(w_current->thidewindow);
}
- if (!GTK_WIDGET_VISIBLE(w_current->tswindow)) {
- len = strlen(generic_textstring);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), generic_textstring);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show(w_current->tswindow);
- gtk_grab_add(w_current->tswindow);
+ else { /* dialog already created, just select it */
+ gtk_window_present(GTK_WINDOW(w_current->thidewindow));
}
+
+ /* always select the text in the search entry */
+ textentry = g_object_get_data (G_OBJECT (w_current->thidewindow), "textentry");
+ gtk_entry_set_text(GTK_ENTRY(textentry), generic_textstring);
+ gtk_entry_select_region(GTK_ENTRY(textentry), 0, -1);
}
/*********** End of hide text dialog box *******/
/*********** Start of show text dialog box *******/
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the show text dialog
* \par Function Description
- *
+ * This function takes the users input and searches all strings starting with
+ * the given search text and hides those text objects.
*/
-int show_text_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
+void show_text_dialog_response(GtkWidget *widget, gint response,
+ TOPLEVEL *w_current)
{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- show_text_done(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
+ GtkWidget *textentry;
+ gchar *string;
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void show_text_ok(GtkWidget * w, TOPLEVEL * w_current)
-{
- char *string = NULL;
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ textentry = g_object_get_data(G_OBJECT(w_current->tshowwindow),"textentry");
+ string = (gchar*) gtk_entry_get_text(GTK_ENTRY(textentry));
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
strncpy(generic_textstring, string, 256);
-
o_edit_show_specific_text(w_current,
w_current->page_current->object_head, string);
-
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void show_text_done(GtkWidget * w, TOPLEVEL * w_current)
-{
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ gtk_widget_destroy(w_current->tshowwindow);
+ w_current->tshowwindow = NULL;
+ break;
+ default:
+ printf("show_text_dialog_response(): strange signal %d\n",response);
+ }
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the show text dialog.
* \par Function Description
- *
+ * This function creates the show text dialog.
*/
void show_text_dialog(TOPLEVEL * w_current)
{
- int len;
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *textentry;
+ GtkWidget *vbox;
- if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
+ if (!w_current->tshowwindow) {
+ w_current->tshowwindow = gtk_dialog_new_with_buttons(_("Show Text"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* not modal GTK_DIALOG_MODAL, */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_APPLY,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
- gtk_window_position(GTK_WINDOW(w_current->tswindow),
+ gtk_window_position(GTK_WINDOW(w_current->tshowwindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "key_press_event",
- (GtkSignalFunc) show_text_keypress, w_current);
+ gtk_signal_connect(GTK_OBJECT(w_current->tshowwindow), "response",
+ GTK_SIGNAL_FUNC(show_text_dialog_response),
+ w_current);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tshowwindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_title(GTK_WINDOW(w_current->tswindow), _("Show text"));
- gtk_container_border_width(GTK_CONTAINER(w_current->tswindow), 10);
+ gtk_container_border_width(GTK_CONTAINER(w_current->tshowwindow),
+ DIALOG_BORDER_SPACING);
+ vbox = GTK_DIALOG(w_current->tshowwindow)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
label = gtk_label_new(_("Show text starting with:"));
- gtk_misc_set_padding(GTK_MISC(label), 20, 20);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gtk_widget_show(label);
- w_current->tsentry = gtk_entry_new_with_max_length(20);
- gtk_editable_select_region(GTK_EDITABLE(w_current->tsentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox), w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(show_text_ok), w_current);
- gtk_widget_show(w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
+ textentry = gtk_entry_new_with_max_length(20);
+ gtk_box_pack_start(GTK_BOX(vbox), textentry, FALSE, FALSE, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(textentry), TRUE);
+ gtk_widget_grab_focus(textentry);
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS(buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(action_area), buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(buttonok), "clicked",
- GTK_SIGNAL_FUNC(show_text_ok), w_current);
- gtk_widget_show(buttonok);
- gtk_widget_grab_default(buttonok);
+ GLADE_HOOKUP_OBJECT(w_current->tshowwindow, textentry, "textentry");
+ gtk_widget_show_all(w_current->tshowwindow);
}
- if (!GTK_WIDGET_VISIBLE(w_current->tswindow)) {
- len = strlen(generic_textstring);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), generic_textstring);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show(w_current->tswindow);
- gtk_grab_add(w_current->tswindow);
+ else { /* dialog already created. Show it */
+ gtk_window_present(GTK_WINDOW(w_current->tshowwindow));
}
+
+ /* always select the text in the entry */
+ textentry = g_object_get_data (G_OBJECT (w_current->tshowwindow), "textentry");
+ gtk_entry_set_text(GTK_ENTRY(textentry), generic_textstring);
+ gtk_entry_select_region(GTK_ENTRY(textentry), 0, -1);
}
/*********** End of show text dialog box *******/
/*********** Start of some Gtk utils *******/
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Selects all text in a TextView widget
* \par Function Description
- *
+ * The function selects all the text in a TextView widget.
*/
void select_all_text_in_textview(GtkTextView *textview)
{
GtkTextBuffer *textbuffer;
GtkTextIter start, end;
- GtkTextMark *mark;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_get_bounds (textbuffer, &start, &end);
- gtk_text_buffer_place_cursor(textbuffer, &start);
- mark = gtk_text_buffer_get_selection_bound(textbuffer);
- gtk_text_buffer_move_mark(textbuffer, mark, &end);
+ gtk_text_buffer_select_range(textbuffer, &start, &end);
}
/*! \todo Finish function documentation!!!
1.41.6.1 +29 -39 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
retrieving revision 1.41.6.1
diff -u -b -r1.41 -r1.41.6.1
--- x_event.c 4 Oct 2006 19:10:30 -0000 1.41
+++ x_event.c 27 Dec 2006 17:37:56 -0000 1.41.6.1
@@ -88,15 +88,14 @@
case(ENDCOPY):
case(ENDMCOPY):
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
case(DRAWCOMP):
case(ENDCOMP):
case(ENDPASTE):
- o_drawbounding(w_current,
- w_current->page_current->complex_place_head->next,
- NULL,
+ o_drawbounding(w_current, NULL,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
@@ -161,7 +160,7 @@
printf("event state: %d \n", event->state);
printf("w_current state: %d \n", w_current->event_state);
printf("Selection is:\n");
- o_selection_print_all( w_current->page_current->selection2_head);
+ o_selection_print_all(&(w_current->page_current->selection_list));
printf("\n");
#endif
@@ -169,8 +168,8 @@
(w_current->event_state == STARTSELECT ||
w_current->event_state == SELECT)) {
o_find_object(w_current, (int) event->x, (int) event->y, TRUE);
- if (w_current->page_current->selection2_head->next) {
- o_edit(w_current, w_current->page_current->selection2_head->next);
+ if (w_current->page_current->selection_list) {
+ o_edit(w_current, w_current->page_current->selection_list);
return(0);
}
}
@@ -433,7 +432,7 @@
w_current->DONT_REDRAW = 0;
o_rotate_90(
w_current,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
(int) event->x, (int) event->y);
w_current->DONT_REDRAW = prev_state;
@@ -444,7 +443,7 @@
case(ENDMIRROR):
o_mirror(w_current,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->selection_list,
(int) event->x, (int) event->y);
w_current->inside_action = 0;
@@ -759,7 +758,6 @@
break;
case(STARTSELECT):
-
/* first look for grips */
if (!o_grips_start(
w_current, (int) event->x, (int) event->y)) {
@@ -782,9 +780,9 @@
if (w_current->inside_action) {
if (w_current->event_state == ENDCOMP) {
o_drawbounding(w_current,
- w_current->page_current->
- complex_place_head->next,
- NULL, x_get_darkcolor(w_current->bb_color), TRUE);
+ NULL,
+ w_current->page_current->complex_place_list,
+ x_get_darkcolor(w_current->bb_color), TRUE);
w_current->complex_rotate =
(w_current->complex_rotate + 90) % 360;
@@ -792,15 +790,16 @@
o_complex_place_rotate(w_current);
o_drawbounding(w_current,
- w_current->page_current->
- complex_place_head->next,
- NULL, x_get_darkcolor(w_current->bb_color), TRUE);
+ NULL,
+ w_current->page_current->complex_place_list,
+ x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
} else if (w_current->event_state == ENDTEXT) {
o_drawbounding(w_current,
w_current->page_current->
attrib_place_head->next,
- NULL, x_get_darkcolor(w_current->bb_color), TRUE);
+ NULL,
+ x_get_darkcolor(w_current->bb_color), TRUE);
w_current->complex_rotate =
(w_current->complex_rotate + 90) % 360;
@@ -810,18 +809,18 @@
o_drawbounding(w_current,
w_current->page_current->
attrib_place_head->next,
- NULL, x_get_darkcolor(w_current->bb_color), TRUE);
+ NULL,
+ x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
}
else if ((w_current->event_state == ENDMOVE) ||
(w_current->event_state == ENDCOPY) ||
(w_current->event_state == ENDMCOPY) ) {
- g_assert (w_current->page_current->selection2_head != NULL);
prev_state = w_current->event_state;
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
/* Don't allow o_rotate_90 to erase the selection, neither to
@@ -830,7 +829,7 @@
redraw_state = w_current->DONT_REDRAW;
w_current->DONT_REDRAW = 1;
- o_rotate_90(w_current, w_current->page_current->selection2_head->next,
+ o_rotate_90(w_current, w_current->page_current->complex_place_list,
fix_x(w_current, w_current->start_x),
fix_y(w_current, w_current->start_y));
w_current->DONT_REDRAW = redraw_state;
@@ -838,7 +837,7 @@
w_current->event_state = prev_state;
o_drawbounding(w_current, NULL,
- w_current->page_current->selection2_head->next,
+ w_current->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
@@ -1072,17 +1071,10 @@
o_move_stretch_rubberband(w_current);
}
- o_drawbounding(
- w_current, NULL,
- w_current->page_current->selection2_head->next,
- x_get_darkcolor(w_current->bb_color), FALSE);
+ o_complex_rubbercomplex(w_current);
w_current->last_x = fix_x(w_current, (int) event->x);
w_current->last_y = fix_y(w_current, (int) event->y);
- o_drawbounding(
- w_current, NULL,
- w_current->page_current->selection2_head->next,
- x_get_darkcolor(w_current->bb_color), FALSE);
-
+ o_complex_rubbercomplex(w_current);
if (w_current->netconn_rubberband) {
o_move_stretch_rubberband(w_current);
}
@@ -1095,15 +1087,13 @@
case(ENDMCOPY):
case(MCOPY):
if (w_current->inside_action) {
- o_drawbounding(
- w_current, NULL,
- w_current->page_current->selection2_head->next,
+ o_drawbounding(w_current, NULL,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), FALSE);
w_current->last_x = fix_x(w_current, (int) event->x);
w_current->last_y = fix_y(w_current, (int) event->y);
- o_drawbounding(
- w_current, NULL,
- w_current->page_current->selection2_head->next,
+ o_drawbounding(w_current, NULL,
+ w_current->page_current->selection_list,
x_get_darkcolor(w_current->bb_color), FALSE);
}
break;
1.27.2.1 +6 -7 eda/geda/gaf/gschem/src/x_image.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_image.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_image.c,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -b -r1.27 -r1.27.2.1
--- x_image.c 9 Dec 2006 19:03:12 -0000 1.27
+++ x_image.c 27 Dec 2006 17:37:56 -0000 1.27.2.1
@@ -274,9 +274,8 @@
/* de select everything first */
o_select_run_hooks(w_current, NULL, 2);
- o_selection_remove_most(w_current,
- w_current->page_current->
- selection2_head);
+ o_selection_unselect_list(w_current,
+ &(w_current->page_current->selection_list));
#ifdef HAS_LIBGD
@@ -652,7 +651,7 @@
/* If there are no objects, can't use zoom_extents */
if (object_found) {
o_redraw_all (&toplevel);
- get_complex_bounds(&toplevel,
+ get_object_list_bounds(&toplevel,
toplevel.page_current->object_head,
&origin_x, &origin_y,
&right, &bottom);
1.3.6.1 +1 -1 eda/geda/gaf/gschem/src/x_multiattrib.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_multiattrib.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_multiattrib.c,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -b -r1.3 -r1.3.6.1
--- x_multiattrib.c 19 Oct 2006 15:42:44 -0000 1.3
+++ x_multiattrib.c 27 Dec 2006 17:37:56 -0000 1.3.6.1
@@ -457,7 +457,7 @@
OBJECT *o_attrib)
{
/* actually deletes the attribute */
- o_selection_remove (toplevel->page_current->selection2_head, o_attrib);
+ o_selection_remove (&(toplevel->page_current->selection_list), o_attrib);
o_delete_text (toplevel, o_attrib);
toplevel->page_current->CHANGED=1;
o_undo_savestate (toplevel, UNDO_ALL);
1.26.2.1 +2 -2 eda/geda/gaf/gschem/src/x_print.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_print.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_print.c,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -b -r1.26 -r1.26.2.1
--- x_print.c 9 Dec 2006 19:03:12 -0000 1.26
+++ x_print.c 27 Dec 2006 17:37:56 -0000 1.26.2.1
@@ -737,8 +737,8 @@
/* de select everything first */
o_select_run_hooks (w_current, NULL, 2);
- o_selection_remove_most (w_current,
- w_current->page_current->selection2_head);
+ g_list_free(w_current->page_current->selection_list);
+ w_current->page_current->selection_list = NULL;
if (usefile && filename[0])
/* Print to file */
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs