/* helper function for bandmap display * mark entries according to age, source and worked state. Mark new multis * - new brigth blue * - normal blue * - aged brown * - worked small caps */ void colorize_spot(spot *data) { if (data -> timeout > SPOT_NORMAL) attrset(COLOR_PAIR(CB_NEW)|A_BOLD); else if (data -> timeout > SPOT_OLD) attrset(COLOR_PAIR(CB_NORMAL)); else attrset(COLOR_PAIR(CB_OLD)); if (bm_ismulti(data->call)) attron(A_STANDOUT); if (data->dupe && bm_config.showdupes) { attrset(COLOR_PAIR(CB_DUPE)|A_BOLD); attroff(A_STANDOUT); } }
void bandmap_show() { /* * display depending on filter state * - all bands on/off * - all mode on/off * - dupes on/off * * If more entries to show than place in window, show around current frequency * * mark entries according to age, source and worked state. Mark new multis * - new brigth blue * - normal blue * - aged black * - worked small caps * - new multi underlined * - self announced stations * small preceeding letter for reporting station * * maybe show own frequency as dashline in other color * (maybee green highlighted) * - highligth actual spot if near its frequency * * Allow selection of one of the spots (switches to S&P) * - Ctrl-G as known * - '.' and cursor plus 'Enter' * - Test mouseclick... * * '.' goes into map, shows help line above and supports * - cursormovement * - 'ESC' leaves mode * - 'Enter' selects spot * - 'B', 'D', 'M' switches filtering for band, dupes and mode on or off. */ GList *list; spot *data; int cols = 0; int curx, cury; int bm_x, bm_y; int i,j; short dupe; if (!bm_initialized) { bm_init(); bm_initialized = 1; } /* acquire mutex * do not add new spots to allspots during * - aging and * - filtering * furthermore do not allow call lookup as long as * filter array is build anew */ pthread_mutex_lock( &bm_mutex ); bandmap_age(); /* age entries in bandmap */ /* make array of spots to display * filter spotlist according to settings */ if (spots) g_ptr_array_free( spots, TRUE); /* free array */ spots = g_ptr_array_sized_new( 128 ); /* allocate new one */ list = allspots; while (list) { data = list->data; /* if spot is allband or allmode is set or band or mode matches * actual one than add it to the filtered 'spot' array */ dupe = bm_isdupe(data->call, data->band); if ((bm_config.allband || (data->band == bandinx)) && (bm_config.allmode || (data->mode == trxmode)) && (bm_config.showdupes || !dupe)) { data -> dupe = dupe; g_ptr_array_add( spots, data ); } list = list->next; } pthread_mutex_unlock( &bm_mutex ); /* afterwards display filtered list around own QRG +/- some offest * (offset gets resest if we change frequency */ /** \todo Auswahl des Display Bereiches */ getyx( stdscr, cury, curx); /* remember cursor */ /* start in line 14, column 0 */ bm_y = 14; bm_x = 0; /* clear space for bandmap */ attrset(COLOR_PAIR(CB_DUPE)|A_BOLD); move(bm_y,0); /* do not overwrite # frequency */ for (j = 0; j < 67; j++) addch(' '); for (i = bm_y + 1; i < bm_y + 10; i++) { move (i,0); for (j = 0; j < 80; j++) addch (' '); } bm_show_info(); /** \fixme Darstellung des # Speichers */ for (i = 0; i < spots->len; i++) { data = g_ptr_array_index( spots, i ); attrset(COLOR_PAIR(CB_DUPE)|A_BOLD); mvprintw (bm_y, bm_x, "%7.1f %c ", (float)(data->freq/1000.), (data->node == thisnode ? '*' : data->node)); if (data -> timeout > SPOT_NORMAL) attrset(COLOR_PAIR(CB_NEW)|A_BOLD); else if (data -> timeout > SPOT_OLD) attrset(COLOR_PAIR(CB_NORMAL)); else attrset(COLOR_PAIR(CB_OLD)); if (bm_ismulti(data->call)) attron(A_STANDOUT); if (data->dupe) { if (bm_config.showdupes) { attrset(COLOR_PAIR(CB_DUPE)|A_BOLD); attroff(A_STANDOUT); printw ("%-12s", g_ascii_strdown(data->call, -1)); } } else { printw ("%-12s", data->call); } attroff (A_BOLD); bm_y++; if (bm_y == 24) { bm_y = 14; bm_x += 22; cols++; if (cols > 2) break; } } move(cury, curx); /* reset cursor */ refreshp(); }