Index: src/main.cpp
===================================================================
--- src/main.cpp (revision 6196)
+++ src/main.cpp (working copy)
@@ -240,6 +240,8 @@
int idStartHerePageLink = wxNewId();
int idStartHerePageVarSubst = wxNewId();
+int idHighlightButton = wxNewId();
+
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_ERASE_BACKGROUND(MainFrame::OnEraseBackground)
EVT_SIZE(MainFrame::OnSize)
@@ -448,6 +450,7 @@
EVT_NOTEBOOK_PAGE_CHANGED(ID_NBEditorManager, MainFrame::OnPageChanged)
+ EVT_BUTTON(idHighlightButton, MainFrame::OnHighlightMenu)
/// CloseFullScreen event handling
EVT_BUTTON( idCloseFullScreen, MainFrame::OnToggleFullScreen )
@@ -1648,6 +1651,7 @@
width[num++] = -1; // main field
// width[num++] = 128; // progress bar
+ dc.GetTextExtent(_(" Nassi Shneiderman "), &width[num++], &h);
dc.GetTextExtent(_(" WINDOWS-1252 "), &width[num++], &h);
dc.GetTextExtent(_(" Line 12345, Column 123 "), &width[num++], &h);
dc.GetTextExtent(_(" Overwrite "), &width[num++], &h);
@@ -1657,7 +1661,10 @@
CreateStatusBar(num);
SetStatusWidths(num, width);
-
+ wxRect rect;
+ GetStatusBar()->GetFieldRect(1, rect);
+ m_pHighlightButton = new wxButton(GetStatusBar(),idHighlightButton,_(""),
+ rect.GetPosition(),rect.GetSize(),wxNO_BORDER|wxBU_LEFT);
// here for later usage
// m_pProgressBar = new wxGauge(GetStatusBar(), -1, 100);
#endif // wxUSE_STATUSBAR
@@ -1677,6 +1684,11 @@
wxString msg;
msg.Printf(_("Line %d, Column %d"), ed->GetControl()->GetCurrentLine() + 1, ed->GetControl()->GetColumn(pos) + 1);
SetStatusText(ed->GetFilename(), panel++); //tiwag 050917
+ // Highlightbutton
+ EditorColourSet* theme = Manager::Get()->GetEditorManager()->GetColourSet();
+ m_pHighlightButton->SetLabel(theme->GetLanguageName(ed->GetLanguage()));
+ panel++;
+
SetStatusText(ed->GetEncodingName(), panel++);
SetStatusText(msg, panel++);
SetStatusText(ed->GetControl()->GetOvertype() ? _("Overwrite") : _("Insert"), panel++);
@@ -1692,6 +1704,8 @@
{
int panel = 0;
SetStatusText(_("Welcome to ") + appglobals::AppName + _T("!"), panel++);
+ m_pHighlightButton->SetLabel(wxEmptyString);
+ panel++;
SetStatusText(wxEmptyString, panel++);
SetStatusText(wxEmptyString, panel++);
SetStatusText(wxEmptyString, panel++);
@@ -2749,6 +2763,13 @@
m_pProgressBar->SetSize(r.GetSize());
}
+ if(m_pHighlightButton)
+ {
+ wxRect rect;
+ GetStatusBar()->GetFieldRect(1, rect);
+ m_pHighlightButton->SetPosition(rect.GetPosition());
+ m_pHighlightButton->SetSize(rect.GetSize());
+ }
// for flicker-free display
event.Skip();
}
@@ -3417,6 +3438,7 @@
#endif
}
}
+ m_pHighlightButton->SetLabel(theme->GetLanguageName(lang));
ed->SetLanguage(lang);
}
}
@@ -4382,6 +4404,44 @@
}
}
+void MainFrame::OnHighlightMenu(wxCommandEvent& event)
+{
+ cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
+ if (ed)
+ {
+ EditorColourSet* theme = Manager::Get()->GetEditorManager()->GetColourSet();
+ if (theme)
+ {
+ wxMenu mm;
+ wxMenu* hl = 0;
+ GetMenuBar()->FindItem(idEditHighlightModeText, &hl);
+ wxArrayString langs = theme->GetAllHighlightLanguages();
+
+ mm.AppendRadioItem(idEditHighlightModeText, _("Plain text"),
+ _("Switch highlighting mode for current document to \"Plain text\""));
+ Connect(hl->FindItem(_("Plain text")), -1, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
+ &MainFrame::OnEditHighlightMode);
+ for (size_t i = 0; i < langs.GetCount(); ++i)
+ {
+ if (i > 0 && !(i % 20))
+ mm.Break(); // break into columns every 20 items
+ mm.AppendRadioItem(hl->FindItem(langs[i]), langs[i],
+ wxString::Format(_("Switch highlighting mode for current document to \"%s\""), langs[i].c_str()));
+ Connect(hl->FindItem(langs[i]), -1, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
+ &MainFrame::OnEditHighlightMode);
+ }
+ int checkeditem = -1;
+ checkeditem = hl->FindItem(theme->GetLanguageName(ed->GetLanguage()));
+ mm.Check(checkeditem,true);
+ wxRect rect;
+ GetStatusBar()->GetFieldRect(1, rect);
+ PopupMenu(&mm, GetStatusBar()->GetPosition()+rect.GetPosition());
+ }
+ }
+}
+
void MainFrame::StartupDone()
{
m_StartupDone = true;
Index: src/ma
download for full patch...