| 104 |
|
|
| 105 |
void mnController::handleNewButton(wxCommandEvent& event) |
void mnController::handleNewButton(wxCommandEvent& event) |
| 106 |
{ |
{ |
| 107 |
if(isEditing) return; |
int ans; |
|
|
|
| 108 |
WikiData* wikiData = wiki->newWikiData(); |
WikiData* wikiData = wiki->newWikiData(); |
| 109 |
frame->showNewItem(wikiData); |
wxString plainTextStr; |
| 110 |
saveData(); |
wxString newSubjectStr; |
| 111 |
isEditing = TRUE; |
mnWikiDataEntryDialog* dlg = new mnWikiDataEntryDialog(frame, -1, wxT("Malon Note")); |
| 112 |
|
const wxString* wikiText = wikiData->getText(); |
| 113 |
|
const wxString* subject = wikiData->getSubject(); |
| 114 |
|
|
| 115 |
|
dlg->setSubject(*subject); |
| 116 |
|
dlg->setPlainText(*wikiText); |
| 117 |
|
ans = dlg->ShowModal(); |
| 118 |
|
|
| 119 |
|
if(ans != wxID_OK) return ; |
| 120 |
|
|
| 121 |
|
plainTextStr = dlg->getPlainText(); |
| 122 |
|
newSubjectStr = dlg->getSubject(); |
| 123 |
|
wikiData->modText(&plainTextStr); |
| 124 |
|
wikiData->save(); |
| 125 |
|
|
| 126 |
|
wikiData->modSubject(&newSubjectStr); |
| 127 |
|
|
| 128 |
|
frame->showSearchResult(wiki); |
| 129 |
|
delete dlg; |
| 130 |
} |
} |
| 131 |
|
|
| 132 |
void mnController::handleRemoveButton(wxCommandEvent& event) |
void mnController::handleRemoveButton(wxCommandEvent& event) |
| 211 |
{ |
{ |
| 212 |
wxString plainTextStr; |
wxString plainTextStr; |
| 213 |
wxString newSubjectStr; |
wxString newSubjectStr; |
| 214 |
wxTreeItemData* item = frame->getSelectedItem(); |
wxTreeItemData* itemData = frame->getSelectedItem(); |
| 215 |
|
wxString subject = frame->getSelectedLabel(); |
| 216 |
mnWikiDataEntryDialog* dlg = new mnWikiDataEntryDialog(frame, -1, wxT("Malon Note")); |
mnWikiDataEntryDialog* dlg = new mnWikiDataEntryDialog(frame, -1, wxT("Malon Note")); |
| 217 |
|
int ans; |
| 218 |
|
|
| 219 |
|
if(itemData == NULL) return; |
| 220 |
|
const wxString* wikiText = ((WikiData*)(itemData))->getText(); |
| 221 |
|
|
| 222 |
|
dlg->setSubject(subject); |
| 223 |
|
dlg->setPlainText(*wikiText); |
| 224 |
|
ans = dlg->ShowModal(); |
| 225 |
|
|
|
int ans = frame->showDataEditDialog(dlg); |
|
| 226 |
if(ans != wxID_OK) return ; |
if(ans != wxID_OK) return ; |
| 227 |
if(item == NULL) return ; |
if(itemData == NULL) return ; |
| 228 |
|
|
| 229 |
plainTextStr = dlg->getPlainText(); |
plainTextStr = dlg->getPlainText(); |
| 230 |
newSubjectStr = dlg->getSubject(); |
newSubjectStr = dlg->getSubject(); |
| 231 |
((WikiData*)(item))->modText(&plainTextStr); |
((WikiData*)(itemData))->modText(&plainTextStr); |
| 232 |
((WikiData*)(item))->save(); |
((WikiData*)(itemData))->save(); |
| 233 |
|
|
| 234 |
((WikiData*)(item))->modSubject(&newSubjectStr); |
((WikiData*)(itemData))->modSubject(&newSubjectStr); |
| 235 |
|
|
| 236 |
frame->showSearchResult(wiki); |
frame->showSearchResult(wiki); |
| 237 |
delete dlg; |
delete dlg; |