Date:2015-01-09 05:58:29 (4 years 9 months ago)
Author:Werner Almesberger
Commit:5a1fd80fc852b784d74b5a3e7fd1ca5225a68d6b
Message:new sidebar mode "Show packages"

Yes, now one can finally go through header.fpd and its 160 packages
without going crazy !
Files: gui.c (2 diffs)
gui_frame.c (3 diffs)
gui_frame.h (1 diff)

Change Details

gui.c
9595}
9696
9797
98static void show_pkg(void)
99{
100    sidebar = sidebar_pkg;
101    change_world();
102}
103
104
98105/* ----- menu bar ---------------------------------------------------------- */
99106
100107
...... 
120127                NULL, show_var, 0, "<RadioItem>" },
121128    { "/View/Show code", NULL, show_code, 0,
122129                        "/View/Show variables" },
130    { "/View/Show packages",NULL, show_pkg, 0,
131                        "/View/Show variables" },
123132};
124133
125134
gui_frame.c
15441544    struct pkg *pkg, *last;
15451545
15461546    switch (event->direction) {
1547    case GDK_SCROLL_UP:
1547    case GDK_SCROLL_DOWN:
15481548        if (active_pkg->next)
15491549            active_pkg = active_pkg->next;
15501550        else
15511551            active_pkg = pkgs->next;
15521552        change_world();
15531553        break;
1554    case GDK_SCROLL_DOWN:
1554    case GDK_SCROLL_UP:
15551555        last = NULL;
15561556        for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg);
15571557            pkg = pkg->next)
...... 
18061806/* ----- frames ------------------------------------------------------------ */
18071807
18081808
1809void build_frames(GtkWidget *vbox, int wrap_width)
1809static void do_build_frames(GtkWidget *vbox, int wrap_width)
18101810{
18111811    struct frame *frame;
18121812    GtkWidget *hbox, *tab, *label, *packages, *refs, *vars, *items, *meas;
...... 
18781878
18791879    gtk_widget_show_all(hbox);
18801880}
1881
1882
1883/* ----- packages ---------------------------------------------------------- */
1884
1885
1886static void build_packages(GtkWidget *vbox, int wrap_width)
1887{
1888    GtkWidget *label, *hbox, *field;
1889    struct pkg *pkg;
1890
1891    destroy_all_children(GTK_CONTAINER(vbox));
1892
1893    label = build_pkg_name();
1894    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
1895
1896    for (pkg = pkgs; pkg; pkg = pkg->next)
1897        if (pkg->name) {
1898            hbox = gtk_hbox_new(FALSE, 0);
1899                       field = add_activator(hbox, pkg == active_pkg,
1900                pkg_select_event, pkg,
1901                "Package name. Click to make active.",
1902                "%s", pkg->name);
1903            g_signal_connect(G_OBJECT(box_of_label(field)),
1904                "scroll_event",
1905                G_CALLBACK(pkg_scroll_event), NULL);
1906            gtk_box_pack_start(GTK_BOX(vbox), hbox,
1907                FALSE, FALSE, 2);
1908        }
1909
1910    gtk_widget_show_all(vbox);
1911}
1912
1913
1914/* ----- sidebar dispatcher ------------------------------------------------ */
1915
1916
1917void build_frames(GtkWidget *vbox, int wrap_width)
1918{
1919    if (sidebar == sidebar_pkg)
1920        build_packages(vbox, wrap_width);
1921    else
1922        do_build_frames(vbox, wrap_width);
1923}
gui_frame.h
2222enum sidebar {
2323    sidebar_var, /* show variables */
2424    sidebar_code, /* show code */
25    sidebar_pkg, /* show packages */
2526};
2627
2728

Archive Download the corresponding diff file

Branches:
master



interactive