mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
Prototype LV2 dialog-message feature extension
This commit is contained in:
parent
532fbc41cb
commit
72e5ec2c5e
2 changed files with 49 additions and 2 deletions
|
|
@ -140,7 +140,9 @@ LV2PluginUI::request_response (int response,
|
|||
}
|
||||
break;
|
||||
case Variant::BOOL:
|
||||
set_path_property (desc.key, Variant (Variant::BOOL, response == Gtk::RESPONSE_YES));
|
||||
if (response != Gtk::BUTTONS_OK) {
|
||||
set_path_property (desc.key, Variant (Variant::BOOL, response == Gtk::RESPONSE_YES));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -197,7 +199,27 @@ LV2PluginUI::request_value(void* handle,
|
|||
|
||||
case Variant::BOOL:
|
||||
{
|
||||
ArdourMessageDialog* msg = new ArdourMessageDialog (desc.label, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, false);
|
||||
std::string message = desc.label;
|
||||
Gtk::MessageType type = Gtk::MESSAGE_QUESTION;
|
||||
Gtk::ButtonsType buttons = Gtk::BUTTONS_YES_NO;
|
||||
|
||||
#ifdef LV2_EXTENDED
|
||||
for (int i = 0; features && features[i]; ++i) {
|
||||
if (!strcmp (features[i]->URI, LV2_DIALOGMESSAGE_URI)) {
|
||||
LV2_Dialog_Message* mt = NULL;
|
||||
mt = (LV2_Dialog_Message*) features[i]->data;
|
||||
if (mt->msg) {
|
||||
message = mt->msg;
|
||||
mt->free_msg (mt->msg);
|
||||
}
|
||||
if (!mt->requires_return) {
|
||||
type = Gtk::MESSAGE_INFO;
|
||||
buttons = Gtk::BUTTONS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ArdourMessageDialog* msg = new ArdourMessageDialog (message, false, type, buttons, false);
|
||||
msg->signal_response().connect (sigc::bind (sigc::mem_fun (*me, &LV2PluginUI::request_response), desc, msg));
|
||||
msg->present();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,31 @@ typedef struct {
|
|||
void (*notify)(LV2_BankPatch_Handle handle, uint8_t channel, uint32_t bank, uint8_t pgm);
|
||||
} LV2_BankPatch;
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
|
||||
/**
|
||||
@defgroup LV2_Dialog_Message
|
||||
|
||||
LV2 extension to allow a plugin to ask a host to display
|
||||
a dedicated dialog message when requesting a value
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
#define LV2_DIALOGMESSAGE_URI "http://ardour.org/lv2/dialog_message"
|
||||
|
||||
/** a LV2 Feature provided by the Plugin, passed as optional feature to LV2_UI__requestValue */
|
||||
typedef struct {
|
||||
void (*free_msg)(char const* msg);
|
||||
|
||||
char const* msg;
|
||||
bool requires_return;
|
||||
|
||||
} LV2_Dialog_Message;
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue