| 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 |
|
wxCursor normal; |
| 118 |
|
wxCursor watch(wxCURSOR_WATCH); |
| 119 |
|
|
| 120 |
|
frame->SetCursor(watch); |
| 121 |
wiki->group(); |
wiki->group(); |
| 122 |
|
frame->clearAllTree(); |
| 123 |
if(autoUpdateMode) |
searchStrList = wiki->getSearchStrList(); |
| 124 |
frame->showSearchResult(wiki, false); |
for(i = 0; i < searchStrList->Count(); i++) { |
| 125 |
else |
wxString& searchStr = searchStrList->Item(i); |
| 126 |
wxLogMessage(wxT("Pleas enable AutoUpdate")); |
frame->addSearchResult(wiki, &searchStr); |
| 127 |
|
} |
| 128 |
|
frame->SetCursor(normal); |
| 129 |
} |
} |
| 130 |
|
|
| 131 |
|
|
| 152 |
|
|
| 153 |
wikiData->modSubject(&newSubjectStr); |
wikiData->modSubject(&newSubjectStr); |
| 154 |
|
|
| 155 |
if(autoUpdateMode) |
notifyUpdate(wikiData); |
| 156 |
frame->showSearchResult(wiki); |
|
| 157 |
delete dlg; |
delete dlg; |
| 158 |
} |
} |
| 159 |
|
|
| 164 |
if(frame->isEditableTreeLabel(frame->getSelection())) { |
if(frame->isEditableTreeLabel(frame->getSelection())) { |
| 165 |
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){ |
| 166 |
((WikiData*)(item))->removeDataFile(); |
((WikiData*)(item))->removeDataFile(); |
| 167 |
|
notifyUpdate((WikiData*)(item)); |
| 168 |
} |
} |
| 169 |
else { |
else { |
| 170 |
return; |
return; |
| 172 |
} |
} |
| 173 |
else { |
else { |
| 174 |
wiki->removeSearchStr(frame->getSelectedLabel()); |
wiki->removeSearchStr(frame->getSelectedLabel()); |
| 175 |
|
frame->removeSelectedItem(); |
| 176 |
} |
} |
| 177 |
|
|
|
if(autoUpdateMode) |
|
|
frame->showSearchResult(wiki); |
|
|
else |
|
|
frame->removeSelectedItem(); |
|
| 178 |
} |
} |
| 179 |
|
|
| 180 |
void mnController::handleHighlightButton(wxCommandEvent& event) |
void mnController::handleHighlightButton(wxCommandEvent& event) |
| 209 |
|
|
| 210 |
if(newSubject.Len() == 0) { |
if(newSubject.Len() == 0) { |
| 211 |
event.Veto(); |
event.Veto(); |
|
if(autoUpdateMode) |
|
|
frame->showSearchResult(wiki); |
|
| 212 |
return; |
return; |
| 213 |
} |
} |
| 214 |
|
|
| 216 |
|
|
| 217 |
event.Veto(); |
event.Veto(); |
| 218 |
|
|
| 219 |
if(autoUpdateMode) |
notifyUpdate((WikiData*)item); |
|
frame->showSearchResult(wiki); |
|
| 220 |
} |
} |
| 221 |
|
|
| 222 |
void mnController::handleClose(wxCloseEvent& event) |
void mnController::handleClose(wxCloseEvent& event) |
| 241 |
|
|
| 242 |
void mnController::handleTreeClear(wxCommandEvent& event) |
void mnController::handleTreeClear(wxCommandEvent& event) |
| 243 |
{ |
{ |
| 244 |
|
wiki->clearSearchStrList(); |
| 245 |
|
wiki->clearSearchResultList(); |
| 246 |
frame->clearAllTree(); |
frame->clearAllTree(); |
| 247 |
} |
} |
| 248 |
|
|
| 286 |
|
|
| 287 |
((WikiData*)(itemData))->modSubject(&newSubjectStr); |
((WikiData*)(itemData))->modSubject(&newSubjectStr); |
| 288 |
|
|
| 289 |
|
notifyUpdate((WikiData*)itemData); |
| 290 |
|
|
| 291 |
|
delete dlg; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
void mnController::notifyUpdate(WikiData* data) |
| 295 |
|
{ |
| 296 |
const wxArrayString* searchStrList= wiki->getSearchStrList(); |
const wxArrayString* searchStrList= wiki->getSearchStrList(); |
| 297 |
char* tokenList[32]; |
char* tokenList[32]; |
| 298 |
|
|
| 299 |
memset(tokenList, 0, sizeof(char*)*32); |
memset(tokenList, 0, sizeof(char*)*32); |
| 300 |
for(int i = 0; i < searchStrList->Count(); i++) { |
for(int i = 0; i < searchStrList->Count(); i++) { |
| 301 |
wxString& searchStr = searchStrList->Item(i); |
wxString& searchStr = searchStrList->Item(i); |
| 302 |
if( wiki->makeSearchToken(searchStr.mb_str(), tokenList) ) { /* create token */ |
if( wiki->makeSearchToken(searchStr.mb_str(), tokenList) ) { /* create token */ |
| 303 |
if(wiki->matchWithToken((wxString*)((WikiData*)(itemData))->getFileName(), tokenList)) { /* match */ |
if(wiki->matchWithToken((wxString*)(data->getFileName()), tokenList)) { /* match */ |
| 304 |
wiki->addSearchResultList(&searchStr, (WikiData*)(itemData)); |
wiki->addSearchResultList(&searchStr, data); |
| 305 |
frame->updateSearchResult(wiki, &searchStr); |
frame->updateSearchResult(wiki, &searchStr); |
| 306 |
} |
} |
| 307 |
else { |
else { /* not match */ |
| 308 |
//wiki->delSearchResultList(searchStr, (WikiData*)(itemData)); |
if( wiki->delSearchResultList(&searchStr, data) ) { |
| 309 |
//frame->updateSearchResult(wiki, &searchStr); |
frame->updateSearchResult(wiki, &searchStr); /* only when suceed to delete */ |
| 310 |
|
} |
| 311 |
} |
} |
| 312 |
|
for(int j = 0; tokenList[j] != NULL; j++) free(tokenList[j]); |
| 313 |
|
memset(tokenList, 0, sizeof(char*)*32); |
| 314 |
} |
} |
| 315 |
} |
} |
| 316 |
delete dlg; |
data->setOldSubjectFromCurrent(); // restore old subject |
| 317 |
} |
} |
| 318 |
|
|
| 319 |
void mnController::handleLinkClick(wxCommandEvent &event) |
void mnController::handleLinkClick(wxCommandEvent &event) |