Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnNotePanel.cpp

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

revision 1.3 by maloninc, Fri Oct 7 10:19:46 2005 UTC revision 1.4 by maloninc, Thu Dec 22 10:48:29 2005 UTC
# Line 11  Line 11 
11  mnNotePanel::mnNotePanel(wxWindow* parent, wxString* dirName)  mnNotePanel::mnNotePanel(wxWindow* parent, wxString* dirName)
12  {  {
13          wxXmlResource::Get()->LoadPanel(this, parent, wxT("notePanel"));          wxXmlResource::Get()->LoadPanel(this, parent, wxT("notePanel"));
14            wxSplitterWindow* spWindow = XRCCTRL(*this, "splitWindow", wxSplitterWindow);
15            searchTree       = XRCCTRL(*spWindow, "searchTree", wxTreeCtrl);
16    
17    #ifdef __WXMAC__
18            wikiHtmlTextCtrl = new mnHtmlWindow(spWindow, -1, wxT(""), wxPoint(0,-100), wxSize(200, 200));
19            spWindow->SplitVertically(searchTree, wikiHtmlTextCtrl, 250);
20    #else
21          /* init members */          /* init members */
22          searchTree       = XRCCTRL(*this, "searchTree", wxTreeCtrl);          wikiHtmlTextCtrl = XRCCTRL(*spWindow, "wikiHtmlTextCtrl", mnHtmlWindow);
23          wikiHtmlTextCtrl = XRCCTRL(*this, "wikiHtmlTextCtrl", mnHtmlWindow);  #endif
24    
25          /* create search tree */          /* create search tree */
26          searchItemRoot = searchTree->AddRoot(wxT(LABEL_ITEM_TREE), -1, -1, NULL);          searchItemRoot = searchTree->AddRoot(wxT(LABEL_ITEM_TREE), -1, -1, NULL);
# Line 126  void mnNotePanel::makeHtml(WikiData* wik Line 132  void mnNotePanel::makeHtml(WikiData* wik
132                    
133          /* [[ ]] */          /* [[ ]] */
134          wxRegEx exp1(wxT("\\[\\[([^\\}]+)\\]\\]"));          wxRegEx exp1(wxT("\\[\\[([^\\}]+)\\]\\]"));
135          exp1.Replace(&htmlText, wxT("<a href=mnlink:\\1>\\1</a>"));          exp1.Replace(&htmlText, wxT("<a href=mnlink:\\1> \\1 </a>"));
136    
137          /* http://  */            /* http://  */  
138          wxRegEx exp2(wxT("(http://[-_.!~*'a-zA-Z0-9;/?:@&=+$,%#]+)"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp2(wxT("(http://[-_.!~*'a-zA-Z0-9;/?:@&=+$,%#]+)"), wxRE_NEWLINE|wxRE_DEFAULT);
139          exp2.Replace(&htmlText, wxT("<a href=\\1>\\1</a>"));          exp2.Replace(&htmlText, wxT("<a href=\\1> \\1 </a>"));
140    
141          /* file://  */            /* file://  */  
142          wxRegEx exp3(wxT("(file://[^ ]+)"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp3(wxT("(file://[^ ]+)"), wxRE_NEWLINE|wxRE_DEFAULT);
143          exp3.Replace(&htmlText, wxT("<a href=\\1>\\1</a>"));          exp3.Replace(&htmlText, wxT("<a href=\\1> \\1 </a>"));
   
         /* *XXXX */  
         wxRegEx exp4(wxT("^\\*([^\\*]+)"), wxRE_NEWLINE|wxRE_DEFAULT);  
         exp4.Replace(&htmlText, wxT("<h3>\\1</h3>"));  
144                    
145          /* **XXXX */          /* **XXXX */
146          wxRegEx exp5(wxT("^\\*\\*([^\\*]+)"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp5(wxT("^\\*\\*([^*]+)"), wxRE_NEWLINE|wxRE_DEFAULT);
147          exp5.Replace(&htmlText, wxT("<h4>\\1</h4>"));          exp5.Replace(&htmlText, wxT("<h4> \\1 </h4>"));
148    
149            /* *XXXX */
150            wxRegEx exp4(wxT("^\\*([^*]+)"), wxRE_NEWLINE|wxRE_DEFAULT);
151            //wxRegEx exp4(wxT("^\\*(..*)"), wxRE_NEWLINE|wxRE_DEFAULT);
152            exp4.Replace(&htmlText, wxT("<h3> \\1 </h3>"));
153                    
154          /* :''XXXX'': */          /* :''XXXX'': */
155          wxRegEx exp6(wxT("^:''(.+)'':(.+)"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp6(wxT("^:''(.+)'':(.+)"), wxRE_NEWLINE|wxRE_DEFAULT);
156          exp6.Replace(&htmlText, wxT("<u><b>\\1:\\2</b></u>"));          exp6.Replace(&htmlText, wxT("<u><b> \\1:\\2 </b></u>"));
157    
158          /* ---- */          /* ---- */
159          wxRegEx exp7(wxT("^----.*"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp7(wxT("^----.*"), wxRE_NEWLINE|wxRE_DEFAULT);
# Line 154  void mnNotePanel::makeHtml(WikiData* wik Line 161  void mnNotePanel::makeHtml(WikiData* wik
161    
162          /* {{ }} */          /* {{ }} */
163          wxRegEx exp8(wxT("\\{\\{([^\\}]+)\\}\\}"));          wxRegEx exp8(wxT("\\{\\{([^\\}]+)\\}\\}"));
164          exp8.Replace(&htmlText, wxT("<a href=mndoc:\\1>\\1</a>"));          exp8.Replace(&htmlText, wxT("<a href=mndoc:\\1> \\1 </a>"));
165    
166          /* table */          /* table */
167          wxRegEx exp10(wxT("^,([^,]+)"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp10(wxT("^,([^,]+)"), wxRE_NEWLINE|wxRE_DEFAULT);
168          exp10.Replace(&htmlText, wxT("<td>\\1</td>"));          exp10.Replace(&htmlText, wxT("<td> \\1 </td>"));
169          for(int i = 0; i < 10; i++){ // It's not good.  :P          for(int i = 0; i < 10; i++){ // It's not good.  :P
170                  wxRegEx exp16(wxT("</td>,([^,\n]+)"), wxRE_DEFAULT);                  wxRegEx exp16(wxT("</td>,([^,\n]+)"), wxRE_DEFAULT);
171                  exp16.Replace(&htmlText, wxT("</td><td>\\1</td>"));                  exp16.Replace(&htmlText, wxT("</td><td> \\1 </td>"));
172          }          }
173          wxRegEx exp11(wxT("^<td>"), wxRE_NEWLINE|wxRE_DEFAULT);          wxRegEx exp11(wxT("^<td>"), wxRE_NEWLINE|wxRE_DEFAULT);
174          exp11.Replace(&htmlText, wxT("<tr><td>"));          exp11.Replace(&htmlText, wxT("<tr><td>"));
# Line 186  void mnNotePanel::makeHtml(WikiData* wik Line 193  void mnNotePanel::makeHtml(WikiData* wik
193                  {                  {
194                          wxString token = tkz.GetNextToken();                          wxString token = tkz.GetNextToken();
195                          wxRegEx exp9(wxT("(?!<[^>]+)(") + token + wxT(")(?![^<]+>)"), wxRE_ADVANCED|wxRE_ICASE|wxRE_NEWLINE);                          wxRegEx exp9(wxT("(?!<[^>]+)(") + token + wxT(")(?![^<]+>)"), wxRE_ADVANCED|wxRE_ICASE|wxRE_NEWLINE);
196                          exp9.Replace(&htmlText, wxT("<b><font color=\"red\">\\1</font></b>"));                          exp9.Replace(&htmlText, wxT("<b><font color=\"red\"> \\1 </font></b>"));
197                  }                  }
198          }          }
199    
           
200          /* make HTML document */          /* make HTML document */
201          wxString wikiHtml;          wxString wikiHtml;
202          wikiHtml.Append(wxT("<meta http-equiv=\"Content-Type\"content=\"text/html; charset="));          wikiHtml.Append(wxT("<meta http-equiv=\"Content-Type\"content=\"text/html; charset="));
203          wikiHtml.Append(wxT(CODE_SET_SYSTEM));          wikiHtml.Append(wxT(CODE_SET_SYSTEM));
204          wikiHtml.Append(wxT("\">"));          wikiHtml.Append(wxT("\">"));
205          wikiHtml.Append(wxT("<pre>"));          wikiHtml.Append(wxT("<pre>"));
206          wikiHtml.Append(htmlText);          wikiHtml.Append(wxT("<html>"));
207            wikiHtml.Append(htmlText.c_str());
208          wikiHtml.Append(wxT("</pre>"));          wikiHtml.Append(wxT("</pre>"));
209            wikiHtml.Append(wxT("</html>"));
210    
211          wikiHtmlTextCtrl->SetPage(wikiHtml);          wikiHtmlTextCtrl->SetPage(wikiHtml);
212  }  }

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

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