/[cabestan]/main.c
ViewVC logotype

Annotation of /main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Sun Oct 4 20:33:09 2009 UTC (10 years ago) by ben
File MIME type: text/plain
File size: 2084 byte(s)
first commit
1 ben 1 #include <libintl.h>
2     #include <locale.h>
3     #include <gtk/gtk.h>
4     #include <glib.h>
5     #include <jack/jack.h>
6     #include <jack/transport.h>
7     #include "version.h"
8     #include "widgets.h"
9     #include "callbacks.h"
10     #define _(string) gettext (string)
11    
12     int main (int argc, char* argv[]) {
13     GtkWidget* window; /* main window */
14     GtkWidget* timeline; /* time display */
15     GtkWidget* vbox;
16     GtkWidget* hbox;
17     GtkWidget* play, * rewind, * forward, * stepf, * stepr; /* buttons */
18     jack_client_t* jackd_client; /* jackd handle */
19     jack_status_t jackd_status; /* jackd status */
20     jack_nframes_t* jackd_frame; /* jackd current frame */
21    
22    
23     /* internationalization */
24     setlocale ( LC_ALL, "" );
25     bindtextdomain ("cabestan", LOCALEDIR);
26     textdomain ( "cabestan" );
27    
28     /* jack init */
29     jackd_client = jack_client_open("cabestan", JackNullOption, &jackd_status);
30     jack_activate(jackd_client);
31    
32     /* gtk init */
33     gtk_init (&argc, &argv);
34    
35     window = window_create("Cabestan");
36     vbox = vbox_create();
37     window_add_vbox(window, vbox);
38     timeline = timeline_create();
39     vbox_pack_widget(vbox, timeline);
40     hbox = hbox_create();
41     vbox_pack_widget(vbox, hbox);
42     rewind = button_create(GTK_STOCK_MEDIA_PREVIOUS);
43     hbox_pack_widget(hbox, rewind);
44     stepr = button_create(GTK_STOCK_MEDIA_REWIND);
45     hbox_pack_widget(hbox, stepr);
46     play = button_create(GTK_STOCK_MEDIA_PLAY);
47     hbox_pack_widget(hbox, play);
48     stepf = button_create(GTK_STOCK_MEDIA_FORWARD);
49     hbox_pack_widget(hbox, stepf);
50     forward = button_create(GTK_STOCK_MEDIA_NEXT);
51     hbox_pack_widget(hbox, forward);
52    
53     /* callback connection */
54     g_signal_connect_swapped(G_OBJECT(window), "delete-event", G_CALLBACK(gtk_main_quit), (gpointer)NULL);
55     g_signal_connect(G_OBJECT(play), "clicked", G_CALLBACK(on_play), (gpointer)jackd_client);
56     g_signal_connect(G_OBJECT(rewind), "clicked", G_CALLBACK(on_rewind), (gpointer)jackd_client);
57     g_signal_connect(G_OBJECT(stepf), "clicked", G_CALLBACK(on_stepf), (gpointer)jackd_client);
58     g_signal_connect(G_OBJECT(stepr), "clicked", G_CALLBACK(on_stepr), (gpointer)jackd_client);
59    
60     gtk_widget_show_all(window);
61    
62     gtk_main();
63    
64     return 0;
65     }

  ViewVC Help
Powered by ViewVC 1.1.26