Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnFrame.cpp

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

revision 1.9 by maloninc, Wed Aug 3 23:19:01 2005 UTC revision 1.10 by maloninc, Thu Aug 4 05:10:02 2005 UTC
# Line 51  mnFrame::mnFrame(wxWindow* parent, int i Line 51  mnFrame::mnFrame(wxWindow* parent, int i
51    
52          /* create search tree */          /* create search tree */
53          searchItemRoot = searchTree->AddRoot(wxT(LABEL_ITEM_TREE), -1, -1, NULL);          searchItemRoot = searchTree->AddRoot(wxT(LABEL_ITEM_TREE), -1, -1, NULL);
         newItemRoot = searchTree->AppendItem(searchItemRoot, wxT(LABEL_NEW_ITEM), -1, -1, NULL);  
54  }  }
55    
56  void mnFrame::set_properties()  void mnFrame::set_properties()
# Line 61  void mnFrame::set_properties() Line 60  void mnFrame::set_properties()
60      SetSize(wxSize(900, 572));      SetSize(wxSize(900, 572));
61      searchTextCtrl->SetFocus();      searchTextCtrl->SetFocus();
62      // end wxGlade      // end wxGlade
63    
64            wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
65            wikiHtmlTextCtrl->SetFonts(font.GetFaceName(), font.GetFaceName());
66  }  }
67    
68    
# Line 96  void mnFrame::do_layout() Line 98  void mnFrame::do_layout()
98      Layout();      Layout();
99    
100          searchTree->Expand(searchItemRoot);          searchTree->Expand(searchItemRoot);
         searchTree->Expand(newItemRoot);  
101  }  }
102    
103  void mnFrame::showSearchResult(mnModel* wiki)  void mnFrame::showSearchResult(mnModel* wiki)
# Line 107  void mnFrame::showSearchResult(mnModel* Line 108  void mnFrame::showSearchResult(mnModel*
108          int i;          int i;
109    
110          searchTree->DeleteChildren(searchItemRoot);          searchTree->DeleteChildren(searchItemRoot);
         newItemRoot = searchTree->AppendItem(searchItemRoot, wxT(LABEL_NEW_ITEM), -1, -1, NULL);  
111    
112          searchStrList = wiki->getSearchStrList();          searchStrList = wiki->getSearchStrList();
113          for(i = 0; i < searchStrList->Count(); i++) {          for(i = 0; i < searchStrList->Count(); i++) {
# Line 152  void mnFrame::showSelectedItemText(wxTre Line 152  void mnFrame::showSelectedItemText(wxTre
152          wxString htmlText(*wikiText);          wxString htmlText(*wikiText);
153    
154          /* [[ ]] */          /* [[ ]] */
155          wxRegEx exp1(wxT("\\[\\[(.+)\\]\\]"));          wxRegEx exp1(wxT("\\[\\[([^\\}]+)\\]\\]"));
156          exp1.Replace(&htmlText, wxT("<a href=mnlink:\\1>\\1</a>"));          exp1.Replace(&htmlText, wxT("<a href=mnlink:\\1>\\1</a>"));
157    
158          /* http://  */            /* http://  */  
159          wxRegEx exp2(wxT("(http://[\\.|&|-|%|$|#|=|_|-|~|\\?|/|a-z|A-Z|0-9]+)"));          wxRegEx exp2(wxT("(http://[\\.|&|%|$|#|=|_|\\-|~|\\?|/|a-z|A-Z|0-9]+)"));
160          exp2.Replace(&htmlText, wxT("<a href=\\1>\\1</a>"));          exp2.Replace(&htmlText, wxT("<a href=\\1>\\1</a>"));
161    
162          /* file://  */            /* file://  */  
# Line 176  void mnFrame::showSelectedItemText(wxTre Line 176  void mnFrame::showSelectedItemText(wxTre
176          exp6.Replace(&htmlText, wxT("<u><b>\\1:\\2</b></u>"));          exp6.Replace(&htmlText, wxT("<u><b>\\1:\\2</b></u>"));
177    
178          /* ---- */          /* ---- */
179          wxRegEx exp7(wxT("^----.+"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp7(wxT("^----.*"), wxRE_NEWLINE|wxRE_DEFAULT);
180          exp7.Replace(&htmlText, wxT("<hr>"));          exp7.Replace(&htmlText, wxT("<hr>"));
181    
182            /* {{ }} */
183            wxRegEx exp8(wxT("\\{\\{([^\\}]+)\\}\\}"));
184            exp8.Replace(&htmlText, wxT("<a href=mndoc:\\1>\\1</a>"));
185    
186          /* make HTML document */          /* make HTML document */
187          wxString wikiHtml;          wxString wikiHtml;
188          wikiHtml.Append(wxT("<meta http-equiv=\"Content-Type\"content=\"text/html; charset="));          wikiHtml.Append(wxT("<meta http-equiv=\"Content-Type\"content=\"text/html; charset="));
189          wikiHtml.Append(wxT(CODE_SET_SYSTEM));          wikiHtml.Append(wxT(CODE_SET_SYSTEM));
190          wikiHtml.Append(wxT("\"><pre>"));          wikiHtml.Append(wxT("\">"));
191            wikiHtml.Append(wxT("<pre>"));
192          wikiHtml.Append(htmlText);          wikiHtml.Append(htmlText);
193          wikiHtml.Append(wxT("</pre>"));          wikiHtml.Append(wxT("</pre>"));
194    
   
195          wikiHtmlTextCtrl->SetPage(wikiHtml);          wikiHtmlTextCtrl->SetPage(wikiHtml);
196  }  }
197    
 void mnFrame::showNewItem(WikiData* data)  
 {  
         wxTreeItemId itemId;  
   
         itemId = searchTree->AppendItem(newItemRoot, *(data->getSubject()), -1, -1, (wxTreeItemData*)data);  
         searchTree->Expand(searchItemRoot);  
         searchTree->Expand(newItemRoot);  
         searchTree->SelectItem(itemId);  
 }  
198    
199  wxTreeItemData* mnFrame::getSelectedItem()  wxTreeItemData* mnFrame::getSelectedItem()
200  {  {
# Line 216  bool mnFrame::isEditableTreeLabel(wxTree Line 211  bool mnFrame::isEditableTreeLabel(wxTree
211          return !(searchTree->GetItemParent(id) == searchItemRoot || id == searchItemRoot);          return !(searchTree->GetItemParent(id) == searchItemRoot || id == searchItemRoot);
212  }  }
213    
 bool mnFrame::isNewItem(wxTreeItemId id)  
 {  
         return (searchTree->GetItemParent(id) == newItemRoot);  
 }  
   

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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