[specimen] GUI: new look (2nd try) -- show midi channel
Ken Restivo
ken at restivo.org
Fri Oct 19 16:10:10 CDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Oct 19, 2007 at 11:11:40AM +0300, Juuso Alasuutari wrote:
> On Friday 19 October 2007 05:31:43 Ken Restivo wrote:
> > My only wish for the specimen GUI would be some way to visually group the
> > patches together by MIDI channel.
> >
> > i.e if I had three patches on channel 1, four on channel 2, and seven on
> > channel 3, it'd be great to see them in some kind of GTK TreeViewWidget in
> > the left column, grouped by MIDI channel with little pivoting triangles
> > next to each channel to expand/contract them.
>
> That sounds like a great idea. What I had in mind was to emphasize all the
> patch names in the patch list that belong to the currently active MIDI
> channel, but that would probably look a bit weird.
>
> My GTK is still weak, so all patches are more than welcome.
>
My GTK is rusty, but I'm remembering it now.
This works, but it doesn't yet have the little triangle to expand/contract. That would require using a GtkTreeStore not at GtkListStore, and I've never messed with those. I'll probably try it tonight and see how it goes.
By the way this should apply cleanly to svn rev 71.
- -ken
- ------------------------
Index: src/gui/patchlist.c
===================================================================
- --- src/gui/patchlist.c (revision 71)
+++ src/gui/patchlist.c (working copy)
@@ -23,6 +23,7 @@
{
PATCH_NAME,
PATCH_ID,
+ PATCH_CHANNEL,
LAST_COLUMN,
};
@@ -103,15 +104,35 @@
gtk_box_set_spacing(box, SPACING);
/* patch list */
- - self->patch_store = gtk_list_store_new(LAST_COLUMN, G_TYPE_STRING, G_TYPE_INT);
+ self->patch_store = gtk_list_store_new(LAST_COLUMN, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
self->patch_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(self->patch_store));
self->vscroll = gtk_vscrollbar_new(NULL);
+
+ // midi channel column
renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Chan", renderer,
+ "text", PATCH_CHANNEL,
+ NULL);
+
+ gtk_tree_view_append_column(GTK_TREE_VIEW(self->patch_tree), column);
+
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+
+
+ // patch column
+ renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Patch", renderer,
"text", PATCH_NAME,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(self->patch_tree), column);
+
+ gtk_tree_view_column_pack_end(column, renderer, TRUE);
+
+
+
+
+
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(self->patch_tree), FALSE);
gtk_tree_view_set_vadjustment(GTK_TREE_VIEW(self->patch_tree),
gtk_range_get_adjustment(GTK_RANGE(self->vscroll)));
@@ -160,6 +181,7 @@
gtk_list_store_set(self->patch_store, &iter,
PATCH_NAME, str,
PATCH_ID, patches[i],
+ PATCH_CHANNEL, patch_get_channel(patches[i]),
-1);
g_free(str);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHGR0ye8HF+6xeOIcRArMQAJ4jZMtYQCWwD9mhmU5zI5LIFjjZ1wCfd096
1kRcBeL05CZHX0J9jiwLff0=
=Xf6J
-----END PGP SIGNATURE-----
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Specimen
mailing list