Added points to the units for editing border widths

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2013-10-16 20:23:42 +00:00
parent ce9de939c7
commit 1459d70072
7 changed files with 122 additions and 109 deletions

View File

@@ -94,7 +94,7 @@ public:
////@begin wxRichTextBordersPage event handler declarations ////@begin wxRichTextBordersPage event handler declarations
/// wxEVT_CHECKBOX event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
void OnRichtextBorderCheckboxClick( wxCommandEvent& event ); void OnRichtextBorderCheckboxClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT

View File

@@ -224,14 +224,16 @@ public:
/// Determines whether tooltips will be shown /// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; } static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Set the dimension into the value and units controls /// Set the dimension into the value and units controls. Optionally pass units to
static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox); /// specify the ordering of units in the combobox.
static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL);
/// Get the dimension from the value and units controls /// Get the dimension from the value and units controls Optionally pass units to
static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox); /// specify the ordering of units in the combobox.
static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL);
/// Convert CM to MM /// Convert from a string to a dimension integer.
static bool ConvertFromString(const wxString& string, int& ret, int scale); static bool ConvertFromString(const wxString& str, int& ret, int unit);
/// Map book control page index to our page id /// Map book control page index to our page id
void AddPageId(int id) { m_pageIds.Add(id); } void AddPageId(int id) { m_pageIds.Add(id); }

View File

@@ -34,13 +34,11 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
* Control identifiers * Control identifiers
*/ */
////@begin control identifiers
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL #define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE wxGetTranslation("Object Properties") #define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE wxGetTranslation("Object Properties")
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG #define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300) #define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition #define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*! /*!
* wxRichTextObjectPropertiesDialog class declaration * wxRichTextObjectPropertiesDialog class declaration

View File

@@ -42,13 +42,11 @@ class WXDLLIMPEXP_FWD_CORE wxCheckBox;
* Control identifiers * Control identifiers
*/ */
////@begin control identifiers
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE wxGetTranslation("Style Organiser") #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE wxGetTranslation("Style Organiser")
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300) #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*! /*!
* Flags for specifying permitted operations * Flags for specifying permitted operations

View File

@@ -40,85 +40,45 @@ BEGIN_EVENT_TABLE( wxRichTextBordersPage, wxRichTextDialogPage )
////@begin wxRichTextBordersPage event table entries ////@begin wxRichTextBordersPage event table entries
EVT_CHECKBOX( ID_RICHTEXT_BORDER_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_BORDER_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT, wxRichTextBordersPage::OnRichtextBorderLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_UNITS, wxRichTextBordersPage::OnRichtextBorderLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_UNITS, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_STYLE, wxRichTextBordersPage::OnRichtextBorderLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_STYLE, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextBorderLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextBorderLeftUpdate )
EVT_CHECKBOX( ID_RICHTEXT_BORDER_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_BORDER_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT, wxRichTextBordersPage::OnRichtextBorderRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextBorderRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextBorderRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextBorderRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextBorderRightUpdate )
EVT_CHECKBOX( ID_RICHTEXT_BORDER_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_BORDER_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP, wxRichTextBordersPage::OnRichtextBorderTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_UNITS, wxRichTextBordersPage::OnRichtextBorderTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_UNITS, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_STYLE, wxRichTextBordersPage::OnRichtextBorderTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_STYLE, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_COLOUR, wxRichTextBordersPage::OnRichtextBorderTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_TOP_COLOUR, wxRichTextBordersPage::OnRichtextBorderTopUpdate )
EVT_CHECKBOX( ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM, wxRichTextBordersPage::OnRichtextBorderBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextBorderBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextBorderBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextBorderBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_BORDER_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextBorderBottomUpdate )
EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_UNITS, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_UNITS, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_STYLE, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_STYLE, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_LEFT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineLeftUpdate )
EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT, wxRichTextBordersPage::OnRichtextOutlineRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextOutlineRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_UNITS, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextOutlineRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_STYLE, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineRightUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_RIGHT_COLOUR, wxRichTextBordersPage::OnRichtextOutlineRightUpdate )
EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_TOP_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP, wxRichTextBordersPage::OnRichtextOutlineTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_UNITS, wxRichTextBordersPage::OnRichtextOutlineTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_UNITS, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_STYLE, wxRichTextBordersPage::OnRichtextOutlineTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_STYLE, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_COLOUR, wxRichTextBordersPage::OnRichtextOutlineTopUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_TOP_COLOUR, wxRichTextBordersPage::OnRichtextOutlineTopUpdate )
EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick ) EVT_CHECKBOX( ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX, wxRichTextBordersPage::OnRichtextBorderCheckboxClick )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_STYLE, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR, wxRichTextBordersPage::OnRichtextOutlineBottomUpdate )
////@end wxRichTextBordersPage event table entries ////@end wxRichTextBordersPage event table entries
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -278,6 +238,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_leftBorderWidthUnitsStrings; wxArrayString m_leftBorderWidthUnitsStrings;
m_leftBorderWidthUnitsStrings.Add(_("px")); m_leftBorderWidthUnitsStrings.Add(_("px"));
m_leftBorderWidthUnitsStrings.Add(_("cm")); m_leftBorderWidthUnitsStrings.Add(_("cm"));
m_leftBorderWidthUnitsStrings.Add(_("pt"));
m_leftBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftBorderWidthUnitsStrings, wxCB_READONLY ); m_leftBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftBorderWidthUnitsStrings, wxCB_READONLY );
m_leftBorderWidthUnits->SetStringSelection(_("px")); m_leftBorderWidthUnits->SetStringSelection(_("px"));
m_leftBorderWidthUnits->SetHelpText(_("Units for the left border width.")); m_leftBorderWidthUnits->SetHelpText(_("Units for the left border width."));
@@ -308,6 +269,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_rightBorderWidthUnitsStrings; wxArrayString m_rightBorderWidthUnitsStrings;
m_rightBorderWidthUnitsStrings.Add(_("px")); m_rightBorderWidthUnitsStrings.Add(_("px"));
m_rightBorderWidthUnitsStrings.Add(_("cm")); m_rightBorderWidthUnitsStrings.Add(_("cm"));
m_rightBorderWidthUnitsStrings.Add(_("pt"));
m_rightBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightBorderWidthUnitsStrings, wxCB_READONLY ); m_rightBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightBorderWidthUnitsStrings, wxCB_READONLY );
m_rightBorderWidthUnits->SetStringSelection(_("px")); m_rightBorderWidthUnits->SetStringSelection(_("px"));
m_rightBorderWidthUnits->SetHelpText(_("Units for the right border width.")); m_rightBorderWidthUnits->SetHelpText(_("Units for the right border width."));
@@ -338,6 +300,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_topBorderWidthUnitsStrings; wxArrayString m_topBorderWidthUnitsStrings;
m_topBorderWidthUnitsStrings.Add(_("px")); m_topBorderWidthUnitsStrings.Add(_("px"));
m_topBorderWidthUnitsStrings.Add(_("cm")); m_topBorderWidthUnitsStrings.Add(_("cm"));
m_topBorderWidthUnitsStrings.Add(_("pt"));
m_topBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topBorderWidthUnitsStrings, wxCB_READONLY ); m_topBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topBorderWidthUnitsStrings, wxCB_READONLY );
m_topBorderWidthUnits->SetStringSelection(_("px")); m_topBorderWidthUnits->SetStringSelection(_("px"));
m_topBorderWidthUnits->SetHelpText(_("Units for the top border width.")); m_topBorderWidthUnits->SetHelpText(_("Units for the top border width."));
@@ -368,6 +331,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_bottomBorderWidthUnitsStrings; wxArrayString m_bottomBorderWidthUnitsStrings;
m_bottomBorderWidthUnitsStrings.Add(_("px")); m_bottomBorderWidthUnitsStrings.Add(_("px"));
m_bottomBorderWidthUnitsStrings.Add(_("cm")); m_bottomBorderWidthUnitsStrings.Add(_("cm"));
m_bottomBorderWidthUnitsStrings.Add(_("pt"));
m_bottomBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomBorderWidthUnitsStrings, wxCB_READONLY ); m_bottomBorderWidthUnits = new wxComboBox( itemPanel5, ID_RICHTEXT_BORDER_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomBorderWidthUnitsStrings, wxCB_READONLY );
m_bottomBorderWidthUnits->SetStringSelection(_("px")); m_bottomBorderWidthUnits->SetStringSelection(_("px"));
m_bottomBorderWidthUnits->SetHelpText(_("Units for the bottom border width.")); m_bottomBorderWidthUnits->SetHelpText(_("Units for the bottom border width."));
@@ -422,6 +386,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_leftOutlineWidthUnitsStrings; wxArrayString m_leftOutlineWidthUnitsStrings;
m_leftOutlineWidthUnitsStrings.Add(_("px")); m_leftOutlineWidthUnitsStrings.Add(_("px"));
m_leftOutlineWidthUnitsStrings.Add(_("cm")); m_leftOutlineWidthUnitsStrings.Add(_("cm"));
m_leftOutlineWidthUnitsStrings.Add(_("pt"));
m_leftOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftOutlineWidthUnitsStrings, wxCB_READONLY ); m_leftOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_leftOutlineWidthUnitsStrings, wxCB_READONLY );
m_leftOutlineWidthUnits->SetStringSelection(_("px")); m_leftOutlineWidthUnits->SetStringSelection(_("px"));
m_leftOutlineWidthUnits->SetHelpText(_("Units for the left outline width.")); m_leftOutlineWidthUnits->SetHelpText(_("Units for the left outline width."));
@@ -452,6 +417,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_rightOutlineWidthUnitsStrings; wxArrayString m_rightOutlineWidthUnitsStrings;
m_rightOutlineWidthUnitsStrings.Add(_("px")); m_rightOutlineWidthUnitsStrings.Add(_("px"));
m_rightOutlineWidthUnitsStrings.Add(_("cm")); m_rightOutlineWidthUnitsStrings.Add(_("cm"));
m_rightOutlineWidthUnitsStrings.Add(_("pt"));
m_rightOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightOutlineWidthUnitsStrings, wxCB_READONLY ); m_rightOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_rightOutlineWidthUnitsStrings, wxCB_READONLY );
m_rightOutlineWidthUnits->SetStringSelection(_("px")); m_rightOutlineWidthUnits->SetStringSelection(_("px"));
m_rightOutlineWidthUnits->SetHelpText(_("Units for the right outline width.")); m_rightOutlineWidthUnits->SetHelpText(_("Units for the right outline width."));
@@ -482,6 +448,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_topOutlineWidthUnitsStrings; wxArrayString m_topOutlineWidthUnitsStrings;
m_topOutlineWidthUnitsStrings.Add(_("px")); m_topOutlineWidthUnitsStrings.Add(_("px"));
m_topOutlineWidthUnitsStrings.Add(_("cm")); m_topOutlineWidthUnitsStrings.Add(_("cm"));
m_topOutlineWidthUnitsStrings.Add(_("pt"));
m_topOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topOutlineWidthUnitsStrings, wxCB_READONLY ); m_topOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_topOutlineWidthUnitsStrings, wxCB_READONLY );
m_topOutlineWidthUnits->SetStringSelection(_("px")); m_topOutlineWidthUnits->SetStringSelection(_("px"));
m_topOutlineWidthUnits->SetHelpText(_("Units for the top outline width.")); m_topOutlineWidthUnits->SetHelpText(_("Units for the top outline width."));
@@ -512,6 +479,7 @@ void wxRichTextBordersPage::CreateControls()
wxArrayString m_bottomOutlineWidthUnitsStrings; wxArrayString m_bottomOutlineWidthUnitsStrings;
m_bottomOutlineWidthUnitsStrings.Add(_("px")); m_bottomOutlineWidthUnitsStrings.Add(_("px"));
m_bottomOutlineWidthUnitsStrings.Add(_("cm")); m_bottomOutlineWidthUnitsStrings.Add(_("cm"));
m_bottomOutlineWidthUnitsStrings.Add(_("pt"));
m_bottomOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomOutlineWidthUnitsStrings, wxCB_READONLY ); m_bottomOutlineWidthUnits = new wxComboBox( itemPanel46, ID_RICHTEXT_OUTLINE_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_bottomOutlineWidthUnitsStrings, wxCB_READONLY );
m_bottomOutlineWidthUnits->SetStringSelection(_("px")); m_bottomOutlineWidthUnits->SetStringSelection(_("px"));
m_bottomOutlineWidthUnits->SetHelpText(_("Units for the bottom outline width.")); m_bottomOutlineWidthUnits->SetHelpText(_("Units for the bottom outline width."));
@@ -648,14 +616,20 @@ void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAt
if (!border.IsValid()) if (!border.IsValid())
{ {
checkBox->Set3StateValue(wxCHK_UNDETERMINED); checkBox->Set3StateValue(wxCHK_UNDETERMINED);
widthValueCtrl->SetValue(wxT("1")); widthValueCtrl->SetValue(wxT("0"));
widthUnitsCtrl->SetSelection(0); widthUnitsCtrl->SetSelection(0);
colourCtrl->SetColour(*wxBLACK); colourCtrl->SetColour(*wxBLACK);
styleCtrl->SetSelection(0); styleCtrl->SetSelection(0);
} }
else else
{ {
wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox); wxArrayInt units;
units.Add(wxTEXT_ATTR_UNITS_PIXELS);
units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM);
units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox,
& units);
int sel = borderStyles.Index(border.GetStyle()); int sel = borderStyles.Index(border.GetStyle());
if (sel == -1) if (sel == -1)
@@ -674,7 +648,13 @@ void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAt
void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles) wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles)
{ {
wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox); wxArrayInt units;
units.Add(wxTEXT_ATTR_UNITS_PIXELS);
units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM);
units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox,
& units);
int sel = styleCtrl->GetSelection(); int sel = styleCtrl->GetSelection();
border.SetColour(colourCtrl->GetColour()); border.SetColour(colourCtrl->GetColour());

View File

@@ -15161,6 +15161,14 @@
<string name="proxy-type">"wbBoxSizerProxy"</string> <string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string> <string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</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-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool> <bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool> <bool name="proxy-wxFIXED_MINSIZE">0</bool>
@@ -22634,14 +22642,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string> <string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string> <string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</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-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool> <bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool> <bool name="proxy-wxFIXED_MINSIZE">0</bool>
@@ -23303,7 +23303,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_leftBorderWidthUnits"</string> <string name="proxy-Member variable name">"m_leftBorderWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the left border width."</string> <string name="proxy-Help text">"Units for the left border width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -23734,7 +23734,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_rightBorderWidthUnits"</string> <string name="proxy-Member variable name">"m_rightBorderWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the right border width."</string> <string name="proxy-Help text">"Units for the right border width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -24165,7 +24165,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_topBorderWidthUnits"</string> <string name="proxy-Member variable name">"m_topBorderWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the top border width."</string> <string name="proxy-Help text">"Units for the top border width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -24596,7 +24596,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_bottomBorderWidthUnits"</string> <string name="proxy-Member variable name">"m_bottomBorderWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the bottom border width."</string> <string name="proxy-Help text">"Units for the bottom border width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -25392,7 +25392,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_leftOutlineWidthUnits"</string> <string name="proxy-Member variable name">"m_leftOutlineWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the left outline width."</string> <string name="proxy-Help text">"Units for the left outline width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -25823,7 +25823,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_rightOutlineWidthUnits"</string> <string name="proxy-Member variable name">"m_rightOutlineWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the right outline width."</string> <string name="proxy-Help text">"Units for the right outline width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -26254,7 +26254,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_topOutlineWidthUnits"</string> <string name="proxy-Member variable name">"m_topOutlineWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the top outline width."</string> <string name="proxy-Help text">"Units for the top outline width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>
@@ -26685,7 +26685,7 @@
<string name="proxy-Implementation filename">""</string> <string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string> <string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_bottomOutlineWidthUnits"</string> <string name="proxy-Member variable name">"m_bottomOutlineWidthUnits"</string>
<string name="proxy-Strings">"px|cm"</string> <string name="proxy-Strings">"px|cm|pt"</string>
<string name="proxy-Initial value">"px"</string> <string name="proxy-Initial value">"px"</string>
<string name="proxy-Help text">"Units for the bottom outline width."</string> <string name="proxy-Help text">"Units for the bottom outline width."</string>
<string name="proxy-Tooltip text">""</string> <string name="proxy-Tooltip text">""</string>

View File

@@ -592,7 +592,7 @@ wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition(
return NULL; return NULL;
} }
void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox) void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units)
{ {
int unitsIdx = 0; int unitsIdx = 0;
@@ -602,37 +602,52 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
checkBox->SetValue(false); checkBox->SetValue(false);
valueCtrl->SetValue(wxT("0")); valueCtrl->SetValue(wxT("0"));
unitsCtrl->SetSelection(0); unitsCtrl->SetSelection(0);
#if 0
dim.SetValue(0);
dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
#endif
} }
else else
{ {
if (checkBox) if (checkBox)
checkBox->SetValue(true); checkBox->SetValue(true);
if (dim.GetUnits() == wxTEXT_ATTR_UNITS_TENTHS_MM)
if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PIXELS)
{ {
unitsIdx = 1; unitsIdx = 0; // By default, the 1st in the list.
valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue()));
}
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_TENTHS_MM)
{
unitsIdx = 1; // By default, the 2nd in the list.
float value = float(dim.GetValue()) / 100.0; float value = float(dim.GetValue()) / 100.0;
valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value)); valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value));
} }
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE) else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE)
{ {
unitsIdx = 2; unitsIdx = 2; // By default, the 3rd in the list.
valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue())); valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue()));
} }
else else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT)
{ {
unitsIdx = 0; unitsIdx = 3; // By default, the 4th in the list.
float value = float(dim.GetValue()) / 100.0;
valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value));
}
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_POINTS)
{
unitsIdx = 3; // By default, the 4th in the list (we don't have points and hundredths of points in the same list)
valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue())); valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue()));
} }
if (units)
{
unitsIdx = units->Index(dim.GetUnits());
if (unitsIdx == -1)
unitsIdx = 0;
}
unitsCtrl->SetSelection(unitsIdx); unitsCtrl->SetSelection(unitsIdx);
} }
} }
void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox) void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units)
{ {
if (checkBox && !checkBox->GetValue()) if (checkBox && !checkBox->GetValue())
{ {
@@ -640,12 +655,22 @@ void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxT
} }
else else
{ {
if (unitsCtrl->GetSelection() == 1) if (units)
{
int unit = (*units)[unitsCtrl->GetSelection()];
dim.SetUnits((wxTextAttrUnits) unit);
}
else
{
if (unitsCtrl->GetSelection() == 0)
dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
else if (unitsCtrl->GetSelection() == 1)
dim.SetUnits(wxTEXT_ATTR_UNITS_TENTHS_MM); dim.SetUnits(wxTEXT_ATTR_UNITS_TENTHS_MM);
else if (unitsCtrl->GetSelection() == 2) else if (unitsCtrl->GetSelection() == 2)
dim.SetUnits(wxTEXT_ATTR_UNITS_PERCENTAGE); dim.SetUnits(wxTEXT_ATTR_UNITS_PERCENTAGE);
else else if (unitsCtrl->GetSelection() == 3)
dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS); dim.SetUnits(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
}
int value = 0; int value = 0;
if (ConvertFromString(valueCtrl->GetValue(), value, dim.GetUnits())) if (ConvertFromString(valueCtrl->GetValue(), value, dim.GetUnits()))
@@ -653,33 +678,43 @@ void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxT
} }
} }
bool wxRichTextFormattingDialog::ConvertFromString(const wxString& string, int& ret, int scale) bool wxRichTextFormattingDialog::ConvertFromString(const wxString& str, int& ret, int unit)
{
if (unit == wxTEXT_ATTR_UNITS_PIXELS)
{
ret = wxAtoi(str);
return true;
}
else if (unit == wxTEXT_ATTR_UNITS_TENTHS_MM)
{
float value = 0.0;
wxSscanf(str.c_str(), wxT("%f"), &value);
// Convert from cm
ret = (int) ((value * 100.0) + 0.5);
return true;
}
else if (unit == wxTEXT_ATTR_UNITS_PERCENTAGE)
{
ret = wxAtoi(str);
return true;
}
else if (unit == wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT)
{
float value = 0.0;
wxSscanf(str.c_str(), wxT("%f"), &value);
ret = (int) ((value * 100.0) + 0.5);
}
else if (unit == wxTEXT_ATTR_UNITS_POINTS)
{
ret = wxAtoi(str);
return true;
}
else
{ {
const wxChar* chars = string.GetData();
int remain = 2;
bool dot = false;
ret = 0; ret = 0;
for (unsigned int i = 0; i < string.Len() && remain; i++)
{
if (!(chars[i] >= wxT('0') && chars[i] <= wxT('9')) && !(scale == wxTEXT_ATTR_UNITS_TENTHS_MM && chars[i] == wxT('.')))
return false; return false;
if (chars[i] == wxT('.'))
{
dot = true;
continue;
} }
if (dot)
remain--;
ret = ret * 10 + chars[i] - wxT('0');
}
while (remain-- > 0 && scale == wxTEXT_ATTR_UNITS_TENTHS_MM)
ret *= 10;
return true; return true;
} }