//------------------------------------------------------------------------- // Filename: help.cc // Version: $Id: help.cc,v 1.1.4.3 1999/05/24 22:54:50 erik Exp $ // Copyright: Copyright (C) 1999, Erik Mouw (J.A.K.Mouw@its.tudelft.nl) // Author: Erik Mouw // Description: GUI "help" stuff // Created at: Sun May 2 15:56:37 1999 // Modified by: Erik Mouw // Modified at: Mon May 24 14:11:24 1999 //------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #ident "$Id: help.cc,v 1.1.4.3 1999/05/24 22:54:50 erik Exp $" #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifdef MUSICA_DEBUG # include #endif #ifdef STDC_HEADERS # include #endif #include #include "gui.hh" #include "help.hh" static void helpCloseCallback(GtkWidget *widget, gpointer data); static char copyingText[] = PACKAGE " " VERSION " - a MIDI player\n\n" \ "Copyright (C) 1999, Erik Mouw (J.A.K.Mouw@its.tudelft.nl)\n\n" \ "This program is free software; you can redistribute it and/or modify " \ "it under the terms of the GNU General Public License as published by " \ "the Free Software Foundation; either version 2 of the License, or " \ "(at your option) any later version.\n\n" \ "This program is distributed in the hope that it will be useful, " \ "but WITHOUT ANY WARRANTY; without even the implied warranty of " \ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " \ "GNU General Public License for more details.\n\n" \ "You should have received a copy of the GNU General Public License " \ "along with this program; if not, write to the Free Software " \ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; static GtkWidget *helpAboutDialog = 0; static GtkWidget *helpCopyingDialog = 0; void helpAboutCallback(GtkWidget *widget, gpointer data) { GtkWidget *label; GtkWidget *button; char buf[128]; #ifdef MUSICA_DEBUG cerr<< __PRETTY_FUNCTION__<< endl; #endif if(helpAboutDialog == 0) { helpAboutDialog = gtk_dialog_new(); g_snprintf(buf, 127, "%s: About", windowName); gtk_window_set_title(GTK_WINDOW(helpAboutDialog), buf); gtk_signal_connect(GTK_OBJECT(helpAboutDialog), "delete_event", GTK_SIGNAL_FUNC(dialogDeleteCallback), helpAboutDialog); label = gtk_label_new("\n" PACKAGE " - a MIDI player\n" \ "Version " VERSION "\n\n" \ "Copyright (C) 1999, Erik Mouw\n" \ "(J.A.K.Mouw@its.tudelft.nl)\n"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(helpAboutDialog)->vbox), label, TRUE, TRUE, 2); gtk_widget_show(label); button = gtk_button_new_with_label("Close"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(helpAboutDialog)->action_area), button, TRUE, TRUE, 1); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(helpCloseCallback), helpAboutDialog); gtk_widget_grab_focus(button); } showOrRaiseWindow(helpAboutDialog); } void helpCopyingCallback(GtkWidget *widget, gpointer data) { GtkWidget *scrolledwindow; GtkWidget *text; GtkWidget *button; char buf[128]; #ifdef MUSICA_DEBUG cerr<< __PRETTY_FUNCTION__<< endl; #endif if(helpCopyingDialog == 0) { helpCopyingDialog = gtk_dialog_new(); g_snprintf(buf, 127, "%s: Copying", windowName); gtk_window_set_title(GTK_WINDOW(helpCopyingDialog), buf); gtk_signal_connect(GTK_OBJECT(helpCopyingDialog), "delete_event", GTK_SIGNAL_FUNC(dialogDeleteCallback), helpCopyingDialog); scrolledwindow = gtk_scrolled_window_new(0, 0); gtk_widget_set_usize(GTK_WIDGET(scrolledwindow), 400, 200); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(helpCopyingDialog)->vbox), scrolledwindow, TRUE, TRUE, 2); gtk_widget_show(scrolledwindow); text = gtk_text_new(0, 0); gtk_text_set_editable(GTK_TEXT(text), FALSE); gtk_text_set_word_wrap(GTK_TEXT(text), TRUE); gtk_container_add(GTK_CONTAINER(scrolledwindow), text); gtk_widget_show(text); gtk_text_freeze(GTK_TEXT(text)); gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, copyingText, strlen(copyingText)); gtk_text_thaw(GTK_TEXT(text)); button = gtk_button_new_with_label("Close"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(helpCopyingDialog)->action_area), button, TRUE, TRUE, 1); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(helpCloseCallback), helpCopyingDialog); gtk_widget_grab_focus(button); } showOrRaiseWindow(helpCopyingDialog); } static void helpCloseCallback(GtkWidget *widget, gpointer data) { GtkWidget *dialog = GTK_WIDGET(data); #ifdef MUSICA_DEBUG cerr<< __PRETTY_FUNCTION__<< endl; #endif gtk_widget_hide(dialog); }