コード例 #1
0
ファイル: sqleditor.cpp プロジェクト: eriser/wxsqlite3
/*---------------------------------------------------------------------------*/
void wxSQLEditorBase::Init()
{
   m_FontName = _T("Courier New");
   m_FontSize = 10;

   SetWrapMode(wxSTC_WRAP_NONE);  // wxSTC_WRAP_WORD wxSTC_WRAP_NONE
   SetLexer(wxSTC_LEX_SQL);
   SetTabWidth(2);
   SetUseTabs(false);
   SetTabIndents (true);
   SetBackSpaceUnIndents (true);
   SetIndent(2);
   SetViewEOL(false);
   SetIndentationGuides(true);
   SetEOLMode(wxSTC_EOL_LF);

   SetEdgeColumn(200);
   SetEdgeMode(wxSTC_EDGE_LINE);   // wxSTC_EDGE_NONE wxSTC_EDGE_LINE
   SetViewWhiteSpace(wxSTC_WS_INVISIBLE);   // wxSTC_WS_VISIBLEALWAYS

   SetMarginType(1, wxSTC_MARGIN_SYMBOL);
   SetMarginWidth(1, 0);

   SetKeyWords(0, SQLWordlist1);
   SetKeyWords(1, SQLWordlist2);
   SetKeyWords(4, SQLWordlist3);
   SetKeyWords(5, SQLWordlist4);

   ReInitAllStyle();
}
コード例 #2
0
ファイル: tcOptionsView.cpp プロジェクト: WarfareCode/gcblue
tcOptionsView::tcOptionsView(tc3DWindow2* parent,
		const wxPoint& pos, const wxSize& size, 
		const wxString& name) : 
    tcXmlWindow(parent, pos, size, "xml/options_view.xml", name, parent),
    fontSize(16.0f),
    sliderBarWidth(150.0f)
{
	if (config)
	{
	}
	else
	{
		fprintf(stderr, "tcOptionsView::tcOptionsView - NULL xml config node\n");
		return;
	}


	mpOptions = tcOptions::Get();

	mnXStart = 30;
	mnYStart = mnHeight - 50;

    SetBorderDraw(true);

    SetTabWidth(90.0f);

    Init();
}
コード例 #3
0
ファイル: svnblameeditor.cpp プロジェクト: 292388900/codelite
void SvnBlameEditor::Initialize()
{
    // Initialize some styles
    SetMarginType (0, wxSTC_MARGIN_TEXT  );
    SetMarginType (1, wxSTC_MARGIN_NUMBER);
    SetMarginWidth(1, 4 + 5*TextWidth(wxSTC_STYLE_LINENUMBER, wxT("9")));
    SetMarginWidth(2, 0);
    SetMarginWidth(3, 0);
    SetMarginWidth(4, 0);
    SetTabWidth(4);
    
    // Define some colors to use
    StyleSetBackground(MARGIN_STYLE_START + 1,  DrawingUtils::LightColour(wxT("GREEN"),      7.0));
    StyleSetBackground(MARGIN_STYLE_START + 2,  DrawingUtils::LightColour(wxT("BLUE"),       7.0));
    StyleSetBackground(MARGIN_STYLE_START + 3,  DrawingUtils::LightColour(wxT("ORANGE"),     7.0));
    StyleSetBackground(MARGIN_STYLE_START + 4,  DrawingUtils::LightColour(wxT("YELLOW"),     7.0));
    StyleSetBackground(MARGIN_STYLE_START + 5,  DrawingUtils::LightColour(wxT("PURPLE"),     7.0));
    StyleSetBackground(MARGIN_STYLE_START + 6,  DrawingUtils::LightColour(wxT("RED"),        7.0));
    StyleSetBackground(MARGIN_STYLE_START + 7,  DrawingUtils::LightColour(wxT("BROWN"),      7.0));
    StyleSetBackground(MARGIN_STYLE_START + 8,  DrawingUtils::LightColour(wxT("LIGHT GREY"), 7.0));
    StyleSetBackground(MARGIN_STYLE_START + 9,  DrawingUtils::LightColour(wxT("SIENNA"),     7.0));

    StyleSetBackground(MARGIN_STYLE_START + 10, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
    StyleSetForeground(MARGIN_STYLE_START + 10, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
}
コード例 #4
0
ファイル: fb_stc.cpp プロジェクト: bihai/fbide
void FB_STC::LoadSettings ( ) {
    FB_Config    * Prefs  = m_Ide->GetConfig();
    Style_STC_FB * Style  = &Prefs->Style_FB;

    // Clear all styles there might be defined
    StyleClearAll(  );
    SetLexer( 0 );
    
    // Tab and indenting
    SetTabWidth             ( Prefs->TabSize );
    SetUseTabs              ( false );
    SetTabIndents           ( true );
    SetBackSpaceUnIndents   ( true );
    SetIndent               ( Prefs->TabSize );
    SetIndentationGuides    ( Prefs->IndentGuide );
    
    // Right margin
    SetEdgeMode   ( Prefs->RightMargin ? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE );
    SetEdgeColumn ( Prefs->EdgeColumn );
    
    // Line and line ending
    SetEOLMode ( 0 );
    SetViewEOL ( Prefs->DisplayEOL );
    SetViewWhiteSpace ( Prefs->WhiteSpace ? wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE );
    
    // Misc
    CmdKeyClear (wxSTC_KEY_TAB, 0);
    #define _STYLE(nr) Style->Style[nr]
        wxFont font ( _STYLE(0).Size, wxMODERN, wxNORMAL, wxNORMAL, false, _STYLE(0).Font );

        StyleSetForeground (wxSTC_STYLE_DEFAULT,    Prefs->GetClr(_STYLE(0).Face));
        StyleSetBackground (wxSTC_STYLE_DEFAULT,    Prefs->GetClr(_STYLE(0).Back));
        StyleSetFont( wxSTC_STYLE_DEFAULT, font );

        StyleSetForeground (0,    Prefs->GetClr(_STYLE(0).Face));
        StyleSetBackground (0,    Prefs->GetClr(_STYLE(0).Back));
        StyleSetFont( 0, font );
        
        StyleSetForeground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberFace));
        StyleSetBackground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberBack));
        StyleSetFont( wxSTC_STYLE_LINENUMBER, font );
                    
        SetCaretForeground (Prefs->GetClr(Style->CaretFace));
        SetSelForeground(true, Prefs->GetClr(Style->SelectFace));
        SetSelBackground(true, Prefs->GetClr(Style->SelectBack));
    #undef STYLE

    int LineNrMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("0001"));
    SetMarginWidth (0, Prefs->LineNumber ? LineNrMargin : 0);
    SetMarginWidth (1,0);

    if ( Prefs->CurrentLine )
    {
        SetCaretLineVisible( true );
        SetCaretLineBack( Prefs->GetClr( Style->CaretLine ) );
    }

}
コード例 #5
0
ファイル: TextEditor.cpp プロジェクト: Gaerzi/SLADE
/* TextEditor::TextEditor
 * TextEditor class constructor
 *******************************************************************/
TextEditor::TextEditor(wxWindow* parent, int id)
	: wxStyledTextCtrl(parent, id), timer_update(this)
{
	// Init variables
	language = nullptr;
	ct_argset = 0;
	ct_function = nullptr;
	ct_start = 0;
	bm_cursor_last_pos = -1;
	panel_fr = nullptr;
	call_tip = new SCallTip(this);
	choice_jump_to = nullptr;
	jump_to_calculator = nullptr;

	// Set tab width
	SetTabWidth(txed_tab_width);

	// Line numbers by default
	SetMarginType(0, wxSTC_MARGIN_NUMBER);
	SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, "9999"));

	// Folding margin
	setupFoldMargin();

	// Border margin
	SetMarginWidth(2, 4);

	// Register icons for autocompletion list
	RegisterImage(1, Icons::getIcon(Icons::TEXT_EDITOR, "key"));
	RegisterImage(2, Icons::getIcon(Icons::TEXT_EDITOR, "const"));
	RegisterImage(3, Icons::getIcon(Icons::TEXT_EDITOR, "func"));

	// Init w/no language
	setLanguage(nullptr);

	// Setup various configurable properties
	setup();

	// Add to text styles editor list
	StyleSet::addEditor(this);

	// Bind events
	Bind(wxEVT_KEY_DOWN, &TextEditor::onKeyDown, this);
	Bind(wxEVT_KEY_UP, &TextEditor::onKeyUp, this);
	Bind(wxEVT_STC_CHARADDED, &TextEditor::onCharAdded, this);
	Bind(wxEVT_STC_UPDATEUI, &TextEditor::onUpdateUI, this);
	Bind(wxEVT_STC_CALLTIP_CLICK, &TextEditor::onCalltipClicked, this);
	Bind(wxEVT_STC_DWELLSTART, &TextEditor::onMouseDwellStart, this);
	Bind(wxEVT_STC_DWELLEND, &TextEditor::onMouseDwellEnd, this);
	Bind(wxEVT_LEFT_DOWN, &TextEditor::onMouseDown, this);
	Bind(wxEVT_KILL_FOCUS, &TextEditor::onFocusLoss, this);
	Bind(wxEVT_ACTIVATE, &TextEditor::onActivate, this);
	Bind(wxEVT_STC_MARGINCLICK, &TextEditor::onMarginClick, this);
	Bind(wxEVT_COMMAND_JTCALCULATOR_COMPLETED, &TextEditor::onJumpToCalculateComplete, this);
	Bind(wxEVT_STC_MODIFIED, &TextEditor::onModified, this);
	Bind(wxEVT_TIMER, &TextEditor::onUpdateTimer, this);
	Bind(wxEVT_STC_STYLENEEDED, &TextEditor::onStyleNeeded, this);
}
コード例 #6
0
ファイル: sourceview.cpp プロジェクト: doneykoo/verysleepy
SourceView::SourceView(wxWindow *parent, MainWin* mainwin_)
:	wxStyledTextCtrl(parent, SOURCE_VIEW,
					 wxDefaultPosition, wxDefaultSize,
					 wxSUNKEN_BORDER, wxEmptyString ),
	mainwin(mainwin_)
{
	SetUseTabs (false);
	SetTabWidth(8);

	setPlainMode();
	updateText ("Select a procedure from the list above.");
}
コード例 #7
0
ファイル: fbtTextFile.cpp プロジェクト: Ali-il/gamekit
fbtTextFile::fbtTextFile(fbtMainFrame* parent, fbtText* fp, int id)
	:   wxStyledTextCtrl(parent, FBT_WINDOW_TXT),
	    m_file(fp), m_parent(parent)
{

	SetViewEOL(false);
	SetIndentationGuides(false);
	SetEdgeMode(wxSTC_EDGE_NONE);
	SetViewWhiteSpace(wxSTC_WS_INVISIBLE);

	SetReadOnly(false);
	SetTabWidth(4);
	SetWrapMode(wxSTC_WRAP_NONE);

	wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
	StyleSetFont(wxSTC_STYLE_DEFAULT, font);


	StyleSetForeground(wxSTC_STYLE_DEFAULT,     *wxBLACK);
	StyleSetBackground(wxSTC_STYLE_DEFAULT,     *wxWHITE);
	StyleSetForeground(wxSTC_STYLE_LINENUMBER,  wxColour (wxT("DARK GREY")));
	StyleSetBackground(wxSTC_STYLE_LINENUMBER,  *wxWHITE);
	StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));


	SetMarginType(0, wxSTC_MARGIN_NUMBER);
	SetMarginWidth(0, TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_99999")));

	SetVisiblePolicy(wxSTC_VISIBLE_STRICT | wxSTC_VISIBLE_SLOP, 1);
	SetXCaretPolicy(wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1);
	SetYCaretPolicy(wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1);


	SetLexer(wxSTC_LEX_CPP);

	StyleSetForeground(wxSTC_C_COMMENT,         COMMENT_COLOR);
	StyleSetForeground(wxSTC_C_COMMENTLINEDOC,  COMMENT_COLOR);
	StyleSetForeground(wxSTC_C_COMMENTLINE,     COMMENT_COLOR);
	StyleSetForeground(wxSTC_C_COMMENTDOC,      COMMENT_COLOR);
	StyleSetForeground(wxSTC_C_NUMBER,          NUMBER_COLOR);
	StyleSetForeground(wxSTC_C_OPERATOR,        OPERATOR_COLOR);
	StyleSetForeground(wxSTC_C_WORD,            WORD_COLOR);
	StyleSetForeground(wxSTC_C_PREPROCESSOR,    WORD_COLOR);

	SetKeyWords(0, WORDS);

	SetSelBackground(true, wxColor(51, 94, 168));
	SetSelForeground(true, wxColor(255, 255, 255));

	m_file->m_textFile = this;
	m_file->m_flag |= fbtText::FILE_IS_OPEN;
}
コード例 #8
0
ファイル: OutputCtrl.cpp プロジェクト: Duion/Torsion
void OutputCtrl::UpdatePrefs()
{
   StyleSetBackground( wxSTC_STYLE_DEFAULT, tsGetPrefs().GetBgColor() );
   SetCaretForeground( tsGetPrefs().GetDefaultColor() );

	StyleSetForeground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetDefaultColor() );
	StyleSetBackground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetBgColor() );

   SetSelBackground( 1, tsGetPrefs().GetSelBgColor() );
   SetSelForeground( 1, tsGetPrefs().GetSelColor() );

   SetTabWidth( tsGetPrefs().GetTabWidth() );
   StyleSetBackground( wxSTC_STYLE_LINENUMBER, tsGetPrefs().GetBgColor() );
}
コード例 #9
0
ファイル: TextEditor.cpp プロジェクト: Aeyesx/SLADE
/* TextEditor::TextEditor
 * TextEditor class constructor
 *******************************************************************/
TextEditor::TextEditor(wxWindow* parent, int id)
	: wxStyledTextCtrl(parent, id)
{
	// Init variables
	language = NULL;
	ct_argset = 0;
	ct_function = NULL;
	ct_start = 0;

	// Set tab width
	SetTabWidth(txed_tab_width);

	// Line numbers by default
	SetMarginType(0, wxSTC_MARGIN_NUMBER);
	SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, "9999"));
	SetMarginWidth(1, 4);

	// Register icons for autocompletion list
	RegisterImage(1, getIcon("ac_key"));
	RegisterImage(2, getIcon("ac_const"));
	RegisterImage(3, getIcon("ac_func"));

	// Init w/no language
	setLanguage(NULL);

	// Find+Replace dialog
	dlg_fr = new FindReplaceDialog(this);

	// Setup various configurable properties
	setup();

	// Bind events
	Bind(wxEVT_KEY_DOWN, &TextEditor::onKeyDown, this);
	Bind(wxEVT_KEY_UP, &TextEditor::onKeyUp, this);
	Bind(wxEVT_STC_CHARADDED, &TextEditor::onCharAdded, this);
	Bind(wxEVT_STC_UPDATEUI, &TextEditor::onUpdateUI, this);
	Bind(wxEVT_STC_CALLTIP_CLICK, &TextEditor::onCalltipClicked, this);
	Bind(wxEVT_STC_DWELLSTART, &TextEditor::onMouseDwellStart, this);
	Bind(wxEVT_STC_DWELLEND, &TextEditor::onMouseDwellEnd, this);
	Bind(wxEVT_LEFT_DOWN, &TextEditor::onMouseDown, this);
	Bind(wxEVT_KILL_FOCUS, &TextEditor::onFocusLoss, this);
	Bind(wxEVT_ACTIVATE, &TextEditor::onActivate, this);
	dlg_fr->getBtnFindNext()->Bind(wxEVT_BUTTON, &TextEditor::onFRDBtnFindNext, this);
	dlg_fr->getBtnReplace()->Bind(wxEVT_BUTTON, &TextEditor::onFRDBtnReplace, this);
	dlg_fr->getBtnReplaceAll()->Bind(wxEVT_BUTTON, &TextEditor::onFRDBtnReplaceAll, this);
	//dlg_fr->getTextFind()->Bind(wxEVT_BUTTON, &TextEditor::onFRDBtnFindNext, this);
	//dlg_fr->getTextReplace()->Bind(wxEVT_BUTTON, &TextEditor::onFRDBtnReplace, this);
	dlg_fr->Bind(wxEVT_CHAR_HOOK, &TextEditor::onFRDKeyDown, this);
}
コード例 #10
0
AsmEditor::AsmEditor( wxWindow *parent, 
    wxWindowID id/*=wxID_ANY*/, 
    const wxPoint &pos/*=wxDefaultPosition*/, 
    const wxSize &size/*=wxDefaultSize*/, 
    long style/*=0*/, 
    const wxString &name/*=wxSTCNameStr*/ ) : wxStyledTextCtrl(parent, id, pos, size, style, name)
{
    InitializePrefs();

    SetKeyWords( 0, wordList1 );
    SetKeyWords( 1, wordList2 ); 
    SetTabWidth(4);
    SetUseTabs(false);

    Connect(wxEVT_STC_MARGINCLICK, wxStyledTextEventHandler(AsmEditor::OnMarginClick), NULL, this);
    Connect(wxEVT_MOUSEWHEEL,(wxObjectEventFunction)&AsmEditor::OnMouseWheel,NULL,this);
}
コード例 #11
0
ファイル: iwnd_stc.cpp プロジェクト: xuanya4202/ew_base
void IWnd_stc::_DoUpdateStyle()
{
	BitFlags& flags(param.flags);

	SetTabWidth (param.wdtab);

	SetUseTabs (true);
	SetTabIndents (true);
	SetBackSpaceUnIndents (true);
	SetIndent (flags.get(FLAG_INDENT)? param.wdtab: 0);

	SetViewEOL (flags.get(FLAG_SHOWEOL));
	SetIndentationGuides (flags.get(FLAG_INDENTGUIDE));
	SetEdgeColumn (80);
	SetEdgeMode (flags.get(FLAG_LONGLINE)?wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
	SetViewWhiteSpace (flags.get(FLAG_WHITESPACE)?wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
	SetOvertype (flags.get(FLAG_OVERTYPE));
	SetReadOnly (flags.get(FLAG_READONLY));
	SetWrapMode (flags.get(FLAG_WRAPMODE)?wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);

	UpdateMarginLineNumWidth(true);
}
コード例 #12
0
void LuaScriptEditorView::SetupSourceEditor()
{
   StyleSetFont(STYLE_DEFAULT, "Courier New");
   StyleSetSize(STYLE_DEFAULT, 11);
   SetEdgeColumn(100);
   SetEdgeMode(EDGE_LINE);
   SetMarginWidthN(0, 50); // margin 0 displays line numbers, but has default width 0

   StyleSetFore(0,  RGB(0x80, 0x80, 0x80));
   StyleSetFore(1,  RGB(0x00, 0x7f, 0x00));
   StyleSetFore(2,  RGB(0x00, 0x7f, 0x00));
   StyleSetFore(3,  RGB(0x7f, 0x7f, 0x7f));
   StyleSetFore(4,  RGB(0x00, 0x7f, 0x7f));
   StyleSetFore(5,  RGB(0x00, 0x00, 0x7f));
   StyleSetFore(6,  RGB(0x7f, 0x00, 0x7f));
   StyleSetFore(7,  RGB(0x7f, 0x00, 0x7f));
   StyleSetFore(8,  RGB(0x00, 0x7f, 0x7f));
   StyleSetFore(9,  RGB(0x7f, 0x7f, 0x7f));
   StyleSetFore(10, RGB(0x00, 0x00, 0x00));
   StyleSetFore(11, RGB(0x00, 0x00, 0x00));
   StyleSetBold(5,  true);
   StyleSetBold(10, true);

   SetLexer(SCLEX_LUA);

   // set Lua keywords and add RemotePhotoTool specific classes
   SetKeyWords(0,
      "and break do else elseif end for function if in "
      "local nil not or repeat return then until while "
      "App Sys Constants RemoteReleaseControl SourceDevice "
      "ImageProperty DeviceProperty ShootingMode Viewfinder "
      "BulbReleaseControl");

   SetTabWidth(3);
   SetUseTabs(true);

   // only notify about text edits in SCEN_CHANGE messages
   SetModEventMask(SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT);
}
コード例 #13
0
ファイル: CodeEdit.cpp プロジェクト: Halfbrick/decoda
void CodeEdit::SetEditorSettings(const EditorSettings& settings)
{
    m_indentationSize = settings.GetIndentSize();

    SetIndent(m_indentationSize);
    SetTabWidth(m_indentationSize);
    
    bool useTabs = settings.GetUseTabs();
    bool showWhiteSpace = settings.GetShowWhiteSpace();

    SetUseTabs(useTabs);
    SetTabIndents(useTabs);
    SetBackSpaceUnIndents(useTabs);
    SetViewWhiteSpace(showWhiteSpace);
    SetMultipleSelection(true);
    SetAdditionalSelectionTyping(true);
    SetMultiPaste(1);
    SetVirtualSpaceOptions(1);

    if (settings.GetShowLineNumbers())
    {

        // Figure out how wide the margin needs to be do display
        // the most number of linqes we'd reasonbly have.
        int marginSize = TextWidth(wxSTC_STYLE_LINENUMBER, "_99999");
        SetMarginWidth(0, marginSize);

        SetMarginType(0,wxSTC_MARGIN_NUMBER);

    }
    else
    {
        SetMarginWidth(0, 0);
    }    

    m_enableAutoComplete = settings.GetEnableAutoComplete();

}    
コード例 #14
0
ファイル: edit.cpp プロジェクト: jfiguinha/Regards
bool Edit::InitializePrefs (const wxString &name) {

    // initialize styles
    StyleClearAll();
    LanguageInfo const* curInfo = NULL;

    // determine language
    bool found = false;
    int languageNr;
    for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) {
        curInfo = &g_LanguagePrefs [languageNr];
        if (curInfo->name == name) {
            found = true;
            break;
        }
    }
    if (!found) return false;

    // set lexer and language
    SetLexer (curInfo->lexer);
    m_language = curInfo;

    // set margin for line numbers
    SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER);
    StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY")));
    StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
    SetMarginWidth (m_LineNrID, 0); // start out not visible

    // annotations style
    StyleSetBackground(ANNOTATION_STYLE, wxColour(244, 220, 220));
    StyleSetForeground(ANNOTATION_STYLE, *wxBLACK);
    StyleSetSizeFractional(ANNOTATION_STYLE,
            (StyleGetSizeFractional(wxSTC_STYLE_DEFAULT)*4)/5);

    // default fonts for all styles!
    int Nr;
    for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
        wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_MODERN));
        StyleSetFont (Nr, font);
    }

    // set common styles
    StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY")));
    StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));

    // initialize settings
    if (g_CommonPrefs.syntaxEnable) {
        int keywordnr = 0;
        for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) {
            if (curInfo->styles[Nr].type == -1) continue;
            const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type];
            wxFont font(wxFontInfo(curType.fontsize)
                            .Family(wxFONTFAMILY_MODERN)
                            .FaceName(curType.fontname));
            StyleSetFont (Nr, font);
            if (curType.foreground) {
                StyleSetForeground (Nr, wxColour (curType.foreground));
            }
            if (curType.background) {
                StyleSetBackground (Nr, wxColour (curType.background));
            }
            StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0);
            StyleSetItalic (Nr, (curType.fontstyle & mySTC_STYLE_ITALIC) > 0);
            StyleSetUnderline (Nr, (curType.fontstyle & mySTC_STYLE_UNDERL) > 0);
            StyleSetVisible (Nr, (curType.fontstyle & mySTC_STYLE_HIDDEN) == 0);
            StyleSetCase (Nr, curType.lettercase);
            const char *pwords = curInfo->styles[Nr].words;
            if (pwords) {
                SetKeyWords (keywordnr, pwords);
                keywordnr += 1;
            }
        }
    }

    // set margin as unused
    SetMarginType (m_DividerID, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth (m_DividerID, 0);
    SetMarginSensitive (m_DividerID, false);

    // folding
    SetMarginType (m_FoldingID, wxSTC_MARGIN_SYMBOL);
    SetMarginMask (m_FoldingID, wxSTC_MASK_FOLDERS);
    StyleSetBackground (m_FoldingID, *wxWHITE);
    SetMarginWidth (m_FoldingID, 0);
    SetMarginSensitive (m_FoldingID, false);
    if (g_CommonPrefs.foldEnable) {
        SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0);
        SetMarginSensitive (m_FoldingID, curInfo->folds != 0);
        SetProperty (wxT("fold"), curInfo->folds != 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.comment"),
                     (curInfo->folds & mySTC_FOLD_COMMENT) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.compact"),
                     (curInfo->folds & mySTC_FOLD_COMPACT) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.preprocessor"),
                     (curInfo->folds & mySTC_FOLD_PREPROC) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.html"),
                     (curInfo->folds & mySTC_FOLD_HTML) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.html.preprocessor"),
                     (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.comment.python"),
                     (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? wxT("1"): wxT("0"));
        SetProperty (wxT("fold.quotes.python"),
                     (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? wxT("1"): wxT("0"));
    }
    SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED |
                  wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

    // set spaces and indentation
    SetTabWidth (4);
    SetUseTabs (false);
    SetTabIndents (true);
    SetBackSpaceUnIndents (true);
    SetIndent (g_CommonPrefs.indentEnable? 4: 0);

    // others
    SetViewEOL (g_CommonPrefs.displayEOLEnable);
    SetIndentationGuides (g_CommonPrefs.indentGuideEnable);
    SetEdgeColumn (80);
    SetEdgeMode (g_CommonPrefs.longLineOnEnable? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE);
    SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable?
                       wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE);
    SetOvertype (g_CommonPrefs.overTypeInitial);
    SetReadOnly (g_CommonPrefs.readOnlyInitial);
    SetWrapMode (g_CommonPrefs.wrapModeInitial?
                 wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);

    return true;
}
コード例 #15
0
PythonCodeCtrl::PythonCodeCtrl(wxWindow *parent, PythonInterpCtrl *py)
    : cbStyledTextCtrl(parent, wxID_ANY)
{
    m_pyctrl = py;
    EditorManager *em = Manager::Get()->GetEditorManager();
//    Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(PythonCodeCtrl::OnUserInput));

    ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));

    //MOST OF THIS STUFF IS TAKEN FROM CB EDITOR
    wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);

    wxString fontstring = mgr->Read(_T("/font"), wxEmptyString);

    if (!fontstring.IsEmpty())
    {
        wxNativeFontInfo nfi;
        nfi.FromString(fontstring);
        font.SetNativeFontInfo(nfi);
    }

    SetMouseDwellTime(1000);

    SetScrollWidthTracking(true);
    SetScrollWidth(5); //Hides horizontal scrollbar if text doesn't exceed the window width

    int caretStyle = mgr->ReadInt(_T("/caret/style"), wxSCI_CARETSTYLE_LINE);
    SetCaretStyle(caretStyle);
    if (caretStyle == wxSCI_CARETSTYLE_LINE)
        SetCaretWidth(mgr->ReadInt(_T("/caret/width"), 1));
    else
        SetCaretWidth(1);

    ColourManager *colours = Manager::Get()->GetColourManager();

    SetCaretForeground(colours->GetColour(wxT("editor_caret")));
    SetCaretPeriod(mgr->ReadInt(_T("/caret/period"), 500));
    SetCaretLineVisible(mgr->ReadBool(_T("/highlight_caret_line"), false));
    SetCaretLineBackground(
        Manager::Get()->GetConfigManager(_T("editor"))->ReadColour(_T("/highlight_caret_line_colour"), wxColour(0xFF, 0xFF, 0x00)));

    SetFoldMarginColour(true, colours->GetColour(wxT("editor_margin_chrome")));
    SetFoldMarginHiColour(true, colours->GetColour(wxT("editor_margin_chrome_highlight")));

    // setup for "CamelCase selection"
    if (mgr->ReadBool(_T("/camel_case"), false))
    {
        // consider CamelCase for both: cursor movement with CTRL and selection with CTRL+SHIFT:
        CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_SCMOD_CTRL,                   wxSCI_CMD_WORDPARTLEFT);
        CmdKeyAssign(wxSCI_KEY_RIGHT, wxSCI_SCMOD_CTRL,                   wxSCI_CMD_WORDPARTRIGHT);
        CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_SCMOD_CTRL|wxSCI_SCMOD_SHIFT, wxSCI_CMD_WORDPARTLEFTEXTEND);
        CmdKeyAssign(wxSCI_KEY_RIGHT, wxSCI_SCMOD_CTRL|wxSCI_SCMOD_SHIFT, wxSCI_CMD_WORDPARTRIGHTEXTEND);
    }
    else // else set default "none CamelCase" key behavior (also default scintilla behaviour, see scintilla docs)
    {
        CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_SCMOD_CTRL,                   wxSCI_CMD_WORDLEFT);
        CmdKeyAssign(wxSCI_KEY_RIGHT, wxSCI_SCMOD_CTRL,                   wxSCI_CMD_WORDRIGHT);
        CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_SCMOD_CTRL|wxSCI_SCMOD_SHIFT, wxSCI_CMD_WORDLEFTEXTEND);
        CmdKeyAssign(wxSCI_KEY_RIGHT, wxSCI_SCMOD_CTRL|wxSCI_SCMOD_SHIFT, wxSCI_CMD_WORDRIGHTEXTEND);
    }

    SetUseTabs(mgr->ReadBool(_T("/use_tab"), false));
    SetIndentationGuides(mgr->ReadBool(_T("/show_indent_guides"), false)?wxSCI_IV_LOOKBOTH:wxSCI_IV_NONE);
    SetTabIndents(mgr->ReadBool(_T("/tab_indents"), true));
    SetBackSpaceUnIndents(mgr->ReadBool(_T("/backspace_unindents"), true));
    SetWrapMode(mgr->ReadBool(_T("/word_wrap"), false));
    if (mgr->ReadBool(_T("/word_wrap_style_home_end"), true))
    {
        // in word wrap mode, home/end keys goto the wrap point if not already there,
        // otherwise to the start/end of the entire line.
        // alt+home/end go to start/end of the entire line.
        // in unwrapped mode, there is no difference between home/end and alt+home/end
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_NORM,                  wxSCI_CMD_LINEENDWRAP);
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_ALT,                   wxSCI_CMD_LINEEND);
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_SHIFT,                 wxSCI_CMD_LINEENDWRAPEXTEND);
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT, wxSCI_CMD_LINEENDEXTEND);

        // if user wants "Home" key to set cursor to the very beginning of line
        if (mgr->ReadBool(_T("/simplified_home"), false))
        {
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_NORM,wxSCI_CMD_HOMEWRAP);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_ALT,wxSCI_CMD_HOME);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT,wxSCI_CMD_HOMEWRAPEXTEND);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT,wxSCI_CMD_HOMEEXTEND);
        }
        else // else set default "Home" key behavior
        {
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_NORM,wxSCI_CMD_VCHOMEWRAP);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_ALT,wxSCI_CMD_VCHOME);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT,wxSCI_CMD_VCHOMEWRAPEXTEND);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT,wxSCI_CMD_VCHOMEEXTEND);
        }
    }
    else
    {   // in word wrap mode, home/end keys goto start/end of the entire line. alt+home/end goes to wrap points
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_ALT,                   wxSCI_CMD_LINEENDWRAP);
        CmdKeyAssign(wxSCI_KEY_END,  wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT, wxSCI_CMD_LINEENDWRAPEXTEND);

        // if user wants "Home" key to set cursor to the very beginning of line
        if (mgr->ReadBool(_T("/simplified_home"), false))
        {
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_ALT,wxSCI_CMD_HOMEWRAP);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT,wxSCI_CMD_HOMEWRAPEXTEND);
        }
        else // else set default "Home" key behavior
        {
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_ALT,wxSCI_CMD_VCHOMEWRAP);
            CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT|wxSCI_SCMOD_ALT,wxSCI_CMD_VCHOMEWRAPEXTEND);
        }
    }
    SetViewEOL(mgr->ReadBool(_T("/show_eol"), false));
    SetViewWhiteSpace(mgr->ReadInt(_T("/view_whitespace"), 0));
    // gutter
    SetEdgeMode(mgr->ReadInt(_T("/gutter/mode"), 0));
    SetEdgeColour(Manager::Get()->GetColourManager()->GetColour(wxT("editor_gutter")));
    SetEdgeColumn(mgr->ReadInt(_T("/gutter/column"), 80));

    StyleSetFont(wxSCI_STYLE_DEFAULT, font);
    StyleClearAll();

    SetTabWidth(mgr->ReadInt(_T("/tab_size"), 4));
    SetIndent(mgr->ReadInt(_T("/tab_size"), 4)); //NEEDED FOR AUTO INDENTATION (NOT IN CB EDITOR)

    em->GetColourSet()->Apply(_("Python"),this);

}
コード例 #16
0
void FixedLine::UpdateFont() {
	m_sr.ClearCache();

	m_isFontFixedWidth = dc.GetFont().IsFixedWidth();

	// Get dimensions of a single whitespace character
	wxCoord w;
	wxCoord h;
	dc.GetTextExtent(wxT(' '), &w, &h);
	charwidth = w;
	charheight = h+1; // add room for underline
	dc.GetTextExtent(wxT('X'), &w, &h);
	m_nlwidth = w;

	// Create images of hidden chars
	// Draw hidden newline
	wxMemoryDC mdc;
	bmNewline = wxBitmap(m_nlwidth, charheight, 1);
	mdc.SelectObject(bmNewline);
	mdc.Clear();
	const int x_middle = m_nlwidth/2;
	const int y_fourth = charheight/4;
	wxPoint triangle_points[3];
	triangle_points[0] = wxPoint(0, charheight-y_fourth-2);
	triangle_points[1] = wxPoint(x_middle, charheight-y_fourth-5);
	triangle_points[2] = wxPoint(x_middle, charheight-y_fourth+1);
	mdc.SetPen(*wxBLACK_PEN);
	mdc.SetBrush(*wxBLACK_BRUSH);
	mdc.DrawLine(m_nlwidth-2, y_fourth, m_nlwidth-2, charheight-y_fourth-1);
	mdc.DrawLine(2, charheight-y_fourth-2, m_nlwidth-2, charheight-y_fourth-2);
	mdc.DrawPolygon(3, triangle_points, 0, 0);

	// Draw hidden space
	bmSpace = wxBitmap(charwidth, charheight, 1);
	mdc.SelectObject(bmSpace);
	mdc.Clear();
	mdc.SetPen(wxPen(*wxBLACK, 2, wxSOLID));
	const int y_middle = charheight/2;
	mdc.DrawCircle(charwidth/2, y_middle, 1);

	// Redraw tab image
	SetTabWidth(m_tabChars);

	// Draw fold indicator
	m_foldWidth = charwidth*2;
	m_foldHeight = charheight/2;
	bmFold = wxBitmap(m_foldWidth, m_foldHeight, 1);
	mdc.SelectObject(bmFold);
	mdc.Clear();
	mdc.SetPen(*wxBLACK_PEN);
	mdc.SetBrush(*wxBLACK_BRUSH);
	mdc.DrawRoundedRectangle(0, 0, m_foldWidth, m_foldHeight, 2);
	const unsigned int foldMiddle = m_foldHeight / 2;
	const unsigned int foldPart = m_foldWidth / 4;
	mdc.SetPen(*wxWHITE_PEN);
	mdc.SetBrush(*wxWHITE_BRUSH);
	mdc.DrawCircle(foldPart, foldMiddle, 1);
	mdc.DrawCircle(m_foldWidth / 2, foldMiddle, 1);
	mdc.DrawCircle(m_foldWidth - foldPart, foldMiddle, 1);

	// Create transparency mask for fold indicator
	wxBitmap bmMask = wxBitmap(m_foldWidth, m_foldHeight, 1);
	mdc.SelectObject(bmMask);
	mdc.SetPen(*wxBLACK_PEN);
	mdc.SetBrush(*wxBLACK_BRUSH);
	mdc.DrawRectangle(0, 0, m_foldWidth, m_foldHeight);
	mdc.SetPen(*wxWHITE_PEN);
	mdc.SetBrush(*wxWHITE_BRUSH);
	mdc.DrawRoundedRectangle(0, 0, m_foldWidth, m_foldHeight, 2);
	mdc.SelectObject(wxNullBitmap);
	bmFold.SetMask(new wxMask(bmMask));

	// Invalidate cache
	textstart = 0;
	textend = 0;
}
コード例 #17
0
ファイル: ctlSQLBox.cpp プロジェクト: Joe-xXx/pgadmin3
void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
{
	wxStyledTextCtrl::Create(parent, id , pos, size, style);

	// Clear all styles
	StyleClearAll();

	// Font
	extern sysSettings *settings;
	wxFont fntSQLBox = settings->GetSQLFont();

	wxColour bgColor = settings->GetSQLBoxColourBackground();
	if (settings->GetSQLBoxUseSystemBackground())
	{
		bgColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
	}

	wxColour frColor = settings->GetSQLBoxColourForeground();
	if (settings->GetSQLBoxUseSystemForeground())
	{
		frColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
	}
	StyleSetBackground(wxSTC_STYLE_DEFAULT, bgColor);
	StyleSetForeground(wxSTC_STYLE_DEFAULT, frColor);
	StyleSetFont(wxSTC_STYLE_DEFAULT, fntSQLBox);

	SetSelBackground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
	SetSelForeground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));

	SetCaretForeground(settings->GetSQLColourCaret());

	SetMarginWidth(1, 0);
	SetTabWidth(settings->GetIndentSpaces());
	SetUseTabs(!settings->GetSpacesForTabs());

	// Setup the different highlight colurs
	for (int i = 0; i < 34; ++ i )
	{
		if (i > 0 && i < 12)
			StyleSetForeground(i, settings->GetSQLBoxColour(i));
		else
			StyleSetForeground(i, frColor);
		StyleSetBackground(i, bgColor);
		StyleSetFont(i, fntSQLBox);
	}

	// Keywords in uppercase?

	if (settings->GetSQLKeywordsInUppercase())
		StyleSetCase(5, wxSTC_CASE_UPPER);

	// Margin style
	StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour());

	// Brace maching styles
	StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF));
	StyleSetBackground(35, wxColour(0xFF, 0xCF, 0x27));
	StyleSetFont(34, fntSQLBox);
	StyleSetFont(35, fntSQLBox);

	// SQL Lexer and keywords.
	if (sqlKeywords.IsEmpty())
		FillKeywords(sqlKeywords);
	SetLexer(wxSTC_LEX_SQL);
	SetKeyWords(0, sqlKeywords + plpgsqlKeywords + ftsKeywords + pgscriptKeywords);

	// Enable folding
	SetMarginSensitive(2, true);

	SetMarginType(2, wxSTC_MARGIN_SYMBOL); // margin 2 for symbols
	SetMarginMask(2, wxSTC_MASK_FOLDERS);  // set up mask for folding symbols
	SetMarginSensitive(2, true);           // this one needs to be mouse-aware
	SetMarginWidth(2, 16);                 // set margin 2 16 px wide

	MarkerDefine(wxSTC_MARKNUM_FOLDEREND,     wxSTC_MARK_BOXPLUSCONNECTED,  *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER,  *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL,    wxSTC_MARK_LCORNER,  *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDERSUB,     wxSTC_MARK_VLINE,    *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDER,        wxSTC_MARK_BOXPLUS,  *wxWHITE, *wxBLACK);
	MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN,    wxSTC_MARK_BOXMINUS, *wxWHITE, *wxBLACK);

	SetProperty(wxT("fold"), wxT("1"));
	SetFoldFlags(16);

	// Setup accelerators
	wxAcceleratorEntry entries[2];
	entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND);
	entries[1].Set(wxACCEL_CTRL, (int)' ', MNU_AUTOCOMPLETE);
	wxAcceleratorTable accel(2, entries);
	SetAcceleratorTable(accel);

	// Autocompletion configuration
	AutoCompSetSeparator('\t');
	AutoCompSetChooseSingle(true);
	AutoCompSetIgnoreCase(true);
	AutoCompSetFillUps(wxT(" \t"));
	AutoCompSetDropRestOfWord(true);

	SetEOLMode(settings->GetLineEndingType());
}
コード例 #18
0
ファイル: CodeEditor.cpp プロジェクト: bill9889/OGRE
CodeEditor::CodeEditor(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
	: wxScintilla (parent, id, pos, size, style)
{
	mFileName = _T("");
	//m_language = NULL;

	mLineNumID = 0;
	mLineNumMargin = TextWidth(wxSCI_STYLE_LINENUMBER, _T("99999"));
	mFoldingID = 1;
	mFoldingMargin = 16;
	mDividerID = 1;

	SetProperty(wxT("fold"), wxT("1"));
	SetFoldFlags(16);
	SetMarginType(mFoldingID, wxSCI_MARGIN_SYMBOL);
	SetMarginMask(mFoldingID, wxSCI_MASK_FOLDERS);
	SetMarginSensitive(mFoldingID, true);
	SetMarginWidth(mFoldingID, mFoldingMargin);

	MarkerDefine(wxSCI_MARKNUM_FOLDEROPEN, wxSCI_MARK_BOXMINUS);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDEROPEN, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDEROPEN, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDER, wxSCI_MARK_BOXPLUS);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDER, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDER, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDERSUB, wxSCI_MARK_VLINE);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDERSUB, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDERSUB, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDERTAIL, wxSCI_MARK_LCORNER);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDERTAIL, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDERTAIL, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDEREND, wxSCI_MARK_BOXPLUSCONNECTED);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDEREND, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDEREND, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDEROPENMID, wxSCI_MARK_BOXMINUSCONNECTED);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDEROPENMID, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDEROPENMID, wxColour(0x80, 0x80, 0x80));
	MarkerDefine(wxSCI_MARKNUM_FOLDERMIDTAIL, wxSCI_MARK_TCORNER);
	MarkerSetForeground(wxSCI_MARKNUM_FOLDERMIDTAIL, wxColour(0xff, 0xff, 0xff));
	MarkerSetBackground(wxSCI_MARKNUM_FOLDERMIDTAIL, wxColour(0x80, 0x80, 0x80));

	// Set defaults, these should eventually be set via user prefs
	SetViewEOL(false);
	SetIndentationGuides(false);
	SetMarginWidth(mLineNumID, mLineNumMargin);
	//SetMarginWidth(mFoldingID, mFoldingMargin);
	//SetMarginSensitive(mFoldingID, true);
	SetEdgeMode(wxSCI_EDGE_LINE);
	//SetViewWhiteSpace(wxSCI_WS_VISIBLEALWAYS);
	SetOvertype(false);
	SetReadOnly(false);
	SetWrapMode(wxSCI_WRAP_NONE);

	wxFont font(10, wxTELETYPE, wxNORMAL, wxNORMAL);
	StyleSetFont(wxSCI_STYLE_DEFAULT, font);
	StyleSetForeground(wxSCI_STYLE_DEFAULT, wxColour(wxT("BLACK")));
	StyleSetBackground(wxSCI_STYLE_DEFAULT, wxColour(wxT("WHITE")));
	StyleSetForeground(wxSCI_STYLE_LINENUMBER, wxColour(wxT("DARK BLUE")));
	StyleSetBackground(wxSCI_STYLE_LINENUMBER, wxColour(wxT("WHITE")));
	StyleSetForeground(wxSCI_STYLE_INDENTGUIDE, wxColour(wxT("DARK GREY")));

	StyleSetBold(wxSCI_STYLE_BRACELIGHT, true);
	
	//InitializePrefs(DEFAULT_LANGUAGE);
	SetTabWidth(4);
	SetUseTabs(false);
	SetTabIndents(true);
	SetBackSpaceUnIndents(true);
	SetIndent(4);

	// Set visibility
	SetVisiblePolicy(wxSCI_VISIBLE_STRICT | wxSCI_VISIBLE_SLOP, 1);
	SetXCaretPolicy(wxSCI_CARET_EVEN | wxSCI_VISIBLE_STRICT | wxSCI_CARET_SLOP, 1);
	SetYCaretPolicy(wxSCI_CARET_EVEN | wxSCI_VISIBLE_STRICT | wxSCI_CARET_SLOP, 1);

	SetCaretLineVisible(true);
	SetCaretLineBackground(wxColour(225, 235, 224));

	// Markers
	//MarkerDefine(wxSCI_MARKNUM_FOLDER, wxSCI_MARK_BOXPLUS);
	//MarkerSetBackground(wxSCI_MARKNUM_FOLDER, wxColour(_T("BLACK")));
	//MarkerSetForeground(wxSCI_MARKNUM_FOLDER, wxColour(_T("WHITE")));
	//MarkerDefine(wxSCI_MARKNUM_FOLDEROPEN, wxSCI_MARK_BOXMINUS);
	//MarkerSetBackground(wxSCI_MARKNUM_FOLDEROPEN, wxColour(_T("BLACK")));
	//MarkerSetForeground(wxSCI_MARKNUM_FOLDEROPEN, wxColour(_T("WHITE")));
	//MarkerDefine(wxSCI_MARKNUM_FOLDERSUB, wxSCI_MARK_EMPTY);
	//MarkerDefine(wxSCI_MARKNUM_FOLDEREND, wxSCI_MARK_SHORTARROW);
	//MarkerDefine(wxSCI_MARKNUM_FOLDEROPENMID, wxSCI_MARK_ARROWDOWN);
	//MarkerDefine(wxSCI_MARKNUM_FOLDERMIDTAIL, wxSCI_MARK_EMPTY);
	//MarkerDefine(wxSCI_MARKNUM_FOLDERTAIL, wxSCI_MARK_EMPTY);

	// Clear wrong default keys
#if !defined(__WXGTK__)
	//CmdKeyClear(wxSCI_KEY_TAB, 0);
	CmdKeyClear(wxSCI_KEY_TAB, wxSCI_SCMOD_SHIFT);
#endif
	CmdKeyClear('A', wxSCI_SCMOD_CTRL);
#if !defined(__WXGTK__)
	CmdKeyClear('C', wxSCI_SCMOD_CTRL);
#endif
	CmdKeyClear('D', wxSCI_SCMOD_CTRL);
	CmdKeyClear('D', wxSCI_SCMOD_SHIFT | wxSCI_SCMOD_CTRL);
	CmdKeyClear('F', wxSCI_SCMOD_ALT | wxSCI_SCMOD_CTRL);
	CmdKeyClear('L', wxSCI_SCMOD_CTRL);
	CmdKeyClear('L', wxSCI_SCMOD_SHIFT | wxSCI_SCMOD_CTRL);
	CmdKeyClear('T', wxSCI_SCMOD_CTRL);
	CmdKeyClear('T', wxSCI_SCMOD_SHIFT | wxSCI_SCMOD_CTRL);
	CmdKeyClear('U', wxSCI_SCMOD_CTRL);
	CmdKeyClear('U', wxSCI_SCMOD_SHIFT | wxSCI_SCMOD_CTRL);
#if !defined(__WXGTK__)
	CmdKeyClear('V', wxSCI_SCMOD_CTRL);
	CmdKeyClear('X', wxSCI_SCMOD_CTRL);
#endif
	CmdKeyClear('Y', wxSCI_SCMOD_CTRL);
#if !defined(__WXGTK__)
	CmdKeyClear('Z', wxSCI_SCMOD_CTRL);
#endif

	UsePopUp(0);
	SetLayoutCache(wxSCI_CACHE_PAGE);
	SetBufferedDraw(1);
}
コード例 #19
0
ファイル: sqleditor.cpp プロジェクト: eriser/wxsqlite3
/*---------------------------------------------------------------------------*/
void wxSQLEditor::InitStyle()
{
   SetDefaultFont(wxGetApp().GetStyleFontName(), wxGetApp().GetStyleFontSize());
   SetEdgeMode(wxGetApp().GetEdgeLineVisible() ? wxSTC_EDGE_LINE : wxSTC_EDGE_NONE);

   SetDefaultStyle(wxGetApp().GetStyleFontBold(STYLE_DEFAULT),
                   wxGetApp().GetStyleFontItalic(STYLE_DEFAULT),
                   wxGetApp().GetStyleFontUnderline(STYLE_DEFAULT),
                   wxGetApp().GetStyleCase(STYLE_DEFAULT),
                   wxGetApp().GetStyleColourFore(STYLE_DEFAULT),
                   wxGetApp().GetStyleColourBack(STYLE_DEFAULT));

   SetCommentStyle(wxGetApp().GetStyleFontBold(STYLE_COMMENT),
                   wxGetApp().GetStyleFontItalic(STYLE_COMMENT),
                   wxGetApp().GetStyleFontUnderline(STYLE_COMMENT),
                   wxGetApp().GetStyleCase(STYLE_COMMENT),
                   wxGetApp().GetStyleColourFore(STYLE_COMMENT),
                   wxGetApp().GetStyleColourBack(STYLE_COMMENT));

   SetCommentLineStyle(wxGetApp().GetStyleFontBold(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleFontItalic(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleFontUnderline(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleCase(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleColourFore(STYLE_COMMENTLINE),
                       wxGetApp().GetStyleColourBack(STYLE_COMMENTLINE));

   SetNumberStyle(wxGetApp().GetStyleFontBold(STYLE_NUMBER),
                  wxGetApp().GetStyleFontItalic(STYLE_NUMBER),
                  wxGetApp().GetStyleFontUnderline(STYLE_NUMBER),
                  wxGetApp().GetStyleCase(STYLE_NUMBER),
                  wxGetApp().GetStyleColourFore(STYLE_NUMBER),
                  wxGetApp().GetStyleColourBack(STYLE_NUMBER));

   SetKeyWordStyle(1, wxGetApp().GetStyleFontBold(STYLE_WORD1),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD1),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD1),
                   wxGetApp().GetStyleCase(STYLE_WORD1),
                   wxGetApp().GetStyleColourFore(STYLE_WORD1),
                   wxGetApp().GetStyleColourBack(STYLE_WORD1));

   SetStringStyle(wxGetApp().GetStyleFontBold(STYLE_STRING),
                  wxGetApp().GetStyleFontItalic(STYLE_STRING),
                  wxGetApp().GetStyleFontUnderline(STYLE_STRING),
                  wxGetApp().GetStyleCase(STYLE_STRING),
                  wxGetApp().GetStyleColourFore(STYLE_STRING),
                  wxGetApp().GetStyleColourBack(STYLE_STRING));

   SetCharacterStyle(wxGetApp().GetStyleFontBold(STYLE_CHARACTER),
                     wxGetApp().GetStyleFontItalic(STYLE_CHARACTER),
                     wxGetApp().GetStyleFontUnderline(STYLE_CHARACTER),
                     wxGetApp().GetStyleCase(STYLE_CHARACTER),
                     wxGetApp().GetStyleColourFore(STYLE_CHARACTER),
                     wxGetApp().GetStyleColourBack(STYLE_CHARACTER));

   SetOperatorStyle(wxGetApp().GetStyleFontBold(STYLE_OPERATOR),
                    wxGetApp().GetStyleFontItalic(STYLE_OPERATOR),
                    wxGetApp().GetStyleFontUnderline(STYLE_OPERATOR),
                    wxGetApp().GetStyleCase(STYLE_OPERATOR),
                    wxGetApp().GetStyleColourFore(STYLE_OPERATOR),
                    wxGetApp().GetStyleColourBack(STYLE_OPERATOR));

   SetIdentifierStyle(wxGetApp().GetStyleFontBold(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleFontItalic(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleFontUnderline(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleCase(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleColourFore(STYLE_IDENTIFIER),
                      wxGetApp().GetStyleColourBack(STYLE_IDENTIFIER));

   SetKeyWordStyle(2, wxGetApp().GetStyleFontBold(STYLE_WORD2),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD2),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD2),
                   wxGetApp().GetStyleCase(STYLE_WORD2),
                   wxGetApp().GetStyleColourFore(STYLE_WORD2),
                   wxGetApp().GetStyleColourBack(STYLE_WORD2));

   SetKeyWordStyle(3, wxGetApp().GetStyleFontBold(STYLE_WORD3),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD3),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD3),
                   wxGetApp().GetStyleCase(STYLE_WORD3),
                   wxGetApp().GetStyleColourFore(STYLE_WORD3),
                   wxGetApp().GetStyleColourBack(STYLE_WORD3));

   SetKeyWordStyle(4, wxGetApp().GetStyleFontBold(STYLE_WORD4),
                   wxGetApp().GetStyleFontItalic(STYLE_WORD4),
                   wxGetApp().GetStyleFontUnderline(STYLE_WORD4),
                   wxGetApp().GetStyleCase(STYLE_WORD4),
                   wxGetApp().GetStyleColourFore(STYLE_WORD4),
                   wxGetApp().GetStyleColourBack(STYLE_WORD4));


   SetTabWidth(wxGetApp().GetStyleTabWidth());
   SetUseTabs(wxGetApp().GetStyleUseTab());
   SetTabIndents(wxGetApp().GetStyleTabIndent());
   SetBackSpaceUnIndents(wxGetApp().GetStyleBackspaceUnindent());
   SetIndent(wxGetApp().GetStyleIndentWidth());

   SetLineNumberMarginStyle(wxGetApp().GetStyleShowLineNumber(),
                            wxGetApp().GetForeLineNumber(),
                            wxGetApp().GetBackLineNumber());
}
コード例 #20
0
ファイル: ScriptEditCtrl.cpp プロジェクト: mikekov/ExifPro
void ScriptEditCtrl::Impl::PreSubclassWindow()
{
	self_->m_hWnd = m_hWnd;	// expose HWND

	SetupDirectAccess();

	// If we are running as Unicode, then use the UTF8 codepage
#ifdef _UNICODE
	SetCodePage(SC_CP_UTF8);
#endif

	SetLexer(SCLEX_LUA);
	StyleSetFont(STYLE_DEFAULT, "Lucida Console");
	StyleSetSize(STYLE_DEFAULT, 10);
	SetKeyWords(0, LuaKeywords);
	SetKeyWords(1, LuaFunctions);
	if (enable_input_attribs_)
		SetKeyWords(2, LuaUser);
	SetKeyWords(3, ConcatAttributes().c_str());

	COLORREF comment= RGB(0,128,128);
	COLORREF string= RGB(128,128,0);

	StyleSetFore(SCE_LUA_COMMENT, comment);
	StyleSetFore(SCE_LUA_COMMENTLINE, comment);
	StyleSetFore(SCE_LUA_COMMENTDOC, comment);
	StyleSetFore(SCE_LUA_NUMBER, RGB(0,0,255));
	StyleSetFore(SCE_LUA_WORD, RGB(34,78,160));		// keywords
	StyleSetFore(SCE_LUA_STRING, string);
	StyleSetFore(SCE_LUA_CHARACTER, string);
	StyleSetFore(SCE_LUA_LITERALSTRING, string);
	StyleSetFore(SCE_LUA_WORD2, RGB(53,113,202));	// functions
	StyleSetFore(SCE_LUA_WORD3, RGB(124,37,203));	// test & number
	StyleSetBack(SCE_LUA_WORD3, CalcColor(::GetSysColor(COLOR_WINDOW), RGB(0,0,255), 0.95f));
	StyleSetFore(SCE_LUA_WORD4, RGB(164,97,49));	// todo: attributes

	StyleSetFont(SCE_LUA_WORD, "Lucida Console");
	StyleSetSize(SCE_LUA_WORD, 10);
	StyleSetBold(SCE_LUA_WORD, true);

	//#define SCE_LUA_PREPROCESSOR 9
	//#define SCE_LUA_OPERATOR 10
	//#define SCE_LUA_IDENTIFIER 11
	//#define SCE_LUA_STRINGEOL 12
	//#define SCE_LUA_WORD2 13
	//#define SCE_LUA_WORD3 14
	//#define SCE_LUA_WORD4 15
	//#define SCE_LUA_WORD5 16
	//#define SCE_LUA_WORD6 17
	//#define SCE_LUA_WORD7 18
	//#define SCE_LUA_WORD8 19

	Colorize(0, -1);

	//MarkerDefine(MARKER_POINTER, SC_MARK_ARROW);
	//MarkerSetBack(MARKER_POINTER, RGB(255,255,0));

	//MarkerDefine(MARKER_BREAKPOINT, SC_MARK_ROUNDRECT);
	//MarkerSetBack(MARKER_BREAKPOINT, RGB(0,0,255));

	//MarkerDefine(MARKER_ERROR, SC_MARK_ARROW);
	//MarkerSetBack(MARKER_ERROR, RGB(255,0,0));

	int width= 0;
	SetMarginWidthN(1, width);

	SetScrollWidthTracking(true);
	SetScrollWidth(1);

	SetWrapMode(SC_WRAP_WORD);
	SetWrapVisualFlags(SC_WRAPVISUALFLAG_END);

	SetSelBack(true, CalcShade(::GetSysColor(COLOR_HIGHLIGHT), 50.0f));

	SetTabWidth(4);
	SetIndent(4);

	DWORD pixels= 1;
	::SystemParametersInfo(SPI_GETCARETWIDTH, 0, &pixels, 0);
	SetCaretWidth(pixels);

	// hwnd is attached, but message processing is not working yet, we are not yet subclassed,
	// so postpone this WM_NCCALCSIZE call:
	PostMessage(WM_APP+1234);
}