Skip to content

Commit c293b14

Browse files
author
Bruce Lee
committed
Merged pal's patch
1 parent fd0ad63 commit c293b14

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

cr3gui/src/cr3pocketbook.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ class CRPocketBookDocView : public V3DocViewWin {
12881288
lString8 menuActionId(PB_QUICK_MENU_ACTION_ID);
12891289
for (int i = 0; i < 9; i++) {
12901290
menuActionId[PB_QUICK_MENU_ACTION_ID_IDX] = '0' + i;
1291-
char *action = GetThemeString((char *)menuActionId.c_str(), (char *)def_menuaction[i]);
1291+
char *action = (char*)GetThemeString((char *)menuActionId.c_str(), (char *)def_menuaction[i]);
12921292
_quick_menuactions[i] = CRPocketBookWindowManager::instance->getPocketBookCommandIndex(action);
12931293
}
12941294
}
@@ -3627,6 +3627,7 @@ void SetSaveStateTimer(){
36273627
}
36283628
#endif
36293629

3630+
static bool need_save_cover = false;
36303631
int main_handler(int type, int par1, int par2)
36313632
{
36323633
bool process_events = false;
@@ -3638,6 +3639,22 @@ int main_handler(int type, int par1, int par2)
36383639
case EVT_SHOW:
36393640
CRPocketBookWindowManager::instance->update(true);
36403641
pbGlobals->BookReady();
3642+
if (need_save_cover) {
3643+
ibitmap *cover = GetBookCover(UnicodeToLocal(pbGlobals->getFileName()).c_str(), ScreenWidth(), ScreenHeight() - PanelHeight());
3644+
if (cover) {
3645+
ibitmap *cover_prev = LoadBitmap( USERLOGOPATH"/bookcover");
3646+
if (cover_prev) {
3647+
if( cover->scanline * cover->height == cover_prev->scanline * cover_prev->height &&
3648+
memcmp(cover->data,cover_prev->data,cover->scanline * cover->height) == 0 )
3649+
need_save_cover = 0;
3650+
if (need_save_cover)
3651+
SaveBitmap( USERLOGOPATH"/bookcover", cover);
3652+
free(cover_prev);
3653+
}
3654+
free(cover);
3655+
}
3656+
need_save_cover = false;
3657+
}
36413658
break;
36423659
#ifdef POCKETBOOK_PRO
36433660
case EVT_BACKGROUND:
@@ -3706,6 +3723,10 @@ int main_handler(int type, int par1, int par2)
37063723
CRPocketBookWindowManager::instance->onTouch(par1, par2, getTouchEventType(type));
37073724
process_events = true;
37083725
break;
3726+
case EVT_INIT:
3727+
SetPanelType(0);
3728+
need_save_cover = true;
3729+
break;
37093730
default:
37103731
break;
37113732
}
@@ -3721,6 +3742,7 @@ const char* TR(const char *label)
37213742
return tr;
37223743
}
37233744

3745+
extern ifont* header_font;
37243746
int main(int argc, char **argv)
37253747
{
37263748
OpenScreen();
@@ -3732,6 +3754,7 @@ int main(int argc, char **argv)
37323754
Message(ICON_WARNING, const_cast<char*>("CoolReader"), const_cast<char*>("@Cant_open_file"), 2000);
37333755
return 2;
37343756
}
3757+
header_font->color = WHITE;
37353758
InkViewMain(main_handler);
37363759
return 0;
37373760
}

0 commit comments

Comments
 (0)