mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-22 13:37:31 +02:00
- keyboard functions for the canvas: - zoom out, + or = zoom in, . center,
* zoom and center to extents - variables in tables weren't properly initialized, causing stray recursive evaluation errors - replaced table->active index with table->active_row pointer - added row selection - for fun, added tab.fpd row selection example git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5375 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
e455b37abb
commit
e1e758b54f
12
README
12
README
@ -337,3 +337,15 @@ Expressions
|
|||||||
Expressions can contain numeric constants (in non-exponential notation),
|
Expressions can contain numeric constants (in non-exponential notation),
|
||||||
variable names, the arithmetic operations +, -, *, /, and unary -.
|
variable names, the arithmetic operations +, -, *, /, and unary -.
|
||||||
Parentheses can be used to change precedence.
|
Parentheses can be used to change precedence.
|
||||||
|
|
||||||
|
|
||||||
|
GUI
|
||||||
|
---
|
||||||
|
|
||||||
|
Keys:
|
||||||
|
|
||||||
|
space reset user coordinates
|
||||||
|
+, = zoom in (like mouse wheel forward)
|
||||||
|
- zoom out (like mouse wheel backward)
|
||||||
|
. cursor position to screen center (like middle click)
|
||||||
|
* zoom and center to extents
|
||||||
|
1
TODO
1
TODO
@ -1,5 +1,4 @@
|
|||||||
Missing features:
|
Missing features:
|
||||||
- add row selection
|
|
||||||
- populate input area (still needed: mm/mil, rezoom)
|
- populate input area (still needed: mm/mil, rezoom)
|
||||||
- add vec editor (need to be able to edit name, x, and y)
|
- add vec editor (need to be able to edit name, x, and y)
|
||||||
- add obj editor
|
- add obj editor
|
||||||
|
2
fpd.l
2
fpd.l
@ -121,6 +121,8 @@ SP [\t ]*
|
|||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
lineno++; }
|
lineno++; }
|
||||||
|
|
||||||
|
; BEGIN(INITIAL);
|
||||||
|
|
||||||
"{" { BEGIN(NOKEYWORD);
|
"{" { BEGIN(NOKEYWORD);
|
||||||
disable_keywords = is_table;
|
disable_keywords = is_table;
|
||||||
return '{'; }
|
return '{'; }
|
||||||
|
4
fpd.y
4
fpd.y
@ -249,7 +249,7 @@ table:
|
|||||||
$$ = $<table>2;
|
$$ = $<table>2;
|
||||||
$$->vars = $4;
|
$$->vars = $4;
|
||||||
$$->rows = $6;
|
$$->rows = $6;
|
||||||
$$->active = 0;
|
$$->active_row = $6;
|
||||||
next_table = &$$->next;
|
next_table = &$$->next;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -272,7 +272,7 @@ vars:
|
|||||||
var:
|
var:
|
||||||
ID
|
ID
|
||||||
{
|
{
|
||||||
$$ = alloc_type(struct var);
|
$$ = zalloc_type(struct var);
|
||||||
$$->name = $1;
|
$$->name = $1;
|
||||||
$$->frame = curr_frame;
|
$$->frame = curr_frame;
|
||||||
$$->next = NULL;
|
$$->next = NULL;
|
||||||
|
29
gui.c
29
gui.c
@ -128,8 +128,8 @@ static void unselect_value(void *data)
|
|||||||
struct value *value = data;
|
struct value *value = data;
|
||||||
|
|
||||||
label_in_box_bg(value->widget,
|
label_in_box_bg(value->widget,
|
||||||
value->row && value->row->table && value->row->table->curr_row ==
|
value->row && value->row->table->active_row == value->row ?
|
||||||
value->row ? COLOR_CHOICE_SELECTED : COLOR_EXPR_PASSIVE);
|
COLOR_CHOICE_SELECTED : COLOR_EXPR_PASSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +141,6 @@ static void edit_value(struct value *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ----- assignments ------------------------------------------------------- */
|
/* ----- assignments ------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -201,6 +200,19 @@ static void build_assignment(GtkWidget *vbox, struct frame *frame,
|
|||||||
/* ----- tables ------------------------------------------------------------ */
|
/* ----- tables ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
static void select_row(struct row *row)
|
||||||
|
{
|
||||||
|
struct table *table = row->table;
|
||||||
|
struct value *value;
|
||||||
|
|
||||||
|
for (value = table->active_row->values; value; value = value->next)
|
||||||
|
label_in_box_bg(value->widget, COLOR_ROW_UNSELECTED);
|
||||||
|
table->active_row = row;
|
||||||
|
for (value = table->active_row->values; value; value = value->next)
|
||||||
|
label_in_box_bg(value->widget, COLOR_ROW_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean table_var_select_event(GtkWidget *widget,
|
static gboolean table_var_select_event(GtkWidget *widget,
|
||||||
GdkEventButton *event, gpointer data)
|
GdkEventButton *event, gpointer data)
|
||||||
{
|
{
|
||||||
@ -212,7 +224,14 @@ static gboolean table_var_select_event(GtkWidget *widget,
|
|||||||
static gboolean table_value_select_event(GtkWidget *widget,
|
static gboolean table_value_select_event(GtkWidget *widget,
|
||||||
GdkEventButton *event, gpointer data)
|
GdkEventButton *event, gpointer data)
|
||||||
{
|
{
|
||||||
edit_value(data);
|
struct value *value = data;
|
||||||
|
|
||||||
|
if (!value->row || value->row->table->active_row == value->row)
|
||||||
|
edit_value(value);
|
||||||
|
else {
|
||||||
|
select_row(value->row);
|
||||||
|
change_world();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +291,7 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
|
|||||||
box_of_label(field),
|
box_of_label(field),
|
||||||
n_vars, n_vars+1,
|
n_vars, n_vars+1,
|
||||||
n_rows+1, n_rows+2);
|
n_rows+1, n_rows+2);
|
||||||
label_in_box_bg(field, table->active == n_rows ?
|
label_in_box_bg(field, table->active_row == row ?
|
||||||
COLOR_ROW_SELECTED : COLOR_ROW_UNSELECTED);
|
COLOR_ROW_SELECTED : COLOR_ROW_UNSELECTED);
|
||||||
g_signal_connect(G_OBJECT(box_of_label(field)),
|
g_signal_connect(G_OBJECT(box_of_label(field)),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
|
15
gui_canvas.c
15
gui_canvas.c
@ -228,6 +228,21 @@ static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event,
|
|||||||
user_origin = pos;
|
user_origin = pos;
|
||||||
update_pos(pos);
|
update_pos(pos);
|
||||||
break;
|
break;
|
||||||
|
case '+':
|
||||||
|
case '=':
|
||||||
|
zoom_in(pos);
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
zoom_out(pos);
|
||||||
|
break;
|
||||||
|
case '*':
|
||||||
|
center();
|
||||||
|
auto_scale();
|
||||||
|
redraw();
|
||||||
|
case '.':
|
||||||
|
ctx.center = pos;
|
||||||
|
redraw();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
9
obj.c
9
obj.c
@ -223,18 +223,13 @@ fail:
|
|||||||
static int iterate_tables(struct frame *frame, struct table *table,
|
static int iterate_tables(struct frame *frame, struct table *table,
|
||||||
struct coord base, int active)
|
struct coord base, int active)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
|
|
||||||
if (!table)
|
if (!table)
|
||||||
return run_loops(frame, frame->loops, base, active);
|
return run_loops(frame, frame->loops, base, active);
|
||||||
n = 0;
|
|
||||||
for (table->curr_row = table->rows; table->curr_row;
|
for (table->curr_row = table->rows; table->curr_row;
|
||||||
table->curr_row = table->curr_row->next) {
|
table->curr_row = table->curr_row->next)
|
||||||
if (!iterate_tables(frame, table->next, base,
|
if (!iterate_tables(frame, table->next, base,
|
||||||
active && table->active == n))
|
active && table->active_row == table->curr_row))
|
||||||
return 0;
|
return 0;
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
obj.h
2
obj.h
@ -62,7 +62,7 @@ struct table {
|
|||||||
struct row *curr_row;
|
struct row *curr_row;
|
||||||
|
|
||||||
/* GUI use */
|
/* GUI use */
|
||||||
int active; /* n-th row is active, 0 based */
|
struct row *active_row;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct loop {
|
struct loop {
|
||||||
|
Loading…
Reference in New Issue
Block a user