示例#1
0
文件: changepars.c 项目: patlc/tlf
int multiplierinfo(void)
{

    extern int use_rxvt;
    extern int arrlss;
    extern int serial_section_mult;
    extern int sectn_mult;
    extern char mults[MAX_MULTS][12];
    extern int mult_bands[MAX_MULTS];
    extern int multarray_nr;
    extern GPtrArray *mults_possible;

    int j, k, vert, hor, cnt, found;
    char mprint[50];
    char chmult[4];
    char ch2mult[4];

    clear();

    if (use_rxvt == 0)
	attron(COLOR_PAIR(C_WINDOW) | A_BOLD | A_STANDOUT);
    else
	attron(COLOR_PAIR(C_WINDOW) | A_STANDOUT);

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    if (arrlss == 1) {
	mvprintw(2, 20, "ARRL SWEEPSTAKES -- REMAINING SECTIONS");
	cnt = 0;
	for (vert = 9; vert < 18; vert++) {

	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 5; hor < 15; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		mprint[0] = '\0';
		strcat(mprint, MULTS_POSSIBLE(cnt));
		strcat(mprint, " ");
		mprint[4] = '\0';

		found = 0;
		for (j = 0; j < multarray_nr; j++) {
		    strcpy(chmult, MULTS_POSSIBLE(cnt));
		    strcpy(ch2mult, mults[j]);

		    if (ch2mult[2] == ' ')
			ch2mult[2] = '\0';

		    if (strcmp(ch2mult, chmult) == 0)
			found = 1;
		}
		if (found == 1)

		    if (use_rxvt == 0)
			attron(COLOR_PAIR(C_HEADER) | A_BOLD |
			       A_STANDOUT);
		    else
			attron(COLOR_PAIR(C_HEADER) | A_STANDOUT);

		else if (use_rxvt == 0)
		    attron(COLOR_PAIR(C_WINDOW) | A_BOLD | A_STANDOUT);
		else
		    attron(COLOR_PAIR(C_WINDOW) | A_STANDOUT);

		if ((strlen(mprint) > 1) && (strcmp(mprint, "W ") != 0))
		    mvprintw(vert, hor * 4, "%s", mprint);

		cnt++;

	    }
	}
    }

    if (serial_section_mult == 1 || (sectn_mult == 1 && arrlss != 1)) {
	mvprintw(0, 30, "REMAINING SECTIONS");
	cnt = 0;
	for (vert = 2; vert < 22; vert++) {
	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 0; hor < 7; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		mprint[0] = '\0';
		strcat(mprint, MULTS_POSSIBLE(cnt));
		if (strlen(mprint) == 0)
		    break;
		if (strlen(mprint) == 1)
		    strcat(mprint, "   ");
		if (strlen(mprint) == 2)
		    strcat(mprint, "  ");
		if (strlen(mprint) == 3)
		    strcat(mprint, " ");
		if (strlen(mprint) > 3)
		    mprint[4] = '\0';

		for (k = 1; k <= MAX_MULTS; k++) {
		    if (strstr(mults[k], MULTS_POSSIBLE(cnt)) != NULL)
			break;
		}

		if ((mult_bands[k] & BAND160) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");
		if ((mult_bands[k] & BAND80) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");
		if ((mult_bands[k] & BAND40) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");
		if ((mult_bands[k] & BAND20) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");
		if ((mult_bands[k] & BAND15) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");
		if ((mult_bands[k] & BAND10) != 0)
		    strcat(mprint, "*");
		else
		    strcat(mprint, "-");

		mprint[11] = '\0';
		mvprintw(vert, 2 + hor * 11, "%s", mprint);
		cnt++;

	    }
	}
    }

    if (use_rxvt == 0)
	attron(COLOR_PAIR(C_WINDOW) | A_BOLD | A_STANDOUT);
    else
	attron(COLOR_PAIR(C_WINDOW) | A_STANDOUT);

    mvprintw(23, 22, " --- Press a key to continue --- ");

    refreshp();

    getch();

    if (use_rxvt == 0)
	attron(COLOR_PAIR(C_LOG) | A_BOLD | A_STANDOUT);
    else
	attron(COLOR_PAIR(C_LOG) | A_STANDOUT);

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    clear_display();

    return (0);

}
示例#2
0
文件: changepars.c 项目: wildj79/tlf
int multiplierinfo(void)
{
    extern int arrlss;
    extern int serial_section_mult;
    extern int sectn_mult;
    extern struct mults_t multis[MAX_MULTS];
    extern int nr_multis;
    extern GPtrArray *mults_possible;

    int j, k, vert, hor, cnt, found;
    char mprint[50];

    clear();

    attron(modify_attr(COLOR_PAIR(C_WINDOW) | A_STANDOUT));

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    if (arrlss == 1) {
	int attributes;
	char chmult[6];
	char ch2mult[6];

	mvprintw(2, 20, "ARRL SWEEPSTAKES -- REMAINING SECTIONS");
	cnt = 0;
	for (vert = 9; vert < 18; vert++) {

	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 5; hor < 15; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		g_strlcpy(chmult, MULTS_POSSIBLE(cnt), sizeof(chmult));

		/* check if in worked multis */
		found = 0;
		for (j = 0; j < nr_multis; j++) {
		    g_strlcpy(ch2mult, multis[j].name, sizeof(ch2mult));

		    if (strcmp(g_strchomp(ch2mult), chmult) == 0)
			found = 1;
		}

		if (found == 1)
		    attributes = COLOR_PAIR(C_HEADER) | A_STANDOUT;
		else
		    attributes = COLOR_PAIR(C_WINDOW) | A_STANDOUT;

		attron(modify_attr(attributes));

		g_strlcpy(mprint, MULTS_POSSIBLE(cnt), 5);
		mvprintw(vert, hor * 4, "%s", mprint);

		cnt++;
	    }
	}
    }

    if (serial_section_mult == 1 || (sectn_mult == 1 && arrlss != 1)) {
	char * tmp;
	int worked_at;

	mvprintw(0, 30, "REMAINING SECTIONS");
	cnt = 0;
	for (vert = 2; vert < 22; vert++) {
	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 0; hor < 7; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		worked_at = 0;

		/* lookup if already worked */
		for (k = 0; k < nr_multis; k++) {
		    if (strstr(multis[k].name, MULTS_POSSIBLE(cnt)) != NULL) {
			worked_at = multis[k].band;
			break;
		    }
		}

		tmp = g_strndup(MULTS_POSSIBLE(cnt), 4);
		sprintf(mprint, "%-4s", tmp);
		g_free(tmp);

		strcat(mprint, (worked_at & BAND160)?"*":"-");
		strcat(mprint, (worked_at & BAND80)?"*":"-");
		strcat(mprint, (worked_at & BAND40)?"*":"-");
		strcat(mprint, (worked_at & BAND20)?"*":"-");
		strcat(mprint, (worked_at & BAND15)?"*":"-");
		strcat(mprint, (worked_at & BAND10)?"*":"-");

		mprint[11] = '\0';
		mvprintw(vert, 2 + hor * 11, "%s", mprint);

		cnt++;
	    }
	}
    }

    attron(modify_attr(COLOR_PAIR(C_WINDOW) | A_STANDOUT));

    mvprintw(23, 22, " --- Press a key to continue --- ");

    refreshp();

    (void)key_get();

    attron(modify_attr(COLOR_PAIR(C_LOG) | A_STANDOUT));

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    clear_display();

    return (0);

}