Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bstutils.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_UTILS_H__
3 #define __BST_UTILS_H__
4 #include "bstbseutils.hh"
5 #include "bstdefs.hh"
6 #include "bstcluehunter.hh"
7 /* generated type IDs, idl types */
8 #include "bstserverapi.hh"
9 
10 namespace Bst {
11 
12 // == event loop ==
13 int event_loop_run ();
14 void event_loop_quit (uint8 exit_code = 0);
15 
16 } // Bst
17 
18 
19 // == Bse Server (BSE remote origin) ==
20 extern Bse::ServerH bse_server;
21 
22 
23 /* --- GUI utilities --- */
24 void bst_status_set_error (Bse::Error error, const String &message);
25 #define bst_status_eprintf(error, ...) bst_status_set_error (error, Rapicorn::string_format (__VA_ARGS__))
26 void bst_gui_error_bell (gpointer widget);
27 void bst_window_sync_title_to_proxy (gpointer window,
28  SfiProxy proxy,
29  const gchar *title_format);
30 void bst_container_set_named_child (GtkWidget *container,
31  GQuark qname,
32  GtkWidget *child);
33 GtkWidget* bst_container_get_named_child (GtkWidget *container,
34  GQuark qname);
35 GtkWidget* bst_xpm_view_create (const gchar **xpm,
36  GtkWidget *colormap_widget);
37 GtkWidget* bst_vpack (const gchar *first_location,
38  ...) G_GNUC_NULL_TERMINATED;
39 GtkWidget* bst_hpack (const gchar *first_location,
40  ...) G_GNUC_NULL_TERMINATED;
41 GtkWidget* bst_vpack0 (const gchar *first_location,
42  ...) G_GNUC_NULL_TERMINATED;
43 GtkWidget* bst_hpack0 (const gchar *first_location,
44  ...) G_GNUC_NULL_TERMINATED;
45 void bst_action_list_add_cat (GxkActionList *alist, const Bse::Category &cat, uint skip_levels, const char *stock_fallback,
46  GxkActionCheck acheck, GxkActionExec aexec, gpointer user_data);
47 void bst_action_list_add_module (GxkActionList *alist, const Bse::AuxData &ad, const Bse::Icon &icon, const char *stock_fallback,
48  GxkActionCheck acheck, GxkActionExec aexec, gpointer user_data);
49 GxkActionList* bst_action_list_from_cats (const Bse::CategorySeq &cseq,
50  guint skip_levels,
51  const gchar *stock_fallback,
52  GxkActionCheck acheck,
53  GxkActionExec aexec,
54  gpointer user_data);
55 typedef gboolean (*BstActionListCategoryP) (gpointer predicate_data, const Bse::Category &cat);
56 GxkActionList* bst_action_list_from_cats_pred (const Bse::CategorySeq &cseq,
57  guint skip_levels,
58  const gchar *stock_fallback,
59  GxkActionCheck acheck,
60  GxkActionExec aexec,
61  gpointer user_data,
62  BstActionListCategoryP predicate,
63  gpointer predicate_data);
64 void bst_background_handler1_add (gboolean (*handler) (gpointer data),
65  gpointer data,
66  void (*free_func) (gpointer data));
67 void bst_background_handler2_add (gboolean (*handler) (gpointer data),
68  gpointer data,
69  void (*free_func) (gpointer data));
70 
71 
72 /* --- stock utilities --- */
73 GtkWidget* bst_stock_button (const gchar *stock_id);
74 GtkWidget* bst_stock_dbutton (const gchar *stock_id);
75 GtkWidget* bst_stock_icon_button (const gchar *stock_id);
76 void bst_stock_register_icon (const String &stock_id, uint bytes_per_pixel, uint width, uint height, uint rowstride, const uint8 *pixels);
77 
78 /* --- pixbuf shortcuts --- */
79 #define bst_pixbuf_no_icon() gxk_stock_fallback_pixbuf (BST_STOCK_NO_ICON)
80 #define bst_pixbuf_ladspa() gxk_stock_fallback_pixbuf (BST_STOCK_LADSPA)
81 #define bst_pixbuf_knob() gxk_stock_fallback_pixbuf (BST_STOCK_KNOB)
82 
83 
84 /* --- misc utils --- */
85 gchar* bst_file_scan_find_key (const gchar *file,
86  const gchar *key,
87  const gchar *value_prefix);
88 
89 
90 /* --- GUI field mask --- */
91 typedef struct _BstGMask BstGMask;
92 GtkWidget* bst_gmask_container_create (guint border_width,
93  gboolean dislodge_columns);
94 typedef enum /*< skip >*/
95 {
96  BST_GMASK_FIT,
97  BST_GMASK_FILL,
98  BST_GMASK_INTERLEAVE, /* stretch */
99  BST_GMASK_BIG,
100  BST_GMASK_CENTER,
101  BST_GMASK_MULTI_SPAN
102 } BstGMaskPack;
103 BstGMask* bst_gmask_form (GtkWidget *gmask_container,
104  GtkWidget *action,
105  BstGMaskPack gpack);
106 #define bst_gmask_form_big(c,a) bst_gmask_form ((c), (a), BST_GMASK_BIG)
107 void bst_gmask_set_tip (BstGMask *mask,
108  const gchar *tip_text);
109 void bst_gmask_set_prompt (BstGMask *mask,
110  gpointer widget);
111 void bst_gmask_set_aux1 (BstGMask *mask,
112  gpointer widget);
113 void bst_gmask_set_aux2 (BstGMask *mask,
114  gpointer widget);
115 void bst_gmask_set_aux3 (BstGMask *mask,
116  gpointer widget);
117 void bst_gmask_set_column (BstGMask *mask,
118  guint column);
119 GtkWidget* bst_gmask_get_prompt (BstGMask *mask);
120 GtkWidget* bst_gmask_get_aux1 (BstGMask *mask);
121 GtkWidget* bst_gmask_get_aux2 (BstGMask *mask);
122 GtkWidget* bst_gmask_get_aux3 (BstGMask *mask);
123 GtkWidget* bst_gmask_get_action (BstGMask *mask);
124 void bst_gmask_foreach (BstGMask *mask,
125  gpointer func,
126  gpointer data);
127 void bst_gmask_pack (BstGMask *mask);
128 BstGMask* bst_gmask_quick (GtkWidget *gmask_container,
129  guint column,
130  const gchar *prompt,
131  gpointer action,
132  const gchar *tip_text);
133 #define bst_gmask_set_sensitive(mask, sensitive) \
134  bst_gmask_foreach ((mask), \
135  (sensitive) ? gxk_widget_make_sensitive : gxk_widget_make_insensitive, \
136  NULL)
137 #define bst_gmask_destroy(mask) \
138  bst_gmask_foreach ((mask), gtk_widget_destroy, NULL)
139 #define bst_gmask_ref g_object_ref
140 #define bst_gmask_unref g_object_unref
141 
142 
143 /* --- object utils --- */
144 #define bst_object_class_install_property(oclass, group, property_id, pspec) \
145  g_object_class_install_property (oclass, property_id, sfi_pspec_set_group (pspec, group))
146 
147 /* --- stock icon aliases --- */
148 #define BST_STOCK_QUESTION GTK_STOCK_DIALOG_QUESTION
149 #define BST_STOCK_WARNING GTK_STOCK_DIALOG_WARNING
150 #define BST_STOCK_ERROR GTK_STOCK_DIALOG_ERROR
151 
152 #define BST_STOCK_NEW GTK_STOCK_NEW
153 #define BST_STOCK_OPEN GTK_STOCK_OPEN
154 #define BST_STOCK_MERGE GTK_STOCK_OPEN // FIXME
155 #define BST_STOCK_SAVE GTK_STOCK_SAVE
156 #define BST_STOCK_SAVE_AS GTK_STOCK_SAVE_AS
157 #define BST_STOCK_PREFERENCES GTK_STOCK_PREFERENCES
158 #define BST_STOCK_QUIT GTK_STOCK_QUIT
159 #define BST_STOCK_CLEAR_UNDO GTK_STOCK_DELETE // FIXME
160 #define BST_STOCK_PREFERENCES GTK_STOCK_PREFERENCES
161 #define BST_STOCK_PLAY GTK_STOCK_GO_FORWARD // FIXME
162 #define BST_STOCK_STOP GTK_STOCK_STOP
163 #define BST_STOCK_REMOVE_SYNTH GTK_STOCK_REMOVE
164 #define BST_STOCK_DOC_INDEX GTK_STOCK_HELP // FIXME
165 #define BST_STOCK_DOC_NEWS GTK_STOCK_NEW // FIXME
166 #define BST_STOCK_HELP GTK_STOCK_HELP
167 #define BST_STOCK_DOC_FAQ GTK_STOCK_NEW // FIXME
168 #define BST_STOCK_DOC_DEVEL GTK_STOCK_NEW // FIXME
169 #define BST_STOCK_ABOUT GTK_STOCK_YES // FIXME
170 #define BST_STOCK_ONLINE_HELP_DESK GTK_STOCK_HELP // FIXME
171 #define BST_STOCK_ONLINE_BUGS GTK_STOCK_HELP // FIXME
172 #define BST_STOCK_ONLINE_BEAST_SITE GTK_STOCK_HOME // FIXME
173 #define BST_STOCK_ONLINE_SOUND_ARCHIVE BST_STOCK_LOAD_LIB // FIXME
174 #define BST_STOCK_ADD GTK_STOCK_ADD
175 #define BST_STOCK_REMOVE GTK_STOCK_REMOVE
176 
177 #define BST_STOCK_SELECT_ALL BST_STOCK_NONE // FIXME
178 #define BST_STOCK_SELECT_NONE BST_STOCK_NONE // FIXME
179 #define BST_STOCK_SELECT_INVERT BST_STOCK_NONE // FIXME
180 
181 
182 /* --- stock actions and aliases --- */
183 #define BST_STOCK_NONE ("")
184 #define BST_STOCK_APPLY GTK_STOCK_APPLY
185 #define BST_STOCK_CANCEL GTK_STOCK_CANCEL
186 #define BST_STOCK_CDROM GTK_STOCK_CDROM
187 #define BST_STOCK_CLONE ("bst-stock-clone")
188 #define BST_STOCK_CLOSE GTK_STOCK_CLOSE
189 #define BST_STOCK_DEFAULT_REVERT ("bst-stock-default-revert")
190 #define BST_STOCK_DELETE GTK_STOCK_DELETE
191 #define BST_STOCK_DISMISS ("bst-stock-dismiss")
192 #define BST_STOCK_EXECUTE GTK_STOCK_EXECUTE
193 #define BST_STOCK_OK GTK_STOCK_OK
194 #define BST_STOCK_OVERWRITE ("bst-stock-overwrite")
195 #define BST_STOCK_REDO GTK_STOCK_REDO
196 #define BST_STOCK_REVERT ("bst-stock-revert")
197 #define BST_STOCK_UNDO GTK_STOCK_UNDO
198 #define BST_STOCK_ZOOM_100 GTK_STOCK_ZOOM_100
199 #define BST_STOCK_ZOOM_FIT GTK_STOCK_ZOOM_FIT
200 #define BST_STOCK_ZOOM_IN GTK_STOCK_ZOOM_IN
201 #define BST_STOCK_ZOOM_OUT GTK_STOCK_ZOOM_OUT
202 /* --- generated includes --- */
203 /* marshallers */
204 #include "bstmarshal.h"
205 /* icon stock IDs */
206 #include "beast-gtk/icons/bst-stock-gen.h"
207 /* --- config values --- */
208 Bst::GConfig* bst_gconfig_get_global (void);
209 #define BST_GCONFIG(field) (* bst_gconfig_get_global ()) . field
210 /* --- internal --- */
211 void _bst_init_utils (void);
212 void _bst_init_radgets (void);
213 
214 // == mouse button checks ==
215 bool bst_mouse_button_activate (GdkEvent *event);
216 bool bst_mouse_button_activate1 (GdkEvent *event);
217 bool bst_mouse_button_activate2 (GdkEvent *event);
218 bool bst_mouse_button_context (GdkEvent *event);
219 bool bst_mouse_button_move (GdkEvent *event);
220 inline bool bst_mouse_button_activate (GdkEventButton *event) { return bst_mouse_button_activate ((GdkEvent*) event); }
221 inline bool bst_mouse_button_activate1 (GdkEventButton *event) { return bst_mouse_button_activate1 ((GdkEvent*) event); }
222 inline bool bst_mouse_button_activate2 (GdkEventButton *event) { return bst_mouse_button_activate2 ((GdkEvent*) event); }
223 inline bool bst_mouse_button_context (GdkEventButton *event) { return bst_mouse_button_context ((GdkEvent*) event); }
224 inline bool bst_mouse_button_move (GdkEventButton *event) { return bst_mouse_button_move ((GdkEvent*) event); }
225 
226 
227 #endif /* __BST_UTILS_H__ */
void bst_gmask_set_aux3(BstGMask *mask, gpointer widget)
Definition: bstutils.cc:790
void bst_gmask_set_aux2(BstGMask *mask, gpointer widget)
Definition: bstutils.cc:767
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
Definition: bstutils.cc:29
void bst_gmask_set_aux1(BstGMask *mask, gpointer widget)
Definition: bstutils.cc:742
void bst_gmask_set_prompt(BstGMask *mask, gpointer widget)
Definition: bstutils.cc:719
BstGMask * bst_gmask_form(GtkWidget *gmask_container, GtkWidget *action, BstGMaskPack gpack)
Definition: bstutils.cc:685
GtkWidget * bst_gmask_container_create(guint border_width, gboolean dislodge_columns)
Definition: bstutils.cc:642
void bst_gmask_pack(BstGMask *mask)
Definition: bstutils.cc:1006
void bst_gmask_set_tip(BstGMask *mask, const gchar *tip_text)
Definition: bstutils.cc:699
STL class.
GtkWidget * bst_gmask_get_aux1(BstGMask *mask)
Definition: bstutils.cc:851
GtkWidget * bst_gmask_get_aux3(BstGMask *mask)
Definition: bstutils.cc:887
void bst_gmask_foreach(BstGMask *mask, gpointer func, gpointer data)
Definition: bstutils.cc:925
GtkWidget * bst_gmask_get_aux2(BstGMask *mask)
Definition: bstutils.cc:869
uint8_t uint8
BstGMask * bst_gmask_quick(GtkWidget *gmask_container, guint column, const gchar *prompt, gpointer action, const gchar *tip_text)
Definition: bstutils.cc:1168
GtkWidget * bst_gmask_get_prompt(BstGMask *mask)
Definition: bstutils.cc:833
void bst_gmask_set_column(BstGMask *mask, guint column)
Definition: bstutils.cc:814
GtkWidget * bst_gmask_get_action(BstGMask *mask)
Definition: bstutils.cc:905