1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2025-04-21 12:27:27 +03:00

make active package track active variables (for the GUI)

If the package whose name is produced by the active variable values
is active and the variables change, then make the newly active
package the one whose name is produced by the changed variables.

This way, iterating through a table or a loop will automatically
switch to the right package, with the exception that, if the user
choses to explicitly select a different package (by clicking on
its name in the packages line), then that selection takes priority.

Explicit selection loses its priority when active package and active
variables coincide again. I.e., one can simply "catch" the active
package by activating the corresponding values.
This commit is contained in:
Werner Almesberger
2012-05-25 19:20:29 -03:00
parent b06ed92557
commit e0351bdf73
5 changed files with 19 additions and 7 deletions

7
inst.c
View File

@@ -35,6 +35,7 @@
struct inst *selected_inst = NULL;
struct bbox active_frame_bbox;
struct pkg *pkgs, *active_pkg, *curr_pkg;
struct pkg *reachable_pkg = NULL;
struct inst *frame_instantiating = NULL;
static struct pkg *prev_pkgs;
@@ -1173,7 +1174,7 @@ void inst_end_frame(const struct frame *frame)
/* ----- package ----------------------------------------------------------- */
void inst_select_pkg(const char *name)
void inst_select_pkg(const char *name, int active)
{
struct pkg **pkg;
enum inst_prio prio;
@@ -1192,6 +1193,8 @@ void inst_select_pkg(const char *name)
(*pkg)->n_samples = n_samples;
}
curr_pkg = *pkg;
if (active && name)
reachable_pkg = curr_pkg;
}
@@ -1246,7 +1249,7 @@ void inst_start(void)
active_frame_bbox = bbox_zero;
prev_pkgs = pkgs;
pkgs = NULL;
inst_select_pkg(NULL);
inst_select_pkg(NULL, 0);
curr_pkg = pkgs;
frame_instantiating = NULL;
}