mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-25 18:01:54 +02:00
new sidebar mode "Show packages"
Yes, now one can finally go through header.fpd and its 160 packages without going crazy !
This commit is contained in:
parent
809e8142b5
commit
5a1fd80fc8
9
gui.c
9
gui.c
@ -95,6 +95,13 @@ static void show_code(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void show_pkg(void)
|
||||||
|
{
|
||||||
|
sidebar = sidebar_pkg;
|
||||||
|
change_world();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- menu bar ---------------------------------------------------------- */
|
/* ----- menu bar ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -120,6 +127,8 @@ static GtkItemFactoryEntry menu_entries[] = {
|
|||||||
NULL, show_var, 0, "<RadioItem>" },
|
NULL, show_var, 0, "<RadioItem>" },
|
||||||
{ "/View/Show code", NULL, show_code, 0,
|
{ "/View/Show code", NULL, show_code, 0,
|
||||||
"/View/Show variables" },
|
"/View/Show variables" },
|
||||||
|
{ "/View/Show packages",NULL, show_pkg, 0,
|
||||||
|
"/View/Show variables" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
49
gui_frame.c
49
gui_frame.c
@ -1544,14 +1544,14 @@ static gboolean pkg_scroll_event(GtkWidget *widget, GdkEventScroll *event,
|
|||||||
struct pkg *pkg, *last;
|
struct pkg *pkg, *last;
|
||||||
|
|
||||||
switch (event->direction) {
|
switch (event->direction) {
|
||||||
case GDK_SCROLL_UP:
|
case GDK_SCROLL_DOWN:
|
||||||
if (active_pkg->next)
|
if (active_pkg->next)
|
||||||
active_pkg = active_pkg->next;
|
active_pkg = active_pkg->next;
|
||||||
else
|
else
|
||||||
active_pkg = pkgs->next;
|
active_pkg = pkgs->next;
|
||||||
change_world();
|
change_world();
|
||||||
break;
|
break;
|
||||||
case GDK_SCROLL_DOWN:
|
case GDK_SCROLL_UP:
|
||||||
last = NULL;
|
last = NULL;
|
||||||
for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg);
|
for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg);
|
||||||
pkg = pkg->next)
|
pkg = pkg->next)
|
||||||
@ -1806,7 +1806,7 @@ static GtkWidget *build_frame_refs(const struct frame *frame)
|
|||||||
/* ----- frames ------------------------------------------------------------ */
|
/* ----- frames ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
void build_frames(GtkWidget *vbox, int wrap_width)
|
static void do_build_frames(GtkWidget *vbox, int wrap_width)
|
||||||
{
|
{
|
||||||
struct frame *frame;
|
struct frame *frame;
|
||||||
GtkWidget *hbox, *tab, *label, *packages, *refs, *vars, *items, *meas;
|
GtkWidget *hbox, *tab, *label, *packages, *refs, *vars, *items, *meas;
|
||||||
@ -1878,3 +1878,46 @@ void build_frames(GtkWidget *vbox, int wrap_width)
|
|||||||
|
|
||||||
gtk_widget_show_all(hbox);
|
gtk_widget_show_all(hbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- packages ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
static void build_packages(GtkWidget *vbox, int wrap_width)
|
||||||
|
{
|
||||||
|
GtkWidget *label, *hbox, *field;
|
||||||
|
struct pkg *pkg;
|
||||||
|
|
||||||
|
destroy_all_children(GTK_CONTAINER(vbox));
|
||||||
|
|
||||||
|
label = build_pkg_name();
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
for (pkg = pkgs; pkg; pkg = pkg->next)
|
||||||
|
if (pkg->name) {
|
||||||
|
hbox = gtk_hbox_new(FALSE, 0);
|
||||||
|
field = add_activator(hbox, pkg == active_pkg,
|
||||||
|
pkg_select_event, pkg,
|
||||||
|
"Package name. Click to make active.",
|
||||||
|
"%s", pkg->name);
|
||||||
|
g_signal_connect(G_OBJECT(box_of_label(field)),
|
||||||
|
"scroll_event",
|
||||||
|
G_CALLBACK(pkg_scroll_event), NULL);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), hbox,
|
||||||
|
FALSE, FALSE, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_show_all(vbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- sidebar dispatcher ------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
void build_frames(GtkWidget *vbox, int wrap_width)
|
||||||
|
{
|
||||||
|
if (sidebar == sidebar_pkg)
|
||||||
|
build_packages(vbox, wrap_width);
|
||||||
|
else
|
||||||
|
do_build_frames(vbox, wrap_width);
|
||||||
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
enum sidebar {
|
enum sidebar {
|
||||||
sidebar_var, /* show variables */
|
sidebar_var, /* show variables */
|
||||||
sidebar_code, /* show code */
|
sidebar_code, /* show code */
|
||||||
|
sidebar_pkg, /* show packages */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user