Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bstfiledialog.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BST_FILE_DIALOG_H__
3 #define __BST_FILE_DIALOG_H__
4 
5 #include "bstutils.hh"
6 #include "bstapp.hh"
7 
8 
9 /* --- type macros --- */
10 #define BST_TYPE_FILE_DIALOG (bst_file_dialog_get_type ())
11 #define BST_FILE_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_FILE_DIALOG, BstFileDialog))
12 #define BST_FILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_FILE_DIALOG, BstFileDialogClass))
13 #define BST_IS_FILE_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_FILE_DIALOG))
14 #define BST_IS_FILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_FILE_DIALOG))
15 #define BST_FILE_DIALOG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_FILE_DIALOG, BstFileDialogClass))
16 
17 
18 /* --- typedefs --- */
19 typedef struct _BstFileDialog BstFileDialog;
20 typedef struct _BstFileDialogClass BstFileDialogClass;
21 
22 
23 /* --- structures --- */
24 typedef enum {
25  BST_FILE_DIALOG_OPEN_PROJECT = 0x0001,
26  BST_FILE_DIALOG_MERGE_PROJECT = 0x0002,
27  BST_FILE_DIALOG_SAVE_PROJECT = 0x0003,
28  BST_FILE_DIALOG_IMPORT_MIDI = 0x0004,
29  BST_FILE_DIALOG_SELECT_FILE = 0x0008,
30  BST_FILE_DIALOG_SELECT_DIR = 0x0009,
31  BST_FILE_DIALOG_LOAD_WAVE = 0x0011,
32  BST_FILE_DIALOG_LOAD_WAVE_LIB = 0x0012,
33  BST_FILE_DIALOG_LOAD_SOUND_FONT = 0x0013,
34  BST_FILE_DIALOG_LOAD_SOUND_FONT_LIB = 0x0014,
35  BST_FILE_DIALOG_MERGE_EFFECT = 0x0021,
36  BST_FILE_DIALOG_MERGE_INSTRUMENT = 0x0022,
37  BST_FILE_DIALOG_SAVE_EFFECT = 0x0023,
38  BST_FILE_DIALOG_SAVE_INSTRUMENT = 0x0024,
39  BST_FILE_DIALOG_MODE_MASK = 0x00ff,
40  BST_FILE_DIALOG_ALLOW_DIRS = 0x1000,
41  BST_FILE_DIALOG_FLAG_MASK = 0xff00
42 } BstFileDialogMode;
44 {
45  GxkDialog parent_instance;
46  GtkFileSelection *fs;
47  GtkWidget *notebook;
48  GtkWidget *fpage; /* file selection */
49  GtkWidget *spage; /* sample selection */
50  GtkTreeView *tview; /* sample selection tree view */
51  GtkWidget *osave; /* save options */
52  GtkWidget *radio1, *radio2;
53  gchar *selected;
54  /* mode state */
55  BstFileDialogMode mode : 16;
56  guint ignore_activate : 1;
57  guint using_file_store : 1;
58  guint apply_project_name : 1;
59  GtkTreeModel *file_store;
60  gchar *search_path;
61  const gchar *search_filter;
62  GtkWindow *parent_window;
63  SfiProxy super, wave_repo, sound_font_repo;
64  Bse::ProjectH project;
65 };
67 {
68  GxkDialogClass parent_class;
69 };
70 
71 
72 /* --- prototypes --- */
73 GType bst_file_dialog_get_type (void);
74 GtkWidget* bst_file_dialog_popup_open_project (gpointer parent_widget);
75 GtkWidget* bst_file_dialog_popup_merge_project (gpointer parent_widget, Bse::ProjectH project);
76 GtkWidget* bst_file_dialog_popup_import_midi (gpointer parent_widget, Bse::ProjectH project);
77 GtkWidget* bst_file_dialog_popup_save_project (gpointer parent_widget, Bse::ProjectH project,
78  gboolean query_project_name, gboolean apply_project_name);
79 GtkWidget* bst_file_dialog_popup_merge_effect (gpointer parent_widget, Bse::ProjectH project);
80 GtkWidget* bst_file_dialog_popup_save_effect (gpointer parent_widget, Bse::ProjectH project, SfiProxy super);
81 GtkWidget* bst_file_dialog_popup_save_instrument (gpointer parent_widget, Bse::ProjectH project, SfiProxy super);
82 GtkWidget* bst_file_dialog_popup_merge_instrument (gpointer parent_widget, Bse::ProjectH project);
83 GtkWidget* bst_file_dialog_popup_select_file (gpointer parent_widget);
84 GtkWidget* bst_file_dialog_popup_select_dir (gpointer parent_widget);
85 GtkWidget* bst_file_dialog_popup_load_wave (gpointer parent_widget,
86  SfiProxy wave_repo,
87  gboolean show_lib);
88 GtkWidget* bst_file_dialog_popup_load_sound_font (gpointer parent_widget,
89  SfiProxy sound_font_repo,
90  gboolean show_lib);
91 void bst_file_dialog_set_mode (BstFileDialog *self, gpointer parent_widget, BstFileDialogMode mode,
92  const gchar *fs_title, Bse::ProjectH project = Bse::ProjectH(),
93  SfiProxy wave_repo = 0, SfiProxy sound_font_repo = 0);
94 GtkWidget* bst_file_dialog_create (void);
95 void bst_file_dialog_setup (GtkWidget *widget,
96  gpointer parent_widget,
97  const gchar *title,
98  const gchar *search_path);
99 typedef void (*BstFileDialogHandler) (GtkWidget *dialog,
100  const gchar *file,
101  gpointer user_data);
102 void bst_file_dialog_set_handler (BstFileDialog *self,
103  BstFileDialogHandler handler,
104  gpointer handler_data,
105  GDestroyNotify destroy);
106 
107 // == Flags Enumeration Operators in C++ ==
108 #ifdef __cplusplus
109 constexpr BstFileDialogMode operator& (BstFileDialogMode s1, BstFileDialogMode s2) { return BstFileDialogMode (s1 & (long long unsigned) s2); }
110 inline BstFileDialogMode& operator&= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 & s2; return s1; }
111 constexpr BstFileDialogMode operator| (BstFileDialogMode s1, BstFileDialogMode s2) { return BstFileDialogMode (s1 | (long long unsigned) s2); }
112 inline BstFileDialogMode& operator|= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 | s2; return s1; }
113 constexpr BstFileDialogMode operator~ (BstFileDialogMode s1) { return BstFileDialogMode (~(long long unsigned) s1); }
114 #endif // __cplusplus
115 
116 #endif /* __BST_FILE_DIALOG_H__ */
Definition: bstfiledialog.hh:43
Definition: bstfiledialog.hh:66