/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */
# include <config.h>

#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>


#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "ADM_assert.h"
#include "ADM_library/default.h"
#include "ADM_gui2/support.h"
#include "ADM_toolkit/toolkit_gtk.h"
#include "ADM_toolkit/toolkit_gtk_include.h"

#include "ADM_assert.h" 


#include "ADM_audiofilter/audioeng_buildfilters.h"
#include "ADM_audiofilter/audioencoder.h"
#include "ADM_audiofilter/audioencoder_lame_param.h"


#define NB_BITRATE 11
static int BTR[] = {		// see interface.c if you change this !
		48,
		56,
		64,
		80,
    		96,
    		112,
    		128,
   		 160,
    		192,
   		 224,
		 384
};
  


 static GtkWidget	*create_dialog1 (void);
 
 int DIA_defaultSettings(ADM_audioEncoderDescriptor *descriptor)
  {
  GtkWidget *dialog;
  
  int ret=0;
  char string[400];
  GtkComboBox *combo_box;

    dialog=create_dialog1();
    gtk_window_set_title (GTK_WINDOW (dialog), descriptor->name);
    gtk_register_dialog(dialog);

        // ******** Set mode****************
        // *******  set bitrate ************
        combo_box=GTK_COMBO_BOX(WID(comboboxBitrate));
        gtk_combo_box_remove_text(combo_box,0);
        
        for(unsigned int i=0;i<NB_BITRATE;i++)
        {
            sprintf(string,"%d kbits",BTR[i]);
            gtk_combo_box_append_text(combo_box,string);
            if(descriptor->bitrate==BTR[i])
              gtk_combo_box_set_active(combo_box,i);
        }
        if(GTK_RESPONSE_OK==gtk_dialog_run(GTK_DIALOG(dialog)))
        {
          combo_box=GTK_COMBO_BOX(WID(comboboxBitrate));
          descriptor->bitrate=BTR[gtk_combo_box_get_active(combo_box)];
        }
        gtk_unregister_dialog(dialog);
        gtk_widget_destroy(dialog);
        return ret;
  }

//___________ glade stuff below ____________

  GtkWidget*
      create_dialog1 (void)
  {
    GtkWidget *dialog1;
    GtkWidget *dialog_vbox1;
    GtkWidget *hbox1;
    GtkWidget *label1;
    GtkWidget *comboboxBitrate;
    GtkWidget *dialog_action_area1;
    GtkWidget *cancelbutton1;
    GtkWidget *okbutton1;

    dialog1 = gtk_dialog_new ();
    gtk_window_set_title (GTK_WINDOW (dialog1), _("Audio Encoder Settings"));
    gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

    dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
    gtk_widget_show (dialog_vbox1);

    hbox1 = gtk_hbox_new (FALSE, 0);
    gtk_widget_show (hbox1);
    gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, FALSE, TRUE, 0);

    label1 = gtk_label_new (_("<b>Bitrate :</b>"));
    gtk_widget_show (label1);
    gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);
    gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);

    comboboxBitrate = gtk_combo_box_new_text ();
    gtk_widget_show (comboboxBitrate);
    gtk_box_pack_start (GTK_BOX (hbox1), comboboxBitrate, TRUE, TRUE, 0);

    dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
    gtk_widget_show (dialog_action_area1);
    gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

    cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
    gtk_widget_show (cancelbutton1);
    gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
    GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

    okbutton1 = gtk_button_new_from_stock ("gtk-ok");
    gtk_widget_show (okbutton1);
    gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
    GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

    /* Store pointers to all widgets, for use by lookup_widget(). */
    GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
    GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
    GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
    GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
    GLADE_HOOKUP_OBJECT (dialog1, comboboxBitrate, "comboboxBitrate");
    GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
    GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
    GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

    return dialog1;
  }

