[sword-svn] r72 - trunk/src/gui
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Sat Dec 22 22:46:23 MST 2007
Author: dtrotzjr
Date: 2007-12-22 22:46:22 -0700 (Sat, 22 Dec 2007)
New Revision: 72
Modified:
trunk/src/gui/NavBooks.cpp
trunk/src/gui/NavNumbers.cpp
trunk/src/gui/TextControl.cpp
trunk/src/gui/TextControl.h
trunk/src/gui/VerseTextControl.cpp
Log:
Fixed Book selection for New Testament.
Modified: trunk/src/gui/NavBooks.cpp
===================================================================
--- trunk/src/gui/NavBooks.cpp 2007-12-23 05:11:56 UTC (rev 71)
+++ trunk/src/gui/NavBooks.cpp 2007-12-23 05:46:22 UTC (rev 72)
@@ -7,7 +7,7 @@
// #define MAXVERTICAL 10 // altered BD Nov 07 to make OK in landscape
//#define MAXVERTICAL 9
-#define MAX_OT_COLS 5
+//#define MAX_OT_COLS 5
// #define ROW0 15
@@ -114,16 +114,13 @@
}
int NavBooks::numberAt(int x, int y) {
- // if ((y>=ROW2)&&(y<ROW2+MAXVERTICAL*(PADDING_HEIGHT+BUTTON_HEIGHT))) {
- // y=y-ROW2;
-if ((y>=ROW0)&&(y < ROW0 + getMaxRows()*(PADDING_HEIGHT+BUTTON_HEIGHT))) {
- y=y-ROW0;
+ // The addition portion adds a partial column to the total
+ int totalOTCols = maxOTNumber / getMaxRows() + (maxOTNumber % getMaxRows() ? 1 : 0);
- // if ((x>=PADDING_WIDTH)&&(x<PADDING_WIDTH+4*(BUTTON_WIDTH+PADDING_WIDTH))) {
-
-// change below needed to make the 'tap' read the 'fifth' column (MAX_OT_COLS = 5)
+ if ((y>=ROW0)&&(y < ROW0 + getMaxRows()*(PADDING_HEIGHT+BUTTON_HEIGHT))) {
+ y=y-ROW0;
- if ((x>=PADDING_WIDTH)&&(x<PADDING_WIDTH+MAX_OT_COLS*(BUTTON_WIDTH_BK+PADDING_WIDTH))) {
+ if ((x>=PADDING_WIDTH)&&(x<PADDING_WIDTH+totalOTCols*(BUTTON_WIDTH_BK+PADDING_WIDTH))) {
x=x-PADDING_WIDTH;
int horizontal=(x/(PADDING_WIDTH+BUTTON_WIDTH_BK));
x=x-horizontal*(PADDING_WIDTH+BUTTON_WIDTH_BK);
@@ -138,8 +135,8 @@
}
}
// it wasn't an old testament book, so try for NT book
- else if (x>=PADDING_WIDTH+MAX_OT_COLS*(BUTTON_WIDTH_BK+PADDING_WIDTH)) {
- x=x-(PADDING_WIDTH+5*(BUTTON_WIDTH_BK+PADDING_WIDTH));
+ else if (x>=PADDING_WIDTH+totalOTCols*(BUTTON_WIDTH_BK+PADDING_WIDTH)) {
+ x=x-(PADDING_WIDTH+totalOTCols*(BUTTON_WIDTH_BK+PADDING_WIDTH));
int horizontal=(x/(PADDING_WIDTH+BUTTON_WIDTH_BK));
x=x-horizontal*(PADDING_WIDTH+BUTTON_WIDTH_BK);
int vertical=(y/(PADDING_HEIGHT+BUTTON_HEIGHT));
Modified: trunk/src/gui/NavNumbers.cpp
===================================================================
--- trunk/src/gui/NavNumbers.cpp 2007-12-23 05:11:56 UTC (rev 71)
+++ trunk/src/gui/NavNumbers.cpp 2007-12-23 05:46:22 UTC (rev 72)
@@ -7,18 +7,10 @@
#define MAXHORIZONTAL 10
-// #define MAXVERTICAL 10 // altered BD Nov 07 to make OK in landscape
-//#define MAXVERTICAL 9
+
#define MAXNUMBERS (getMaxRows()*MAXHORIZONTAL)
-// #define ROW0 15
-// #define ROW1 30
-// #define ROW2 45
#define ROW0 5
-// all uses of ROW1 and ROW2 removed BD Nov 2007 to make buttons fit on landscape
-// the message "Select a [whatever]:" does not now display but may not really be important
-
-// #define LASTROW ROW2+getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT)
#define LASTROW ROW0+getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT)
NavNumbers::NavNumbers(SimpleNavigator* navigator):NavPage(navigator) {
@@ -71,7 +63,6 @@
while ((current<=maxNumber)&&(current<start+MAXNUMBERS)) {
int colStart=current;
rt.left=rt.right; rt.right=rt.left+BUTTON_WIDTH_NM; rt.bottom=ROW0;
- // rt.left=rt.right; rt.right=rt.left+BUTTON_WIDTH; rt.bottom=ROW2;
while ((current<=maxNumber)&&(current-colStart<getMaxRows())) {
//padding above button
rt.top=rt.bottom;rt.bottom=rt.top+PADDING_HEIGHT;
@@ -86,7 +77,6 @@
rt.top=rt.bottom;rt.bottom=LASTROW;
clearRect(&rt);
//padding right of buttons
- // rt.top=ROW2; rt.left=rt.right; rt.right=rt.left+PADDING_WIDTH;
rt.top=ROW0; rt.left=rt.right; rt.right=rt.left+PADDING_WIDTH;
clearRect(&rt);
}
Modified: trunk/src/gui/TextControl.cpp
===================================================================
--- trunk/src/gui/TextControl.cpp 2007-12-23 05:11:56 UTC (rev 71)
+++ trunk/src/gui/TextControl.cpp 2007-12-23 05:46:22 UTC (rev 72)
@@ -33,20 +33,20 @@
portrait = true;
VERIFY(InitHTMLControl(g_hInst));
- htmlControl1 = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL,
+ htmlPrimed = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL,
WS_CHILD | HS_CLEARTYPE | HS_NOSCRIPTING |
HS_NOIMAGES | HS_NOACTIVEX | HS_NOSOUNDS ,
x, y, width, height,
g_hWnd, NULL, g_hInst, NULL);
- htmlControl2 = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL,
+ htmlFull = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL,
WS_CHILD | HS_CLEARTYPE | HS_NOSCRIPTING |
HS_NOIMAGES | HS_NOACTIVEX | HS_NOSOUNDS ,
x, y, width, height,
g_hWnd, NULL, g_hInst, NULL);
- setZoom(htmlControl1, 1);
- setZoom(htmlControl2, 1);
+ setZoom(htmlPrimed, 1);
+ setZoom(htmlFull, 1);
i = 0;
- ShowWindow(htmlControl2,SW_HIDE);
+ ShowWindow(htmlFull,SW_HIDE);
}
TextControl::~TextControl(){
@@ -54,27 +54,27 @@
void TextControl::show() {
if(preview)
- ShowWindow(htmlControl1,SW_SHOW);
+ ShowWindow(htmlPrimed,SW_SHOW);
else if(primed){
- ShowWindow(htmlControl2,SW_SHOW);
- ShowWindow(htmlControl1,SW_HIDE);
+ ShowWindow(htmlFull,SW_SHOW);
+ ShowWindow(htmlPrimed,SW_HIDE);
}else{
- ShowWindow(htmlControl1,SW_SHOW);
- ShowWindow(htmlControl2,SW_HIDE);
+ ShowWindow(htmlPrimed,SW_SHOW);
+ ShowWindow(htmlFull,SW_HIDE);
}
}
void TextControl::focus() {
if(primed)
- SetFocus(htmlControl2);
+ SetFocus(htmlFull);
else
- SetFocus(htmlControl1);
+ SetFocus(htmlPrimed);
}
void TextControl::hide() {
- ShowWindow(htmlControl1,SW_HIDE);
- ShowWindow(htmlControl2,SW_HIDE);
+ ShowWindow(htmlPrimed,SW_HIDE);
+ ShowWindow(htmlFull,SW_HIDE);
}
void TextControl::paint() {
@@ -85,24 +85,24 @@
int height = GetSystemMetrics(SM_CYSCREEN);
if(width < height && !portrait){
portrait = true;
- MoveWindow(htmlControl1,0,0,width,height - 2*MENU_HEIGHT, TRUE);
- MoveWindow(htmlControl2,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+ MoveWindow(htmlPrimed,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+ MoveWindow(htmlFull,0,0,width,height - 2*MENU_HEIGHT, TRUE);
}else if(width > height && portrait){
portrait = false;
- MoveWindow(htmlControl1,0,0,width,height - 2*MENU_HEIGHT, TRUE);
- MoveWindow(htmlControl2,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+ MoveWindow(htmlPrimed,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+ MoveWindow(htmlFull,0,0,width,height - 2*MENU_HEIGHT, TRUE);
}
}
TextControl::moveTo(int x, int y, int width, int height){
- MoveWindow(htmlControl1, x, y, width, height, TRUE);
- MoveWindow(htmlControl2, x, y, width, height, TRUE);
+ MoveWindow(htmlPrimed, x, y, width, height, TRUE);
+ MoveWindow(htmlFull, x, y, width, height, TRUE);
}
void TextControl::clearText() {
- clearHtml(htmlControl1);
- clearHtml(htmlControl2);
+ clearHtml(htmlPrimed);
+ clearHtml(htmlFull);
primed = false;
i = 0;
buffer.clear();
@@ -112,12 +112,12 @@
buffer+=text;
if(!preview && !primed && buffer.length() > 1500){
- clearHtml(htmlControl1);
- addHtml(htmlControl1,buffer.c_str());
- addHtml(htmlControl1, UString(L"</body></html>").c_str());
- endHtml(htmlControl1);
- ShowWindow(htmlControl1,SW_SHOW);
- ShowWindow(htmlControl2,SW_HIDE);
+ clearHtml(htmlPrimed);
+ addHtml(htmlPrimed,buffer.c_str());
+ addHtml(htmlPrimed, UString(L"</body></html>").c_str());
+ endHtml(htmlPrimed);
+ ShowWindow(htmlPrimed,SW_SHOW);
+ ShowWindow(htmlFull,SW_HIDE);
UpdateWindow(g_hWnd);
primed = true;
}
@@ -128,13 +128,13 @@
file=fopen("\\chapter.html","w+");
#endif
if(preview){
- addHtml(htmlControl1,buffer.c_str());
- endHtml(htmlControl1);
+ addHtml(htmlPrimed,buffer.c_str());
+ endHtml(htmlPrimed);
}else{
- addHtml(htmlControl2,buffer.c_str());
- endHtml(htmlControl2);
- ShowWindow(htmlControl1,SW_HIDE);
- ShowWindow(htmlControl2,SW_SHOW);
+ addHtml(htmlFull,buffer.c_str());
+ endHtml(htmlFull);
+ ShowWindow(htmlPrimed,SW_HIDE);
+ ShowWindow(htmlFull,SW_SHOW);
// In some cases this is still false due to very short chapters
primed = true;
}
Modified: trunk/src/gui/TextControl.h
===================================================================
--- trunk/src/gui/TextControl.h 2007-12-23 05:11:56 UTC (rev 71)
+++ trunk/src/gui/TextControl.h 2007-12-23 05:46:22 UTC (rev 72)
@@ -22,8 +22,8 @@
void addText(UString text);
void endOfText();
protected:
- HWND htmlControl1;
- HWND htmlControl2;
+ HWND htmlPrimed;
+ HWND htmlFull;
UString buffer;
RECT area;
bool portrait;
Modified: trunk/src/gui/VerseTextControl.cpp
===================================================================
--- trunk/src/gui/VerseTextControl.cpp 2007-12-23 05:11:56 UTC (rev 71)
+++ trunk/src/gui/VerseTextControl.cpp 2007-12-23 05:46:22 UTC (rev 72)
@@ -21,9 +21,9 @@
void VerseTextControl::gotoAnchor(int anchor) {
if(!primed || preview)
- controlToVerse(htmlControl1,anchor);
+ controlToVerse(htmlPrimed,anchor);
else
- controlToVerse(htmlControl2,anchor);
+ controlToVerse(htmlFull,anchor);
}
void VerseTextControl::paint() {
More information about the sword-cvs
mailing list