X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80fdcdb90ef779185492dab676d461fc34933312..739c5499fcab1c165b8dd0591c9fd9e2329b3cf9:/src/richtext/richtextsizepage.cpp diff --git a/src/richtext/richtextsizepage.cpp b/src/richtext/richtextsizepage.cpp index 5425a95bfd..fda625d9fb 100644 --- a/src/richtext/richtextsizepage.cpp +++ b/src/richtext/richtextsizepage.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/richtext/richtextsizepage.cpp -// Purpose: +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 20/10/2010 10:23:24 -// RCS-ID: +// RCS-ID: // Copyright: (c) Julian Smart -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// #include "wx/richtext/richtextsizepage.h" @@ -29,6 +29,8 @@ IMPLEMENT_DYNAMIC_CLASS( wxRichTextSizePage, wxRichTextDialogPage ) BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage ) ////@begin wxRichTextSizePage event table entries + EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate ) + EVT_UPDATE_UI( ID_RICHTEXT_WIDTH, wxRichTextSizePage::OnRichtextWidthUpdate ) EVT_UPDATE_UI( ID_RICHTEXT_UNITS_W, wxRichTextSizePage::OnRichtextWidthUpdate ) @@ -37,11 +39,37 @@ BEGIN_EVENT_TABLE( wxRichTextSizePage, wxRichTextDialogPage ) EVT_UPDATE_UI( ID_RICHTEXT_UNITS_H, wxRichTextSizePage::OnRichtextHeightUpdate ) - EVT_UPDATE_UI( ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate ) + EVT_UPDATE_UI( ID_RICHTEXT_MIN_WIDTH, wxRichTextSizePage::OnRichtextMinWidthUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_W, wxRichTextSizePage::OnRichtextMinWidthUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_MIN_HEIGHT, wxRichTextSizePage::OnRichtextMinHeightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MIN_H, wxRichTextSizePage::OnRichtextMinHeightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_MAX_WIDTH, wxRichTextSizePage::OnRichtextMaxWidthUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_W, wxRichTextSizePage::OnRichtextMaxWidthUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_MAX_HEIGHT, wxRichTextSizePage::OnRichtextMaxHeightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_UNITS_MAX_H, wxRichTextSizePage::OnRichtextMaxHeightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_LEFT, wxRichTextSizePage::OnRichtextLeftUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_LEFT_UNITS, wxRichTextSizePage::OnRichtextTopUpdate ) - EVT_UPDATE_UI( ID_RICHTEXT_OFFSET, wxRichTextSizePage::OnRichtextOffsetUpdate ) + EVT_UPDATE_UI( ID_RICHTEXT_TOP, wxRichTextSizePage::OnRichtextTopUpdate ) - EVT_UPDATE_UI( ID_RICHTEXT_OFFSET_UNITS, wxRichTextSizePage::OnRichtextOffsetUpdate ) + EVT_UPDATE_UI( ID_RICHTEXT_TOP_UNITS, wxRichTextSizePage::OnRichtextTopUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_RIGHT, wxRichTextSizePage::OnRichtextRightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_RIGHT_UNITS, wxRichTextSizePage::OnRichtextRightUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM, wxRichTextSizePage::OnRichtextBottomUpdate ) + + EVT_UPDATE_UI( ID_RICHTEXT_BOTTOM_UNITS, wxRichTextSizePage::OnRichtextBottomUpdate ) EVT_BUTTON( ID_RICHTEXT_PARA_UP, wxRichTextSizePage::OnRichtextParaUpClick ) @@ -107,23 +135,46 @@ wxRichTextSizePage::~wxRichTextSizePage() void wxRichTextSizePage::Init() { ////@begin wxRichTextSizePage member initialisation + m_positionMode = 0; m_parentSizer = NULL; m_floatingControls = NULL; m_float = NULL; + m_alignmentControls = NULL; + m_verticalAlignmentCheckbox = NULL; + m_verticalAlignmentComboBox = NULL; m_widthCheckbox = NULL; m_width = NULL; m_unitsW = NULL; m_heightCheckbox = NULL; m_height = NULL; m_unitsH = NULL; - m_alignmentControls = NULL; - m_verticalAlignmentCheckbox = NULL; - m_verticalAlignmentComboBox = NULL; + m_minWidthCheckbox = NULL; + m_minWidth = NULL; + m_unitsMinW = NULL; + m_minHeightCheckbox = NULL; + m_minHeight = NULL; + m_unitsMinH = NULL; + m_maxWidthCheckbox = NULL; + m_maxWidth = NULL; + m_unitsMaxW = NULL; + m_maxHeightCheckbox = NULL; + m_maxHeight = NULL; + m_unitsMaxH = NULL; m_positionControls = NULL; m_moveObjectParentSizer = NULL; - m_offsetYCheckbox = NULL; - m_offset = NULL; - m_unitsOffset = NULL; + m_positionModeCtrl = NULL; + m_positionLeftCheckbox = NULL; + m_left = NULL; + m_unitsLeft = NULL; + m_positionTopCheckbox = NULL; + m_top = NULL; + m_unitsTop = NULL; + m_positionRightCheckbox = NULL; + m_right = NULL; + m_unitsRight = NULL; + m_positionBottomCheckbox = NULL; + m_bottom = NULL; + m_unitsBottom = NULL; m_moveObjectSizer = NULL; ////@end wxRichTextSizePage member initialisation } @@ -134,7 +185,7 @@ void wxRichTextSizePage::Init() */ void wxRichTextSizePage::CreateControls() -{ +{ ////@begin wxRichTextSizePage content construction wxRichTextSizePage* itemRichTextDialogPage1 = this; @@ -144,29 +195,32 @@ void wxRichTextSizePage::CreateControls() m_parentSizer = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(m_parentSizer, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); + m_parentSizer->Add(itemBoxSizer4, 0, wxGROW, 5); + m_floatingControls = new wxBoxSizer(wxVERTICAL); - m_parentSizer->Add(m_floatingControls, 0, wxGROW, 5); + itemBoxSizer4->Add(m_floatingControls, 1, wxALIGN_CENTER_VERTICAL, 5); - wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); - m_floatingControls->Add(itemBoxSizer5, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); + m_floatingControls->Add(itemBoxSizer6, 0, wxGROW, 5); - wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Floating"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText6->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); - itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticText* itemStaticText7 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Floating"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticText7->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); + itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticLine* itemStaticLine7 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer5->Add(itemStaticLine7, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticLine* itemStaticLine8 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer6->Add(itemStaticLine8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL); - m_floatingControls->Add(itemBoxSizer8, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL); + m_floatingControls->Add(itemBoxSizer9, 0, wxGROW, 5); - itemBoxSizer8->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(0, 2, 0, 0); - itemBoxSizer8->Add(itemFlexGridSizer10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0); + itemBoxSizer9->Add(itemFlexGridSizer11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); - wxStaticText* itemStaticText11 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer10->Add(itemStaticText11, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticText* itemStaticText12 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer11->Add(itemStaticText12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxArrayString m_floatStrings; m_floatStrings.Add(_("None")); @@ -177,41 +231,77 @@ void wxRichTextSizePage::CreateControls() m_float->SetHelpText(_("How the object will float relative to the text.")); if (wxRichTextSizePage::ShowToolTips()) m_float->SetToolTip(_("How the object will float relative to the text.")); - itemFlexGridSizer10->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemFlexGridSizer11->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_alignmentControls = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(m_alignmentControls, 1, wxALIGN_CENTER_VERTICAL, 5); + + wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL); + m_alignmentControls->Add(itemBoxSizer15, 0, wxGROW, 5); + + wxStaticText* itemStaticText16 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Alignment"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticText16->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); + itemBoxSizer15->Add(itemStaticText16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxStaticLine* itemStaticLine17 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer15->Add(itemStaticLine17, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL); + m_alignmentControls->Add(itemBoxSizer18, 0, wxGROW, 5); + + itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_verticalAlignmentCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX, _("&Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_verticalAlignmentCheckbox->SetValue(false); + m_verticalAlignmentCheckbox->SetHelpText(_("Enable vertical alignment.")); + if (wxRichTextSizePage::ShowToolTips()) + m_verticalAlignmentCheckbox->SetToolTip(_("Enable vertical alignment.")); + itemBoxSizer18->Add(m_verticalAlignmentCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxArrayString m_verticalAlignmentComboBoxStrings; + m_verticalAlignmentComboBoxStrings.Add(_("Top")); + m_verticalAlignmentComboBoxStrings.Add(_("Centred")); + m_verticalAlignmentComboBoxStrings.Add(_("Bottom")); + m_verticalAlignmentComboBox = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, _("Top"), wxDefaultPosition, wxDefaultSize, m_verticalAlignmentComboBoxStrings, wxCB_READONLY ); + m_verticalAlignmentComboBox->SetStringSelection(_("Top")); + m_verticalAlignmentComboBox->SetHelpText(_("Vertical alignment.")); + if (wxRichTextSizePage::ShowToolTips()) + m_verticalAlignmentComboBox->SetToolTip(_("Vertical alignment.")); + itemBoxSizer18->Add(m_verticalAlignmentComboBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL); - m_parentSizer->Add(itemBoxSizer13, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL); + m_parentSizer->Add(itemBoxSizer22, 0, wxGROW, 5); - wxStaticText* itemStaticText14 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText14->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); - itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticText* itemStaticText23 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticText23->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); + itemBoxSizer22->Add(itemStaticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticLine* itemStaticLine15 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer13->Add(itemStaticLine15, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticLine* itemStaticLine24 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer22->Add(itemStaticLine24, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL); - m_parentSizer->Add(itemBoxSizer16, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); + m_parentSizer->Add(itemBoxSizer25, 0, wxGROW, 5); - itemBoxSizer16->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer25->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxFlexGridSizer* itemFlexGridSizer18 = new wxFlexGridSizer(0, 2, 0, 0); - itemBoxSizer16->Add(itemFlexGridSizer18, 0, wxALIGN_CENTER_VERTICAL, 5); + wxFlexGridSizer* itemFlexGridSizer27 = new wxFlexGridSizer(0, 4, 0, 0); + itemBoxSizer25->Add(itemFlexGridSizer27, 0, wxALIGN_CENTER_VERTICAL, 5); m_widthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH_CHECKBOX, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_widthCheckbox->SetValue(false); m_widthCheckbox->SetHelpText(_("Enable the width value.")); if (wxRichTextSizePage::ShowToolTips()) m_widthCheckbox->SetToolTip(_("Enable the width value.")); - itemFlexGridSizer18->Add(m_widthCheckbox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + itemFlexGridSizer27->Add(m_widthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer18->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer29 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer29, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); - m_width = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_width = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); m_width->SetHelpText(_("The object width.")); if (wxRichTextSizePage::ShowToolTips()) m_width->SetToolTip(_("The object width.")); - itemBoxSizer20->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + itemBoxSizer29->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); wxArrayString m_unitsWStrings; m_unitsWStrings.Add(_("px")); @@ -222,23 +312,23 @@ void wxRichTextSizePage::CreateControls() m_unitsW->SetHelpText(_("Units for the object width.")); if (wxRichTextSizePage::ShowToolTips()) m_unitsW->SetToolTip(_("Units for the object width.")); - itemBoxSizer20->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer29->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_heightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT_CHECKBOX, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 ); m_heightCheckbox->SetValue(false); m_heightCheckbox->SetHelpText(_("Enable the height value.")); if (wxRichTextSizePage::ShowToolTips()) m_heightCheckbox->SetToolTip(_("Enable the height value.")); - itemFlexGridSizer18->Add(m_heightCheckbox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + itemFlexGridSizer27->Add(m_heightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer18->Add(itemBoxSizer24, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer33 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer33, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); - m_height = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_height = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); m_height->SetHelpText(_("The object height.")); if (wxRichTextSizePage::ShowToolTips()) m_height->SetToolTip(_("The object height.")); - itemBoxSizer24->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + itemBoxSizer33->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); wxArrayString m_unitsHStrings; m_unitsHStrings.Add(_("px")); @@ -249,110 +339,287 @@ void wxRichTextSizePage::CreateControls() m_unitsH->SetHelpText(_("Units for the object height.")); if (wxRichTextSizePage::ShowToolTips()) m_unitsH->SetToolTip(_("Units for the object height.")); - itemBoxSizer24->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer33->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_alignmentControls = new wxBoxSizer(wxVERTICAL); - m_parentSizer->Add(m_alignmentControls, 0, wxGROW, 5); + m_minWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH_CHECKBOX, _("Min width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_minWidthCheckbox->SetValue(false); + m_minWidthCheckbox->SetHelpText(_("Enable the minimum width value.")); + if (wxRichTextSizePage::ShowToolTips()) + m_minWidthCheckbox->SetToolTip(_("Enable the minimum width value.")); + itemFlexGridSizer27->Add(m_minWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL); - m_alignmentControls->Add(itemBoxSizer28, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer37, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* itemStaticText29 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Alignment"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText29->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); - itemBoxSizer28->Add(itemStaticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_minWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); + m_minWidth->SetHelpText(_("The object minimum width.")); + if (wxRichTextSizePage::ShowToolTips()) + m_minWidth->SetToolTip(_("The object minimum width.")); + itemBoxSizer37->Add(m_minWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsMinWStrings; + m_unitsMinWStrings.Add(_("px")); + m_unitsMinWStrings.Add(_("cm")); + m_unitsMinWStrings.Add(_("percent")); + m_unitsMinW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinWStrings, wxCB_READONLY ); + m_unitsMinW->SetStringSelection(_("px")); + m_unitsMinW->SetHelpText(_("Units for the minimum object width.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsMinW->SetToolTip(_("Units for the minimum object width.")); + itemBoxSizer37->Add(m_unitsMinW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticLine* itemStaticLine30 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer28->Add(itemStaticLine30, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_minHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT_CHECKBOX, _("Min height:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_minHeightCheckbox->SetValue(false); + m_minHeightCheckbox->SetHelpText(_("Enable the minimum height value.")); + if (wxRichTextSizePage::ShowToolTips()) + m_minHeightCheckbox->SetToolTip(_("Enable the minimum height value.")); + itemFlexGridSizer27->Add(m_minHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer31 = new wxBoxSizer(wxHORIZONTAL); - m_alignmentControls->Add(itemBoxSizer31, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); - itemBoxSizer31->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_minHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MIN_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); + m_minHeight->SetHelpText(_("The object minimum height.")); + if (wxRichTextSizePage::ShowToolTips()) + m_minHeight->SetToolTip(_("The object minimum height.")); + itemBoxSizer41->Add(m_minHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsMinHStrings; + m_unitsMinHStrings.Add(_("px")); + m_unitsMinHStrings.Add(_("cm")); + m_unitsMinHStrings.Add(_("percent")); + m_unitsMinH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MIN_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMinHStrings, wxCB_READONLY ); + m_unitsMinH->SetStringSelection(_("px")); + m_unitsMinH->SetHelpText(_("Units for the minimum object height.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsMinH->SetToolTip(_("Units for the minimum object height.")); + itemBoxSizer41->Add(m_unitsMinH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_verticalAlignmentCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX, _("&Vertical alignment:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_verticalAlignmentCheckbox->SetValue(false); - m_verticalAlignmentCheckbox->SetHelpText(_("Enable vertical alignment.")); + m_maxWidthCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH_CHECKBOX, _("Max width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_maxWidthCheckbox->SetValue(false); + m_maxWidthCheckbox->SetHelpText(_("Enable the maximum width value.")); if (wxRichTextSizePage::ShowToolTips()) - m_verticalAlignmentCheckbox->SetToolTip(_("Enable vertical alignment.")); - itemBoxSizer31->Add(m_verticalAlignmentCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_maxWidthCheckbox->SetToolTip(_("Enable the maximum width value.")); + itemFlexGridSizer27->Add(m_maxWidthCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxArrayString m_verticalAlignmentComboBoxStrings; - m_verticalAlignmentComboBoxStrings.Add(_("Top")); - m_verticalAlignmentComboBoxStrings.Add(_("Centred")); - m_verticalAlignmentComboBoxStrings.Add(_("Bottom")); - m_verticalAlignmentComboBox = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX, _("Top"), wxDefaultPosition, wxDefaultSize, m_verticalAlignmentComboBoxStrings, wxCB_READONLY ); - m_verticalAlignmentComboBox->SetStringSelection(_("Top")); - m_verticalAlignmentComboBox->SetHelpText(_("Vertical alignment.")); + wxBoxSizer* itemBoxSizer45 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer45, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); + + m_maxWidth = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); + m_maxWidth->SetHelpText(_("The object maximum width.")); if (wxRichTextSizePage::ShowToolTips()) - m_verticalAlignmentComboBox->SetToolTip(_("Vertical alignment.")); - itemBoxSizer31->Add(m_verticalAlignmentComboBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_maxWidth->SetToolTip(_("The object maximum width.")); + itemBoxSizer45->Add(m_maxWidth, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsMaxWStrings; + m_unitsMaxWStrings.Add(_("px")); + m_unitsMaxWStrings.Add(_("cm")); + m_unitsMaxWStrings.Add(_("percent")); + m_unitsMaxW = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxWStrings, wxCB_READONLY ); + m_unitsMaxW->SetStringSelection(_("px")); + m_unitsMaxW->SetHelpText(_("Units for the maximum object width.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsMaxW->SetToolTip(_("Units for the maximum object width.")); + itemBoxSizer45->Add(m_unitsMaxW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_maxHeightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT_CHECKBOX, _("Max height:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_maxHeightCheckbox->SetValue(false); + m_maxHeightCheckbox->SetHelpText(_("Enable the height value.")); + if (wxRichTextSizePage::ShowToolTips()) + m_maxHeightCheckbox->SetToolTip(_("Enable the height value.")); + itemFlexGridSizer27->Add(m_maxHeightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer27->Add(itemBoxSizer49, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); + + m_maxHeight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_MAX_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 ); + m_maxHeight->SetHelpText(_("The object maximum height.")); + if (wxRichTextSizePage::ShowToolTips()) + m_maxHeight->SetToolTip(_("The object maximum height.")); + itemBoxSizer49->Add(m_maxHeight, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsMaxHStrings; + m_unitsMaxHStrings.Add(_("px")); + m_unitsMaxHStrings.Add(_("cm")); + m_unitsMaxHStrings.Add(_("percent")); + m_unitsMaxH = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_UNITS_MAX_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsMaxHStrings, wxCB_READONLY ); + m_unitsMaxH->SetStringSelection(_("px")); + m_unitsMaxH->SetHelpText(_("Units for the maximum object height.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsMaxH->SetToolTip(_("Units for the maximum object height.")); + itemBoxSizer49->Add(m_unitsMaxH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_positionControls = new wxBoxSizer(wxVERTICAL); m_parentSizer->Add(m_positionControls, 0, wxGROW, 5); - wxBoxSizer* itemBoxSizer36 = new wxBoxSizer(wxHORIZONTAL); - m_positionControls->Add(itemBoxSizer36, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer53 = new wxBoxSizer(wxHORIZONTAL); + m_positionControls->Add(itemBoxSizer53, 0, wxGROW, 5); - wxStaticText* itemStaticText37 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Position"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText37->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); - itemBoxSizer36->Add(itemStaticText37, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticText* itemStaticText54 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Position"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticText54->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT(""))); + itemBoxSizer53->Add(itemStaticText54, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticLine* itemStaticLine38 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer36->Add(itemStaticLine38, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticLine* itemStaticLine55 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer53->Add(itemStaticLine55, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxHORIZONTAL); - m_positionControls->Add(itemBoxSizer39, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxHORIZONTAL); + m_positionControls->Add(itemBoxSizer56, 0, wxGROW, 5); - itemBoxSizer39->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer56->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_moveObjectParentSizer = new wxBoxSizer(wxVERTICAL); - itemBoxSizer39->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5); + itemBoxSizer56->Add(m_moveObjectParentSizer, 0, wxALIGN_TOP, 5); + + wxBoxSizer* itemBoxSizer59 = new wxBoxSizer(wxHORIZONTAL); + m_moveObjectParentSizer->Add(itemBoxSizer59, 0, wxALIGN_LEFT, 5); + + wxStaticText* itemStaticText60 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position mode:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer59->Add(itemStaticText60, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxArrayString m_positionModeCtrlStrings; + m_positionModeCtrlStrings.Add(_("Static")); + m_positionModeCtrlStrings.Add(_("Relative")); + m_positionModeCtrlStrings.Add(_("Absolute")); + m_positionModeCtrlStrings.Add(_("Fixed")); + m_positionModeCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_POSITION_MODE, _("Static"), wxDefaultPosition, wxDefaultSize, m_positionModeCtrlStrings, wxCB_READONLY ); + m_positionModeCtrl->SetStringSelection(_("Static")); + itemBoxSizer59->Add(m_positionModeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxFlexGridSizer* itemFlexGridSizer62 = new wxFlexGridSizer(0, 4, 0, 0); + m_moveObjectParentSizer->Add(itemFlexGridSizer62, 0, wxGROW, 5); + + m_positionLeftCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_LEFT_CHECKBOX, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_positionLeftCheckbox->SetValue(false); + m_positionLeftCheckbox->SetHelpText(_("The left position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_positionLeftCheckbox->SetToolTip(_("The left position.")); + itemFlexGridSizer62->Add(m_positionLeftCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxBoxSizer* itemBoxSizer64 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer62->Add(itemBoxSizer64, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); + + m_left = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_left->SetMaxLength(10); + m_left->SetHelpText(_("The left position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_left->SetToolTip(_("The left position.")); + itemBoxSizer64->Add(m_left, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsLeftStrings; + m_unitsLeftStrings.Add(_("px")); + m_unitsLeftStrings.Add(_("cm")); + m_unitsLeftStrings.Add(_("percent")); + m_unitsLeft = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_LEFT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsLeftStrings, wxCB_READONLY ); + m_unitsLeft->SetStringSelection(_("px")); + m_unitsLeft->SetHelpText(_("Units for the left position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsLeft->SetToolTip(_("Units for the left position.")); + itemBoxSizer64->Add(m_unitsLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_positionTopCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_TOP_CHECKBOX, _("&Top:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_positionTopCheckbox->SetValue(false); + m_positionTopCheckbox->SetHelpText(_("The top position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_positionTopCheckbox->SetToolTip(_("The top position.")); + itemFlexGridSizer62->Add(m_positionTopCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer62->Add(itemBoxSizer68, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); + + m_top = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_TOP, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_top->SetMaxLength(10); + m_top->SetHelpText(_("The top position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_top->SetToolTip(_("The top position.")); + itemBoxSizer68->Add(m_top, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsTopStrings; + m_unitsTopStrings.Add(_("px")); + m_unitsTopStrings.Add(_("cm")); + m_unitsTopStrings.Add(_("percent")); + m_unitsTop = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_TOP_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsTopStrings, wxCB_READONLY ); + m_unitsTop->SetStringSelection(_("px")); + m_unitsTop->SetHelpText(_("Units for the top position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_unitsTop->SetToolTip(_("Units for the top position.")); + itemBoxSizer68->Add(m_unitsTop, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer42 = new wxBoxSizer(wxHORIZONTAL); - m_moveObjectParentSizer->Add(itemBoxSizer42, 0, wxGROW, 5); + m_positionRightCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT_CHECKBOX, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_positionRightCheckbox->SetValue(false); + m_positionRightCheckbox->SetHelpText(_("The right position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_positionRightCheckbox->SetToolTip(_("The right position.")); + itemFlexGridSizer62->Add(m_positionRightCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer62->Add(itemBoxSizer72, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - m_offsetYCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET_CHECKBOX, _("Vertical &Offset:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_offsetYCheckbox->SetValue(false); - m_offsetYCheckbox->SetHelpText(_("Enable vertical offset.")); + m_right = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_right->SetMaxLength(10); + m_right->SetHelpText(_("The right position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_right->SetToolTip(_("The right position.")); + itemBoxSizer72->Add(m_right, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsRightStrings; + m_unitsRightStrings.Add(_("px")); + m_unitsRightStrings.Add(_("cm")); + m_unitsRightStrings.Add(_("percent")); + m_unitsRight = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_RIGHT_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsRightStrings, wxCB_READONLY ); + m_unitsRight->SetStringSelection(_("px")); + m_unitsRight->SetHelpText(_("Units for the right position.")); if (wxRichTextSizePage::ShowToolTips()) - m_offsetYCheckbox->SetToolTip(_("Enable vertical offset.")); - itemBoxSizer42->Add(m_offsetYCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + m_unitsRight->SetToolTip(_("Units for the right position.")); + itemBoxSizer72->Add(m_unitsRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_offset = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); - m_offset->SetMaxLength(10); - m_offset->SetHelpText(_("The vertical offset relative to the paragraph.")); + m_positionBottomCheckbox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM_CHECKBOX, _("&Bottom:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_positionBottomCheckbox->SetValue(false); + m_positionBottomCheckbox->SetHelpText(_("The bottom position.")); if (wxRichTextSizePage::ShowToolTips()) - m_offset->SetToolTip(_("The vertical offset relative to the paragraph.")); - itemBoxSizer42->Add(m_offset, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + m_positionBottomCheckbox->SetToolTip(_("The bottom position.")); + itemFlexGridSizer62->Add(m_positionBottomCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxArrayString m_unitsOffsetStrings; - m_unitsOffsetStrings.Add(_("px")); - m_unitsOffsetStrings.Add(_("cm")); - m_unitsOffset = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsOffsetStrings, wxCB_READONLY ); - m_unitsOffset->SetStringSelection(_("px")); - m_unitsOffset->SetHelpText(_("Units for the object offset.")); + wxBoxSizer* itemBoxSizer76 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer62->Add(itemBoxSizer76, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); + + m_bottom = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 ); + m_bottom->SetMaxLength(10); + m_bottom->SetHelpText(_("The bottom position.")); + if (wxRichTextSizePage::ShowToolTips()) + m_bottom->SetToolTip(_("The bottom position.")); + itemBoxSizer76->Add(m_bottom, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); + + wxArrayString m_unitsBottomStrings; + m_unitsBottomStrings.Add(_("px")); + m_unitsBottomStrings.Add(_("cm")); + m_unitsBottomStrings.Add(_("percent")); + m_unitsBottom = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_BOTTOM_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsBottomStrings, wxCB_READONLY ); + m_unitsBottom->SetStringSelection(_("px")); + m_unitsBottom->SetHelpText(_("Units for the bottom position.")); if (wxRichTextSizePage::ShowToolTips()) - m_unitsOffset->SetToolTip(_("Units for the object offset.")); - itemBoxSizer42->Add(m_unitsOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_unitsBottom->SetToolTip(_("Units for the bottom position.")); + itemBoxSizer76->Add(m_unitsBottom, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_moveObjectSizer = new wxBoxSizer(wxHORIZONTAL); m_moveObjectParentSizer->Add(m_moveObjectSizer, 0, wxGROW, 5); - wxStaticText* itemStaticText47 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Move the object to:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_moveObjectSizer->Add(itemStaticText47, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticText* itemStaticText80 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Move the object to:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_moveObjectSizer->Add(itemStaticText80, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxButton* itemButton48 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton48->SetHelpText(_("Moves the object to the previous paragraph.")); + wxButton* itemButton81 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton81->SetHelpText(_("Moves the object to the previous paragraph.")); if (wxRichTextSizePage::ShowToolTips()) - itemButton48->SetToolTip(_("Moves the object to the previous paragraph.")); - m_moveObjectSizer->Add(itemButton48, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemButton81->SetToolTip(_("Moves the object to the previous paragraph.")); + m_moveObjectSizer->Add(itemButton81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxButton* itemButton49 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton49->SetHelpText(_("Moves the object to the next paragraph.")); + wxButton* itemButton82 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXT_PARA_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton82->SetHelpText(_("Moves the object to the next paragraph.")); if (wxRichTextSizePage::ShowToolTips()) - itemButton49->SetToolTip(_("Moves the object to the next paragraph.")); - m_moveObjectSizer->Add(itemButton49, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); + itemButton82->SetToolTip(_("Moves the object to the next paragraph.")); + m_moveObjectSizer->Add(itemButton82, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); + // Set validators + m_positionModeCtrl->SetValidator( wxGenericValidator(& m_positionMode) ); ////@end wxRichTextSizePage content construction } @@ -397,32 +664,69 @@ bool wxRichTextSizePage::TransferDataToWindow() } } - if (dialog && dialog->GetObject()) + wxRichTextImage* imageObj = NULL; + if (dialog) + imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage); + + // For an image, show the original width and height if the size is not explicitly specified. + if (imageObj && !GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() && !GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() && + imageObj->GetOriginalImageSize() != wxSize(-1, -1)) { - wxTextAttrSize size = dialog->GetObject()->GetNaturalSize(); - if (size.GetWidth().IsValid() && size.GetHeight().IsValid()) - { - if (!GetAttributes()->GetTextBoxAttr().GetWidth().IsValid() || GetAttributes()->GetTextBoxAttr().GetWidth().GetValue() <= 0) - { - GetAttributes()->GetTextBoxAttr().GetWidth() = size.GetWidth(); - } - - if (!GetAttributes()->GetTextBoxAttr().GetHeight().IsValid() || GetAttributes()->GetTextBoxAttr().GetHeight().GetValue() <= 0) - { - GetAttributes()->GetTextBoxAttr().GetHeight() = size.GetHeight(); - } - } + m_widthCheckbox->SetValue(false); + m_heightCheckbox->SetValue(false); + m_unitsW->SetSelection(0); + m_unitsH->SetSelection(0); + m_width->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetWidth())); + m_height->SetValue(wxString::Format(wxT("%d"), (int) imageObj->GetOriginalImageSize().GetHeight())); + } + else + { + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox); } - wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox); - wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox); - wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left, m_unitsLeft, m_positionLeftCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top, m_unitsTop, m_positionTopCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right, m_unitsRight, m_positionRightCheckbox); + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom, m_unitsBottom, m_positionBottomCheckbox); + + if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) || + (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) || + (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED) || + (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_FIXED)) + { + m_positionMode = 3; + } + else + if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) || + (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) || + (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE) || + (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_ABSOLUTE)) + { + m_positionMode = 2; + } + else + if ((GetAttributes()->GetTextBoxAttr().GetLeft().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) || + (GetAttributes()->GetTextBoxAttr().GetRight().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) || + (GetAttributes()->GetTextBoxAttr().GetTop().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE) || + (GetAttributes()->GetTextBoxAttr().GetBottom().GetPosition() & wxTEXT_BOX_ATTR_POSITION_RELATIVE)) + { + m_positionMode = 1; + } + else + m_positionMode = 0; - return true; + return wxPanel::TransferDataToWindow(); } bool wxRichTextSizePage::TransferDataFromWindow() { + wxPanel::TransferDataFromWindow(); + GetAttributes()->GetTextBoxAttr().SetFloatMode((wxTextBoxAttrFloatStyle) m_float->GetSelection()); if (m_float->GetSelection() == 0) GetAttributes()->GetTextBoxAttr().RemoveFlag(wxTEXT_BOX_ATTR_FLOAT); @@ -437,7 +741,34 @@ bool wxRichTextSizePage::TransferDataFromWindow() wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetWidth(), m_width, m_unitsW, m_widthCheckbox); wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetHeight(), m_height, m_unitsH, m_heightCheckbox); - wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_offset, m_unitsOffset, m_offsetYCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetWidth(), m_minWidth, m_unitsMinW, m_minWidthCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMinSize().GetHeight(), m_minHeight, m_unitsMinH, m_minHeightCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetWidth(), m_maxWidth, m_unitsMaxW, m_maxWidthCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetMaxSize().GetHeight(), m_maxHeight, m_unitsMaxH, m_maxHeightCheckbox); + + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetLeft(), m_left, m_unitsLeft, m_positionLeftCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetTop(), m_top, m_unitsTop, m_positionTopCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetRight(), m_right, m_unitsRight, m_positionRightCheckbox); + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetBottom(), m_bottom, m_unitsBottom, m_positionBottomCheckbox); + + wxTextBoxAttrPosition flags; + if (m_positionMode == 3) + flags = wxTEXT_BOX_ATTR_POSITION_FIXED; + else if (m_positionMode == 2) + flags = wxTEXT_BOX_ATTR_POSITION_ABSOLUTE; + else if (m_positionMode == 1) + flags = wxTEXT_BOX_ATTR_POSITION_RELATIVE; + else + flags = wxTEXT_BOX_ATTR_POSITION_STATIC; + + if (GetAttributes()->GetTextBoxAttr().GetLeft().IsValid()) + GetAttributes()->GetTextBoxAttr().GetLeft().SetPosition(flags); + if (GetAttributes()->GetTextBoxAttr().GetTop().IsValid()) + GetAttributes()->GetTextBoxAttr().GetTop().SetPosition(flags); + if (GetAttributes()->GetTextBoxAttr().GetRight().IsValid()) + GetAttributes()->GetTextBoxAttr().GetRight().SetPosition(flags); + if (GetAttributes()->GetTextBoxAttr().GetBottom().IsValid()) + GetAttributes()->GetTextBoxAttr().GetBottom().SetPosition(flags); return true; } @@ -462,7 +793,6 @@ void wxRichTextSizePage::ShowFloatingControls(bool show) } } - /*! * Get bitmap resources */ @@ -508,16 +838,6 @@ void wxRichTextSizePage::OnRichtextHeightUpdate( wxUpdateUIEvent& event ) event.Enable(m_heightCheckbox->GetValue()); } -/*! - * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET - */ - -void wxRichTextSizePage::OnRichtextOffsetUpdate( wxUpdateUIEvent& event ) -{ - event.Enable(m_offsetYCheckbox->GetValue()); -} - - /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP */ @@ -527,10 +847,10 @@ void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); if (!dialog || !dialog->GetObject()) return; - + // Make sure object attributes are up-to-date dialog->TransferDataFromWindow(); - + wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer(); wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer(); wxRichTextObject* parent = dialog->GetObject()->GetParent(); @@ -562,7 +882,7 @@ void wxRichTextSizePage::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event) container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer); - wxRichTextObject* obj2 = container->InsertObjectWithUndo(rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), buffer, 0); + wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart(), tempObj, buffer->GetRichTextCtrl(), 0); dialog->SetObject(obj2); } @@ -575,10 +895,10 @@ void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event wxRichTextFormattingDialog* dialog = wxRichTextFormattingDialog::GetDialog(this); if (!dialog || !dialog->GetObject()) return; - + // Make sure object attributes are up-to-date dialog->TransferDataFromWindow(); - + wxRichTextBuffer* buffer = dialog->GetObject()->GetBuffer(); wxRichTextParagraphLayoutBox* container = dialog->GetObject()->GetParentContainer(); wxRichTextObject* parent = dialog->GetObject()->GetParent(); @@ -611,7 +931,7 @@ void wxRichTextSizePage::OnRichtextParaDownClick( wxCommandEvent& WXUNUSED(event container->DeleteRangeWithUndo(range, buffer->GetRichTextCtrl(), buffer); // Minus one because we deleted an object - wxRichTextObject* obj2 = container->InsertObjectWithUndo(rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), buffer, 0); + wxRichTextObject* obj2 = container->InsertObjectWithUndo(buffer, rg.GetStart()-1, tempObj, buffer->GetRichTextCtrl(), 0); dialog->SetObject(obj2); } @@ -625,3 +945,80 @@ void wxRichTextSizePage::OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEv event.Enable(m_verticalAlignmentCheckbox->GetValue()); } + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH + */ + +void wxRichTextSizePage::OnRichtextMinWidthUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_minWidthCheckbox->GetValue()); +} + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT + */ + +void wxRichTextSizePage::OnRichtextMinHeightUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_minHeightCheckbox->GetValue()); +} + + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH + */ + +void wxRichTextSizePage::OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_maxWidthCheckbox->GetValue()); +} + + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT + */ + +void wxRichTextSizePage::OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_maxHeightCheckbox->GetValue()); +} + + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT + */ + +void wxRichTextSizePage::OnRichtextLeftUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_positionLeftCheckbox->GetValue()); +} + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS + */ + +void wxRichTextSizePage::OnRichtextTopUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_positionTopCheckbox->GetValue()); +} + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT + */ + +void wxRichTextSizePage::OnRichtextRightUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_positionRightCheckbox->GetValue()); +} + + +/*! + * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM + */ + +void wxRichTextSizePage::OnRichtextBottomUpdate( wxUpdateUIEvent& event ) +{ + event.Enable(m_positionBottomCheckbox->GetValue()); +} +