kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Macro Idle
Change idle macro to allow fractional seconds <IDLE:nn.nn> Changed execution process for idle macro. Improved layout of macro edit dialogpull/2/head
rodzic
a61d925727
commit
40ae07fd45
|
@ -4479,9 +4479,13 @@ void put_rx_data(int *data, int len)
|
|||
FHdisp->data(data, len);
|
||||
}
|
||||
|
||||
extern bool macro_idle_on;
|
||||
|
||||
char szTestChar[] = "E|I|S|T|M|O|A|V";
|
||||
int get_tx_char(void)
|
||||
{
|
||||
if (macro_idle_on) return -1;
|
||||
|
||||
if (arq_text_available)
|
||||
return arq_get_char();
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ void loadBrowser(Fl_Widget *widget) {
|
|||
|
||||
w->add(LINE_SEP);
|
||||
w->add(_("<FILE:>\tinsert text file"));
|
||||
w->add(_("<IDLE:NN>\tidle signal for NN sec"));
|
||||
w->add(_("<IDLE:NN.nn>\tidle signal for NN.nn sec"));
|
||||
w->add(_("<TIMER:NN>\trepeat every NN sec"));
|
||||
w->add(_("<TUNE:NN>\ttune signal for NN sec"));
|
||||
w->add(_("<WAIT:NN>\tdelay xmt for NN sec"));
|
||||
|
@ -229,28 +229,31 @@ void cbInsertMacro(Fl_Widget *, void *)
|
|||
|
||||
Fl_Double_Window* make_macroeditor(void)
|
||||
{
|
||||
Fl_Double_Window* w = new Fl_Double_Window(730, 230, "");
|
||||
labeltext = new Fl_Input2(45, 15, 115, 25, _("Label:"));
|
||||
labeltext->textfont(FL_COURIER);
|
||||
Fl_Double_Window* w = new Fl_Double_Window(768, 190, "");
|
||||
|
||||
btnMacroEditOK = new Fl_Button(500, 15, 75, 25, _("OK"));
|
||||
btnMacroEditOK->callback(cbMacroEditOK);
|
||||
|
||||
btnMacroEditCancel = new Fl_Button(600, 15, 75, 25, _("Cancel"));
|
||||
btnMacroEditCancel->callback(cbMacroEditOK);
|
||||
|
||||
macrotext = new Fl_Input2(5, 60, 450, 165, _("Text:"));
|
||||
macrotext = new Fl_Input2(2, 22, 450, 140, _("Text:"));
|
||||
macrotext->type(FL_MULTILINE_INPUT);
|
||||
macrotext->textfont(FL_COURIER);
|
||||
macrotext->align(FL_ALIGN_TOP_LEFT);
|
||||
|
||||
btnInsertMacro = new Fl_Button(460, 125, 25, 25);
|
||||
btnInsertMacro = new Fl_Button(454, 86, 20, 20);
|
||||
btnInsertMacro->image(new Fl_Pixmap(left_arrow_icon));
|
||||
btnInsertMacro->callback(cbInsertMacro);
|
||||
|
||||
macroDefs = new Fl_Hold_Browser(490, 60, 235, 165);
|
||||
macroDefs = new Fl_Hold_Browser(476, 22, 290, 140, _("Select Tags:"));
|
||||
macroDefs->column_widths(widths);
|
||||
macroDefs->align(FL_ALIGN_TOP_LEFT);
|
||||
loadBrowser(macroDefs);
|
||||
|
||||
labeltext = new Fl_Input2(2 + 450 - 115, 164, 115, 24, _("Macro Button Label:"));
|
||||
labeltext->textfont(FL_COURIER);
|
||||
|
||||
btnMacroEditOK = new Fl_Button(476 + 145 - 80 - 1, 164, 80, 24, _("OK"));
|
||||
btnMacroEditOK->callback(cbMacroEditOK);
|
||||
|
||||
btnMacroEditCancel = new Fl_Button(476 + 145 + 1 , 164, 80, 24, _("Cancel"));
|
||||
btnMacroEditCancel->callback(cbMacroEditOK);
|
||||
|
||||
w->end();
|
||||
w->xclass(PACKAGE_NAME);
|
||||
return w;
|
||||
|
|
|
@ -297,17 +297,17 @@ void pPOST(string &s, size_t &i)
|
|||
s.replace(i, endbracket - i + 1, "");
|
||||
}
|
||||
|
||||
bool useIdle = false;
|
||||
int idleTime = 0;
|
||||
bool macro_idle_on = false;
|
||||
float idleTime = 0;
|
||||
|
||||
void pIDLE(string &s, size_t &i)
|
||||
{
|
||||
size_t endbracket = s.find('>',i);
|
||||
int number;
|
||||
float number;
|
||||
string sTime = s.substr(i+6, endbracket - i - 6);
|
||||
if (sTime.length() > 0) {
|
||||
sscanf(sTime.c_str(), "%d", &number);
|
||||
useIdle = true;
|
||||
sscanf(sTime.c_str(), "%f", &number);
|
||||
macro_idle_on = true;
|
||||
idleTime = number;
|
||||
}
|
||||
s.replace(i, endbracket - i + 1, "");
|
||||
|
@ -1076,23 +1076,19 @@ string MACROTEXT::expandMacro(int n)
|
|||
|
||||
string text2send = "";
|
||||
|
||||
void insertTextAfter(void *)
|
||||
void idleTimer(void *)
|
||||
{
|
||||
TransmitText->add( text2send.c_str() );
|
||||
text2send.clear();
|
||||
macro_idle_on = false;
|
||||
}
|
||||
|
||||
void continueMacro(void *)
|
||||
{
|
||||
if ( TransmitON ) {
|
||||
active_modem->set_stopflag(false);
|
||||
if (macro_idle_on && idleTime > 0)
|
||||
Fl::add_timeout(idleTime, idleTimer);
|
||||
start_tx();
|
||||
TransmitON = false;
|
||||
if (useIdle && idleTime > 0) {
|
||||
Fl::add_timeout(idleTime , insertTextAfter);
|
||||
useIdle = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
TransmitText->add( text2send.c_str() );
|
||||
text2send.clear();
|
||||
|
@ -1115,13 +1111,10 @@ void finishWait(void *)
|
|||
}
|
||||
if ( TransmitON ) {
|
||||
active_modem->set_stopflag(false);
|
||||
if (macro_idle_on && idleTime > 0)
|
||||
Fl::add_timeout(idleTime, idleTimer);
|
||||
start_tx();
|
||||
TransmitON = false;
|
||||
if (useIdle && idleTime > 0) {
|
||||
Fl::add_timeout(idleTime , insertTextAfter);
|
||||
useIdle = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
TransmitText->add( text2send.c_str() );
|
||||
text2send.clear();
|
||||
|
@ -1138,9 +1131,11 @@ void MACROTEXT::execute(int n)
|
|||
text2send = expandMacro(n);
|
||||
if (ToggleTXRX) {
|
||||
text2send.clear();
|
||||
if (!wf->xmtrcv->value())
|
||||
if (!wf->xmtrcv->value()) {
|
||||
REQ(set_button, wf->xmtrcv, true);
|
||||
else
|
||||
if (macro_idle_on && idleTime > 0)
|
||||
Fl::add_timeout(idleTime, idleTimer);
|
||||
} else
|
||||
REQ(set_button, wf->xmtrcv, false);
|
||||
return;
|
||||
}
|
||||
|
@ -1156,14 +1151,12 @@ void MACROTEXT::execute(int n)
|
|||
return;
|
||||
}
|
||||
if ( TransmitON ) {
|
||||
if (macro_idle_on && idleTime > 0)
|
||||
Fl::add_timeout(idleTime, idleTimer);
|
||||
|
||||
active_modem->set_stopflag(false);
|
||||
start_tx();
|
||||
TransmitON = false;
|
||||
if (useIdle && idleTime > 0) {
|
||||
Fl::add_timeout(idleTime , insertTextAfter);
|
||||
useIdle = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
TransmitText->add( text2send.c_str() );
|
||||
text2send.clear();
|
||||
|
|
Ładowanie…
Reference in New Issue