Exemplo n.º 1
0
void EditorTweaks::OnShowLineNumbers(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();

    bool enabled=control->GetMarginWidth(0)>0;

//    bool old_state=mgr->ReadBool(_T("/show_line_numbers"), true);
//    mgr->Write(_T("/show_line_numbers"), !enabled);
//    ed->SetEditorStyleAfterFileOpen();
//    mgr->Write(_T("/show_line_numbers"), old_state);

    if (enabled)
        control->SetMarginWidth(0, 0);
    else
    {
        ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
        int pixelWidth = control->TextWidth(wxSCI_STYLE_LINENUMBER, _T("9"));

        if (cfg->ReadBool(_T("/margin/dynamic_width"), false))
        {
            int lineNumWidth = 1;
            int lineCount = control->GetLineCount();

            while (lineCount >= 10)
            {
                lineCount /= 10;
                ++lineNumWidth;
            }

            control->SetMarginWidth(0, 6 + lineNumWidth * pixelWidth);
        }
        else
            control->SetMarginWidth(0, 6 + cfg->ReadInt(_T("/margin/width_chars"), 6) * pixelWidth);
    }
}
Exemplo n.º 2
0
void EditorTweaks::UpdateUI()
{
    if (!m_tweakmenu)
    	return;

    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        m_tweakmenuitem->Enable(false);
    else
        m_tweakmenuitem->Enable(true);

    wxMenu *submenu = m_tweakmenu;

    if(control)
    {
        submenu->Check(id_et_WordWrap,control->GetWrapMode()==wxSCI_WRAP_WORD);
        submenu->Check(id_et_CharWrap,control->GetWrapMode()==wxSCI_WRAP_CHAR);
        submenu->Check(id_et_ShowLineNumbers,control->GetMarginWidth(0)>0);
        submenu->Check(id_et_TabChar,control->GetUseTabs());
        submenu->Check(id_et_TabIndent,control->GetTabIndents());
        submenu->Check(id_et_TabSize2,control->GetTabWidth()==2);
        submenu->Check(id_et_TabSize4,control->GetTabWidth()==4);
        submenu->Check(id_et_TabSize6,control->GetTabWidth()==6);
        submenu->Check(id_et_TabSize8,control->GetTabWidth()==8);
        submenu->Check(id_et_EOLCRLF,control->GetEOLMode()==wxSCI_EOL_CRLF);
        submenu->Check(id_et_EOLCR,control->GetEOLMode()==wxSCI_EOL_CR);
        submenu->Check(id_et_EOLLF,control->GetEOLMode()==wxSCI_EOL_LF);
        submenu->Check(id_et_ShowEOL,control->GetViewEOL());
        submenu->Check(id_et_ShowWhitespaceChars, control->GetViewWhiteSpace()!=wxSCI_WS_INVISIBLE);
    }
    submenu->Check(id_et_SuppressInsertKey, m_suppress_insert);
    submenu->Check(id_et_LaptopFriendly, m_laptop_friendly);
    submenu->Check(id_et_ConvertBraces,     m_convert_braces);
}
Exemplo n.º 3
0
void EditorTweaks::OnStripTrailingBlanks(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
            return;

    int maxLines = control->GetLineCount();
    control->BeginUndoAction();
    for (int line = 0; line < maxLines; line++)
    {
        int lineStart = control->PositionFromLine(line);
        int lineEnd = control->GetLineEndPosition(line);
        int i = lineEnd-1;
        wxChar ch = (wxChar)(control->GetCharAt(i));
        while ((i >= lineStart) && ((ch == _T(' ')) || (ch == _T('\t'))))
        {
            i--;
            ch = (wxChar)(control->GetCharAt(i));
        }
        if (i < (lineEnd-1))
        {
            control->SetTargetStart(i+1);
            control->SetTargetEnd(lineEnd);
            control->ReplaceTarget(_T(""));
        }
    }
    control->EndUndoAction();
}
Exemplo n.º 4
0
void EditorTweaks::OnTabSize8(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    control->SetTabWidth(8);
}
Exemplo n.º 5
0
void EditorTweaks::OnShowEOL(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    control->SetViewEOL(!control->GetViewEOL());
}
Exemplo n.º 6
0
void EditorTweaks::OnStripTrailingBlanks(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
            return;

    StripTrailingBlanks(control);
}
Exemplo n.º 7
0
void EditorTweaks::OnEnsureConsistentEOL(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
            return;

    control->ConvertEOLs(control->GetEOLMode());
}
Exemplo n.º 8
0
void EditorTweaks::OnEOLLF(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    control->SetEOLMode(wxSCI_EOL_LF);
}
Exemplo n.º 9
0
void EditorTweaks::OnTabIndent(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    control->SetTabIndents(!control->GetTabIndents());
}
Exemplo n.º 10
0
void EditorTweaks::OnEditorOpen(CodeBlocksEvent& /*event*/)
{
    Manager::Get()->GetLogManager()->DebugLog(wxString::Format(_("Editor Open")));
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    control->SetOvertype(false);
    control->Connect(wxEVT_KEY_DOWN,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnKeyPress,NULL,this);
    control->Connect(wxEVT_CHAR,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnChar,NULL,this);

}
Exemplo n.º 11
0
void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    bool enabled = control->GetWrapMode() == wxSCI_WRAP_CHAR;

    if (enabled)
        control->SetWrapMode(wxSCI_WRAP_NONE);
    else
        control->SetWrapMode(wxSCI_WRAP_CHAR);
}
Exemplo n.º 12
0
void EditorTweaks::UpdateUI()
{
    if ( !IsAttached() )
        return;

    if (!m_tweakmenu)
    	return;

    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
    {
        m_tweakmenuitem->Enable(false);
        return;
    }

    m_tweakmenuitem->Enable(true);

    wxMenu *submenu = m_tweakmenu; //_("Editor Tweaks") TODO: Retrieve actual menu

    submenu->Check(id_et_WordWrap,control->GetWrapMode()==wxSCI_WRAP_WORD);
    submenu->Check(id_et_CharWrap,control->GetWrapMode()==wxSCI_WRAP_CHAR);
    submenu->Check(id_et_ShowLineNumbers,control->GetMarginWidth(0)>0);
    submenu->Check(id_et_TabChar,control->GetUseTabs());
    submenu->Check(id_et_TabIndent,control->GetTabIndents());
    submenu->Check(id_et_TabSize2,control->GetTabWidth()==2);
    submenu->Check(id_et_TabSize4,control->GetTabWidth()==4);
    submenu->Check(id_et_TabSize6,control->GetTabWidth()==6);
    submenu->Check(id_et_TabSize8,control->GetTabWidth()==8);
    submenu->Check(id_et_EOLCRLF,control->GetEOLMode()==wxSCI_EOL_CRLF);
    submenu->Check(id_et_EOLCR,control->GetEOLMode()==wxSCI_EOL_CR);
    submenu->Check(id_et_EOLLF,control->GetEOLMode()==wxSCI_EOL_LF);
    submenu->Check(id_et_ShowEOL,control->GetViewEOL());
    submenu->Check(id_et_SuppressInsertKey, m_suppress_insert);
    submenu->Check(id_et_ConvertBraces,     m_convert_braces);

}
Exemplo n.º 13
0
/**	Fold/Unfold/Toggle all folds in the givel level.
	\param	level	Level number of folding, starting from 0.
	\param	fold	Type of folding action requested:	\n
	-	0 = Unfold.
	-	1 = Fold.
*/
void EditorTweaks::DoFoldAboveLevel(int level, int fold)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    level+=wxSCI_FOLDLEVELBASE;

    control->Colourise(0, -1); // the *most* important part!

	// Scan all file lines searching for the specified folding level.
    int count = control->GetLineCount();
    for (int line = 0; line <= count; ++line)
    {
        int line_level_data = control->GetFoldLevel(line);
        if (!(line_level_data & wxSCI_FOLDLEVELHEADERFLAG))
            continue;
        const int line_level = line_level_data & wxSCI_FOLDLEVELNUMBERMASK;

        const bool IsExpanded = control->GetFoldExpanded(line);

        // If a fold/unfold request is issued when the block is already
        // folded/unfolded, ignore the request.
        if (line_level<=level)
        {
            if (IsExpanded)
                continue;
        }
        else
        {
            if ((fold==0 && IsExpanded) || (fold ==1 && !IsExpanded))
                continue;
        }
        control->ToggleFold(line);
    }
}
Exemplo n.º 14
0
void EditorTweaks::DoBufferEditorPos(int delta, bool isScrollTimer)
{
    if (m_buffer_caret == -1)
        m_buffer_caret = Manager::Get()->GetConfigManager(wxT("EditorTweaks"))->ReadInt(wxT("/buffer_caret"), 1);
    if (m_buffer_caret < 1) // feature disabled (selected "None" in settings)
        return;

    cbStyledTextCtrl* stc = GetSafeControl();
    if (!stc)
        return;

    if (!stc || stc->AutoCompActive() || stc->LinesOnScreen() < 10) // ignore small editors
        return;
    const int firstVisibleLine = stc->GetFirstVisibleLine();
    const int dist = stc->VisibleFromDocLine(stc->GetCurrentLine()) + delta - firstVisibleLine;
    if (dist < 0 || dist > stc->LinesOnScreen()) // caret is off screen (see bug #18795)
    {
        if (!isScrollTimer && !m_scrollTimer.IsRunning())
            m_scrollTimer.Start(5, wxTIMER_ONE_SHOT); // check to see if we moved into place
        return;
    }
    const int buffer = (m_buffer_caret > 4 ? (stc->LinesOnScreen() >> 1) - 2 : m_buffer_caret);
    int remaining = 0;
    if (dist < buffer)
    {
        remaining = buffer - dist - 1;
        stc->LineScroll(0, (remaining > 3 ? -2 : -1)); // scroll up
    }
    else if (dist >= stc->LinesOnScreen() - buffer)
    {
        remaining = dist + buffer - stc->LinesOnScreen();
        stc->LineScroll(0, (remaining > 3 ? 2 : 1)); // scroll down
    }
    if (!m_scrollTimer.IsRunning() && remaining > 0 && firstVisibleLine != stc->GetFirstVisibleLine())
        m_scrollTimer.Start(4 + (30 / remaining), wxTIMER_ONE_SHOT); // smooth scroll required lines
}
Exemplo n.º 15
0
void EditorTweaks::OnKeyPress(wxKeyEvent& event)
{
    const int keyCode = event.GetKeyCode();
    switch (keyCode)
    {
    case WXK_NUMPAD_UP:      case WXK_UP:
        if (event.GetModifiers() != wxMOD_CONTROL)
            DoBufferEditorPos(-1);
        break;

    case WXK_NUMPAD_DOWN:    case WXK_DOWN:
        if (event.GetModifiers() == wxMOD_CONTROL)
            break;
        // fall through
    case WXK_NUMPAD_ENTER:   case WXK_RETURN:
        DoBufferEditorPos(1);
        break;

    case WXK_NUMPAD_TAB:     case WXK_TAB:
        if (event.GetModifiers() != wxMOD_NONE)
            break;
        // fall through
    case WXK_BACK:
    case WXK_NUMPAD_DELETE:  case WXK_DELETE:
    case WXK_NUMPAD_LEFT:    case WXK_LEFT:
    case WXK_NUMPAD_RIGHT:   case WXK_RIGHT:
        if (event.GetModifiers() == wxMOD_ALT)
            break;
        // fall through
    case WXK_NUMPAD_HOME:    case WXK_HOME:
    case WXK_NUMPAD_END:     case WXK_END:
        DoBufferEditorPos();
        break;

    default:
        break;
    }
    if (m_suppress_insert && keyCode == WXK_INSERT && event.GetModifiers() == wxMOD_NONE)
        event.Skip(false);
    else
        event.Skip(true);
    if (m_convert_braces && keyCode == WXK_DELETE && (event.GetModifiers() == wxMOD_NONE || event.GetModifiers() == wxMOD_SHIFT))
    {
        event.Skip(true);

        cbStyledTextCtrl* control = GetSafeControl();
        if (!control)
            return;

        int p = control->GetCurrentPos();
        int a = control->GetAnchor();
        if (abs(p-a) != 1)
            return;
        int l = a<p? a: p;
        int m = control->BraceMatch(l);
        if (m == wxSCI_INVALID_POSITION)
            return;
        control->BeginUndoAction();
        if(l<m)
        {
            control->DeleteRange(m, 1);
            control->DeleteRange(l, 1);
        }
        else
        {
            control->DeleteRange(l, 1);
            control->DeleteRange(m, 1);
            l--;
        }
        control->SetCurrentPos(l);
        control->SetAnchor(l);
        control->EndUndoAction();
        event.Skip(false);
    }
}
Exemplo n.º 16
0
void EditorTweaks::AlignToString(const wxString AlignmentString)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
        return;

    int line_start = wxSCI_INVALID_POSITION;
    int line_end   = wxSCI_INVALID_POSITION;
    if (GetSelectionLines(line_start, line_end))
    {
        // get furthest position of alignmentstring
        size_t find_position  = wxString::npos;
        size_t max_position   = wxString::npos;
        int matches           = 0;
        for (int i=line_start; i<=line_end; i++)
        {
            // look for string
            find_position = control->GetLine(i).Find(AlignmentString);

            // store max position
            if (find_position != wxString::npos)
            {
                matches++;
                if ((int) find_position > (int) max_position)
                    max_position = find_position;
            }
        }

        // if string has been found more than once
        if (matches > 1)
        {
            // loop through lines
            wxString replacement_text = _T("");
            wxString current_line     = _T("");
            int spacing_diff          = 0;
            for (int i=line_start; i<=line_end; i++)
            {
                // get line
                current_line = control->GetLine(i);
                if ( i == line_end )
                    current_line = current_line.Trim();


                // look for string
                find_position = current_line.Find(AlignmentString);

                // insert spacing
                if (find_position != wxString::npos)
                {
                    spacing_diff = (int) max_position - (int) find_position;
                    if (spacing_diff > 0)
                    {
                        // assemble next part of replacement string
                        current_line = current_line.insert(find_position, GetPadding(_T(" "), spacing_diff));
                    }
                }

                // tack on line
                replacement_text += current_line;
            }

            // start undo
            control->BeginUndoAction();

            // get character positions of true selection start and end
            int pos_start = control->PositionFromLine(line_start);
            int pos_end   = control->GetLineEndPosition(line_end);

            // select all lines properly
            control->SetSelectionVoid(pos_start, pos_end);

            // replace with replacement string
            control->ReplaceSelection(replacement_text);

            // finish undo
            control->EndUndoAction();
        }
    }

}
Exemplo n.º 17
0
void EditorTweaks::OnKeyPress(wxKeyEvent& event)
{
    const int keyCode = event.GetKeyCode();
    // This set of laptop friendly helpers are a bit of a hack to make up for the lack of
    // page up, page down, home, end, and delete keys on some laptops (especially Chromebooks)
    if (m_laptop_friendly && keyCode == WXK_LEFT && event.AltDown())
    {
        cbStyledTextCtrl* control = GetSafeControl();
        if (event.ShiftDown())
            control->VCHomeDisplayExtend();
        else
            control->VCHomeDisplay();
        event.Skip(false);
    }
    else if (m_laptop_friendly && keyCode == WXK_RIGHT && event.AltDown())
    {
        cbStyledTextCtrl* control = GetSafeControl();
        if (event.ShiftDown())
            control->LineEndDisplayExtend();
        else
            control->LineEndDisplay();
        event.Skip(false);
    }
    else if (m_laptop_friendly && keyCode == WXK_UP && event.AltDown())
    {
        cbStyledTextCtrl* control = GetSafeControl();
        if (event.ControlDown())
        {
            if (event.ShiftDown())
                control->DocumentStartExtend();
            else
                control->DocumentStart();
        } else
        {
            if (event.ShiftDown())
                control->PageUpExtend();
            else
                control->PageUp();
        }
        event.Skip(false);
    }
    else if (m_laptop_friendly && keyCode == WXK_DOWN && event.AltDown())
    {
        cbStyledTextCtrl* control = GetSafeControl();
        if (event.ControlDown())
        {
            if (event.ShiftDown())
                control->DocumentEndExtend();
            else
                control->DocumentEnd();
        } else
        {
            if (event.ShiftDown())
                control->PageDownExtend();
            else
                control->PageDown();
        }
        event.Skip(false);
    }
    else if (m_laptop_friendly && keyCode == WXK_BACK && event.GetModifiers() == wxMOD_SHIFT)
    {
        cbStyledTextCtrl* control = GetSafeControl();
        int anchor = control->GetAnchor();
        int pos = control->GetCurrentPos();
        if (anchor >= 0 && anchor != pos)
            control->DeleteRange(control->GetSelectionStart(), control->GetSelectionEnd() - control->GetSelectionStart());
        else
            control->DeleteRange(control->GetCurrentPos(), 1);
        event.Skip(false);
    }
    else if (m_suppress_insert && keyCode == WXK_INSERT && event.GetModifiers() == wxMOD_NONE)
        event.Skip(false);
    else if (m_convert_braces && keyCode == WXK_DELETE && (event.GetModifiers() == wxMOD_NONE || event.GetModifiers() == wxMOD_SHIFT))
    {
        event.Skip(true);

        cbStyledTextCtrl* control = GetSafeControl();
        if (!control)
            return;

        int p = control->GetCurrentPos();
        int a = control->GetAnchor();
        if (abs(p-a) != 1)
            return;
        int l = a<p? a: p;
        int m = control->BraceMatch(l);
        if (m == wxSCI_INVALID_POSITION)
            return;
        control->BeginUndoAction();
        if(l<m)
        {
            control->DeleteRange(m, 1);
            control->DeleteRange(l, 1);
        }
        else
        {
            control->DeleteRange(l, 1);
            control->DeleteRange(m, 1);
            l--;
        }
        control->SetCurrentPos(l);
        control->SetAnchor(l);
        control->EndUndoAction();
        event.Skip(false);
    }
    else
        event.Skip(true);
}
Exemplo n.º 18
0
void EditorTweaks::OnChar(wxKeyEvent& event)
{
    event.Skip(true);
    wxChar ch = event.GetKeyCode();
    if (m_convert_braces &&
            (ch == _T('(') ||
             ch == _T(')') ||
             ch == _T('[') ||
             ch == _T(']') ||
             ch == _T('<') ||
             ch == _T('>') ||
             ch == _T('{') ||
             ch == _T('}')
             ))
    {
        event.Skip(true);

        cbStyledTextCtrl* control = GetSafeControl();
        if (!control)
            return;

        int p = control->GetCurrentPos();
        int a = control->GetAnchor();
        if (abs(p-a) != 1)
            return;
        int l = a<p? a: p;
        wxString opch;
        switch (ch)
        {
            case _T('('):
                opch = _T(")");
                break;
            case _T(')'):
                opch = _T("(");
                break;
            case _T('['):
                opch = _T("]");
                break;
            case _T(']'):
                opch = _T("[");
                break;
            case _T('<'):
                opch = _T(">");
                break;
            case _T('>'):
                opch = _T("<");
                break;
            case _T('{'):
                opch = _T("}");
                break;
            case _T('}'):
                opch = _T("{");
                break;
            default:
              return;
        }
        int m = control->BraceMatch(l);
        if (m == wxSCI_INVALID_POSITION)
            return;
        control->BeginUndoAction();
        control->InsertText(l, wxString(ch,1));
        control->DeleteRange(l+1, 1);
        control->InsertText(m, opch);
        control->DeleteRange(m+1, 1);
        control->SetCurrentPos(p);
        control->SetAnchor(a);
        control->EndUndoAction();
        event.Skip(false);
    }
}
Exemplo n.º 19
0
void EditorTweaks::OnShowWhitespaceChars(wxCommandEvent &event)
{
    cbStyledTextCtrl* control = GetSafeControl();
    if (control)
        control->SetViewWhiteSpace(event.IsChecked() ? wxSCI_WS_VISIBLEALWAYS : wxSCI_WS_INVISIBLE);
}
Exemplo n.º 20
0
void EditorTweaks::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* /*data*/)
{
    //Some library module is ready to display a pop-up menu.
    //Check the parameter \"type\" and see which module it is
    //and append any items you need in the menu...
    //TIP: for consistency, add a separator as the first item...

    //make sure we have an editor
    if (type != mtEditorManager || !m_tweakmenu)
        return;

    cbStyledTextCtrl* control = GetSafeControl();
    if (!control)
    {
        m_tweakmenuitem->Enable(false);
        return;
    }

    m_tweakmenuitem->Enable(true);

    // build aligner menu and items
    wxMenu* alignerMenu = new wxMenu();

    std::sort (AlignerMenuEntries.begin(), AlignerMenuEntries.end(),CompareAlignerMenuEntryObject);
    std::reverse( AlignerMenuEntries.begin(), AlignerMenuEntries.end());

    for ( unsigned int i = 0; i < AlignerMenuEntries.size() ; i++ )
        alignerMenu->Append(AlignerMenuEntries[i].id, AlignerMenuEntries[i].MenuName + _T("\t")  + _T("[") + AlignerMenuEntries[i].ArgumentString + _T("]"));
    alignerMenu->AppendSeparator();
    alignerMenu->Append(id_et_align_auto,   _("Auto"));
    alignerMenu->Append(id_et_align_last,   _("Last Align"), _("repeat last Align command") );
    alignerMenu->Append(id_et_align_others, _("More ..."));

    // attach aligner menu
    const wxString label = wxT("Aligner");
    const int position = Manager::Get()->GetPluginManager()->FindSortedMenuItemPosition(*menu, label);
    menu->Insert(position, wxID_ANY, label, alignerMenu);

    return;

// DISABLED ALL OF THE STUFF BELOW (IT IS ALREADY IN THE MAIN MENU BAR)
#if 0
    // build "editor tweaks" menu
    wxMenu *submenu=new wxMenu(); //_("Editor Tweaks")

    menu->Append(id_et,_("Editor Tweaks"),submenu);

    submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap word" ) );
    if (control->GetWrapMode()==wxSCI_WRAP_WORD)
        submenu->Check(id_et_WordWrap,true);

    submenu->AppendCheckItem( id_et_CharWrap, _( "Char wrap" ), _( "Wrap char" ) );
    if (control->GetWrapMode()==wxSCI_WRAP_CHAR)
        submenu->Check(id_et_CharWrap,true);

    submenu->AppendCheckItem( id_et_ShowLineNumbers, _( "Show Line Numbers" ), _( "Show Line Numbers" ) );
    if (control->GetMarginWidth(0)>0)
        submenu->Check(id_et_ShowLineNumbers,true);

    submenu->AppendSeparator();

    submenu->AppendCheckItem( id_et_TabChar, _( "Use Tab Character" ), _( "Use Tab Character" ) );
    if (control->GetUseTabs())
        submenu->Check(id_et_TabChar,true);

    submenu->AppendCheckItem( id_et_TabIndent, _( "Tab Indents" ), _( "Tab Indents" ) );
    if (control->GetTabIndents())
        submenu->Check(id_et_TabIndent,true);

    wxMenu *tabsizemenu=new wxMenu();
    tabsizemenu->AppendRadioItem( id_et_TabSize2, _( "2" ), _( "Tab Width of 2" ) );
    if (control->GetTabWidth()==2)
        tabsizemenu->Check(id_et_TabSize2,true);
    tabsizemenu->AppendRadioItem( id_et_TabSize4, _( "4" ), _( "Tab Width of 4" ) );
    if (control->GetTabWidth()==4)
        tabsizemenu->Check(id_et_TabSize4,true);
    tabsizemenu->AppendRadioItem( id_et_TabSize6, _( "6" ), _( "Tab Width of 6" ) );
    if (control->GetTabWidth()==6)
        tabsizemenu->Check(id_et_TabSize6,true);
    tabsizemenu->AppendRadioItem( id_et_TabSize8, _( "8" ), _( "Tab Width of 8" ) );
    if (control->GetTabWidth()==8)
        tabsizemenu->Check(id_et_TabSize8,true);
    submenu->Append(wxID_ANY,_("Tab Size"),tabsizemenu);

    submenu->AppendSeparator();

    wxMenu *eolmenu=new wxMenu();
    eolmenu->AppendRadioItem( id_et_EOLCRLF, _( "CR LF" ), _( "Carriage Return - Line Feed (Windows Default)" ) );
    if (control->GetEOLMode()==wxSCI_EOL_CRLF)
        eolmenu->Check(id_et_EOLCRLF,true);
    eolmenu->AppendRadioItem( id_et_EOLCR, _( "CR" ), _( "Carriage Return (Mac Default)" ) );
    if (control->GetEOLMode()==wxSCI_EOL_CR)
        eolmenu->Check(id_et_EOLCR,true);
    eolmenu->AppendRadioItem( id_et_EOLLF, _( "LF" ), _( "Line Feed (Unix Default)" ) );
    if (control->GetEOLMode()==wxSCI_EOL_LF)
        eolmenu->Check(id_et_EOLLF,true);
    submenu->Append(wxID_ANY,_("End-of-Line Mode"),eolmenu);

    submenu->AppendCheckItem( id_et_ShowEOL, _( "Show EOL Chars" ), _( "Show End-of-Line Characters" ) );
    if (control->GetViewEOL())
        submenu->Check(id_et_ShowEOL,true);

    submenu->Append( id_et_StripTrailingBlanks, _( "Strip Trailing Blanks Now" ), _( "Strip trailing blanks from each line" ) );

    submenu->Append( id_et_EnsureConsistentEOL, _( "Make EOLs Consistent Now" ), _( "Convert End-of-Line Characters to the Active Setting" ) );

    menu->Append(wxID_ANY, _T("Editor Tweaks"), submenu);
#endif
}