Macro tag Image

* Added macro tag for sending image.  Similar to <File:xxx>
    <IMAGE:[full pathname to image file]>
    A file finder will open for image file selection when the
    macro tag is selected from the pick list.
pull/1/head
David Freese 2013-09-18 07:26:17 -05:00
rodzic 8159199998
commit 1eaba46bc6
6 zmienionych plików z 60 dodań i 1 usunięć

Wyświetl plik

@ -72,6 +72,7 @@ extern void deleteTxViewer();
extern void cb_picRxClose( Fl_Widget *w, void *);
extern void cb_picRxAbort( Fl_Widget *w, void *);
extern void picTxSendColor();
extern void cb_picTxSendColor( Fl_Widget *w, void *);
extern void cb_picTxSendGrey( Fl_Widget *w, void *);
extern void cb_picTxSendAbort( Fl_Widget *w, void *);
@ -113,6 +114,7 @@ class mfsk : public modem {
friend void updateTxPic(unsigned char data);
friend void cb_picRxClose( Fl_Widget *w, void *);
friend void cb_picRxAbort( Fl_Widget *w, void *);
friend void pic_TxSendColor();
friend void cb_picTxSendColor( Fl_Widget *w, void *);
friend void cb_picTxSendGrey( Fl_Widget *w, void *);
friend void cb_picTxSendAbort( Fl_Widget *w, void *);
@ -269,6 +271,7 @@ public:
void restart() {};
int rx_process(const double *buf, int len);
int tx_process();
void send_image(std::string s);
void shutdown();
};

Wyświetl plik

@ -121,6 +121,8 @@ public:
void videoText();
void pretone();
virtual void send_image(std::string) {}
void set_stopflag(bool b) { stopflag = b;};
bool get_stopflag() const { return stopflag; };

Wyświetl plik

@ -186,7 +186,7 @@ void cb_picTxClose( Fl_Widget *w, void *)
FL_UNLOCK_D();
}
void cb_picTxSendColor( Fl_Widget *w, void *)
void pic_TxSendColor()
{
int W, H, rowstart;
W = TxImg->w();
@ -221,11 +221,20 @@ void cb_picTxSendColor( Fl_Widget *w, void *)
btnpicTxSendAbort->show();
picTx->clear();
FL_UNLOCK_D();
if (!picTxWin->visible())
picTxWin->show();
;
// start the transmission
start_tx();
serviceme->startpic = true;
}
void cb_picTxSendColor( Fl_Widget *w, void *)
{
pic_TxSendColor();
}
void cb_picTxSendGrey( Fl_Widget *w, void *)
{
if (serviceme != active_modem) return;

Wyświetl plik

@ -1126,3 +1126,10 @@ int mfsk::tx_process()
return 0;
}
void mfsk::send_image(std::string s)
{
load_image(s.c_str());
pic_TxSendColor();
}

Wyświetl plik

@ -158,6 +158,7 @@ void loadBrowser(Fl_Widget *widget) {
w->add(LINE_SEP);
w->add(_("<FILE:>\tinsert text file"));
w->add(_("<IMAGE:>\tinsert MFSK image"));
w->add(LINE_SEP);
w->add(_("<PAUSE>\tpause transmit"));
@ -320,6 +321,13 @@ void cbInsertMacro(Fl_Widget *, void *)
text.insert(6, p);
} else
text = "";
} else if (text == "<IMAGE:>") {
string filters = "Text\t*." "txt";
const char *p = FSEL::select(_("MFSK image file"), "*.{png,jpg,bmp}\t*", "");
if (p) {
text.insert(7, p);
} else
text = "";
} else if (text == "<MACROS:>") {
string filters = "Macrost\t*." "mdf";
const char* p = FSEL::select(_("Change to Macro file"), filters.c_str(),

Wyświetl plik

@ -1121,6 +1121,35 @@ static void pMODEM_compSKED(std::string &s, size_t &i, size_t endbracket)
s.erase(i, k-i);
}
static void doIMAGE(std::string s)
{
if (s.length() > 0) {
string fname = s.substr(7);
fname.erase(fname.length() - 1);
trx_mode active_mode = active_modem->get_mode();
if ((active_mode == MODE_MFSK16 ||
active_mode == MODE_MFSK32 ||
active_mode == MODE_MFSK64 ||
active_mode == MODE_MFSK128) &&
active_modem->get_cap() & modem::CAP_IMG) {
active_modem->send_image(fname);
}
}
que_ok = true;
}
static void pQueIMAGE(std::string &s, size_t &i, size_t endbracket)
{
if (within_exec) {
s.replace(i, endbracket - i + 1, "");
return;
}
string cmdstr = s.substr(i, endbracket - i + 1);
struct CMDS cmd = { cmdstr, doIMAGE };
pushcmd(cmd);
s.replace(i, endbracket - i + 1, "^!");
}
#include <float.h>
#include "re.h"
@ -2292,6 +2321,7 @@ static const MTAGS mtags[] = {
#endif
{"<WX>", pWX},
{"<WX:", pWX2},
{"<IMAGE:", pQueIMAGE},
{"<!WPM:", pQueWPM},
{"<!RISE:", pQueRISETIME},
{"<!PRE:", pQuePRE},