Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnFrameController.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4 by maloninc, Thu Oct 6 05:29:01 2005 UTC revision 1.6 by maloninc, Fri Oct 7 12:49:26 2005 UTC
# Line 25  BEGIN_EVENT_TABLE(mnFrameController, wxE Line 25  BEGIN_EVENT_TABLE(mnFrameController, wxE
25          EVT_MENU(XRCID("Quit"), mnFrameController::handleExit)          EVT_MENU(XRCID("Quit"), mnFrameController::handleExit)
26          EVT_MENU(wxID_ABOUT, mnFrameController::handleAbout)          EVT_MENU(wxID_ABOUT, mnFrameController::handleAbout)
27          EVT_CLOSE(mnFrameController::handleClose)          EVT_CLOSE(mnFrameController::handleClose)
28            EVT_NOTEBOOK_PAGE_CHANGED(XRCID("noteBook"), mnFrameController::handlePageChange)
29  END_EVENT_TABLE()  END_EVENT_TABLE()
30    
31  mnFrameController::mnFrameController(mnFrame* inframe)  mnFrameController::mnFrameController(mnFrame* inframe)
# Line 112  void mnFrameController::handleAddDir(wxC Line 113  void mnFrameController::handleAddDir(wxC
113          dlg = new wxDirDialog(frame);          dlg = new wxDirDialog(frame);
114          if(dlg->ShowModal() == wxID_OK) {          if(dlg->ShowModal() == wxID_OK) {
115                  gotDirName = dlg->GetPath();                  gotDirName = dlg->GetPath();
116                  frame->addNotePanel(&gotDirName);                  if(isExistConfig(&gotDirName) == false){
117                            frame->addNotePanel(&gotDirName);
118                    }
119                    else {
120                            wxMessageBox(wxT("It already exist in MalonNote"), wxT("Already exist"), wxOK|wxICON_INFORMATION);
121                            return;
122                    }
123          }          }
124          updateConfig();          updateConfig();
125  }  }
# Line 147  void mnFrameController::updateConfig() Line 154  void mnFrameController::updateConfig()
154          }          }
155          delete config;          delete config;
156  }  }
157    
158    bool mnFrameController::isExistConfig(wxString* dir)
159    {
160            wxString* dirName = new wxString();
161            wxString gotDirName;
162            wxDirDialog* dlg;
163            wxString confKey;
164    
165            wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));
166            for(int i = 0; ;i++) {
167                    if(i == 0) {
168                            confKey.sprintf(wxT(CONF_WIKI_DIR));
169                    }
170                    else {
171                            confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", i);
172                    }
173                    if(config->Read(confKey.c_str(), dirName)) {
174                            if(*dir == *dirName) return true;    /* Exist */
175                    }
176                    else {
177                            break;
178                    }
179            }
180            
181            delete dirName;
182            delete config;
183    
184            return false;
185    }
186    
187    
188    void mnFrameController::handlePageChange(wxNotebookEvent& event)
189    {
190            wxNotebook* notebook;
191            mnNotePanel* panel;
192    
193            notebook = frame->getNotebook();
194            panel = (mnNotePanel*)notebook->GetPage(event.GetSelection());
195            const wxString* dataDir = panel->getController()->getWikiDataDir();
196    
197            frame->GetStatusBar()->SetStatusText(*dataDir);
198    }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26