Browse CVS Repository
Contents of /tombo/Tombo/Src/DetailsViewDlg.cpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.1 -
( show annotations)
( download)
( as text)
Thu Jun 17 19:07:22 2004 UTC
(19 years, 9 months ago)
by hirami
Branch: MAIN
CVS Tags: B155, Tombo_2_0a3, Tombo_2_0a2, Tombo_2_0a1, Tombo_1_17_1, B153, B191, B192, B193, B194, Tombo_1_9b1, B196, B197, B198, B199, B200, B201, B202, B203, B205, B206, B207, B208, SNAPSHOT_20040920, SNAPSHOT_20040925, B183, B181, B180, B187, B186, B184, B189, B188, B213, B212, B211, B217, B216, B215, B214, B219, B218, Tombo_2_0b2, Tombo_2_0b3, Tombo_2_0b1, Tombo_1_9, Tombo_2_0b4, B228, B229, B226, B227, B224, B225, B222, B223, B220, B221, B154, B172, B156, B157, B150, B151, B152, B173, B158, B159, B171, Tombo_1_10, Tombo_1_13, SNAPSHOT20051220, Tombo_1_12, B231, B230, B147, B146, B145, B144, B143, B142, B141, B140, B149, B148, Tombo_1_15, Tombo_1_14, Tombo_1_17, Tombo_1_16, Tombo_1_11, B177, B174, B175, B178, B179, B164, B169, B168, B165, SNAPSHOT_20041121, B166, B161, B160, B163, B162, B138, B139, HEAD
Branch point for: Tombo_2_0alpha_branch, Tombo_1_17_1_branch
File MIME type: text/x-c++src
* major refactoring
- modify MemoDetailsView for multi instance support.
- impliment MemoDetailsViewDlg for support morden PocketPC style but not used in this version.
| 1 |
#include <windows.h> |
| 2 |
#include <tchar.h> |
| 3 |
|
| 4 |
#include <aygshell.h> |
| 5 |
|
| 6 |
#include "Tombo.h" |
| 7 |
#include "resource.h" |
| 8 |
#include "MemoManager.h" |
| 9 |
#include "DialogTemplate.h" |
| 10 |
#include "DetailsViewDlg.h" |
| 11 |
#include "MemoDetailsView.h" |
| 12 |
#include "Property.h" |
| 13 |
#include "MemoNote.h" |
| 14 |
#include "Message.h" |
| 15 |
|
| 16 |
#include "Tombo.h" |
| 17 |
#define NUM_TOOLBAR_BMP 12 |
| 18 |
|
| 19 |
/////////////////////////////////////////////////// |
| 20 |
// view callback |
| 21 |
/////////////////////////////////////////////////// |
| 22 |
|
| 23 |
class DetailsViewDlgCallback : public MemoDetailsViewCallback { |
| 24 |
MemoManager *pMgr; |
| 25 |
DetailsViewDlg *pDlg; |
| 26 |
public: |
| 27 |
DetailsViewDlgCallback(MemoManager *pm, DetailsViewDlg *p) : pMgr(pm), pDlg(p) {} |
| 28 |
void GetFocusCallback(MemoDetailsView *pView); |
| 29 |
void SetModifyStatusCallback(MemoDetailsView *pView); |
| 30 |
void SetReadOnlyStatusCallback(MemoDetailsView *pView); |
| 31 |
|
| 32 |
void SetSearchFlg(BOOL bFlg); |
| 33 |
|
| 34 |
SearchEngineA *GetSearchEngine(MemoDetailsView *pView); |
| 35 |
void GetCurrentSelectedPath(MemoDetailsView *pView, TString *pPath); |
| 36 |
}; |
| 37 |
|
| 38 |
void DetailsViewDlgCallback::GetFocusCallback(MemoDetailsView *pView) {} |
| 39 |
void DetailsViewDlgCallback::SetModifyStatusCallback(MemoDetailsView *pView) |
| 40 |
{ |
| 41 |
pDlg->SetModify(); |
| 42 |
} |
| 43 |
|
| 44 |
void DetailsViewDlgCallback::SetReadOnlyStatusCallback(MemoDetailsView *pView) {} |
| 45 |
void DetailsViewDlgCallback::SetSearchFlg(BOOL bFlg) {} |
| 46 |
|
| 47 |
SearchEngineA *DetailsViewDlgCallback::GetSearchEngine(MemoDetailsView *pView) |
| 48 |
{ |
| 49 |
return pMgr->GetSearchEngine(); |
| 50 |
} |
| 51 |
void DetailsViewDlgCallback::GetCurrentSelectedPath(MemoDetailsView *pView, TString *pPath) |
| 52 |
{ |
| 53 |
pMgr->GetCurrentSelectedPath(pPath); |
| 54 |
} |
| 55 |
|
| 56 |
/////////////////////////////////////////////////// |
| 57 |
// |
| 58 |
/////////////////////////////////////////////////// |
| 59 |
|
| 60 |
DetailsViewDlg::DetailsViewDlg() : pText(NULL) |
| 61 |
{ |
| 62 |
} |
| 63 |
|
| 64 |
DetailsViewDlg::~DetailsViewDlg() |
| 65 |
{ |
| 66 |
delete [] pText; |
| 67 |
} |
| 68 |
|
| 69 |
void DetailsViewDlg::InitDialog(HWND hDlg) |
| 70 |
{ |
| 71 |
hDialog = hDlg; |
| 72 |
|
| 73 |
// set PocketPC style dialog |
| 74 |
SHINITDLGINFO shidi; |
| 75 |
shidi.dwMask = SHIDIM_FLAGS; |
| 76 |
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN; |
| 77 |
shidi.hDlg = hDlg; |
| 78 |
SHInitDialog(&shidi); |
| 79 |
|
| 80 |
// create menu bar |
| 81 |
SHMENUBARINFO mbi; |
| 82 |
memset(&mbi, 0, sizeof(SHMENUBARINFO)); |
| 83 |
mbi.cbSize = sizeof(SHMENUBARINFO); |
| 84 |
mbi.hwndParent = hDlg; |
| 85 |
mbi.nToolBarId = IDM_DETAILSDLG_MENU; |
| 86 |
mbi.hInstRes =g_hInstance; |
| 87 |
mbi.nBmpId = IDB_TOOLBAR; |
| 88 |
mbi.cBmpImages = NUM_TOOLBAR_BMP; |
| 89 |
SHCreateMenuBar(&mbi); |
| 90 |
|
| 91 |
hMenubar = mbi.hwndMB; |
| 92 |
|
| 93 |
RECT r; |
| 94 |
GetClientRect(hDlg, &r); |
| 95 |
|
| 96 |
DetailsViewDlgCallback *pCB = new DetailsViewDlgCallback(pMgr, this); |
| 97 |
SimpleEditor *p = new SimpleEditor(pCB); |
| 98 |
p->Init(pMgr, 2000, 2001); |
| 99 |
p->Create(TEXT("MemoDetailsDlg"), r, hDlg, g_hInstance, g_Property.DetailsViewFont()); |
| 100 |
pView = p; |
| 101 |
|
| 102 |
pView->Show(SW_SHOW); |
| 103 |
pView->SetMemo(pText, 0, FALSE); |
| 104 |
MemoNote::WipeOutAndDelete(pText); |
| 105 |
pText = NULL; |
| 106 |
|
| 107 |
pView->SetModifyStatus(); |
| 108 |
pView->SetFocus(); |
| 109 |
} |
| 110 |
|
| 111 |
BOOL DetailsViewDlg::OnOK() |
| 112 |
{ |
| 113 |
if (pView->IsModify()) { |
| 114 |
int iResult = MessageBox(hDialog, MSG_MEMO_EDITED, MSG_CONFIRM_SAVE, MB_ICONQUESTION | MB_YESNOCANCEL | MB_APPLMODAL); |
| 115 |
if (iResult == IDCANCEL) return FALSE; |
| 116 |
if (iResult == IDYES) { |
| 117 |
delete [] pText; |
| 118 |
pText = NULL; |
| 119 |
} |
| 120 |
// override popup results |
| 121 |
nResult = iResult; |
| 122 |
} |
| 123 |
return TRUE; |
| 124 |
} |
| 125 |
|
| 126 |
DWORD DetailsViewDlg::Popup(HINSTANCE hInst, HWND hParent, MemoManager *p, LPTSTR pt) |
| 127 |
{ |
| 128 |
pText = pt; |
| 129 |
pMgr = p; |
| 130 |
return DialogTemplate::Popup(hInst, IDD_DETAILSVIEW, hParent); |
| 131 |
} |
| 132 |
|
| 133 |
void DetailsViewDlg::SetModify() |
| 134 |
{ |
| 135 |
BOOL bEnable = pView->IsModify(); |
| 136 |
SendMessage(hMenubar, TB_ENABLEBUTTON, IDM_SAVE, MAKELONG(bEnable, 0)); |
| 137 |
} |
| |