diff --git a/Makefile b/Makefile index bb14f3f..bbf77e0 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ OBJS = fped.o expr.o coord.o obj.o delete.o inst.o util.o error.o \ gui_tool.o gui_over.o gui_meas.o gui_frame.o gui_frame_drag.o XPMS = point.xpm delete.xpm delete_off.xpm \ - vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \ + vec.xpm frame.xpm \ line.xpm rect.xpm pad.xpm rpad.xpm arc.xpm circ.xpm \ meas.xpm meas_x.xpm meas_y.xpm \ stuff.xpm stuff_off.xpm meas_off.xpm \ diff --git a/gui.html b/gui.html index cfa206a..1be0ed9 100644 --- a/gui.html +++ b/gui.html @@ -93,7 +93,32 @@ Frames serve various purposes: a pad.
  • To define a repetition through a loop or a table.
  • To set variables for child frames. - + +At the bottom of the hierarchy, we have the root frame. To add another +frame, right-click on the root frame's label "(root)" and select "Add +frame". +

    +To be able to put items into the new frame, it has to be attached to +the root frame (or to any other frame that's attached). This is called a +frame reference. First, we need a place to attach it to. This +can be the origin of its parent frame or it can be the end of a vector +in the parent frame. To create the frame reference, do this: +

    +

    + +If you wish to cancel the operation, simply release the mouse button at +any place that isn't a point of attachment.

    Variables

    @@ -191,25 +216,6 @@ Tools are used to add new elements and to manipulate existing ones. Note that the starting point of the vector has to be in the same frame as the vector being drawn. This limitation also applies to points defining pads and silk-screen items. -
      -   -
    Add a frame reference. A frame reference inserts the content of a - frame into another frame. There are three steps in this process: - - When finished, don't forget that the destination frame is still selected. - In order to add elements to the newly referenced frame, you have to - select it first.
     
    Add a pad. Pads are either rectangular or rounded. They are defined by two points which are opposite corners of the rectangle diff --git a/gui_canvas.c b/gui_canvas.c index 6b64cc8..ed60005 100644 --- a/gui_canvas.c +++ b/gui_canvas.c @@ -441,7 +441,6 @@ static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event, case GDK_KP_Delete: if (selected_inst) { inst_delete(selected_inst); - tool_frame_update(); change_world(); } break; diff --git a/gui_frame.c b/gui_frame.c index bd6943e..866c1c4 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -130,7 +130,6 @@ static void popup_del_frame(void) struct frame *frame = popup_data; assert(frame != root_frame); - tool_frame_deleted(frame); delete_frame(frame); if (active_frame == frame) select_frame(root_frame); @@ -1680,7 +1679,6 @@ void select_frame(struct frame *frame) if (active_frame) label_in_box_bg(active_frame->label, COLOR_FRAME_UNSELECTED); active_frame = frame; - tool_frame_update(); change_world(); } diff --git a/gui_tool.c b/gui_tool.c index cdc1bc0..dc0e34b 100644 --- a/gui_tool.c +++ b/gui_tool.c @@ -34,8 +34,6 @@ #include "icons/arc.xpm" #include "icons/circ.xpm" #include "icons/frame.xpm" -#include "icons/frame_locked.xpm" -#include "icons/frame_ready.xpm" #include "icons/line.xpm" #include "icons/meas.xpm" #include "icons/meas_x.xpm" @@ -49,11 +47,10 @@ #include "icons/vec.xpm" -static GtkWidget *ev_point, *ev_delete, *ev_frame; +static GtkWidget *ev_point, *ev_delete; static GtkWidget *active_tool; static struct tool_ops *active_ops = NULL; static struct inst *hover_inst = NULL; -static GtkWidget *frame_image, *frame_image_locked, *frame_image_ready; static GtkWidget *delete_image[2]; static struct drag_state { @@ -591,47 +588,12 @@ static int is_parent_of(const struct frame *p, const struct frame *c) } -/* ----- frame cache ------------------------------------------------------- */ +/* ----- frame ------------------------------------------------------------- */ static struct frame *locked_frame = NULL; -static void set_frame_image(GtkWidget *image) -{ - set_image(ev_frame, image); -} - - -void tool_frame_update(void) -{ - set_frame_image(!locked_frame ? frame_image : - is_parent_of(locked_frame, active_frame) ? - frame_image_locked : frame_image_ready); -} - - -void tool_frame_deleted(const struct frame *frame) -{ - if (frame == locked_frame) { - locked_frame = NULL; - set_frame_image(frame_image); - } -} - - -static void tool_selected_frame(void) -{ - if (active_frame != root_frame) { - locked_frame = active_frame; - set_frame_image(frame_image_locked); - } -} - - -/* ----- frame ------------------------------------------------------------- */ - - struct pix_buf *draw_move_frame(struct inst *inst, struct coord pos, int i) { struct pix_buf *buf; @@ -663,14 +625,13 @@ static int end_new_frame(struct inst *from, struct inst *to) if (!locked_frame->active_ref) locked_frame->active_ref = obj; locked_frame = NULL; - tool_frame_update(); tool_reset(); return 1; } static struct tool_ops frame_ops = { - .tool_selected = tool_selected_frame, + .tool_selected = NULL, .drag_new = NULL, .end_new = end_new_frame, }; @@ -1199,8 +1160,6 @@ GtkWidget *gui_setup_tools(GdkDrawable *drawable) tool_button(bar, drawable, xpm_vec, "Add a vector", tool_button_press_event, &vec_ops); - ev_frame = tool_button(bar, drawable, NULL, NULL, - tool_button_press_event, &frame_ops); tool_button(bar, drawable, xpm_pad, "Add a rectangular pad", tool_button_press_event, &pad_ops); @@ -1227,17 +1186,6 @@ GtkWidget *gui_setup_tools(GdkDrawable *drawable) "Add a vertical measurement", tool_button_press_event, &tool_meas_ops_y); - frame_image = gtk_widget_ref(make_image(drawable, xpm_frame, - "Step 1: select the current frame for insertion")); - frame_image_locked = - gtk_widget_ref(make_image(drawable, xpm_frame_locked, - "Step 2: select the frame into which to insert")); - frame_image_ready = - gtk_widget_ref(make_image(drawable, xpm_frame_ready, - "Final step: add the frame reference to an anchor point " - "(vector or origin)")); - set_frame_image(frame_image); - delete_image[0] = gtk_widget_ref(make_image(drawable, xpm_delete_off, NULL)); delete_image[1] = gtk_widget_ref(make_image(drawable, xpm_delete, @@ -1252,9 +1200,6 @@ GtkWidget *gui_setup_tools(GdkDrawable *drawable) void gui_cleanup_tools(void) { - g_object_unref(frame_image); - g_object_unref(frame_image_locked); - g_object_unref(frame_image_ready); g_object_unref(delete_image[0]); g_object_unref(delete_image[1]); } diff --git a/gui_tool.h b/gui_tool.h index 048e32e..c3bd48b 100644 --- a/gui_tool.h +++ b/gui_tool.h @@ -65,14 +65,6 @@ struct pix_buf *draw_move_line_common(struct inst *inst, struct coord end, struct coord pos, int i); struct pix_buf *drag_new_line(struct inst *from, struct coord to); - -/* - * Cache the frame and track it. - */ - -void tool_frame_update(void); -void tool_frame_deleted(const struct frame *frame); - void tool_push_frame(struct frame *frame); int tool_place_frame(struct frame *frame, struct coord pos); void tool_pop_frame(void); diff --git a/icons/frame_locked.fig b/icons/frame_locked.fig deleted file mode 100644 index ebab309..0000000 --- a/icons/frame_locked.fig +++ /dev/null @@ -1,17 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5a -Landscape -Center -Inches -A4 -100.00 -Single --2 -1200 2 -6 3750 3225 5775 4200 -2 1 0 10 12 7 50 -1 -1 0.000 0 0 -1 0 0 3 - 3900 4125 3900 3525 5700 3525 -4 0 12 50 -1 22 42 0.0000 4 135 450 3750 3375 FRAME\001 --6 -1 3 0 0 0 0 50 -1 20 0.000 1 0.0000 5400 4200 375 375 5400 4200 5775 4200 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400 diff --git a/icons/frame_ready.fig b/icons/frame_ready.fig deleted file mode 100644 index 5552cc0..0000000 --- a/icons/frame_ready.fig +++ /dev/null @@ -1,15 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5a -Landscape -Center -Inches -A4 -100.00 -Single --2 -1200 2 -1 3 0 0 0 12 50 -1 20 0.000 1 0.0000 5400 4200 375 375 5400 4200 5775 4200 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400 -2 1 0 10 12 7 50 -1 -1 0.000 0 0 -1 0 0 3 - 3900 4125 3900 3525 5700 3525 -4 0 12 50 -1 22 42 0.0000 4 135 450 3750 3375 FRAME\001