26 |
set_position(Gtk::WIN_POS_MOUSE); |
set_position(Gtk::WIN_POS_MOUSE); |
27 |
} |
} |
28 |
|
|
29 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 12) |
30 |
|
m_labelIntro.set_margin_start(10); |
31 |
|
m_labelIntro.set_margin_end(10); |
32 |
|
#else |
33 |
m_labelIntro.set_padding(10, 10); |
m_labelIntro.set_padding(10, 10); |
34 |
|
#endif |
35 |
#if GTKMM_MAJOR_VERSION >= 3 |
#if GTKMM_MAJOR_VERSION >= 3 |
36 |
m_labelIntro.set_line_wrap(); |
m_labelIntro.set_line_wrap(); |
37 |
#endif |
#endif |
88 |
m_treeViewMacro.get_selection()->signal_changed().connect( |
m_treeViewMacro.get_selection()->signal_changed().connect( |
89 |
sigc::mem_fun(*this, &MacroEditor::onTreeViewSelectionChanged) |
sigc::mem_fun(*this, &MacroEditor::onTreeViewSelectionChanged) |
90 |
); |
); |
91 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
92 |
|
m_treeViewMacro.signal_key_release_event().connect( |
93 |
|
#else |
94 |
m_treeViewMacro.signal_key_release_event().connect_notify( |
m_treeViewMacro.signal_key_release_event().connect_notify( |
95 |
|
#endif |
96 |
sigc::mem_fun(*this, &MacroEditor::onMacroTreeViewKeyRelease) |
sigc::mem_fun(*this, &MacroEditor::onMacroTreeViewKeyRelease) |
97 |
); |
); |
98 |
m_treeStoreMacro->signal_row_changed().connect( |
m_treeStoreMacro->signal_row_changed().connect( |
117 |
m_applyButton.set_sensitive(false); |
m_applyButton.set_sensitive(false); |
118 |
m_applyButton.grab_focus(); |
m_applyButton.grab_focus(); |
119 |
|
|
120 |
#if GTKMM_MAJOR_VERSION >= 3 |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 12) |
121 |
|
m_labelIntro.set_margin_start(6); |
122 |
|
m_labelIntro.set_margin_end(6); |
123 |
|
#elif GTKMM_MAJOR_VERSION >= 3 |
124 |
m_statusLabel.set_margin_left(6); |
m_statusLabel.set_margin_left(6); |
125 |
m_statusLabel.set_margin_right(6); |
m_statusLabel.set_margin_right(6); |
126 |
#else |
#else |
128 |
#endif |
#endif |
129 |
|
|
130 |
m_statusHBox.pack_start(m_statusLabel); |
m_statusHBox.pack_start(m_statusLabel); |
131 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
132 |
m_statusHBox.show_all_children(); |
m_statusHBox.show_all_children(); |
133 |
|
#endif |
134 |
|
|
135 |
m_footerHBox.pack_start(m_buttonBoxL, Gtk::PACK_SHRINK); |
m_footerHBox.pack_start(m_buttonBoxL, Gtk::PACK_SHRINK); |
136 |
m_footerHBox.pack_start(m_statusHBox); |
m_footerHBox.pack_start(m_statusHBox); |
159 |
); |
); |
160 |
|
|
161 |
signal_delete_event().connect( |
signal_delete_event().connect( |
162 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
163 |
sigc::mem_fun(*this, &MacroEditor::onWindowDelete) |
sigc::mem_fun(*this, &MacroEditor::onWindowDelete) |
164 |
|
#else |
165 |
|
sigc::mem_fun(*this, &MacroEditor::onWindowDeleteP) |
166 |
|
#endif |
167 |
); |
); |
168 |
|
|
169 |
signal_key_press_event().connect( |
signal_key_press_event().connect( |
176 |
m_deleteButton.set_tooltip_text(_("Delete the selected parameters from this macro.")); |
m_deleteButton.set_tooltip_text(_("Delete the selected parameters from this macro.")); |
177 |
m_inverseDeleteButton.set_tooltip_text(_("Delete all parameters from this macro except the selected ones.")); |
m_inverseDeleteButton.set_tooltip_text(_("Delete all parameters from this macro except the selected ones.")); |
178 |
|
|
179 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
180 |
show_all_children(); |
show_all_children(); |
181 |
|
#endif |
182 |
updateStatus(); |
updateStatus(); |
183 |
} |
} |
184 |
|
|
231 |
for (int iMember = 0; iMember < parentObject.members().size(); ++iMember) { |
for (int iMember = 0; iMember < parentObject.members().size(); ++iMember) { |
232 |
const Serialization::Member& member = parentObject.members()[iMember]; |
const Serialization::Member& member = parentObject.members()[iMember]; |
233 |
const Serialization::Object& object = m_macro.objectByUID(member.uid()); |
const Serialization::Object& object = m_macro.objectByUID(member.uid()); |
234 |
|
|
235 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
236 |
|
//HACK: on GTKMM 3.9x append() below requires TreeNodeChildren, parentRow.children() returns TreeNodeConstChildren though, probably going to be fixed before final GTKMM4 release though. |
237 |
|
const Gtk::TreeNodeConstChildren& children = parentRow.children(); |
238 |
|
Gtk::TreeNodeChildren* const pChildren = (Gtk::TreeNodeChildren* const) &children; |
239 |
|
Gtk::TreeModel::iterator iterRow = m_treeStoreMacro->append(*pChildren); |
240 |
|
#else |
241 |
Gtk::TreeModel::iterator iterRow = m_treeStoreMacro->append(parentRow.children()); |
Gtk::TreeModel::iterator iterRow = m_treeStoreMacro->append(parentRow.children()); |
242 |
|
#endif |
243 |
Gtk::TreeModel::Row row = *iterRow; |
Gtk::TreeModel::Row row = *iterRow; |
244 |
row[m_treeModelMacro.m_col_name] = gig_to_utf8(member.name()); |
row[m_treeModelMacro.m_col_name] = gig_to_utf8(member.name()); |
245 |
row[m_treeModelMacro.m_col_type] = gig_to_utf8(member.type().asLongDescr()); |
row[m_treeModelMacro.m_col_type] = gig_to_utf8(member.type().asLongDescr()); |
321 |
GDK_KEY_Control_R; |
GDK_KEY_Control_R; |
322 |
#endif |
#endif |
323 |
|
|
324 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
325 |
|
bool MacroEditor::onKeyPressed(Gdk::EventKey& _key) { |
326 |
|
GdkEventKey* key = _key.gobj(); |
327 |
|
#else |
328 |
bool MacroEditor::onKeyPressed(GdkEventKey* key) { |
bool MacroEditor::onKeyPressed(GdkEventKey* key) { |
329 |
|
#endif |
330 |
//printf("key down 0x%x\n", key->keyval); |
//printf("key down 0x%x\n", key->keyval); |
331 |
if (key->keyval == GDK_KEY_Alt_L || key->keyval == GDK_KEY_Alt_R) |
if (key->keyval == GDK_KEY_Alt_L || key->keyval == GDK_KEY_Alt_R) |
332 |
m_altKeyDown = true; |
m_altKeyDown = true; |
335 |
return false; |
return false; |
336 |
} |
} |
337 |
|
|
338 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
339 |
|
bool MacroEditor::onKeyReleased(Gdk::EventKey& _key) { |
340 |
|
GdkEventKey* key = _key.gobj(); |
341 |
|
#else |
342 |
bool MacroEditor::onKeyReleased(GdkEventKey* key) { |
bool MacroEditor::onKeyReleased(GdkEventKey* key) { |
343 |
|
#endif |
344 |
//printf("key up 0x%x\n", key->keyval); |
//printf("key up 0x%x\n", key->keyval); |
345 |
if (key->keyval == GDK_KEY_Alt_L || key->keyval == GDK_KEY_Alt_R) |
if (key->keyval == GDK_KEY_Alt_L || key->keyval == GDK_KEY_Alt_R) |
346 |
m_altKeyDown = false; |
m_altKeyDown = false; |
349 |
return false; |
return false; |
350 |
} |
} |
351 |
|
|
352 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
353 |
|
bool MacroEditor::onMacroTreeViewKeyRelease(Gdk::EventKey& _key) { |
354 |
|
GdkEventKey* key = _key.gobj(); |
355 |
|
#else |
356 |
void MacroEditor::onMacroTreeViewKeyRelease(GdkEventKey* key) { |
void MacroEditor::onMacroTreeViewKeyRelease(GdkEventKey* key) { |
357 |
|
#endif |
358 |
if (key->keyval == GDK_KEY_BackSpace || key->keyval == GDK_KEY_Delete) { |
if (key->keyval == GDK_KEY_BackSpace || key->keyval == GDK_KEY_Delete) { |
359 |
if (m_altKeyDown) |
if (m_altKeyDown) |
360 |
inverseDeleteSelectedRows(); |
inverseDeleteSelectedRows(); |
361 |
else if (m_primaryKeyDown) |
else if (m_primaryKeyDown) |
362 |
deleteSelectedRows(); |
deleteSelectedRows(); |
363 |
} |
} |
364 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
365 |
|
return true; |
366 |
|
#endif |
367 |
} |
} |
368 |
|
|
369 |
void MacroEditor::onValueCellEdited(const Glib::ustring& sPath, const Glib::ustring& text) { |
void MacroEditor::onValueCellEdited(const Glib::ustring& sPath, const Glib::ustring& text) { |
491 |
m_statusLabel.set_markup(txt); |
m_statusLabel.set_markup(txt); |
492 |
} |
} |
493 |
|
|
494 |
bool MacroEditor::onWindowDelete(GdkEventAny* e) { |
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
495 |
|
bool MacroEditor::onWindowDelete(Gdk::Event& e) { |
496 |
|
return onWindowDeleteP(NULL); |
497 |
|
} |
498 |
|
#endif |
499 |
|
|
500 |
|
bool MacroEditor::onWindowDeleteP(GdkEventAny* /*e*/) { |
501 |
//printf("onWindowDelete\n"); |
//printf("onWindowDelete\n"); |
502 |
|
|
503 |
if (!isModified()) return false; // propagate event further (which will close this window) |
if (!isModified()) return false; // propagate event further (which will close this window) |
540 |
} |
} |
541 |
|
|
542 |
void MacroEditor::onButtonCancel() { |
void MacroEditor::onButtonCancel() { |
543 |
bool dropEvent = onWindowDelete(NULL); |
bool dropEvent = onWindowDeleteP(NULL); |
544 |
if (dropEvent) return; |
if (dropEvent) return; |
545 |
hide(); |
hide(); |
546 |
} |
} |