void wxRichTextFormattingDialog::Init()
{
- m_imageList = NULL;
m_styleDefinition = NULL;
m_styleSheet = NULL;
m_object = NULL;
wxRichTextFormattingDialog::~wxRichTextFormattingDialog()
{
- delete m_imageList;
delete m_styleDefinition;
}
}
// Apply attributes to the object being edited, if any
-bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* WXUNUSED(ctrl), int flags)
+bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, int WXUNUSED(flags))
{
if (GetObject())
{
- wxRichTextParagraphLayoutBox* parentContainer = GetObject()->GetParentContainer();
- if (parentContainer)
- parentContainer->SetStyle(GetObject(), m_attributes, flags);
+ ctrl->SetStyle(GetObject(), m_attributes);
return true;
}
else
font.SetPointSize( static_cast<int>(size) );
}
- if ( font.Ok() )
+ if ( font.IsOk() )
{
dc.SetFont(font);
// Calculate vertical and horizontal centre
void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox)
{
int unitsIdx = 0;
-
+
if (!dim.IsValid())
{
checkBox->SetValue(false);
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;
{
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);
if (!facename.IsEmpty() && facename != _("(none)"))
str << wxT(" face=\"") << facename << wxT("\"");
/*
- if (def->GetStyle().GetTextColour().Ok())
+ if (def->GetStyle().GetTextColour().IsOk())
str << wxT(" color=\"#") << ColourToHexString(def->GetStyle().GetTextColour()) << wxT("\"");
*/