Remove various bit of redundant code from the wxWebView sample source view dialog.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@67786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -28,22 +28,10 @@
|
|||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// SOURCE VIEW FRAME
|
// SOURCE VIEW FRAME
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
enum
|
|
||||||
{
|
|
||||||
MARGIN_LINE_NUMBERS,
|
|
||||||
//MARGIN_DIVIDER,
|
|
||||||
//MARGIN_FOLDING
|
|
||||||
};
|
|
||||||
|
|
||||||
class SourceViewDialog : public wxDialog
|
class SourceViewDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void onClose(wxCloseEvent& evt)
|
|
||||||
{
|
|
||||||
EndModal( GetReturnCode() );
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceViewDialog(wxWindow* parent, wxString source) :
|
SourceViewDialog(wxWindow* parent, wxString source) :
|
||||||
wxDialog(parent, wxID_ANY, "Source Code",
|
wxDialog(parent, wxID_ANY, "Source Code",
|
||||||
wxDefaultPosition, wxSize(700,500),
|
wxDefaultPosition, wxSize(700,500),
|
||||||
@@ -51,36 +39,26 @@ public:
|
|||||||
{
|
{
|
||||||
wxStyledTextCtrl* text = new wxStyledTextCtrl(this, wxID_ANY);
|
wxStyledTextCtrl* text = new wxStyledTextCtrl(this, wxID_ANY);
|
||||||
|
|
||||||
//text->SetLexer(wxSTC_LEX_HTML);
|
text->SetMarginWidth(1, 30);
|
||||||
text->SetMarginWidth (MARGIN_LINE_NUMBERS, 50);
|
text->SetMarginType(1, wxSTC_MARGIN_NUMBER);
|
||||||
text->StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (75, 75, 75) );
|
|
||||||
text->StyleSetBackground (wxSTC_STYLE_LINENUMBER, wxColour (220, 220, 220));
|
|
||||||
text->SetMarginType (MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER);
|
|
||||||
|
|
||||||
text->SetWrapMode (wxSTC_WRAP_WORD);
|
|
||||||
|
|
||||||
text->SetText(source);
|
text->SetText(source);
|
||||||
|
|
||||||
text->StyleClearAll();
|
text->StyleClearAll();
|
||||||
text->SetLexer(wxSTC_LEX_HTML);
|
text->SetLexer(wxSTC_LEX_HTML);
|
||||||
text->StyleSetForeground (wxSTC_H_DOUBLESTRING, wxColour(255,0,0));
|
text->StyleSetForeground(wxSTC_H_DOUBLESTRING, wxColour(255,0,0));
|
||||||
text->StyleSetForeground (wxSTC_H_SINGLESTRING, wxColour(255,0,0));
|
text->StyleSetForeground(wxSTC_H_SINGLESTRING, wxColour(255,0,0));
|
||||||
text->StyleSetForeground (wxSTC_H_ENTITY, wxColour(255,0,0));
|
text->StyleSetForeground(wxSTC_H_ENTITY, wxColour(255,0,0));
|
||||||
text->StyleSetForeground (wxSTC_H_TAG, wxColour(0,150,0));
|
text->StyleSetForeground(wxSTC_H_TAG, wxColour(0,150,0));
|
||||||
text->StyleSetForeground (wxSTC_H_TAGUNKNOWN, wxColour(0,150,0));
|
text->StyleSetForeground(wxSTC_H_TAGUNKNOWN, wxColour(0,150,0));
|
||||||
text->StyleSetForeground (wxSTC_H_ATTRIBUTE, wxColour(0,0,150));
|
text->StyleSetForeground(wxSTC_H_ATTRIBUTE, wxColour(0,0,150));
|
||||||
text->StyleSetForeground (wxSTC_H_ATTRIBUTEUNKNOWN, wxColour(0,0,150));
|
text->StyleSetForeground(wxSTC_H_ATTRIBUTEUNKNOWN, wxColour(0,0,150));
|
||||||
text->StyleSetForeground (wxSTC_H_COMMENT, wxColour(150,150,150));
|
text->StyleSetForeground(wxSTC_H_COMMENT, wxColour(150,150,150));
|
||||||
|
|
||||||
|
|
||||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
sizer->Add(text, 1, wxEXPAND);
|
sizer->Add(text, 1, wxEXPAND);
|
||||||
SetSizer(sizer);
|
SetSizer(sizer);
|
||||||
|
|
||||||
Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(SourceViewDialog::onClose), NULL, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user