Applied #12941: Fixes and enhancements for wxRTC (Robert Hoffman)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67020 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2011-02-25 11:37:20 +00:00
parent 887b919bde
commit 706465df1f
9 changed files with 704 additions and 295 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1919,7 +1919,8 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl
// Assume this box only contains paragraphs
wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph);
wxCHECK_MSG( child, false, wxT("Unknown object in layout") );
// Unsure if this is needed
// wxCHECK_MSG( child, false, wxT("Unknown object in layout") );
if (child && child->IsShown())
{
@ -8630,8 +8631,6 @@ bool wxRichTextTable::Layout(wxDC& dc, const wxRect& rect, int style)
wxRichTextCell* cell = GetCell(j, i);
if (cell->IsShown())
{
wxASSERT(colWidths[i] > 0);
// Get max specified cell height
// Don't handle percentages for height
if (cell->GetAttributes().GetTextBoxAttr().GetHeight().IsValid() && cell->GetAttributes().GetTextBoxAttr().GetHeight().GetUnits() != wxTEXT_ATTR_UNITS_PERCENTAGE)

View File

@ -140,6 +140,8 @@ bool wxRichTextBulletsPage::Create( wxWindow* parent, wxWindowID id, const wxPoi
void wxRichTextBulletsPage::CreateControls()
{
m_dontUpdate = true;
////@begin wxRichTextBulletsPage content construction
wxRichTextBulletsPage* itemRichTextDialogPage1 = this;
@ -311,6 +313,8 @@ void wxRichTextBulletsPage::CreateControls()
facenames.Sort();
m_symbolFontCtrl->Append(facenames);
m_dontUpdate = false;
}
/// Transfer data from/to window

View File

@ -2229,14 +2229,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -3050,7 +3042,7 @@
<string name="proxy-GrowableColumns">""</string>
<string name="proxy-GrowableRows">""</string>
<long name="proxy-Columns">2</long>
<long name="proxy-Rows">4</long>
<long name="proxy-Rows">0</long>
<long name="proxy-ColumnSpacing">0</long>
<long name="proxy-RowSpacing">0</long>
<string name="proxy-Member variable name">""</string>
@ -4021,7 +4013,7 @@
<string name="proxy-GrowableColumns">"1"</string>
<string name="proxy-GrowableRows">""</string>
<long name="proxy-Columns">2</long>
<long name="proxy-Rows">3</long>
<long name="proxy-Rows">30</long>
<long name="proxy-ColumnSpacing">0</long>
<long name="proxy-RowSpacing">0</long>
<string name="proxy-Member variable name">""</string>
@ -10562,14 +10554,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -11222,7 +11206,7 @@
<long name="proxy-X">-1</long>
<long name="proxy-Y">-1</long>
<long name="proxy-Width">-1</long>
<long name="proxy-Height">140</long>
<long name="proxy-Height">80</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">1</long>
@ -13213,7 +13197,7 @@
<string name="proxy-GrowableColumns">""</string>
<string name="proxy-GrowableRows">""</string>
<long name="proxy-Columns">2</long>
<long name="proxy-Rows">2</long>
<long name="proxy-Rows">0</long>
<long name="proxy-ColumnSpacing">0</long>
<long name="proxy-RowSpacing">0</long>
<string name="proxy-Member variable name">""</string>
@ -14047,7 +14031,7 @@
<string name="proxy-GrowableColumns">""</string>
<string name="proxy-GrowableRows">""</string>
<long name="proxy-Columns">2</long>
<long name="proxy-Rows">2</long>
<long name="proxy-Rows">0</long>
<long name="proxy-ColumnSpacing">0</long>
<long name="proxy-RowSpacing">0</long>
<string name="proxy-Member variable name">""</string>
@ -14637,8 +14621,8 @@
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
<bool name="proxy-wxBORDER_THEME">0</bool>
<bool name="proxy-wxSUNKEN_BORDER">1</bool>
<bool name="proxy-wxBORDER_THEME">1</bool>
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
<bool name="proxy-wxRAISED_BORDER">0</bool>
<bool name="proxy-wxSTATIC_BORDER">0</bool>
<bool name="proxy-wxWANTS_CHARS">0</bool>
@ -14652,7 +14636,7 @@
<long name="proxy-X">-1</long>
<long name="proxy-Y">-1</long>
<long name="proxy-Width">350</long>
<long name="proxy-Height">180</long>
<long name="proxy-Height">140</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
@ -15703,7 +15687,7 @@
<string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_unitsW"</string>
<string name="proxy-Strings">"px|cm"</string>
<string name="proxy-Strings">"px|cm|percent"</string>
<string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the object width."</string>
<string name="proxy-Tooltip text">""</string>
@ -15939,7 +15923,7 @@
<string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_unitsH"</string>
<string name="proxy-Strings">"px|cm"</string>
<string name="proxy-Strings">"px|cm|percent"</string>
<string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the object height."</string>
<string name="proxy-Tooltip text">""</string>

View File

@ -611,9 +611,14 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
if (dim.GetUnits() == wxTEXT_ATTR_UNITS_TENTHS_MM)
{
unitsIdx = 1;
float value = float(dim.GetValue()) / 10.0;
float value = float(dim.GetValue()) / 100.0;
valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value));
}
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE)
{
unitsIdx = 2;
valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue()));
}
else
{
unitsIdx = 0;
@ -634,6 +639,8 @@ void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxT
{
if (unitsCtrl->GetSelection() == 1)
dim.SetUnits(wxTEXT_ATTR_UNITS_TENTHS_MM);
else if (unitsCtrl->GetSelection() == 2)
dim.SetUnits(wxTEXT_ATTR_UNITS_PERCENTAGE);
else
dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS);

View File

@ -201,7 +201,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(4, 2, 0, 0);
wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(0, 2, 0, 0);
itemBoxSizer20->Add(itemFlexGridSizer22, 0, wxALIGN_CENTER_VERTICAL, 5);
wxStaticText* itemStaticText23 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -279,7 +279,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
itemBoxSizer39->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
wxFlexGridSizer* itemFlexGridSizer41 = new wxFlexGridSizer(3, 2, 0, 0);
wxFlexGridSizer* itemFlexGridSizer41 = new wxFlexGridSizer(30, 2, 0, 0);
itemFlexGridSizer41->AddGrowableCol(1);
itemBoxSizer39->Add(itemFlexGridSizer41, 0, wxALIGN_CENTER_VERTICAL, 5);

View File

@ -212,7 +212,7 @@ void wxRichTextListStylePage::CreateControls()
itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
wxArrayString m_styleListBoxStrings;
m_styleListBox = new wxListBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 140), m_styleListBoxStrings, wxLB_SINGLE );
m_styleListBox = new wxListBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 80), m_styleListBoxStrings, wxLB_SINGLE );
m_styleListBox->SetHelpText(_("The available bullet styles."));
if (wxRichTextListStylePage::ShowToolTips())
m_styleListBox->SetToolTip(_("The available bullet styles."));
@ -377,7 +377,7 @@ void wxRichTextListStylePage::CreateControls()
itemBoxSizer53->Add(itemBoxSizer55, 0, wxALIGN_LEFT|wxALL, 5);
itemBoxSizer55->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
wxFlexGridSizer* itemFlexGridSizer57 = new wxFlexGridSizer(2, 2, 0, 0);
wxFlexGridSizer* itemFlexGridSizer57 = new wxFlexGridSizer(0, 2, 0, 0);
itemBoxSizer55->Add(itemFlexGridSizer57, 0, wxALIGN_CENTER_VERTICAL, 5);
wxStaticText* itemStaticText58 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer57->Add(itemStaticText58, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -428,7 +428,7 @@ void wxRichTextListStylePage::CreateControls()
itemBoxSizer70->Add(itemBoxSizer72, 0, wxALIGN_LEFT|wxALL, 5);
itemBoxSizer72->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
wxFlexGridSizer* itemFlexGridSizer74 = new wxFlexGridSizer(2, 2, 0, 0);
wxFlexGridSizer* itemFlexGridSizer74 = new wxFlexGridSizer(0, 2, 0, 0);
itemBoxSizer72->Add(itemFlexGridSizer74, 0, wxALIGN_CENTER_VERTICAL, 5);
wxStaticText* itemStaticText75 = new wxStaticText( itemPanel37, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer74->Add(itemStaticText75, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -472,7 +472,7 @@ void wxRichTextListStylePage::CreateControls()
itemBoxSizer3->Add(itemNotebook9, 0, wxGROW|wxALL, 5);
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER|wxVSCROLL|wxTE_READONLY );
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 140), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
if (wxRichTextListStylePage::ShowToolTips())
m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));

View File

@ -216,6 +216,7 @@ void wxRichTextSizePage::CreateControls()
wxArrayString m_unitsWStrings;
m_unitsWStrings.Add(_("px"));
m_unitsWStrings.Add(_("cm"));
m_unitsWStrings.Add(_("percent"));
m_unitsW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsWStrings, wxCB_READONLY );
m_unitsW->SetStringSelection(_("px"));
m_unitsW->SetHelpText(_("Units for the object width."));
@ -242,6 +243,7 @@ void wxRichTextSizePage::CreateControls()
wxArrayString m_unitsHStrings;
m_unitsHStrings.Add(_("px"));
m_unitsHStrings.Add(_("cm"));
m_unitsHStrings.Add(_("percent"));
m_unitsH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHStrings, wxCB_READONLY );
m_unitsH->SetStringSelection(_("px"));
m_unitsH->SetHelpText(_("Units for the object height."));

View File

@ -406,6 +406,9 @@ wxString wxRichTextXMLHandler::GetText(wxXmlNode *node, const wxString& param, b
wxXmlNode* wxRichTextXMLHandler::FindNode(wxXmlNode* node, const wxString& name)
{
if (node->GetName() == name && name == wxT("stylesheet"))
return node;
wxXmlNode* child = node->GetChildren();
while (child)
{
@ -943,6 +946,11 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxRichT
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
wxString name = def->GetName();
wxString nameProp;
if (!name.empty())
nameProp = wxT(" name=\"") + name + wxT("\"");
wxString baseStyle = def->GetBaseStyle();
wxString baseStyleProp;
if (!baseStyle.empty())
@ -956,7 +964,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxRichT
if (charDef)
{
OutputIndentation(stream, level);
OutputString(stream, wxT("<characterstyle") + baseStyleProp + descrProp + wxT(">"));
OutputString(stream, wxT("<characterstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
@ -980,7 +988,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxRichT
if (!listDef->GetNextStyle().empty())
baseStyleProp << wxT(" nextstyle=\"") << listDef->GetNextStyle() << wxT("\"");
OutputString(stream, wxT("<liststyle") + baseStyleProp + descrProp + wxT(">"));
OutputString(stream, wxT("<liststyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
@ -1021,7 +1029,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxRichT
if (!paraDef->GetNextStyle().empty())
baseStyleProp << wxT(" nextstyle=\"") << paraDef->GetNextStyle() << wxT("\"");
OutputString(stream, wxT("<paragraphstyle") + baseStyleProp + descrProp + wxT(">"));
OutputString(stream, wxT("<paragraphstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
@ -1042,7 +1050,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxRichT
{
OutputIndentation(stream, level);
OutputString(stream, wxT("<boxstyle") + baseStyleProp + descrProp + wxT(">"));
OutputString(stream, wxT("<boxstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
@ -1181,7 +1189,21 @@ wxString wxRichTextXMLHandler::AddAttributes(const wxRichTextAttr& attr, bool is
AddAttribute(str, wxT("border"), attr.GetTextBoxAttr().GetBorder());
AddAttribute(str, wxT("outline"), attr.GetTextBoxAttr().GetOutline());
AddAttribute(str, wxT("width"), attr.GetTextBoxAttr().GetWidth());
AddAttribute(str, wxT("height"), attr.GetTextBoxAttr().GetWidth());
AddAttribute(str, wxT("height"), attr.GetTextBoxAttr().GetHeight());
if (attr.GetTextBoxAttr().HasVerticalAlignment())
{
wxString value;
if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP)
value = wxT("top");
else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE)
value = wxT("centre");
else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM)
value = wxT("bottom");
else
value = wxT("none");
AddAttribute(str, wxT("verticalalignment"), value);
}
if (attr.GetTextBoxAttr().HasFloatMode())
{
@ -1455,7 +1477,21 @@ bool wxRichTextXMLHandler::AddAttributes(wxXmlNode* node, wxRichTextAttr& attr,
AddAttribute(node, wxT("border"), attr.GetTextBoxAttr().GetBorder());
AddAttribute(node, wxT("outline"), attr.GetTextBoxAttr().GetOutline());
AddAttribute(node, wxT("width"), attr.GetTextBoxAttr().GetWidth());
AddAttribute(node, wxT("height"), attr.GetTextBoxAttr().GetWidth());
AddAttribute(node, wxT("height"), attr.GetTextBoxAttr().GetHeight());
if (attr.GetTextBoxAttr().HasVerticalAlignment())
{
wxString value;
if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP)
value = wxT("top");
else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE)
value = wxT("centre");
else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM)
value = wxT("bottom");
else
value = wxT("none");
AddAttribute(node, wxT("verticalalignment"), value);
}
if (attr.GetTextBoxAttr().HasFloatMode())
{
@ -1815,6 +1851,17 @@ bool wxRichTextXMLHandler::ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bo
attr.GetTextBoxAttr().GetHeight().SetValue(wxRichTextParseDimension(value));
}
else if (name == wxT("verticalalignment"))
{
if (value == wxT("top"))
attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP);
else if (value == wxT("centre"))
attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE);
else if (value == wxT("bottom"))
attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM);
else if (value == wxT("none"))
attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
}
else if (name == wxT("float"))
{
if (value == wxT("left"))