[sword-svn] r137 - trunk/src/SwordReader_GUI
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Thu May 22 20:56:22 MST 2008
Author: dtrotzjr
Date: 2008-05-22 20:56:22 -0700 (Thu, 22 May 2008)
New Revision: 137
Removed:
trunk/src/SwordReader_GUI/ApplicationInterface.cpp
trunk/src/SwordReader_GUI/ApplicationInterface.h
trunk/src/SwordReader_GUI/Main.h
trunk/src/SwordReader_GUI/NavBooks.cpp
trunk/src/SwordReader_GUI/NavBooks.h
trunk/src/SwordReader_GUI/NavChap.cpp
trunk/src/SwordReader_GUI/NavChap.h
trunk/src/SwordReader_GUI/NavFind.cpp
trunk/src/SwordReader_GUI/NavFind.h
trunk/src/SwordReader_GUI/NavNumbers.cpp
trunk/src/SwordReader_GUI/NavNumbers.h
trunk/src/SwordReader_GUI/NavPage.h
trunk/src/SwordReader_GUI/NavRenderText.cpp
trunk/src/SwordReader_GUI/NavRenderText.h
trunk/src/SwordReader_GUI/NavVerse.cpp
trunk/src/SwordReader_GUI/NavVerse.h
trunk/src/SwordReader_GUI/Navigator.cpp
trunk/src/SwordReader_GUI/Navigator.h
trunk/src/SwordReader_GUI/SimpleNavigator.cpp
trunk/src/SwordReader_GUI/SimpleNavigator.h
trunk/src/SwordReader_GUI/TextControl.cpp
trunk/src/SwordReader_GUI/TextControl.h
trunk/src/SwordReader_GUI/Utils.cpp
trunk/src/SwordReader_GUI/Utils.h
trunk/src/SwordReader_GUI/VerseTextControl.cpp
trunk/src/SwordReader_GUI/VerseTextControl.h
trunk/src/SwordReader_GUI/newres.h
Log:
Cleaned out old files.
Deleted: trunk/src/SwordReader_GUI/ApplicationInterface.cpp
===================================================================
--- trunk/src/SwordReader_GUI/ApplicationInterface.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/ApplicationInterface.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,38 +0,0 @@
-#include "ApplicationInterface.h"
-#include <commctrl.h>
-#include <aygshell.h>
-#include <sipapi.h>
-
-#include "resource.h"
-
-HINSTANCE g_hInst; // The current instance
-HWND g_hWnd; // The main window
-DWORD g_tMain; // The main thread id.
-HWND g_hwndCB; // The command bar handle
-HDC hdc; // Only valid when painting
-HBRUSH background;
-HFONT navFont; // For navigation
-HFONT textFont; // For navigation
-int font; // Current font id
-HFONT defaultFont;
-
-void initApplicationInterface() {
- font=FONT_DEFAULT;
- LOGFONT fontSpecs;
- memset(&fontSpecs,0,sizeof(fontSpecs));
- fontSpecs.lfHeight=-10;
- fontSpecs.lfWeight=200;
- fontSpecs.lfPitchAndFamily=FF_SWISS;
- fontSpecs.lfQuality=5;
- navFont=CreateFontIndirect(&fontSpecs);
-
- fontSpecs.lfHeight=-12;
- textFont=CreateFontIndirect(&fontSpecs);
-
- background=(HBRUSH) GetStockObject(WHITE_BRUSH);
-}
-
-void closeApplicationInterface() {
- DeleteObject(textFont);
- DeleteObject(navFont);
-}
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/ApplicationInterface.h
===================================================================
--- trunk/src/SwordReader_GUI/ApplicationInterface.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/ApplicationInterface.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,110 +0,0 @@
-#ifndef APPLICATIONINTERFACE_H
-#define APPLICATIONINTERFACE_H
-// This file contains a wrapper for the windows CE functions that are needed for the gui
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <aygshell.h>
-#include <htmlctrl.h>
-
-#include "utils.h"
-#include "SRFramework/WCString.h"
-#include "swordce.h"
-#include "resource.h"
-
-
-#define setMenuSelected(hWndMB, idButton, checked) SendMessage((hWndMB), TB_CHECKBUTTON,\
- (WPARAM)idButton, (LPARAM)MAKELONG(checked,0));
-
-NMNEWMENU
-
-#define getMenu(hWndMB) (HMENU)SendMessage((hWndMB), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0);
-#define getSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_GETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU);
-#define setSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_SETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU);
-#define registerID(id) (HMENU)(USERBUTTONS+id)
-
-#define WM_TXT_START WM_USER + 0x00F1
-#define WM_TXT_END WM_USER + 0x00F2
-
-#define MENU_HEIGHT 26
-#define MAX_LOADSTRING 100
-
-#define FONT_DEFAULT 0
-#define FONT_NAVIGATION 1
-#define FONT_TEXT 2
-
-#define NOCOLOR 0xFFFFFFFF
-
-#define BUTTON_WIDTH_BK 26
-#define BUTTON_WIDTH_NM 20
-#define BUTTON_HEIGHT 17
-
-#define PADDING_WIDTH 3
-#define PADDING_HEIGHT 3
-/*
-void initApplicationInterface();
-
-void closeApplicationInterface();
-
-// load string from string table
-void loadString(UINT id, LPTSTR buffer);
-WCString loadString(UINT id);
-
-// sets the main title
-void setTitle(const WCString &title);
-
-// Refreshes the whole application screen
-void refreshScreen();
-
-// Draws the text inside the rectangle
-inline void drawText(RECT* rt, const TCHAR* text, int length) {
- ExtTextOut(hdc, rt->left+2, rt->top+2, ETO_CLIPPED|ETO_OPAQUE,
- rt, text, length, 0);
-}
-
-void drawText(RECT* rt,const WCString &text);
-
-// Draws the text right-aligned inside the rectangle
-inline void drawRText(RECT* rt, const TCHAR* text, int length) {
- SIZE textSize;
- GetTextExtentPoint(hdc,text,length,&textSize);
- ExtTextOut(hdc, rt->right-2-textSize.cx, rt->top+2, ETO_CLIPPED|ETO_OPAQUE,
- rt, text, length, 0);
-}
-
-void drawRText(RECT* rt,const WCString &text);
-
-int drawVerseText(RECT* rt,const WCString &text);
-
-// fill the rectangle with the original background color
-inline void clearRect(RECT* rt) {
- FillRect(hdc, rt, background);
-}
-
-// set the font
-void setFont(int id=FONT_DEFAULT);
-
-// set the background color
-inline void setBackground(COLORREF color=NOCOLOR) {
- if (color==NOCOLOR)
- SetBkColor(hdc,(COLORREF)GetSysColor(COLOR_WINDOW));
- else
- SetBkColor(hdc,color);
-}
-
-void selectMenu(std::map<int,int>& menus, int mode);
-//void selectMenu(int mode);
-
-void addMenu(HMENU menu, int flags, int id,const WCString& text);
-
-void checkMenu(HMENU menu, int id, bool checked);
-
-// Get an id to give to the CreateWindow as hMenu
-HMENU registerID(int id);
-
-WCString getText(HWND edit);
-
-*/
-#endif
Deleted: trunk/src/SwordReader_GUI/Main.h
===================================================================
--- trunk/src/SwordReader_GUI/Main.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/Main.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,16 +0,0 @@
-#ifndef MAIN_H
-#define MAIN_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "ApplicationInterface.h"
-#include "Utils.h"
-
-int WINAPI WinMain( HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPTSTR lpCmdLine,
- int nCmdShow);
-
-#endif
Deleted: trunk/src/SwordReader_GUI/NavBooks.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavBooks.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavBooks.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,162 +0,0 @@
-#include "ApplicationInterface.h"
-#include "NavBooks.h"
-
-#include "SimpleNavigator.h"
-
-//RECT RECT_SCREEN = {0,0,240,294};
-
-// #define MAXVERTICAL 10 // altered BD Nov 07 to make OK in landscape
-//#define MAXVERTICAL 9
-//#define MAX_OT_COLS 5
-
-
-// #define ROW0 15
-// #define ROW1 30
-// #define ROW2 45
-
-// all uses of ROW1 and ROW2 removed BD Nov 2007 to make buttons fit on landscape
-// the message "Select a book:" will only show in portrait display as it is now
-// re-sited below the buttons - but it's not really that important anyway
-
-#define ROW0 5
-
-NavBooks::NavBooks(SimpleNavigator* navigator): NavPage(navigator) {
- this->position=&(navigator->position);
- this->command = "Select a book from the above:";
- this->maxOTNumber=position->otBookCount();
- this->maxNumber=position->bookCount();
-}
-
-NavBooks::~NavBooks() {
-}
-
-void NavBooks::paint() {
- RECT rt;
- memset(&rt,0,sizeof(rt));
-
- //RECT_SCREEN.bottom = 320; // portrait or landscape for clearing (Big square area)
- //RECT_SCREEN.right = 320;
-
- RECT_SCREEN.bottom = GetSystemMetrics(SM_CYSCREEN) - 2*MENU_HEIGHT;
- RECT_SCREEN.right = GetSystemMetrics(SM_CXSCREEN);
-
- rt.right=RECT_SCREEN.right;
-
- // to see if the whole screen gets filled
- //rt.bottom=RECT_SCREEN.bottom;
- //setBackground(0x00000000);
- //drawText(&rt,UString(L"test"));
- //setBackground();
-
- // below simply padded the top of the screen downwards and displayed the string
- // rt.bottom=ROW0;
- // clearRect(&rt);
- // rt.top=ROW0; rt.bottom=ROW1;
- // drawText(&rt,command);
- // rt.top=ROW1; rt.bottom=ROW2;
- // clearRect(&rt);
-
- // all references below changed to ROW0 :some were formerly ROW2 - amended BD Nov 07
-
- setBackground(BUTTON_BACKGROUND);
- setFont(FONT_NAVIGATION);
- TCHAR** bookNames=position->getBookNames();
- int current=1;
- int maxTNumber=maxOTNumber;
- //padding left of books
- rt.top=rt.bottom; rt.bottom=RECT_SCREEN.bottom;
- rt.right=PADDING_WIDTH;
- clearRect(&rt);
- while (current<=maxNumber) {
- //Paint one testament
- while (current<=maxTNumber) {
- int colStart=current;
- rt.left=rt.right; rt.right=rt.left+BUTTON_WIDTH_BK; rt.bottom=ROW0;
- while ((current<=maxTNumber)&&(current-colStart<getMaxRows())) {
- //padding top of button
- rt.top=rt.bottom;rt.bottom=rt.top+PADDING_HEIGHT;
- clearRect(&rt);
- //button
- rt.top=rt.bottom;rt.bottom=rt.top+BUTTON_HEIGHT;
- drawText(&rt,bookNames[current-1],3);
- current++;
- }
-
- // padding below buttons
- rt.top=rt.bottom;rt.bottom=RECT_SCREEN.bottom;
- 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);
- // six lines above commented out while testing BD
- }
- if (current<maxNumber) {
- //space between testaments
- maxTNumber=maxNumber;
- rt.right=rt.left+PADDING_WIDTH+PADDING_WIDTH;
- // rt.right=rt.left+BUTTON_WIDTH+PADDING_WIDTH;
- clearRect(&rt);
- }
-
- }
- //space right of the buttons
- rt.left=rt.right; rt.right=RECT_SCREEN.right; rt.bottom=RECT_SCREEN.bottom;
- clearRect(&rt);
- // next three lines draw text which will only be seen in portrait mode
- setBackground(0xFFFFFFFF); // white
- rt.left=0;
- rt.top = ROW0 + 20 + getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT);
- rt.bottom=ROW0+20+BUTTON_HEIGHT+getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT);
- drawText(&rt,command);
- setBackground();
- setFont();
-}
-
-int NavBooks::numberAt(int x, int y) {
- // The addition portion adds a partial column to the total
- int totalOTCols = maxOTNumber / getMaxRows() + (maxOTNumber % getMaxRows() ? 1 : 0);
-
- if ((y>=ROW0)&&(y < ROW0 + getMaxRows()*(PADDING_HEIGHT+BUTTON_HEIGHT))) {
- y=y-ROW0;
-
- 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);
- int vertical=(y/(PADDING_HEIGHT+BUTTON_HEIGHT));
- if (vertical<getMaxRows()) {
- y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT);
- //button is in bottom left corner
- if ((x<BUTTON_WIDTH_BK)&&(y>=PADDING_HEIGHT)) {
- int current=horizontal*getMaxRows()+vertical+1;
- if (current<=maxOTNumber) return current; // it was a valid OT book
- }
- }
- }
- // it wasn't an old testament book, so try for NT book
- 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));
- if (vertical<getMaxRows()) {
- y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT);
- //button is in bottom left corner
- if ((x<BUTTON_WIDTH_BK)&&(y>=PADDING_HEIGHT)) {
- int current=horizontal*getMaxRows()+vertical+maxOTNumber+1;
- if (current<=maxNumber) return current;
- }
- }
- }
- }
- return -1;
-}
-
-void NavBooks::userTap(int x, int y) {
- int number=numberAt(x,y);
- if (number>0) {
- navigator->setBook(number);
- navigator->setMode(MODE_CHAP);
- }
-}
Deleted: trunk/src/SwordReader_GUI/NavBooks.h
===================================================================
--- trunk/src/SwordReader_GUI/NavBooks.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavBooks.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,34 +0,0 @@
-#ifndef NAVBOOKS_H
-#define NAVBOOKS_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "WCString.h"
-#include "NavPage.h"
-
-class SimpleNavigator;
-class SwordIndex;
-
-class NavBooks: public NavPage {
-public:
- NavBooks(SimpleNavigator* navigator);
- virtual ~NavBooks();
- // redraw the screen. This should use methods in ApplicationInterface.h to do the drawing
- void paint();
- // signals that the user has tapped somewhere.
- // returns: the number that the user has tapped. -1 if no number
- void userTap(int x, int y);
- int getMaxRows() {
- return (GetSystemMetrics(SM_CYSCREEN) - 2*MENU_HEIGHT) / (BUTTON_HEIGHT + PADDING_HEIGHT) - 1;
- };
-private:
- int numberAt(int x, int y);
- SwordIndex* position;
- WCString command;
- int maxNumber, maxOTNumber;
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/NavChap.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavChap.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavChap.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,24 +0,0 @@
-#include "NavChap.h"
-#include "ApplicationInterface.h"
-#include "NavFind.h"
-#include "SimpleNavigator.h"
-
-NavChap::NavChap(SimpleNavigator* navigator):NavNumbers(navigator){
- command=L"Select a chapter";
-}
-
-NavChap::~NavChap(){
-}
-
-void NavChap::show() {
- maxNumber=navigator->chapCount();
- NavNumbers::show();
-}
-
-void NavChap::userTap(int x, int y) {
- int number=numberAt(x,y);
- if (number>0) {
- navigator->setChap(number);
- navigator->setMode(MODE_VERSE);
- }
-}
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/NavChap.h
===================================================================
--- trunk/src/SwordReader_GUI/NavChap.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavChap.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,22 +0,0 @@
-#ifndef NAVCHAP_H
-#define NAVCHAP_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "NavPage.h"
-#include "NavNumbers.h"
-
-class SimpleNavigator;
-
-class NavChap : public NavNumbers {
-public:
- NavChap(SimpleNavigator* navigator);
- virtual ~NavChap();
- void show();
- void userTap(int x, int y);
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/NavFind.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavFind.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavFind.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,269 +0,0 @@
-#include "ApplicationInterface.h"
-#include "NavFind.h"
-#include "SimpleNavigator.h"
-
-#include <aygshell.h>
-
-#define check(checkButtonHWND) SendMessage(checkButtonHWND,BM_SETCHECK,BST_CHECKED,0);
-#define uncheck(checkButtonHWND) SendMessage(checkButtonHWND,BM_SETCHECK,BST_UNCHECKED,0);
-
-// added Nov 2007 to check mode before painting 'find' listbox - BD
-// this was written as a separate function in case we want to call it from elsewhere
-int IsPortrait() {
- if (GetSystemMetrics(SM_CYSCREEN) > GetSystemMetrics(SM_CXSCREEN)) return(100);
- return(0);
-}
-
-
-NavFind::NavFind(SimpleNavigator* navigator) : NavPage(navigator) {
- // register ID's so we get feedback
- searchID=navigator->getID();
- rangeBibleID=navigator->getID();
- rangeTestamentID=navigator->getID();
- rangeBookID=navigator->getID();
- methodMultiwordID=navigator->getID();
- methodExactphraseID=navigator->getID();
- goID=navigator->getID();
- resultsID=navigator->getID();
-
- // create windows ce managed controls
- queryEdit = CreateWindow(_T("edit"), NULL,
- WS_CHILD | ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP | WS_BORDER,
- 0,0,0,0,
- g_hWnd, NULL, g_hInst, NULL);
- search = CreateWindow(_T("button"), L"Search",
- WS_CHILD | BS_PUSHBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(searchID), g_hInst, NULL);
-
- // Radio Buttons
- rangeBible = CreateWindow(_T("button"), L"Whole bible",
- WS_CHILD | BS_RADIOBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(rangeBibleID),g_hInst, NULL);
- rangeTestament = CreateWindow(_T("button"), L"This testament",
- WS_CHILD | BS_RADIOBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(rangeTestamentID),g_hInst, NULL);
- rangeBook = CreateWindow(_T("button"), L"This book",
- WS_CHILD | BS_RADIOBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(rangeBookID),g_hInst, NULL);
- methodMultiword = CreateWindow(_T("button"), L"Multi-word",
- WS_CHILD | BS_RADIOBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(methodMultiwordID),g_hInst, NULL);
- methodExactphrase = CreateWindow(_T("button"), L"Exact phrase",
- WS_CHILD | BS_RADIOBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(methodExactphraseID),g_hInst, NULL);
- check(rangeBook);
- rangeMode=RANGEBOOK;
- check(methodMultiword);
- methodMode=METHODMULTIWORD;
-
- results = CreateWindow(_T("listbox"),NULL,
- WS_CHILD | WS_VSCROLL | LBS_DISABLENOSCROLL | LBS_NOTIFY | WS_BORDER | LBS_NOINTEGRALHEIGHT,
- 0,0,0,0,
- g_hWnd, registerID(resultsID), g_hInst, NULL); //bottom row of screen
- // the last figure in above line needs to be 100 for landscape or 173 for portrait (scrHeight)
-
- progressBar = CreateWindow(PROGRESS_CLASS, L"",
- WS_CHILD | WS_BORDER | PBS_SMOOTH,
- 0,0,0,0,
- g_hWnd, NULL, g_hInst, NULL);
- go = CreateWindow(_T("button"), L"Go to",
- WS_CHILD | BS_PUSHBUTTON,
- 0,0,0,0,
- g_hWnd, registerID(goID), g_hInst, NULL);
- // HTML control
- // preview=new TextControl(80,120,160,148); // this is OK for portrait
- // we now change the preview size for landscape. Note, however that
- // preview window does not have scroll bars. Are long verses going to
- // become a problem? Maybe it's not that important. If it is, then add scrollbars.
-
- preview=new TextControl(0,0,0,0, true); // the last figure is the height
- // I haven't bothered changing the height - what is off-screen simply doesn't show.
- // There is no test and no error.
- preview->clearText();
- preview->addText(L"preview");
- preview->endOfText();
- placeWidgets();
-}
-
-NavFind::~NavFind() {
- delete preview;
-}
-
-void NavFind::show() {
- // set our controls to visible
- ShowWindow(queryEdit,SW_SHOW);
- ShowWindow(search,SW_SHOW);
-
- ShowWindow(rangeBible,SW_SHOW);
- ShowWindow(rangeTestament,SW_SHOW);
- ShowWindow(rangeBook,SW_SHOW);
- ShowWindow(methodMultiword,SW_SHOW);
- ShowWindow(methodExactphrase,SW_SHOW);
- //ShowWindow(title,SW_SHOW);
-
- ShowWindow(results,SW_SHOW);
- ShowWindow(progressBar,SW_SHOW);
- ShowWindow(go,SW_SHOW);
-
- // propagate to HTML control
- preview->show();
-}
-
-void NavFind::hide() {
- // set our controls to visible
- ShowWindow(queryEdit,SW_HIDE);
- ShowWindow(search,SW_HIDE);
-
- ShowWindow(rangeBible,SW_HIDE);
- ShowWindow(rangeTestament,SW_HIDE);
- ShowWindow(rangeBook,SW_HIDE);
- ShowWindow(methodMultiword,SW_HIDE);
- ShowWindow(methodExactphrase,SW_HIDE);
- //ShowWindow(title,SW_HIDE);
-
- ShowWindow(results,SW_HIDE);
- ShowWindow(progressBar,SW_HIDE);
- ShowWindow(go,SW_HIDE);
- // propagate to HTML control
- preview->hide();
-}
-
-void NavFind::paint() {
- placeWidgets();
- // this method can be used to do custom painting, for an example, see NavBooks::paint()
- // propagate to HTML control
- preview->paint();
-}
-
-void NavFind::placeWidgets(){
- int width = GetSystemMetrics(SM_CXSCREEN);
- int height = GetSystemMetrics(SM_CYSCREEN);
- int searchBtnW = 60;
- int pad = 2;
- int btnH = 24;
- int margin = 2;
- int row0 = margin;
- int row1 = row0 + pad + btnH;
- int row2 = row1 + pad + btnH;
- int row3 = row2 + pad + btnH;
- int row4 = row3 + pad + btnH;
- int row5 = row4 + pad + btnH;
- int col0 = margin;
- int textW = (width - (2*margin + pad))/2;
- int col1 = margin + textW + pad;
- int gotoBtnW = 60;
- int queryW = width - (margin + searchBtnW + pad + margin);
- int listH = height - (row4 + margin + 2*MENU_HEIGHT);
- int listW = 80;
- int prevH = height - (row5 + margin);
- int prevW = width - (margin + listW + pad + margin);
- int progW = width - (margin + listW + pad + pad + gotoBtnW + margin);
-
- MoveWindow(queryEdit,col0, row0, queryW, btnH,TRUE);
- MoveWindow(search,col0 + queryW + pad, row0, searchBtnW, btnH,TRUE);
- MoveWindow(rangeBible,col0,row1,textW,btnH,TRUE);
- MoveWindow(rangeTestament,col0,row2,textW,btnH,TRUE);
- MoveWindow(rangeBook,col0,row3,textW,btnH,TRUE);
- MoveWindow(methodMultiword,col1,row1,textW,btnH,TRUE);
- MoveWindow(methodExactphrase,col1,row2,textW,btnH,TRUE);
- MoveWindow(results,margin,row4,listW,listH,TRUE);
- MoveWindow(progressBar,col0 + listW + pad,row4,progW,btnH,TRUE);
- MoveWindow(go,col0 + listW + pad + progW + pad,row4, gotoBtnW,btnH,TRUE);
- preview->moveTo(margin + listW + pad,row5,prevW,prevH);
-}
-
-void NavFind::buttonClicked(int id) {
- // is it one of our registered ID's?
- if (id==searchID) {
- searchFor(getText(queryEdit));
- refreshScreen();
- } else if (id==rangeBibleID) {
- check(rangeBible);
- uncheck(rangeTestament);
- uncheck(rangeBook);
- rangeMode=RANGEBIBLE;
- } else if (id==rangeTestamentID) {
- uncheck(rangeBible);
- check(rangeTestament);
- uncheck(rangeBook);
- rangeMode=RANGETESTAMENT;
- } else if (id==rangeBookID) {
- uncheck(rangeBible);
- uncheck(rangeTestament);
- check(rangeBook);
- rangeMode=RANGEBOOK;
- } else if (id==methodMultiwordID) {
- check(methodMultiword);
- uncheck(methodExactphrase);
- methodMode=METHODMULTIWORD;
- } else if (id==methodExactphraseID) {
- check(methodExactphrase);
- uncheck(methodMultiword);
- methodMode=METHODEXACTPHRASE;
- } else if (id==resultsID) {
- unsigned int pos= SendMessage (results, LB_GETCURSEL, 0, 0);
- if ((pos!=LB_ERR)&&(pos<verses.size())) {
- previewVerse(&verses[pos]);
- }
- } else if (id==goID) {
- unsigned int pos= SendMessage (results, LB_GETCURSEL, 0, 0);
- if ((pos!=LB_ERR)&&(pos<verses.size())) {
- navigateToVerse(&verses[pos]);
- }
- }
-}
-
-void NavFind::previewVerse(Verse* verse) {
- preview->clearText();
- // next line was commented out
- // preview->addText(SwordIndex::verseToString(verse));
- // and the line below left in
- preview->addText(navigator->position.verseText(verse));
- preview->endOfText();
-}
-
-void NavFind::navigateToVerse(Verse* verse) {
- navigator->position.setVerseKey(verse);
- navigator->chapterCache=false;
- navigator->setMode(MODE_TEXT);
-}
-
-
-void NavFind::clearResults() {
- SendMessage (results, LB_RESETCONTENT,0,0);
- preview->clearText();
- preview->addText(L"preview");
- preview->endOfText();
- verses.clear();
-}
-
-void NavFind::setProgress(int percent) {
- SendMessage(progressBar,PBM_SETPOS, percent, 0);
-}
-
-void NavFind::addResult(const WCString &verseStr) {
- Verse* verse=new Verse(verseStr.c_str());
- verses.push_back(*verse);
- WCString verseString = SwordIndex::verseToString(verse);
- SendMessage (results, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)verseString.w_str());
- delete verse;
-}
-
-void NavFind::searchFor(const WCString &query) {
- clearResults();
- setProgress(5);
- navigator->position.search(query,rangeMode,methodMode,this);
-}
-
-WCString NavFind::GetSearchText(HWND edit) {
- TCHAR chars[MAX_LOADSTRING];
- SendMessage(edit,WM_GETTEXT,(WPARAM)MAX_LOADSTRING,(LPARAM)chars);
- chars[MAX_LOADSTRING-1]=0; // in case the buffer was exceeded
- return WCString(chars);
-}
Deleted: trunk/src/SwordReader_GUI/NavFind.h
===================================================================
--- trunk/src/SwordReader_GUI/NavFind.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavFind.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,46 +0,0 @@
-#ifndef NAVFIND_H
-#define NAVFIND_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "NavPage.h"
-#include "TextControl.h"
-#include "SwordIndex.h"
-
-class SimpleNavigator;
-
-class NavFind: public NavPage, public Searcher {
-public:
- NavFind(SimpleNavigator* navigator);
- virtual ~NavFind();
- void show();
- void paint();
- void hide();
- void buttonClicked(int id);
- void searchFor(const WCString &query);
- virtual void setProgress(int percent);
- virtual void addResult(const WCString &verseStr);
- void placeWidgets();
- WCString GetSearchText(HWND edit);
-private:
- //Navigator* navigator;
- std::vector<Verse> verses;
- HWND queryEdit,search;
- HWND rangeBible, rangeTestament, rangeBook;
- HWND methodMultiword, methodExactphrase;
- HWND progressBar, results, title, go;
- TextControl* preview;
- int searchID;
- int rangeBibleID, rangeTestamentID, rangeBookID;
- int methodMultiwordID, methodExactphraseID;
- int goID, resultsID;
- void clearResults();
- void previewVerse(Verse* verse);
- void navigateToVerse(Verse* verse);
- int rangeMode;
- int methodMode;
-};
-#endif
Deleted: trunk/src/SwordReader_GUI/NavNumbers.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavNumbers.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavNumbers.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,140 +0,0 @@
-#include "ApplicationInterface.h"
-#include "NavNumbers.h"
-
-#include "SimpleNavigator.h"
-
-//RECT RECT_SCREEN = {0,0,240,294};
-
-
-#define MAXHORIZONTAL 10
-
-#define MAXNUMBERS (getMaxRows()*MAXHORIZONTAL)
-
-#define ROW0 5
-#define LASTROW ROW0+getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT)
-
-NavNumbers::NavNumbers(SimpleNavigator* navigator):NavPage(navigator) {
-}
-
-NavNumbers::~NavNumbers() {
-}
-
-void NavNumbers::show() {
- start=1;
-}
-
-void NavNumbers::paint() {
- RECT rt;
- memset(&rt,0,sizeof(rt));
-
- RECT_SCREEN.bottom = GetSystemMetrics(SM_CYSCREEN) - 2*MENU_HEIGHT;
- RECT_SCREEN.right = GetSystemMetrics(SM_CXSCREEN);
-
- rt.right=RECT_SCREEN.right;
-
- // to see if the whole screen gets filled
- //rt.bottom=RECT_SCREEN.bottom;
- //setBackground(0x00000000);
- //drawText(&rt,UString(L"test"));
- //setBackground();
-
- // below simply padded the top of the screen downwards and displayed the string
-
- // rt.bottom=ROW0;
- // clearRect(&rt);
- // rt.bottom=ROW0;
- // clearRect(&rt);
-
- // rt.top=ROW0; rt.bottom=ROW1;
- // drawText(&rt,command);
-
- // rt.top=ROW1; rt.bottom=ROW2;
- // clearRect(&rt);
-
- TCHAR buttonText[4];
- setBackground(BUTTON_BACKGROUND);
- setFont(FONT_NAVIGATION);
- int current=start;
- // left of first buttons
- rt.right=rt.left+PADDING_WIDTH;
- rt.top=rt.bottom; rt.bottom=LASTROW;
- clearRect(&rt);
-
- while ((current<=maxNumber)&&(current<start+MAXNUMBERS)) {
- int colStart=current;
- rt.left=rt.right; rt.right=rt.left+BUTTON_WIDTH_NM; rt.bottom=ROW0;
- while ((current<=maxNumber)&&(current-colStart<getMaxRows())) {
- //padding above button
- rt.top=rt.bottom;rt.bottom=rt.top+PADDING_HEIGHT;
- clearRect(&rt);
- //button
- rt.top=rt.bottom;rt.bottom=rt.top+BUTTON_HEIGHT;
- _itow(current,buttonText,10);
- drawRText(&rt,buttonText,wcslen(buttonText));
- current++;
- }
- //padding below buttons
- rt.top=rt.bottom;rt.bottom=LASTROW;
- clearRect(&rt);
- //padding right of buttons
- rt.top=ROW0; rt.left=rt.right; rt.right=rt.left+PADDING_WIDTH;
- clearRect(&rt);
- }
- //area right of buttons
- rt.left=rt.right; rt.right=RECT_SCREEN.right;
- clearRect(&rt);
- rt.left=RECT_SCREEN.left;rt.right=RECT_SCREEN.right; //rt.bottom is still LASTROW
- //optional 'more' button
- if ((start!=1)||(current<maxNumber)) {
- rt.top=rt.bottom;rt.bottom=rt.top+PADDING_HEIGHT;
- clearRect(&rt);
- rt.top=rt.bottom; rt.bottom=rt.top+BUTTON_HEIGHT;
- rt.right=(RECT_SCREEN.right/3);
- clearRect(&rt);
- rt.left=rt.right;rt.right=RECT_SCREEN.right-rt.left;
- drawText(&rt,"More...");
- rt.left=rt.right;rt.right=RECT_SCREEN.right;
- clearRect(&rt);
- rt.left=RECT_SCREEN.left;
- }
- //space below the buttons
- rt.top=rt.bottom; rt.bottom=RECT_SCREEN.bottom;
- clearRect(&rt);
-
- setBackground();
- setFont();
-}
-
-int NavNumbers::numberAt(int x, int y) {
- // y=y-ROW2;
- y=y-ROW0;
- if (x>0) {
- int horizontal=(x/(PADDING_WIDTH+BUTTON_WIDTH_NM));
- if (horizontal<MAXHORIZONTAL) {
- x=x-horizontal*(PADDING_HEIGHT+BUTTON_HEIGHT);
- int vertical=(y/(PADDING_HEIGHT+BUTTON_HEIGHT));
- if (vertical<getMaxRows()) {
- y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT);
- //button is in bottom right corner
- if ((x>=PADDING_WIDTH)&&(y>=PADDING_HEIGHT)) {
- int current=horizontal*getMaxRows()+vertical+start;
- if (current<=maxNumber) return current;
- }
- }
- else if (vertical==getMaxRows()) { // The 'more' button is here
- y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT);
- if (y>=PADDING_HEIGHT) {
- x=x+horizontal*(PADDING_HEIGHT+BUTTON_HEIGHT); //undo
- if (((2*x)>=(RECT_SCREEN.right-x))&&((2*(RECT_SCREEN.right-x))>=x)) {
- if ((start+MAXNUMBERS)>maxNumber)
- start=1;
- else
- start=start+MAXNUMBERS;
- refreshScreen();
- }
- }
- }
- }
- }
- return -1;
-}
Deleted: trunk/src/SwordReader_GUI/NavNumbers.h
===================================================================
--- trunk/src/SwordReader_GUI/NavNumbers.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavNumbers.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,35 +0,0 @@
-#ifndef NAVNUMBERS_H
-#define NAVNUMBERS_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "NavPage.h"
-#include "ApplicationInterface.h"
-
-class SimpleNavigator;
-
-class NavNumbers: public NavPage {
-public:
- NavNumbers(SimpleNavigator* navigator);
- virtual ~NavNumbers();
-
- // initialize with this maximum number
- void show();
- // redraw the screen. This should use methods in ApplicationInterface.h to do the drawing
- void paint();
- // signals that the user has tapped somewhere.
- // returns: the number that the user has tapped. -1 if no number
- int numberAt(int x, int y);
- int getMaxRows() {
- return (GetSystemMetrics(SM_CYSCREEN) - 2*MENU_HEIGHT) / (BUTTON_HEIGHT + PADDING_HEIGHT) - 1;
- };
-protected:
- int maxNumber;
- WCString command;
- int start;
-};
-
-#endif
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/NavPage.h
===================================================================
--- trunk/src/SwordReader_GUI/NavPage.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavPage.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,67 +0,0 @@
-#ifndef NAVPAGE_H
-#define NAVPAGE_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-
-class SimpleNavigator;
-
-class NavPage
-{
-public:
- // In a derived class, use this constructor to instantiate visual
- // components using CreateWindow. For example:
- //
- // anEdit = CreateWindow(_T("edit"), NULL,
- // WS_CHILD | WS_BORDER,
- // RECT_SCREEN.left, RECT_SCREEN.top, 30, 20,
- // g_hWnd, NULL, g_hInst, NULL);
- //
- // In order to listen to button clicks, they first need to be
- // registered here in the navigator like this:
- //
- // aButtonID=navigator->getID();
- //
- // aButton = CreateWindow(_T("button"), L"Go",
- // WS_CHILD | BS_PUSHBUTTON,
- // RECT_SCREEN.right-30, RECT_SCREEN.top, 30, 20,
- // g_hWnd, registerID(goButtonID), g_hInst, NULL);
- NavPage(SimpleNavigator* navigator) {
- portrait = inPortraitMode();
- this->navigator=navigator;
- };
- // Destructor
- virtual ~NavPage() {};
- // In the derived class, show all visual components here using
- // ShowWindow. For example:
- //
- // ShowWindow(anEdit,SW_SHOW);
- virtual void show() {};
- // In the derived class, hide all visual components here using
- // ShowWindow. For example:
- //
- // ShowWindow(anEdit,SW_HIDE);
- virtual void hide() {};
- // In the derived class, use this method to do all custom
- // painting, using methods from ApplicationInterface.cpp. Example:
- //
- // drawText(&RECT_SCREEN, L"Under construction");
- virtual void paint() {};
- // In the derived class, use this method to listen to buttons being
- // clicked. See the comment in the constructor on how to obtain the id
- virtual void buttonClicked(int id) {};
- // In the derived class, use this method to listen to 'mouse clicks'
- // that do not occur inside visual components.
- virtual void userTap(int x, int y) {};
- // In the derived class, use this method to listen to keys being pressed
- virtual void keyDown(WPARAM id, LPARAM lparam) {};
-protected:
- SimpleNavigator* navigator;
- // Used to determine if the screen switched from portrait to landscape and visa versa.
- bool portrait;
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/NavRenderText.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavRenderText.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavRenderText.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,157 +0,0 @@
-#include "ApplicationInterface.h"
-#include "NavRenderText.h"
-#include "SimpleNavigator.h"
-
-
-#include <swordce.h>
-#include <windows.h>
-#include <sipapi.h>
-#include <shlobj.h>
-#include <prsht.h>
-#include <aygshell.h>
-
-#include "utils.h"
-
-
-//#define getMenu(window) (HMENU)SendMessage(window, SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
-
-NavRenderText::NavRenderText(SimpleNavigator* navigator):NavPage(navigator) {
- textControl = new VerseTextControl(RECT_SCREEN.left, RECT_SCREEN.top, RECT_SCREEN.right, RECT_SCREEN.bottom);
-}
-
-NavRenderText::~NavRenderText() {
- delete textControl;
-}
-
-void NavRenderText::show() {
- textControl->show();
- showText();
-}
-
-void NavRenderText::showText() {
- int verse=navigator->getVerse();
- if (!(navigator->chapterCache)) {
- textControl->clearText();
- textControl->hide();
- load();
- textControl->show();
- if (verse!=1)
- textControl->gotoAnchor(verse);
- }
- else
- textControl->gotoAnchor(verse);
- navigator->chapterCache=true;
-}
-
-void NavRenderText::load() {
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_BOOK, false);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_CHAP, false);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_VERSE, false);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_TEXT, false);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_FIND, false);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_MENU, false);
-
-
- // Suspend user interaction until this page is fully loaded.
- PostThreadMessage(g_tMain, WM_TXT_START, NULL, NULL);
-
- navigator->position.setMark();
- navigator->position.setVerse(1);
- textControl->addText("<html><head><meta name=\"MobileOptimized\" content=\"240\"><title></title></head><body>"); // a <style> section presumably gets skipped
- WCString s;
- WCString heading;
- char buf[10];
- while (true) {
- int pvHeading = 0;
- do {
- sprintf(buf, "%i", pvHeading++);
- SWBuf preverseHeading = navigator->position.bible->getEntryAttributes()["Heading"]["Preverse"][buf].c_str();
- if (preverseHeading.length()) {
- textControl->addText(L"<br /><br /><b>");
- textControl->addText((WCHAR *)navigator->position.bible->RenderText(preverseHeading)); // do any tag conversions for our requested markup
- textControl->addText(L"</b><br /><br />");
- }
- else break;
- } while (true);
- s = navigator->position.verseText();
- if (s.length() > 0) {
- textControl->addAnchoredText(getVerseHeader(),navigator->position.getVerse());
- textControl->addText(s);
- }
- if (navigator->position.getVerse()==navigator->position.verseCount())
- break;
- else
- navigator->position.next();
- }
- textControl->addText("</body></html>");
- navigator->position.jumpBack();
-
- textControl->endOfText();
-
- // Allow user interaction since this page is now fully loaded.
- PostThreadMessage(g_tMain, WM_TXT_END, NULL, NULL);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_BOOK, true);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_CHAP, true);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_VERSE, true);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_TEXT, true);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_FIND, true);
- SendMessage(g_hwndCB, TB_ENABLEBUTTON, MENU_MENU, true);
-
-
- textControl->focus();
- refreshScreen();
- textControl->paint();
-}
-
-void NavRenderText::hide() {
- textControl->hide();
-}
-
-void NavRenderText::paint() {
- textControl->paint();
-}
-
-WCString NavRenderText::getVerseHeader() {
- wchar_t wverse[16] = {0};
- wchar_t wchap[16] = {0};
- _itow(navigator->position.getVerse(), wverse, 10);
- _itow(navigator->position.getChap(), wchap, 10);
-
- WCString result = "\n<b><a name=\"";
- result += wverse;
- result += "\">";
- if (navigator->position.getVerse() == 1) {
- result += wchap;
- result += ":";
- }
- result += wverse;
- result += "</a></b> ";
-
- return result;
-}
-
-void NavRenderText::keyDown(WPARAM id, LPARAM lparam) {
- switch (id) {
- case VK_UP:
- navigator->position--;
- if (navigator->position.getVerse()==navigator->position.verseCount())
- navigator->chapterCache=false;
- break;
- case VK_DOWN:
- navigator->position++;
- if (navigator->position.getVerse()==1) navigator->chapterCache=false;
- break;
- case VK_LEFT:
- navigator->position.setVerse(1);
- navigator->position--;
- navigator->chapterCache=false;
- break;
- case VK_RIGHT:
- navigator->position.setVerse(navigator->position.verseCount());
- navigator->position++;
- navigator->chapterCache=false;
- break;
- }
- showText();
- navigator->updateTitle();
-}
Deleted: trunk/src/SwordReader_GUI/NavRenderText.h
===================================================================
--- trunk/src/SwordReader_GUI/NavRenderText.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavRenderText.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,33 +0,0 @@
-#ifndef NAVRENDERTEXT_H
-#define NAVRENDERTEXT_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "NavPage.h"
-#include "VerseTextControl.h"
-
-class SimpleNavigator;
-
-class NavRenderText: public NavPage {
-public:
- int verseCount; //number of verses on screen
-
- NavRenderText(SimpleNavigator* navigator);
- virtual ~NavRenderText();
-
- void show();
- void paint();
- void hide();
- void keyDown(WPARAM id, LPARAM lparam);
-private:
-// HWND htmlControl;
- VerseTextControl* textControl;
- void load();
- void showText();
- WCString getVerseHeader();
-};
-
-#endif // !defined(NAVRENDERTEXT_H)
Deleted: trunk/src/SwordReader_GUI/NavVerse.cpp
===================================================================
--- trunk/src/SwordReader_GUI/NavVerse.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavVerse.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,24 +0,0 @@
-#include "NavVerse.h"
-#include "ApplicationInterface.h"
-#include "NavFind.h"
-#include "SimpleNavigator.h"
-
-NavVerse::NavVerse(SimpleNavigator* navigator):NavNumbers(navigator){
- command=L"Select a verse";
-}
-
-NavVerse::~NavVerse(){
-}
-
-void NavVerse::show() {
- NavNumbers::show();
- maxNumber=navigator->verseCount();
-}
-
-void NavVerse::userTap(int x, int y) {
- int number=numberAt(x,y);
- if (number>0) {
- navigator->setVerse(number);
- navigator->setMode(MODE_TEXT);
- }
-}
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/NavVerse.h
===================================================================
--- trunk/src/SwordReader_GUI/NavVerse.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/NavVerse.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,25 +0,0 @@
-#ifndef NAVVERSE_H
-#define NAVVERSE_H
-
-class Navigator;
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "utils.h"
-#include "NavPage.h"
-#include "NavNumbers.h"
-
-class SimpleNavigator;
-
-class NavVerse : public NavNumbers
-{
-public:
- NavVerse(SimpleNavigator* navigator);
- virtual ~NavVerse();
- void show();
- void userTap(int x, int y);
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/Navigator.cpp
===================================================================
--- trunk/src/SwordReader_GUI/Navigator.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/Navigator.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,10 +0,0 @@
-#include "Navigator.h"
-
-Navigator::Navigator(RECT* screen):SimpleNavigator(screen) {
- text2=pages[MODE_TEXT2]=new ConstructionPage(this);
- menus[MODE_TEXT2]=MENU_TEXT2;
-}
-
-Navigator::~Navigator() {
- delete text2;
-}
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/Navigator.h
===================================================================
--- trunk/src/SwordReader_GUI/Navigator.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/Navigator.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,31 +0,0 @@
-#ifndef NAVIGATOR_H
-#define NAVIGATOR_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "SimpleNavigator.h"
-#include "ApplicationInterface.h"
-
-#define MODE_TEXT2 5
-
-class NavPage;
-
-class ConstructionPage: public NavPage {
- public:
- ConstructionPage(SimpleNavigator* navigator):NavPage(navigator) {};
- void paint() {
- drawText(&RECT_SCREEN, L"Under construction");
- };
-};
-
-class Navigator : public SimpleNavigator {
- private:
- NavPage* text2;
- public:
- Navigator(RECT* screen);
- virtual ~Navigator();
-};
-
-#endif
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/SimpleNavigator.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SimpleNavigator.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/SimpleNavigator.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,371 +0,0 @@
-#include "ApplicationInterface.h"
-#include "SimpleNavigator.h"
-#include "NavChap.h"
-#include "NavVerse.h"
-#include "NavBooks.h"
-#include "NavRenderText.h"
-
-#include "NavFind.h"
-#include <swordce.h>
-#include <swmgr.h>
-
-#include <url.h>
-
-using namespace sword;
-
-extern SWConfig *g_swordConf;
-
-#define WIDTH 240
-#define HEIGHT 294
-
-RECT RECT_SCREEN;// = {0,0,240,294};
-
-RECT RECT_SELECTLABEL = {4,4,120,20};
-
-RECT RECT_POSITION = {164,4,236,20};
-
-RECT RECT_FIELD = {6,24,240,250};
-
-
-SimpleNavigator::SimpleNavigator(RECT* screen) {
- RECT_SCREEN=*screen;
- mode=-1;
- nextID = 1;
- chapterCache=false;
- books=pages[MODE_BOOK]=new NavBooks(this);
- chapters=pages[MODE_CHAP]=new NavChap(this);
- verses=pages[MODE_VERSE]=new NavVerse(this);
- text=pages[MODE_TEXT]=new NavRenderText(this);
- find=pages[MODE_FIND]=new NavFind(this);
- menus[MODE_BOOK]=MENU_BOOK;
- menus[MODE_CHAP]=MENU_CHAP;
- menus[MODE_VERSE]=MENU_VERSE;
- menus[MODE_TEXT]=MENU_TEXT;
- menus[MODE_FIND]=MENU_FIND;
- optStartID = 0;
- optEndID = 0;
- transStartID = 0;
- transEndID = 0;
- options = 0;
- opCount = 0;
-
- SWModule *mod = SwordIndex::manager->getModule((*g_swordConf)["History"].getWithDefault("LastVersion", "KJV"));
- if (mod) {
- position.setModule(SwordIndex::manager->getModule((*g_swordConf)["History"].getWithDefault("LastVersion", "KJV")));
- }
- else setModule(transStartID); // if defaults not present, start with first module found
- sword::VerseKey key = sword::VerseKey((*g_swordConf)["History"].getWithDefault("LastPassage", "Gen 1:1"));
- position.setVerseKey(&key);
-}
-
-SimpleNavigator::~SimpleNavigator() {
- delete books;
- delete chapters;
- delete verses;
- delete text;
- delete find;
- if (options){
- delete [] options;
- }
- saveState();
-}
-
-void SimpleNavigator::saveState(){
- (*g_swordConf)["History"]["LastPassage"] = position.verseToString().c_str();
- (*g_swordConf)["History"]["LastVersion"] = position.getModName();
-}
-
-void SimpleNavigator::refresh() {
- refreshScreen();
-}
-
-void SimpleNavigator::setModule(const char *module){
- position.setModule(SwordIndex::manager->getModule(module));
-}
-
-void SimpleNavigator::setMode(int mode) {
- if (this->mode>=0) pages[this->mode]->hide();
- this->mode=mode;
- selectMenu(menus, mode);
- pages[this->mode]->show();
- updateTitle();
- refresh();
-}
-
-void SimpleNavigator::paint() {
- pages[mode]->paint();
-}
-
-void SimpleNavigator::updateTitle() {
- WCString title = position.toString() + " - SwRd";
- setTitle(title);
-}
-
-/* a menu-item is selected (maybe one of the translations) */
-void SimpleNavigator::buttonClicked(int id) {
- if ((id >= transStartID) && (id <= transEndID)) {
- setModule(id);
- checkModuleMenu(id);
- chapterCache=false;
- setMode(mode);
- }
- else if ((id >= optStartID) && (id <= optEndID)) {
- toggleOptionMenu(id);
- chapterCache=false;
- setMode(mode);
- }
- else
- pages[mode]->buttonClicked(id);
-}
-
-bool SimpleNavigator::menuClicked(int id) {
- for (std::map<int,int>::iterator i=menus.begin();i!=menus.end();i++) {
- if (i->second==id) {
- setMode(i->first);
- return true;
- }
- }
- return false;
-}
-
-void SimpleNavigator::keyDown(WPARAM id, LPARAM lparam) {
- pages[mode]->keyDown(id,lparam);
-}
-
-void SimpleNavigator::mouseDown(int x, int y) {
- pages[mode]->userTap(x,y);
-}
-
-void SimpleNavigator::setBook(int number) {
- position.setBook(number);
- chapterCache=false;
-}
-
-void SimpleNavigator::setChap(int number) {
- position.setChap(number);
- chapterCache=false;
-}
-
-void SimpleNavigator::setVerse(int number) {
- position.setVerse(number);
-}
-
-void SimpleNavigator::fillTranslationsMenu(HMENU menuTranslations) {
- transStartID = nextID;
- this->menuTranslations=menuTranslations;
- if (menuTranslations) {
- for (ModuleMap::iterator i=position.firstModule();i!=position.lastModule();i++) {
- if(strcmp(i->first, position.getModName()) == 0)
- addMenu(menuTranslations, MF_CHECKED, nextID++, i->first);
- else
- addMenu(menuTranslations, 0, nextID++, i->first);
- }
- }
- // The following line is now handled above. -- dctrotz
- //checkModuleMenu(transStartID);
- transEndID = nextID - 1;
-}
-
-void SimpleNavigator::fillGlobalOptionsMenu(HMENU menuOptions) {
- StringList::iterator i;
-
- if (menuOptions) {
- if (options)
- delete [] options;
- optStartID = nextID;
- this->menuOptions=menuOptions;
- StringList optionNames = position.manager->getGlobalOptions();
-
- // count options
- opCount = 0;
- for (i = optionNames.begin(); i != optionNames.end(); i++) {
- StringList values = position.manager->getGlobalOptionValues(*i);
- bool supported = true;
- for (StringList::iterator j = values.begin(); j != values.end(); j++) {
- if ((*j != "On") && (*j != "Off"))
- supported = false;
- }
- if (supported)
- opCount++;
- }
-
- options = new SWBuf[opCount];
-
- // add options;
- for (i = optionNames.begin(); i != optionNames.end(); i++) {
-// HMENU menuOption = CreatePopupMenu();
-// InsertMenu(menuOptions,0,MF_POPUP,(UINT)menuOption, toUString(i->c_str()).c_str());
- StringList values = position.manager->getGlobalOptionValues(*i);
- bool supported = true;
- for (StringList::iterator j = values.begin(); j != values.end(); j++) {
-// addMenu(menuOption, nextID++, toUString(j->c_str()));
- if ((*j != "On") && (*j != "Off"))
- supported = false;
- }
- if (supported) {
- options[nextID - optStartID] = *i;
- addMenu(menuOptions, 0, nextID++, i->c_str());
- }
- }
- }
- optEndID = nextID - 1;
- // TODO: if no options, disable options menu
-}
-
-void SimpleNavigator::setModule(int id) {
- int modulenr = transStartID;
- ModuleMap::iterator i;
- for (i=position.firstModule();
- (i!=position.lastModule())&&(id!=modulenr);
- i++) {
- modulenr++;
- };
- if (i!=position.lastModule()) {
- position.setModule(i->second);
- // added - bd 06/01/08
- (*g_swordConf)["History"]["LastModule"] = position.getModName();
- SWModule *mod = SwordIndex::manager->getModule((*g_swordConf)["History"]["LastModule"]);
- if (!strcmp(mod->Type(), "Biblical Texts")) {
- (*g_swordConf)["History"]["LastBible"] = position.getModName();
- }
- else if (!strcmp(mod->Type(), "Commentaries")) {
- (*g_swordConf)["History"]["LastComment"] = position.getModName();
- }
- // end added code - bd 06/01/08
- }
-}
-
-
-void SimpleNavigator::checkModuleMenu(int id) {
- int current=transStartID;
- for (ModuleMap::iterator i=position.firstModule();i!=position.lastModule();i++) {
- checkMenu(menuTranslations,current,(current==id));
- current++;
- }
-}
-
-
-void SimpleNavigator::toggleOptionMenu(int id) {
- if (options) {
- for (int i = optStartID; i <= optEndID; i++) {
- SWBuf val = position.manager->getGlobalOption(options[i-optStartID]);
- if (i == id) {
- val = (val=="On")?"Off":"On";
- position.manager->setGlobalOption(options[i-optStartID], val);
- }
- checkMenu(menuOptions, i, (val == "On"));
- }
- }
-}
-
-void SimpleNavigator::urlClicked(const WCHAR *target) {
- const int BUF_SIZE = 2048;
- char target_cstr[BUF_SIZE];
- const char * t = wstrtostr(target_cstr, target, BUF_SIZE);
- wchar_t buf[BUF_SIZE];
-
- SWKey *modKey = 0;
- // MessageBox(0, strtowstr(t), L"This is 't'", MB_OK);
- // SWMgr swmanager; // don't create new manager - use SwordIndex::manager
- // Footnote MessageBox
- WCString oldPos = position.verseToString(); // information to restore the persistent key
- if (strstr(t, "showNote")) {
- URL footnote(t); // t is char* to URL string
- SWBuf module = footnote.getParameterValue("module");
- SWBuf key = footnote.getParameterValue("passage");
- SWBuf footnoteNumber = footnote.getParameterValue("value");
- // Now that you have extracted all the info you need from the URL,
- // you can lookup the footnote...
- // get the module it's in
- SWModule *mod = SwordIndex::manager->getModule(module); // Thanks Troy for above ... Nov 2007
- // set that module to the correct entry
- // TODO - may need to re-set this afterwards - could save int SimpleNavigator::getID();
- modKey = mod->getKey(); // get the persistent key
- modKey->setText(key.c_str()); // set the key itself
- // force a parse of the entry
- mod->RenderText();
- SWBuf body = mod->getEntryAttributes()["Footnote"][footnoteNumber]["body"];
- const char *Body = mod->RenderText(body.c_str()); // RenderText not StripText used
- // MessageBox can't display html - need to strip out tagged stuff; but Greek works OK
- // FIX ME
- MessageBox(0, (LPCWSTR)Body, L"Footnote", MB_OK); //
- }
- // Strongs number MessageBox
- else if (strstr(t, "showStrongs")) {
- URL footnote(t); // t is char* to URL string
- SWBuf type = footnote.getParameterValue("type");
- SWBuf number = footnote.getParameterValue("value");
- SWModule *mod = 0;
- if(strstr(type.c_str(), "Greek"))
- mod = SwordIndex::greekLex;
- if(strstr(type.c_str(), "Hebrew"))
- mod = SwordIndex::hebrewLex;
- if (! mod) {
- MessageBox(0, L"No Dictionary found - install Strong's modules",
- L"Strong's", MB_OK);
- return;
- }
- modKey = mod->getKey();
- modKey->setText(number.c_str());
- mod->RenderText();
- MessageBox(0, strtowstr(buf, mod->StripText(), BUF_SIZE), L"Strong's", MB_OK);
- }
- // Morph MessageBox
- else if (strstr(t, "showMorph")) {
- URL footnote(t); // t is char* to URL string
- SWBuf type = footnote.getParameterValue("type");
- SWBuf number = footnote.getParameterValue("value");
- SWModule *mod = 0;
- if(strstr(type.c_str(), "robinson")) {
- mod = SwordIndex::greekMorph;
- if (! mod) {
- MessageBox(0, L"No Greek parsing Dictionary found - install Morphological modules",
- L"Greek Morphological tags", MB_ICONWARNING);
- return;
- }
- }
- if(strstr(type.c_str(), "strongMorph")) {
- mod = SwordIndex::hebrewMorph;
- if (! mod) {
- MessageBox(0, L"No Hebrew parsing Dictionary found - install Morphological modules",
- L"Hebrew Morphological tags", MB_ICONWARNING);
- return;
- }
- }
- modKey = mod->getKey();
- modKey->setText(number.c_str());
- mod->RenderText();
- MessageBox(0, strtowstr(buf, mod->StripText(), BUF_SIZE), L"Morph tags", MB_OK);
- }
- // X-Ref MessageBox
- else if (strstr(t, "scripRef")) {
- URL footnote(t); // t is char* to URL string
- SWBuf module = footnote.getParameterValue("module"); // very unlikely to have this
- SWBuf key = footnote.getParameterValue("value");
- // get the last bible module used and get xRefs from this version
- SWModule *mod = SwordIndex::manager->getModule((*g_swordConf)["History"]["LastBible"]);
- // will fail if user has never looked at a bible - possible??? so check ....
- if (!mod) {
- MessageBox(0, L"xRef bible not found",
- L"Cross referencing", MB_ICONWARNING);
- return;
- }
- modKey = mod->getKey(); // get the persistent key
- modKey->setText(key.c_str()); // set the key itself
- mod->RenderText();
- // strip out html if present
- SWBuf body = mod->StripText();
- // not sure if MessageBox can display html - if it can, re-think this some day
- MessageBox(0, strtowstr(buf, body, BUF_SIZE), L"Scripture reference", MB_OK);
- }
-
- else //comment next line out in release version
- MessageBox(0, strtowstr(buf, t, BUF_SIZE), L"Raw entry unresolved", MB_OK); // catch all
- modKey->setText((const char *)oldPos.c_str()); // restore the key before leaving
-}
-
-
-int SimpleNavigator::getID() {
- return nextID++;
-}
-
Deleted: trunk/src/SwordReader_GUI/SimpleNavigator.h
===================================================================
--- trunk/src/SwordReader_GUI/SimpleNavigator.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/SimpleNavigator.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,104 +0,0 @@
-#ifndef SIMPLENAVIGATOR_H
-#define SIMPLENAVIGATOR_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-
-#include "utils.h"
-#include "SwordIndex.h"
-#include "NavPage.h"
-
-//using namespace sword;
-
-#define NUM_MENUS 5
-
-#define MODE_BOOK 0
-#define MODE_CHAP 1
-#define MODE_VERSE 2
-#define MODE_TEXT 3
-#define MODE_FIND 4
-
-#define BUTTON_BACKGROUND 0x00A0A0A0
-
-extern RECT RECT_SCREEN;
-
-class NavNumbers;
-class NavBooks;
-class NavRenderText;
-class NavFind;
-
-class SimpleNavigator
-{
-protected:
- std::map<int,NavPage*> pages;
- std::map<int,int> menus;
- int mode;
-
- HMENU menuTranslations;
- HMENU menuOptions;
-
- int nextID;
- int transStartID;
- int transEndID;
- int optStartID;
- int optEndID;
- SWBuf *options;
- int opCount;
- WCString getVerseHeader();
-
- void setModule(int id);
- void checkModuleMenu(int id);
-
-public:
- SwordIndex position;
- NavPage* chapters;
- NavPage* verses;
- NavPage* books;
- NavPage* text;
- NavPage* find;
-
- SimpleNavigator(RECT* screen);
- virtual ~SimpleNavigator();
-
- void saveState();
-
- // Navigation
- void setBook(int number);
- void setChap(int number);
- void setVerse(int number);
- void setModule(const char *module);
-
- int getBook() {return position.getBook();};
- int getChap() {return position.verse->Chapter();};
- int getVerse() {return position.verse->Verse();};
-
- int chapCount() {return position.chapCount();}
- int verseCount() {return position.verseCount();}
-
- // Change user interface
- void updateTitle();
- void fillTranslationsMenu(HMENU menuTranslations);
- void fillGlobalOptionsMenu(HMENU menuTranslations);
- void toggleOptionMenu(int id);
-
- // Interface with pages
- int getID();
- void setMode(int mode);
- bool chapterCache; // to be set to false if 'text' should reload
- // its chapter
- void refresh();
-
- // Interface with system
- bool initialized() {return position.initialized();}
- void buttonClicked(int id);
- void keyDown(WPARAM id, LPARAM lparam);
- void urlClicked(const WCHAR *target);
- bool menuClicked(int id);
- void mouseDown(int x, int y);
- void paint();
-};
-
-#endif
-
Deleted: trunk/src/SwordReader_GUI/TextControl.cpp
===================================================================
--- trunk/src/SwordReader_GUI/TextControl.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/TextControl.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,181 +0,0 @@
-#include "ApplicationInterface.h"
-#include "TextControl.h"
-
-#include <swordce.h>
-
-//#define NOHTML
-
-#ifndef NOHTML
-
-// The sophisticated graphical representation, using an HTML component
-
-#include <htmlctrl.h>
-
-//#define debugfile
-
-#ifdef debugfile
- #include <stdio.h>
- FILE* file;
- #define addHtml(window,text) SendMessage(window, DTM_ADDTEXTW, FALSE, (LPARAM)text);fwprintf(file,text);
-#else
- #define addHtml(window,text) SendMessage(window, DTM_ADDTEXTW, FALSE, (LPARAM)text)
-#endif
-
-#define setZoom(window,zoom) SendMessage(window, DTM_ZOOMLEVEL, 0, zoom);
-#define clearHtml(window) SendMessage(window, DTM_CLEAR, 0, 0);
-#define endHtml(window) SendMessage(window, DTM_ENDOFSOURCE, 0, 0);
-#define controlToVerse(window,versenr) SendMessage(window, DTM_ANCHORW, FALSE, (LPARAM)(toUString(versenr).c_str()))
-
-TextControl::TextControl(int x, int y, int width, int height, bool preview){
- this->preview = preview;
- primed = false;
- if(width < height)
- portrait = true;
-
- VERIFY(InitHTMLControl(g_hInst));
- 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);
- 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(htmlPrimed, 1);
- setZoom(htmlFull, 1);
- i = 0;
- ShowWindow(htmlFull,SW_HIDE);
-}
-
-TextControl::~TextControl(){
-}
-
-void TextControl::show() {
- if(preview)
- ShowWindow(htmlPrimed,SW_SHOW);
- else if(primed){
- ShowWindow(htmlFull,SW_SHOW);
- ShowWindow(htmlPrimed,SW_HIDE);
- }else{
- ShowWindow(htmlPrimed,SW_SHOW);
- ShowWindow(htmlFull,SW_HIDE);
- }
-
-}
-
-void TextControl::focus() {
- if(primed)
- SetFocus(htmlFull);
- else
- SetFocus(htmlPrimed);
-}
-
-void TextControl::hide() {
- ShowWindow(htmlPrimed,SW_HIDE);
- ShowWindow(htmlFull,SW_HIDE);
-}
-
-void TextControl::paint() {
- if(preview)
- return;
- // Detect if we switched from portrait to landscape. If so lets resize the window appropiately.
- int width = GetSystemMetrics(SM_CXSCREEN);
- int height = GetSystemMetrics(SM_CYSCREEN);
- if(width < height && !portrait){
- portrait = 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(htmlPrimed,0,0,width,height - 2*MENU_HEIGHT, TRUE);
- MoveWindow(htmlFull,0,0,width,height - 2*MENU_HEIGHT, TRUE);
- }
-}
-
-void TextControl::moveTo(int x, int y, int width, int height){
- MoveWindow(htmlPrimed, x, y, width, height, TRUE);
- MoveWindow(htmlFull, x, y, width, height, TRUE);
-}
-
-void TextControl::clearText() {
- clearHtml(htmlPrimed);
- clearHtml(htmlFull);
- primed = false;
- i = 0;
- buffer.clear();
-}
-
-void TextControl::addText(const WCString &text) {
- buffer+=text;
-
- if(!preview && !primed && buffer.length() > 1500){
- clearHtml(htmlPrimed);
- addHtml(htmlPrimed,buffer.w_str());
- addHtml(htmlPrimed, L"</body></html>");
- endHtml(htmlPrimed);
- ShowWindow(htmlPrimed,SW_SHOW);
- ShowWindow(htmlFull,SW_HIDE);
- UpdateWindow(g_hWnd);
- primed = true;
- }
-}
-
-void TextControl::endOfText() {
-
- if(preview){
- addHtml(htmlPrimed,buffer.w_str());
- endHtml(htmlPrimed);
- }else{
- addHtml(htmlFull,buffer.w_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;
- }
-#ifdef LOG_TEXT_TO_FILE
- FILE *fp = fopen("\\Storage Card\\Program Files\\sword\\text.txt", "w");
- fwrite(buffer.c_str(), buffer.length(), 2, fp);
- fclose(fp);
-#endif
-}
-
-#else //ifndef NOHTML
-
-// A simpeler graphical representation not using the HTML component
-
-TextControl::TextControl(int x, int y, int width, int height){
- area.left=x; area.top=y; area.right=x+width; area.bottom=y+height;
-}
-
-TextControl::~TextControl(){
-}
-
-void TextControl::show() {
-}
-
-void TextControl::hide() {
-}
-
-void TextControl::paint() {
- RECT textArea=area;
- textArea.top+=drawVerseText(&textArea,buffer);
- clearRect(&textArea);
-}
-
-void TextControl::clearText() {
- buffer=L"";
-}
-
-void TextControl::addText(UString text) {
- buffer+=noMarkup(text);
-}
-
-void TextControl::endOfText() {
- refreshScreen();
-}
-
-#endif
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/TextControl.h
===================================================================
--- trunk/src/SwordReader_GUI/TextControl.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/TextControl.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,35 +0,0 @@
-#ifndef TEXTCONTROL_H
-#define TEXTCONTROL_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include <map>
-
-class TextControl {
-public:
- TextControl(int x, int y, int width, int height, bool preview = false);
- void moveTo(int x, int y, int width, int height);
- virtual ~TextControl();
-
- void show();
- void hide();
- void focus();
- virtual void paint();
-
- virtual void clearText();
- void addText(const WCString &text);
- void endOfText();
-protected:
- HWND htmlPrimed;
- HWND htmlFull;
- WCString buffer;
- RECT area;
- bool portrait;
- bool preview;
- bool primed;
- int i;
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/Utils.cpp
===================================================================
--- trunk/src/SwordReader_GUI/Utils.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/Utils.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,79 +0,0 @@
-#include "Utils.h"
-#include "ApplicationInterface.h"
-
-/*
-WCHAR CharToUchar(const char in){
- WCHAR result;
- mbstowcs(&result,&in,1);
- return result;
-}
-
-
-char UcharToChar(const WCHAR in){
- char result;
- wcstombs(&result,&in,1);
- return result;
-}
-
-UString toUString(int i) {
- TCHAR buffer[12];
- return UString(_itow(i, buffer, 10));
-}
-
-String toCString(int i) {
- char buffer[12];
- return String(_itoa(i, buffer, 10));
-}
-
-UString *toUString(UString& dst,const std::string src) {
- dst.resize(src.length());
- for(unsigned int i = 0; i < dst.length(); i++){
- dst[i] = CharToUchar(src[i]);
- }
- return &dst;
-}
-
-std::string toCString(UString s) {
- std::string result(s.length(),' ');
- for(int i = 0; i < result.length(); i++){
- result[i] = UcharToChar(s[i]);
- }
- return result;
-}
-
-UString noMarkup(UString in) {
- bool inTag=false;
- bool inEntity=false;
- UString::iterator pos;
- UString result;
- for(pos=in.begin();pos!=in.end();pos++) {
- if ((inTag)&&(*pos==L'>')) inTag=false;
- else if ((!inTag)&&(*pos==L'<')) inTag=true;
- else if ((!inEntity)&&(*pos==L'&')) inEntity=true;
- else if ((inEntity)&&(*pos==L';')) { inEntity=false; result+=L' '; } //probably
- else if ((!inTag)&&(!inEntity)&&(*pos!=L'\n')) result+=*pos;
- }
- return result;
-}
-*/
-bool inPortraitMode(){
- return GetSystemMetrics(SM_CXSCREEN) <= GetSystemMetrics(SM_CYSCREEN);
-}
-
-void LOGIT(const char *msg)
-{
-#ifdef __DEBUG__
- FILE *fp2 = fopen("\\Storage Card\\Program Files\\sword\\init_log.txt", "a");
- fprintf(fp2, msg);
- fclose(fp2);
-#endif // __DEBUG__
-}
-
-void LOGIT(const char *msg, int i)
-{
-#ifdef __DEBUG__
- FILE *fp2 = fopen("\\Storage Card\\Program Files\\sword\\init_log.txt", "a");
- fprintf(fp2, msg, i);
- fclose(fp2);
-#endif // __DEBUG__
-}
Deleted: trunk/src/SwordReader_GUI/Utils.h
===================================================================
--- trunk/src/SwordReader_GUI/Utils.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/Utils.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,35 +0,0 @@
-#ifndef UTILS_H
-#define UTILS_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include <swbuf.h>
-#include <string>
-#include <map>
-#include <vector>
-
-// This file is a library containing several utilities that can be used throughout the program
-
-/*
-
-typedef std::basic_string<WCHAR> UString;
-typedef std::string String;
-
-UString toUString(int i);
-
-String toCString(int i);
-
-UString *toUString(UString& dst,const std::string src);
-
-String toCString(UString s);
-
-UString noMarkup(UString in);
-*/
-bool inPortraitMode();
-
-void LOGIT(const char *msg, int i);
-void LOGIT(const char *msg);
-
-#endif
Deleted: trunk/src/SwordReader_GUI/VerseTextControl.cpp
===================================================================
--- trunk/src/SwordReader_GUI/VerseTextControl.cpp 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/VerseTextControl.cpp 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,89 +0,0 @@
-#include "ApplicationInterface.h"
-#include "VerseTextControl.h"
-
-#include <swordce.h>
-
-//#define NOHTML
-
-#ifndef NOHTML
-
-#include <htmlctrl.h>
-
-#define controlToVerse(window,versenr) SendMessage(window, DTM_ANCHORW, FALSE, (LPARAM)(versenr))
-
-VerseTextControl::VerseTextControl(int x, int y, int width, int height)
- : TextControl(x,y,width,height) {}
-
-void VerseTextControl::addAnchoredText(const WCString &text, int anchor) {
- // anchor is assumed to be embedded in the text
- addText(text);
-}
-
-void VerseTextControl::gotoAnchor(int anchor) {
- wchar_t wanchor[16];
- _itow(anchor, wanchor, 10);
- if(!primed || preview)
- controlToVerse(htmlPrimed,wanchor);
- else
- controlToVerse(htmlFull,wanchor);
-}
-
-void VerseTextControl::paint() {
- TextControl::paint();
-}
-
-void VerseTextControl::clearText() {
- TextControl::clearText();
-}
-
-#else //ifndef NOHTML
-
-VerseTextControl::VerseTextControl(int x, int y, int width, int height)
- : TextControl(x,y,width,height) {
- currentAnchor=-1;
-}
-
-void VerseTextControl::paint() {
- AnchorIterator current=anchorPositions.find(currentAnchor);
- if (current==(AnchorIterator)anchorPositions.end()) {
- current=anchorPositions.begin();
- // no or invalid anchor, start at the first anchor
- }
- RECT textArea=area;
- int start, end;
- if (current==(AnchorIterator)anchorPositions.end()) start=0;
- else start=current->second;
- while (textArea.top<textArea.bottom) {
- if (current==(AnchorIterator)anchorPositions.end())
- end=buffer.length();
- else {
- current++;
- end=(current==(AnchorIterator)anchorPositions.end())?buffer.length():current->second;
- }
- if (end<=start) {
- clearRect(&textArea);
- break; // no more text left
- }
- textArea.top+=drawVerseText(&textArea,buffer.substr(start, end-start));
- start=end;
- }
-}
-
-void VerseTextControl::clearText() {
- TextControl::clearText();
- currentAnchor=-1;
- anchorPositions.clear();
-}
-
-
-void VerseTextControl::addAnchoredText(UString text, int anchor) {
- anchorPositions[anchor]=buffer.length();
- addText(text);
-}
-
-void VerseTextControl::gotoAnchor(int anchor) {
- currentAnchor=anchor;
- refreshScreen();
-}
-
-#endif
\ No newline at end of file
Deleted: trunk/src/SwordReader_GUI/VerseTextControl.h
===================================================================
--- trunk/src/SwordReader_GUI/VerseTextControl.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/VerseTextControl.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,26 +0,0 @@
-#ifndef VERSETEXTCONTROL_H
-#define VERSETEXTCONTROL_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "TextControl.h"
-
-class VerseTextControl: public TextControl {
-public:
- VerseTextControl(int x, int y, int width, int height);
- ~VerseTextControl() {}
- void addAnchoredText(const WCString &text, int anchor);
- // we are able to scroll back to this point using the anchor
- void gotoAnchor(int anchor);
-
- virtual void paint();
- virtual void clearText();
-protected:
- std::map<int,int> anchorPositions; // in case of plain text
- typedef std::map<int,int>::const_iterator AnchorIterator;
- int currentAnchor;
-};
-
-#endif
Deleted: trunk/src/SwordReader_GUI/newres.h
===================================================================
--- trunk/src/SwordReader_GUI/newres.h 2008-05-23 03:40:02 UTC (rev 136)
+++ trunk/src/SwordReader_GUI/newres.h 2008-05-23 03:56:22 UTC (rev 137)
@@ -1,41 +0,0 @@
-#ifndef __NEWRES_H__
-#define __NEWRES_H__
-
-#if !defined(UNDER_CE)
-#define UNDER_CE _WIN32_WCE
-#endif
-
-#if defined(_WIN32_WCE)
- #if !defined(WCEOLE_ENABLE_DIALOGEX)
- #define DIALOGEX DIALOG DISCARDABLE
- #endif
- #include <commctrl.h>
- #define SHMENUBAR RCDATA
- #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300)
- #include <aygshell.h>
- #define AFXCE_IDR_SCRATCH_SHMENU 28700
- #else
- #define I_IMAGENONE (-2)
- #define NOMENU 0xFFFF
- #define IDS_SHNEW 1
-
- #define IDM_SHAREDNEW 10
- #define IDM_SHAREDNEWDEFAULT 11
- #endif // _WIN32_WCE_PSPC
- #define AFXCE_IDD_SAVEMODIFIEDDLG 28701
-#endif // _WIN32_WCE
-
-#ifdef RC_INVOKED
-#ifndef _INC_WINDOWS
-#define _INC_WINDOWS
- #include "winuser.h" // extract from windows header
- #include "winver.h"
-#endif
-#endif
-
-#ifdef IDC_STATIC
-#undef IDC_STATIC
-#endif
-#define IDC_STATIC (-1)
-
-#endif //__NEWRES_H__
More information about the sword-cvs
mailing list