[sword-cvs] swordreader/src/gui NavFind.cpp,1.4,1.5 NavFind.h,1.4,1.5
sword@www.crosswire.org
sword@www.crosswire.org
Sat, 20 Mar 2004 08:56:18 -0700
- Previous message: [sword-cvs] swordreader/src/gui ApplicationInterface.h,1.2,1.3 Main.cpp,1.7,1.8 NavBooks.cpp,1.5,1.6 NavBooks.h,1.5,1.6 NavChap.h,1.2,1.3 NavFind.cpp,1.3,1.4 NavFind.h,1.3,1.4 Navigator.cpp,1.9,1.10 Navigator.h,1.8,1.9 NavNumbers.h,1.5,1.6 NavPage.h,1.3,1.4 NavRenderText.cpp,1.10,1.11 NavRenderText.h,1.4,1.5 NavVerse.cpp,1.2,1.3 NavVerse.h,1.2,1.3 resource.h,1.3,1.4 SwordIndex.cpp,1.9,1.10 SwordIndex.h,1.5,1.6
- Next message: [sword-cvs] sword/include gbfredletterwords.h,1.4,1.5 swbuf.h,1.30,1.31 swmodule.h,1.71,1.72
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/core/swordreader/src/gui
In directory www:/tmp/cvs-serv16742
Modified Files:
NavFind.cpp NavFind.h
Log Message:
Completed gui of the search page
Index: NavFind.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/NavFind.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- NavFind.cpp 15 Mar 2004 10:44:35 -0000 1.4
+++ NavFind.cpp 20 Mar 2004 15:56:16 -0000 1.5
@@ -2,20 +2,74 @@
#include "NavFind.h"
#include "Navigator.h"
#include <winuser.h>
+#include <commctrl.h>
+
+#define check(checkButtonHWND) SendMessage(checkButtonHWND,BM_SETCHECK,BST_CHECKED,0);
+#define uncheck(checkButtonHWND) SendMessage(checkButtonHWND,BM_SETCHECK,BST_UNCHECKED,0);
+
+#define RANGEBIBLE 0
+#define RANGETESTAMENT 1
+#define RANGEBOOK 2
+
+#define METHODMULTIWORD 0
+#define METHODEXACTPHRASE 1
NavFind::NavFind(SimpleNavigator* navigator) : NavPage(navigator) {
+
+ InitCommonControls(); //maybe does something for progress bar
+
//this->navigator=navigator;
- goButtonID=navigator->getID();
+ searchID=navigator->getID();
+ rangeBibleID=navigator->getID();
+ rangeTestamentID=navigator->getID();
+ rangeBookID=navigator->getID();
+ methodMultiwordID=navigator->getID();
+ methodExactphraseID=navigator->getID();
+ goID=navigator->getID();
query=L"Busy implementing, id=";
- query+=toUString(goButtonID);
+ query+=toUString(searchID);
queryEdit = CreateWindow(_T("edit"), NULL,
WS_CHILD | ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP | WS_BORDER,
- RECT_SCREEN.left, RECT_SCREEN.top, RECT_SCREEN.right-30, 20,
+ 0, 0, 180, 24,
g_hWnd, NULL, g_hInst, NULL);
- go = CreateWindow(_T("button"), L"Go",
+ search = CreateWindow(_T("button"), L"Search",
WS_CHILD | BS_PUSHBUTTON,
- RECT_SCREEN.right-30, RECT_SCREEN.top, 30, 20,
- g_hWnd, registerID(goButtonID), g_hInst, NULL);
+ 180, 0, 60, 24,
+ g_hWnd, registerID(searchID), g_hInst, NULL);
+ rangeBible = CreateWindow(_T("button"), L"Whole bible",
+ WS_CHILD | BS_RADIOBUTTON,
+ 0,24,120,24, g_hWnd, registerID(rangeBibleID),g_hInst, NULL);
+ rangeTestament = CreateWindow(_T("button"), L"This testament",
+ WS_CHILD | BS_RADIOBUTTON,
+ 0,48,120,24, g_hWnd, registerID(rangeTestamentID),g_hInst, NULL);
+ rangeBook = CreateWindow(_T("button"), L"This book",
+ WS_CHILD | BS_RADIOBUTTON,
+ 0,72,120,24, g_hWnd, registerID(rangeBookID),g_hInst, NULL);
+ methodMultiword = CreateWindow(_T("button"), L"Multi-word",
+ WS_CHILD | BS_RADIOBUTTON,
+ 120,24,120,24, g_hWnd, registerID(methodMultiwordID),g_hInst, NULL);
+ methodExactphrase = CreateWindow(_T("button"), L"Exact phrase",
+ WS_CHILD | BS_RADIOBUTTON,
+ 120,48,120,24, g_hWnd, registerID(methodExactphraseID),g_hInst, NULL);
+ title = CreateWindow(_T("static"),L"",
+ WS_CHILD,
+ 120,72,120,24, g_hWnd, NULL, g_hInst, NULL);
+ check(rangeBible);
+ rangeMode=RANGEBIBLE;
+ check(methodMultiword);
+ methodMode=METHODMULTIWORD;
+
+ results = CreateWindow(_T("listbox"),NULL,
+ WS_CHILD | /*WS_VSCROLL*/ LBS_DISABLENOSCROLL | LBS_NOTIFY | WS_BORDER,
+ 0,96,80,198, g_hWnd, NULL, g_hInst, NULL);
+ progressBar = CreateWindow(PROGRESS_CLASS, L"",
+ WS_CHILD | WS_BORDER | PBS_SMOOTH,
+ 80,96,100,24, g_hWnd, NULL, g_hInst, NULL);
+ go = CreateWindow(_T("button"), L"Go to",
+ WS_CHILD | BS_PUSHBUTTON,
+ 180,96,60,24,
+ g_hWnd, registerID(goID), g_hInst, NULL);
+
}
NavFind::~NavFind() {
@@ -23,27 +77,87 @@
void NavFind::show() {
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);
}
void NavFind::hide() {
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);
}
void NavFind::paint() {
- RECT rect;
- GetWindowRect(queryEdit,&rect);
RECT bottom=RECT_SCREEN;
- bottom.top=rect.bottom-rect.top;
+ bottom.top=120;
+ bottom.left=80;
drawText(&bottom, query);
}
void NavFind::buttonClicked(int id) {
- if (id==goButtonID) {
- query=L"Search for '";
- query+=getText(queryEdit);
- query+=L"' not implemented";
+ if (id==searchID) {
+ query=L"Search not implemented";
+ searchFor(getText(queryEdit));
refreshScreen();
+ } else if (id==rangeBibleID) {
+ check(rangeBible);
+ uncheck(rangeTestament);
+ uncheck(rangeBook);
+ } else if (id==rangeTestamentID) {
+ uncheck(rangeBible);
+ check(rangeTestament);
+ uncheck(rangeBook);
+ } else if (id==rangeBookID) {
+ uncheck(rangeBible);
+ uncheck(rangeTestament);
+ check(rangeBook);
+ } else if (id==methodMultiwordID) {
+ check(methodMultiword);
+ uncheck(methodExactphrase);
+ } else if (id==methodExactphraseID) {
+ check(methodExactphrase);
+ uncheck(methodMultiword);
}
+}
+
+void NavFind::clearResults() {
+ SendMessage (results, LB_RESETCONTENT,0,0);
+}
+
+void NavFind::setProgress(int percent) {
+ SendMessage(progressBar,PBM_SETPOS, percent, 0);
+}
+
+void NavFind::addResult(UString verse) {
+ SendMessage (results, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)verse.c_str());
+}
+
+void NavFind::searchFor(UString query) {
+ clearResults();
+ setProgress(0);
+
+ //test
+ setProgress(50);
+ UString result1=L"Psa 119:172";
+ addResult(result1);
}
Index: NavFind.h
===================================================================
RCS file: /cvs/core/swordreader/src/gui/NavFind.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- NavFind.h 15 Mar 2004 10:44:35 -0000 1.4
+++ NavFind.h 20 Mar 2004 15:56:16 -0000 1.5
@@ -18,11 +18,23 @@
void paint();
void hide();
void buttonClicked(int id);
+ void searchFor(UString query);
private:
//Navigator* navigator;
- HWND queryEdit,go;
- int goButtonID;
+ HWND queryEdit,search;
+ HWND rangeBible, rangeTestament, rangeBook;
+ HWND methodMultiword, methodExactphrase;
+ HWND progressBar, results, title, go, preview;
+ int searchID;
+ int rangeBibleID, rangeTestamentID, rangeBookID;
+ int methodMultiwordID, methodExactphraseID;
+ int goID;
UString query;
+ void clearResults();
+ void setProgress(int percent);
+ void addResult(UString verse);
+ int rangeMode;
+ int methodMode;
};
#endif
- Previous message: [sword-cvs] swordreader/src/gui ApplicationInterface.h,1.2,1.3 Main.cpp,1.7,1.8 NavBooks.cpp,1.5,1.6 NavBooks.h,1.5,1.6 NavChap.h,1.2,1.3 NavFind.cpp,1.3,1.4 NavFind.h,1.3,1.4 Navigator.cpp,1.9,1.10 Navigator.h,1.8,1.9 NavNumbers.h,1.5,1.6 NavPage.h,1.3,1.4 NavRenderText.cpp,1.10,1.11 NavRenderText.h,1.4,1.5 NavVerse.cpp,1.2,1.3 NavVerse.h,1.2,1.3 resource.h,1.3,1.4 SwordIndex.cpp,1.9,1.10 SwordIndex.h,1.5,1.6
- Next message: [sword-cvs] sword/include gbfredletterwords.h,1.4,1.5 swbuf.h,1.30,1.31 swmodule.h,1.71,1.72
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]