/** allow control of bandmap features */ void bm_menu() { int curx, cury; char c = -1; int j; getyx( stdscr, cury, curx); /* remember cursor */ attrset( COLOR_PAIR(C_LOG) | A_STANDOUT ); mvprintw( 13, 0, " Toggle <B>and, <M>ode or <D>upes filter"); printw(" | any other - leave"); c = toupper( onechar()); switch (c) { case 'B': bm_config.allband = 1 - bm_config.allband; break; case 'M': bm_config.allmode = 1 - bm_config.allmode; break; case 'D': bm_config.showdupes = 1 - bm_config.showdupes; break; } bandmap_show(); /* refresh display */ move (13,0); for (j = 0; j < 80; j++) addch (' '); move (cury, curx); refreshp(); }
/* helper function to set 'nodelay' mode according to 'wait' * parameter and then ask for the next character * leaves 'nodelay' afterwards always as FALSE (meaning: wait for * character */ static int getkey(int wait) { int x = 0; nodelay(stdscr, wait ? FALSE : TRUE); x = onechar(); nodelay(stdscr, FALSE); return x; }
int changepars(void) { extern int use_rxvt; extern int cluster; extern int shortqsonr; extern int searchflg; extern int demode; extern int contest; extern int announcefilter; extern int showscore_flag; extern int zonedisplay; extern int trxmode; extern char hiscall[]; extern int rit; extern int trx_control; extern int editor; extern int packetinterface; extern int nopacket; extern int cqdelay; extern int ctcomp; extern SCREEN *mainscreen; extern char *config_file; extern int miniterm; extern char buffer[]; #ifdef HAVE_LIBHAMLIB extern freq_t outfreq; #else extern int outfreq; #endif extern int simulator; extern int keyerport; extern char synclogfile[]; extern char sc_volume[]; extern int cwstart; char parameterstring[20]; char parameters[51][19]; char cmdstring[80]; int i, k, x, nopar = 0; int maxpar = 50; int volumebuffer; int currentmode = 0; int rc; strcpy(parameters[0], "SPOT"); strcpy(parameters[1], "MAP"); strcpy(parameters[2], "CLOFF"); strcpy(parameters[3], "CLUSTER"); strcpy(parameters[4], "SHORT"); strcpy(parameters[5], "LONG"); strcpy(parameters[6], "MESSAGE"); strcpy(parameters[7], "LIST"); strcpy(parameters[8], "CHECK"); strcpy(parameters[9], "NOCHECK"); strcpy(parameters[10], "TONE"); strcpy(parameters[11], "EDIT"); strcpy(parameters[12], "VIEW"); strcpy(parameters[13], "HELP"); strcpy(parameters[14], "DEMODE"); strcpy(parameters[15], "CONTEST"); strcpy(parameters[16], "FILTER"); strcpy(parameters[17], "SCORE"); strcpy(parameters[18], "WRITE"); strcpy(parameters[19], "EXIT"); strcpy(parameters[20], "TXFILE"); strcpy(parameters[21], "ZONES"); strcpy(parameters[22], "CTY"); strcpy(parameters[23], "MODE"); strcpy(parameters[24], "SET"); strcpy(parameters[25], "MULTI"); strcpy(parameters[26], "PROP"); strcpy(parameters[27], "RITCLEAR"); strcpy(parameters[28], "TRXCONTROL"); strcpy(parameters[29], "CFG"); //strcpy(parameters[30], "CWMODE"); strcpy(parameters[30], "CW"); strcpy(parameters[31], "SSBMODE"); strcpy(parameters[32], "DIGIMODE"); strcpy(parameters[33], "PACKET"); strcpy(parameters[34], "SIMULATOR"); strcpy(parameters[35], "INFO"); strcpy(parameters[36], "FREQ"); strcpy(parameters[37], "RECONNECT"); strcpy(parameters[38], "QUIT"); strcpy(parameters[39], "CQDELAY"); strcpy(parameters[40], "ADIF"); strcpy(parameters[41], "SYNC"); strcpy(parameters[42], "RESCORE"); strcpy(parameters[43], "SCVOLUME"); strcpy(parameters[44], "SCAN"); strcpy(parameters[45], "DEBUG"); strcpy(parameters[46], "MINITERM"); strcpy(parameters[47], "RTTY"); strcpy(parameters[48], "SOUND"); strcpy(parameters[49], "CWMODE"); strcpy(parameters[50], "CHARS"); nopar = 0; attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, "PARAMETER? "); refreshp(); mvprintw(12, 29, " "); mvprintw(12, 29, ""); refreshp(); echo(); getstr(parameterstring); noecho(); for (k = 0; parameterstring[k]; k++) parameterstring[k] = toupper(parameterstring[k]); for (i = 0; i <= maxpar; i++) { if (strncmp(parameterstring, parameters[i], 3) == 0) { break; } } switch (i) { case 0: /* SPOTS) */ { /* SPOTS not supported anymore * - default to MAP*/ cluster = MAP; break; } case 1: /* BANDMAP */ { cluster = MAP; break; } case 2: /* CLOFF */ { cluster = NOCLUSTER; break; } case 3: /* CLUSTER */ { cluster = CLUSTER; announcefilter = FILTER_ALL; break; } case 4: /* SHORTNR */ { shortqsonr = SHORTCW; break; } case 5: /* LONGNR */ { shortqsonr = LONGCW; break; } case 6: /* MESSAGE */ { message_change(i); break; } case 7: /* LIST */ { listmessages(); break; } case 8: /* CHECK */ { searchflg = SEARCHWINDOW; break; } case 9: /* NOCHECK */ { searchflg = 0; break; } case 10: /* TONE */ { set_tone(); break; } case 11: /* EDIT */ { logedit(); break; } case 12: /* VIEW */ { logview(); break; } case 13: /* HELP */ { show_help(); break; } case 14: /* DEMODE */ { if (demode == SEND_DE) demode = 0; else demode = SEND_DE; mvprintw(13, 29, "DE-mode is %d", demode); refreshp(); sleep(1); break; } case 15: /* CONTEST */ { if (contest == CONTEST) contest = 0; else { contest = CONTEST; searchflg = SEARCHWINDOW; } mvprintw(13, 29, "CONTEST-mode is %d", contest); refreshp(); sleep(1); break; } case 16: /* FILTER */ { announcefilter++; if (announcefilter > 3) announcefilter = 0; mvprintw(13, 29, "FILTER-mode is %d", announcefilter); refreshp(); sleep(1); break; } case 17: /* SCORE */ { if (showscore_flag == 0) showscore_flag = 1; else { showscore_flag = 0; } mvprintw(13, 29, "Show score-mode is %d", showscore_flag); refreshp(); sleep(1); break; } case 18: /* WRITE CABRILLO FILE */ { int old_cluster = cluster; cluster = NOCLUSTER; write_cabrillo(); cluster = old_cluster; break; } case 19: /* EXIT */ { writeparas(); clear(); cleanup_telnet(); endwin(); puts("\n\nThanks for using TLF.. 73\n"); exit(0); break; } case 20: /* TXFILE */ { break; } case 21: /* ZONES */ { if (zonedisplay == 0) zonedisplay = 1; else { zonedisplay = 0; } break; } case 22: /* COUNTRIES */ { show_mults(); refreshp(); sleep(1); break; } case 23: /* MODE */ { if (trxmode == CWMODE) trxmode = SSBMODE; else if (trxmode == SSBMODE) trxmode = DIGIMODE; else trxmode = CWMODE; if (trxmode == CWMODE) { mvprintw(13, 29, "TRXMODE = CW"); } else if (trxmode == SSBMODE) mvprintw(13, 29, "TRXMODE = SSB"); else mvprintw(13, 29, "TRXMODE = DIG"); refreshp(); sleep(1); break; } case 24: /* SET PARAMETERS */ case 29: /* CFG PARAMETERS */ { clear(); if (editor == EDITOR_JOE) { strcpy(cmdstring, "joe "); } else if (editor == EDITOR_VI) { strcpy(cmdstring, "vi "); } else if (editor == EDITOR_MC) { strcpy(cmdstring, "mcedit "); } else { strcpy(cmdstring, "e3 "); } strcat(cmdstring, config_file); rc = system(cmdstring); read_logcfg(); read_rules(); /* also reread rules file */ writeparas(); mvprintw(24, 0, "Logcfg.dat loaded, parameters written.."); refreshp(); clear_display(); break; } case 25: /* MULTI */ { multiplierinfo(); break; } case 26: /* PROPAGATION */ { muf(); clear_display(); break; } case 27: /* RITCLEAR */ { if (rit == RITCLEAR) rit = 0; else { rit = RITCLEAR; } if (rit == RITCLEAR) { mvprintw(13, 29, "RIT clear on"); } else { mvprintw(13, 29, "RIT clear off"); } refreshp(); sleep(1); break; } case 28: /* trx ctl */ { if (trx_control == 1) trx_control = 0; else { trx_control = 1; } if (trx_control == 1) { mvprintw(13, 29, "TRX control on"); } else { mvprintw(13, 29, "TRX control off"); } refreshp(); sleep(1); break; } case 30: /* CW */ case 49: { if (keyerport == MFJ1278_KEYER) { strcpy(buffer, "MODE CW,30"); buffer[7] = '\015'; buffer[8] = 'K'; buffer[9] = '\015'; buffer[10] = '\0'; sendbuf(); } trxmode = CWMODE; if (trx_control == 1) outfreq = SETCWMODE; break; } case 31: /* SSBMODE */ { trxmode = SSBMODE; outfreq = SETSSBMODE; break; } case 32: /* DIGIMODE */ { trxmode = DIGIMODE; break; } case 33: /* PACKET */ { if ((nopacket == 0) && (packetinterface > 0)) packet(); break; } case 34: /* SIMULATOR */ { if (simulator == 0) { simulator = 1; if (ctcomp == 1) { mvprintw(13, 19, "The simulator only works in TRmode. Switching to TRmode"); ctcomp = 0; } else mvprintw(13, 29, "Simulator on"); refreshp(); if (keyerport == NET_KEYER) { if (netkeyer(K_WORDMODE, NULL) < 0) { mvprintw(24, 0, "keyer not active; switching to SSB"); trxmode = SSBMODE; clear_display(); } } } else { simulator = 0; mvprintw(13, 29, "Simulator off"); refreshp(); if (keyerport == NET_KEYER) { if (netkeyer(K_RESET, NULL) < 0) { mvprintw(24, 0, "keyer not active; switching to SSB"); trxmode = SSBMODE; clear_display(); } } } break; } case 35: /* INFO */ { int currentterm = miniterm; miniterm = 0; networkinfo(); miniterm = currentterm; if (currentmode == DIGIMODE) trxmode = DIGIMODE; break; } case 36: /* CLOFF */ { cluster = FREQWINDOW; break; } case 37: /* RECONNECT */ { if ((nopacket == 0) && (packetinterface > 0)) { cleanup_telnet(); init_packet(); packet(); } break; } case 38: /* EXIT=QUIT */ { writeparas(); cleanup_telnet(); endwin(); puts("\n\nThanks for using TLF.. 73\n"); exit(0); break; } case 39: /* CQDELAY */ { mvprintw(12, 29, "CQD: pgup/dwn", cqdelay); refreshp(); x = 1; while (x) { x = onechar(); switch (x) { case 156:{ if (cqdelay <= 60) { cqdelay++; attron(COLOR_PAIR(C_HEADER) | A_STANDOUT); mvprintw(0, 19, " "); mvprintw(0, 19, "%i", cqdelay); break; } } case 157:{ if (cqdelay >= 1) { cqdelay--; attron(COLOR_PAIR(C_HEADER) | A_STANDOUT); mvprintw(0, 19, " "); mvprintw(0, 19, "%i", cqdelay); break; } default: x = 0; } } } if (use_rxvt == 0) attron(COLOR_PAIR(NORMCOLOR) | A_BOLD); else attron(COLOR_PAIR(NORMCOLOR)); mvprintw(12, 29 + strlen(hiscall), ""); break; } case 40: /* ADIF */ { write_adif(); break; } case 41: /* SYNC */ { if (strlen(synclogfile) > 0) synclog(synclogfile); scroll_log(); /** \todo register return value */ readcalls(); clear_display(); break; } case 42: /* RESCORE */ { /** \todo register return value */ readcalls(); clear_display(); break; } case 43: /* SCVOLUME - set soundcard volume */ { volumebuffer = atoi(sc_volume); mvprintw(12, 29, "Vol: pgup/dwn"); refreshp(); usleep(500000); mvprintw(12, 29, "Vol: "); mvprintw(12, 29, "Vol: %d", volumebuffer); x = 1; while (x) { x = onechar(); switch (x) { case 156:{ if (volumebuffer < 95) volumebuffer += 5; break; } case 157:{ if (volumebuffer >= 5) volumebuffer -= 5; break; } default: x = 0; } attron(COLOR_PAIR(COLOR_GREEN) | A_STANDOUT); mvprintw(12, 34, " "); mvprintw(12, 34, "%d", volumebuffer); if (volumebuffer >= 0 && volumebuffer <= 99) sprintf(sc_volume, "%d", volumebuffer); netkeyer(K_STVOLUME, sc_volume); } clear_display(); break; } case 44: /* SCAN */ { int currentterm = miniterm; miniterm = 0; testaudio(); clear_display(); miniterm = currentterm; break; } case 45: /* DEBUG */ { debug_tty(); clear_display(); break; } case 46: /* MINITERM ON/OFF */ { if (miniterm == 1) miniterm = 0; else miniterm = 1; break; } case 47: /* RTTY Initialize mode (MFJ1278B controller) */ { strcpy(buffer, "MODE VB"); buffer[7] = '\015'; buffer[8] = 'K'; buffer[9] = '\015'; buffer[10] = '\0'; sendbuf(); trxmode = DIGIMODE; break; } case 48: /* SOUND */ { clear_display(); record(); clear_display(); break; } case 50: /* CHARS */ { mvprintw(13, 29, "Autosend: (0 (off), 2..5 chars) ?"); refreshp(); x = 1; /* wait for correct input or ESC */ while ((x != 0) && ((x < 2) || (x > 5)) ) { x = onechar(); if (x == 27) break; x = x - '0'; } /* remember new setting */ if (x != 27) cwstart = x; if (cwstart) mvprintw(13,29, "Autosend now: %1d ", cwstart); else mvprintw(13,29, "Autosend now: OFF "); refreshp(); break; } default: { nopar = 1; } } if (nopar != 1) { mvprintw(12, 29, "OK ! "); writeparas(); } else { if ((nopacket ==0) && (packetinterface > 0)) packet(); } refreshp(); if (use_rxvt == 0) attron(COLOR_PAIR(NORMCOLOR) | A_BOLD); else attron(COLOR_PAIR(NORMCOLOR)); mvprintw(12, 29, " "); mvprintw(12, 29, ""); refreshp(); hiscall[0] = '\0'; return (0); }
void edit_last(void) { int j = 0, b, k; int editline = NR_LINES-1; char editbuffer[LOGLINELEN+1]; if (nr_qsos == 0) return; /* nothing to edit */ stop_backgrnd_process = 1; //(no qso add during edit process) b = 29; /* start with last QSO */ get_qso (nr_qsos - (NR_LINES - editline), editbuffer); while ((j != 27) && (j != '\n')) { highlite_line(editline, editbuffer, b); j = onechar(); if (j == 1) { // ctrl A, beginning of line b = 1; } else if (j == 5) { // ctrl E, end of line b = 77; } else if (j == 9) { // TAB, next field if (b < 17) b = 17; else if (b < 29) b = 29; else if (b < 54) b = 54; else if (b < 68) b = 68; else if (b < 77) b = 77; else b = 1; } else if (j == 152) { // up if (editline > (NR_LINES - nr_qsos) && (editline > 0)) { unhighlite_line(editline, editbuffer); putback_qso (nr_qsos - (NR_LINES -editline), editbuffer); editline--; get_qso (nr_qsos - (NR_LINES - editline), editbuffer); } else { logview(); j = 27; } } else if (j == 153) { // down if (editline < NR_LINES-1) { unhighlite_line(editline, editbuffer); putback_qso (nr_qsos - (NR_LINES -editline), editbuffer); editline++; get_qso (nr_qsos - (NR_LINES - editline), editbuffer); } else j = 27; /* escape */ } else if (j == 155) { // left if (b >= 1) b--; } else if (j == 154) { // right if (b < 79) b++; } else if ((j == 160) && (b >= 0) && (b < 28)) { // insert for (k = 28; k > b; k--) editbuffer[k] = editbuffer[k - 1]; editbuffer[b] = ' '; } else if ((j == 160) && (b >= 29) && (b < 39)) { // insert call for (k = 39; k > b; k--) editbuffer[k] = editbuffer[k - 1]; editbuffer[b] = ' '; } else if ((j == 160) && (b >= 54) && (b < 64)) { // insert for (k = 64; k > b; k--) editbuffer[k] = editbuffer[k - 1]; editbuffer[b] = ' '; } else if ((j == 160) && (b >= 68) && (b < 76)) { // insert for (k = 76; k > b; k--) editbuffer[k] = editbuffer[k - 1]; editbuffer[b] = ' '; } else if ((j == 161) && (b >= 1) && (b < 28)) { // delete for (k = b; k < 28; k++) editbuffer[k] = editbuffer[k + 1]; } else if ((j == 161) && (b >= 29) && (b < 39)) { // delete for (k = b; k < 39; k++) editbuffer[k] = editbuffer[k + 1]; } else if ((j == 161) && (b >= 68) && (b < 76)) { // delete for (k = b; k < 76; k++) editbuffer[k] = editbuffer[k + 1]; } else if ((j == 161) && (b >= 54) && (b < 64)) { // delete for (k = b; k < 64; k++) editbuffer[k] = editbuffer[k + 1]; } else if (j != 27) { if ((j >= 97) && (j <= 122)) j = j - 32; if ((j >= 32) && (j < 97)) { editbuffer[b] = j; if ((b < strlen(editbuffer) - 2) && (b < 80)) b++; } } } unhighlite_line(editline, editbuffer); putback_qso (nr_qsos - (NR_LINES - editline), editbuffer); scroll_log(); stop_backgrnd_process = 0; }
int message_change(int x) { extern char backgrnd_str[]; extern char message[15][80]; extern char sp_return[]; extern char cq_return[]; int j; int count; int mes_length; int bufnr = 0; char printbuf[80]; clear_display(); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); for (j = 13; j <= 23; j++) { mvprintw(j, 0, backgrnd_str); } nicebox(14, 3, 2, 60, "Enter message (F1-12, C, S)"); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); while (1) { bufnr = onechar(); if ((bufnr == 'C') || (bufnr == 'S')) break; if (bufnr >= 129 && bufnr <= 141) break; } if (bufnr == 'S') { bufnr = 12; } else if (bufnr == 'C') { bufnr = 13; } else { if (bufnr <= 138) { bufnr = bufnr - 129; } else { bufnr = bufnr - 130; } } printbuf[0] = '\0'; strncat(printbuf, message[bufnr], strlen(message[bufnr]) - 1); mvprintw(15, 4, "%s", printbuf); refreshp(); mvprintw(16, 4, ""); message[bufnr][0] = '\0'; echo(); getnstr(message[bufnr], 60); noecho(); strcat(message[bufnr], "\n"); mes_length = strlen(message[bufnr]); if (mes_length < 2) { clear_display(); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); for (j = 13; j <= 23; j++) { mvprintw(j, 0, backgrnd_str); } return (1); } for (count = 0; count <= mes_length; count++) { if ((message[bufnr][count] > 96) && (message[bufnr][count] < 123)) message[bufnr][count] = message[bufnr][count] - 32; } mvprintw(12, 29, ""); refreshp(); clear_display(); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); for (j = 13; j <= 23; j++) { mvprintw(j, 0, backgrnd_str); } writeparas(); strncpy(sp_return, message[12], 79); strncpy(cq_return, message[13], 79); return (0); }
int keyer(void) { extern char mode[20]; extern int bufloc; extern char buffer[]; extern char termbuf[]; extern char message[15][80]; extern char wkeyerbuffer[]; extern int data_ready; extern int keyerport; extern int weight; int x = 0, i = 0, j = 0; int cury, curx; char nkbuffer[2]; char keyerstring[30] = " "; char weightbuf[15]; const char txcontrolstring[2] = { 20, '\0' }; const char rxcontrolstring[2] = { 18, '\0' }; const char crcontrolstring[2] = { 13, '\0' }; const char ctl_c_controlstring[2] = { 92, '\0' }; strcpy(mode, "Keyboard"); clear_display(); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); if (keyerport == NO_KEYER) /* no keyer present */ return (1); if (keyerport == MFJ1278_KEYER) { buffer[0] = 20; // 1 char at the time ! buffer[1] = '\0'; if (data_ready != 1) { strcat(wkeyerbuffer, buffer); data_ready = 1; } buffer[0] = '\0'; } while (1) { x = onechar(); if (x == 34) { /* bug fix */// " x = 32; } if (x == '\n') x = 32; if (x == 27 || x == 11 || x == 235) { // esc, ctrl-k, alt-k if (keyerport == MFJ1278_KEYER) { buffer[0] = 18; // 1 char at the time ! buffer[1] = '\0'; if (data_ready != 1) { strcat(wkeyerbuffer, buffer); data_ready = 1; } } else { stoptx(); } buffer[0] = '\0'; break; } if (x >= 32 && x <= 125) { // display space ... } addch(x); refreshp(); i++; if ((i >= 40)) { i = 0; mvprintw(4, 0, " "); mvprintw(4, 0, ""); refreshp(); displayit(); } refreshp(); } if (x == 127 && (strlen(buffer) >= 1)) { /* erase */ getyx(stdscr, cury, curx); mvprintw(5, curx - 1, " "); mvprintw(5, curx - 1, ""); buffer[strlen(buffer) - 1] = '\0'; bufloc--; } if (x > 96 && x < 123) /* upper case only */ x = x - 32; if (x > 9 && x < 91) { if (bufloc >= 38) // maximum buffer = 39 { bufloc = 38; printw("\nBuffer overflow !, bufloc = %d\n", bufloc); refreshp(); } else { if (x > 31 || x == 10) { if (keyerport == MFJ1278_KEYER) { mfj1278_control(x); } else if (keyerport == NET_KEYER) { nkbuffer[0] = x; // 1 char at the time ! nkbuffer[1] = '\0'; netkeyer(K_MESSAGE, nkbuffer); nkbuffer[0] = '\0'; for (j = 0; j < 29; j++) { keyerstring[j] = keyerstring[j + 1]; } keyerstring[28] = x; keyerstring[29] = '\0'; attron(COLOR_PAIR(C_LOG) | A_STANDOUT); mvprintw(5, 0, "%s", keyerstring); refreshp(); } else if (keyerport == ORION_KEYER) { nkbuffer[0] = x; nkbuffer[1] = '\0'; strcat(wkeyerbuffer, nkbuffer); sendbuf(); nkbuffer[0] = '\0'; for (j = 0; j < 29; j++) { keyerstring[j] = keyerstring[j + 1]; } keyerstring[28] = x; keyerstring[29] = '\0'; attron(COLOR_PAIR(C_LOG) | A_STANDOUT); mvprintw(5, 0, "%s", keyerstring); refreshp(); } } else // control char... { if (data_ready != 1) { strcat(wkeyerbuffer, buffer); data_ready = 1; } else buffer[0] = '\0'; getyx(stdscr, cury, curx); attron(COLOR_PAIR(C_HEADER) | A_STANDOUT); mvaddstr(0, 0, " "); attron(COLOR_PAIR(C_LOG)); mvaddstr(cury, curx, ""); refreshp(); strcat(termbuf, buffer); strcat(termbuf, " "); mvprintw(5, 0, termbuf); refreshp(); if ((strlen(buffer) + strlen(termbuf) > 39) || x == '=') { i = 0; mvprintw(5, 0, " "); mvprintw(5, 0, ""); refreshp(); displayit(); } bufloc = 0; buffer[bufloc] = '\0'; } } } else { switch (x) { case 9: { bufloc = 0; buffer[bufloc] = '\0'; strcpy(mode, "Log "); clear_display(); return (2); } case '\n': case 13: { if (keyerport == MFJ1278_KEYER && strlen(buffer) < 39) { strcat(buffer, crcontrolstring); sendbuf(); bufloc = 0; } break; } case 27: case 11: { stoptx(); bufloc = 0; buffer[bufloc] = '\0'; strcpy(mode, "Log "); clear_display(); return (2); } case 123: { if (keyerport == MFJ1278_KEYER) { strcat(buffer, txcontrolstring); sendbuf(); } break; } case 125: { if (keyerport == MFJ1278_KEYER) { strcat(buffer, rxcontrolstring); sendbuf(); } break; } case 92: { if (keyerport == MFJ1278_KEYER) { strcat(buffer, ctl_c_controlstring); sendbuf(); } break; } case 247: // Alt-w, set weight { mvprintw(1, 0, "Weight= "); mvprintw(1, 7, ""); refreshp(); echo(); getnstr(weightbuf, 2); noecho(); weight = atoi(weightbuf); netkeyer(K_WEIGHT, weightbuf); break; } case 156: { speedup(); clear_display(); break; } case 157: { speeddown(); clear_display(); break; } case 129: { strcat(buffer, message[0]); /* F1 */ getyx(stdscr, cury, curx); mvprintw(5, 0, ""); sendbuf(); mvprintw(cury, curx, ""); break; } case 130: { strcat(buffer, message[1]); /* F2 */ sendbuf(); break; } case 131: { strcat(buffer, message[2]); /* F3 */ sendbuf(); break; } case 132: { strcat(buffer, message[3]); /* F4 */ sendbuf(); break; } case 133: { strcat(buffer, message[4]); /* F5 */ sendbuf(); break; } case 134: { strcat(buffer, message[5]); /* F6 */ sendbuf(); break; } case 135: { strcat(buffer, message[6]); /* F7 */ sendbuf(); break; } case 136: { strcat(buffer, message[7]); /* F8 */ sendbuf(); break; } case 137: { strcat(buffer, message[8]); /* F9 */ sendbuf(); break; } case 138: { strcat(buffer, message[9]); /* F10 */ sendbuf(); break; } case 140: { strcat(buffer, message[10]); /* F11 */ sendbuf(); break; } case 141: { strcat(buffer, message[11]); /* F12 */ sendbuf(); break; } default: x = x; } } } strcpy(mode, "Log "); clear_display(); return (2); /* show end of keyer routine */ }
void calledit(void) { extern char hiscall[]; extern int block_part; int i = 0, l, b = 0; int j = 0; int x = 0; int cnt = 0, insertflg = 0; char dupecall[20]; char call1[30], call2[10]; l = strlen(hiscall); b = l - 1; while ((i != 27) && (b <= strlen(hiscall))) { attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, " "); mvprintw(12, 29, hiscall); mvprintw(12, 29 + b, ""); /* no refreshp() here as getch() calls wrefresh() for the * panel with last output (whre the cursor should go */ i = onechar(); if ((i == 161) || (i == 160)) // Ins / Del cnt++; else { if (i != 27) cnt = 0; } if (i == 9) block_part = 1; else block_part = 0; if (i == 1) // ctrl-A, home { b = 0; x = 0; } if (i == 5) // ctrl-E, End { b = strlen(hiscall) - 1; x = 0; } if (i == 155) { // left if (b > 0) b--; } else if (i == 154) { // right if (b < strlen(hiscall) - 1) { b++; } else break; /* stop edit */ } else if (i == 161) { /* delete */ l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; /* move to left incl. \0 */ } strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); if (cnt > 1) searchlog(hiscall); } else if (i == 127) { /* backspace */ if (b > 0) { b--; l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; } strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); if (cnt > 1) searchlog(hiscall); } } else if (i == 160) { /* insert */ if (insertflg == 0) insertflg = 1; else insertflg = 0; } else if (i != 27) { if ((i >= 97) && (i <= 122)) i = i - 32; if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { if (b <= 12) { strncpy(call1, hiscall, b); } if (b <= 12) { strncpy(call2, hiscall + b, strlen(hiscall) - (b - 1)); } if (strlen(hiscall) + 1 == 12) break; // leave insert mode if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { call1[b] = i; call1[b + 1] = '\0'; if ((strlen(call1) + strlen(call2)) < 12) { strcat(call1, call2); // if (strlen(call1) + strlen(hiscall) >= 12) break; if (strlen(call1) >= 12) break; strcpy(hiscall, call1); } } if ((b < strlen(hiscall) - 1) && (b <= 12)) b++; else break; strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); searchlog(hiscall); } else if (x != 0) i = 27; } else i = 27; } attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, hiscall); mvprintw(12, 29, " "); refreshp(); attron(A_STANDOUT); searchlog(hiscall); }
int insert_char(int curposition) { extern char hiscall[]; char call1[30], call2[10]; int ichr = 0; attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); call1[0] = '\0'; call2[0] = '\0'; while (ichr != 27) { ichr = onechar(); if ((ichr == 9) || (ichr == '\n') || (ichr == 127)) break; // leave insert mode if ((ichr >= 97) && (ichr <= 122)) ichr = ichr - 32; if (curposition <= 10) { strncpy(call1, hiscall, curposition); } if (curposition <= 10) { strncpy(call2, hiscall + curposition, strlen(hiscall) - (curposition - 1)); } if (strlen(hiscall) + 1 == 13) break; // leave insert mode if (((ichr >= 65) && (ichr <= 90)) || ((ichr >= 47) && (ichr <= 57))) { call1[curposition] = ichr; call1[curposition + 1] = '\0'; if ((strlen(call1) + strlen(call2)) < 12) { strcat(call1, call2); if (strlen(call1) + strlen(hiscall) >= 12) break; strcpy(hiscall, call1); } } else break; attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, hiscall); curposition++; mvprintw(12, 29 + curposition, ""); refreshp(); } ichr = 27; return (ichr); }
void change_freq (void) { extern float freq; extern int trx_control; #ifdef HAVE_LIBHAMLIB extern freq_t outfreq; #else extern int outfreq; #endif int brkflg = 0; int x; if (trx_control == 0) return; curs_set(0); while (1) { freq_display(); if (outfreq == 0) { x = onechar(); switch (x) { case 152:{ //up #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq += 100; break; } case 153:{ //down #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq -= 100; break; } case 154:{ //right #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq += 20; break; } case 155:{ //left #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq -= 20; break; } case 156:{ //left #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq += 500; break; } case 157:{ //left #ifdef HAVE_LIBHAMLIB outfreq = (freq_t) (freq * 1000); #else outfreq = (int) (freq * 1000); #endif outfreq -= 500; break; } default:{ brkflg = 1; break; } } } if (brkflg == 1) { brkflg = 0; break; } freq_display(); time_update(); usleep(100000); } curs_set(1); }