| 1 |
// -*- C++ -*- generated by wxGlade 0.3.5.1 on Wed Jun 29 12:57:38 2005 |
// -*- C++ -*- generated by wxGlade 0.3.5.1 on Wed Jun 29 12:57:38 2005 |
| 2 |
#include <wx/regex.h> |
#include <wx/regex.h> |
| 3 |
#include <wx/tokenzr.h> |
#include <wx/tokenzr.h> |
| 4 |
|
#include <wx/xrc/xmlres.h> |
| 5 |
#include "mnID.h" |
#include "mnID.h" |
| 6 |
#include "mnDef.h" |
#include "mnDef.h" |
| 7 |
#include "mnFrame.h" |
#include "mnFrame.h" |
| 8 |
#include "mnDialog.h" |
#include "mnDialog.h" |
| 9 |
|
|
| 10 |
|
|
| 11 |
mnFrame::mnFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): |
mnFrame::mnFrame(wxWindow* parent) |
|
wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE) |
|
| 12 |
{ |
{ |
| 13 |
// begin wxGlade: mnFrame::mnFrame |
wxXmlResource::Get()->LoadFrame(this, parent, wxT("mnFrame")); |
|
splitWindow = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER); |
|
|
rightPanel = new wxPanel(splitWindow, -1); |
|
|
leftPanel = new wxPanel(splitWindow, -1); |
|
|
panel = new wxPanel(this, -1); |
|
|
searchLaebl = new wxStaticText(panel, -1, wxT("Search"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); |
|
|
searchTextCtrl = new wxTextCtrl(this, ID_SearchTextCtrl, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); |
|
|
searchTree = new wxTreeCtrl(leftPanel, ID_SearchTree, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER|wxTR_EDIT_LABELS); |
|
|
wikiHtmlTextCtrl = new mnHtmlWindow(rightPanel, ID_HtmlTextCtrl); |
|
|
|
|
|
// begin add by hand |
|
|
menuBar = new wxMenuBar(); |
|
|
SetMenuBar(menuBar); |
|
|
|
|
|
// File menu |
|
|
wxMenu* tmp_menu_1 = new wxMenu(); |
|
|
tmp_menu_1->Append(ID_MenuFileNew, _("New\tCtrl+N"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->Append(ID_MenuFileEdit, _("Edit\tCtrl+E"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->Append(ID_MenuFileRemove, _("Remove\tCtrl+R"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->Append(ID_MenuFileHighlight, _("Highlight\tCtrl+L"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->AppendSeparator(); |
|
|
tmp_menu_1->Append(ID_MenuFileGroup, _("Group by TYPE\tCtrl+G"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->AppendSeparator(); |
|
|
tmp_menu_1->Append(ID_MenuFileConfig, _("Configure..."), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_1->AppendSeparator(); |
|
|
tmp_menu_1->Append(ID_MenuFileExit, _("Quit\tCtrl+Q"), wxT(""), wxITEM_NORMAL); |
|
|
menuBar->Append(tmp_menu_1, _("&File")); |
|
|
|
|
|
// Tree menu |
|
|
wxMenu* tmp_menu_3 = new wxMenu(); |
|
|
tmp_menu_3->Append(ID_MenuTreeExpand, _("Expand All\tCtrl+D"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_3->Append(ID_MenuTreeCollapse, _("Collapse All\tCtrl+U"), wxT(""), wxITEM_NORMAL); |
|
|
tmp_menu_3->Append(ID_MenuTreeClear, _("Clear All\tCtrl+K"), wxT(""), wxITEM_NORMAL); |
|
|
//tmp_menu_3->AppendSeparator(); |
|
|
//tmp_menu_3->AppendCheckItem(ID_MenuTreeDisableUpdate, _("Disable AutoUpdate")); |
|
|
menuBar->Append(tmp_menu_3, _("&Tree")); |
|
|
|
|
|
// Help menu |
|
|
wxMenu* tmp_menu_2 = new wxMenu(); |
|
|
tmp_menu_2->Append(wxID_ABOUT, _("&About"), wxT(""), wxITEM_NORMAL); |
|
|
menuBar->Append(tmp_menu_2, _("&Help")); |
|
| 14 |
|
|
| 15 |
#ifdef __WXMSW__ |
#ifdef __WXMSW__ |
| 16 |
wxIcon icon(wxT(APP_ICON_NAME), wxBITMAP_TYPE_ICO_RESOURCE); |
wxIcon icon(wxT(APP_ICON_NAME), wxBITMAP_TYPE_ICO_RESOURCE); |
| 17 |
SetIcon(icon); |
SetIcon(icon); |
| 18 |
#endif |
#endif |
|
// end add by hand |
|
| 19 |
|
|
| 20 |
set_properties(); |
/* init members */ |
| 21 |
do_layout(); |
searchTree = XRCCTRL(*this, "searchTree", wxTreeCtrl); |
| 22 |
// end wxGlade |
searchTextCtrl = XRCCTRL(*this, "searchTextCtrl", wxTextCtrl); |
| 23 |
|
wikiHtmlTextCtrl = XRCCTRL(*this, "wikiHtmlTextCtrl", mnHtmlWindow); |
| 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); |
| 27 |
} |
} |
| 28 |
|
|
|
void mnFrame::set_properties() |
|
|
{ |
|
|
// begin wxGlade: mnFrame::set_properties |
|
|
SetTitle(wxT("Malon Note")); |
|
|
SetSize(wxSize(900, 572)); |
|
|
searchTextCtrl->SetFocus(); |
|
|
// end wxGlade |
|
|
|
|
|
wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); |
|
|
wikiHtmlTextCtrl->SetFonts(font.GetFaceName(), font.GetFaceName()); |
|
|
} |
|
|
|
|
|
|
|
|
void mnFrame::do_layout() |
|
|
{ |
|
|
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); |
|
|
rightPanelSizer = new wxGridSizer(1, 1, 0, 0); |
|
|
wxBoxSizer* leftPanelSizer = new wxBoxSizer(wxHORIZONTAL); |
|
|
wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL); |
|
|
wxBoxSizer* labelSizer = new wxBoxSizer(wxHORIZONTAL); |
|
|
labelSizer->Add(searchLaebl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); |
|
|
panel->SetAutoLayout(true); |
|
|
panel->SetSizer(labelSizer); |
|
|
labelSizer->Fit(panel); |
|
|
labelSizer->SetSizeHints(panel); |
|
|
topSizer->Add(panel, 0, wxEXPAND, 0); |
|
|
topSizer->Add(searchTextCtrl, 1, wxTOP|wxBOTTOM|wxEXPAND|wxFIXED_MINSIZE, 1); |
|
|
mainSizer->Add(topSizer, 0, wxEXPAND, 0); |
|
|
leftPanelSizer->Add(searchTree, 1, wxEXPAND, 0); |
|
|
leftPanel->SetAutoLayout(true); |
|
|
leftPanel->SetSizer(leftPanelSizer); |
|
|
leftPanelSizer->Fit(leftPanel); |
|
|
leftPanelSizer->SetSizeHints(leftPanel); |
|
|
rightPanelSizer->Add(wikiHtmlTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); |
|
|
rightPanel->SetAutoLayout(true); |
|
|
rightPanel->SetSizer(rightPanelSizer); |
|
|
rightPanelSizer->Fit(rightPanel); |
|
|
rightPanelSizer->SetSizeHints(rightPanel); |
|
|
splitWindow->SplitVertically(leftPanel, rightPanel, 250); |
|
|
mainSizer->Add(splitWindow, 1, wxEXPAND, 0); |
|
|
SetAutoLayout(true); |
|
|
SetSizer(mainSizer); |
|
|
Layout(); |
|
|
|
|
|
searchTree->Expand(searchItemRoot); |
|
|
} |
|
|
|
|
|
void mnFrame::showSearchResult(mnModel* wiki, bool isExpand) |
|
|
{ |
|
|
wxLogMessage(wxT("showSearchResult is not available")); |
|
|
} |
|
|
|
|
| 29 |
void mnFrame::updateSearchResult(mnModel* wiki, wxString* searchStr, bool isExpand) |
void mnFrame::updateSearchResult(mnModel* wiki, wxString* searchStr, bool isExpand) |
| 30 |
{ |
{ |
| 31 |
wxTreeItemIdValue cookie1, cookie2; |
wxTreeItemIdValue cookie1, cookie2; |