Restore Fl_Choice

* Sound card device selection
pull/1/head
David Freese 2014-08-29 03:23:35 -05:00
rodzic 9a7dfe5bb9
commit eaafc9173c
4 zmienionych plików z 72 dodań i 83 usunięć

Wyświetl plik

@ -3748,9 +3748,9 @@ progdefaults.changed = true;
resetSoundCard();
}
Fl_ListBox *menuOSSDev=(Fl_ListBox *)0;
Fl_Input_Choice *menuOSSDev=(Fl_Input_Choice *)0;
static void cb_menuOSSDev(Fl_ListBox* o, void*) {
static void cb_menuOSSDev(Fl_Input_Choice* o, void*) {
scDevice[0] = scDevice[1] = progdefaults.OSSdevice = o->value();
resetSoundCard();
progdefaults.changed = true;
@ -3764,20 +3764,20 @@ progdefaults.changed = true;
resetSoundCard();
}
Fl_ListBox *menuPortInDev=(Fl_ListBox *)0;
Fl_Choice *menuPortInDev=(Fl_Choice *)0;
static void cb_menuPortInDev(Fl_ListBox* o, void*) {
scDevice[0] = progdefaults.PortInDevice = o->value();
progdefaults.PortInIndex = reinterpret_cast<intptr_t>(o->data());
static void cb_menuPortInDev(Fl_Choice* o, void*) {
scDevice[0] = progdefaults.PortInDevice = o->text();
progdefaults.PortInIndex = reinterpret_cast<intptr_t>(o->mvalue()->user_data());
resetSoundCard();
progdefaults.changed = true;
}
Fl_ListBox *menuPortOutDev=(Fl_ListBox *)0;
Fl_Choice *menuPortOutDev=(Fl_Choice *)0;
static void cb_menuPortOutDev(Fl_ListBox* o, void*) {
scDevice[1] = progdefaults.PortOutDevice = o->value();
progdefaults.PortOutIndex = reinterpret_cast<intptr_t>(o->data());
static void cb_menuPortOutDev(Fl_Choice* o, void*) {
scDevice[1] = progdefaults.PortOutDevice = o->text();
progdefaults.PortOutIndex = reinterpret_cast<intptr_t>(o->mvalue()->user_data());
resetSoundCard();
progdefaults.changed = true;
}
@ -8986,22 +8986,11 @@ le Earth)"));
btnAudioIO[0]->selection_color((Fl_Color)1);
btnAudioIO[0]->callback((Fl_Callback*)cb_btnAudioIO);
} // Fl_Round_Button* btnAudioIO[0]
{ Fl_ListBox* o = menuOSSDev = new Fl_ListBox(425, 75, 110, 24, _("Device:"));
{ Fl_Input_Choice* o = menuOSSDev = new Fl_Input_Choice(424, 75, 110, 25, _("Device:"));
menuOSSDev->tooltip(_("Select device"));
menuOSSDev->box(FL_DOWN_BOX);
menuOSSDev->color(FL_BACKGROUND2_COLOR);
menuOSSDev->selection_color(FL_BACKGROUND_COLOR);
menuOSSDev->labeltype(FL_NORMAL_LABEL);
menuOSSDev->labelfont(0);
menuOSSDev->labelsize(14);
menuOSSDev->labelcolor(FL_FOREGROUND_COLOR);
menuOSSDev->callback((Fl_Callback*)cb_menuOSSDev);
menuOSSDev->align(Fl_Align(FL_ALIGN_LEFT));
menuOSSDev->when(FL_WHEN_RELEASE);
o->value(progdefaults.OSSdevice.c_str());
o->labelsize(FL_NORMAL_SIZE);
menuOSSDev->end();
} // Fl_ListBox* menuOSSDev
} // Fl_Input_Choice* menuOSSDev
AudioOSS->end();
} // Fl_Group* AudioOSS
{ AudioPort = new Fl_Group(55, 110, 490, 80);
@ -9012,35 +9001,16 @@ le Earth)"));
btnAudioIO[1]->selection_color((Fl_Color)1);
btnAudioIO[1]->callback((Fl_Callback*)cb_btnAudioIO1);
} // Fl_Round_Button* btnAudioIO[1]
{ menuPortInDev = new Fl_ListBox(265, 120, 270, 24, _("Capture:"));
{ menuPortInDev = new Fl_Choice(244, 121, 290, 25, _("Capture:"));
menuPortInDev->tooltip(_("Audio input device"));
menuPortInDev->box(FL_DOWN_BOX);
menuPortInDev->color(FL_BACKGROUND2_COLOR);
menuPortInDev->selection_color(FL_BACKGROUND_COLOR);
menuPortInDev->labeltype(FL_NORMAL_LABEL);
menuPortInDev->labelfont(0);
menuPortInDev->labelsize(14);
menuPortInDev->labelcolor(FL_FOREGROUND_COLOR);
menuPortInDev->down_box(FL_BORDER_BOX);
menuPortInDev->callback((Fl_Callback*)cb_menuPortInDev);
menuPortInDev->align(Fl_Align(FL_ALIGN_LEFT));
menuPortInDev->when(FL_WHEN_RELEASE);
menuPortInDev->end();
} // Fl_ListBox* menuPortInDev
{ Fl_ListBox* o = menuPortOutDev = new Fl_ListBox(265, 155, 270, 24, _("Playback:"));
} // Fl_Choice* menuPortInDev
{ menuPortOutDev = new Fl_Choice(244, 156, 290, 25, _("Playback:"));
menuPortOutDev->tooltip(_("Audio output device"));
menuPortOutDev->box(FL_DOWN_BOX);
menuPortOutDev->color(FL_BACKGROUND2_COLOR);
menuPortOutDev->selection_color(FL_BACKGROUND_COLOR);
menuPortOutDev->labeltype(FL_NORMAL_LABEL);
menuPortOutDev->labelfont(0);
menuPortOutDev->labelsize(14);
menuPortOutDev->labelcolor(FL_FOREGROUND_COLOR);
menuPortOutDev->down_box(FL_BORDER_BOX);
menuPortOutDev->callback((Fl_Callback*)cb_menuPortOutDev);
menuPortOutDev->align(Fl_Align(FL_ALIGN_LEFT));
menuPortOutDev->when(FL_WHEN_RELEASE);
o->labelsize(FL_NORMAL_SIZE);
menuPortOutDev->end();
} // Fl_ListBox* menuPortOutDev
} // Fl_Choice* menuPortOutDev
AudioPort->end();
} // Fl_Group* AudioPort
{ AudioPulse = new Fl_Group(55, 190, 490, 45);

Wyświetl plik

@ -291,7 +291,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
static const char szProsigns[] = "~|%|&|+|=|{|}|<|>|[|]| ";} {}
Fl_Window {} {
label {Fldigi configuration} open
xywh {57 115 600 415} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
xywh {921 110 600 415} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
} {
Fl_Tabs tabsConfigure {open
xywh {0 0 600 380} color 50 selection_color 50
@ -4625,7 +4625,7 @@ progdefaults.changed = true;}
}
}
Fl_Group tabSoundCard {
label Audio
label Audio open
tooltip {Audio devices} xywh {0 25 600 355} hide
} {
Fl_Tabs tabsSoundCard {open
@ -4645,15 +4645,13 @@ progdefaults.changed = true;
resetSoundCard();}
tooltip {Use OSS audio server} xywh {65 75 53 25} down_box DOWN_BOX selection_color 1
}
Fl_Group menuOSSDev {
Fl_Input_Choice menuOSSDev {
label {Device:}
callback {scDevice[0] = scDevice[1] = progdefaults.OSSdevice = o->value();
resetSoundCard();
progdefaults.changed = true;} open
tooltip {Select device} xywh {425 75 110 24} box DOWN_BOX color 7 align 4
code0 {o->value(progdefaults.OSSdevice.c_str());
o->labelsize(FL_NORMAL_SIZE);}
class Fl_ListBox
tooltip {Select device} xywh {424 75 110 25}
code0 {o->value(progdefaults.OSSdevice.c_str());}
} {}
}
Fl_Group AudioPort {open
@ -4666,24 +4664,21 @@ progdefaults.changed = true;
resetSoundCard();}
tooltip {Use Port Audio server} xywh {65 138 95 25} down_box DOWN_BOX selection_color 1
}
Fl_Group menuPortInDev {
Fl_Choice menuPortInDev {
label {Capture:}
callback {scDevice[0] = progdefaults.PortInDevice = o->value();
progdefaults.PortInIndex = reinterpret_cast<intptr_t>(o->data());
callback {scDevice[0] = progdefaults.PortInDevice = o->text();
progdefaults.PortInIndex = reinterpret_cast<intptr_t>(o->mvalue()->user_data());
resetSoundCard();
progdefaults.changed = true;} open
tooltip {Audio input device} xywh {265 120 270 24} box DOWN_BOX color 7 align 4
class Fl_ListBox
tooltip {Audio input device} xywh {244 121 290 25} down_box BORDER_BOX
} {}
Fl_Group menuPortOutDev {
Fl_Choice menuPortOutDev {
label {Playback:}
callback {scDevice[1] = progdefaults.PortOutDevice = o->value();
progdefaults.PortOutIndex = reinterpret_cast<intptr_t>(o->data());
callback {scDevice[1] = progdefaults.PortOutDevice = o->text();
progdefaults.PortOutIndex = reinterpret_cast<intptr_t>(o->mvalue()->user_data());
resetSoundCard();
progdefaults.changed = true;} open
tooltip {Audio output device} xywh {265 155 270 24} box DOWN_BOX color 7 align 4
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_ListBox
tooltip {Audio output device} xywh {244 156 290 25} down_box BORDER_BOX
} {}
}
Fl_Group AudioPulse {open

Wyświetl plik

@ -446,10 +446,12 @@ extern Fl_Group *tabSoundCard;
extern Fl_Tabs *tabsSoundCard;
extern Fl_Group *tabAudio;
extern Fl_Group *AudioOSS;
extern Fl_ListBox *menuOSSDev;
#include <FL/Fl_Input_Choice.H>
extern Fl_Input_Choice *menuOSSDev;
extern Fl_Group *AudioPort;
extern Fl_ListBox *menuPortInDev;
extern Fl_ListBox *menuPortOutDev;
#include <FL/Fl_Choice.H>
extern Fl_Choice *menuPortInDev;
extern Fl_Choice *menuPortOutDev;
extern Fl_Group *AudioPulse;
extern Fl_Input2 *inpPulseServer;
extern Fl_Group *AudioNull;

Wyświetl plik

@ -181,11 +181,11 @@ static void init_portaudio(void)
}
// add to menu
if (ilist->dev->maxInputChannels > 0)
menuPortInDev->add(menu_item.c_str(),
reinterpret_cast<void *>(ilist->idx));
menuPortInDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);
if (ilist->dev->maxOutputChannels > 0)
menuPortOutDev->add(menu_item.c_str(),
reinterpret_cast<void *>(ilist->idx));
menuPortOutDev->add(menu_item.c_str(), 0, NULL,
reinterpret_cast<void *>(ilist->idx), 0);
}
if (progdefaults.PortInDevice.length() == 0) {
@ -214,18 +214,40 @@ static void init_portaudio(void)
// select the correct menu items
int size = menuPortInDev->lsize();
for (int i = 1; i <= size; i++) {
menuPortInDev->index(i);
if (progdefaults.PortInDevice == menuPortInDev->value())
break;
const Fl_Menu_Item* menu;
int size;
int idx;
idx = -1;
menu = menuPortInDev->menu();
size = menuPortInDev->size();
for (int i = 0; i < size - 1; i++, menu++) {
if (menu->label() && progdefaults.PortInDevice == menu->label()) {
idx = i; // near match
if (reinterpret_cast<intptr_t>(menu->user_data()) == progdefaults.PortInIndex ||
progdefaults.PortInIndex == -1) // exact match, or index was never saved
break;
}
}
if (idx >= 0) {
menuPortInDev->value(idx);
menuPortInDev->set_changed();
}
size = menuPortOutDev->lsize();
for (int i = 1; i <= size; i++) {
menuPortOutDev->index(i);
if (progdefaults.PortOutDevice == menuPortOutDev->value())
break;
idx = -1;
menu = menuPortOutDev->menu();
size = menuPortOutDev->size();
for (int i = 0; i < size - 1; i++, menu++) {
if (menu->label() && progdefaults.PortOutDevice == menu->label()) {
idx = i;
if (reinterpret_cast<intptr_t>(menu->user_data()) == progdefaults.PortOutIndex ||
progdefaults.PortOutIndex == -1)
break;
}
}
if (idx >= 0) {
menuPortOutDev->value(idx);
menuPortOutDev->set_changed();
}
}
#else