| 83 |
} |
} |
| 84 |
delete config; |
delete config; |
| 85 |
|
|
| 86 |
if(autoUpdateMode) |
frame->clearAllTree(); |
|
frame->showSearchResult(wiki); |
|
| 87 |
} |
} |
| 88 |
|
|
| 89 |
void mnController::handleSearch(wxCommandEvent& event) |
void mnController::handleSearch(wxCommandEvent& event) |
| 100 |
return; |
return; |
| 101 |
} |
} |
| 102 |
|
|
| 103 |
wiki->addSearchStr(str); |
if(wiki->addSearchStr(str)) { |
| 104 |
wiki->addSearchList(str, wikiList); |
wiki->addSearchList(str, wikiList); |
| 105 |
|
frame->addSearchResult(wiki, str); |
| 106 |
frame->addSearchResult(wiki, str); |
} |
| 107 |
|
else { /* str is already in search list */ |
| 108 |
|
delete wikiList; |
| 109 |
|
} |
| 110 |
} |
} |
| 111 |
|
|
| 112 |
void mnController::handleGroup(wxCommandEvent& event) |
void mnController::handleGroup(wxCommandEvent& event) |
| 113 |
{ |
{ |
| 114 |
|
WikiList* wikiList; |
| 115 |
|
const wxArrayString* searchStrList; |
| 116 |
|
int i; |
| 117 |
|
|
| 118 |
wiki->group(); |
wiki->group(); |
| 119 |
|
|
| 120 |
if(autoUpdateMode) |
frame->clearAllTree(); |
| 121 |
frame->showSearchResult(wiki, false); |
searchStrList = wiki->getSearchStrList(); |
| 122 |
else |
for(i = 0; i < searchStrList->Count(); i++) { |
| 123 |
wxLogMessage(wxT("Pleas enable AutoUpdate")); |
wxString& searchStr = searchStrList->Item(i); |
| 124 |
|
frame->addSearchResult(wiki, &searchStr); |
| 125 |
|
} |
| 126 |
} |
} |
| 127 |
|
|
| 128 |
|
|
| 149 |
|
|
| 150 |
wikiData->modSubject(&newSubjectStr); |
wikiData->modSubject(&newSubjectStr); |
| 151 |
|
|
| 152 |
if(autoUpdateMode) |
notifyUpdate(wikiData); |
| 153 |
frame->showSearchResult(wiki); |
|
| 154 |
delete dlg; |
delete dlg; |
| 155 |
} |
} |
| 156 |
|
|
| 161 |
if(frame->isEditableTreeLabel(frame->getSelection())) { |
if(frame->isEditableTreeLabel(frame->getSelection())) { |
| 162 |
if(wxMessageBox(wxT("Do you realy remove this memo?\n") + frame->getSelectedLabel(), wxT("Realy?"), wxYES_NO|wxICON_QUESTION) == wxYES){ |
if(wxMessageBox(wxT("Do you realy remove this memo?\n") + frame->getSelectedLabel(), wxT("Realy?"), wxYES_NO|wxICON_QUESTION) == wxYES){ |
| 163 |
((WikiData*)(item))->removeDataFile(); |
((WikiData*)(item))->removeDataFile(); |
| 164 |
|
notifyUpdate((WikiData*)(item)); |
| 165 |
} |
} |
| 166 |
else { |
else { |
| 167 |
return; |
return; |
| 169 |
} |
} |
| 170 |
else { |
else { |
| 171 |
wiki->removeSearchStr(frame->getSelectedLabel()); |
wiki->removeSearchStr(frame->getSelectedLabel()); |
| 172 |
|
frame->removeSelectedItem(); |
| 173 |
} |
} |
| 174 |
|
|
|
if(autoUpdateMode) |
|
|
frame->showSearchResult(wiki); |
|
|
else |
|
|
frame->removeSelectedItem(); |
|
| 175 |
} |
} |
| 176 |
|
|
| 177 |
void mnController::handleHighlightButton(wxCommandEvent& event) |
void mnController::handleHighlightButton(wxCommandEvent& event) |
| 206 |
|
|
| 207 |
if(newSubject.Len() == 0) { |
if(newSubject.Len() == 0) { |
| 208 |
event.Veto(); |
event.Veto(); |
|
if(autoUpdateMode) |
|
|
frame->showSearchResult(wiki); |
|
| 209 |
return; |
return; |
| 210 |
} |
} |
| 211 |
|
|
| 213 |
|
|
| 214 |
event.Veto(); |
event.Veto(); |
| 215 |
|
|
| 216 |
if(autoUpdateMode) |
notifyUpdate((WikiData*)item); |
|
frame->showSearchResult(wiki); |
|
| 217 |
} |
} |
| 218 |
|
|
| 219 |
void mnController::handleClose(wxCloseEvent& event) |
void mnController::handleClose(wxCloseEvent& event) |
| 238 |
|
|
| 239 |
void mnController::handleTreeClear(wxCommandEvent& event) |
void mnController::handleTreeClear(wxCommandEvent& event) |
| 240 |
{ |
{ |
| 241 |
|
wiki->clearSearchStrList(); |
| 242 |
|
wiki->clearSearchResultList(); |
| 243 |
frame->clearAllTree(); |
frame->clearAllTree(); |
| 244 |
} |
} |
| 245 |
|
|
| 283 |
|
|
| 284 |
((WikiData*)(itemData))->modSubject(&newSubjectStr); |
((WikiData*)(itemData))->modSubject(&newSubjectStr); |
| 285 |
|
|
| 286 |
|
notifyUpdate((WikiData*)itemData); |
| 287 |
|
|
| 288 |
|
delete dlg; |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
void mnController::notifyUpdate(WikiData* data) |
| 292 |
|
{ |
| 293 |
const wxArrayString* searchStrList= wiki->getSearchStrList(); |
const wxArrayString* searchStrList= wiki->getSearchStrList(); |
| 294 |
char* tokenList[32]; |
char* tokenList[32]; |
| 295 |
|
|
| 296 |
memset(tokenList, 0, sizeof(char*)*32); |
memset(tokenList, 0, sizeof(char*)*32); |
| 297 |
for(int i = 0; i < searchStrList->Count(); i++) { |
for(int i = 0; i < searchStrList->Count(); i++) { |
| 298 |
wxString& searchStr = searchStrList->Item(i); |
wxString& searchStr = searchStrList->Item(i); |
| 299 |
if( wiki->makeSearchToken(searchStr.mb_str(), tokenList) ) { /* create token */ |
if( wiki->makeSearchToken(searchStr.mb_str(), tokenList) ) { /* create token */ |
| 300 |
if(wiki->matchWithToken((wxString*)((WikiData*)(itemData))->getFileName(), tokenList)) { /* match */ |
if(wiki->matchWithToken((wxString*)(data->getFileName()), tokenList)) { /* match */ |
| 301 |
wiki->addSearchResultList(&searchStr, (WikiData*)(itemData)); |
wiki->addSearchResultList(&searchStr, data); |
| 302 |
frame->updateSearchResult(wiki, &searchStr); |
frame->updateSearchResult(wiki, &searchStr); |
| 303 |
} |
} |
| 304 |
else { |
else { /* not match */ |
| 305 |
//wiki->delSearchResultList(searchStr, (WikiData*)(itemData)); |
if( wiki->delSearchResultList(&searchStr, data) ) { |
| 306 |
//frame->updateSearchResult(wiki, &searchStr); |
frame->updateSearchResult(wiki, &searchStr); /* only when suceed to delete */ |
| 307 |
|
} |
| 308 |
} |
} |
| 309 |
|
for(int j = 0; tokenList[j] != NULL; j++) free(tokenList[j]); |
| 310 |
|
memset(tokenList, 0, sizeof(char*)*32); |
| 311 |
} |
} |
| 312 |
} |
} |
|
delete dlg; |
|
| 313 |
} |
} |
| 314 |
|
|
| 315 |
void mnController::handleLinkClick(wxCommandEvent &event) |
void mnController::handleLinkClick(wxCommandEvent &event) |