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.3 by maloninc, Wed Oct 5 07:20:56 2005 UTC
# Line 32  mnFrameController::mnFrameController(mnF Line 32  mnFrameController::mnFrameController(mnF
32          wxString* dirName = new wxString();          wxString* dirName = new wxString();
33          wxString gotDirName;          wxString gotDirName;
34          wxDirDialog* dlg;          wxDirDialog* dlg;
35            wxString confKey;
36    
37          frame = inframe;          frame = inframe;
38    
# Line 52  mnFrameController::mnFrameController(mnF Line 53  mnFrameController::mnFrameController(mnF
53          else {          else {
54                  frame->addNotePanel(dirName);                  frame->addNotePanel(dirName);
55    
56                  wxString testDir(wxT("C:\\wiki_test"));                  for(int i = 1; ;i++) {
57                  frame->addNotePanel(&testDir);                          confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", i);
58                            if(config->Read(confKey.c_str(), dirName) == FALSE) break;
59                            frame->addNotePanel(dirName);
60                    }
61                    frame->getNotebook()->SetSelection(0);
62          }          }
63    
64          delete config;          delete config;
# Line 132  void mnFrameController::handleAbout(wxCo Line 137  void mnFrameController::handleAbout(wxCo
137    
138  void mnFrameController::handleAddDir(wxCommandEvent& event)  void mnFrameController::handleAddDir(wxCommandEvent& event)
139  {  {
 /*  
140          wxDirDialog* dlg;          wxDirDialog* dlg;
141          wxString gotDirName;          wxString gotDirName;
142          wxString* dirName = new wxString();          wxString* dirName = new wxString();
143          wxString  confKey;          
   
         wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));  
   
144          dlg = new wxDirDialog(frame);          dlg = new wxDirDialog(frame);
145          if(dlg->ShowModal() == wxID_OK) {          if(dlg->ShowModal() == wxID_OK) {
146                  gotDirName = dlg->GetPath();                  gotDirName = dlg->GetPath();
147                  confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", numOfMemoDir);                  frame->addNotePanel(&gotDirName);
                 config->Write(wxT(CONF_WIKI_DIR), gotDirName.c_str());  
148          }          }
149          delete config;          updateConfig();
 */  
 /*  
  * frame->addNotePanel を最終的に呼び出せばよい  
  * その後、frame->noteBook内の情報をNotePanel毎に一つずつ取り出し  
  * 一つ目をCONF_WIKI_DIR, 二つ目からCONF_WIKI_DIR+1のように設定ファイルに  
  * 記録すればよい  
  * 記録前に以前の記録をすべて削除するために、DeleteAllを呼ぶこと  
  */  
150  }  }
151    
152  void mnFrameController::handleRemoveDir(wxCommandEvent& event)  void mnFrameController::handleRemoveDir(wxCommandEvent& event)
153  {  {
154            frame->removeSelectedNotePanel();
155            updateConfig();
156    }
157    
158    void mnFrameController::updateConfig()
159    {
160            wxString  confKey;
161            wxNotebook* notebook;
162            mnNotePanel* panel;
163    
164            wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));
165            config->DeleteAll();
166            notebook = frame->getNotebook();
167            int count = notebook->GetPageCount();
168            for(int i = 0; i < count; i++) {
169                    panel = (mnNotePanel*)notebook->GetPage(i);
170                    const wxString* dataDir = panel->getController()->getWikiDataDir();
171    
172                    if(i == 0){
173                            config->Write(wxT(CONF_WIKI_DIR), dataDir->c_str());
174                    }
175                    else{
176                            confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", i);
177                            config->Write(confKey.c_str(), dataDir->c_str());
178                    }
179            }
180            delete config;
181  }  }

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

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