Beispiel #1
0
/**
 * Draw the big screen and the screen divisions.
 */
void screenPrintFrame(void)
{
    uint8_t y;

    // Top line
    screenPrintTopLine(0, 39, 0);
    // 1 text line
    screenPrintFreeLine(0, 39, 1);
    // separation line
    screenPrintSepLine(0, 39, 2);

    // some free lines
    for (y = 3; y < 22; ++y)
        screenPrintFreeLine(0, 39, y);
    // separation line
    screenPrintSepLine(0, 39, 22);
    // 1 text line
    screenPrintFreeLine(0, 39, 23);
    // Bottom line
    screenPrintBottomLine(0, 39, 24);
}
Beispiel #2
0
/**
 * Return the string entered. The maximal length of the string is
 * FILENAME_MAX, i.e. 16+1.
 */
const char* __fastcall__ screenReadInput(const char* pStrTitle,
                                         const char* pStrDefault)
{
    uint8_t len;
    static char strInput[FILENAME_MAX];
    char c;

    screenBing();
    strcpy(strInput, pStrDefault);
    len = strlen(strInput);

    screenPrintBox(2, 6, 36, 12);
    screenPrintSepLine(2, 37, 8);

    cputsxy(3, 7, pStrTitle);

    // the input field
    textcolor(COLOR_LIGHTFRAME);
    screenPrintBox(4, 10, 32, 3);
    textcolor(COLOR_FOREGROUND);

    screenPrintButton(30, 14, "Enter");

    cursor(1);
    do
    {
        cputsxy(5, 11, strInput);
        cputc(' ');
        gotox(5 + len);

        c = cgetc();
        if (len < sizeof(strInput) - 1 &&
                ((c >=  32 && c < 128) ||
                 (c >= 192 && c < 224))
           )
        {
            strInput[len++] = c;
            strInput[len]   = '\0';
        }
        else if (c == CH_DEL)
        {
            if (len)
                strInput[--len] = '\0';
        }
    } while (c != CH_ENTER);

    cursor(0);
    refreshMainScreen();

    return strInput;
}
Beispiel #3
0
/**
 * Print a dialog with some text lines and wait for a key if a flag is set.
 * The array of lines apStrLines must be terminated with a NULL pointer.
 *
 * flags            may contain BUTTON_ENTER and/or BUTTON_STOP.
 * return           the button which has been pressed
 */
uint8_t __fastcall__ screenPrintDialog(const char* apStrLines[], uint8_t flags)
{
    uint8_t y, t;
    uint8_t nLines;
    uint8_t nLongestLength = 1;
    uint8_t xStart, xEnd, yStart, yEnd;

    for (y = 0; apStrLines[y]; ++y)
    {
        t = strlen(apStrLines[y]);
        if (t > nLongestLength)
            nLongestLength = t;
    }
    nLines = y;

    if (nLongestLength > 38)
        nLongestLength = 38;

    nLongestLength += 2;
    xStart = 20 - nLongestLength / 2;
    xEnd = 20 + nLongestLength / 2;
    yStart = 7 - nLines / 2;
    yEnd = 7 + nLines / 2 + 9;

    // Top line
    y = yStart;
    screenPrintTopLine(xStart, xEnd, y);
    screenPrintFreeLine(xStart, xEnd, ++y);
    cputsxy(xStart + 1, y, "EasyProg");
    screenPrintSepLine(xStart, xEnd, ++y);

    // some lines
    for (++y; y < yEnd; ++y)
        screenPrintFreeLine(xStart, xEnd, y);
    // Bottom line
    screenPrintBottomLine(xStart, xEnd, y);

    // Write the text lines
    yStart += 4;
    ++xStart;
    for (y = 0; y < nLines; ++y)
    {
        t = strlen(apStrLines[y]);
        if (t > 38)
            continue;

        cputsxy(xStart, yStart++, apStrLines[y]);
    }

    y = yEnd - 3;
    if (flags & BUTTON_ENTER)
        screenPrintButton(xEnd - 7, yEnd - 3, "Enter");

    if (flags & BUTTON_STOP)
        screenPrintButton(xStart, yEnd - 3, "Stop");

    screenBing();

    if (flags)
        return screenWaitKey(flags);

    return 0;
}
Beispiel #4
0
/**
 * Show or refresh the Screen which reports the Flash IDs.
 */
void refreshMainScreen(void)
{
    const char* str;

    screenPrintFrame();

    // menu entries
    gotoxy (1, 1);
    textcolor(COLOR_EXTRA);
    cputc('M');
    textcolor(COLOR_FOREGROUND);
    cputs("enu  ");

    textcolor(COLOR_EXTRA);
    cputc('O');
    textcolor(COLOR_FOREGROUND);
    cputs("ptions  ");

    textcolor(COLOR_EXTRA);
    cputc('E');
    textcolor(COLOR_FOREGROUND);
    cputs("xpert  ");

    textcolor(COLOR_EXTRA);
    cputc('H');
    textcolor(COLOR_FOREGROUND);
    cputs("elp");

    textcolor(COLOR_LIGHTFRAME);
    screenPrintBox(16, 4, 23, 11);
    screenPrintSepLine(16, 38, 6);
    screenPrintSepLine(16, 38, 8);
    screenPrintSepLine(16, 38, 10);
    screenPrintSepLine(16, 38, 12);
    textcolor(COLOR_FOREGROUND);

    gotoxy(6, 5);
    cputs("File name:");
    gotox(17);
    cputs(g_strFileName);

    gotoxy(7, 7);
    cputs("CRT Type:");
    gotox(17);
    cputs(aStrInternalCartTypeName[internalCartType]);

    gotoxy(3, 9);
    cputs("Flash Driver:");
    gotox(17);
    cputs(pStrFlashDriver);

    gotoxy(10, 11);
    cputs("Slots:");
    gotox(17);
    cputs(strMemSize);

    gotoxy(3, 13);
    cputs("Time elapsed:");

    refreshElapsedTime();
    progressShow();
    refreshStatusLine();
}