[specimen] GUI: new look (2nd try)

Ken Restivo ken at restivo.org
Fri Oct 19 12:55:52 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.
> 

This is what I expected to work, but it causes speciment to segfault.

Obviously I'm doing something stupid, but I don't know what.

- -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,
 };
 
@@ -107,11 +108,20 @@
     self->patch_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(self->patch_store));
     self->vscroll = gtk_vscrollbar_new(NULL);
     renderer = gtk_cell_renderer_text_new();
+
+
+    column = gtk_tree_view_column_new_with_attributes("Chan", renderer,
+						      "int", PATCH_CHANNEL, "expand", TRUE,
+						      NULL);
+
+    gtk_tree_view_append_column(GTK_TREE_VIEW(self->patch_tree), column);
+
+
     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_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)));
@@ -154,13 +166,14 @@
     
     for (i = 0; i < npatches; ++i)
     {
- -	gtk_list_store_set(self->patch_store, &iter,
- -			   PATCH_NAME, str,
- -			   PATCH_ID, patches[i],
- -			   -1);
- -
+	 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(patches);
     if (type == PATCH_LIST_INDEX)
 	index = target;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHGO+oe8HF+6xeOIcRAkvGAJ9CaTkVc+LdJirqrDjg5+hBeaTDpQCcCD0x
Bgat5OvQZzE6aq+S1kTG3Ts=
=48V7
-----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