From 2b774400bdebf5f34a7de74e86410cf35cb848f0 Mon Sep 17 00:00:00 2001 From: seife Date: Fri, 1 Apr 2011 17:02:35 +0000 Subject: [PATCH] moviebrowser: specify widths and height in percent of screen size git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1370 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/deutsch.locale | 4 +- data/locale/dutch.locale | 4 +- data/locale/english.locale | 4 +- data/locale/french.locale | 4 +- data/locale/hungarian.locale | 4 +- data/locale/italiano.locale | 4 +- data/locale/polski.locale | 4 +- data/locale/portugues.locale | 4 +- data/locale/russkij.locale | 4 +- data/locale/slovak.locale | 4 +- src/gui/moviebrowser.cpp | 112 ++++++++++++++++++++++------------- src/gui/moviebrowser.h | 5 +- src/gui/widget/listframe.cpp | 17 +++--- 13 files changed, 103 insertions(+), 71 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index b9ad606cb..e9af9cb89 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -820,11 +820,11 @@ moviebrowser.book_position Position: moviebrowser.book_type Sprung (<0 zurück, >0 vor): moviebrowser.book_type_backward Wiederholung moviebrowser.book_type_forward Überspringen -moviebrowser.browser_frame_high Anzeigehöhe oberes Fenster [Punkte] +moviebrowser.browser_frame_high Anzeigehöhe oberes Fenster [%] moviebrowser.browser_row_head Spalten Einstellungen moviebrowser.browser_row_item Spalteninfo moviebrowser.browser_row_nr Anzahl Spalten -moviebrowser.browser_row_width Spaltenbreite [Punkte] +moviebrowser.browser_row_width Spaltenbreite [% der Gesamtbreite] moviebrowser.dir Pfad moviebrowser.dir_head Zusätzliche Verzeichnisse moviebrowser.edit_book Bookmark Ändern diff --git a/data/locale/dutch.locale b/data/locale/dutch.locale index 9fbbb6ef2..441119b33 100644 --- a/data/locale/dutch.locale +++ b/data/locale/dutch.locale @@ -1275,7 +1275,7 @@ moviebrowser.load_default Laadt standaard instellingen moviebrowser.browser_row_head Kolom instellingen moviebrowser.browser_row_nr Aantal kolommen moviebrowser.browser_row_item Kolom item -moviebrowser.browser_row_width Kolom breedte +moviebrowser.browser_row_width Kolom breedte [%] moviebrowser.reload_at_start Opnieuw inladen van film info na starten moviebrowser.remount_at_start Hermount na opstarten moviebrowser.dir_head Additional paths @@ -1286,7 +1286,7 @@ moviebrowser.use_movie_dir Gebruik movie directory moviebrowser.hide_series Verberg series moviebrowser.last_record_max_items Aantal regels van laatste opname moviebrowser.last_play_max_items Aantal regels van laatst gespeelde video -moviebrowser.browser_frame_high Browser hoogte [Pixel] +moviebrowser.browser_frame_high Browser hoogte [%] extra.auto_timeshift Auto-record, sec (0 = uit) extra.auto_delete Automatiisch wissen extra.auto_to_record Verplaats timeshift naar opnames diff --git a/data/locale/english.locale b/data/locale/english.locale index 325f068cb..80513dd9b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -820,11 +820,11 @@ moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back , >0 for): moviebrowser.book_type_backward Repeat moviebrowser.book_type_forward jump over -moviebrowser.browser_frame_high Browser hight [Pixel] +moviebrowser.browser_frame_high Browser hight [%] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item moviebrowser.browser_row_nr Number of rows -moviebrowser.browser_row_width Row width +moviebrowser.browser_row_width Row width (% of screenwidth) moviebrowser.dir Path moviebrowser.dir_head Additional paths moviebrowser.edit_book Bookmark change diff --git a/data/locale/french.locale b/data/locale/french.locale index 71bc6afa3..000c7412a 100644 --- a/data/locale/french.locale +++ b/data/locale/french.locale @@ -641,11 +641,11 @@ moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back , >0 for): moviebrowser.book_type_backward Repeat moviebrowser.book_type_forward jump over -moviebrowser.browser_frame_high Browser hight [Pixel] +moviebrowser.browser_frame_high Browser hight [%] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item moviebrowser.browser_row_nr Number of rows -moviebrowser.browser_row_width Row width +moviebrowser.browser_row_width Row width [%] moviebrowser.dir Path moviebrowser.dir_head Additional paths moviebrowser.edit_book Bookmark change diff --git a/data/locale/hungarian.locale b/data/locale/hungarian.locale index e0abf16e6..40b75593a 100644 --- a/data/locale/hungarian.locale +++ b/data/locale/hungarian.locale @@ -800,11 +800,11 @@ moviebrowser.book_position Pozíció: moviebrowser.book_type Ugrás (<0 back , >0 for): moviebrowser.book_type_backward Ismétlés moviebrowser.book_type_forward jump over -moviebrowser.browser_frame_high Böngésző magassága (px) +moviebrowser.browser_frame_high Böngésző magassága (%) moviebrowser.browser_row_head Sor beállítások moviebrowser.browser_row_item Elem moviebrowser.browser_row_nr Sorok száma -moviebrowser.browser_row_width Szélesség +moviebrowser.browser_row_width Szélesség [%] moviebrowser.dir Útvonal moviebrowser.dir_head További útvonalak moviebrowser.edit_book Bookmark change diff --git a/data/locale/italiano.locale b/data/locale/italiano.locale index e51c24916..9602049b3 100644 --- a/data/locale/italiano.locale +++ b/data/locale/italiano.locale @@ -742,11 +742,11 @@ moviebrowser.book_position Posizione: moviebrowser.book_type Salta (<0 indietro , >0 avanti): moviebrowser.book_type_backward Ripeti moviebrowser.book_type_forward salta oltre -moviebrowser.browser_frame_high Browser altezza [Pixel] +moviebrowser.browser_frame_high Browser altezza [%] moviebrowser.browser_row_head Impostazioni righe moviebrowser.browser_row_item Indice riga moviebrowser.browser_row_nr Numero di righe -moviebrowser.browser_row_width Larghezza riga +moviebrowser.browser_row_width Larghezza riga [%] moviebrowser.dir Path moviebrowser.dir_head Additional paths moviebrowser.edit_book Bookmark cambia diff --git a/data/locale/polski.locale b/data/locale/polski.locale index 1991f913b..6715d4dd9 100644 --- a/data/locale/polski.locale +++ b/data/locale/polski.locale @@ -795,11 +795,11 @@ moviebrowser.book_position Pozycja: moviebrowser.book_type Skocz (<0 w tył , >0 do przodu): moviebrowser.book_type_backward Powtórz moviebrowser.book_type_forward skocz poza -moviebrowser.browser_frame_high Wysokość przeglądarki [Piksele] +moviebrowser.browser_frame_high Wysokość przeglądarki [%] moviebrowser.browser_row_head Ustawienia wierszy moviebrowser.browser_row_item Ustęp wiersza moviebrowser.browser_row_nr Ilość wierszy -moviebrowser.browser_row_width Szerokośc wiersza +moviebrowser.browser_row_width Szerokośc wiersza [%] moviebrowser.dir Ścieżka moviebrowser.dir_head Dodatkowe ściezki moviebrowser.edit_book Zmień zakładkę diff --git a/data/locale/portugues.locale b/data/locale/portugues.locale index 096a9a045..b611d2170 100644 --- a/data/locale/portugues.locale +++ b/data/locale/portugues.locale @@ -696,11 +696,11 @@ moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back , >0 for): moviebrowser.book_type_backward Repeat moviebrowser.book_type_forward jump over -moviebrowser.browser_frame_high Browser hight [Pixel] +moviebrowser.browser_frame_high Browser hight [%] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item moviebrowser.browser_row_nr Number of rows -moviebrowser.browser_row_width Row width +moviebrowser.browser_row_width Row width [%] moviebrowser.dir Path moviebrowser.dir_head Additional paths moviebrowser.edit_book Bookmark change diff --git a/data/locale/russkij.locale b/data/locale/russkij.locale index 8e5baf722..6b6b81565 100644 --- a/data/locale/russkij.locale +++ b/data/locale/russkij.locale @@ -645,11 +645,11 @@ moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back , >0 for): moviebrowser.book_type_backward Repeat moviebrowser.book_type_forward jump over -moviebrowser.browser_frame_high Browser hight [Pixel] +moviebrowser.browser_frame_high Browser hight [%] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item moviebrowser.browser_row_nr Number of rows -moviebrowser.browser_row_width Row width +moviebrowser.browser_row_width Row width [%] moviebrowser.dir Path moviebrowser.dir_head Additional paths moviebrowser.edit_book Bookmark change diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index cc3b0198f..e82df5ea8 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -789,11 +789,11 @@ moviebrowser.book_position Pozícia: moviebrowser.book_type Skok (<0 vzad , >0 vpred): moviebrowser.book_type_backward Opakovať moviebrowser.book_type_forward Skok za -moviebrowser.browser_frame_high Výška prehliadača [pixel] +moviebrowser.browser_frame_high Výška prehliadača [%] moviebrowser.browser_row_head Nastavenia riadku moviebrowser.browser_row_item Položka stĺpca moviebrowser.browser_row_nr Počet stĺpcov -moviebrowser.browser_row_width Šírka stĺpca +moviebrowser.browser_row_width Šírka stĺpca [%] moviebrowser.dir Adresár moviebrowser.dir_head Doplnkové adresáre moviebrowser.edit_book Zmeň záložku diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 3fccfae1e..f45751ea6 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -173,27 +173,27 @@ const neutrino_locale_t m_localizedItemName[MB_INFO_MAX_NUMBER+1] = NONEXISTANT_LOCALE }; -// default row size in pixel for any element -#define MB_ROW_WIDTH_FILENAME 150 -#define MB_ROW_WIDTH_FILEPATH 150 -#define MB_ROW_WIDTH_TITLE 300 -#define MB_ROW_WIDTH_SERIE 100 -#define MB_ROW_WIDTH_INFO1 100 -#define MB_ROW_WIDTH_MAJOR_GENRE 100 -#define MB_ROW_WIDTH_MINOR_GENRE 30 -#define MB_ROW_WIDTH_INFO2 30 -#define MB_ROW_WIDTH_PARENTAL_LOCKAGE 25 -#define MB_ROW_WIDTH_CHANNEL 80 -#define MB_ROW_WIDTH_BOOKMARK 50 -#define MB_ROW_WIDTH_QUALITY 25 -#define MB_ROW_WIDTH_PREVPLAYDATE 80 -#define MB_ROW_WIDTH_RECORDDATE 80 -#define MB_ROW_WIDTH_PRODDATE 50 -#define MB_ROW_WIDTH_COUNTRY 50 -#define MB_ROW_WIDTH_GEOMETRIE 50 -#define MB_ROW_WIDTH_AUDIO 50 -#define MB_ROW_WIDTH_LENGTH 40 -#define MB_ROW_WIDTH_SIZE 45 +/* default row size in percent for any element */ +#define MB_ROW_WIDTH_FILENAME 22 +#define MB_ROW_WIDTH_FILEPATH 22 +#define MB_ROW_WIDTH_TITLE 45 +#define MB_ROW_WIDTH_SERIE 15 +#define MB_ROW_WIDTH_INFO1 25 +#define MB_ROW_WIDTH_MAJOR_GENRE 15 +#define MB_ROW_WIDTH_MINOR_GENRE 8 +#define MB_ROW_WIDTH_INFO2 25 +#define MB_ROW_WIDTH_PARENTAL_LOCKAGE 4 +#define MB_ROW_WIDTH_CHANNEL 12 +#define MB_ROW_WIDTH_BOOKMARK 4 +#define MB_ROW_WIDTH_QUALITY 4 +#define MB_ROW_WIDTH_PREVPLAYDATE 12 +#define MB_ROW_WIDTH_RECORDDATE 12 +#define MB_ROW_WIDTH_PRODDATE 8 +#define MB_ROW_WIDTH_COUNTRY 8 +#define MB_ROW_WIDTH_GEOMETRIE 8 +#define MB_ROW_WIDTH_AUDIO 8 +#define MB_ROW_WIDTH_LENGTH 6 +#define MB_ROW_WIDTH_SIZE 10 const int m_defaultRowWidth[MB_INFO_MAX_NUMBER+1] = { @@ -407,6 +407,9 @@ void CMovieBrowser::fileInfoStale(void) void CMovieBrowser::init(void) { + bool reinit_rows = false; + int i; + //TRACE("[mb]->init\r\n"); initGlobalSettings(); loadSettings(&m_settings); @@ -456,10 +459,27 @@ void CMovieBrowser::init(void) if(m_settings.parentalLock >= MB_PARENTAL_LOCK_MAX_NUMBER) m_settings.parentalLock = MB_PARENTAL_LOCK_OFF; + /* convert from old pixel-based to new percent values */ + if (m_settings.browserFrameHeight > 100) + m_settings.browserFrameHeight = 50; + if(m_settings.browserFrameHeight < MIN_BROWSER_FRAME_HEIGHT ) - m_settings.browserFrameHeight = MIN_BROWSER_FRAME_HEIGHT; + m_settings.browserFrameHeight = MIN_BROWSER_FRAME_HEIGHT; if(m_settings.browserFrameHeight > MAX_BROWSER_FRAME_HEIGHT) - m_settings.browserFrameHeight = MAX_BROWSER_FRAME_HEIGHT; + m_settings.browserFrameHeight = MAX_BROWSER_FRAME_HEIGHT; + + /* the old code had row widths in pixels, not percent. Check if we have + * an old configuration (one of the rows hopefully was larger than 100 pixels... */ + for (i = 0; i < m_settings.browserRowNr; i++) + { + if (m_settings.browserRowWidth[i] > 100) + { + printf("[moviebrowser] old row config detected - converting...\n"); + reinit_rows = true; + break; + } + } + /***** Browser List **************/ if(m_settings.browserRowNr == 0) { @@ -472,18 +492,23 @@ void CMovieBrowser::init(void) m_settings.browserRowItem[3] = MB_INFO_SIZE; m_settings.browserRowItem[4] = MB_INFO_PARENTAL_LOCKAGE; m_settings.browserRowItem[5] = MB_INFO_QUALITY; - m_settings.browserRowWidth[0] = m_defaultRowWidth[m_settings.browserRowItem[0]]; //300; - m_settings.browserRowWidth[1] = m_defaultRowWidth[m_settings.browserRowItem[1]]; //100; - m_settings.browserRowWidth[2] = m_defaultRowWidth[m_settings.browserRowItem[2]]; //80; - m_settings.browserRowWidth[3] = m_defaultRowWidth[m_settings.browserRowItem[3]]; //50; - m_settings.browserRowWidth[4] = m_defaultRowWidth[m_settings.browserRowItem[4]]; //30; - m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]]; //30; + reinit_rows = true; + } + + if (reinit_rows) + { + for (i = 0; i < m_settings.browserRowNr; i++) + m_settings.browserRowWidth[i] = m_defaultRowWidth[m_settings.browserRowItem[i]]; } initFrames(); initRows(); //initDevelopment(); + /* save settings here, because ::exec() will load them again... */ + if (reinit_rows) + saveSettings(&m_settings); + refreshLastPlayList(); refreshLastRecordList(); refreshBrowserList(); @@ -541,7 +566,7 @@ void CMovieBrowser::initGlobalSettings(void) } /***** Browser List **************/ - m_settings.browserFrameHeight = g_settings.screen_EndY - g_settings.screen_StartY - 20 - ((g_settings.screen_EndY - g_settings.screen_StartY - 20)>>1) - (INTER_FRAME_SPACE>>1); + m_settings.browserFrameHeight = 50; /* percent */ m_settings.browserRowNr = 6; m_settings.browserRowItem[0] = MB_INFO_TITLE; @@ -587,8 +612,9 @@ void CMovieBrowser::initFrames(void) m_cBoxFrameBrowserList.iX = m_cBoxFrame.iX; m_cBoxFrameBrowserList.iY = m_cBoxFrame.iY + m_cBoxFrameTitleRel.iHeight; m_cBoxFrameBrowserList.iWidth = m_cBoxFrame.iWidth; - m_cBoxFrameBrowserList.iHeight = m_settings.browserFrameHeight; //m_cBoxFrame.iHeight - (m_cBoxFrame.iHeight>>1) - (INTER_FRAME_SPACE>>1); + m_cBoxFrameBrowserList.iHeight = m_cBoxFrame.iHeight * m_settings.browserFrameHeight / 100; +fprintf(stderr, "m_cBoxFrame.iHeight %d m_cBoxFrameBrowserList.iHeight %d m_settings.browserFrameHeight %d\n",m_cBoxFrame.iHeight, m_cBoxFrameBrowserList.iHeight, m_settings.browserFrameHeight); m_cBoxFrameFootRel.iX = 0; m_cBoxFrameFootRel.iY = m_cBoxFrame.iHeight - m_pcFontFoot->getHeight(); m_cBoxFrameFootRel.iWidth = m_cBoxFrameBrowserList.iWidth; @@ -627,8 +653,10 @@ void CMovieBrowser::initRows(void) m_settings.lastPlayRow[3] = MB_INFO_MAX_NUMBER; m_settings.lastPlayRow[4] = MB_INFO_MAX_NUMBER; m_settings.lastPlayRow[5] = MB_INFO_MAX_NUMBER; - m_settings.lastPlayRowWidth[0] = 190; - m_settings.lastPlayRowWidth[1] = m_defaultRowWidth[m_settings.lastPlayRow[1]]; + /* the "last played" / "last recorded" windows have only half the width, so + multiply the relative width with 2 and add some fixed value for slack */ + m_settings.lastPlayRowWidth[1] = m_defaultRowWidth[m_settings.lastPlayRow[1]] * 2 + 1; + m_settings.lastPlayRowWidth[0] = 100 - m_settings.lastPlayRowWidth[1]; m_settings.lastPlayRowWidth[2] = m_defaultRowWidth[m_settings.lastPlayRow[2]]; m_settings.lastPlayRowWidth[3] = m_defaultRowWidth[m_settings.lastPlayRow[3]]; m_settings.lastPlayRowWidth[4] = m_defaultRowWidth[m_settings.lastPlayRow[4]]; @@ -642,8 +670,8 @@ void CMovieBrowser::initRows(void) m_settings.lastRecordRow[3] = MB_INFO_MAX_NUMBER; m_settings.lastRecordRow[4] = MB_INFO_MAX_NUMBER; m_settings.lastRecordRow[5] = MB_INFO_MAX_NUMBER; - m_settings.lastRecordRowWidth[0] = 190; - m_settings.lastRecordRowWidth[1] = m_defaultRowWidth[m_settings.lastRecordRow[1]]; + m_settings.lastRecordRowWidth[1] = m_defaultRowWidth[m_settings.lastRecordRow[1]] * 2 + 1; + m_settings.lastRecordRowWidth[0] = 100 - m_settings.lastRecordRowWidth[1]; m_settings.lastRecordRowWidth[2] = m_defaultRowWidth[m_settings.lastRecordRow[2]]; m_settings.lastRecordRowWidth[3] = m_defaultRowWidth[m_settings.lastRecordRow[3]]; m_settings.lastRecordRowWidth[4] = m_defaultRowWidth[m_settings.lastRecordRow[4]]; @@ -711,7 +739,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->storageDirUsed[i] = configfile.getInt32( cfg_key,false ); } /* these variables are used for the listframes */ - settings->browserFrameHeight = configfile.getInt32("mb_browserFrameHeight", 250); + settings->browserFrameHeight = configfile.getInt32("mb_browserFrameHeight", 50); settings->browserRowNr = configfile.getInt32("mb_browserRowNr", 0); for(int i = 0; i < MB_MAX_ROWS && i < settings->browserRowNr; i++) { @@ -1254,7 +1282,7 @@ void CMovieBrowser::refreshFilterList(void) m_FilterLines.rows = 1; m_FilterLines.lineArray[0].clear(); - m_FilterLines.rowWidth[0] = 400; + m_FilterLines.rowWidth[0] = 100; m_FilterLines.lineHeader[0]= ""; if(m_vMovieInfo.size() <= 0) @@ -2921,7 +2949,7 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/) /** optionsMenuBrowser **************************************************/ CIntInput playMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, (int&) m_settings.lastPlayMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput recMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, (int&) m_settings.lastRecordMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - CIntInput browserFrameUserIntInput(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int&) m_settings.browserFrameHeight, 4, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + CIntInput browserFrameUserIntInput(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int&) m_settings.browserFrameHeight, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput browserRowNrIntInput(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, (int&) m_settings.browserRowNr, 1, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput* browserRowWidthIntInput[MB_MAX_ROWS]; for(i=0; i500) - m_settings.browserRowWidth[i] = 500; - if( m_settings.browserRowWidth[i] < 10) - m_settings.browserRowWidth[i] = 10; + if( m_settings.browserRowWidth[i] > 100) + m_settings.browserRowWidth[i] = 100; + if( m_settings.browserRowWidth[i] < 1) + m_settings.browserRowWidth[i] = 1; } if(dirMenu.isChanged()) diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 8aad4ad39..d22eb1458 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -84,8 +84,9 @@ #define MAX_NUMBER_OF_BOOKMARK_ITEMS MI_MOVIE_BOOK_USER_MAX // we just use the same size as used in Movie info (MAX_NUMBER_OF_BOOKMARK_ITEMS is used for the number of menu items) #define MOVIEBROWSER_SETTINGS_FILE CONFIGDIR "/moviebrowser.conf" -#define MIN_BROWSER_FRAME_HEIGHT 100 -#define MAX_BROWSER_FRAME_HEIGHT 400 +/* percent */ +#define MIN_BROWSER_FRAME_HEIGHT 10 +#define MAX_BROWSER_FRAME_HEIGHT 80 void strReplace(std::string& orig, const char* fstr, const std::string rstr); /* !!!! Do NOT change the order of the enum, just add items at the end !!!! */ diff --git a/src/gui/widget/listframe.cpp b/src/gui/widget/listframe.cpp index 2da96f5eb..8c1621dcc 100644 --- a/src/gui/widget/listframe.cpp +++ b/src/gui/widget/listframe.cpp @@ -415,9 +415,10 @@ void CListFrame::refreshList(void) int width; int x = m_cFrameListRel.iX + TEXT_BORDER_WIDTH; y += m_nFontListHeight; + int net_width = m_cFrameListRel.iWidth - ROW_BORDER_WIDTH * (m_pLines->rows - 1); for(int row = 0; row < m_pLines->rows; row++) { - width = m_pLines->rowWidth[row] ; + width = m_pLines->rowWidth[row] * net_width / 100 ; if(width > m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH) { width = m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH; @@ -426,7 +427,7 @@ void CListFrame::refreshList(void) m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY, width, m_pLines->lineArray[row][line].c_str(), color, 0, true); // UTF-8 - x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH; + x += width + ROW_BORDER_WIDTH; } } } @@ -459,14 +460,15 @@ void CListFrame::refreshLine(int line) int width; int x = m_cFrameListRel.iX + TEXT_BORDER_WIDTH; y += m_nFontListHeight; + int net_width = m_cFrameListRel.iWidth - ROW_BORDER_WIDTH * (m_pLines->rows - 1); for(int row = 0; row < m_pLines->rows; row++) { - width = std::min(m_pLines->rowWidth[row], + width = std::min(m_pLines->rowWidth[row] * net_width / 100, m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH); m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY, width, m_pLines->lineArray[row][line].c_str(), color, 0, true); // UTF-8 - x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH; + x += width + ROW_BORDER_WIDTH; } } @@ -482,11 +484,12 @@ void CListFrame::refreshHeaderList(void) int width; int x = m_cFrameHeaderListRel.iX + TEXT_BORDER_WIDTH; int y = m_cFrameHeaderListRel.iY + m_nFontHeaderListHeight + 2; + int net_width = m_cFrameHeaderListRel.iWidth - ROW_BORDER_WIDTH * (m_pLines->rows - 1); bool loop = true; for(int row = 0; row < m_pLines->rows && loop == true; row++) { - width = m_pLines->rowWidth[row] ; - if(width > m_cFrameHeaderListRel.iWidth - x + m_cFrameHeaderListRel.iX - TEXT_BORDER_WIDTH) + width = m_pLines->rowWidth[row] * net_width / 100; + if (width > m_cFrameHeaderListRel.iWidth - x + m_cFrameHeaderListRel.iX - TEXT_BORDER_WIDTH) { width = m_cFrameHeaderListRel.iWidth - x + m_cFrameHeaderListRel.iX - TEXT_BORDER_WIDTH; //TRACE(" normalize width to %d , x:%d \r\n",width,x); @@ -495,7 +498,7 @@ void CListFrame::refreshHeaderList(void) m_pcFontHeaderList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY, width, m_pLines->lineHeader[row].c_str(), HEADER_LIST_FONT_COLOR, 0, true); // UTF-8 - x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH; + x += width + ROW_BORDER_WIDTH; } }