[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-268-g79da812)



The branch, master has been updated
       via  79da8125fa7ac7a005710ed2a6340004a66402a5 (commit)
       via  fba1fe91258e62ad0d5ffd685adad93336542e30 (commit)
       via  91cef383fbeaa0f48afe404f15ac39009f41fda7 (commit)
      from  01a544083a1161bfae9a976962823488e09b0ed7 (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 |    4 +-
 gschem/src/o_arc.c         |    9 +++--
 gschem/src/o_grips.c       |   13 ++-----
 gschem/src/o_misc.c        |    3 ++
 gschem/src/x_dialog.c      |   73 ++++++++++++++++++++++++++++++++++---------
 gschem/src/x_event.c       |    2 +-
 6 files changed, 72 insertions(+), 32 deletions(-)


=================
 Commit Messages
=================

commit 79da8125fa7ac7a005710ed2a6340004a66402a5
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Tue Oct 28 19:40:04 2008 +0100

    gschem: removed unsnapped arc modification special case
    
    When using the grips to modify an arc, then always unsnapped coords
    have been used. There two reasons to remove that:
    
    * it's a special case that is not neccessary as the user can easily
      switch off the snapping to get the unsnapped behaviour
    
    * with snapped arcs it's easier to draw 45° and 90° arcs

:100644 100644 29f8b37... 11dc1c3... M	gschem/src/o_grips.c
:100644 100644 d35597f... 4c4eab1... M	gschem/src/x_event.c

commit fba1fe91258e62ad0d5ffd685adad93336542e30
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Tue Oct 28 19:38:52 2008 +0100

    gschem: use the arc dialog to modify arc objects
    
    Using edit->edit now raises the arc dialog. The properties of the arc
    can be modified and applied. The arc needs to be the first or only
    element of the selection list.

:100644 100644 650ccf6... 51ce397... M	gschem/include/prototype.h
:100644 100644 d032071... 5b44c70... M	gschem/src/o_arc.c
:100644 100644 4d54d51... f14f09f... M	gschem/src/o_misc.c
:100644 100644 c4a03a6... 63f162f... M	gschem/src/x_dialog.c

commit 91cef383fbeaa0f48afe404f15ac39009f41fda7
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Mon Oct 27 20:59:47 2008 +0100

    gschem: added radius to the arc angle dialog
    
    Now you can set the radius, too, when creating an arc.

:100644 100644 f908976... 650ccf6... M	gschem/include/prototype.h
:100644 100644 984c83e... d032071... M	gschem/src/o_arc.c
:100644 100644 91cf52d... c4a03a6... M	gschem/src/x_dialog.c

=========
 Changes
=========

commit 79da8125fa7ac7a005710ed2a6340004a66402a5
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Tue Oct 28 19:40:04 2008 +0100

    gschem: removed unsnapped arc modification special case
    
    When using the grips to modify an arc, then always unsnapped coords
    have been used. There two reasons to remove that:
    
    * it's a special case that is not neccessary as the user can easily
      switch off the snapping to get the unsnapped behaviour
    
    * with snapped arcs it's easier to draw 45° and 90° arcs

diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 29f8b37..11dc1c3 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -539,8 +539,8 @@ OBJECT *o_grips_search_line_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
  *  of the grip and the object it belongs to respectively.
  *
  *  \param [in]  w_current  The GSCHEM_TOPLEVEL object.
- *  \param [in]  w_x        Current x coordinate of pointer in screen units.
- *  \param [in]  w_y        Current y coordinate of pointer in screen units.
+ *  \param [in]  w_x        Current x coordinate of pointer in world units.
+ *  \param [in]  w_y        Current y coordinate of pointer in world units.
  *  \return FALSE if an error occurred or no grip was found, TRUE otherwise.
  */
 int o_grips_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
@@ -956,22 +956,17 @@ void o_grips_start_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
  *  \param [in] w_x        Current x coordinate of pointer in world units.
  *  \param [in] w_y        Current y coordinate of pointer in world units.
  */
-void o_grips_motion(GSCHEM_TOPLEVEL *w_current, int unsnapped_wx, int unsnapped_wy)
+void o_grips_motion(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
-  int w_x, w_y;
   int grip = w_current->which_grip;
 
-  w_x = snap_grid(toplevel, unsnapped_wx);
-  w_y = snap_grid(toplevel, unsnapped_wy);
-
   g_assert( w_current->inside_action != 0 );
   g_return_if_fail( w_current->which_object != NULL );
 
   switch(w_current->which_object->type) {
     case(OBJ_ARC):
     /* erase, update and draw an arc */
-    o_grips_motion_arc (w_current, unsnapped_wx, unsnapped_wy, grip);
+    o_grips_motion_arc (w_current, w_x, w_y, grip);
     break;
 
     case(OBJ_BOX):
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index d35597f..4c4eab1 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -784,7 +784,7 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
     break;
 
     case(GRIPS):
-    o_grips_motion(w_current, unsnapped_wx, unsnapped_wy);
+      o_grips_motion(w_current, w_x, w_y);
     break;
 
     case(STARTSELECT):

commit fba1fe91258e62ad0d5ffd685adad93336542e30
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Tue Oct 28 19:38:52 2008 +0100

    gschem: use the arc dialog to modify arc objects
    
    Using edit->edit now raises the arc dialog. The properties of the arc
    can be modified and applied. The arc needs to be the first or only
    element of the selection list.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 650ccf6..51ce397 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -779,7 +779,7 @@ 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 arc_angle_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);
 void snap_size_dialog(GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index d032071..5b44c70 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -924,8 +924,7 @@ void o_arc_end1(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 #endif
 
   /* open a dialog to input the start and end angle */
-  arc_angle_dialog(w_current);
-  
+  arc_angle_dialog(w_current, NULL);
 }
 
 /*! \brief Ends the process of arc input.
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 4d54d51..f14f09f 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -77,6 +77,9 @@ void o_edit(GSCHEM_TOPLEVEL *w_current, GList *list)
     case(OBJ_PICTURE):
     picture_change_filename_dialog(w_current);
     break;
+    case(OBJ_ARC):
+    arc_angle_dialog(w_current, o_current);
+    break;
     case(OBJ_TEXT):
       str = o_text_get_string (w_current->toplevel, o_current);
       if (o_attrib_get_name_value (str, NULL, NULL) &&
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index c4a03a6..63f162f 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -1425,6 +1425,7 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
 {
   GtkWidget *spinentry;
   gint radius, start_angle, sweep_angle;
+  OBJECT *arc_object = NULL;
 
   switch (response) {
   case GTK_RESPONSE_REJECT:
@@ -1438,8 +1439,17 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
     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));
-
-    o_arc_end4(w_current, radius, start_angle, sweep_angle);
+    arc_object = (OBJECT*) g_object_get_data(G_OBJECT(w_current->aawindow),"arc_object");
+
+    if (arc_object != NULL) {
+      o_erase_selected(w_current);
+      o_arc_modify(w_current->toplevel, arc_object, radius, 0, ARC_RADIUS);
+      o_arc_modify(w_current->toplevel, arc_object, start_angle, 0, ARC_START_ANGLE);
+      o_arc_modify(w_current->toplevel, arc_object, sweep_angle, 0, ARC_END_ANGLE);
+      o_draw_selected(w_current);
+    } else {
+      o_arc_end4(w_current, radius, start_angle, sweep_angle);
+    }
     break;
   default:
     printf("arc_angle_dialog_response(): strange signal %d\n",response);
@@ -1451,9 +1461,15 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
 
 /*! \brief Creates the arc angle dialog
  *  \par Function Description
- *  This function create the arc angle dialog.
+ *  This function creates the arc angle dialog. Depending on the 
+ *  \a arc_object the entries are filled with the arc OBJECT properties
+ *  or with some standard values.
+ *
+ *  \param [in] w_current   The GSCHEM_TOPLEVEL object
+ *  \param [in] arc_object  an arc OBJECT if used to modify an arc
+ *                          or NULL to create a new arc.
  */
-void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
+void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current, OBJECT *arc_object)
 {
   GtkWidget *label = NULL;
   GtkWidget *vbox;
@@ -1506,8 +1522,6 @@ void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
     gtk_table_attach(GTK_TABLE(table), label, 0,1,0,1, GTK_FILL,0,0,0);
 
     radius = gtk_spin_button_new_with_range(1, 100000, 100);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(radius), w_current->distance);
-    gtk_widget_grab_focus(radius);
     gtk_entry_set_activates_default(GTK_ENTRY(radius), TRUE);
     gtk_table_attach_defaults(GTK_TABLE(table), radius, 1,2,0,1);
 
@@ -1516,7 +1530,6 @@ void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
     gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2, GTK_FILL,0,0,0);
 
     spin_start = gtk_spin_button_new_with_range(-360,360,1);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_start),0);
     gtk_entry_set_activates_default(GTK_ENTRY(spin_start), TRUE);
     gtk_table_attach_defaults(GTK_TABLE(table), spin_start, 1,2,1,2);
 
@@ -1525,19 +1538,37 @@ void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
     gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3, 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_entry_set_activates_default(GTK_ENTRY(spin_sweep), TRUE);
     gtk_table_attach_defaults(GTK_TABLE(table), spin_sweep, 1,2,2,3);
 
     GLADE_HOOKUP_OBJECT(w_current->aawindow, radius, "radius");
     GLADE_HOOKUP_OBJECT(w_current->aawindow, spin_start,"spin_start");
     GLADE_HOOKUP_OBJECT(w_current->aawindow, spin_sweep,"spin_sweep");
+    g_object_set_data(G_OBJECT(w_current->aawindow), "arc_object", arc_object);
     gtk_widget_show_all (w_current->aawindow);
   }
 
   else {  /* dialog already created */
     gtk_window_present (GTK_WINDOW(w_current->aawindow));
+    radius = g_object_get_data(G_OBJECT(w_current->aawindow),"radius");
+    spin_start = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_start");
+    spin_sweep = g_object_get_data(G_OBJECT(w_current->aawindow),"spin_sweep");
   }
+
+  if (arc_object == NULL) {
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(radius), w_current->distance);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_start),0);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_sweep), 90);
+  } else {
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(radius), 
+			      arc_object->arc->width / 2);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_start),
+			      arc_object->arc->start_angle);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_sweep),
+			      arc_object->arc->end_angle);
+  }
+
+  gtk_widget_grab_focus(radius);
 }
 
 /***************** End of Arc dialog box *****************************/

commit 91cef383fbeaa0f48afe404f15ac39009f41fda7
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Mon Oct 27 20:59:47 2008 +0100

    gschem: added radius to the arc angle dialog
    
    Now you can set the radius, too, when creating an arc.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index f908976..650ccf6 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -469,7 +469,7 @@ void o_arc_eraserubber(GSCHEM_TOPLEVEL *w_current);
 void o_arc_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
 void o_arc_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_arc_end1(GSCHEM_TOPLEVEL *w_current, int x, int y);
-void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int start_angle, int end_angle);
+void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int radius, int start_angle, int end_angle);
 void o_arc_rubberarc(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
 void o_arc_rubberarc_xor(GSCHEM_TOPLEVEL *w_current);
 void o_arc_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index 984c83e..d032071 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -937,10 +937,12 @@ void o_arc_end1(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
  *  A new object is created and linked to the object list.
  *
  *  \param [in] w_current    The GSCHEM_TOPLEVEL object.
+ *  \param [in] radius       Radius of the arc
  *  \param [in] start_angle  Start of angle in degrees.
  *  \param [in] end_angle    End of angle in degrees.
  */
-void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int start_angle, int end_angle)
+void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int radius, 
+		int start_angle, int end_angle)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *new_obj;
@@ -948,7 +950,7 @@ void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int start_angle, int end_angle)
   /* create, initialize and link the new arc object */
   new_obj = o_arc_new(toplevel, OBJ_ARC, w_current->graphic_color,
                       w_current->first_wx, w_current->first_wy,
-                      w_current->distance, start_angle, end_angle);
+                      radius, start_angle, end_angle);
   toplevel->page_current->object_tail =
     s_basic_link_object(new_obj, toplevel->page_current->object_tail);
 
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 91cf52d..c4a03a6 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -1424,7 +1424,7 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
                                GSCHEM_TOPLEVEL *w_current)
 {
   GtkWidget *spinentry;
-  gint start_angle, sweep_angle;
+  gint radius, start_angle, sweep_angle;
 
   switch (response) {
   case GTK_RESPONSE_REJECT:
@@ -1432,12 +1432,14 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
     /* void */
     break;
   case GTK_RESPONSE_ACCEPT:
+    spinentry = g_object_get_data(G_OBJECT(w_current->aawindow),"radius");
+    radius = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spinentry));
     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));
 
-    o_arc_end4(w_current, start_angle, sweep_angle);
+    o_arc_end4(w_current, radius, start_angle, sweep_angle);
     break;
   default:
     printf("arc_angle_dialog_response(): strange signal %d\n",response);
@@ -1445,7 +1447,6 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
 
   gtk_widget_destroy(w_current->aawindow);
   w_current->aawindow = NULL;
-  w_current->event_state = DRAWARC;
 }
 
 /*! \brief Creates the arc angle dialog
@@ -1457,7 +1458,7 @@ void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
   GtkWidget *label = NULL;
   GtkWidget *vbox;
   GtkWidget *alignment, *table;
-  GtkWidget *spin_start, *spin_sweep;
+  GtkWidget *radius, *spin_start, *spin_sweep;
 
   if (!w_current->aawindow) {
     w_current->aawindow = gschem_dialog_new_with_buttons(_("Arc Params"),
@@ -1495,31 +1496,40 @@ void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
                               0 /*DIALOG_INDENTATION */, 0);
     gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
 
-    table = gtk_table_new (2, 2, FALSE);
+    table = gtk_table_new (2, 3, 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 (_("Start Angle:"));
+    label = gtk_label_new (_("Arc Radius:"));
     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);
 
+    radius = gtk_spin_button_new_with_range(1, 100000, 100);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(radius), w_current->distance);
+    gtk_widget_grab_focus(radius);
+    gtk_entry_set_activates_default(GTK_ENTRY(radius), TRUE);
+    gtk_table_attach_defaults(GTK_TABLE(table), radius, 1,2,0,1);
+
+    label = gtk_label_new (_("Start Angle:"));
+    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_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);
+    gtk_table_attach_defaults(GTK_TABLE(table), spin_start, 1,2,1,2);
 
     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);
+    gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3, 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);
+    gtk_table_attach_defaults(GTK_TABLE(table), spin_sweep, 1,2,2,3);
 
+    GLADE_HOOKUP_OBJECT(w_current->aawindow, radius, "radius");
     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);



_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs