mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-22 12:00:36 +02:00
Removing the old interface for adding frame refrences. Also updated the
documentation. - Makefile, icons/frame_locked.fig, icons/frame_ready.fig: removed the icons of locked and ready frames - gui_tool.c: removed the frame tool and all the image handling associated with it, leaving only the bits in place that are used by frame to canvas dragging - gui_tool.h, gui_tool.c (tool_frame_update, tool_frame_deleted), gui_canvas.c (key_press_event), gui_frame.c (popup_del_frame, select_frame): removed the notifications of frame changes - gui.html: removed the old clumsy frame reference procedure and described the new way git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5937 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
84e03e5542
commit
af0d2c78cb
2
Makefile
2
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 \
|
||||
|
46
gui.html
46
gui.html
@ -93,7 +93,32 @@ Frames serve various purposes:
|
||||
a pad.
|
||||
<LI> To define a repetition through a loop or a table.
|
||||
<LI> To set variables for child frames.
|
||||
</UL
|
||||
</UL>
|
||||
|
||||
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".
|
||||
<P>
|
||||
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
|
||||
<I>frame reference</I>. 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:
|
||||
<P>
|
||||
<UL>
|
||||
<LI> Click on the parent frame to select it.
|
||||
<LI> Press the left mouse button on the frame you wish to reference
|
||||
and drag it (move the mouse pointer while keeping the left button
|
||||
pressed) into the canvas. When dragging, the mouse cursor changes
|
||||
to show a hand.
|
||||
<LI> When the mouse pointer is above a suitable point of attachment,
|
||||
the point of attachment is highlighted with a red circle and the
|
||||
mouse cursor changes to show a hand with a plus sign.
|
||||
<LI> At the desired location, release the mouse button.
|
||||
</UL>
|
||||
|
||||
If you wish to cancel the operation, simply release the mouse button at
|
||||
any place that isn't a point of attachment.
|
||||
|
||||
|
||||
<H1>Variables</H1>
|
||||
@ -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.
|
||||
<DT><IMG src="manual/frame.png"> <IMG src="manual/frame_locked.png">
|
||||
<IMG src="manual/frame_ready.png">
|
||||
<DD> Add a frame reference. A frame reference inserts the content of a
|
||||
frame into another frame. There are three steps in this process:
|
||||
<UL>
|
||||
<LI> Select the frame to be inserted and click on the frame icon.
|
||||
A large black dot appears in the icon to indicate that a frame
|
||||
reference has been chosen.
|
||||
<LI> Select the frame into which to insert the reference. The dot
|
||||
changes to green to indicate that the reference can now be placed.
|
||||
If the dot stays black, then the selected frame is not a valid
|
||||
destination, i.e., because the reference in turn references this
|
||||
frame.
|
||||
<LI> Click on the location at which to attach the reference. This
|
||||
location can be either the end of a vector or the frame's origin.
|
||||
</UL>
|
||||
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.
|
||||
<DT><IMG src="manual/pad.png"> <IMG src="manual/rpad.png">
|
||||
<DD> Add a pad. Pads are either rectangular or rounded. They are
|
||||
defined by two points which are opposite corners of the rectangle
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
61
gui_tool.c
61
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]);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue
Block a user