Added a list style editor page to the formatting dialog.
Added a style organiser dialog, which can be used to browse for and apply styles and can be limited to show one of the three style types, or all three. Added a font name cache since it's an expensive operation that's used frequently by the rich text dialogs. Added ability to switch off tooltips for new dialogs (off by default). Improved the previews. Pressing tab or shift-tab at the start of a list item now demotes or promotes the item. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "wx/filename.h"
|
||||
#include "wx/dcbuffer.h"
|
||||
#include "wx/arrimpl.cpp"
|
||||
#include "wx/fontenum.h"
|
||||
|
||||
// DLL options compatibility check:
|
||||
#include "wx/app.h"
|
||||
@@ -91,6 +92,8 @@ END_EVENT_TABLE()
|
||||
* wxRichTextCtrl
|
||||
*/
|
||||
|
||||
wxArrayString wxRichTextCtrl::sm_availableFontNames;
|
||||
|
||||
wxRichTextCtrl::wxRichTextCtrl()
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
@@ -123,6 +126,9 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
||||
|
||||
GetBuffer().SetRichTextCtrl(this);
|
||||
|
||||
if (style & wxTE_READONLY)
|
||||
SetEditable(false);
|
||||
|
||||
wxTextAttrEx attributes;
|
||||
attributes.SetFont(GetFont());
|
||||
attributes.SetTextColour(*wxBLACK);
|
||||
@@ -638,6 +644,27 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
if (keycode == wxT('\t'))
|
||||
{
|
||||
// See if we need to promote or demote the selection or paragraph at the cursor
|
||||
// position, instead of inserting a tab.
|
||||
long pos = GetAdjustedCaretPosition(GetCaretPosition());
|
||||
wxRichTextParagraph* para = GetBuffer().GetParagraphAtPosition(pos);
|
||||
if (para && para->GetRange().GetStart() == pos && para->GetAttributes().HasListStyleName())
|
||||
{
|
||||
wxRichTextRange range;
|
||||
if (HasSelection())
|
||||
range = GetSelectionRange();
|
||||
else
|
||||
range = para->GetRange().FromInternal();
|
||||
|
||||
int promoteBy = event.ShiftDown() ? 1 : -1;
|
||||
|
||||
PromoteList(promoteBy, range, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BeginBatchUndo(_("Insert Text"));
|
||||
|
||||
@@ -2908,6 +2935,21 @@ bool wxRichTextCtrl::PromoteList(int promoteBy, const wxRichTextRange& range, co
|
||||
return GetBuffer().PromoteList(promoteBy, range.ToInternal(), defName, flags, specifiedLevel);
|
||||
}
|
||||
|
||||
const wxArrayString& wxRichTextCtrl::GetAvailableFontNames()
|
||||
{
|
||||
if (sm_availableFontNames.GetCount() == 0)
|
||||
{
|
||||
sm_availableFontNames = wxFontEnumerator::GetFacenames();
|
||||
sm_availableFontNames.Sort();
|
||||
}
|
||||
return sm_availableFontNames;
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::ClearAvailableFontNames()
|
||||
{
|
||||
sm_availableFontNames.Clear();
|
||||
}
|
||||
|
||||
#endif
|
||||
// wxUSE_RICHTEXT
|
||||
|
||||
|
Reference in New Issue
Block a user