[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-150-g8ca5988)
The branch, master has been updated
via 8ca598852f51c04183ab872f35bcc156628bdf79 (commit)
via 31e883e9666c7721c9a73995ff071cb628c241e6 (commit)
via 600c870c0486edfe0afae031a6857ccddfec7e08 (commit)
from d48b0b36c5348abd52413de14afb6ab0958b260d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gschem/include/prototype.h | 2 +-
gschem/src/i_callbacks.c | 30 +----
gschem/src/x_dialog.c | 365 ++++++++++++++++++++++++++----------------
libgeda/include/prototype.h | 2 +
libgeda/src/o_basic.c | 78 +++++++++-
5 files changed, 304 insertions(+), 173 deletions(-)
=================
Commit Messages
=================
commit 8ca598852f51c04183ab872f35bcc156628bdf79
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Mon Jan 5 17:20:47 2009 +0100
gschem: fill type dialog: improved default values
If the user changes the fill type from HOLLOW to HATCHED and does not
define the angle and pitch, then the gschem could either reject
the change of the type, or guess the pitch values.
I've decided that it is better to set the missing values.
In the opposite case, when the user switches the type from HATCHED to
HOLLOW, the pitch is still set. Reset the not required parameters
to -1.
Maybe the functionality should be moved to o_set_fill_type() in
libgeda.
:100644 100644 90a864f... 5997cc6... M gschem/src/x_dialog.c
commit 31e883e9666c7721c9a73995ff071cb628c241e6
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Mon Jan 5 16:08:38 2009 +0100
gschem: show correct properties in filltype dialog
The filltype dialog uses the selection list now. With the new
functions selection_get_fill_type() and fill_type_dialog_set_values()
it will be possible to convert the dialog into a non_modal dialog.
In the dialog only those values are marked as *unchanged* that
differ from each other.
This also fixes the bug [#2344964].
:100644 100644 ddf5481... 2dce2e0... M gschem/include/prototype.h
:100644 100644 a79ea53... 5e224eb... M gschem/src/i_callbacks.c
:100644 100644 e61b398... 90a864f... M gschem/src/x_dialog.c
commit 600c870c0486edfe0afae031a6857ccddfec7e08
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Wed Dec 31 13:59:23 2008 +0100
libgeda: access functions for filltype and linestyle
Created the function o_get_fill_options and o_get_line_options to
get the properties of an object.
:100644 100644 6a3cd8f... 78408d5... M libgeda/include/prototype.h
:100644 100644 b681b8b... 859b73f... M libgeda/src/o_basic.c
=========
Changes
=========
commit 8ca598852f51c04183ab872f35bcc156628bdf79
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Mon Jan 5 17:20:47 2009 +0100
gschem: fill type dialog: improved default values
If the user changes the fill type from HOLLOW to HATCHED and does not
define the angle and pitch, then the gschem could either reject
the change of the type, or guess the pitch values.
I've decided that it is better to set the missing values.
In the opposite case, when the user switches the type from HATCHED to
HOLLOW, the pitch is still set. Reset the not required parameters
to -1.
Maybe the functionality should be moved to o_set_fill_type() in
libgeda.
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 90a864f..5997cc6 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -1277,14 +1277,37 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
&opitch1, &oangle1, &opitch2, &oangle2))
continue;
+ otype = type == -1 ? otype : type;
+ owidth = width == -1 ? owidth : width;
+ opitch1 = pitch1 == -1 ? opitch1 : pitch1;
+ oangle1 = angle1 == -1 ? oangle1 : angle1;
+ opitch2 = pitch2 == -1 ? opitch2 : pitch2;
+ oangle2 = angle2 == -1 ? oangle2 : angle2;
+
+ /* set all not required options to -1 and
+ set nice parameters if not provided by the user */
+ switch (otype) {
+ case (FILLING_HOLLOW):
+ case (FILLING_FILL):
+ owidth = opitch1 = oangle1 = opitch2 = oangle2 = -1;
+ break;
+ case (FILLING_HATCH):
+ if (owidth < 1) owidth = 1;
+ if (opitch1 < 1) opitch1 = 100;
+ opitch2 = oangle2 = -1;
+ break;
+ case (FILLING_MESH):
+ if (owidth < 1) owidth = 1;
+ if (opitch1 < 1) opitch1 = 100;
+ if (opitch2 < 1) opitch2 = 100;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
o_invalidate (w_current, object);
- o_set_fill_options (toplevel, object,
- type == -1 ? otype : type,
- width == -1 ? owidth : width,
- pitch1 == -1 ? opitch1 : pitch1,
- angle1 == -1 ? oangle1 : angle1,
- pitch2 == -1 ? opitch2 : pitch2,
- angle2 == -1 ? oangle2 : angle2);
+ o_set_fill_options (toplevel, object, otype, owidth,
+ opitch1, oangle1, opitch2, oangle2);
o_invalidate (w_current, object);
}
commit 31e883e9666c7721c9a73995ff071cb628c241e6
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Mon Jan 5 16:08:38 2009 +0100
gschem: show correct properties in filltype dialog
The filltype dialog uses the selection list now. With the new
functions selection_get_fill_type() and fill_type_dialog_set_values()
it will be possible to convert the dialog into a non_modal dialog.
In the dialog only those values are marked as *unchanged* that
differ from each other.
This also fixes the bug [#2344964].
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index ddf5481..2dce2e0 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -753,7 +753,7 @@ gint change_alignment(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
void text_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
void text_edit_dialog(GSCHEM_TOPLEVEL *w_current, const char *string, int text_size, int text_alignment);
void line_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects);
-void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects);
+void fill_type_dialog(GSCHEM_TOPLEVEL *w_current);
void arc_angle_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT *arc_object);
void translate_dialog(GSCHEM_TOPLEVEL *w_current);
void text_size_dialog(GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index a79ea53..5e224eb 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1295,35 +1295,7 @@ DEFINE_I_CALLBACK(edit_filltype)
exit_if_null(w_current);
- /* anything selected ? */
- if (o_select_selected(w_current)) {
- GList *s_current =
- geda_list_get_glist( w_current->toplevel->page_current->selection_list );
- GList *objects = NULL;
-
- /* yes, build a list of relevant objects */
- while (s_current != NULL) {
- OBJECT *o_current = (OBJECT *) s_current->data;
-
- if (o_current->type == OBJ_BOX ||
- o_current->type == OBJ_CIRCLE ||
- o_current->type == OBJ_PATH) {
- objects = g_list_prepend (objects, o_current);
- }
-
- s_current = g_list_next(s_current);
- }
-
- if (objects != NULL) {
- /* at least one object in the list */
- i_update_middle_button(w_current,
- i_callback_edit_color,
- _("Edit Fill Type"));
- /* enter edition of parameters of selected objects */
- fill_type_dialog(w_current, objects);
- }
- }
-
+ fill_type_dialog(w_current);
}
/*! \section view-menu View Menu Callback Functions */
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index e61b398..90a864f 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -68,7 +68,6 @@ struct fill_type_data {
GtkWidget *pitch2_entry;
GSCHEM_TOPLEVEL *w_current;
- GList *objects;
};
/*! \todo Finish function documentation!!!
@@ -1015,7 +1014,8 @@ static GtkWidget *create_menu_filltype (GSCHEM_TOPLEVEL *w_current)
} types[] = { { N_("Hollow"), FILLING_HOLLOW },
{ N_("Filled"), FILLING_FILL },
{ N_("Mesh"), FILLING_MESH },
- { N_("Hatch"), FILLING_HATCH } };
+ { N_("Hatch"), FILLING_HATCH },
+ { N_("*unchanged*"), FILLING_VOID } };
gint i;
menu = gtk_menu_new ();
@@ -1035,6 +1035,131 @@ static GtkWidget *create_menu_filltype (GSCHEM_TOPLEVEL *w_current)
return menu;
}
+/*! \brief get the filltype data from selected objects
+ * \par Function Description
+ * Get filltype information over all selected objects.
+ * If a object property is different to the other objects, then
+ * return -2 in that variable.
+ * \param [in] selection the selection list
+ * \param [out] type OBJECT_FILLING type
+ * \param [out] width fill width.
+ * \param [out] pitch1 cross hatch line distance
+ * \param [out] angle1 cross hatch angle
+ * \param [out] pitch2 cross hatch line distance
+ * \param [out] angle2 cross hatch angle
+ * \returns TRUE if filltype found, FALSE otherwise
+ */
+static gboolean selection_get_fill_type(GList *selection,
+ OBJECT_FILLING *type, gint *width,
+ gint *pitch1, gint *angle1,
+ gint *pitch2, gint *angle2)
+{
+ GList *iter;
+ OBJECT *object;
+ gboolean found = FALSE;
+ OBJECT_FILLING otype;
+ gint owidth, opitch1, oangle1, opitch2, oangle2;
+
+
+ for (iter = selection; iter != NULL; iter = g_list_next(iter)) {
+ object = (OBJECT *) iter->data;
+ if (! o_get_fill_options(object, &otype, &owidth,
+ &opitch1, &oangle1, &opitch2, &oangle2))
+ continue;
+
+ if (found == FALSE) { /* first object with filltype */
+ found = TRUE;
+ *type = otype;
+ *width = owidth;
+ *pitch1 = opitch1;
+ *angle1 = oangle1;
+ *pitch2 = opitch2;
+ *angle2 = oangle2;
+ } else {
+ /* indicate different values with the value -2 */
+ if (*type != otype) *type = -2;
+ if (*width != owidth) *width = -2;
+ if (*pitch1 != opitch1) *pitch1 = -2;
+ if (*angle1 != oangle1) *angle1 = -2;
+ if (*pitch2 != opitch2) *pitch2 = -2;
+ if (*angle2 != oangle2) *angle2 = -2;
+ }
+ }
+
+ return found;
+}
+
+
+/*! \brief set the filltype in the filltype dialog
+ * \par Function Description
+ * Set all widgets in the filltype dialog. Variables marked with the
+ * invalid value -2 are set to *unchanged*.
+ * \param [in] selection the selection list
+ * \param [in] type OBJECT_FILLING type
+ * \param [in] width fill width.
+ * \param [in] pitch1 cross hatch line distance
+ * \param [in] angle1 cross hatch angle
+ * \param [in] pitch2 cross hatch line distance
+ * \param [in] angle2 cross hatch angle
+ */
+static void fill_type_dialog_set_values(struct fill_type_data *fill_type_data,
+ OBJECT_FILLING type, gint width,
+ gint pitch1, gint angle1,
+ gint pitch2, gint angle2)
+{
+ gchar *text;
+
+ if (type == -2)
+ type = FILLING_VOID;
+ gtk_option_menu_set_history(GTK_OPTION_MENU(fill_type_data->fill_type), type);
+
+ if (width == -2)
+ text = g_strdup(_("*unchanged*"));
+ else
+ text = g_strdup_printf ("%d", width);
+ gtk_entry_set_text (GTK_ENTRY (fill_type_data->width_entry), text);
+ gtk_entry_select_region (GTK_ENTRY (fill_type_data->width_entry),
+ 0, strlen (text));
+ g_free(text);
+
+ if (pitch1 == -2)
+ text = g_strdup(_("*unchanged*"));
+ else
+ text = g_strdup_printf ("%d", pitch1);
+ gtk_entry_set_text (GTK_ENTRY (fill_type_data->pitch1_entry), text);
+ gtk_entry_select_region (GTK_ENTRY (fill_type_data->pitch1_entry),
+ 0, strlen (text));
+ g_free(text);
+
+ if (angle1 == -2)
+ text = g_strdup(_("*unchanged*"));
+ else
+ text = g_strdup_printf ("%d", angle1);
+ gtk_entry_set_text (GTK_ENTRY (fill_type_data->angle1_entry), text);
+ gtk_entry_select_region (GTK_ENTRY (fill_type_data->angle1_entry),
+ 0, strlen (text));
+ g_free(text);
+
+ if (pitch2 == -2)
+ text = g_strdup(_("*unchanged*"));
+ else
+ text = g_strdup_printf ("%d", pitch2);
+ gtk_entry_set_text (GTK_ENTRY (fill_type_data->pitch2_entry), text);
+ gtk_entry_select_region (GTK_ENTRY (fill_type_data->pitch2_entry),
+ 0, strlen (text));
+ g_free(text);
+
+ if (angle2 == -2)
+ text = g_strdup(_("*unchanged*"));
+ else
+ text = g_strdup_printf ("%d", angle2);
+ gtk_entry_set_text (GTK_ENTRY (fill_type_data->angle2_entry), text);
+ gtk_entry_select_region (GTK_ENTRY (fill_type_data->angle2_entry),
+ 0, strlen (text));
+ g_free(text);
+}
+
+
/*! \brief Callback function for the filltype menu in the filltype dialog
* \par Function Description
* This function sets the entry activity according to the selected
@@ -1056,26 +1181,25 @@ static gint fill_type_dialog_filltype_change(GtkWidget *w, gpointer data)
type = GPOINTER_TO_INT(
gtk_object_get_data (GTK_OBJECT (menuitem), "filltype"));
switch(type) {
- case(FILLING_HOLLOW):
- case(FILLING_FILL):
- activate_width_entry = FALSE;
- activate_anglepitch1_entries = FALSE;
- activate_anglepitch2_entries = FALSE;
- break;
- case(FILLING_HATCH):
- activate_width_entry = TRUE;
- activate_anglepitch1_entries = TRUE;
- activate_anglepitch2_entries = FALSE;
- break;
- case(FILLING_MESH):
- activate_width_entry = TRUE;
- activate_anglepitch1_entries = TRUE;
- activate_anglepitch2_entries = TRUE;
- break;
- default:
- activate_width_entry = TRUE;
- activate_anglepitch1_entries = TRUE;
- activate_anglepitch2_entries = TRUE;
+ case(FILLING_HOLLOW):
+ case(FILLING_FILL):
+ activate_width_entry = FALSE;
+ activate_anglepitch1_entries = FALSE;
+ activate_anglepitch2_entries = FALSE;
+ break;
+ case(FILLING_HATCH):
+ activate_width_entry = TRUE;
+ activate_anglepitch1_entries = TRUE;
+ activate_anglepitch2_entries = FALSE;
+ break;
+ case(FILLING_MESH):
+ case(FILLING_VOID):
+ activate_width_entry = TRUE;
+ activate_anglepitch1_entries = TRUE;
+ activate_anglepitch2_entries = TRUE;
+ break;
+ default:
+ g_assert_not_reached ();
}
gtk_widget_set_sensitive (fill_type_data->width_entry,
@@ -1099,15 +1223,22 @@ static gint fill_type_dialog_filltype_change(GtkWidget *w, gpointer data)
*/
static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
{
- struct fill_type_data *fill_type_data = (struct fill_type_data*)data;
+ struct fill_type_data *fill_type_data = (struct fill_type_data*) data;
GSCHEM_TOPLEVEL *w_current = fill_type_data->w_current;
TOPLEVEL *toplevel = w_current->toplevel;
- GList *objects;
+ GList *selection, *iter;
+ OBJECT *object;
const gchar *width_str, *angle1_str, *pitch1_str, *angle2_str, *pitch2_str;
OBJECT_FILLING type;
+ gint width, angle1, pitch1, angle2, pitch2;
+ OBJECT_FILLING otype;
+ gint owidth, oangle1, opitch1, oangle2, opitch2;
- /* retrieve the list of objects */
- objects = fill_type_data->objects;
+ /* get the selection */
+ if (! o_select_selected(w_current))
+ return;
+ selection =
+ geda_list_get_glist(w_current->toplevel->page_current->selection_list);
/* get the new values from the text entries of the dialog */
width_str = gtk_entry_get_text (GTK_ENTRY (
@@ -1127,62 +1258,36 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
GTK_MENU (gtk_option_menu_get_menu (
GTK_OPTION_MENU (
fill_type_data->fill_type))))), "filltype"));
-
- /* are there several objects concerned? */
- if (g_list_next (objects) == NULL) {
- /* no, there is only one object */
- OBJECT *o_current = (OBJECT*) objects->data;
- gint width, angle1, pitch1, angle2, pitch2;
-
- width = atoi (width_str);
- angle1 = atoi (angle1_str);
- pitch1 = atoi (pitch1_str);
- angle2 = atoi (angle2_str);
- pitch2 = atoi (pitch2_str);
-
- /* apply the new line options to object */
- o_invalidate (w_current, o_current);
- o_set_fill_options(toplevel, o_current,
- type, width,
- pitch1, angle1,
- pitch2, angle2);
- o_invalidate (w_current, o_current);
-
- } else {
- /* more than one object in the list */
- GList *object;
- gint width, angle1, pitch1, angle2, pitch2;
-
- /* get the new line options */
- width = g_strcasecmp (width_str,
- _("*unchanged*")) ? atoi (width_str) : -1;
- angle1 = g_strcasecmp (angle1_str,
- _("*unchanged*")) ? atoi (angle1_str) : -1;
- pitch1 = g_strcasecmp (pitch1_str,
- _("*unchanged*")) ? atoi (pitch1_str) : -1;
- angle2 = g_strcasecmp (angle2_str,
- _("*unchanged*")) ? atoi (angle2_str) : -1;
- pitch2 = g_strcasecmp (pitch2_str,
- _("*unchanged*")) ? atoi (pitch2_str) : -1;
-
- /* apply changes to each object */
- object = objects;
- while (object != NULL) {
- OBJECT *o_current = (OBJECT*)object->data;
-
- o_invalidate (w_current, o_current);
- o_set_fill_options (toplevel, o_current,
- type == -1 ? o_current->fill_type : type,
- width == -1 ? o_current->fill_width : width,
- pitch1 == -1 ? o_current->fill_pitch1 : pitch1,
- angle1 == -1 ? o_current->fill_angle1 : angle1,
- pitch2 == -1 ? o_current->fill_pitch2 : pitch2,
- angle2 == -1 ? o_current->fill_angle2 : angle2);
- o_invalidate (w_current, o_current);
-
- object = g_list_next(object);
- }
+
+ /* convert the options to integers (-1 means unchanged) */
+ width = g_strcasecmp (width_str,
+ _("*unchanged*")) ? atoi (width_str) : -1;
+ angle1 = g_strcasecmp (angle1_str,
+ _("*unchanged*")) ? atoi (angle1_str) : -1;
+ pitch1 = g_strcasecmp (pitch1_str,
+ _("*unchanged*")) ? atoi (pitch1_str) : -1;
+ angle2 = g_strcasecmp (angle2_str,
+ _("*unchanged*")) ? atoi (angle2_str) : -1;
+ pitch2 = g_strcasecmp (pitch2_str,
+ _("*unchanged*")) ? atoi (pitch2_str) : -1;
+
+ for (iter = selection; iter != NULL; iter = g_list_next(iter)) {
+ object = (OBJECT *) iter->data;
+ if (! o_get_fill_options(object, &otype, &owidth,
+ &opitch1, &oangle1, &opitch2, &oangle2))
+ continue;
+
+ o_invalidate (w_current, object);
+ o_set_fill_options (toplevel, object,
+ type == -1 ? otype : type,
+ width == -1 ? owidth : width,
+ pitch1 == -1 ? opitch1 : pitch1,
+ angle1 == -1 ? oangle1 : angle1,
+ pitch2 == -1 ? opitch2 : pitch2,
+ angle2 == -1 ? oangle2 : angle2);
+ o_invalidate (w_current, object);
}
+
toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -1213,17 +1318,15 @@ void fill_type_dialog_response(GtkWidget *widget, gint response,
gtk_grab_remove (fill_type_data->dialog);
gtk_widget_destroy (fill_type_data->dialog);
- /* get ride of the list of objects but not the objects */
- g_list_free (fill_type_data->objects);
g_free (fill_type_data);
}
/*! \brief Creates the fill type dialog
* \par Function Description
- * This function creates the fill type dialog. It operates on a list
- * of objects.
+ * This function creates the fill type dialog.
+ * It uses the selection to set it's initial values.
*/
-void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects)
+void fill_type_dialog(GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *dialog;
GtkWidget *vbox;
@@ -1236,8 +1339,19 @@ void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects)
GtkWidget *label;
GtkWidget *table;
struct fill_type_data *fill_type_data;
- gchar *width_str, *angle1_str, *pitch1_str, *angle2_str, *pitch2_str;
- gint type;
+ GList *selection;
+ OBJECT_FILLING type=FILLING_VOID;
+ gint width=0, pitch1=0, angle1=0, pitch2=0, angle2=0;
+
+ if (! o_select_selected(w_current))
+ return;
+
+ selection =
+ geda_list_get_glist(w_current->toplevel->page_current->selection_list);
+
+ if (! selection_get_fill_type(selection, &type, &width,
+ &pitch1, &angle1, &pitch2, &angle2))
+ return;
fill_type_data = (struct fill_type_data*) g_malloc (
sizeof (struct fill_type_data));
@@ -1350,66 +1464,16 @@ void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects)
fill_type_data->pitch2_entry = pitch2_entry;
fill_type_data->w_current = w_current;
- fill_type_data->objects = objects;
/* fill in the fields of the dialog */
- if (g_list_next (objects) == NULL) {
- /* only one object in object list */
- OBJECT *o_current = (OBJECT*) objects->data;
-
- type = o_current->fill_type;
- width_str = g_strdup_printf ("%d", o_current->fill_width);
- angle1_str = g_strdup_printf ("%d", o_current->fill_angle1);
- pitch1_str = g_strdup_printf ("%d", o_current->fill_pitch1);
- angle2_str = g_strdup_printf ("%d", o_current->fill_angle2);
- pitch2_str = g_strdup_printf ("%d", o_current->fill_pitch2);
- } else {
- GtkWidget *menuitem;
- GtkWidget *menu;
-
- width_str = g_strdup_printf (_("*unchanged*"));
- angle1_str = g_strdup_printf (_("*unchanged*"));
- pitch1_str = g_strdup_printf (_("*unchanged*"));
- angle2_str = g_strdup_printf (_("*unchanged*"));
- pitch2_str = g_strdup_printf (_("*unchanged*"));
- type = FILLING_HATCH + 1;
-
- /* add a new menuitem to option menu for line type */
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (optionmenu));
- menuitem = gtk_radio_menu_item_new_with_label (
- gtk_radio_menu_item_get_group (
- GTK_RADIO_MENU_ITEM (gtk_menu_get_active (GTK_MENU (menu)))),
- _("*unchanged*"));
- gtk_menu_append (menu, menuitem);
- gtk_object_set_data (GTK_OBJECT (menuitem),
- "filltype",
- GINT_TO_POINTER (-1));
- gtk_widget_show (menuitem);
- }
-
- gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), type);
- gtk_entry_set_text (GTK_ENTRY (width_entry), width_str);
- gtk_entry_select_region (GTK_ENTRY (width_entry), 0, strlen (width_str));
- gtk_entry_set_text (GTK_ENTRY (angle1_entry), angle1_str);
- gtk_entry_select_region (GTK_ENTRY (angle1_entry), 0, strlen (angle1_str));
- gtk_entry_set_text (GTK_ENTRY (pitch1_entry), pitch1_str);
- gtk_entry_select_region (GTK_ENTRY (pitch1_entry), 0, strlen (pitch1_str));
- gtk_entry_set_text (GTK_ENTRY (angle2_entry), angle2_str);
- gtk_entry_select_region (GTK_ENTRY (angle2_entry), 0, strlen (angle2_str));
- gtk_entry_set_text (GTK_ENTRY (pitch2_entry), pitch2_str);
- gtk_entry_select_region (GTK_ENTRY (pitch2_entry), 0, strlen (pitch2_str));
+ fill_type_dialog_set_values(fill_type_data, type, width,
+ pitch1, angle1, pitch2, angle2);
/* Set the widget activity according to the current filltype */
fill_type_dialog_filltype_change(optionmenu, fill_type_data);
gtk_widget_grab_focus(width_entry);
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);
}
/***************** End of Fill Type dialog box ***********************/
commit 600c870c0486edfe0afae031a6857ccddfec7e08
Author: Werner Hoch <werner.ho@xxxxxx>
Date: Wed Dec 31 13:59:23 2008 +0100
libgeda: access functions for filltype and linestyle
Created the function o_get_fill_options and o_get_line_options to
get the properties of an object.
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 6a3cd8f..78408d5 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -130,7 +130,9 @@ int inside_region(int xmin, int ymin, int xmax, int ymax, int x, int y);
void o_recalc_single_object(TOPLEVEL *toplevel, OBJECT *o_current);
void o_recalc_object_glist(TOPLEVEL *toplevel, GList *object_glist);
void o_set_line_options(TOPLEVEL *toplevel, OBJECT *o_current, OBJECT_END end, OBJECT_TYPE type, int width, int length, int space);
+gboolean o_get_line_options(OBJECT *object, OBJECT_END *end, OBJECT_TYPE *type, int *width, int *length, int *space);
void o_set_fill_options(TOPLEVEL *toplevel, OBJECT *o_current, OBJECT_FILLING type, int width, int pitch1, int angle1, int pitch2, int angle2);
+gboolean o_get_fill_options(OBJECT *object, OBJECT_FILLING *type, int *width, int *pitch1, int *angle1, int *pitch2, int *angle2);
gboolean o_get_position(TOPLEVEL *toplevel, gint *x, gint *y, OBJECT *object);
void o_translate_world (TOPLEVEL *toplevel, gint dx, gint dy, OBJECT *object);
void o_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object);
diff --git a/libgeda/src/o_basic.c b/libgeda/src/o_basic.c
index b681b8b..859b73f 100644
--- a/libgeda/src/o_basic.c
+++ b/libgeda/src/o_basic.c
@@ -227,6 +227,41 @@ void o_set_line_options(TOPLEVEL *toplevel, OBJECT *o_current,
o_recalc_single_object( toplevel, o_current );
}
+/*! \brief get #OBJECT's line properties.
+ * \par Function Description
+ * This function get's the #OBJECT's line options.
+ * See #OBJECT_END and #OBJECT_TYPE for information on valid
+ * object end and type values.
+ *
+ * \param [in] object OBJECT to read the properties
+ * \param [out] end An OBJECT_END.
+ * \param [out] type An OBJECT_TYPE.
+ * \param [out] width Line width.
+ * \param [out] length Line length.
+ * \param [out] space Spacing between dashes/dots.
+ * \return TRUE on succes, FALSE otherwise
+ *
+ */
+gboolean o_get_line_options(OBJECT *object,
+ OBJECT_END *end, OBJECT_TYPE *type,
+ int *width, int *length, int *space)
+{
+ if (object->type != OBJ_LINE
+ && object->type != OBJ_ARC
+ && object->type != OBJ_BOX
+ && object->type != OBJ_CIRCLE
+ && object->type != OBJ_PATH)
+ return FALSE;
+
+ *end = object->line_end;
+ *type = object->line_type;
+ *width = object->line_width;
+ *length = object->line_length;
+ *space = object->line_space;
+
+ return TRUE;
+}
+
/*! \brief Set #OBJECT's fill options.
* \par Function Description
* This function allows an #OBJECT's fill options to be configured.
@@ -236,10 +271,10 @@ void o_set_line_options(TOPLEVEL *toplevel, OBJECT *o_current,
* \param [in,out] o_current OBJECT to be updated.
* \param [in] type OBJECT_FILLING type.
* \param [in] width fill width.
- * \param [in] pitch1 cross hatch???.
- * \param [in] angle1 cross hatch???.
- * \param [in] pitch2 cross hatch???.
- * \param [in] angle2 cross hatch???.
+ * \param [in] pitch1 cross hatch line distance
+ * \param [in] angle1 cross hatch angle
+ * \param [in] pitch2 cross hatch line distance
+ * \param [in] angle2 cross hatch angle
*
*/
void o_set_fill_options(TOPLEVEL *toplevel, OBJECT *o_current,
@@ -262,6 +297,41 @@ void o_set_fill_options(TOPLEVEL *toplevel, OBJECT *o_current,
}
+/*! \brief get #OBJECT's fill properties.
+ * \par Function Description
+ * This function get's the #OBJECT's fill options.
+ * See #OBJECT_FILLING for information on valid fill types.
+ *
+ * \param [in] object OBJECT to read the properties
+ * \param [out] type OBJECT_FILLING type
+ * \param [out] width fill width.
+ * \param [out] pitch1 cross hatch line distance
+ * \param [out] angle1 cross hatch angle
+ * \param [out] pitch2 cross hatch line distance
+ * \param [out] angle2 cross hatch angle
+ * \return TRUE on succes, FALSE otherwise
+ *
+ */
+gboolean o_get_fill_options(OBJECT *object,
+ OBJECT_FILLING *type, int *width,
+ int *pitch1, int *angle1,
+ int *pitch2, int *angle2)
+{
+ if (object->type != OBJ_BOX
+ && object->type != OBJ_CIRCLE
+ && object->type != OBJ_PATH)
+ return FALSE;
+
+ *type = object->fill_type;
+ *width = object->fill_width;
+ *pitch1 = object->fill_pitch1;
+ *angle1 = object->fill_angle1;
+ *pitch2 = object->fill_pitch2;
+ *angle2 = object->fill_angle2;
+
+ return TRUE;
+}
+
/*! \brief get the base position of an object
* \par Function Description
* This function gets the position of an object in world coordinates.
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs