示例#1
0
void SDeskItemRSS::DrawMessage(
    CascadeBitmap& bitmap)
{
    int x = SDesk::getInstance().getCurrentTheme().getTextTopOffset();
    int y = SDesk::getInstance().getCurrentTheme().getTextLeftOffset();
    const char* str = mName;
    SDeskBitmap b;

    Log(7, "SDeskItemRSS::DrawMessage(%s)\n", str);

    // This is the rectangle we draw in.
    CascadeRect r = CascadeRect(x, y,
        SDesk::getInstance().getCurrentTheme().getScreenWidth() - (2 * x),
        SDesk::getInstance().getCurrentTheme().getScreenHeight() - y - 20);

    // The item is not selected.
    bitmap.DrawText(
        SDesk::getInstance().getCurrentTheme().getNormalFont(),
        r, mFilename,
        SDesk::getInstance().getCurrentTheme().getNormalColor(),
        TEXT_JUSTIFY_TOP |
        TEXT_JUSTIFY_LEFT | TEXT_WORD_WRAP);

    Log(7, "SDeskItemRSS::DrawMessage() done\n");
}
示例#2
0
void SDeskItemRSS::DrawText(
    CascadeBitmap& bitmap,
    int x,
    int y,
    int menuType)
{
    const char* str = mName;

    Log(1, "SDeskItemRSS::DrawText(%s)\n", str);

    // This is the rectangle we draw in.
    CascadeRect r = CascadeRect(x, y,
        SDesk::getInstance().getCurrentTheme().getScreenWidth() - (2 * x),
        SDesk::getInstance().getCurrentTheme().getTextCellHeight());

    // The item is not selected.
    bitmap.DrawText(
        SDesk::getInstance().getCurrentTheme().getNormalFont(),
        r, mName,
        SDesk::getInstance().getCurrentTheme().getNormalColor(),
        TEXT_CENTER_VERTICALLY |
        TEXT_JUSTIFY_LEFT | TEXT_CLIP_WITH_DOTDOTDOT);

    Log(7, "SDeskItemRSS::DrawText() done\n");
}
示例#3
0
/*****************************************************************************
 * Display: Map p_image onto the screen
 *****************************************************************************/
static void Display( vout_thread_t *p_vout, picture_t *p_pic )
{
    uint32_t i_width, i_height, i_x, i_y;
    uint32_t i_offset = 0;
    
    vout_PlacePicture( p_vout, p_vout->p_sys->i_width,
                       p_vout->p_sys->i_height,
                       &i_x, &i_y, &i_width, &i_height );
    msg_Dbg( p_vout, "PlacePicture at x_left = %d, y_left = %d, x_bottom = %d, y_bottom = %d",
                i_x, i_y, i_width, i_height );

    /* Currently the only pixel format supported is 32bpp RGBA.*/
    p_vout->p_sys->p_screen->LockScreen();
    
    /* Unlock the shared memory region first. */
    if( p_pic->p_sys->p_image->Unlock() ) 
    {
        msg_Err( p_vout, "unlocking shared memory failed. Expect threading problems." );
    }
    
    p_vout->p_sys->p_screen->Blit( CascadePoint( (u32) i_x, (u32) i_y ), /* Place bitmap at */
            (*p_pic->p_sys->p_image)   ,                                      /* Image data */
            (u32) i_offset,                                   /* Offset in SharedMemoryZone */
            (u32) i_width,                                           /* Source bitmap width */
            (u32) i_height,                                         /* Source bitmap height */
            (u32) p_vout->p_sys->i_screen_depth,                      /* Source pixel depth */
            CascadeRect( (u32) i_x, (u32) i_y, (u32) i_width, (u32) i_height ) );
            
    p_vout->p_sys->p_screen->UnlockScreen();
}
示例#4
0
void SDeskItemMovieInfo::DrawMessage(
    CascadeBitmap& bitmap)
{
    const char* str = mName;
    SDeskBitmap b;
    CascadeRect r;
    CascadeString label;
    CascadeString value;
    FILE *fd;
    char *pos;
    char buf[1024];
    int valueWidth = 0;
    int valueY = 0;
    int valueHeight = 0;

    Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", str);
    strcpy(buf, mFilename);
    pos = strrchr(buf, '.');
    if (pos) {
        // found a file extension
        *pos = 0;
    }
    strcat(buf, ".nfo");
    Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
    if ((fd = fopen(buf, "r")) == NULL) {
        strcpy(buf, mFilename);
        pos = strrchr(buf, '.');
        if (pos) {
            // found a file extension
            *pos = 0;
        }
        strcat(buf, ".my");
        Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
        if ((fd = fopen(buf, "r")) == NULL) {
            strcpy(buf, mFilename);
            pos = strrchr(buf, '.');
            if (pos) {
                // found a file extension
                *pos = 0;
            }
            strcat(buf, ".txt");
            Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
            if ((fd = fopen(buf, "r")) == NULL) {
                strcpy(buf, mFilename);
                strcat(buf, "/folder.nfo");
                Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                if ((fd = fopen(buf, "r")) == NULL) {
                    strcpy(buf, mFilename);
                    strcat(buf, "/folder.my");
                    Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                    if ((fd = fopen(buf, "r")) == NULL) {
                        strcpy(buf, mFilename);
                        strcat(buf, "/folder.txt");
                        Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                        if ((fd = fopen(buf, "r")) == NULL) {
                            strcpy(buf, mFilename);
                            pos = strrchr(buf, '/');
                            if (pos) {
                                // found a file extension
                                *pos = 0;
                                if (pos) {
                                    if (strcmp(pos, "/VIDEO_TS") == 0) {
                                        *pos = 0;
                                    }
                                }
                            }
                            strcat(buf, ".nfo");
                            Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                            if ((fd = fopen(buf, "r")) == NULL) {
                                strcpy(buf, mFilename);
                                pos = strrchr(buf, '/');
                                if (pos) {
                                    // found a file extension
                                    *pos = 0;
                                    if (strcmp(pos, "/VIDEO_TS") == 0) {
                                        *pos = 0;
                                    }
                                }
                                strcat(buf, ".my");
                                Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                                if ((fd = fopen(buf, "r")) == NULL) {
                                    strcpy(buf, mFilename);
                                    pos = strrchr(buf, '/');
                                    if (pos) {
                                        // found a file extension
                                        *pos = 0;
                                        if (strcmp(pos, "/VIDEO_TS") == 0) {
                                            *pos = 0;
                                        }
                                    }
                                    strcat(buf, ".txt");
                                    Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                                    if ((fd = fopen(buf, "r")) == NULL) {
                                        strcpy(buf, mFilename);
                                        pos = strrchr(buf, '/');
                                        if (pos) {
                                            // found a file extension
                                            *pos = 0;
                                        }
                                        strcat(buf, "/folder.nfo");
                                        Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                                        if ((fd = fopen(buf, "r")) == NULL) {
                                            strcpy(buf, mFilename);
                                            pos = strrchr(buf, '/');
                                            if (pos) {
                                                // found a file extension
                                                *pos = 0;
                                                if (strcmp(pos, "/VIDEO_TS") == 0) {
                                                    *pos = 0;
                                                }
                                            }
                                            strcat(buf, "/folder.my");
                                            Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                                            if ((fd = fopen(buf, "r")) == NULL) {
                                                strcpy(buf, mFilename);
                                                pos = strrchr(buf, '/');
                                                if (pos) {
                                                    // found a file extension
                                                    *pos = 0;
                                                    if (strcmp(pos, "/VIDEO_TS") == 0) {
                                                        *pos = 0;
                                                    }
                                                }
                                                strcat(buf, "/folder.txt");
                                                Log(7, "SDeskItemMovieInfo::DrawMessage(%s)\n", buf);
                                                if ((fd = fopen(buf, "r")) == NULL) {
                                                    Log(8, "fopen failed (%s)...\n", buf);
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    // Compute the width for the value items.
    valueWidth = SDesk::getInstance().getCurrentTheme().getScreenWidth() -
        LABEL_WIDTH - 40;

    while ((pos = fgets(buf, 1023, fd)) != 0) {
        buf[strlen(buf) - 1] = 0;
        if (buf[strlen(buf) - 1] == '\n' ||
            buf[strlen(buf) - 1] == '\r') {
            buf[strlen(buf) - 1] = 0;
        }

        valueY = 0;
        valueHeight = 0;
        if (strncmp(pos, "title=", 6) == 0 ||
            strncmp(pos, "TVEpisode=", 10) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Title:");
            value = CascadeString(pos);
            valueY = TITLE_Y;
            valueHeight = TITLE_HEIGHT;
        } else if (strncmp(pos, "summary=", 8) == 0 ||
                   strncmp(pos, "TVOverview=", 11) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Summary:");
            value = CascadeString(pos);
            valueY = SUMMARY_Y;
            valueHeight = SUMMARY_HEIGHT;
        } else if (strncmp(pos, "genre=", 6) == 0 ||
                   strncmp(pos, "TVGenre=", 8) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Genre:");
            value = CascadeString(pos);
            valueY = GENRE_Y;
            valueHeight = GENRE_HEIGHT;
        } else if (strncmp(pos, "year=", 5) == 0 ||
                   strncmp(pos, "TVOriginalAiringDate=", 21) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Year:");
            value = CascadeString(pos);
            valueY = YEAR_Y;
            valueHeight = YEAR_HEIGHT;
        } else if (strncmp(pos, "rating=", 7) == 0 ||
                   strncmp(pos, "TVParentalRatings=", 18) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Rating:");
            value = CascadeString(pos);
            valueY = RATING_Y;
            valueHeight = RATING_HEIGHT;
        } else if (strncmp(pos, "director=", 9) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Director:");
            value = CascadeString(pos);
            valueY = DIRECTOR_Y;
            valueHeight = DIRECTOR_HEIGHT;
        } else if (strncmp(pos, "writer=", 7) == 0) {
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Writer:");
            value = CascadeString(pos);
            valueY = WRITER_Y;
            valueHeight = WRITER_HEIGHT;
        } else if (strncmp(pos, "actors=", 7) == 0 ||
                   strncmp(pos, "TVActors=", 9) == 0) {
            if (strncmp(pos, "TVActors=", 9) == 0) {
                valueY = DIRECTOR_Y;
            } else {
                valueY = ACTORS_Y;
            }
            pos = strchr(pos, '=');
            pos++;
            label = CascadeString("Actors:");
            value = CascadeString(pos);
            valueHeight = ACTORS_HEIGHT;
        }

        if (valueY != 0) {
            // This is the rectangle we draw in.
            r = CascadeRect(LABEL_X, valueY,
                            LABEL_WIDTH, LABEL_HEIGHT);

            // Show the label..
            bitmap.DrawText(
                SDesk::getInstance().getCurrentTheme().getNormalFont(),
                r, label,
                SDesk::getInstance().getCurrentTheme().getNormalColor(),
                TEXT_JUSTIFY_TOP |
                TEXT_JUSTIFY_LEFT);

            r = CascadeRect(VALUE_X, valueY, valueWidth, valueHeight);
            
            // Shopw the actual value...
            bitmap.DrawText(
                SDesk::getInstance().getCurrentTheme().getNormalFont(),
                r, value,
                SDesk::getInstance().getCurrentTheme().getNormalColor(),
                TEXT_JUSTIFY_TOP |
                TEXT_JUSTIFY_LEFT | TEXT_WORD_WRAP);
        }
    }

    fclose(fd);

    Log(7, "SDeskItemMovieInfo::DrawMessage() done\n");
}