Skip to content

Commit

Permalink
Merge pull request #108 from blchinezu/dev
Browse files Browse the repository at this point in the history
Up version: 0.0.6-17-32
  • Loading branch information
blchinezu committed Aug 6, 2015
2 parents 3b09b35 + dc9760d commit 6044fc8
Show file tree
Hide file tree
Showing 36 changed files with 661 additions and 143 deletions.
Binary file modified builds/360/360/latest.zip
Binary file not shown.
Binary file modified builds/515/pro4/latest.zip
Binary file not shown.
Binary file modified builds/515/pro5/latest.zip
Binary file not shown.
Binary file modified builds/602/pro2/latest.zip
Binary file not shown.
Binary file modified builds/626/pro4/latest.zip
Binary file not shown.
Binary file modified builds/626/pro5/latest.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion builds/current.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.6-17-31
0.0.6-17-32
94 changes: 74 additions & 20 deletions cr3gui/src/cr3pocketbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
}

virtual void showWindow() {
CRLog::trace("CRPocketBookQuickMenuWindow::showWindow()");


#if defined(POCKETBOOK_PRO) && !defined(POCKETBOOK_PRO_PRO2)
// Touch menu
Expand All @@ -955,15 +957,18 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
#if defined(POCKETBOOK_PRO) && !defined(POCKETBOOK_PRO_PRO2)

virtual bool onTouch( int x, int y, CRGUITouchEventType evType ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(%d, %d, ?)", x, y);

// PRESS
if( evType == CRTOUCH_DOWN ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): CRTOUCH_DOWN");

touchDown.x = x;
touchDown.y = y;

// BOTTOM Page Bar
if( y >= bottomY + (int)(bottomH/2) && y < bottomY+bottomH ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): bottom page bar");
draggingPage = true;
TM_lastDragPage = -1;
}
Expand All @@ -974,18 +979,22 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow

// DRAG
else if( evType == CRTOUCH_MOVE ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): CRTOUCH_MOVE");

// BOTTOM
if( draggingPage ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): draggingPage");
DrawBottom(true, -1, x);
}
}

// RELEASE
else if( evType == CRTOUCH_UP ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): CRTOUCH_UP");

// TOP
if( max(touchDown.y, y) <= icon_height ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): TOP");

// Match tapped icon
int position = icon_space;
Expand All @@ -1006,13 +1015,15 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow

// Dragged page bar
if( draggingPage ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): Dragged page bar");

if( TM_lastDragPage == -1 )
DrawBottom(true, -1, x);

draggingPage = false;

if( TM_lastDragPage != main_win->getDocView()->getCurPage() ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): go to page %d", TM_lastDragPage);
SelfClose();
pageSelector(TM_lastDragPage);
return true;
Expand All @@ -1022,13 +1033,15 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow

// Go to page (progress text)
if( y >= bottomY && y < bottomY+(int)(bottomH/2) ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): Bottom");

if( x >= textX-20 && x <= textX+textW+20 ) {
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): progress text");
lString16 pageTmp = lString16::itoa(TM_lastDragPage);
strcpy( key_buffer, UnicodeToUtf8(pageTmp).c_str() );
SelfClose();
CRLog::trace("CRPocketBookQuickMenuWindow::onTouch(): OpenKeyboard(..., KBD_NUMERIC)");
OpenKeyboard(const_cast<char *>("@Page"), key_buffer, KEY_BUFFER_LEN, KBD_NUMERIC, goToPageKeyboardHandler);
// OpenKeyboard(const_cast<char *>("@Page"), key_buffer, KEY_BUFFER_LEN, 0, goToPageKeyboardHandler);
return true;
}
return true;
Expand All @@ -1043,23 +1056,32 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
}

virtual void IconTapped(int iconKey, int position) {
CRLog::trace("CRPocketBookQuickMenuWindow::IconTapped(%d, %d)", iconKey, position);

// Image name
lString16 path = lString16("icon_") + lString16(touchMenuIcons[iconKey]) + lString16("_tap.png");
CRLog::trace("CRPocketBookQuickMenuWindow::IconTapped(): [%d] %s", iconKey, UnicodeToUtf8(path).c_str());

// Get image
LVImageSourceRef img = CRPocketBookWindowManager::instance->getSkin()->getImage(path);
ibitmap* bmp = LVImageSourceRef_to_ibitmab(img);

// Draw
DrawBitmap(position, 0, bmp);
if( !img.isNull() ) {

// Convert
ibitmap* bmp = LVImageSourceRef_to_ibitmab(img);

// Draw
DrawBitmap(position, 0, bmp);

// Free memory
free(bmp);
// Free memory
free(bmp);

// Highlight tapped icon
// InvertAreaBW(position, 0, icon_width, icon_height);
PartialUpdateBW(position, 0, icon_width, icon_height);
// Highlight tapped icon
PartialUpdateBW(position, 0, icon_width, icon_height);
}
else {
CRLog::trace("CRPocketBookQuickMenuWindow::IconTapped(): NOT FOUND: [%d] %s", iconKey, UnicodeToUtf8(path).c_str());
}

// Close current window
SelfClose();
Expand All @@ -1076,6 +1098,7 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
}

virtual void DrawTop(bool updateScreen) {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawTop(%d)", updateScreen?1:0);

// Draw top background
FillArea(0, 0, ScreenWidth(), icon_height+2, 0x00FFFFFF);
Expand All @@ -1087,27 +1110,38 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow

// Image name
lString16 path = lString16("icon_") + lString16(touchMenuIcons[i]) + lString16(".png");
CRLog::trace("CRPocketBookQuickMenuWindow::DrawTop(): [%d] %s", i, UnicodeToUtf8(path).c_str());

// Get image
LVImageSourceRef img = CRPocketBookWindowManager::instance->getSkin()->getImage(path);
ibitmap* bmp = LVImageSourceRef_to_ibitmab(img);

// Draw
DrawBitmap(position, 0, bmp);
if( !img.isNull() ) {

// Convert
ibitmap* bmp = LVImageSourceRef_to_ibitmab(img);

// Free memory
free(bmp);
// Draw
DrawBitmap(position, 0, bmp);

// Free memory
free(bmp);
}
else {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawTop(): NOT FOUND: [%d] %s", i, UnicodeToUtf8(path).c_str());
}

// Increase position
position += icon_width + icon_space;
}

if( updateScreen ) {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawTop(): PartialUpdate(0, 0, %d, %d);", ScreenWidth(), icon_height+1);
PartialUpdate(0, 0, ScreenWidth(), icon_height+1);
}
}

virtual void DrawBottom(bool updateScreen, int page, int px) {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawBottom(%d, %d, %d)", updateScreen?1:0, page, px);

int drawPosition;
int pageCount;
Expand Down Expand Up @@ -1165,31 +1199,43 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
DrawString( textX, textY, UnicodeToUtf8(progress).c_str() );

if( updateScreen ) {
if( dragging )
if( dragging ) {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawBottom(): PartialUpdateBW(0, %d, %d, %d);",
bottomY, ScreenWidth(), bottomH);
PartialUpdateBW(0, bottomY, ScreenWidth(), bottomH);
else
}
else {
CRLog::trace("CRPocketBookQuickMenuWindow::DrawBottom(): PartialUpdate(0, %d, %d, %d);",
bottomY, ScreenWidth(), PanelHeight()+bottomH);
PartialUpdate(0, bottomY, ScreenWidth(), PanelHeight()+bottomH);
}
}
}

virtual void OpenTouchMenu() {
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu()");

isTouchMenuVisible = true;
TM_lastDragPage = -1;

// Activate panel

// Activate system panel
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): Activate system panel");
showSystemPanel(false);

// Offset the background
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): Offset the background");
ibitmap * bkg = BitmapFromScreen(0, PanelHeight(), ScreenWidth(), ScreenHeight()-PanelHeight());
DrawBitmap(0, 0, bkg);
free(bkg);

// Draw side lines
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): Draw side lines");
FillArea(0, 0, 1, ScreenHeight()-PanelHeight(), 0x00000000);
FillArea(ScreenWidth()-1, 0, 1, ScreenHeight()-PanelHeight(), 0x00000000);

// Set class vars
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): Set class vars");
icon_width = 75;
icon_height = 75;
icon_space = (ScreenWidth() - icon_width * TM_NB_ICONS) / (TM_NB_ICONS + 1);
Expand All @@ -1201,22 +1247,29 @@ class CRPocketBookQuickMenuWindow : public CRPocketBookInkViewWindow
barX1 = (int)(ScreenWidth()*0.05);
barX2 = barX1 + barW;
barY = bottomY + bottomH - (int)(bottomH/4);
textY = bottomY+20;
textY = bottomY+33;

// Draw
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): Draw");
DrawTop(false);
DrawBottom(false, -1, -1);

// Update screen
CRLog::trace("CRPocketBookQuickMenuWindow::OpenTouchMenu(): PartialUpdate(0, 0, %d);",
ScreenWidth(), ScreenHeight());
PartialUpdate(0, 0, ScreenWidth(), ScreenHeight());
}

virtual bool TouchMenuCanBeUsed() {
CRLog::trace("CRPocketBookQuickMenuWindow::TouchMenuCanBeUsed()");
return
pbSkinFileName == lString16("pb626fw5.cr3skin") &&
CRPocketBookScreen::instance->isTouchSupported() && /*touch device*/
max(ScreenWidth(), ScreenHeight()) > 800; /*resolution greater than 600x800*/
}

virtual void SelfClose() {
CRLog::trace("CRPocketBookQuickMenuWindow::SelfClose()");
isTouchMenuVisible = false;
_wm->closeWindow( this );
hideSystemPanel(false);
Expand Down Expand Up @@ -4955,8 +5008,9 @@ int main(int argc, char **argv)
forcePartialUpdates = false;
useDeveloperFeatures = access( PB_DEV_MARKER, F_OK ) != -1;
OpenScreen();
if (argc < 2) {
Message(ICON_WARNING, const_cast<char*>("CoolReader"), const_cast<char*>("@Cant_open_file"), 2000);
if (argc < 2 || strlen(argv[1]) == 0 ) {
Message(ICON_WARNING, const_cast<char*>("CoolReader"), const_cast<char*>("No book to open!"), 2000);
printf("No book to open!\n");
return 1;
}
if (!InitDoc(argv[0], argv[1])) {
Expand Down
4 changes: 2 additions & 2 deletions cr3gui/src/cr3pocketbook.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ enum CRPbCommands {

#define PB_CR3_CACHE_SIZE (0x100000 * 64)

#define CR_PB_VERSION "0.0.6-17-31"
#define CR_PB_BUILD_DATE "2015-07-31"
#define CR_PB_VERSION "0.0.6-17-32"
#define CR_PB_BUILD_DATE "2015-08-06"

#define PB_ROTATE_MODE_360 0
#define PB_ROTATE_MODE_180 1
Expand Down
10 changes: 10 additions & 0 deletions crengine/include/crconcurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#include "lvref.h"
#include "lvqueue.h"


enum {
CR_THREAD_PRIORITY_LOW,
CR_THREAD_PRIORITY_NORMAL,
CR_THREAD_PRIORITY_HIGH,
};

class CRConcurrencyProvider {
public:
virtual ~CRConcurrencyProvider() {}
Expand All @@ -18,6 +25,9 @@ class CRConcurrencyProvider {
virtual void executeGui(CRRunnable * task, int delayMillis) = 0;
/// sleep current thread
virtual void sleepMs(int durationMs) = 0;
virtual void setThreadPriority(int p) {
CR_UNUSED(p);
}
};

extern CRConcurrencyProvider * concurrencyProvider;
Expand Down
4 changes: 2 additions & 2 deletions crengine/include/hyphman.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class HyphMethod
};


#define WORD_LENGTH 64
#define MAX_REAL_WORD 24
#define WORD_LENGTH 2048
//#define MAX_REAL_WORD 24


enum HyphDictType
Expand Down
9 changes: 7 additions & 2 deletions crengine/include/lvautoptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
template <class T >
class LVAutoPtr {
T * p;
LVAutoPtr( const LVAutoPtr & v ) { } // no copy allowed
LVAutoPtr & operator = (const LVAutoPtr & v) { return *this; } // no copy
LVAutoPtr( const LVAutoPtr & v ) {
CR_UNUSED(v);
} // no copy allowed
LVAutoPtr & operator = (const LVAutoPtr & v) {
CR_UNUSED(v);
return *this;
} // no copy
public:
LVAutoPtr()
: p(NULL)
Expand Down
11 changes: 10 additions & 1 deletion crengine/include/lvdocview.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class LVDocView : public CacheLoadingCallback
lvRect m_pageMargins;
lvRect m_pageRects[2];
int m_pagesVisible;
int m_pagesVisibleOverride;
int m_pageHeaderInfo;
bool m_showCover;
LVRefVec<LVImageSource> m_headerIcons;
Expand Down Expand Up @@ -620,7 +621,9 @@ class LVDocView : public CacheLoadingCallback
/// set list of battery icons to display battery state
void setBatteryIcons( LVRefVec<LVImageSource> icons );
/// sets page margins
void setPageMargins( const lvRect & rc );
void setPageMargins(lvRect rc);
/// update page margins based on current settings
void updatePageMargins();
/// returns page margins
lvRect getPageMargins() const { return m_pageMargins; }
#if CR_INTERNAL_PAGE_ORIENTATION==1
Expand Down Expand Up @@ -665,10 +668,14 @@ class LVDocView : public CacheLoadingCallback
LVDocViewMode getViewMode();
/// toggle pages/scroll view mode
void toggleViewMode();
/// returns current pages visible setting value (independent on window and font size)
int getPagesVisibleSetting();
/// get window visible page count (1 or 2)
int getVisiblePageCount();
/// set window visible page count (1 or 2)
void setVisiblePageCount( int n );
/// set window visible page count, to use exact value independent of font size and window sides
void overrideVisiblePageCount(int n);

/// get page header info mask
int getPageHeaderInfo() { return m_pageHeaderInfo; }
Expand Down Expand Up @@ -804,6 +811,8 @@ class LVDocView : public CacheLoadingCallback
int scrollPosToDocPos( int scrollpos );
/// returns position in 1/100 of percents (0..10000)
int getPosPercent();
/// returns position in 1/100 of percents (0..10000)
int getPosEndPagePercent();

/// execute command
int doCommand( LVDocCmd cmd, int param=0 );
Expand Down
Loading

0 comments on commit 6044fc8

Please sign in to comment.