Mercurial > audlegacy-plugins
comparison src/amidi-plug/i_utils.c @ 12:3da1b8942b8b trunk
[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author | nenolod |
---|---|
date | Mon, 18 Sep 2006 03:14:20 -0700 |
parents | src/Input/amidi-plug/i_utils.c@13389e613d67 |
children | 5daedb3af7c9 |
comparison
equal
deleted
inserted
replaced
11:cff1d04026ae | 12:3da1b8942b8b |
---|---|
1 /* | |
2 * | |
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2006 | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License as published by the | |
7 * Free Software Foundation; either version 2 of the License, or (at your | |
8 * option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, but | |
11 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License along | |
16 * with this program; if not, write to the Free Software Foundation, Inc., | |
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 * | |
19 */ | |
20 | |
21 | |
22 #include "i_utils.h" | |
23 #include <gtk/gtk.h> | |
24 #include "amidi-plug.logo.xpm" | |
25 | |
26 | |
27 void i_about_gui( void ) | |
28 { | |
29 static GtkWidget * aboutwin = NULL; | |
30 GtkWidget *logoandinfo_vbox , *aboutwin_vbox; | |
31 GtkWidget *logo_image , *logo_frame; | |
32 GtkWidget *info_frame , *info_scrolledwin , *info_textview; | |
33 GtkWidget *hseparator , *hbuttonbox , *button_ok; | |
34 GtkTextBuffer *info_textbuffer; | |
35 GdkPixbuf *logo_pixbuf; | |
36 | |
37 if ( aboutwin != NULL ) | |
38 return; | |
39 | |
40 aboutwin = gtk_window_new( GTK_WINDOW_TOPLEVEL ); | |
41 gtk_window_set_type_hint( GTK_WINDOW(aboutwin), GDK_WINDOW_TYPE_HINT_DIALOG ); | |
42 gtk_window_set_title( GTK_WINDOW(aboutwin), "AMIDI-Plug - about" ); | |
43 gtk_window_set_resizable( GTK_WINDOW(aboutwin) , FALSE ); | |
44 gtk_container_set_border_width( GTK_CONTAINER(aboutwin), 10 ); | |
45 g_signal_connect( G_OBJECT(aboutwin) , "destroy" , G_CALLBACK(gtk_widget_destroyed) , &aboutwin ); | |
46 | |
47 aboutwin_vbox = gtk_vbox_new( FALSE , 0 ); | |
48 | |
49 logoandinfo_vbox = gtk_vbox_new( TRUE , 2 ); | |
50 gtk_container_add( GTK_CONTAINER(aboutwin) , aboutwin_vbox ); | |
51 | |
52 logo_pixbuf = gdk_pixbuf_new_from_xpm_data( (const gchar **)amidiplug_xpm_logo ); | |
53 logo_image = gtk_image_new_from_pixbuf( logo_pixbuf ); | |
54 g_object_unref( logo_pixbuf ); | |
55 | |
56 logo_frame = gtk_frame_new( NULL ); | |
57 gtk_container_add( GTK_CONTAINER(logo_frame) , logo_image ); | |
58 gtk_box_pack_start( GTK_BOX(logoandinfo_vbox) , logo_frame , TRUE , TRUE , 0 ); | |
59 | |
60 info_textview = gtk_text_view_new(); | |
61 info_textbuffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(info_textview) ); | |
62 gtk_text_view_set_editable( GTK_TEXT_VIEW(info_textview) , FALSE ); | |
63 gtk_text_view_set_cursor_visible( GTK_TEXT_VIEW(info_textview) , FALSE ); | |
64 gtk_text_view_set_justification( GTK_TEXT_VIEW(info_textview) , GTK_JUSTIFY_LEFT ); | |
65 gtk_text_view_set_left_margin( GTK_TEXT_VIEW(info_textview) , 10 ); | |
66 | |
67 gtk_text_buffer_set_text( info_textbuffer , | |
68 "\nAMIDI-Plug " AMIDIPLUG_VERSION | |
69 "\nmodular MIDI music player\n" | |
70 "http://www.develia.org/projects.php?p=amidiplug\n\n" | |
71 "written by Giacomo Lozito\n" | |
72 "< james@develia.org >\n\n\n" | |
73 "special thanks to...\n\n" | |
74 "Clemens Ladisch and Jaroslav Kysela\n" | |
75 "for their cool programs aplaymidi and amixer; those\n" | |
76 "were really useful, along with alsa-lib docs, in order\n" | |
77 "to learn more about the ALSA API\n\n" | |
78 "Alfredo Spadafina\n" | |
79 "for the nice midi keyboard logo\n\n" | |
80 "Tony Vroon\n" | |
81 "for the good help with alpha testing\n\n" | |
82 , -1 ); | |
83 | |
84 info_scrolledwin = gtk_scrolled_window_new( NULL , NULL ); | |
85 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(info_scrolledwin) , | |
86 GTK_POLICY_NEVER , GTK_POLICY_ALWAYS ); | |
87 gtk_container_add( GTK_CONTAINER(info_scrolledwin) , info_textview ); | |
88 info_frame = gtk_frame_new( NULL ); | |
89 gtk_container_add( GTK_CONTAINER(info_frame) , info_scrolledwin ); | |
90 | |
91 gtk_box_pack_start( GTK_BOX(logoandinfo_vbox) , info_frame , TRUE , TRUE , 0 ); | |
92 | |
93 gtk_box_pack_start( GTK_BOX(aboutwin_vbox) , logoandinfo_vbox , TRUE , TRUE , 0 ); | |
94 | |
95 /* horizontal separator and buttons */ | |
96 hseparator = gtk_hseparator_new(); | |
97 gtk_box_pack_start( GTK_BOX(aboutwin_vbox) , hseparator , FALSE , FALSE , 4 ); | |
98 hbuttonbox = gtk_hbutton_box_new(); | |
99 gtk_button_box_set_layout( GTK_BUTTON_BOX(hbuttonbox) , GTK_BUTTONBOX_END ); | |
100 button_ok = gtk_button_new_from_stock( GTK_STOCK_OK ); | |
101 g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" , G_CALLBACK(gtk_widget_destroy) , aboutwin ); | |
102 gtk_container_add( GTK_CONTAINER(hbuttonbox) , button_ok ); | |
103 gtk_box_pack_start( GTK_BOX(aboutwin_vbox) , hbuttonbox , FALSE , FALSE , 0 ); | |
104 | |
105 gtk_widget_show_all( aboutwin ); | |
106 } | |
107 | |
108 | |
109 gpointer i_message_gui( gchar * title , gchar * message , | |
110 gint type , gpointer parent_win , gboolean show_win ) | |
111 { | |
112 GtkWidget *win; | |
113 GtkMessageType mtype = GTK_MESSAGE_INFO; | |
114 | |
115 switch ( type ) | |
116 { | |
117 case AMIDIPLUG_MESSAGE_INFO: | |
118 mtype = GTK_MESSAGE_INFO; break; | |
119 case AMIDIPLUG_MESSAGE_WARN: | |
120 mtype = GTK_MESSAGE_WARNING; break; | |
121 case AMIDIPLUG_MESSAGE_ERR: | |
122 mtype = GTK_MESSAGE_ERROR; break; | |
123 } | |
124 | |
125 if ( parent_win != NULL ) | |
126 win = gtk_message_dialog_new( GTK_WINDOW(parent_win) , GTK_DIALOG_DESTROY_WITH_PARENT , | |
127 mtype , GTK_BUTTONS_OK , message ); | |
128 else | |
129 win = gtk_message_dialog_new( NULL , 0 , mtype , GTK_BUTTONS_OK , message ); | |
130 | |
131 gtk_window_set_title( GTK_WINDOW(win) , title ); | |
132 g_signal_connect_swapped( G_OBJECT(win) , "response" , G_CALLBACK(gtk_widget_destroy) , win ); | |
133 | |
134 if ( show_win == TRUE ) | |
135 gtk_widget_show_all( win ); | |
136 | |
137 return win; | |
138 } |