BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bstfiledialog.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BST_FILE_DIALOG_H__
00003 #define __BST_FILE_DIALOG_H__
00004 
00005 #include "bstutils.hh"
00006 #include "bstapp.hh"
00007 
00008 G_BEGIN_DECLS
00009 
00010 
00011 /* --- type macros --- */
00012 #define BST_TYPE_FILE_DIALOG              (bst_file_dialog_get_type ())
00013 #define BST_FILE_DIALOG(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_FILE_DIALOG, BstFileDialog))
00014 #define BST_FILE_DIALOG_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_FILE_DIALOG, BstFileDialogClass))
00015 #define BST_IS_FILE_DIALOG(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_FILE_DIALOG))
00016 #define BST_IS_FILE_DIALOG_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_FILE_DIALOG))
00017 #define BST_FILE_DIALOG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_FILE_DIALOG, BstFileDialogClass))
00018 
00019 
00020 /* --- typedefs --- */
00021 typedef struct  _BstFileDialog      BstFileDialog;
00022 typedef struct  _BstFileDialogClass BstFileDialogClass;
00023 
00024 
00025 /* --- structures --- */
00026 typedef enum {
00027   BST_FILE_DIALOG_OPEN_PROJECT     = 0x0001,
00028   BST_FILE_DIALOG_MERGE_PROJECT    = 0x0002,
00029   BST_FILE_DIALOG_SAVE_PROJECT     = 0x0003,
00030   BST_FILE_DIALOG_IMPORT_MIDI      = 0x0004,
00031   BST_FILE_DIALOG_SELECT_FILE      = 0x0008,
00032   BST_FILE_DIALOG_SELECT_DIR       = 0x0009,
00033   BST_FILE_DIALOG_LOAD_WAVE        = 0x0011,
00034   BST_FILE_DIALOG_LOAD_WAVE_LIB    = 0x0012,
00035   BST_FILE_DIALOG_MERGE_EFFECT     = 0x0021,
00036   BST_FILE_DIALOG_MERGE_INSTRUMENT = 0x0022,
00037   BST_FILE_DIALOG_SAVE_EFFECT      = 0x0023,
00038   BST_FILE_DIALOG_SAVE_INSTRUMENT  = 0x0024,
00039   BST_FILE_DIALOG_MODE_MASK        = 0x00ff,
00040   BST_FILE_DIALOG_ALLOW_DIRS       = 0x1000,
00041   BST_FILE_DIALOG_FLAG_MASK        = 0xff00
00042 } BstFileDialogMode;
00043 struct _BstFileDialog
00044 {
00045   GxkDialog         parent_instance;
00046   GtkFileSelection *fs;
00047   GtkWidget        *notebook;
00048   GtkWidget        *fpage;      /* file selection */
00049   GtkWidget        *spage;      /* sample selection */
00050   GtkTreeView      *tview;      /* sample selection tree view */
00051   GtkWidget        *osave;      /* save options */
00052   GtkWidget        *radio1, *radio2;
00053   gchar            *selected;
00054   /* mode state */
00055   BstFileDialogMode mode : 16;
00056   guint             ignore_activate : 1;
00057   guint             using_file_store : 1;
00058   guint             apply_project_name : 1;
00059   GtkTreeModel     *file_store;
00060   gchar            *search_path;
00061   const gchar      *search_filter;
00062   GtkWindow        *parent_window;
00063   SfiProxy          proxy, super;
00064 };
00065 struct _BstFileDialogClass
00066 {
00067   GxkDialogClass parent_class;
00068 };
00069 
00070 
00071 /* --- prototypes --- */
00072 GType           bst_file_dialog_get_type                (void);
00073 GtkWidget*      bst_file_dialog_popup_open_project      (gpointer          parent_widget);
00074 GtkWidget*      bst_file_dialog_popup_merge_project     (gpointer          parent_widget,
00075                                                          SfiProxy          project);
00076 GtkWidget*      bst_file_dialog_popup_import_midi       (gpointer          parent_widget,
00077                                                          SfiProxy          project);
00078 GtkWidget*      bst_file_dialog_popup_save_project      (gpointer          parent_widget,
00079                                                          SfiProxy          project,
00080                                                          gboolean          query_project_name,
00081                                                          gboolean          apply_project_name);
00082 GtkWidget*      bst_file_dialog_popup_merge_effect      (gpointer          parent_widget,
00083                                                          SfiProxy          project);
00084 GtkWidget*      bst_file_dialog_popup_save_effect       (gpointer          parent_widget,
00085                                                          SfiProxy          project,
00086                                                          SfiProxy          super);
00087 GtkWidget*      bst_file_dialog_popup_save_instrument   (gpointer          parent_widget,
00088                                                          SfiProxy          project,
00089                                                          SfiProxy          super);
00090 GtkWidget*      bst_file_dialog_popup_merge_instrument  (gpointer          parent_widget,
00091                                                          SfiProxy          project);
00092 GtkWidget*      bst_file_dialog_popup_select_file       (gpointer          parent_widget);
00093 GtkWidget*      bst_file_dialog_popup_select_dir        (gpointer          parent_widget);
00094 GtkWidget*      bst_file_dialog_popup_load_wave         (gpointer          parent_widget,
00095                                                          SfiProxy          wave_repo,
00096                                                          gboolean          show_lib);
00097 void            bst_file_dialog_set_mode                (BstFileDialog    *self,
00098                                                          gpointer          parent_widget,
00099                                                          BstFileDialogMode mode,
00100                                                          const gchar      *fs_title,
00101                                                          SfiProxy          project);
00102 GtkWidget*      bst_file_dialog_create                  (void);
00103 void            bst_file_dialog_setup                   (GtkWidget        *widget,
00104                                                          gpointer          parent_widget,
00105                                                          const gchar      *title,
00106                                                          const gchar      *search_path);
00107 typedef void  (*BstFileDialogHandler)                   (GtkWidget        *dialog,
00108                                                          const gchar      *file,
00109                                                          gpointer          user_data);
00110 void            bst_file_dialog_set_handler             (BstFileDialog    *self,
00111                                                          BstFileDialogHandler handler,
00112                                                          gpointer          handler_data,
00113                                                          GDestroyNotify    destroy);
00114 
00115 G_END_DECLS
00116 
00117 // == Flags Enumeration Operators in C++ ==
00118 #ifdef __cplusplus
00119 constexpr BstFileDialogMode  operator&  (BstFileDialogMode  s1, BstFileDialogMode s2) { return BstFileDialogMode (s1 & (long long unsigned) s2); }
00120 inline    BstFileDialogMode& operator&= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 & s2; return s1; }
00121 constexpr BstFileDialogMode  operator|  (BstFileDialogMode  s1, BstFileDialogMode s2) { return BstFileDialogMode (s1 | (long long unsigned) s2); }
00122 inline    BstFileDialogMode& operator|= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 | s2; return s1; }
00123 constexpr BstFileDialogMode  operator~  (BstFileDialogMode  s1)                    { return BstFileDialogMode (~(long long unsigned) s1); }
00124 #endif // __cplusplus
00125 
00126 #endif  /* __BST_FILE_DIALOG_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines