Changed show callsign behavior

Popup now shows the Name, Last QSO date, Azimuth & Distance
based on logbook record if the station was previously worked
Otherwise the cty.dat file is used if present.
pull/2/head
David Freese 2008-12-30 09:47:00 -06:00
rodzic 5709faf609
commit 3daf3d9a18
3 zmienionych plików z 45 dodań i 12 usunięć

Wyświetl plik

@ -48,6 +48,7 @@ extern void deleteRecord ();
extern void AddRecord ();
extern void SearchLastQSO (const char *);
extern int SearchLog(const char *callsign, const char*** data);
extern char *getSearchField( int fld );
extern void DupCheck(const char *);
extern void cb_search(Fl_Widget* w, void*);
extern int log_search_handler(int);

Wyświetl plik

@ -327,6 +327,15 @@ void DupCheck(const char *callsign)
lblDup->show();
}
cQsoRec *srchRec = 0;
char *getSearchField( int fld )
{
if (srchRec && fld >= CALL && fld < EXPORT)
return srchRec->getField(fld);
return 0;
}
int SearchLog(const char *callsign, const char*** data)
{
size_t len = strlen(callsign);
@ -335,10 +344,12 @@ int SearchLog(const char *callsign, const char*** data)
int row = 0, col = 2;
if (wBrowser->search(row, col, true, re)) {
if (wBrowser->search(row, col, !cQsoDb::reverse, re)) {
srchRec = qsodb.getRec (row);
*data = wBrowser->getRow(row);
return wBrowser->columns();
}
srchRec = 0;
return 0;
}

Wyświetl plik

@ -888,20 +888,41 @@ const char* FTextView::dxcc_lookup_call(int x, int y)
static char tip[128];
size_t len = snprintf(tip, sizeof(tip), "%s (%s GMT%+0.1f) CQ-%d ITU-%d",
e->country, e->continent, -e->gmt_offset, e->cq_zone, e->itu_zone);
if (len < sizeof(tip) && !progdefaults.myLocator.empty()) {
double lon, lat, distance, azimuth;
if (locator2longlat(&lon, &lat, progdefaults.myLocator.c_str()) == RIG_OK &&
qrb(lon, lat, -e->longitude, e->latitude, &distance, &azimuth) == RIG_OK)
len += snprintf(tip + len, sizeof(tip) - len,
"\nQTE %.0f\260 (%.0f\260) QRB %.0fkm (%.0fkm)",
azimuth, azimuth_long_path(azimuth), distance, distance_long_path(distance));
}
if (len < sizeof(tip)) {
const char** data;
if (SearchLog(s, &data) > 0)
snprintf(tip + len, sizeof(tip) - len, "\n* %s (%s)", _("worked before"), data[0]);
char* locator = 0;
char* name = 0;
if (SearchLog(s, &data) > 0) {
locator = getSearchField(GRIDSQUARE);
name = getSearchField(NAME);
if (name)
len += snprintf(tip + len, sizeof(tip) - len, "\n* %s %s (%s)",
name, _("worked before"), data[0]);
else
len += snprintf(tip + len, sizeof(tip) - len, "\n* %s (%s)",
_("worked before"), data[0]);
if ( locator ) {
if (len < sizeof(tip) && !progdefaults.myLocator.empty()) {
double lon, lat, lon2, lat2, distance, azimuth;
if (locator2longlat(&lon, &lat, progdefaults.myLocator.c_str()) == RIG_OK &&
locator2longlat(&lon2, &lat2, locator) == RIG_OK &&
qrb(lon, lat, lon2, lat2, &distance, &azimuth) == RIG_OK)
len += snprintf(tip + len, sizeof(tip) - len,
"\nQTE %.0f\260 (%.0f\260) QRB %.0fkm (%.0fkm)",
azimuth, azimuth_long_path(azimuth), distance, distance_long_path(distance));
}
}
} else {
if (len < sizeof(tip) && !progdefaults.myLocator.empty()) {
double lon, lat, distance, azimuth;
if (locator2longlat(&lon, &lat, progdefaults.myLocator.c_str()) == RIG_OK &&
qrb(lon, lat, -e->longitude, e->latitude, &distance, &azimuth) == RIG_OK)
len += snprintf(tip + len, sizeof(tip) - len,
"\nQTE %.0f\260 (%.0f\260) QRB %.0fkm (%.0fkm)",
azimuth, azimuth_long_path(azimuth), distance, distance_long_path(distance));
}
}
}
ret = tip;
}