diff -Nru -x CVS --strip-trailing-cr bookr_orig/Makefile bookr/Makefile
--- bookr_orig/Makefile 2006-08-15 18:23:25.000000000 +0400
+++ bookr/Makefile 2007-08-20 13:24:34.637875000 +0400
@@ -7,7 +7,7 @@
OBJS+=bkfancytext.o bkplaintext.o bkpalmdoc.o palmdoc/palm.o
OBJS+=fzrefcount.o fzinstreammem.o fzinstreamstd.o fzimage.o fzimagepng.o fztexture.o fzfont.o fzscreenpsp.o fzscreencommon.o
OBJS+=tinystr.o tinyxmlerror.o tinyxml.o tinyxmlparser.o
-OBJS+=res_uifont.o res_txtfont.o res_uitex.o res_logo.o res_uitex2.o bkmemcpy.S
+OBJS+=res_uifont.o res_txtfont.o res_uitex.o res_logo.o res_uitex2.o
INCDIR =
CFLAGS = -Imupdf/include -G0 -Wall -O2 -I/usr/local/pspdev/psp/include/freetype2
@@ -16,7 +16,7 @@
LIBDIR =
LDFLAGS =
-LIBS=-Lmupdf/libs -lmupdf -lraster -lworld -lfonts -lstream -lbase -lpspgum -lpspgu -lpsppower -lpsprtc -lpng -lz -ljpeg -lm -lfreetype -lstdc++ -lsupc++
+LIBS=bkmemcpy.S -Lmupdf/libs -lmupdf -lraster -lworld -lfonts -lstream -lbase -lpspgum -lpspgu -lpsppower -lpsprtc -lpng -lz -ljpeg -lm -lfreetype -lstdc++ -lsupc++
EXTRA_TARGETS = EBOOT.PBP
diff -Nru -x CVS --strip-trailing-cr bookr_orig/Makefile.cygwin bookr/Makefile.cygwin
--- bookr_orig/Makefile.cygwin 2005-11-11 10:32:53.000000000 +0300
+++ bookr/Makefile.cygwin 2007-08-20 12:10:41.274125000 +0400
@@ -17,10 +17,10 @@
all: $(EXE)
-OBJS:=bkbook.o bkpdf.o bklayer.o bkmainmenu.o bkfilechooser.o bklogo.o bkuser.o bookr.o bkbookmark.o bkpopup.o bkcolorchooser.o
-OBJS+=fzrefcount.o fzinstreammem.o fzinstreamstd.o fzimage.o fzimagepng.o fztexture.o fzfont.o fzscreenglut.o fzscreencommon.o
+OBJS:=palm.o bkpdf.o bklayer.o bkmainmenu.o bkfilechooser.o bklogo.o bkuser.o bookr.o bkbookmark.o bkpopup.o bkcolorchooser.o
+OBJS+=bkplaintext.o bkfancytext.o bkdocument.o bkpalmdoc.o fzrefcount.o fzinstreammem.o fzinstreamstd.o fzimage.o fzimagepng.o fztexture.o fzfont.o fzscreenglut.o fzscreencommon.o
OBJS+=tinystr.o tinyxmlerror.o tinyxml.o tinyxmlparser.o
-OBJS+=res_uifont.o res_txtfont.o res_uitex.o res_logo.o
+OBJS+=res_uifont.o res_txtfont.o res_uitex.o res_logo.o res_uitex2.o
res_uifont.c: data/urwgothicb.pfb
bin2c $< temp res_uifont
@@ -37,6 +37,11 @@
sed s/static// temp > $@
rm -f temp
+res_uitex2.c: data/ui2.png
+ bin2c $< temp res_uitex2
+ sed s/static// temp > $@
+ rm -f temp
+
res_logo.c: data/logo.png
bin2c $< temp res_logo
sed s/static// temp > $@
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkbookmark.cpp bookr/bkbookmark.cpp
--- bookr_orig/bkbookmark.cpp 2006-04-09 15:50:53.000000000 +0400
+++ bookr/bkbookmark.cpp 2007-08-20 13:24:34.637875000 +0400
@@ -38,6 +38,7 @@
...
+
*/
@@ -112,6 +113,14 @@
return 0;
}
+static TiXmlElement* lastFileNode() {
+ if (doc == 0)
+ loadXML();
+ TiXmlElement* root = doc->RootElement();
+ TiXmlElement* file = root->FirstChildElement("lastfile");
+ return file;
+}
+
static TiXmlNode* loadOrAddFileNode(string& filename) {
if (doc == 0)
loadXML();
@@ -148,6 +157,29 @@
}
// find the last read bookmark for a given file
+string BKBookmarksManager::getLastFile() {
+ TiXmlElement* file = lastFileNode();
+ if (file == 0)
+ return string();
+ return file->Attribute("filename");
+}
+
+// save last use file
+void BKBookmarksManager::setLastFile(string& filename) {
+ TiXmlElement* file = lastFileNode();
+ if (file != 0)
+ {
+ file->SetAttribute("filename", filename.c_str());
+ } else {
+ TiXmlElement* root = doc->RootElement();
+ TiXmlElement efile("lastfile");
+ efile.SetAttribute("filename", filename.c_str());
+ root->InsertEndChild(efile);
+ }
+ saveXML();
+}
+
+// find the last read bookmark for a given file
bool BKBookmarksManager::getLastView(string& filename, BKBookmark& b) {
TiXmlNode* file = fileNode(filename);
if (file == 0)
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkbookmark.h bookr/bkbookmark.h
--- bookr_orig/bkbookmark.h 2006-01-29 01:14:19.000000000 +0300
+++ bookr/bkbookmark.h 2007-08-20 13:24:34.637875000 +0400
@@ -47,6 +47,11 @@
#define BOOKMARK_XML_BASE "%s/%s"
public:
+
+ // find the last file used
+ static string getLastFile();
+ static void setLastFile( string& filename );
+
// find the last read bookmark for a given file
static bool getLastView(string& filename, BKBookmark&);
// load all the bookmarks for a given file
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkcolorchooser.cpp bookr/bkcolorchooser.cpp
--- bookr_orig/bkcolorchooser.cpp 2005-10-05 19:34:21.000000000 +0400
+++ bookr/bkcolorchooser.cpp 2007-08-20 13:24:34.637875000 +0400
@@ -105,10 +105,10 @@
return BK_CMD_MARK_DIRTY;
}
}
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
return ret;
}
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
hueMode = !hueMode;
return BK_CMD_MARK_DIRTY;
}
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkdocument.cpp bookr/bkdocument.cpp
--- bookr_orig/bkdocument.cpp 2006-04-06 15:18:33.000000000 +0400
+++ bookr/bkdocument.cpp 2007-08-20 13:24:34.637875000 +0400
@@ -32,13 +32,16 @@
doc = BKPlainText::create(filePath);
}
if (doc != 0)
+ {
doc->buildToolbarMenus();
- if (doc->isBookmarkable()) {
- BKBookmark b;
- string fn;
- doc->getFileName(fn);
- if (BKBookmarksManager::getLastView(fn, b)) {
- doc->setBookmarkPosition(b.viewData);
+
+ if (doc->isBookmarkable()) {
+ BKBookmark b;
+ string fn;
+ doc->getFileName(fn);
+ if (BKBookmarksManager::getLastView(fn, b)) {
+ doc->setBookmarkPosition(b.viewData);
+ }
}
}
return doc;
@@ -63,6 +66,7 @@
b.lastView = true;
getBookmarkPosition(b.viewData);
BKBookmarksManager::addBookmark(fn, b);
+ BKBookmarksManager::setLastFile(fn);
}
}
@@ -434,7 +438,7 @@
}
}
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
// add bookmark
if (toolbarSelMenu == 0 && toolbarSelMenuItem == 0 && isBookmarkable()) {
string fn, t;
@@ -673,10 +677,10 @@
FZScreen::ambientColor(0xffcccccc);
int tw = textW((char*)it.circleLabel.c_str(), fontBig);
if (it.circleLabel.size() > 0) {
- drawImage(480 - tw - 65, 248, 20, 20, 31, 70);
+ drawImage(480 - tw - 65, 248, BK_IMG_CROSS_XSIZE, BK_IMG_CROSS_YSIZE, BK_IMG_CROSS_X, BK_IMG_CROSS_Y);
}
if (it.triangleLabel.size() > 0) {
- drawImage(37, 248, 20, 18, 9, 53);
+ drawImage(37, 248, 20, 18, BK_IMG_TRIANGLE_X, BK_IMG_TRIANGLE_Y);
}
// icon bar
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkdocument.h bookr/bkdocument.h
--- bookr_orig/bkdocument.h 2006-04-06 15:18:33.000000000 +0400
+++ bookr/bkdocument.h 2007-08-20 13:24:34.653500000 +0400
@@ -69,7 +69,8 @@
protected:
BKDocument();
virtual void saveLastView();
- ~BKDocument();
+ public:
+ virtual ~BKDocument();
public:
// BKLayer::update is implemented outside the document viewers.
@@ -138,7 +139,7 @@
// Rotation (0 = 0deg, 1 = 90deg, 2 = 180deg, 3 = 240deg)
virtual bool isRotable() = 0;
virtual int getRotation() = 0;
- virtual int setRotation(int) = 0;
+ virtual int setRotation(int, bool bForce=false) = 0;
// Bookmark support. The returned map is a black box
// for the bookmarking system.
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkfancytext.cpp bookr/bkfancytext.cpp
--- bookr_orig/bkfancytext.cpp 2006-08-15 18:24:03.000000000 +0400
+++ bookr/bkfancytext.cpp 2007-08-21 21:29:42.618125000 +0400
@@ -23,6 +23,9 @@
BKFancyText::BKFancyText() : lines(0), nLines(0), topLine(0), maxY(0), font(0), rotation(0), runs(0), nRuns(0), holdScroll(false) {
lastFontSize = BKUser::options.txtSize;
+ lastFontFace = BKUser::options.txtFont;
+ lastHeightPct = BKUser::options.txtHeightPct;
+ lastWrapCR = BKUser::options.txtWrapCR;
}
BKFancyText::~BKFancyText() {
if (runs)
@@ -153,7 +156,7 @@
void BKFancyText::resizeView(int width, int height) {
reflow(width - 10 - 10);
- linesPerPage = (height - 10) / font->getLineHeight();
+ linesPerPage = (height - 10) / (font->getLineHeight()*(BKUser::options.txtHeightPct/100.0));
maxY = height - 10;
totalPages = (nLines / linesPerPage) + 1;
}
@@ -343,13 +346,41 @@
list tempRuns;
int li = 0;
BKRun run;
+ int lastbreak = 0;
for (int i = 0; i < length; ++i) {
if (b[i] == 10) {
- run.text = &b[li];
- run.n = i - li;
- li = i;
- run.lineBreak = true;
- tempRuns.push_back(run);
+ bool bBreak = true;
+ if( BKUser::options.txtWrapCR > 0 )
+ {
+// if( i-lastbreak < 100 )
+// {
+// b[i] = 'X';
+// bBreak = false;
+// } else
+// lastbreak = i;
+ bBreak = true;
+ for( int j = 1 ; j <= BKUser::options.txtWrapCR+1 ; j++ )
+ {
+ if( i+j >= length || b[i+j] != 10 )
+ bBreak = false;
+ }
+ if( !bBreak )
+ {
+ for( int j = 1 ; j <= BKUser::options.txtWrapCR+1 ; j++ )
+ {
+ if( i+j < length && b[i+j] == 10 )
+ b[i+j] = 32;
+ }
+ }
+ }
+ if( bBreak )
+ {
+ run.text = &b[li];
+ run.n = i - li;
+ li = i;
+ run.lineBreak = true;
+ tempRuns.push_back(run);
+ }
}
}
// last run
@@ -369,7 +400,7 @@
++i;
++it;
}
-
+ //printf("t: %s\n", b);
return b;
}
@@ -395,7 +426,10 @@
}
int BKFancyText::updateContent() {
- if (lastFontSize != BKUser::options.txtSize)
+ if (lastFontSize != BKUser::options.txtSize
+ || lastFontFace != BKUser::options.txtFont
+ || lastHeightPct != BKUser::options.txtHeightPct // should be able to just resize view here
+ || lastWrapCR != BKUser::options.txtWrapCR )
return BK_CMD_RELOAD;
return 0;
}
@@ -428,6 +462,7 @@
do {
int pn = n < run->n ? n : run->n;
if (pn > 0) {
+ //printf("to: %s\n", &run->text[offset]);
x = drawText(&run->text[offset], font, x, y, pn, false, BKUser::options.txtJustify, lines[i].spaceWidth, true);
}
n -= pn;
@@ -435,7 +470,7 @@
++run;
} while (n > 0);
//y += lines[i].vSpace;
- y += font->getLineHeight();
+ y += font->getLineHeight()*(BKUser::options.txtHeightPct/100.0);
//if (y > maxY)
// break;
}
@@ -534,8 +569,8 @@
return rotation;
}
-int BKFancyText::setRotation(int r) {
- if (r == rotation)
+int BKFancyText::setRotation(int r, bool bForce) {
+ if (r == rotation && !bForce)
return 0;
rotation = r;
int run = runForLine(topLine);
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkfancytext.h bookr/bkfancytext.h
--- bookr_orig/bkfancytext.h 2006-08-15 18:24:03.000000000 +0400
+++ bookr/bkfancytext.h 2007-08-20 13:24:34.653500000 +0400
@@ -69,6 +69,9 @@
FZFont* font;
int rotation;
int lastFontSize;
+ string lastFontFace;
+ int lastHeightPct;
+ int lastWrapCR;
int linesPerPage;
int totalPages;
@@ -127,7 +130,7 @@
virtual bool isRotable();
virtual int getRotation();
- virtual int setRotation(int);
+ virtual int setRotation(int, bool bForce=false);
virtual bool isBookmarkable();
virtual void getBookmarkPosition(map&);
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkfilechooser.cpp bookr/bkfilechooser.cpp
--- bookr_orig/bkfilechooser.cpp 2006-04-09 19:52:13.000000000 +0400
+++ bookr/bkfilechooser.cpp 2007-08-20 13:24:34.653500000 +0400
@@ -24,7 +24,10 @@
#include "bkuser.h"
BKFileChooser::BKFileChooser(string& t, int r) : title(t), ret(r) {
- path = BKUser::options.lastFolder;
+ if( r == BK_CMD_SET_FONT )
+ path = BKUser::options.lastFontFolder;
+ else
+ path = BKUser::options.lastFolder;
updateDirFiles();
}
@@ -49,13 +52,16 @@
}
if (dirFiles.size() == 0)
dirFiles.push_back(FZDirent("", 0, 0));
- BKUser::options.lastFolder = path;
+ if( ret == BK_CMD_SET_FONT )
+ BKUser::options.lastFontFolder = path;
+ else
+ BKUser::options.lastFolder = path;
}
int BKFileChooser::update(unsigned int buttons) {
menuCursorUpdate(buttons, (int)dirFiles.size());
int* b = FZScreen::ctrlReps();
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
//printf("selected %s\n", dirFiles[selItem].name.c_str());
if (dirFiles[selItem].stat & FZ_STAT_IFDIR ) {
path += "/" + dirFiles[selItem].name;
@@ -83,7 +89,7 @@
topItem = 0;
updateDirFiles();
}
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
return BK_CMD_CLOSE_TOP_LAYER;
}
if (b[FZ_REPS_START] == 1) {
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bklayer.cpp bookr/bklayer.cpp
--- bookr_orig/bklayer.cpp 2006-08-10 21:52:11.000000000 +0400
+++ bookr/bklayer.cpp 2007-08-21 21:20:40.727500000 +0400
@@ -245,9 +245,10 @@
float fx = 0.0f;
for (unsigned char *p = (unsigned char*)t; i < n; i++, p++) {
int idx = *p;
+ //if(idx == 151) idx = 45;
// new line
if (idx == 10 && useLF) {
- baseY += font->getLineHeight();
+ baseY += font->getLineHeight()*(BKUser::options.txtHeightPct/100.0);
baseX = x;
fx = 0.0f;
}
@@ -336,18 +337,18 @@
drawTPill(25, 272 - 30 + scrY, 480 - 46 - 11, 30, 6, 31, 1);
// icons
FZScreen::ambientColor(0xff000000);
- //drawImage(430, 30 + scrY, 20, 18, 9, 53); tri!
- drawImage(430, 29 + scrY, 20, 17, 31, 53); // close handle
+ //drawImage(430, 30 + scrY, BK_IMG_TRIANGLE_XSIZE, BK_IMG_TRIANGLE_YSIZE, BK_IMG_TRIANGLE_X, BK_IMG_TRIANGLE_Y); tri!
+ drawImage(430, 29 + scrY, BK_IMG_CIRCLE_XSIZE, BK_IMG_CIRCLE_YSIZE, BK_IMG_CIRCLE_X, BK_IMG_CIRCLE_Y); // close handle
FZScreen::ambientColor(0xffcccccc);
// circle or other context icon
if (flags & BK_MENU_ITEM_USE_LR_ICON) {
- drawImage(480 - tw - 65, 248 + scrY, 20, 17, 7, 92);
+ drawImage(480 - tw - 65, 248 + scrY, BK_IMG_LRARROWS_XSIZE, BK_IMG_LRARROWS_YSIZE, BK_IMG_LRARROWS_X, BK_IMG_LRARROWS_Y);
} else {
- drawImage(480 - tw - 65, 248 + scrY, 20, 20, 31, 70);
+ drawImage(480 - tw - 65, 248 + scrY, BK_IMG_CROSS_XSIZE, BK_IMG_CROSS_YSIZE, BK_IMG_CROSS_X, BK_IMG_CROSS_Y);
}
if (triangleLabel.size() > 0 || flags & BK_MENU_ITEM_OPTIONAL_TRIANGLE_LABEL) {
//drawImage(37, 248 + scrY, 20, 20, 107, 5);
- drawImage(37, 248 + scrY, 20, 18, 9, 53);
+ drawImage(37, 248 + scrY, BK_IMG_TRIANGLE_XSIZE, BK_IMG_TRIANGLE_YSIZE, BK_IMG_TRIANGLE_X, BK_IMG_TRIANGLE_Y);
}
fontBig->bindForDisplay();
@@ -406,7 +407,7 @@
if (items[selItem].flags & BK_MENU_ITEM_FOLDER) {
FZScreen::ambientColor(0xff000000);
//drawImage(40, 60 + scrY + selPos*fontBig->getLineHeight(), 20, 20, 84, 52);
- drawImage(40, 60 + scrY + selPos*fontBig->getLineHeight(), 20, 20, 58, 81);
+ drawImage(40, 60 + scrY + selPos*fontBig->getLineHeight(), BK_IMG_FOLDER_XSIZE, BK_IMG_FOLDER_YSIZE, BK_IMG_FOLDER_X, BK_IMG_FOLDER_Y);
}
// scrollbar
@@ -476,7 +477,7 @@
drawPill(45, 5 + y, 480 - 86 - 10, 20, 6, 31, 1);
// icons
FZScreen::ambientColor(bg1|0xff000000);
- drawImage(410, 9 + y, 20, 17, 31, 53);
+ drawImage(410, 9 + y, BK_IMG_CIRCLE_XSIZE, BK_IMG_CIRCLE_YSIZE, BK_IMG_CIRCLE_X, BK_IMG_CIRCLE_Y);
fontBig->bindForDisplay();
@@ -488,9 +489,9 @@
void BKLayer::drawClockAndBattery(string& extra) {
texUI->bindForDisplay();
FZScreen::ambientColor(0xffbbbbbb);
- drawImage(350, 226, 16, 16, 100, 20);
- drawImage(405, 222, 16, 16, 100, 0);
- drawImage(292, 224, 16, 16, 76, 18);
+ drawImage(350, 226, BK_IMG_BATTERY_XSIZE, BK_IMG_BATTERY_YSIZE, BK_IMG_BATTERY_X, BK_IMG_BATTERY_Y);
+ drawImage(405, 222, BK_IMG_CLOCK_XSIZE, BK_IMG_CLOCK_YSIZE, BK_IMG_CLOCK_X, BK_IMG_CLOCK_Y);
+ drawImage(292, 224, BK_IMG_MEMORY_XSIZE, BK_IMG_MEMORY_YSIZE, BK_IMG_MEMORY_X, BK_IMG_MEMORY_Y);
fontSmall->bindForDisplay();
FZScreen::ambientColor(0xffbbbbbb);
int ew = textW((char*)extra.c_str(), fontSmall);
@@ -499,15 +500,20 @@
FZScreen::getTime(h, m);
int b = FZScreen::getBattery();
int mem = FZScreen::getUsedMemory();
+ int speed = 0;
+ speed = FZScreen::getSpeed();
char t1[20];
snprintf(t1, 20, "%02d:%02d", h, m);
char t2[20];
snprintf(t2, 20, "%d%%", b);
char t3[20];
snprintf(t3, 20, "%.1fM", ((float)(mem)) / (1024.0f*1024.0f));
+ char t4[20];
+ snprintf(t4, 20, "%dMHz", speed);
drawText(t1, fontSmall, 425, 224);
drawText(t2, fontSmall, 370, 224);
drawText(t3, fontSmall, 310, 224);
+ drawText(t4, fontSmall, 240, 224);
}
void BKLayer::menuCursorUpdate(unsigned int buttons, int max) {
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bklayer.h bookr/bklayer.h
--- bookr_orig/bklayer.h 2006-04-09 15:50:35.000000000 +0400
+++ bookr/bklayer.h 2007-08-20 13:24:34.669125000 +0400
@@ -30,6 +30,7 @@
#define BK_CMD_CLOSE_TOP_LAYER 1
#define BK_CMD_MARK_DIRTY 2
+#define BK_CMD_MARK_VERY_DIRTY 7
#define BK_CMD_EXIT 3
#define BK_CMD_RELOAD 4
#define BK_CMD_MAINMENU_POPUP 5
@@ -48,6 +49,39 @@
#define BK_CMD_INVOKE_COLOR_CHOOSER_TXTBG 104
#define BK_CMD_INVOKE_COLOR_CHOOSER_PDFBG 105
+#define BK_IMG_TRIANGLE_X 9
+#define BK_IMG_TRIANGLE_Y 53
+#define BK_IMG_CIRCLE_X 31
+#define BK_IMG_CIRCLE_Y 70
+#define BK_IMG_CROSS_X 31
+#define BK_IMG_CROSS_Y 53
+#define BK_IMG_LRARROWS_X 7
+#define BK_IMG_LRARROWS_Y 92
+#define BK_IMG_CLOCK_X 100
+#define BK_IMG_CLOCK_Y 0
+#define BK_IMG_BATTERY_X 100
+#define BK_IMG_BATTERY_Y 20
+#define BK_IMG_MEMORY_X 76
+#define BK_IMG_MEMORY_Y 18
+#define BK_IMG_FOLDER_X 58
+#define BK_IMG_FOLDER_Y 81
+
+#define BK_IMG_TRIANGLE_XSIZE 20
+#define BK_IMG_TRIANGLE_YSIZE 18
+#define BK_IMG_CIRCLE_XSIZE 20
+#define BK_IMG_CIRCLE_YSIZE 20
+#define BK_IMG_CROSS_XSIZE 20
+#define BK_IMG_CROSS_YSIZE 17
+#define BK_IMG_LRARROWS_XSIZE 20
+#define BK_IMG_LRARROWS_YSIZE 17
+#define BK_IMG_CLOCK_XSIZE 16
+#define BK_IMG_CLOCK_YSIZE 16
+#define BK_IMG_BATTERY_XSIZE 16
+#define BK_IMG_BATTERY_YSIZE 16
+#define BK_IMG_MEMORY_XSIZE 16
+#define BK_IMG_MEMORY_YSIZE 16
+#define BK_IMG_FOLDER_XSIZE 20
+#define BK_IMG_FOLDER_YSIZE 20
class BKLayer : public FZRefCounted {
protected:
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bklogo.cpp bookr/bklogo.cpp
--- bookr_orig/bklogo.cpp 2006-08-15 17:20:27.000000000 +0400
+++ bookr/bklogo.cpp 2007-08-20 13:24:34.669125000 +0400
@@ -59,7 +59,7 @@
drawPill(150, 240, 180, 20, 6, 31, 1);
fontBig->bindForDisplay();
FZScreen::ambientColor(0xff000000);
- drawTextHC("Version 0.7.1", fontBig, 180);
+ drawTextHC("Version 0.7.1 PSM", fontBig, 180);
FZScreen::ambientColor(0xffffffff);
if (loading)
drawTextHC("Loading...", fontBig, 244);
@@ -75,6 +75,8 @@
FZScreen::ambientColor(0xffffffff);
drawTextHC("Press Start", fontBig, 244);
}
+ string e;
+ drawClockAndBattery(e);
}
BKLogo* BKLogo::create() {
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkmainmenu.cpp bookr/bkmainmenu.cpp
--- bookr_orig/bkmainmenu.cpp 2006-08-15 18:22:40.000000000 +0400
+++ bookr/bkmainmenu.cpp 2007-08-20 13:24:34.669125000 +0400
@@ -131,6 +131,10 @@
t = txt;
optionItems.push_back(BKMenuItem(t, "Change", BK_MENU_ITEM_USE_LR_ICON));
+ snprintf(txt, 1024, "Plain text - Line Height: %d Pct", BKUser::options.txtHeightPct);
+ t = txt;
+ optionItems.push_back(BKMenuItem(t, "Change", BK_MENU_ITEM_USE_LR_ICON));
+
t = "Plain text - Justify text: ";
t += BKUser::options.txtJustify ? "Enabled" : "Disabled";
optionItems.push_back(BKMenuItem(t, "Toggle", 0));
@@ -148,6 +152,9 @@
snprintf(txt, 1024, "CPU/Bus speed: %s", FZScreen::speedLabels[BKUser::options.pspSpeed]);
t = txt;
optionItems.push_back(BKMenuItem(t, "Change", BK_MENU_ITEM_USE_LR_ICON));
+ snprintf(txt, 1024, "Menu speed: %s", FZScreen::speedLabels[BKUser::options.pspMenuSpeed]);
+ t = txt;
+ optionItems.push_back(BKMenuItem(t, "Change", BK_MENU_ITEM_USE_LR_ICON));
t = "Display page loading and numbering labels: ";
t += BKUser::options.displayLabels ? "Enabled" : "Disabled";
@@ -164,6 +171,14 @@
optionItems.push_back(BKMenuItem("Clear bookmarks", "Select", 0));
+ t = "Autoload last file: ";
+ t += BKUser::options.loadLastFile ? "Enabled" : "Disabled";
+ optionItems.push_back(BKMenuItem(t, "Toggle", 0));
+
+ snprintf(txt, 1024, "Plain text - Wrap CRs: %d", BKUser::options.txtWrapCR);
+ t = txt;
+ optionItems.push_back(BKMenuItem(t, "Change", BK_MENU_ITEM_USE_LR_ICON));
+
/*char txt[1024];
snprintf(txt, 1024, "Plain text - Rotation: %d\260", BKUser::options.txtRotation);
t = txt;
@@ -184,7 +199,7 @@
int* b = FZScreen::ctrlReps();
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
if (selItem == 0) {
return BK_CMD_INVOKE_OPEN_FILE;
}
@@ -201,7 +216,7 @@
return BK_CMD_MARK_DIRTY;
}
if (selItem == 3) {
- popupText = "Bookr - a document viewer for the Sony PSP.\nProgramming by Carlos and Edward.\nVisit http://bookr.sf.net for new versions.\nThis program is licensed under the terms of the GPL v2.\nUses the MuPDF library under the terms of the AFPL.";
+ popupText = "Bookr - a document viewer for the Sony PSP.\nProgramming by Carlos and Edward.\nVisit http://bookr.sf.net for new versions.\nUnofficial build by Paul Murray.\nThis program is licensed under the terms of the GPL v2.\nUses the MuPDF library under the terms of the AFPL.";
popupMode = BKPOPUP_INFO;
return BK_CMD_MAINMENU_POPUP;
}
@@ -221,7 +236,7 @@
}
}
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
return BK_CMD_CLOSE_TOP_LAYER;
}
@@ -271,7 +286,7 @@
int* b = FZScreen::ctrlReps();
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
if (selItem == 0) {
BKUser::setDefaultControls();
BKUser::save();
@@ -283,7 +298,7 @@
return BK_CMD_MARK_DIRTY;
}
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
selItem = 0;
topItem = 0;
mode = BKMM_MAIN;
@@ -302,7 +317,7 @@
int* b = FZScreen::ctrlReps();
- if (b[FZ_REPS_CIRCLE] == 1) {
+ if (b[FZ_REPS_CROSS] == 1) {
if (selItem == 0) {
BKUser::setDefaultOptions();
buildOptionMenu();
@@ -318,36 +333,41 @@
if (selItem == 2) {
return BK_CMD_INVOKE_OPEN_FONT;
}
- if (selItem == 4) {
+ if (selItem == 4+1) {
BKUser::options.txtJustify = !BKUser::options.txtJustify;
buildOptionMenu();
return BK_CMD_MARK_DIRTY;
}
- if (selItem == 5) {
+ if (selItem == 5+1) {
return BK_CMD_INVOKE_COLOR_CHOOSER_TXTFG;
}
- if (selItem == 6) {
+ if (selItem == 6+1) {
return BK_CMD_INVOKE_COLOR_CHOOSER_TXTBG;
}
- if (selItem == 8) {
+ if (selItem == 8+2) {
BKUser::options.displayLabels = !BKUser::options.displayLabels;
buildOptionMenu();
return BK_CMD_MARK_DIRTY;
}
- if (selItem == 9) {
+ if (selItem == 9+2) {
BKUser::options.pdfInvertColors = !BKUser::options.pdfInvertColors;
buildOptionMenu();
return BK_CMD_MARK_DIRTY;
}
- if (selItem == 10) {
+ if (selItem == 10+2) {
return BK_CMD_INVOKE_COLOR_CHOOSER_PDFBG;
}
- if (selItem == 11) {
+ if (selItem == 11+2) {
BKBookmarksManager::clear();
popupText = "Bookmarks cleared.";
popupMode = BKPOPUP_INFO;
return BK_CMD_MAINMENU_POPUP;
}
+ if (selItem == 12+2) {
+ BKUser::options.loadLastFile = !BKUser::options.loadLastFile;
+ buildOptionMenu();
+ return BK_CMD_MARK_DIRTY; //?
+ }
/*if (selItem == 2) {
if (BKUser::options.txtRotation == 0) {
BKUser::options.txtRotation = 90;
@@ -372,7 +392,7 @@
}
}
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
selItem = 0;
topItem = 0;
mode = BKMM_MAIN;
@@ -397,7 +417,15 @@
buildOptionMenu();
}
return BK_CMD_MARK_DIRTY;
- } else if (selItem == 7) {
+ } else if (selItem == 4) {
+ BKUser::options.txtHeightPct -= 5;
+ if (BKUser::options.txtHeightPct < 50) {
+ BKUser::options.txtHeightPct = 50;
+ } else {
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 7+1) {
--BKUser::options.pspSpeed;
if (BKUser::options.pspSpeed < 0) {
BKUser::options.pspSpeed = 0;
@@ -409,6 +437,26 @@
buildOptionMenu();
}
return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 8+1) {
+ --BKUser::options.pspMenuSpeed;
+ if (BKUser::options.pspMenuSpeed < 0) {
+ BKUser::options.pspMenuSpeed = 0;
+ } else {
+// if (BKUser::options.pspMenuSpeed == 0)
+// FZScreen::setSpeed(5);
+// else
+// FZScreen::setSpeed(BKUser::options.pspMenuSpeed);
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 13+2) {
+ --BKUser::options.txtWrapCR;
+ if (BKUser::options.txtWrapCR < 0) {
+ BKUser::options.txtWrapCR = 0;
+ } else {
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
}
}
@@ -421,7 +469,15 @@
buildOptionMenu();
}
return BK_CMD_MARK_DIRTY;
- } else if (selItem == 7) {
+ } else if (selItem == 4) {
+ BKUser::options.txtHeightPct += 5;
+ if (BKUser::options.txtHeightPct > 150) {
+ BKUser::options.txtHeightPct = 150;
+ } else {
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 7+1) {
++BKUser::options.pspSpeed;
if (BKUser::options.pspSpeed > 6) {
BKUser::options.pspSpeed = 6;
@@ -433,6 +489,26 @@
buildOptionMenu();
}
return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 8+1) {
+ ++BKUser::options.pspMenuSpeed;
+ if (BKUser::options.pspMenuSpeed > 6) {
+ BKUser::options.pspMenuSpeed = 6;
+ } else {
+// if (BKUser::options.pspMenuSpeed == 0)
+// FZScreen::setSpeed(5);
+// else
+// FZScreen::setSpeed(BKUser::options.pspMenuSpeed);
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
+ } else if (selItem == 13+2) {
+ ++BKUser::options.txtWrapCR;
+ if (BKUser::options.txtWrapCR > 3) {
+ BKUser::options.txtWrapCR = 3;
+ } else {
+ buildOptionMenu();
+ }
+ return BK_CMD_MARK_DIRTY;
}
}
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkpalmdoc.cpp bookr/bkpalmdoc.cpp
--- bookr_orig/bkpalmdoc.cpp 2006-04-06 15:18:33.000000000 +0400
+++ bookr/bkpalmdoc.cpp 2007-08-20 13:24:45.919125000 +0400
@@ -36,13 +36,16 @@
r->fileName = file;
int length = 0;
int isMobi = 0;
+ char ctitle[dmDBNameLength];
// convert file to plain text
- char* b = palmdoc_decode(file.c_str(), &length, &isMobi);
+ char* b = palmdoc_decode(file.c_str(), &length, &isMobi, ctitle);
if (b == NULL) {
return 0;
}
+ r->title = ctitle;
+
if (isMobi) {
r->buffer = BKFancyText::parseHTML(r, b, length);
} else {
@@ -59,7 +62,7 @@
}
void BKPalmDoc::getTitle(string& t) {
- t = "FIX PALMDOC TITLES";
+ t = title;
}
void BKPalmDoc::getType(string& t) {
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkpalmdoc.h bookr/bkpalmdoc.h
--- bookr_orig/bkpalmdoc.h 2006-02-02 04:51:17.000000000 +0300
+++ bookr/bkpalmdoc.h 2007-08-20 13:24:45.919125000 +0400
@@ -29,6 +29,7 @@
class BKPalmDoc : public BKFancyText {
private:
string fileName;
+ string title;
char* buffer;
protected:
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkpdf.cpp bookr/bkpdf.cpp
--- bookr_orig/bkpdf.cpp 2006-08-15 17:33:21.000000000 +0400
+++ bookr/bkpdf.cpp 2007-08-20 13:24:45.919125000 +0400
@@ -890,7 +890,7 @@
return ctx->rotateLevel;
}
-int BKPDF::setRotation(int z) {
+int BKPDF::setRotation(int z, bool bForce) {
if (z == ctx->rotateLevel)
return 0;
int n = 4;
@@ -1263,6 +1263,8 @@
char header[4];
memset((void*)header, 0, 4);
FILE* f = fopen(file.c_str(), "r");
+ if( !f )
+ return false;
fread(header, 4, 1, f);
fclose(f);
return header[0] == 0x25 && header[1] == 0x50 && header[2] == 0x44 && header[3] == 0x46;
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkpdf.h bookr/bkpdf.h
--- bookr_orig/bkpdf.h 2006-08-15 17:33:21.000000000 +0400
+++ bookr/bkpdf.h 2007-08-20 13:24:45.919125000 +0400
@@ -81,7 +81,7 @@
virtual bool isRotable();
virtual int getRotation();
- virtual int setRotation(int);
+ virtual int setRotation(int, bool bForce=false);
virtual bool isBookmarkable();
virtual void getBookmarkPosition(map&);
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkplaintext.cpp bookr/bkplaintext.cpp
--- bookr_orig/bkplaintext.cpp 2006-04-06 15:18:33.000000000 +0400
+++ bookr/bkplaintext.cpp 2007-08-21 21:51:18.336875000 +0400
@@ -45,10 +45,19 @@
fseek(f, 0, SEEK_SET);
if (length > 4*1024*1024)
length = 4*1024*1024;
- char* b = (char*)malloc(length);
+ char* b = (char*)malloc(length+4);
fread(b, length, 1, f);
fclose(f);
+ // hack by CrazyCoder to fix skipping last line in the text file
+ // just pretend there are \n\n in the end
+ b[length] = 13;
+ b[length+1] = 10;
+ b[length+2] = 13;
+ b[length+3] = 10;
+
+ length += 4;
+
bool isHTML = false;
// FIX: make the heuristic a bit more advanced than that...
const char* fc = file.c_str();
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkpopup.cpp bookr/bkpopup.cpp
--- bookr_orig/bkpopup.cpp 2005-10-01 18:01:41.000000000 +0400
+++ bookr/bkpopup.cpp 2007-08-20 13:24:45.919125000 +0400
@@ -31,7 +31,7 @@
int BKPopup::update(unsigned int buttons) {
int* b = FZScreen::ctrlReps();
- if (b[FZ_REPS_CROSS] == 1) {
+ if (b[FZ_REPS_CIRCLE] == 1) {
return BK_CMD_CLOSE_TOP_LAYER;
}
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkuser.cpp bookr/bkuser.cpp
--- bookr_orig/bkuser.cpp 2006-04-09 19:52:13.000000000 +0400
+++ bookr/bkuser.cpp 2007-08-20 13:24:45.919125000 +0400
@@ -51,14 +51,19 @@
options.txtRotation = 0;
options.txtFont = "bookr:builtin";
options.txtSize = 11;
+ options.txtHeightPct = 100;
options.txtFGColor = 0;
options.txtBGColor = 0xffffff;
options.txtJustify = true;
options.pspSpeed = 0;
+ options.pspMenuSpeed = 0;
options.displayLabels = true;
options.pdfInvertColors = false;
options.pdfBGColor = 0x505050;
options.lastFolder = FZScreen::basePath();
+ options.lastFontFolder = FZScreen::basePath();
+ options.loadLastFile = false;
+ options.txtWrapCR = 0;
}
void BKUser::save() {
@@ -93,14 +98,19 @@
fprintf(f, "\t\t\n", options.txtRotation);
fprintf(f, "\t\t\n", options.txtFont.c_str());
fprintf(f, "\t\t\n", options.txtSize);
+ fprintf(f, "\t\t\n", options.txtHeightPct);
fprintf(f, "\t\t\n", options.txtFGColor);
fprintf(f, "\t\t\n", options.txtBGColor);
fprintf(f, "\t\t\n", options.txtJustify ? 1 : 0);
fprintf(f, "\t\t\n", options.pspSpeed);
+ fprintf(f, "\t\t\n", options.pspMenuSpeed);
fprintf(f, "\t\t\n", options.displayLabels ? 1 : 0);
fprintf(f, "\t\t\n", options.pdfInvertColors ? 1 : 0);
fprintf(f, "\t\t\n", options.pdfBGColor);
fprintf(f, "\t\t\n", options.lastFolder.c_str());
+ fprintf(f, "\t\t\n", options.lastFontFolder.c_str());
+ fprintf(f, "\t\t\n", options.loadLastFile ? 1 : 0);
+ fprintf(f, "\t\t\n", options.txtWrapCR);
fprintf(f, "\t\n");
fprintf(f, "\n");
@@ -166,14 +176,19 @@
else if (strncmp(option, "txtRotation", 128) == 0) options.txtRotation = atoi(value);
else if (strncmp(option, "txtFont", 128) == 0) options.txtFont = value;
else if (strncmp(option, "txtSize", 128) == 0) options.txtSize = atoi(value);
+ else if (strncmp(option, "txtHeightPct", 128) == 0) options.txtHeightPct = atoi(value);
else if (strncmp(option, "txtFGColor", 128) == 0) options.txtFGColor = atoi(value);
else if (strncmp(option, "txtBGColor", 128) == 0) options.txtBGColor = atoi(value);
else if (strncmp(option, "txtJustify", 128) == 0) options.txtJustify = atoi(value) != 0;
else if (strncmp(option, "pspSpeed", 128) == 0) options.pspSpeed = atoi(value);
+ else if (strncmp(option, "pspMenuSpeed", 128) == 0) options.pspMenuSpeed = atoi(value);
else if (strncmp(option, "displayLabels", 128) == 0) options.displayLabels = atoi(value) != 0;
else if (strncmp(option, "pdfInvertColors", 128) == 0) options.pdfInvertColors = atoi(value) != 0;
else if (strncmp(option, "pdfBGColor", 128) == 0) options.pdfBGColor = atoi(value);
else if (strncmp(option, "lastFolder", 128) == 0) options.lastFolder = value;
+ else if (strncmp(option, "lastFontFolder", 128) == 0) options.lastFontFolder = value;
+ else if (strncmp(option, "loadLastFile", 128) == 0) options.loadLastFile = atoi(value) != 0;
+ else if (strncmp(option, "txtWrapCR", 128) == 0) options.txtWrapCR = atoi(value);
eset = eset->NextSiblingElement("set");
}
@@ -190,10 +205,14 @@
options.txtRotation = 0;
operror = true;
}
- if (options.txtSize < 6 && options.txtSize > 20) {
+ if (options.txtSize < 6 || options.txtSize > 20) {
options.txtSize = 11;
operror = true;
}
+ if (options.txtHeightPct < 50 || options.txtHeightPct > 150) {
+ options.txtHeightPct = 100;
+ operror = true;
+ }
if ((options.txtFGColor & 0xff000000) != 0) {
options.txtFGColor &= 0xffffff;
operror = true;
@@ -210,6 +229,10 @@
options.pspSpeed = 0;
operror = true;
}
+ if (options.pspMenuSpeed < 0 || options.pspMenuSpeed > 6) {
+ options.pspMenuSpeed = 0;
+ operror = true;
+ }
if (operror)
BKUser::save();
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bkuser.h bookr/bkuser.h
--- bookr_orig/bkuser.h 2006-04-09 19:52:13.000000000 +0400
+++ bookr/bkuser.h 2007-08-20 13:24:45.934750000 +0400
@@ -60,10 +60,15 @@
int txtBGColor;
bool txtJustify;
int pspSpeed;
+ int pspMenuSpeed;
bool displayLabels;
bool pdfInvertColors;
int pdfBGColor;
string lastFolder;
+ string lastFontFolder;
+ int txtHeightPct;
+ bool loadLastFile;
+ int txtWrapCR;
};
static Options options;
};
diff -Nru -x CVS --strip-trailing-cr bookr_orig/bookr.cpp bookr/bookr.cpp
--- bookr_orig/bookr.cpp 2006-08-10 01:33:56.000000000 +0400
+++ bookr/bookr.cpp 2007-08-20 13:24:45.934750000 +0400
@@ -44,13 +44,15 @@
return header[0] == 0x0 && header[1] == 0x1 && header[2] == 0x0 && header[3] == 0x0;
}
+BKDocument* documentLayer = 0;
+
+
int main(int argc, char* argv[]) {
- BKDocument* documentLayer = 0;
FZScreen::setupCallbacks();
FZScreen::open(argc, argv);
FZScreen::setupCtrl();
BKUser::init();
- FZScreen::setSpeed(BKUser::options.pspSpeed);
+ FZScreen::setSpeed(BKUser::options.pspMenuSpeed);
FZ_DEBUG_SCREEN_INIT
BKLayer::load();
@@ -63,10 +65,64 @@
FZScreen::dcacheWritebackAll();
+
+ if( BKUser::options.loadLastFile )
+ {
+ string s = BKBookmarksManager::getLastFile();
+ if( s.substr(0,5) == "ms0:/" )
+ {
+ // clear layers
+ bkLayersIt it(layers.begin());
+ bkLayersIt end(layers.end());
+ while (it != end) {
+ (*it)->release();
+ ++it;
+ }
+ layers.clear();
+ // little hack to display a loading screen
+ BKLogo* l = BKLogo::create();
+ l->setLoading(true);
+ FZScreen::startDirectList();
+ l->render();
+ FZScreen::endAndDisplayList();
+ FZScreen::waitVblankStart();
+ FZScreen::swapBuffers();
+ FZScreen::checkEvents();
+ l->release();
+ // detect file type and add a new display layer
+ documentLayer = BKDocument::create(s);
+ if (documentLayer == 0) {
+ // error, back to logo screen
+ BKLogo* l = BKLogo::create();
+ l->setError(true);
+ layers.push_back(l);
+ FZScreen::swapBuffers();
+ } else {
+ // file loads ok, add the layer
+ layers.push_back(documentLayer);
+ }
+ }
+ }
+
+ FZScreen::setSpeed(BKUser::options.pspSpeed);
+
bool dirty = true;
+// bool vdirty = true;
bool exitApp = false;
int reloadTimer = 0;
while (!exitApp) {
+// if(vdirty) {
+// FZScreen::startDirectList();
+// // render layers back to front
+// bkLayersIt it(layers.begin());
+// bkLayersIt end(layers.end());
+// while (it != end) {
+// (*it)->update(0);
+// (*it)->render();
+// ++it;
+// }
+// FZScreen::endAndDisplayList();
+// } else
if (dirty) {
FZScreen::startDirectList();
// render layers back to front
@@ -91,6 +147,7 @@
int buttons = FZScreen::readCtrl();
dirty = buttons != 0;
+// vdirty = 0;
// the last layer always owns the input focus
bkLayersIt it(layers.end());
@@ -123,6 +180,9 @@
dirty = true;
}
} break;
+ case BK_CMD_MARK_VERY_DIRTY:
+// dirty = true;
+// vdirty = true;
case BK_CMD_MARK_DIRTY:
dirty = true;
break;
@@ -143,6 +203,8 @@
// open a file as a document
string s;
+ FZScreen::setSpeed(BKUser::options.pspMenuSpeed);
+
if (command == BK_CMD_RELOAD) {
documentLayer->getFileName(s);
documentLayer = 0;
@@ -152,6 +214,7 @@
fs->getFullPath(s);
fs = 0;
}
+
// clear layers
bkLayersIt it(layers.begin());
bkLayersIt end(layers.end());
@@ -181,6 +244,9 @@
// file loads ok, add the layer
layers.push_back(documentLayer);
}
+
+ FZScreen::setSpeed(BKUser::options.pspSpeed);
+
dirty = true;
} break;
case BK_CMD_SET_FONT: {
@@ -264,6 +330,7 @@
layers.erase(it);
} break;
case BK_CMD_EXIT: {
+ FZScreen::setSpeed(BKUser::options.pspMenuSpeed);
exitApp = true;
}
break;
diff -Nru -x CVS --strip-trailing-cr bookr_orig/fzfont.cpp bookr/fzfont.cpp
--- bookr_orig/fzfont.cpp 2006-01-26 03:39:05.000000000 +0300
+++ bookr/fzfont.cpp 2007-08-21 21:18:03.946250000 +0400
@@ -20,6 +20,7 @@
#include
#include
#include
+#include "glyphmap.h"
#ifdef MAC
static void* memalign(int t, int s) {
@@ -78,6 +79,15 @@
return createProto(library, face, fontSize, autohint);
}
+// hack by CrazyCoder to display em dash, ellipsis, etc
+FT_UInt FZFont::getCharIndex(FT_Face face, FT_ULong i) {
+ int char_index = FT_Get_Char_Index(face, i);
+ if(char_index == 0) {
+ char_index = FT_Get_Char_Index(face, glyphAnsiToUnicode[i]);
+ }
+ return char_index;
+}
+
FZFont* FZFont::createProto(FT_Library& library, FT_Face& face, int fontSize, bool autohint) {
// Margins around characters to prevent them from 'bleeding' into
// each other.
@@ -105,7 +115,8 @@
loadMode |= FT_LOAD_FORCE_AUTOHINT;
for (int i = 0; i < 256; ++i) {
// Look up the character in the font file.
- int char_index = FT_Get_Char_Index(face, i);
+ int char_index = getCharIndex(face, i);
+
if (i < 32)
char_index = 0;
@@ -157,7 +168,8 @@
// Drawing loop
for (int i = 0; i < 256; ++i) {
- int char_index = FT_Get_Char_Index(face, i);
+ int char_index = getCharIndex(face, i);
+
if (i < 32)
char_index = 0;
diff -Nru -x CVS --strip-trailing-cr bookr_orig/fzfont.h bookr/fzfont.h
--- bookr_orig/fzfont.h 2005-10-02 14:14:55.000000000 +0400
+++ bookr/fzfont.h 2007-08-20 12:44:44.211625000 +0400
@@ -38,6 +38,7 @@
FZCharMetrics* metrics;
int lineHeight;
static FZFont* createProto(FT_Library& library, FT_Face& face, int fontSize, bool autohint);
+ static FT_UInt getCharIndex(FT_Face face, FT_ULong i);
protected:
FZFont();
diff -Nru -x CVS --strip-trailing-cr bookr_orig/fzscreen.h bookr/fzscreen.h
--- bookr_orig/fzscreen.h 2006-08-10 21:52:11.000000000 +0400
+++ bookr/fzscreen.h 2007-08-21 21:19:34.758750000 +0400
@@ -266,7 +266,7 @@
static char* speedLabels[];
static int speedValues[];
static void setSpeed(int v);
-
+ static int getSpeed();
static void getTime(int &h, int &m);
static int getBattery();
static int getUsedMemory();
diff -Nru -x CVS --strip-trailing-cr bookr_orig/fzscreenglut.cpp bookr/fzscreenglut.cpp
--- bookr_orig/fzscreenglut.cpp 2006-08-10 21:52:11.000000000 +0400
+++ bookr/fzscreenglut.cpp 2007-08-21 21:26:57.165000000 +0400
@@ -578,6 +578,10 @@
void FZScreen::setSpeed(int v) {
}
+int FZScreen::getSpeed() {
+ return 266;
+}
+
void FZScreen::getTime(int &h, int &m) {
time_t t = time(NULL);
struct tm* lt = localtime(&t);
diff -Nru -x CVS --strip-trailing-cr bookr_orig/fzscreenpsp.cpp bookr/fzscreenpsp.cpp
--- bookr_orig/fzscreenpsp.cpp 2006-08-10 21:52:11.000000000 +0400
+++ bookr/fzscreenpsp.cpp 2007-08-20 13:24:45.934750000 +0400
@@ -30,6 +30,9 @@
#include "fzscreen.h"
#include "fztexture.h"
+#include "bkdocument.h"
+extern BKDocument* documentLayer;
+
FZScreen::FZScreen() {
}
@@ -51,6 +54,9 @@
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
+// if( documentLayer )
+// delete documentLayer;
+
sceKernelExitGame();
return 0;
}
@@ -412,6 +418,10 @@
scePowerSetBusClockFrequency(speedValues[v*2+1]);
}
+int FZScreen::getSpeed() {
+ return scePowerGetCpuClockFrequency();
+}
+
void FZScreen::getTime(int &h, int &m) {
pspTime time;
if (sceRtcGetCurrentClockLocalTime(&time) >= 0) {
diff -Nru -x CVS --strip-trailing-cr bookr_orig/glyphmap.h bookr/glyphmap.h
--- bookr_orig/glyphmap.h 1970-01-01 03:00:00.000000000 +0300
+++ bookr/glyphmap.h 2007-08-21 20:38:03.561000000 +0400
@@ -0,0 +1,34 @@
+const long glyphAnsiToUnicode[256] = {
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+8364, 0, 8218, 402, 8222, 8230, 8224, 8225,
+710, 8240, 352, 8249, 338, 0, 381, 0,
+0, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
+732, 8482, 353, 8250, 339, 0, 382, 376,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0
+};
diff -Nru -x CVS --strip-trailing-cr bookr_orig/palmdoc/palm.c bookr/palmdoc/palm.c
--- bookr_orig/palmdoc/palm.c 2006-02-07 19:27:56.000000000 +0300
+++ bookr/palmdoc/palm.c 2007-08-20 13:24:45.934750000 +0400
@@ -143,7 +143,7 @@
return 1;
}
-char* palmdoc_decode(char const *src_file_name, int* length, int* isMobi) {
+char* palmdoc_decode(char const *src_file_name, int* length, int* isMobi, char* title) {
buffer buf;
int compression, doc_size;
DWord file_size, offset, rec_size;
@@ -185,6 +185,9 @@
*isMobi = 0;
}
+ if( title )
+ strncpy(title,header.name,dmDBNameLength);
+
num_records = ntohs( header.recordList.numRecords ) - 1; /* w/o rec 0 */
/********** read record 0 ********************************************/
diff -Nru -x CVS --strip-trailing-cr bookr_orig/palmdoc/palmdoc.h bookr/palmdoc/palmdoc.h
--- bookr_orig/palmdoc/palmdoc.h 2006-02-02 18:17:14.000000000 +0300
+++ bookr/palmdoc/palmdoc.h 2007-08-20 13:24:45.950375000 +0400
@@ -24,8 +24,9 @@
extern "C" {
#endif
-extern char* palmdoc_decode(char const *src_file_name, int* length, int* isMobi);
+extern char* palmdoc_decode(char const *src_file_name, int* length, int* isMobi, char* title);
extern int palmdoc_is_palmdoc(char const *src_file_name);
+#define dmDBNameLength 32 /* 31 chars + 1 null terminator */
#ifdef __cplusplus
}