if (ld_loaddlg) return(1);
-// if(needinit) ld_init();
-
ld_mode=mode;
ld_count=count;
-
- ld_loaddlg=gtk_dialog_new();
+
+#ifdef USE_GTK2
+ ld_loaddlg=gtk_dialog_new_with_buttons("terminatorX - loading",
+ GTK_WINDOW(main_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_NONE, NULL);
+#else
+ ld_loaddlg=gtk_dialog_new();
+#endif
ld_window=&(GTK_DIALOG(ld_loaddlg)->window);
- gtk_window_set_title(ld_window, "terminatorX - Loading");
+#ifndef USE_GTK2
+ gtk_window_set_title(ld_window, "terminatorX - loading");
+#endif
gtk_container_set_border_width(GTK_CONTAINER(ld_window), 5);
vbox=GTK_WIDGET(GTK_DIALOG(ld_loaddlg)->vbox);
ld_single_p=gtk_progress_bar_new();
add_widget_fix(ld_single_p);
-
+
+#ifndef USE_GTK2
dummy=gtk_button_new_with_label("Cancel");
gtk_box_pack_start(GTK_BOX(actionarea), dummy, WID_DYN);
gtk_widget_show(dummy);
-
- dummy=gtk_widget_get_toplevel(dummy);
-
-
+#endif
gtk_window_set_modal(ld_window, TRUE);
gtk_window_set_default_size(ld_window, 400, 100);
+#ifndef USE_GTK2
gtk_window_set_position(ld_window, GTK_WIN_POS_CENTER_ALWAYS);
+#endif
gtk_widget_realize(ld_loaddlg);
gdk_window_set_decorations(gtk_widget_get_parent_window(vbox),(GdkWMDecoration) 0);
-
-// gtk_window_reposition(ld_window, gdk_screen_width()/2-200, gdk_screen_height()/2-50);
- //gtk_window_reposition(ld_window, gdk_screen_width()/2-200, gdk_screen_height()/2-50);
gtk_widget_show(ld_loaddlg);
gtk_flush();
- return(0);
+ return 0;
}
char *strip_path(char *name)
int grab_status=0;
int last_grab_status=0;
-void tx_note(const char *message);
-
GtkTooltips *gui_tooltips=NULL;
void gui_set_tooltip(GtkWidget *wid, char *tip)
fread(idbuff, strlen(TX_SET_ID_10), 1, in);
if (strncmp(idbuff, TX_SET_ID_10, strlen(TX_SET_ID_10))==0)
{
- if (vtt_class::load_all_10(in, buffer)) tx_note("Error while reading set.");
+ if (vtt_class::load_all_10(in, buffer)) tx_note("Error while reading set.", true);
}
else if (strncmp(idbuff, TX_SET_ID_11, strlen(TX_SET_ID_11))==0)
{
- if (vtt_class::load_all_11(in, buffer)) tx_note("Error while reading set.");
+ if (vtt_class::load_all_11(in, buffer)) tx_note("Error while reading set.", true);
}
else if (strncmp(idbuff, TX_SET_ID_12, strlen(TX_SET_ID_12))==0)
{
- if (vtt_class::load_all_12(in, buffer)) tx_note("Error while reading set.");
+ if (vtt_class::load_all_12(in, buffer)) tx_note("Error while reading set.", true);
}
else if (strncmp(idbuff, TX_SET_ID_13, strlen(TX_SET_ID_13))==0)
{
- if (vtt_class::load_all_13(in, buffer)) tx_note("Error while reading set.");
+ if (vtt_class::load_all_13(in, buffer)) tx_note("Error while reading set.", true);
}
else if (strncmp(idbuff, TX_SET_ID_14, strlen(TX_SET_ID_14))==0)
{
- if (vtt_class::load_all_14(in, buffer)) tx_note("Error while reading set.");
+ if (vtt_class::load_all_14(in, buffer)) tx_note("Error while reading set.", true);
}
else
{
- tx_note("Sorry, this file is not a terminatorX set-file.");
+ tx_note("This file is not a terminatorX set-file.", true);
fclose(in);
return;
}
strcpy(idbuff, "Failed to access file: \""); // I'm stealing the unrelated sting for a temp :)
strcat(idbuff, globals.tables_filename);
strcat(idbuff, "\"");
- tx_note(idbuff);
+ tx_note(idbuff, true);
}
}
{
strcpy(idbuffer, TX_SET_ID_14);
fwrite(idbuffer, strlen(idbuffer), 1, out);
- if (vtt_class::save_all(out)) tx_note("Error while saving set.");
+ if (vtt_class::save_all(out)) tx_note("Error while saving set.", true);
fclose(out);
sprintf(wbuf,"terminatorX - %s", strip_path(buffer));
gtk_window_set_title(GTK_WINDOW(main_window), wbuf);
}
else
{
- tx_note("Failed to access file.");
+ tx_note("Failed to open file for write access.", true);
}
}
switch(res)
{
case ERROR_BUSY:
- tx_note("Error starting engine: engine is already running.");
+ tx_note("Error starting engine: engine is already running.", true);
break;
case ERROR_AUDIO:
- tx_note("Error starting engine: failed to access audiodevice.");
+ tx_note("Error starting engine: failed to access audiodevice.", true);
break;
case ERROR_TAPE:
- tx_note("Error starting engine: failed to open the recording file.");
+ tx_note("Error starting engine: failed to open the recording file.", true);
break;
- default:tx_note("Error starting engine: Unknown error.");
+ default:tx_note("Error starting engine: Unknown error.", true);
}
return 0;
}
if ((sequencer.is_empty()) && (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(seq_rec_btn)))) {
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
{
- tx_note("Sequencer playback triggered - but no events\nrecorded yet - nothing to playback!\n\nTo perform live with terminatorX just activate the\naudio engine with the \"Power\" button.");
+ tx_note("Sequencer playback triggered - but no events recorded yet - nothing to playback!\n\nTo perform live with terminatorX just activate the audio engine with the \"Power\" button.");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), 0);
}
} else {
gtk_widget_destroy(GTK_WIDGET(mbox));
}
-void tx_note(const char *message)
+void tx_note(const char *message, bool isError=false)
{
- char buffer[4096]="\nterminatorX Note:\n\n";
+ char buffer[4096]="terminatorX ";
+ if (isError) {
+ strcat(buffer, "note:\n\n");
+ } else {
+ strcat(buffer, "error:\n\n");
+ }
+
+#ifdef USE_GTK2
+ strcat(buffer, message);
+ GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ isError ? GTK_MESSAGE_ERROR : GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, message);
+ int result=gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+#else
GtkWidget *mbox;
GtkWidget *label;
mbox=gtk_dialog_new();
win=&(GTK_DIALOG(mbox)->window);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(mbox)->vbox), 2);
+ gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(mbox)->vbox), 4);
gtk_container_set_border_width(GTK_CONTAINER(mbox), 10);
- label=gtk_label_new("terminatorX Note");
+ label=gtk_label_new("terminatorX note");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), label, TRUE, TRUE, 0);
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), sp, TRUE, TRUE, 0);
gtk_widget_show(sp);
- strcpy(buffer, "\n");
- strcat(buffer, message);
- strcat(buffer, "\n");
- label=gtk_label_new(buffer);
+ label=gtk_label_new(message);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mbox)->vbox), label, TRUE, TRUE, 0);
gtk_widget_show(label);
gtk_widget_grab_default(btn);
gtk_widget_show(btn);
gtk_widget_show(mbox);
+#endif
}
void tx_l_note(const char *message)
{
+#ifdef USE_GTK2
+ char buffer[4096]="Plugin info:\n\n";
+ strcat(buffer, message);
+
+ GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, message);
+ int result=gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+#else
char buffer[4096]="\n Plugin Info: \n ------------ \n\n";
GtkWidget *mbox;
gtk_window_set_default_size(win, 200, 100);
gtk_window_set_position(win, GTK_WIN_POS_CENTER_ALWAYS);
gtk_widget_show(mbox);
+#endif
}
void display_mastergui()
extern void create_mastergui(int x, int y);
extern void wav_progress_update(gfloat percent);
extern void note_destroy(GtkWidget *widget, GtkWidget *mbox);
-extern void tx_note(const char *message);
+extern void tx_note(const char *message, bool isError=false);
extern void tx_l_note(const char *message);
extern void display_mastergui();
extern void grab_off();
gui_set_name(this, name);
}
-int vtt_class :: load_file(char *fname)
+tX_audio_error vtt_class :: load_file(char *fname)
{
- int res;
+ tX_audio_error res;
int was_playing=is_playing;
if (is_playing) stop();
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
- tx_note(buffer);
+ sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+ tx_note(buffer, true);
res++;
}
break;
default:
- tx_note("Fatal Error loading set: unknown effect type!");
+ tx_note("Fatal error loading set: unknown effect type!", true);
res++;
}
}
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
- tx_note(buffer);
+ sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+ tx_note(buffer, true);
res++;
}
break;
default:
- tx_note("Fatal Error loading set: unknown effect type!");
+ tx_note("Fatal error loading set: unknown effect type!", true);
res++;
}
}
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
- tx_note(buffer);
+ sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
+ tx_note(buffer, true);
res++;
}
break;
default:
- tx_note("Fatal Error loading set: unknown effect type!");
+ tx_note("Fatal error loading set: unknown effect type!", true);
res++;
}
}
ld_set_filename(ftmp);
//restmp=load_wav(newvtt->filename, &newbuffer, &size);
- restmp=newvtt->load_file(ftmp);
+ restmp=(int) newvtt->load_file(ftmp);
res+=restmp;
}
gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
ld_set_filename(ftmp);
//restmp=load_wav(newvtt->filename, &newbuffer, &size);
- restmp=newvtt->load_file(ftmp);
+ restmp=(int) newvtt->load_file(ftmp);
res+=restmp;
}
gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
ld_set_filename(ftmp);
//restmp=load_wav(newvtt->filename, &newbuffer, &size);
- restmp=newvtt->load_file(ftmp);
+ restmp=(int) newvtt->load_file(ftmp);
res+=restmp;
}
gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
ld_set_filename(ftmp);
//restmp=load_wav(newvtt->filename, &newbuffer, &size);
- restmp=newvtt->load_file(ftmp);
+ restmp=(int) newvtt->load_file(ftmp);
res+=restmp;
}
gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
ld_set_filename(ftmp);
//restmp=load_wav(newvtt->filename, &newbuffer, &size);
- restmp=newvtt->load_file(ftmp);
+ restmp=(int) newvtt->load_file(ftmp);
res+=restmp;
}
gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
static int load_all_13(FILE *, char *fname); /* fname is for display only*/
static int load_all_14(FILE *, char *fname); /* fname is for display only*/
static int save_all(FILE *);
- int load_file(char *name);
+ tX_audio_error load_file(char *name);
void render_scratch();
void render_lp();
void load_part(char *newfile, vtt_class *vtt)
{
- int ret=0;
+ tX_audio_error ret=TX_AUDIO_SUCCESS;
ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
ld_set_filename(newfile);
switch(ret)
{
case TX_AUDIO_ERR_ALLOC:
- tx_note("Error loading file: failed to allocate memory");
+ tx_note("Failed to load audiofile - there's not enough memory available.", true);
break;
case TX_AUDIO_ERR_PIPE_READ:
- tx_note("Error loading file: broken pipe (File not supported/corrupt?)");
+ tx_note("An error occured on reading from the piped process - probably the file format of the audiofile is not supported by this configuration - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.", true);
break;
case TX_AUDIO_ERR_SOX:
- tx_note("Error loading file: couldn't execute sox");
+ tx_note("Failed to run sox - to load the given audiofile please ensure that sox is installed correctly.", true);
break;
case TX_AUDIO_ERR_MPG123:
- tx_note("Error loading file: couldn't execute mpg123");
+ tx_note("Failed to run mpg123 - to load the given mp3 file please ensure that mpg123 (or mpg321) is installed correctly.", true);
break;
case TX_AUDIO_ERR_WAV_NOTFOUND:
- tx_note("Error loading file: file not found");
+ tx_note("Couldn't acces the audiofile - file not found.", true);
break;
case TX_AUDIO_ERR_NOT_16BIT:
- tx_note("Error loading file: RIFF/WAV is not 16 Bit.");
+ tx_note("The wav file doesn't use 16 bit wide samples - please compile terminatorX with libaudiofile support to enable loading of such files.", true);
break;
case TX_AUDIO_ERR_NOT_MONO:
- tx_note("Error loading file: RIFF/WAV is not mono");
+ tx_note("The wav file is not mono - please compile terminatorX with libaudiofile support to enable loading of such files.", true);
break;
case TX_AUDIO_ERR_WAV_READ:
- tx_note("Error loading file: RIFF/WAV corrupt?");
+ tx_note("The wav file seems to be corrupt.", true);
break;
case TX_AUDIO_ERR_NOT_SUPPORTED:
- tx_note("Error loading file: filetype not supported.");
+ tx_note("The file format of the audiofile is not supported - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.", true);
+ break;
+ case TX_AUDIO_ERR_MAD_OPEN:
+ tx_note("Failed to open this mp3 file - please ensure that the file exists and is readable.", true);
+ break;
+ case TX_AUDIO_ERR_MAD_STAT:
+ tx_note("Failed to 'stat' this mp3 file - please ensure that the file exists and is readable.", true);
+ break;
+ case TX_AUDIO_ERR_MAD_DECODE:
+ tx_note("Failed to decode the mp3 stream - file is corrupt.", true);
+ break;
+ case TX_AUDIO_ERR_MAD_MMAP:
+ tx_note("Failed to map the audiofile to memory - please ensure the file is readable.", true);
+ break;
+ case TX_AUDIO_ERR_MAD_MUNMAP:
+ tx_note("Failed to unmap audiofile.", true);
+ break;
+ case TX_AUDIO_ERR_VORBIS_OPEN:
+ tx_note("Failed to open ogg file - please ensure the file is an ogg stream and that it is readable.", true);
+ break;
+ case TX_AUDIO_ERR_VORBIS_NODATA:
+ tx_note("The vorbis codec failed to decode any data - possibly this ogg stream is corrupt.", true);
+ break;
+ case TX_AUDIO_ERR_AF_OPEN:
+ tx_note("Failed to open this file with libaudiofile - please check terminatorX' INSTALL file on howto configure terminatorX for files of this format.",true);
+ break;
+ case TX_AUDIO_ERR_AF_NODATA:
+ tx_note("libaudiofile failed to decode any data - possilby the audiofile is corrupt.", true);
break;
default:
- tx_note("OOPS: An unknown error occured - This shouldn't happen :(");
+ tx_note("An unknown error occured - if this bug is reproducible please report it, thanks.", true);
}
}
else
if (vtt->samples_in_buffer == 0)
{
- tx_note("Nothing to edit.");
+ tx_note("No audiofile loaded - so there's nothing to edit.", true);
}
else
if (strlen(globals.file_editor)>0)
}
else
{
- tx_note("No soundfile editor configured.");
+ tx_note("No soundfile editor has been configured - to do so enter the soundfile editor of your choice in the options dialog.", true);
}
}
strcpy(reload_buffer, vtt->filename);
load_part(reload_buffer, vtt);
}
- else tx_note("Nothing to reload.");
+ else tx_note("No audiofile loaded - so there's nothing to reload.", true);
}
void clone_vtt(GtkWidget *wid, vtt_class *vtt)