BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
bstusermessage.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_USER_MESSAGE_H__
3 #define __BST_USER_MESSAGE_H__
4 #include "bstutils.hh"
5 G_BEGIN_DECLS
6 
7 /* --- structures --- */
8 typedef enum {
9  BST_MSG_ERROR = Bse::ERROR,
10  BST_MSG_WARNING = Bse::WARNING,
11  BST_MSG_INFO = Bse::INFO,
12  BST_MSG_DEBUG = Bse::DEBUG,
13  BST_MSG_SCRIPT,
14 } BstMsgType;
15 const char* bst_msg_type_ident (BstMsgType);
16 
17 typedef struct {
18  guint id;
19  gchar *text;
20  gchar *stock_icon;
21  gchar *options;
22 } BstMsgBit;
23 typedef struct {
24  const char *log_domain;
25  BstMsgType type;
26  const char *ident; /* type identifier */
27  const char *label; /* type label (translated) */
28  const char *title;
29  const char *primary;
30  const char *secondary;
31  const char *details;
32  const char *config_check;
33  SfiProxy janitor;
34  const char *process;
35  guint pid;
36  guint n_msg_bits;
37  BstMsgBit **msg_bits;
38 } BstMessage;
39 
40 typedef struct {
41  guint type;
42  const gchar *ident;
43  const gchar *label; /* maybe NULL */
44 } BstMsgID;
45 
46 /* --- prototypes --- */
47 void bst_message_connect_to_server (void);
48 void bst_message_dialogs_popdown (void);
49 guint bst_message_handler (const BstMessage *message);
50 guint bst_message_dialog_display (const char *log_domain,
51  BstMsgType type,
52  guint n_bits,
53  BstMsgBit **bits);
54 void bst_msg_bit_free (BstMsgBit *mbit);
55 #define bst_msg_bit_printf(msg_part_id, ...) bst_msg_bit_create (msg_part_id, Rapicorn::string_format (__VA_ARGS__))
56 BstMsgBit* bst_msg_bit_create (guint8 msg_part_id, const std::string &text);
57 BstMsgBit* bst_msg_bit_create_choice (guint id,
58  const gchar *name,
59  const gchar *stock_icon,
60  const gchar *options);
61 #define bst_msg_dialog(level, ...) BST_MSG_DIALOG (level, __VA_ARGS__)
62 /* SFI message bit equivalents */
63 #define BST_MSG_TEXT0(...) bst_msg_bit_printf ('0', __VA_ARGS__)
64 #define BST_MSG_TEXT1(...) bst_msg_bit_printf ('1', __VA_ARGS__)
65 #define BST_MSG_TEXT2(...) bst_msg_bit_printf ('2', __VA_ARGS__)
66 #define BST_MSG_TEXT3(...) bst_msg_bit_printf ('3', __VA_ARGS__)
67 #define BST_MSG_CHECK(...) bst_msg_bit_printf ('c', __VA_ARGS__)
68 #define BST_MSG_TITLE BST_MSG_TEXT0 /* alias */
69 #define BST_MSG_PRIMARY BST_MSG_TEXT1 /* alias */
70 #define BST_MSG_SECONDARY BST_MSG_TEXT2 /* alias */
71 #define BST_MSG_DETAIL BST_MSG_TEXT3 /* alias */
72 /* BST specific message bits */
73 #define BST_MSG_CHOICE(id, name, stock_icon) bst_msg_bit_create_choice (id, name, stock_icon, "C") /* choice */
74 #define BST_MSG_CHOICE_D(id, name, stock_icon) bst_msg_bit_create_choice (id, name, stock_icon, "D") /* default */
75 #define BST_MSG_CHOICE_S(id, name, sticn, sens) bst_msg_bit_create_choice (id, name, sticn, (sens) ? "" : "I") /* insensitive */
76 #define BST_MSG_DIALOG(lvl, ...) ({ BstMsgType __mt = lvl; uint __result = 0; \
77  BstMsgBit *__ba[] = { __VA_ARGS__ }; \
78  __result = bst_message_dialog_display ("BEAST", \
79  __mt, RAPICORN_ARRAY_SIZE (__ba), __ba); \
80  __result; })
81 
82 G_END_DECLS
83 
84 #endif /* __BST_USER_MESSAGE_H__ */
Definition: bstusermessage.hh:23
STL class.
Indicate a message about an error condition.
Definition: bseapi.idl:305
Indicate an informational message.
Definition: bseapi.idl:307
Indicate a debugging message (usually insignificant).
Definition: bseapi.idl:308
Indicate a message about a possibly harmful condition.
Definition: bseapi.idl:306
Definition: bstusermessage.hh:17
Definition: bstusermessage.hh:40
guint bst_message_dialog_display(const char *log_domain, BstMsgType type, guint n_bits, BstMsgBit **bits)
bst_message_dialog_display
Definition: bstusermessage.cc:654