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.2 by maloninc, Wed Oct 5 04:55:48 2005 UTC revision 1.4 by maloninc, Thu Oct 6 05:29:01 2005 UTC
# Line 29  END_EVENT_TABLE() Line 29  END_EVENT_TABLE()
29    
30  mnFrameController::mnFrameController(mnFrame* inframe)  mnFrameController::mnFrameController(mnFrame* inframe)
31  {  {
         wxString* dirName = new wxString();  
         wxString gotDirName;  
         wxDirDialog* dlg;  
   
32          frame = inframe;          frame = inframe;
   
         /* create wiki model */  
         wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));  
         if(config->Read(wxT(CONF_WIKI_DIR), dirName) == FALSE) {  
                 delete dirName;  
                 dlg = new wxDirDialog(frame);  
                 if(dlg->ShowModal() == wxID_OK) {  
                         gotDirName = dlg->GetPath();  
                         config->Write(wxT(CONF_WIKI_DIR), gotDirName.c_str());  
                         frame->addNotePanel(&gotDirName);  
                 }  
                 else {  
                         frame->Close();  
                 }  
         }  
         else {  
                 frame->addNotePanel(dirName);  
   
                 wxString testDir(wxT("C:\\wiki_test"));  
                 frame->addNotePanel(&testDir);  
         }  
   
         delete config;  
33  }  }
34    
35  void mnFrameController::handleConfig(wxCommandEvent& event)  void mnFrameController::handleConfig(wxCommandEvent& event)
# Line 132  void mnFrameController::handleAbout(wxCo Line 105  void mnFrameController::handleAbout(wxCo
105    
106  void mnFrameController::handleAddDir(wxCommandEvent& event)  void mnFrameController::handleAddDir(wxCommandEvent& event)
107  {  {
 /*  
108          wxDirDialog* dlg;          wxDirDialog* dlg;
109          wxString gotDirName;          wxString gotDirName;
110          wxString* dirName = new wxString();          wxString* dirName = new wxString();
111          wxString  confKey;          
   
         wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));  
   
112          dlg = new wxDirDialog(frame);          dlg = new wxDirDialog(frame);
113          if(dlg->ShowModal() == wxID_OK) {          if(dlg->ShowModal() == wxID_OK) {
114                  gotDirName = dlg->GetPath();                  gotDirName = dlg->GetPath();
115                  confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", numOfMemoDir);                  frame->addNotePanel(&gotDirName);
                 config->Write(wxT(CONF_WIKI_DIR), gotDirName.c_str());  
116          }          }
117          delete config;          updateConfig();
 */  
 /*  
  * frame->addNotePanel を最終的に呼び出せばよい  
  * その後、frame->noteBook内の情報をNotePanel毎に一つずつ取り出し  
  * 一つ目をCONF_WIKI_DIR, 二つ目からCONF_WIKI_DIR+1のように設定ファイルに  
  * 記録すればよい  
  * 記録前に以前の記録をすべて削除するために、DeleteAllを呼ぶこと  
  */  
118  }  }
119    
120  void mnFrameController::handleRemoveDir(wxCommandEvent& event)  void mnFrameController::handleRemoveDir(wxCommandEvent& event)
121  {  {
122            frame->removeSelectedNotePanel();
123            updateConfig();
124    }
125    
126    void mnFrameController::updateConfig()
127    {
128            wxString  confKey;
129            wxNotebook* notebook;
130            mnNotePanel* panel;
131    
132            wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));
133            config->DeleteAll();
134            notebook = frame->getNotebook();
135            int count = notebook->GetPageCount();
136            for(int i = 0; i < count; i++) {
137                    panel = (mnNotePanel*)notebook->GetPage(i);
138                    const wxString* dataDir = panel->getController()->getWikiDataDir();
139    
140                    if(i == 0){
141                            config->Write(wxT(CONF_WIKI_DIR), dataDir->c_str());
142                    }
143                    else{
144                            confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", i);
145                            config->Write(confKey.c_str(), dataDir->c_str());
146                    }
147            }
148            delete config;
149  }  }

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

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