#endif
// _WX_RICHTEXTBUFFER_H_
-
#endif
// _WX_RICHTEXTCTRL_H_
-
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
-
+
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
-
+
/// Map book control page index to our page id
void AddPageId(int id) { m_pageIds.Add(id); }
/////////////////////////////////////////////////////////////////////////////
-// Name: richtextliststylepage.h
-// Purpose:
+// Name: wx/richtext/richtextliststylepage.h
+// Purpose:
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 10/18/2006 11:36:37 AM
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence:
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTLISTSTYLEPAGE_H_
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxPanel
-{
+{
DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage )
DECLARE_EVENT_TABLE()
/// Transfer data from/to window
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
-
+
/// Get attributes for selected level
wxTextAttrEx* GetAttributesForSelection();
/// Transfer from the window and preview
void TransferAndPreview();
-
+
////@begin wxRichTextListStylePage event handler declarations
/// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
/////////////////////////////////////////////////////////////////////////////
-// Name: richtextstyledlg.h
-// Purpose:
+// Name: wx/richtext/richtextstyledlg.h
+// Purpose:
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 10/5/2006 12:05:31 PM
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence:
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSTYLEDLG_H_
/*!
* Flags for specifying permitted operations
*/
-
+
#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
-{
+{
DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
DECLARE_EVENT_TABLE()
/// Creates the controls and sizers
void CreateControls();
-
+
/// Initialise member variables
void Init();
/// Transfer data from/to window
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
-
+
/// Set/get style sheet
void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
-
+
/// Set/get control
void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
/// Set/get flags
void SetFlags(int flags) { m_flags = flags; }
int GetFlags() const { return m_flags; }
-
+
/// Show preview for given or selected preview
void ShowPreview(int sel = -1);
-
+
/// Clears the preview
void ClearPreview();
-
+
/// List selection
void OnListSelection(wxCommandEvent& event);
-
+
/// Get/set restart numbering boolean
bool GetRestartNumbering() const { return m_restartNumbering; }
void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
-
+
/// Get selected style name or definition
wxString GetSelectedStyle() const;
wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
-
+
/// Apply the style
bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
-
+
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
wxRichTextCtrl* m_richTextCtrl;
wxRichTextStyleSheet* m_richTextStyleSheet;
-
+
bool m_dontUpdate;
int m_flags;
static bool sm_showToolTips;
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextstylepage.h
-// Purpose:
+// Purpose:
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 10/5/2006 11:34:55 AM
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
*/
class wxRichTextStylePage: public wxPanel
-{
+{
DECLARE_DYNAMIC_CLASS( wxRichTextStylePage )
DECLARE_EVENT_TABLE()
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE );
-
+
/// Initialise members
void Init();
// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
-
+
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
size_t i = 0;
size_t len = text.length();
wxString line;
- wxRichTextParagraph* para = new wxRichTextParagraph(wxT(""), this, & style);
+ wxRichTextParagraph* para = new wxRichTextParagraph(wxEmptyString, this, & style);
if (paraStyle)
para->SetAttributes(*paraStyle);
wxRichTextPlainText* plainText = (wxRichTextPlainText*) para->GetChildren().GetFirst()->GetData();
plainText->SetText(line);
- para = new wxRichTextParagraph(wxT(""), this, & style);
+ para = new wxRichTextParagraph(wxEmptyString, this, & style);
if (paraStyle)
para->SetAttributes(*paraStyle);
}
else
newPara = para;
-
+
if (paragraphStyle && !charactersOnly)
{
if (applyMinimal)
// Problem: when changing from one list style to another, there's a danger that the level info will get lost.
// So when changing a list style interactively, could retrieve level based on current style, then
// set appropriate indent and apply new style.
-
+
if (!para->GetAttributes().GetParagraphStyleName().IsEmpty() && !para->GetAttributes().GetListStyleName().IsEmpty())
{
int currentIndent = para->GetAttributes().GetLeftIndent();
wxRichTextListStyleDefinition* listDef = styleSheet->FindListStyle(para->GetAttributes().GetListStyleName());
- // Overall list definition style
+ // Overall list definition style
para->GetAttributes() = listDef->GetStyle();
-
+
// Style for this level
wxRichTextApplyStyle(para->GetAttributes(), * listDef->GetLevelAttributes(listDef->FindLevelForIndent(currentIndent)));
// bool applyMinimal = ((flags & wxRICHTEXT_SETSTYLE_OPTIMIZE) != 0);
bool specifyLevel = ((flags & wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL) != 0);
bool renumber = ((flags & wxRICHTEXT_SETSTYLE_RENUMBER) != 0);
-
+
// Current number, if numbering
int n = startFrom;
-
+
wxASSERT (!specifyLevel || (specifyLevel && (specifiedLevel >= 0)));
// If we are associated with a control, make undoable; otherwise, apply immediately
}
else
newPara = para;
-
+
if (def)
{
int thisIndent = newPara->GetAttributes().GetLeftIndent();
int thisLevel = specifyLevel ? specifiedLevel : def->FindLevelForIndent(thisIndent);
-
+
// How is numbering going to work?
// If we are renumbering, or numbering for the first time, we need to keep
// track of the number for each level. But we might be simply applying a different
// Apply the overall list style, and item style for this level
wxTextAttrEx listStyle(def->GetCombinedStyleForLevel(thisLevel));
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
-
+
// Now we need to check numbering
if (renumber)
{
newPara->GetAttributes().SetBulletNumber(n);
}
-
+
n ++;
}
else if (!newPara->GetAttributes().GetListStyleName().IsEmpty())
newPara->GetAttributes().SetListStyleName(wxEmptyString);
newPara->GetAttributes().SetLeftIndent(0, 0);
-
+
// Eliminate the main list-related attributes
newPara->GetAttributes().SetFlags(newPara->GetAttributes().GetFlags() & ~wxTEXT_ATTR_LEFT_INDENT & ~wxTEXT_ATTR_BULLET_STYLE & ~wxTEXT_ATTR_BULLET_NUMBER & ~wxTEXT_ATTR_BULLET_SYMBOL & wxTEXT_ATTR_LIST_STYLE_NAME);
-
+
wxRichTextStyleSheet* styleSheet = GetStyleSheet();
if (styleSheet && !newPara->GetAttributes().GetParagraphStyleName().IsEmpty())
{
bool specifyLevel = ((flags & wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL) != 0);
bool renumber = ((flags & wxRICHTEXT_SETSTYLE_RENUMBER) != 0);
-
+
// Max number of levels
const int maxLevels = 10;
-
+
// The level we're looking at now
int currentLevel = -1;
-
+
// The item number for each level
int levels[maxLevels];
int i;
-
+
// Reset all numbering
for (i = 0; i < maxLevels; i++)
{
else
levels[i] = -1; // start from the number we found, if any
}
-
+
wxASSERT(!specifyLevel || (specifyLevel && (specifiedLevel >= 0)));
// If we are associated with a control, make undoable; otherwise, apply immediately
}
else
newPara = para;
-
+
wxRichTextListStyleDefinition* defToUse = def;
if (!defToUse)
{
wxRichTextStyleSheet* sheet = GetStyleSheet();
-
+
if (sheet && !newPara->GetAttributes().GetListStyleName().IsEmpty())
defToUse = sheet->FindListStyle(newPara->GetAttributes().GetListStyleName());
}
-
+
if (defToUse)
{
int thisIndent = newPara->GetAttributes().GetLeftIndent();
// change the level.
if (thisIndent == 0 || specifiedLevel != -1)
thisLevel = specifiedLevel;
-
+
// Do promotion if specified
if ((promoteBy != 0) && !para->GetRange().IsOutside(promotionRange))
{
if (thisLevel > 9)
thisLevel = 9;
}
-
+
// Apply the overall list style, and item style for this level
wxTextAttrEx listStyle(defToUse->GetCombinedStyleForLevel(thisLevel));
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
-
+
// OK, we've (re)applied the style, now let's get the numbering right.
-
+
if (currentLevel == -1)
currentLevel = thisLevel;
-
+
// Same level as before, do nothing except increment level's number afterwards
if (currentLevel == thisLevel)
{
else if (thisLevel < currentLevel)
{
currentLevel = thisLevel;
- }
+ }
// Use the current numbering if -1 and we have a bullet number already
if (levels[currentLevel] == -1)
else
levels[currentLevel] = 1;
}
-
+
newPara->GetAttributes().SetBulletNumber(levels[currentLevel]);
- levels[currentLevel] ++;
+ levels[currentLevel] ++;
}
}
}
// list position will start from 1.
// Similarly, we look after the last para in the promote range for an indentation that is less (or no list style).
// We can end the renumbering at this point.
-
+
// For now, only renumber within the promotion range.
-
+
return DoNumberList(range, range, promoteBy, def, flags, 1, specifiedLevel);
}
// Compensate for kerning difference
wxString stringFragment2(m_text.Mid(r1 - offset, fragmentLen+1));
wxString stringFragment3(m_text.Mid(r1 - offset + fragmentLen, 1));
-
+
wxCoord w1, h1, w2, h2, w3, h3;
dc.GetTextExtent(stringFragment, & w1, & h1);
dc.GetTextExtent(stringFragment2, & w2, & h2);
dc.GetTextExtent(stringFragment3, & w3, & h3);
-
+
int kerningDiff = (w1 + w3) - w2;
x = x - kerningDiff;
}
// Compensate for kerning difference
wxString stringFragment2(m_text.Mid(s1 - offset, fragmentLen+1));
wxString stringFragment3(m_text.Mid(s1 - offset + fragmentLen, 1));
-
+
wxCoord w1, h1, w2, h2, w3, h3;
dc.GetTextExtent(stringFragment, & w1, & h1);
dc.GetTextExtent(stringFragment2, & w2, & h2);
dc.GetTextExtent(stringFragment3, & w3, & h3);
-
+
int kerningDiff = (w1 + w3) - w2;
x = x - kerningDiff;
}
tabArray = textAttr.GetTabs();
int tabCount = tabArray.GetCount();
-
+
for (int i = 0; i < tabCount; ++i)
{
int pos = tabArray[i];
pos = ((wxRichTextPlainText*) this)->ConvertTenthsMMToPixels(dc, pos);
tabArray[i] = pos;
}
-
+
int nextTabPos = -1;
while (stringChunk.Find(wxT('\t')) >= 0)
styleSheet->InsertSheet(m_styleSheet);
SetStyleSheet(styleSheet);
-
+
return true;
}
wxRichTextStyleSheet* oldSheet = m_styleSheet;
m_styleSheet = oldSheet->GetNextSheet();
oldSheet->Unlink();
-
+
return oldSheet;
}
else
/// Load a file
bool wxRichTextBuffer::LoadFile(const wxString& filename, int type)
+
+
{
wxRichTextFileHandler* handler = FindHandlerFilenameOrType(filename, type);
if (handler)
#endif
// wxUSE_RICHTEXT
-
itemBoxSizer11->Add(itemBoxSizer13, 0, wxGROW, 5);
wxString* m_symbolCtrlStrings = NULL;
- m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
+ m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
m_symbolCtrl->SetHelpText(_("The bullet character."));
if (ShowToolTips())
m_symbolCtrl->SetToolTip(_("The bullet character."));
itemBoxSizer11->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_symbolFontCtrlStrings = NULL;
- m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
+ m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
m_symbolFontCtrl->SetHelpText(_("Available fonts."));
if (ShowToolTips())
m_symbolFontCtrl->SetToolTip(_("Available fonts."));
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
-
+
m_previewCtrl->BeginStyle(attr);
m_previewCtrl->WriteText(s_para2);
m_previewCtrl->EndStyle();
event.Skip();
return;
}
-
+
if (keycode == wxT('\t'))
{
// See if we need to promote or demote the selection or paragraph at the cursor
range = GetSelectionRange();
else
range = para->GetRange().FromInternal();
-
+
int promoteBy = event.ShiftDown() ? 1 : -1;
PromoteList(promoteBy, range, NULL);
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
{
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
-
+
wxRichTextRange range;
-
+
if (HasSelection())
range = GetSelectionRange();
else
{
- long pos = GetAdjustedCaretPosition(GetCaretPosition());
+ long pos = GetAdjustedCaretPosition(GetCaretPosition());
range = wxRichTextRange(pos, pos+1);
}
-
- return SetListStyle(range, (wxRichTextListStyleDefinition*) def, flags);
- }
-
+
+ return SetListStyle(range, (wxRichTextListStyleDefinition*) def, flags);
+ }
+
// Make sure the attr has the style name
if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
{
/// Number/renumber any list elements in the given range
bool wxRichTextCtrl::NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags, int startFrom, int specifiedLevel)
{
- return GetBuffer().NumberList(range.ToInternal(), def, flags, startFrom, specifiedLevel);
+ return GetBuffer().NumberList(range.ToInternal(), def, flags, startFrom, specifiedLevel);
}
bool wxRichTextCtrl::NumberList(const wxRichTextRange& range, const wxString& defName, int flags, int startFrom, int specifiedLevel)
{
- return GetBuffer().NumberList(range.ToInternal(), defName, flags, startFrom, specifiedLevel);
+ return GetBuffer().NumberList(range.ToInternal(), defName, flags, startFrom, specifiedLevel);
}
/// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
#endif
// wxUSE_RICHTEXT
-
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "../../include/wx/richtext/richtextfontpage.h"
+#include "wx/richtext/richtextfontpage.h"
/*!
* wxRichTextFontPage type definition
wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Font:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
- m_faceTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_FACETEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
+ m_faceTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_FACETEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_faceTextCtrl->SetHelpText(_("Type a font name."));
if (ShowToolTips())
m_faceTextCtrl->SetToolTip(_("Type a font name."));
wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
- m_sizeTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_sizeTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_sizeTextCtrl->SetHelpText(_("Type a size in points."));
if (ShowToolTips())
m_sizeTextCtrl->SetToolTip(_("Type a size in points."));
itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_styleCtrlStrings = NULL;
- m_styleCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_STYLECTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_styleCtrlStrings, wxCB_READONLY );
+ m_styleCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_STYLECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_styleCtrlStrings, wxCB_READONLY );
m_styleCtrl->SetHelpText(_("Select regular or italic style."));
if (ShowToolTips())
m_styleCtrl->SetToolTip(_("Select regular or italic style."));
itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_weightCtrlStrings = NULL;
- m_weightCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_WEIGHTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_weightCtrlStrings, wxCB_READONLY );
+ m_weightCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_WEIGHTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_weightCtrlStrings, wxCB_READONLY );
m_weightCtrl->SetHelpText(_("Select regular or bold."));
if (ShowToolTips())
m_weightCtrl->SetToolTip(_("Select regular or bold."));
itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_underliningCtrlStrings = NULL;
- m_underliningCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_underliningCtrlStrings, wxCB_READONLY );
+ m_underliningCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_underliningCtrlStrings, wxCB_READONLY );
m_underliningCtrl->SetHelpText(_("Select underlining or no underlining."));
if (ShowToolTips())
m_underliningCtrl->SetToolTip(_("Select underlining or no underlining."));
int imageIndex = GetPageImage(pageId);
dialog->GetBookCtrl()->AddPage(panel, title, !selected, imageIndex);
selected = true;
-
+
dialog->AddPageId(pageId);
}
}
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeft->SetHelpText(_("The left indent."));
if (ShowToolTips())
m_indentLeft->SetToolTip(_("The left indent."));
wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeftFirst->SetHelpText(_("The first line indent."));
if (ShowToolTips())
m_indentLeftFirst->SetToolTip(_("The first line indent."));
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentRight->SetHelpText(_("The right indent."));
if (ShowToolTips())
m_indentRight->SetToolTip(_("The right indent."));
wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer39->Add(itemBoxSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
if (ShowToolTips())
m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer39->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
if (ShowToolTips())
m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
itemBoxSizer44->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
/////////////////////////////////////////////////////////////////////////////
-// Name: richtextliststylepage.cpp
-// Purpose:
+// Name: src/richtext/richtextliststylepage.cpp
+// Purpose:
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 10/18/2006 11:36:37 AM
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence:
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "../../include/wx/richtext/richtextliststylepage.h"
+#include "wx/richtext/richtextliststylepage.h"
////@begin XPM images
////@end XPM images
}
/*!
- * Member initialisation
+ * Member initialisation
*/
void wxRichTextListStylePage::Init()
*/
void wxRichTextListStylePage::CreateControls()
-{
+{
////@begin wxRichTextListStylePage content construction
wxRichTextListStylePage* itemPanel1 = this;
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer19->Add(itemBoxSizer21, 0, wxGROW, 5);
wxString* m_symbolCtrlStrings = NULL;
- m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
+ m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
m_symbolCtrl->SetHelpText(_("The bullet character."));
if (ShowToolTips())
m_symbolCtrl->SetToolTip(_("The bullet character."));
itemBoxSizer19->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_symbolFontCtrlStrings = NULL;
- m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
+ m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
if (ShowToolTips())
m_symbolFontCtrl->SetToolTip(_("Available fonts."));
itemBoxSizer19->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer53->Add(itemBoxSizer55, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeft->SetHelpText(_("The left indent."));
if (ShowToolTips())
m_indentLeft->SetToolTip(_("The left indent."));
wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer53->Add(itemBoxSizer58, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeftFirst->SetHelpText(_("The first line indent."));
if (ShowToolTips())
m_indentLeftFirst->SetToolTip(_("The first line indent."));
wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer53->Add(itemBoxSizer61, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_indentRight->SetHelpText(_("The right indent."));
if (ShowToolTips())
m_indentRight->SetToolTip(_("The right indent."));
wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer70->Add(itemBoxSizer72, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
if (ShowToolTips())
m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
wxBoxSizer* itemBoxSizer75 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer70->Add(itemBoxSizer75, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
m_spacingAfter->SetHelpText(_("The spacing after the paragraph."));
if (ShowToolTips())
m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
wxRichTextListStyleDefinition);
-
+
wxTextAttrEx attr(def->GetStyle());
attr.SetFlags(attr.GetFlags() &
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
-
+
m_previewCtrl->BeginStyle(attr);
-
+
int i;
for (i = 0; i < 10; i++)
{
attr->SetBulletSymbol(c);
attr->SetBulletFont(m_symbolFontCtrl->GetValue());
}
-
+
return true;
}
{
DoTransferDataToWindow();
UpdatePreview();
-
+
return true;
}
m_dontUpdate = true;
wxPanel::TransferDataToWindow();
-
+
m_levelCtrl->SetValue(m_currentLevel);
wxTextAttrEx* attr = GetAttributesForSelection();
{
wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
wxRichTextListStyleDefinition);
-
+
int value = m_levelCtrl->GetValue();
-
+
if (def)
return def->GetLevelAttributes(value-1);
else
////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
// Before editing this code, remove the block markers.
event.Skip();
-////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
}
/*!
////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
// Before editing this code, remove the block markers.
event.Skip();
-////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
}
/*!
////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
// Before editing this code, remove the block markers.
event.Skip();
-////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
}
/*!
TransferAndPreview();
}
}
-
-
/////////////////////////////////////////////////////////////////////////////
-// Name: richtextstyledlg.cpp
-// Purpose:
+// Name: src/richtext/richtextstyledlg.cpp
+// Purpose:
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 10/5/2006 12:05:31 PM
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence:
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
m_dontUpdate = false;
m_flags = 0;
m_restartNumbering = true;
-
+
////@begin wxRichTextStyleOrganiserDialog member initialisation
m_innerSizer = NULL;
m_buttonSizerParent = NULL;
m_deleteStyle = NULL;
m_closeButton = NULL;
m_bottomButtonSizer = NULL;
+
m_restartNumberingCtrl = NULL;
m_okButton = NULL;
m_cancelButton = NULL;
m_richTextStyleSheet = sheet;
m_richTextCtrl = ctrl;
m_flags = flags;
-
+
////@begin wxRichTextStyleOrganiserDialog creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP);
wxDialog::Create( parent, id, caption, pos, size, style );
*/
void wxRichTextStyleOrganiserDialog::CreateControls()
-{
+{
bool hideTypeSelector = false;
wxRichTextStyleListBox::wxRichTextStyleType typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL;
-
+
if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_CHARACTER) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER;
{
// wxRICHTEXT_ORGANISER_SHOW_ALL is implied if the other styles aren't included
}
-
+
long listCtrlStyle = 0;
if (hideTypeSelector)
listCtrlStyle = wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR;
-
+
////@begin wxRichTextStyleOrganiserDialog content construction
wxRichTextStyleOrganiserDialog* itemDialog1 = this;
{
m_buttonSizerParent->Show(m_buttonSizer, false);
}
-
+
// No buttons in the horizontal group are shown, so hide the whole sizer
if ((m_flags & (wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)) == 0)
{
m_innerSizer->Show(m_bottomButtonSizer, false);
}
-
+
if (hideTypeSelector)
{
m_stylesListBox->GetStyleListBox()->SetStyleType(typesToShow);
}
-
+
m_stylesListBox->SetStyleSheet(m_richTextStyleSheet);
m_stylesListBox->SetRichTextCtrl(m_richTextCtrl);
m_stylesListBox->UpdateStyles();
{
if (!wxDialog::TransferDataFromWindow())
return false;
-
+
m_restartNumbering = m_restartNumberingCtrl->GetValue();
-
+
return true;
}
{
if (!wxDialog::TransferDataToWindow())
return false;
-
+
m_restartNumberingCtrl->SetValue(m_restartNumbering);
-
+
return true;
}
{
sel = m_stylesListBox->GetStyleListBox()->GetSelection();
if (sel == -1)
- return;
+ return;
}
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
-
+
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
//wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
- //wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition);
-
+ //wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition);
+
wxTextAttrEx attr(def->GetStyle());
#if 0
attr.SetFlags(attr.GetFlags() &
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
m_previewCtrl->Freeze();
- m_previewCtrl->Clear();
+ m_previewCtrl->Clear();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
-
+
m_previewCtrl->BeginStyle(attr);
-
+
if (listDef)
{
int i;
{
m_previewCtrl->WriteText(wxString(wxT("\n")) + s_para2);
}
-
+
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->Thaw();
}
-
+
/// Clears the preview
void wxRichTextStyleOrganiserDialog::ClearPreview()
{
return false;
if (!ctrl->HasSelection())
return false;
-
- wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
+
+ wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
if (listDef && m_restartNumberingCtrl->GetValue())
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
-
+
wxRichTextCharacterStyleDefinition* style = new wxRichTextCharacterStyleDefinition(styleName);
-
+
int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_STYLE_EDITOR;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
-
+
(*((wxRichTextCharacterStyleDefinition* ) style)) = (*charDef);
-
+
GetStyleSheet()->AddCharacterStyle(style);
m_stylesListBox->UpdateStyles();
}
else
delete style;
- }
+ }
}
/*!
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
-
+
wxRichTextParagraphStyleDefinition* style = new wxRichTextParagraphStyleDefinition(styleName);
-
+
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
-
+
(*((wxRichTextParagraphStyleDefinition* ) style)) = (*paraDef);
-
+
GetStyleSheet()->AddParagraphStyle(style);
m_stylesListBox->UpdateStyles();
}
else
delete style;
- }
+ }
}
/*!
if (sel != wxNOT_FOUND)
{
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
-
+
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
-
+
if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
{
pages |= wxRICHTEXT_FORMAT_FONT;
{
pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
}
-
+
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*def, GetStyleSheet());
formatDlg.Create(pages, this);
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
-
+
if (listDef)
{
(*((wxRichTextListStyleDefinition* ) def)) = (*listDef);
if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), (const wxChar*) name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this))
{
m_stylesListBox->GetStyleListBox()->SetItemCount(0);
-
+
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
-
+
m_stylesListBox->UpdateStyles();
if (m_stylesListBox->GetStyleListBox()->GetSelection() != -1)
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
-
+
wxRichTextListStyleDefinition* style = new wxRichTextListStyleDefinition(styleName);
-
+
// Initialize the style to make it easier to edit
int i;
for (i = 0; i < 10; i++)
style->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_SYMBOL, bulletSymbol);
}
-
+
int pages = wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
-
+
(*((wxRichTextListStyleDefinition* ) style)) = (*listDef);
-
+
GetStyleSheet()->AddListStyle(style);
m_stylesListBox->UpdateStyles();
}
else
delete style;
- }
+ }
}
/*!
else
event.Skip();
}
-
wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
- m_styleName = new wxTextCtrl( itemPanel1, ID_RICHTEXTSTYLEPAGE_STYLE_NAME, _T(""), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY );
+ m_styleName = new wxTextCtrl( itemPanel1, ID_RICHTEXTSTYLEPAGE_STYLE_NAME, wxEmptyString, wxDefaultPosition, wxSize(300, -1), wxTE_READONLY );
m_styleName->SetHelpText(_("The style name."));
if (ShowToolTips())
m_styleName->SetToolTip(_("The style name."));
itemBoxSizer5->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_basedOnStrings = NULL;
- m_basedOn = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_BASED_ON, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_basedOnStrings, wxCB_DROPDOWN );
+ m_basedOn = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_BASED_ON, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_basedOnStrings, wxCB_DROPDOWN );
m_basedOn->SetHelpText(_("The style on which this style is based."));
if (ShowToolTips())
m_basedOn->SetToolTip(_("The style on which this style is based."));
itemBoxSizer5->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_nextStyleStrings = NULL;
- m_nextStyle = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_NEXT_STYLE, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_nextStyleStrings, wxCB_DROPDOWN );
+ m_nextStyle = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_NEXT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_nextStyleStrings, wxCB_DROPDOWN );
m_nextStyle->SetHelpText(_("The default style for the next paragraph."));
if (ShowToolTips())
m_nextStyle->SetToolTip(_("The default style for the next paragraph."));
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
if (paraDef)
paraDef->SetNextStyle(m_nextStyle->GetValue());
-
+
def->SetName(m_styleName->GetValue());
def->SetBaseStyle(m_basedOn->GetValue());
}
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
// wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition);
wxRichTextStyleSheet* sheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
-
+
m_styleName->SetValue(def->GetName());
-
+
if (listDef)
{
if (m_nextStyle->GetCount() == 0)
}
m_nextStyle->SetValue(paraDef->GetNextStyle());
}
-
+
if (m_basedOn->GetCount() == 0)
{
if (sheet)
}
}
}
-
+
m_basedOn->SetValue(def->GetBaseStyle());
}
void wxRichTextListStyleDefinition::Copy(const wxRichTextListStyleDefinition& def)
{
wxRichTextParagraphStyleDefinition::Copy(def);
-
+
int i;
for (i = 0; i < 10; i++)
m_levelStyles[i] = def.m_levelStyles[i];
for (i = 0; i < 10; i++)
if (!(m_levelStyles[i] == def.m_levelStyles[i]))
return false;
-
+
return true;
}
if (i >= 0 && i < 10)
{
wxTextAttrEx attr;
-
+
attr.SetBulletStyle(bulletStyle);
attr.SetLeftIndent(leftIndent, leftSubIndent);
if (!bulletSymbol.IsEmpty())
attr.SetBulletSymbol(bulletSymbol[0]);
-
- m_levelStyles[i] = attr;
- }
+
+ m_levelStyles[i] = attr;
+ }
}
/// Finds the level corresponding to the given indentation
wxTextAttrEx wxRichTextListStyleDefinition::CombineWithParagraphStyle(int indent, const wxTextAttrEx& paraStyle)
{
int listLevel = FindLevelForIndent(indent);
-
+
wxTextAttrEx attr(*GetLevelAttributes(listLevel));
int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent();
- // First apply the overall paragraph style, if any
+ // First apply the overall paragraph style, if any
wxRichTextApplyStyle(attr, GetStyle());
// Then apply paragraph style, e.g. from paragraph style definition
wxRichTextApplyStyle(attr, paraStyle);
-
+
// We override the indents according to the list definition
attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent);
-
+
return attr;
}
int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent();
- // Apply the overall paragraph style, if any
+ // Apply the overall paragraph style, if any
wxRichTextApplyStyle(attr, GetStyle());
// We override the indents according to the list definition
attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent);
-
+
return attr;
}
if (m_nextSheet)
m_nextSheet->m_previousSheet = m_previousSheet;
-
+
if (m_previousSheet)
m_previousSheet->m_nextSheet = m_nextSheet;
-
+
m_previousSheet = NULL;
m_nextSheet = NULL;
}
if (def->GetName().Lower() == name.Lower())
return def;
}
-
+
if (m_nextSheet && recurse)
return m_nextSheet->FindStyle(list, name, recurse);
{
m_previousSheet = before->m_previousSheet;
m_nextSheet = before;
-
+
before->m_previousSheet = this;
return true;
}
{
last = last->m_nextSheet;
}
-
+
if (last)
{
m_previousSheet = last;
last->m_nextSheet = this;
-
+
return true;
}
else
m_previousSheet->m_nextSheet = m_nextSheet;
if (m_nextSheet)
m_nextSheet->m_previousSheet = m_previousSheet;
-
+
m_previousSheet = NULL;
m_nextSheet = NULL;
}
{
if (!GetStyleSheet())
return wxEmptyString;
-
+
wxRichTextStyleDefinition* def = GetStyle(n);
if (def)
return CreateHTML(def);
else if ((GetStyleType() == wxRICHTEXT_STYLE_LIST) && (i < GetStyleSheet()->GetListStyleCount()))
{
return GetStyleSheet()->GetListStyle(i);
- }
+ }
return NULL;
}
if (GetStyleSheet())
{
SetSelection(wxNOT_FOUND);
-
+
if (GetStyleType() == wxRICHTEXT_STYLE_ALL)
SetItemCount(GetStyleSheet()->GetParagraphStyleCount()+GetStyleSheet()->GetCharacterStyleCount()+GetStyleSheet()->GetListStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH)
SetItemCount(GetStyleSheet()->GetCharacterStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_LIST)
SetItemCount(GetStyleSheet()->GetListStyleCount());
-
+
Refresh();
if (GetItemCount() > 0)
{
SetSelection(0);
SendSelectedEvent();
- }
+ }
}
}
{
styleName = para->GetAttributes().GetListStyleName();
}
-
+
return styleName;
}
const wxSize& size, long style)
{
wxControl::Create(parent, id, pos, size, style);
-
+
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (size != wxDefaultSize)
SetBestFittingSize(size);
-
+
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
-
+
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER);
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
-
+
if (showSelector)
- {
+ {
wxArrayString choices;
choices.Add(_("All styles"));
choices.Add(_("Paragraph styles"));
choices.Add(_("Character styles"));
choices.Add(_("List styles"));
-
+
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
-
+
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
}
{
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0);
}
-
+
SetSizer(boxSizer);
Layout();
m_dontUpdate = true;
if (m_styleChoice)
- {
+ {
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
-
+
m_dontUpdate = false;
-
+
return true;
}
wxRichTextStyleListCtrl::~wxRichTextStyleListCtrl()
{
-
+
}
/// React to style type choice
{
if (m_dontUpdate)
return;
-
+
wxRichTextStyleListBox::wxRichTextStyleType styleType = StyleIndexToType(event.GetSelection());
m_styleListBox->SetStyleType(styleType);
}
m_dontUpdate = true;
if (m_styleChoice)
- {
+ {
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
-
+
m_dontUpdate = false;
}
void wxRichTextStyleListCtrl::UpdateStyles()
{
if (m_styleListBox)
- m_styleListBox->UpdateStyles();
+ m_styleListBox->UpdateStyles();
}
#if wxUSE_COMBOCTRL
if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && wxWindow::FindFocus() != this)
{
wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType());
-
+
wxString currentValue = GetValue();
if (!styleName.IsEmpty())
{
#endif
// wxUSE_RICHTEXT
-
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
wxString* m_fontCtrlStrings = NULL;
- m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, _T(""), wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY );
+ m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, wxEmptyString, wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY );
m_fontCtrl->SetHelpText(_("The font from which to take the symbol."));
if (ShowToolTips())
m_fontCtrl->SetToolTip(_("The font from which to take the symbol."));
#if defined(__UNICODE__)
wxString* m_subsetCtrlStrings = NULL;
- m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY );
+ m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY );
m_subsetCtrl->SetHelpText(_("Shows a Unicode subset."));
if (ShowToolTips())
m_subsetCtrl->SetToolTip(_("Shows a Unicode subset."));
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Character code:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer12->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
- m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, _T(""), wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
+ m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, wxEmptyString, wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
m_characterCodeCtrl->SetHelpText(_("The character code."));
if (ShowToolTips())
m_characterCodeCtrl->SetToolTip(_("The character code."));
wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Position (tenths of a mm):"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
- m_tabEditCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTTABSPAGE_TABEDIT, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
+ m_tabEditCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTTABSPAGE_TABEDIT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_tabEditCtrl->SetHelpText(_("The tab position."));
if (ShowToolTips())
m_tabEditCtrl->SetToolTip(_("The tab position."));
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer4->Add(itemBoxSizer10, 0, wxGROW, 5);
- wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1, wxID_STATIC, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
+ wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxADJUST_MINSIZE, 5);
wxButton* itemButton12 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_NEW_TAB, _("&New"), wxDefaultPosition, wxDefaultSize, 0 );