1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 13:04:04 +02:00

- when selecting an object via the item list, make its frame active

- having variables and items on the screen at the same time was too much. We 
  can now toggle with "/" while the canvas has the focus. (This needs better 
  controls.)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5425 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-12 14:44:17 +00:00
parent a648cb888f
commit 2bae5614d9
5 changed files with 45 additions and 19 deletions

1
README
View File

@ -402,6 +402,7 @@ Space reset user coordinates
* zoom and center to extents
# zoom and center to currently active frame instance
U undelete the previously deleted object
/ Switch between variable and item display.
Canvas

View File

@ -349,6 +349,13 @@ static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event,
if (undelete())
change_world();
break;
case '/':
{
/* @@@ find a better place for this */
extern int show_vars;
show_vars = !show_vars;
change_world();
}
}
return TRUE;
}

View File

@ -30,6 +30,9 @@
#include "gui_frame.h"
int show_vars = 1;
/* ----- popup dispatcher -------------------------------------------------- */
@ -1003,7 +1006,7 @@ static GtkWidget *item_label(GtkWidget *tab, char *s, int col, int row,
static GtkWidget *build_items(struct frame *frame)
{
GtkWidget *hbox, *tab;
GtkWidget *vbox, *hbox, *tab;
struct order *order, *item;
struct vec *vec;
struct obj *obj;
@ -1017,7 +1020,11 @@ static GtkWidget *build_items(struct frame *frame)
if (obj->type != ot_meas)
n++;
vbox = gtk_vbox_new(FALSE, 0);
add_sep(vbox, 3);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
tab = gtk_table_new(n, 2, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
@ -1043,13 +1050,13 @@ static GtkWidget *build_items(struct frame *frame)
}
free(order);
return hbox;
return vbox;
}
static GtkWidget *build_meas(struct frame *frame)
{
GtkWidget *hbox, *tab;
GtkWidget *vbox, *hbox, *tab;
struct obj *obj;
int n;
char *s;
@ -1059,7 +1066,11 @@ static GtkWidget *build_meas(struct frame *frame)
if (obj->type == ot_meas)
n++;
vbox = gtk_vbox_new(FALSE, 0);
add_sep(vbox, 3);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
tab = gtk_table_new(n, 2, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
@ -1074,7 +1085,7 @@ static GtkWidget *build_meas(struct frame *frame)
n++;
}
return hbox;
return vbox;
}
@ -1277,7 +1288,7 @@ void build_frames(GtkWidget *vbox)
hbox = gtk_hbox_new(FALSE, 0);
tab = gtk_table_new(n*2+3, 3, FALSE);
tab = gtk_table_new(n*2+3, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
@ -1297,24 +1308,24 @@ void build_frames(GtkWidget *vbox)
gtk_table_attach_defaults(GTK_TABLE(tab), refs,
1, 2, n*2+1, n*2+2);
if (show_vars) {
vars = build_vars(frame);
gtk_table_attach_defaults(GTK_TABLE(tab), vars,
1, 2, n*2+2, n*2+3);
} else {
items = build_items(frame);
gtk_table_attach_defaults(GTK_TABLE(tab), items,
2, 3, n*2+2, n*2+3);
1, 2, n*2+2, n*2+3);
}
n++;
}
label = label_in_box_new(" ");
gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(label),
2, 3, n*2+1, n*2+2);
if (!show_vars) {
meas = build_meas(root_frame);
gtk_table_attach_defaults(GTK_TABLE(tab), meas,
2, 3, n*2+2, n*2+3);
1, 2, n*2+2, n*2+3);
}
gtk_widget_show_all(hbox);
}

View File

@ -17,6 +17,9 @@
#include <gtk/gtk.h>
extern int show_vars;
void make_popups(void);
void select_frame(struct frame *frame);

4
inst.c
View File

@ -303,6 +303,8 @@ void inst_select_vec(const struct vec *vec)
{
struct inst *inst;
if (vec->frame != active_frame)
select_frame(vec->frame);
for (inst = insts[ip_vec]; inst; inst = inst->next)
if (inst->vec == vec && inst->active) {
inst_deselect();
@ -318,6 +320,8 @@ void inst_select_obj(const struct obj *obj)
enum inst_prio prio;
struct inst *inst;
if (obj->frame != active_frame)
select_frame(obj->frame);
FOR_INSTS_DOWN(prio, inst)
if (inst->obj && inst->obj == obj && inst->active) {
inst_deselect();