1 /*
2  * Copyright (C) 2009, Magnus Hjorth
3  *
4  * This file is part of mhWaveEdit.
5  *
6  * mhWaveEdit is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * mhWaveEdit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mhWaveEdit; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 
22 #ifndef RECORDFORMATCOMBO_H_INCLUDED
23 #define RECORDFORMATCOMBO_H_INCLUDED
24 
25 #include <gtk/gtk.h>
26 #include "combo.h"
27 #include "dataformat.h"
28 #include "listobject.h"
29 
30 #define RECORD_FORMAT_COMBO(obj) GTK_CHECK_CAST(obj,record_format_combo_get_type(),RecordFormatCombo)
31 #define RECORD_FORMAT_COMBO_CLASS(klass) GTK_CHECK_CLASS_CAST(klass,record_format_combo_get_type(),RecordFormatComboClass)
32 #define IS_RECORD_FORMAT_COMBO(obj) GTK_CHECK_TYPE(obj,record_format_combo_get_type())
33 
34 typedef struct {
35      gint num;
36      gchar *name;
37      Dataformat fmt;
38 } RecordFormat;
39 
40 
41 typedef struct {
42      Combo c;
43 
44      /* Private */
45      int current_selection_type; /* 0 none, 1 user preset, 2 driver preset,
46 				  * 3 custom */
47      gchar *current_selection_name;
48      Dataformat current_selection_format;
49 
50      int stored_selection_type;
51      gchar *stored_selection_name;
52      Dataformat stored_selection_format;
53 
54      int named_preset_start,nameless_preset_start,custom_start,other_start;
55      ListObject *named_presets,*nameless_presets;
56 
57      gboolean show_other;
58 
59 } RecordFormatCombo;
60 
61 typedef struct {
62      ComboClass klass;
63      void (*format_changed)(RecordFormatCombo *rfc, Dataformat *new_fmt);
64      void (*format_dialog_request)(RecordFormatCombo *rfc);
65 } RecordFormatComboClass;
66 
67 GtkType record_format_combo_get_type(void);
68 
69 GtkWidget *record_format_combo_new(ListObject *named_presets,
70 				   ListObject *driver_presets,
71 				   gboolean show_dialog_item);
72 
73 gboolean record_format_combo_set_named_preset(RecordFormatCombo *rfc,
74 					     gchar *preset_name);
75 
76 void record_format_combo_set_format(RecordFormatCombo *rfc, Dataformat *fmt);
77 
78 void record_format_combo_store(RecordFormatCombo *rfc);
79 void record_format_combo_recall(RecordFormatCombo *rfc);
80 
81 Dataformat *record_format_combo_get_format(RecordFormatCombo *rfc);
82 gchar *record_format_combo_get_preset_name(RecordFormatCombo *rfc);
83 
84 #endif
85