1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-06-24 16:11:40 +03:00

- new visualization option: show all frames or show only current frame

- new visualization option: highlight pads and silk ("final" view)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5527 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-22 19:00:55 +00:00
parent 5a2eb77629
commit 63e60182bb
10 changed files with 175 additions and 6 deletions

View File

@ -22,7 +22,8 @@ XPMS = point.xpm delete.xpm delete_off.xpm \
vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \
line.xpm rect.xpm pad.xpm rpad.xpm circ.xpm \
meas.xpm meas_x.xpm meas_y.xpm \
stuff.xpm stuff_off.xpm meas_off.xpm
stuff.xpm stuff_off.xpm meas_off.xpm \
bright.xpm bright_off.xpm all.xpm all_off.xpm
SHELL = /bin/bash
CFLAGS_GTK = `pkg-config --cflags gtk+-2.0`

53
gui.c
View File

@ -27,16 +27,23 @@
#include "icons/stuff_off.xpm"
#include "icons/meas.xpm"
#include "icons/meas_off.xpm"
#include "icons/all.xpm"
#include "icons/all_off.xpm"
#include "icons/bright.xpm"
#include "icons/bright_off.xpm"
GtkWidget *root;
int show_all = 1;
int show_stuff = 1;
int show_meas = 1;
int show_bright = 0;
static GtkWidget *frames_box;
static GtkWidget *ev_stuff, *ev_meas;
static GtkWidget *stuff_image[2], *meas_image[2];
static GtkWidget *ev_stuff, *ev_meas, *ev_all, *ev_bright;
static GtkWidget *stuff_image[2], *meas_image[2], *all_image[2];
static GtkWidget *bright_image[2];
/* ----- view callbacks ---------------------------------------------------- */
@ -87,6 +94,21 @@ static void make_menu_bar(GtkWidget *hbox)
}
static gboolean toggle_all(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
switch (event->button) {
case 1:
show_all = !show_all;
set_image(ev_all, all_image[show_all]);
inst_deselect();
redraw();
break;
}
return TRUE;
}
static gboolean toggle_stuff(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
@ -117,6 +139,21 @@ static gboolean toggle_meas(GtkWidget *widget, GdkEventButton *event,
}
static gboolean toggle_bright(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
switch (event->button) {
case 1:
show_bright = !show_bright;
set_image(ev_bright, bright_image[show_bright]);
inst_deselect();
redraw();
break;
}
return TRUE;
}
static void make_tool_bar(GtkWidget *hbox, GdkDrawable *drawable)
{
GtkWidget *bar;
@ -126,16 +163,24 @@ static void make_tool_bar(GtkWidget *hbox, GdkDrawable *drawable)
//gtk_box_pack_end(GTK_BOX(hbox), bar, FALSE, FALSE, 0);
gtk_toolbar_set_style(GTK_TOOLBAR(bar), GTK_TOOLBAR_ICONS);
ev_all = tool_button(bar, drawable, NULL, toggle_all, NULL);
ev_stuff = tool_button(bar, drawable, NULL, toggle_stuff, NULL);
ev_meas = tool_button(bar, drawable, NULL, toggle_meas, NULL);
ev_bright = tool_button(bar, drawable, NULL, toggle_bright, NULL);
stuff_image[0] = gtk_widget_ref(make_image(drawable, xpm_stuff_off));
stuff_image[1] = gtk_widget_ref(make_image(drawable, xpm_stuff));
meas_image[0] = gtk_widget_ref(make_image(drawable, xpm_meas_off));
meas_image[1] = gtk_widget_ref(make_image(drawable, xpm_meas));
all_image[0] = gtk_widget_ref(make_image(drawable, xpm_all_off));
all_image[1] = gtk_widget_ref(make_image(drawable, xpm_all));
bright_image[0] = gtk_widget_ref(make_image(drawable, xpm_bright_off));
bright_image[1] = gtk_widget_ref(make_image(drawable, xpm_bright));
set_image(ev_stuff, stuff_image[show_stuff]);
set_image(ev_meas, meas_image[show_meas]);
set_image(ev_all, all_image[show_all]);
set_image(ev_bright, bright_image[show_bright]);
}
@ -145,6 +190,10 @@ static void cleanup_tool_bar(void)
g_object_unref(stuff_image[1]);
g_object_unref(meas_image[0]);
g_object_unref(meas_image[1]);
g_object_unref(all_image[0]);
g_object_unref(all_image[1]);
g_object_unref(bright_image[0]);
g_object_unref(bright_image[1]);
}

2
gui.h
View File

@ -18,8 +18,10 @@
extern GtkWidget *root;
extern int show_all;
extern int show_stuff;
extern int show_meas;
extern int show_bright;
/* update everything after a model change */

View File

@ -111,7 +111,7 @@ static enum mode get_mode(struct inst *self)
{
if (selected_inst == self)
return mode_selected;
return self->active ? mode_active : mode_inactive;
return self->active || bright(self) ? mode_active : mode_inactive;
}

22
icons/all.fig Normal file
View File

@ -0,0 +1,22 @@
#FIG 3.2 Produced by xfig version 3.2.5a
Landscape
Center
Inches
A4
100.00
Single
-2
1200 2
0 32 #c0c000
6 4350 3225 5625 4425
2 1 0 15 13 7 50 -1 -1 0.000 1 1 -1 0 0 2
4500 3825 5475 3825
2 1 0 15 13 7 50 -1 -1 0.000 1 1 -1 0 0 2
4650 3375 5250 4275
2 1 0 15 13 7 50 -1 -1 0.000 1 1 -1 0 0 2
5250 3375 4650 4275
-6
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 1 -1 0 0 3
3900 3690 3900 2850 5700 2850

22
icons/all_off.fig Normal file
View File

@ -0,0 +1,22 @@
#FIG 3.2 Produced by xfig version 3.2.5a
Landscape
Center
Inches
A4
100.00
Single
-2
1200 2
0 32 #c0c000
6 4350 3225 5625 4425
2 1 0 15 0 7 50 -1 -1 0.000 1 1 -1 0 0 2
4650 3375 5250 4275
2 1 0 15 0 7 50 -1 -1 0.000 1 1 -1 0 0 2
5250 3375 4650 4275
2 1 0 15 0 7 50 -1 -1 0.000 1 1 -1 0 0 2
4500 3825 5475 3825
-6
2 2 0 1 0 7 60 -1 10 0.000 0 0 -1 0 0 5
3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
2 1 0 10 0 7 50 -1 -1 0.000 0 1 -1 0 0 3
3900 3690 3900 2850 5700 2850

24
icons/bright.fig Normal file
View File

@ -0,0 +1,24 @@
#FIG 3.2 Produced by xfig version 3.2.5a
Landscape
Center
Inches
A4
100.00
Single
-2
1200 2
0 32 #b0ffff
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 2 0 0 0 4 50 -1 20 0.000 0 0 -1 0 0 5
4200 3150 4650 3150 4650 4050 4200 4050 4200 3150
2 2 0 0 0 4 50 -1 20 0.000 0 0 -1 0 0 5
4950 3150 5400 3150 5400 4050 4950 4050 4950 3150
2 2 0 10 3 7 50 -1 -1 0.000 0 0 -1 0 0 5
3900 2850 5700 2850 5700 4350 3900 4350 3900 2850
2 2 0 15 29 7 60 -1 -1 0.000 0 0 -1 0 0 5
4950 3150 5400 3150 5400 4050 4950 4050 4950 3150
2 2 0 15 29 7 60 -1 -1 0.000 0 0 -1 0 0 5
4200 3150 4650 3150 4650 4050 4200 4050 4200 3150
2 2 0 20 32 7 60 -1 -1 0.000 0 0 -1 0 0 5
3900 2850 5700 2850 5700 4350 3900 4350 3900 2850

18
icons/bright_off.fig Normal file
View File

@ -0,0 +1,18 @@
#FIG 3.2 Produced by xfig version 3.2.5a
Landscape
Center
Inches
A4
100.00
Single
-2
1200 2
0 32 #b0ffff
2 2 0 0 0 19 50 -1 20 0.000 0 0 -1 0 0 5
4200 3150 4650 3150 4650 4050 4200 4050 4200 3150
2 2 0 0 0 19 50 -1 20 0.000 0 0 -1 0 0 5
4950 3150 5400 3150 5400 4050 4950 4050 4950 3150
2 2 0 1 0 7 65 -1 10 0.000 0 0 -1 0 0 5
3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
2 2 0 10 16 7 50 -1 -1 0.000 0 0 -1 0 0 5
3900 2850 5700 2850 5700 4350 3900 4350 3900 2850

33
inst.c
View File

@ -41,6 +41,7 @@ static unsigned long active_set = 0;
static struct inst_ops vec_ops;
static struct inst_ops frame_ops;
static struct inst_ops meas_ops;
#define IS_ACTIVE ((active_set & 1))
@ -63,6 +64,27 @@ static int show(enum inst_prio prio)
}
int bright(const struct inst *inst)
{
if (!show_bright)
return 0;
return inst->ops != &vec_ops && inst->ops != &frame_ops &&
inst->ops != &meas_ops;
}
static int show_this(const struct inst *inst)
{
if (show_all)
return 1;
if (inst->ops == &frame_ops && inst->u.frame.ref == active_frame)
return 1;
if (!inst->outer)
return active_frame == root_frame;
return inst->outer->u.frame.ref == active_frame;
}
/* ----- selection of items not on the canvas ------------------------------ */
@ -176,6 +198,8 @@ int inst_select(struct coord pos)
if (!show(prio))
continue;
FOR_ALL_INSTS(i, prio, inst) {
if (!show_this(inst))
continue;
if (!inst->ops->distance)
continue;
if (!inst_connected(inst))
@ -228,6 +252,9 @@ int inst_select(struct coord pos)
goto selected;
}
if (!show_all)
return 0;
if (any_same_frame) {
if (activate_item(any_same_frame))
return inst_select(pos);
@ -1148,8 +1175,10 @@ void inst_draw(void)
FOR_INST_PRIOS_UP(prio)
FOR_ALL_INSTS(i, prio, inst)
if (show(prio) && !inst->active && inst->ops->draw)
inst->ops->draw(inst);
if (show_this(inst))
if (show(prio) && !inst->active &&
inst->ops->draw)
inst->ops->draw(inst);
FOR_INST_PRIOS_UP(prio)
FOR_ALL_INSTS(i, prio, inst)
if (show(prio) && prio != ip_frame && inst->active &&

2
inst.h
View File

@ -147,6 +147,8 @@ extern struct inst *curr_frame;
FOR_PKG_INSTS(i ? active_pkg : pkgs, prio, inst)
int bright(const struct inst *inst);
void inst_select_outside(void *item, void (*deselect)(void *item));
int inst_select(struct coord pos);
void inst_deselect(void);