void showhelp(char far *heading,char far *text) { makewindow(9,5,70,21,heading); window(11,6,69,20); gotoxy(1,2); cprintf(text); window(1,1,80,25); waitkey(); closewindow(9,5,70,21); }
int choosefunction() { char ch; makewindow(11,7,68,13,"Function Keys"); window(13,8,67,12); gotoxy(1,1); cprintf("\nPress the function key that you require help with\n" "or any other key to return to the help menu"); window(1,1,80,25); ch = getch(); closewindow(11,7,68,13); if (ch != 0) return(0); ch = getch(); return(ch); }
void filedelete() { char delname[20]; int x; delname[0] = 0; makewindow( 10,9,55,14,"Delete File"); gotoxy(12,12); cprintf("Filename : "); retcursor(); x= inputstring(wherex(),12,delname); if (x>0) { x = unlink(delname); if (x == -1) burp(); } hidecursor(); closewindow(10,9,55,14); }
void init_spectrum (SpecBlock * sb) { REAL phase_tmp = 0.0; REAL gain_tmp = 1.0; COMPLEX *p; sb->fill = 0; p = newvec_COMPLEX_fftw(sb->size*16,"spectrum accum"); sb->accum = newCXB (sb->size * 16, p, "spectrum accum"); p = newvec_COMPLEX_fftw(sb->size, "spectrum timebuf"); sb->timebuf = newCXB (sb->size, p, "spectrum timebuf"); p = newvec_COMPLEX_fftw(sb->size, "spectrum timebuf"); sb->freqbuf = newCXB (sb->size, p, "spectrum freqbuf"); sb->window = newvec_REAL (sb->size * 16, "spectrum window"); makewindow (BLACKMANHARRIS_WINDOW, sb->size, sb->window); sb->mask = sb->size - 1; sb->polyphase = FALSE; sb->output = (float *) safealloc (sb->size, sizeof (float), "spectrum output"); sb->coutput = (COMPLEX *)safealloc (sb->size, sizeof (COMPLEX), "spectrum output");; sb->plan = fftwf_plan_dft_1d (sb->size, (fftwf_complex *) CXBbase (sb->timebuf), (fftwf_complex *) CXBbase (sb->freqbuf), FFTW_FORWARD, sb->planbits); sb->iqfix = newCorrectIQspec2(); // SV1EIA AIR sb->iqfix->buffer_counter = 0; // SV1EIA AIR sb->iqfix->im_max_actual = 0; // SV1EIA AIR sb->iqfix->im_max_test = 0; // SV1EIA AIR sb->iqfix->im_min_actual = 0; // SV1EIA AIR sb->iqfix->im_min_test = 0; // SV1EIA AIR sb->iqfix->re_max_actual = 0; // SV1EIA AIR sb->iqfix->re_max_test = 0; // SV1EIA AIR sb->iqfix->re_min_actual = 0; // SV1EIA AIR sb->iqfix->re_min_test = 0; // SV1EIA AIR }
/*-----------------------------------------------------------------------------------*/ static void load_dirent(void) { static char message[40]; char *name; if(loading == LOADING_DSC) { name = filenames[filenameptr]; dscs[filenameptr] = LOADER_LOAD_DSC(name); if(dscs[filenameptr] == NULL || filenameptr + 1 >= numfiles) { loading = 0; makewindow(0); show_statustext("Directory loaded"); ctk_window_redraw(&window); return; } ++filenameptr; strcpy(message, "Loading \""); strcpy(message + 9, name); strcpy(message + 9 + strlen(name), "\"..."); show_statustext(message); } }
void init_spectrum (SpecBlock * sb) { COMPLEX *p; sb->fill = 0; p = newvec_COMPLEX_16(sb->size*16,"spectrum accum"); sb->accum = newCXB (sb->size * 16, p, "spectrum accum"); p = newvec_COMPLEX_16(sb->size, "spectrum timebuf"); sb->timebuf = newCXB (sb->size, p, "spectrum timebuf"); p = newvec_COMPLEX_16(sb->size, "spectrum timebuf"); sb->freqbuf = newCXB (sb->size, p, "spectrum freqbuf"); sb->window = newvec_REAL (sb->size * 16, "spectrum window"); makewindow (BLACKMANHARRIS_WINDOW, sb->size, sb->window); sb->mask = sb->size - 1; sb->polyphase = FALSE; sb->output = (float *) safealloc (sb->size, sizeof (float), "spectrum output"); sb->coutput = (COMPLEX *)safealloc (sb->size, sizeof (COMPLEX), "spectrum output");; sb->plan = fftwf_plan_dft_1d (sb->size, (fftwf_complex *) CXBbase (sb->timebuf), (fftwf_complex *) CXBbase (sb->freqbuf), FFTW_FORWARD, sb->planbits); }
/*-----------------------------------------------------------------------------------*/ PROCESS_THREAD(directory_process, ev, data) { unsigned char i; PROCESS_BEGIN(); width = ctk_draw_width() - 2; height = ctk_draw_height() - 2 - CTK_CONF_MENUS; ctk_window_new(&window, width, height, "Directory"); /* loaddirectory();*/ makewindow(0); show_statustext("Loading directory..."); startloading(); ctk_window_open(&window); while(1) { PROCESS_WAIT_EVENT(); if(ev == PROCESS_EVENT_CONTINUE) { read_dirent(); load_dirent(); if(loading != 0) { process_post(&directory_process, PROCESS_EVENT_CONTINUE, NULL); } } else if(ev == ctk_signal_widget_activate) { if(data == (process_data_t)&reloadbutton) { for(i = 0; dscs[i] != NULL; ++i) { LOADER_UNLOAD_DSC(dscs[i]); dscs[i] = NULL; } /* loaddirectory();*/ startloading(); makewindow(0); ctk_window_open(&window); } else if(data == (process_data_t)&morebutton) { makewindow(morestart); ctk_window_open(&window); } else if(data == (process_data_t)&backbutton) { makewindow(0); ctk_window_open(&window); } else if(data == (process_data_t)&autoexitbutton) { autoexit = 1 - autoexit; if(autoexit == 1) { ctk_label_set_text(&autoexitlabel, autoexiton); } else { ctk_label_set_text(&autoexitlabel, autoexitoff); } CTK_WIDGET_REDRAW(&autoexitlabel); } else { for(i = 0; dscs[i] != NULL; ++i) { if(data == (process_data_t)(dscs[i]->icon)) { program_handler_load(dscs[i]->prgname, NULL); if(autoexit) { ctk_window_close(&window); quit(); } break; } } } } else if(ev == ctk_signal_widget_select) { if(data == (process_data_t)&reloadbutton) { show_statustext("Reload directory"); } else if(data == (process_data_t)&morebutton) { show_statustext("Show more files"); } else if(data == (process_data_t)&backbutton) { show_statustext("Show first files"); } else if(data == (process_data_t)&autoexitbutton) { show_statustext("Exit when loading program"); } else { for(i = 0; dscs[i] != NULL; ++i) { if(data == (process_data_t)(dscs[i]->icon)) { show_statustext(dscs[i]->description); break; } } } } else if(ev == ctk_signal_window_close && data == (process_data_t)&window) { quit(); } else if(ev == PROCESS_EVENT_EXIT) { ctk_window_close(&window); quit(); } } PROCESS_END(); }
int choice(int n,char far *ch[]) /* first line of array gives the window title */ { int x; int y; int z; char let; int chi; int maxlen; int current; current = 1; maxlen = 0; for ( x = 0; x <= n; x++) { y = strlen(ch[x]); if ( maxlen < y ) maxlen = y; } if (maxlen < 24 ) maxlen = 24; maxlen += 2; x = (80 - maxlen)/2; y = (12 - n); if (y == 7) y = 8; makewindow( x-4, y-2, x + maxlen +3, y + (2* n) + 2, ch[0]); gotoxy(x-2, y); cprintf(" Select a Number or <esc>"); gotoxy( x-1, y + (2 * (1)) ); putch(16); cprintf("%d ", current); cprintf("%s ",ch[current]); putch(17); for (z=2 ; z <= n; z++) { gotoxy( x-1, y + (2 * (z)) ); cprintf(" %d ", z); cprintf("%s",ch[z]); } do { let = getch(); if (let == 0) { gotoxy( x-1, y + (2 * (current)) ); cprintf(" %d ",current); cprintf("%s ",ch[current]); chi = getch(); switch (chi) { case ARROWD : current++; if (current > n) current = 1; break; case ARROWU : current--; if (current < 1) current = n; break; default : ungetch(chi); } gotoxy( x-1, y + (2 * (current)) ); putch(16); cprintf("%d ",current); cprintf("%s ",ch[current]); putch(17); } else if ((let > 58 ) && (let <= 58 + n)) let = let + '0' - 58; } while ( (let > '0'+ n || let < '1') && let != 27 && let != 13) ; closewindow( x-4, y-2, x+ maxlen + 3, y + (2* n)+2 ); if (let == 27) return(0); else if (let == 13) return(current); else return(let - '0'); }
void showtotals() { char headstr[30]; char numstr1[30]; char numstr2[30]; char numstr3[30]; char endstring[30]; coltype col1,col2; int x; double y; if (totalvalue >= 1.0e8 || totalvalue <= -1.0e8) { burp(); if (totalvalue > 0.0) { makewindow(10,5,60,19,"TOO RICH"); gotoxy(14,8); cprintf("You are too Rich."); gotoxy(14,10); cprintf("This is a free society so you have a choice:"); gotoxy(14,12); cprintf("1. Make a LARGE DONATION TO CHARITY."); gotoxy(14,14); cprintf("2. Buy an EXPENSIVE version of this program."); gotoxy(14,16); } else { makewindow(10,5,60,19,"BANKRUPT !"); gotoxy(14,8); cprintf("You are too Poor."); gotoxy(14,10); cprintf("This is a free society so you have a choice:"); gotoxy(14,12); cprintf("1. Become a charity."); gotoxy(14,14); cprintf("2. Buy an EXPENSIVE version of this program."); gotoxy(14,16); } cprintf("NOTE: We cannot guarantee values produced"); gotoxy(14,18); cprintf(" when such large numbers are used."); delay(6000); closewindow(10,5,60,19); totalvalue = 0.0; } switch (sys.screen) { case SCREEN1 : ltoa(totalputs,numstr3,10); ltoa(totalcalls,numstr2,10); col1 = HELDC; col2 = HELDP; if (sys.display == HELDS) { strcpy(headstr," Tot. Value $ "); sprintf(numstr1,"%-12.2f",totalvalue); strcpy(endstring," "); } else { strcpy(headstr," Tot. Delta "); sprintf(numstr1,"%-12.2f",totaldelta); strcpy(endstring,"$/c"); } break; case SCREEN2 : break; case SCREEN3 : if (sys.display == INVVOL || sys.display == OVERVALUED) { strcpy(headstr," Weighted Vol. "); strcpy(endstring," \% "); sprintf(numstr1,"%-5.*f",2,weightedvol); sprintf(numstr2,"%-4.*f \%",2,weightedvolc); sprintf(numstr3,"%-4.*f \%",2,weightedvolp); col1 = VOLC; col2 = VOLP; } break; }
void getdir() { char buff[30]; struct ffblk ffblk; int x; int y; int z; int disnum; int done; char ch; disnum = 0; x = 12; y = 9; makewindow( 10,7,71,23,"Directory"); done= findfirst("*.*", &ffblk, 0); while (!done) { while (disnum == 0 && !done) { gotoxy(x,y); cprintf("%s",ffblk.ff_name); y++; if (y > 21 && x == 57) { x = 12; y = 9; disnum = 1; } else if (y > 21) { y = 9; x += 15; }; done = findnext(&ffblk); }; z = 0; do { if (disnum != 0) { gotoxy(15,22); cprintf("Press Pagedown to continue or <esc> to quit"); ch = getch(); if (ch == 27) { done = -1; disnum = 0; z = 1; } else if (ch == 0) { ch = getch(); if (ch == PGDN) { disnum = 0; x = 12; y = 9; z = 1; window(11,8,70,22);clrscr();window(1,1,80,25);} } } else { gotoxy(15,22); cprintf("Press <esc> to quit"); ch = getch(); if (ch == 27) { done = -1; disnum = 0; z = 1; } } } while (z == 0); } closewindow( 10,7,71,23); }
/*-----------------------------------------------------------------------------------*/ EK_EVENTHANDLER(directory_eventhandler, ev, data) { unsigned char i; EK_EVENTHANDLER_ARGS(ev, data); if(ev == EK_EVENT_INIT) { ctk_window_new(&window, width, height, "Directory"); /* loaddirectory();*/ makewindow(0); show_statustext("Loading directory..."); startloading(); ctk_window_open(&window); } else if(ev == EK_EVENT_CONTINUE) { read_dirent(); load_dirent(); if(loading != 0) { ek_post(id, EK_EVENT_CONTINUE, NULL); } } else if(ev == ctk_signal_widget_activate) { if(data == (ek_data_t)&reloadbutton) { for(i = 0; dscs[i] != NULL; ++i) { LOADER_UNLOAD_DSC(dscs[i]); dscs[i] = NULL; } /* loaddirectory();*/ startloading(); makewindow(0); ctk_window_open(&window); } else if(data == (ek_data_t)&morebutton) { makewindow(morestart); ctk_window_open(&window); } else if(data == (ek_data_t)&backbutton) { makewindow(0); ctk_window_open(&window); } else if(data == (ek_data_t)&autoexitbutton) { autoexit = 1 - autoexit; if(autoexit == 1) { ctk_label_set_text(&autoexitlabel, autoexiton); } else { ctk_label_set_text(&autoexitlabel, autoexitoff); } CTK_WIDGET_REDRAW(&autoexitlabel); } else { for(i = 0; dscs[i] != NULL; ++i) { if(data == (ek_data_t)(dscs[i]->icon)) { program_handler_load(dscs[i]->prgname, NULL); if(autoexit) { ctk_window_close(&window); quit(); } break; } } } } else if(ev == ctk_signal_widget_select) { if(data == (ek_data_t)&reloadbutton) { show_statustext("Reload directory"); } else if(data == (ek_data_t)&morebutton) { show_statustext("Show more files"); } else if(data == (ek_data_t)&backbutton) { show_statustext("Show first files"); } else if(data == (ek_data_t)&autoexitbutton) { show_statustext("Exit when loading program"); } else { for(i = 0; dscs[i] != NULL; ++i) { if(data == (ek_data_t)(dscs[i]->icon)) { show_statustext(dscs[i]->description); break; } } } } else if(ev == ctk_signal_window_close && data == (ek_data_t)&window) { quit(); } else if(ev == EK_EVENT_REQUEST_EXIT) { ctk_window_close(&window); quit(); } }