kopia lustrzana https://github.com/jamescoxon/dl-fldigi
				
				
				
			Upstream version 3.03AK
							rodzic
							
								
									91eac1e155
								
							
						
					
					
						commit
						aff666dd7b
					
				| 
						 | 
				
			
			@ -28,6 +28,8 @@ Change Log:
 | 
			
		|||
      14) Fixed macro timer to properly reset if <TIMER> re-invoked during
 | 
			
		||||
          timeout period.
 | 
			
		||||
      15) Fixed broken access to on-line subscriber Hamlog data base
 | 
			
		||||
      16) Removed trailing spaces from frequency field in ADIF file
 | 
			
		||||
      17) Changes to rigio thread loop to disable reads during transmit
 | 
			
		||||
      
 | 
			
		||||
3.02
 | 
			
		||||
      1) Added hamlib interface for rig control
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may
 | 
			
		|||
dnl contain other characters or be empty
 | 
			
		||||
m4_define(FLDIGI_MAJOR, [3])
 | 
			
		||||
m4_define(FLDIGI_MINOR, [0])
 | 
			
		||||
m4_define(FLDIGI_PATCH, [3AJ])
 | 
			
		||||
m4_define(FLDIGI_PATCH, [3AK])
 | 
			
		||||
 | 
			
		||||
AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com])
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,10 @@
 | 
			
		|||
#  include <sys/msg.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __CYGWIN__
 | 
			
		||||
#  include <w32api/windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -856,7 +860,38 @@ void cb_mnuAbout(Fl_Widget*, void*)
 | 
			
		|||
 | 
			
		||||
void cb_mnuVisitURL(Fl_Widget*, void* arg)
 | 
			
		||||
{
 | 
			
		||||
	fl_open_uri(reinterpret_cast<const char *>(arg));
 | 
			
		||||
	const char* url = reinterpret_cast<const char *>(arg);
 | 
			
		||||
#ifndef __CYGWIN__
 | 
			
		||||
#  ifdef __APPLE__
 | 
			
		||||
	const char* browsers[] = { "open" };
 | 
			
		||||
#  else
 | 
			
		||||
	const char* browsers[] = { "xdg-open", getenv("BROWSER"), "sensible-brower",
 | 
			
		||||
				   "firefox", "mozilla" };
 | 
			
		||||
#  endif
 | 
			
		||||
	switch (fork()) {
 | 
			
		||||
	case 0:
 | 
			
		||||
		for (size_t i = 0; i < sizeof(browsers)/sizeof(browsers[0]); i++)
 | 
			
		||||
			if (browsers[i])
 | 
			
		||||
				execlp(browsers[i], browsers[i], url, (char*)0);
 | 
			
		||||
		LOG_PERROR("Could not execute a web browser");
 | 
			
		||||
		exit(EXIT_FAILURE);
 | 
			
		||||
	case -1:
 | 
			
		||||
		fl_alert("Could not run a web browser:\n%s\n\n"
 | 
			
		||||
			 "Open this URL manually:\n%s",
 | 
			
		||||
			 strerror(errno), url);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	// gurgle... gurgle... HOWL
 | 
			
		||||
	// "The return value is cast as an HINSTANCE for backward
 | 
			
		||||
	// compatibility with 16-bit Windows applications. It is
 | 
			
		||||
	// not a true HINSTANCE, however. The only thing that can
 | 
			
		||||
	// be done with the returned HINSTANCE is to cast it to an
 | 
			
		||||
	// int and compare it with the value 32 or one of the error
 | 
			
		||||
	// codes below." (Error codes omitted to preserve sanity).
 | 
			
		||||
	if ((int)ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL) <= 32)
 | 
			
		||||
		fl_alert("Could not open url:\n%s\n", url);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        restoreFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -878,8 +913,11 @@ void cb_mnuBeginnersURL(Fl_Widget*, void*)
 | 
			
		|||
		return;
 | 
			
		||||
	f << szBeginner;
 | 
			
		||||
	f.close();
 | 
			
		||||
 | 
			
		||||
#ifndef __CYGWIN__
 | 
			
		||||
	cb_mnuVisitURL(NULL, (void *)deffname.insert(0, "file://").c_str());
 | 
			
		||||
#else
 | 
			
		||||
	cb_mnuVisitURL(NULL, (void *)deffname.c_str());
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cb_mnuAboutURL(Fl_Widget*, void*)
 | 
			
		||||
| 
						 | 
				
			
			@ -1000,7 +1038,7 @@ void cb_mnuAudioInfo(Fl_Widget*, void*)
 | 
			
		|||
 | 
			
		||||
void cb_ShowConfig(Fl_Widget*, void*)
 | 
			
		||||
{
 | 
			
		||||
	cb_mnuVisitURL(0, (void*)string("file://").append(HomeDir).c_str());
 | 
			
		||||
	cb_mnuVisitURL(0, (void*)HomeDir.c_str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cbTune(Fl_Widget *w, void *) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,7 +161,7 @@ int submit_log(void)
 | 
			
		|||
 | 
			
		||||
	const char *mode = mode_info[active_modem->get_mode()].adif_name;
 | 
			
		||||
	
 | 
			
		||||
	snprintf(strFreqMhz, sizeof(strFreqMhz), "%-12f", wf->dFreq()/1.0e6);
 | 
			
		||||
	snprintf(strFreqMhz, sizeof(strFreqMhz), "%-10f", wf->dFreq()/1.0e6);
 | 
			
		||||
 | 
			
		||||
	adif.erase();
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -216,6 +216,9 @@ bool hamlib_init(bool bPtt)
 | 
			
		|||
	hamlib_freq = 0;
 | 
			
		||||
	hamlib_rmode = RIG_MODE_NONE;//RIG_MODE_USB;
 | 
			
		||||
 | 
			
		||||
	hamlib_exit = false;
 | 
			
		||||
	hamlib_bypass = false;
 | 
			
		||||
	
 | 
			
		||||
	if (fl_create_thread(hamlib_thread, hamlib_loop, &dummy) < 0) {
 | 
			
		||||
		show_error(__func__, "pthread_create failed");
 | 
			
		||||
		xcvr->close();
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +228,6 @@ bool hamlib_init(bool bPtt)
 | 
			
		|||
	init_Hamlib_RigDialog();
 | 
			
		||||
	
 | 
			
		||||
	hamlib_closed = false;
 | 
			
		||||
	hamlib_exit = false;
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +263,7 @@ void hamlib_set_ptt(int ptt)
 | 
			
		|||
	fl_lock(&hamlib_mutex);
 | 
			
		||||
		try {
 | 
			
		||||
			xcvr->setPTT(ptt ? RIG_PTT_ON : RIG_PTT_OFF);
 | 
			
		||||
			hamlib_bypass = ptt;
 | 
			
		||||
			hamlib_bypass = ptt ? true : false;
 | 
			
		||||
		}
 | 
			
		||||
		catch (const RigException& Ex) {
 | 
			
		||||
			show_error("Rig PTT", Ex.what());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -970,6 +970,9 @@ bool rigCAT_init()
 | 
			
		|||
	}
 | 
			
		||||
	
 | 
			
		||||
	rigCAT_sendINIT();
 | 
			
		||||
	
 | 
			
		||||
	rigCAT_bypass = false;
 | 
			
		||||
	rigCAT_exit = false;
 | 
			
		||||
 | 
			
		||||
	if (fl_create_thread(rigCAT_thread, rigCAT_loop, &dummy) < 0) {
 | 
			
		||||
		LOG_ERROR("pthread_create failed");
 | 
			
		||||
| 
						 | 
				
			
			@ -980,7 +983,6 @@ bool rigCAT_init()
 | 
			
		|||
	init_Xml_RigDialog();
 | 
			
		||||
 | 
			
		||||
	rigCAT_open = true;
 | 
			
		||||
	rigCAT_exit = false;
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1017,11 +1019,13 @@ void rigCAT_set_ptt(int ptt)
 | 
			
		|||
	if (rigCAT_open == false)
 | 
			
		||||
		return;
 | 
			
		||||
	fl_lock(&rigCAT_mutex);
 | 
			
		||||
		if (ptt)
 | 
			
		||||
		if (ptt) {
 | 
			
		||||
			rigCAT_pttON();
 | 
			
		||||
		else
 | 
			
		||||
			rigCAT_bypass = true;
 | 
			
		||||
		} else{
 | 
			
		||||
			rigCAT_pttOFF();
 | 
			
		||||
		rigCAT_bypass = ptt;
 | 
			
		||||
			rigCAT_bypass = false;
 | 
			
		||||
		}
 | 
			
		||||
	fl_unlock(&rigCAT_mutex);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1067,25 +1071,24 @@ static void *rigCAT_loop(void *args)
 | 
			
		|||
		MilliSleep(100);
 | 
			
		||||
 | 
			
		||||
		if (rigCAT_bypass == true)
 | 
			
		||||
			goto loop;
 | 
			
		||||
 | 
			
		||||
			continue;
 | 
			
		||||
		if (rigCAT_exit == true)
 | 
			
		||||
			goto exitloop;
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		fl_lock(&rigCAT_mutex);
 | 
			
		||||
			freq = rigCAT_getfreq();
 | 
			
		||||
		fl_unlock(&rigCAT_mutex);
 | 
			
		||||
 | 
			
		||||
		if (freq != llFreq) {
 | 
			
		||||
		if ((freq > 0) && (freq != llFreq)) {
 | 
			
		||||
			llFreq = freq;
 | 
			
		||||
			FreqDisp->value(freq); // REQ is built in to the widget
 | 
			
		||||
			wf->rfcarrier(freq);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (rigCAT_exit == true)
 | 
			
		||||
			goto exitloop;
 | 
			
		||||
		if (rigCAT_bypass == true)
 | 
			
		||||
			goto loop;
 | 
			
		||||
			continue;
 | 
			
		||||
		if (rigCAT_exit == true)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		fl_lock(&rigCAT_mutex);
 | 
			
		||||
			sWidth = rigCAT_getwidth();
 | 
			
		||||
| 
						 | 
				
			
			@ -1096,10 +1099,10 @@ static void *rigCAT_loop(void *args)
 | 
			
		|||
			REQ(&Fl_ComboBox::put_value, opBW, sWidth.c_str());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (rigCAT_exit == true)
 | 
			
		||||
			goto exitloop;
 | 
			
		||||
		if (rigCAT_bypass == true)
 | 
			
		||||
			goto loop;
 | 
			
		||||
			continue;
 | 
			
		||||
		if (rigCAT_exit == true)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		fl_lock(&rigCAT_mutex);
 | 
			
		||||
			sMode = rigCAT_getmode();
 | 
			
		||||
| 
						 | 
				
			
			@ -1113,12 +1116,11 @@ static void *rigCAT_loop(void *args)
 | 
			
		|||
				wf->USB(true);
 | 
			
		||||
			REQ(&Fl_ComboBox::put_value, opMODE, sMode.c_str());
 | 
			
		||||
		}
 | 
			
		||||
loop:
 | 
			
		||||
		continue;
 | 
			
		||||
	}
 | 
			
		||||
exitloop:
 | 
			
		||||
 | 
			
		||||
	rigCAT_open = false;
 | 
			
		||||
	rigCAT_exit = false;
 | 
			
		||||
	rigCAT_bypass = false;
 | 
			
		||||
	if (rigcontrol)
 | 
			
		||||
		rigcontrol->hide();
 | 
			
		||||
	wf->USB(true);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue