mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-25 07:57:43 +01:00
[Summary] Adding convenient methods to get dropdawn item data
This commit is contained in:
parent
3484f5f3e9
commit
28efa3f82d
4 changed files with 12 additions and 10 deletions
|
|
@ -44,7 +44,7 @@ void*
|
|||
WavesDropdown::get_item_associated_data(int item_number)
|
||||
{
|
||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||
if (item_number >= items.size() ) {
|
||||
if (item_number >= items.size()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ Gtk::MenuItem*
|
|||
WavesDropdown::get_item (int item_number)
|
||||
{
|
||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||
if (item_number >= items.size() ) {
|
||||
if (item_number >= items.size()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ class WavesDropdown : public WavesIconButton
|
|||
int get_current_item () { return _current_item_number; }
|
||||
void set_current_item (int current_item_number);
|
||||
|
||||
void* get_item_associated_data (int);
|
||||
void* get_item_associated_data (size_t);
|
||||
int get_item_data_i (size_t item) { return (char*)get_item_associated_data(item) - (char*)0; }
|
||||
unsigned int get_item_data_u (size_t item) { return (char*)get_item_associated_data(item) - (char*)0; }
|
||||
Gtk::MenuItem* get_item (int);
|
||||
Gtk::MenuItem* get_item (const std::string&);
|
||||
|
||||
|
|
@ -46,7 +48,7 @@ class WavesDropdown : public WavesIconButton
|
|||
void set_maxmenuheight (int maxmenuheight) { _maxmenuheight = ((maxmenuheight < 0) ? -1 : maxmenuheight); }
|
||||
int get_maxmenuheight () const { return _maxmenuheight; }
|
||||
|
||||
sigc::signal2<void, WavesDropdown*, int> selected_item_changed;
|
||||
sigc::signal2<void, WavesDropdown*, size_t> selected_item_changed;
|
||||
|
||||
private:
|
||||
static char* menu_item_data_key;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ WavesExportFilenameSelector::change_date_format (WavesDropdown*, int item)
|
|||
return;
|
||||
}
|
||||
|
||||
filename->set_date_format ((DateFormat)((char*)_date_format_dropdown.get_item_associated_data(item) - (char*)0));
|
||||
filename->set_date_format ((DateFormat)_date_format_dropdown.get_item_data_u(item));
|
||||
CriticalSelectionChanged();
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ WavesExportFilenameSelector::change_time_format (WavesDropdown*, int item)
|
|||
return;
|
||||
}
|
||||
|
||||
filename->set_time_format ((TimeFormat)((char*)_time_format_dropdown.get_item_associated_data(item) - (char*)0));
|
||||
filename->set_time_format ((TimeFormat)_time_format_dropdown.get_item_data_u(item));
|
||||
CriticalSelectionChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void
|
|||
WavesExportFormatSelector::on_format_dropdown (WavesDropdown*, int item)
|
||||
{
|
||||
if (_state && _state->format) {
|
||||
ExportFormatId export_format_id = ExportFormatId((char*)_format_dropdown.get_item_associated_data(item) - (char*)0);
|
||||
ExportFormatId export_format_id = ExportFormatId(_format_dropdown.get_item_data_u(item));
|
||||
switch (export_format_id) {
|
||||
case AIFF:
|
||||
_state->format->set_format_id (ARDOUR::ExportFormatBase::F_AIFF);
|
||||
|
|
@ -223,7 +223,7 @@ void
|
|||
WavesExportFormatSelector::on_depth_dropdown (WavesDropdown*, int item)
|
||||
{
|
||||
if (_state && _state->format) {
|
||||
int depth = int((char*)_depth_dropdown.get_item_associated_data(item) - (char*)0);
|
||||
unsigned int depth = _depth_dropdown.get_item_data_u(item);
|
||||
|
||||
switch (depth) {
|
||||
case 24:
|
||||
|
|
@ -243,7 +243,7 @@ void
|
|||
WavesExportFormatSelector::on_sample_rate_dropdown (WavesDropdown*, int item)
|
||||
{
|
||||
if (_state && _state->format) {
|
||||
int sample_rate = int((char*)_sample_rate_dropdown.get_item_associated_data(item) - (char*)0);
|
||||
unsigned int sample_rate = _sample_rate_dropdown.get_item_data_u(item);
|
||||
|
||||
switch (sample_rate) {
|
||||
case 44100:
|
||||
|
|
@ -275,7 +275,7 @@ void
|
|||
WavesExportFormatSelector::on_dithering_dropdown (WavesDropdown*, int item)
|
||||
{
|
||||
if (_state && _state->format) {
|
||||
ExportDitheringId export_format_id = ExportDitheringId((char*)_dithering_dropdown.get_item_associated_data(item) - (char*)0);
|
||||
ExportDitheringId export_format_id = ExportDitheringId(_dithering_dropdown.get_item_data_u(item));
|
||||
switch (export_format_id) {
|
||||
case Shaped:
|
||||
_state->format->set_dither_type (ARDOUR::ExportFormatBase::D_Shaped);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue