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