]> git.saurik.com Git - wxWidgets.git/commitdiff
wxRTC: fixed style selection reset after editing a style.
authorJulian Smart <julian@anthemion.co.uk>
Tue, 27 Apr 2010 16:09:22 +0000 (16:09 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 27 Apr 2010 16:09:22 +0000 (16:09 +0000)
wxRTC: can now edit line spacing in .1 increments from 1 to 2.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/richtext/richtextindentspage.h
src/richtext/richtextdialogs.pjd
src/richtext/richtextindentspage.cpp
src/richtext/richtextstyles.cpp

index 1bc9abedb63167611868eac2d9d1cc4a1f5b153a..989f20c826185a1e47c98bd52c901f1cd82f0fd8 100644 (file)
@@ -500,6 +500,8 @@ All (GUI):
 - wxRTC: added wxRICHTEXT_HANDLER_USE_CSS flag for HTML handler to use CSS
   where possible.
 - wxRTC: corrected centring and right-justification spacing.
+- wxRTC: fixed style selection reset after editing a style.
+- wxRTC: can now edit line spacing in .1 increments from 1 to 2.
 - Added wxBORDER_THEME to XRC.
 - wxGraphicsContext is now enabled by default if supported by the platform.
 - Fix building with using system libpng 1.4 (Volker Grabsch).
index ad6ae910297da94be98487d575962a4dd5ae06c1..d70b0a7cacc373613dddeecad46bde8c0026a496 100644 (file)
@@ -34,7 +34,7 @@ class wxRichTextCtrl;
 
 ////@begin control identifiers
 #define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
-#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE wxT("")
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE wxEmptyString
 #define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE
 #define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300)
 #define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition
index cad54964f550422b36378c330e14e57bdb57dbaa..35faf900d66461ad4d3511b86862256743c4a047 100644 (file)
             <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>
                           <string name="proxy-Implementation filename">""</string>
                           <string name="proxy-Header filename">""</string>
                           <string name="proxy-Member variable name">"m_spacingLine"</string>
-                          <string name="proxy-Strings">"Single|1.5|2"</string>
+                          <string name="proxy-Strings">"Single|1.1|1.2|1.3|1.4|1.5|1.6|1.7|1.8|1.9|2"</string>
                           <string name="proxy-Initial value">"Single"</string>
                           <string name="proxy-Help text">"The line spacing."</string>
                           <string name="proxy-Tooltip text">""</string>
             <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>
index b993ce2cef09d00acde835ee74f56f0d262f2d18..0d0eea7d8e1a87c487c94f9498cde25a6d5ee024 100644 (file)
@@ -208,7 +208,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
     wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
     itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxT(""), wxDefaultPosition, wxSize(50, -1), 0 );
+    m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
     m_indentLeft->SetHelpText(_("The left indent."));
     if (wxRichTextIndentsSpacingPage::ShowToolTips())
         m_indentLeft->SetToolTip(_("The left indent."));
@@ -220,7 +220,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
     wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL);
     itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxT(""), wxDefaultPosition, wxSize(50, -1), 0 );
+    m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
     m_indentLeftFirst->SetHelpText(_("The first line indent."));
     if (wxRichTextIndentsSpacingPage::ShowToolTips())
         m_indentLeftFirst->SetToolTip(_("The first line indent."));
@@ -232,7 +232,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
     wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL);
     itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxT(""), wxDefaultPosition, wxSize(50, -1), 0 );
+    m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
     m_indentRight->SetHelpText(_("The right indent."));
     if (wxRichTextIndentsSpacingPage::ShowToolTips())
         m_indentRight->SetToolTip(_("The right indent."));
@@ -287,7 +287,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
     wxBoxSizer* itemBoxSizer43 = new wxBoxSizer(wxHORIZONTAL);
     itemFlexGridSizer41->Add(itemBoxSizer43, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxT(""), wxDefaultPosition, wxSize(50, -1), 0 );
+    m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
     m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
     if (wxRichTextIndentsSpacingPage::ShowToolTips())
         m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
@@ -299,7 +299,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
     wxBoxSizer* itemBoxSizer46 = new wxBoxSizer(wxHORIZONTAL);
     itemFlexGridSizer41->Add(itemBoxSizer46, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxT(""), wxDefaultPosition, wxSize(50, -1), 0 );
+    m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
     if (wxRichTextIndentsSpacingPage::ShowToolTips())
         m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
     itemBoxSizer46->Add(m_spacingAfter, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
@@ -312,7 +312,15 @@ void wxRichTextIndentsSpacingPage::CreateControls()
 
     wxArrayString m_spacingLineStrings;
     m_spacingLineStrings.Add(_("Single"));
+    m_spacingLineStrings.Add(_("1.1"));
+    m_spacingLineStrings.Add(_("1.2"));
+    m_spacingLineStrings.Add(_("1.3"));
+    m_spacingLineStrings.Add(_("1.4"));
     m_spacingLineStrings.Add(_("1.5"));
+    m_spacingLineStrings.Add(_("1.6"));
+    m_spacingLineStrings.Add(_("1.7"));
+    m_spacingLineStrings.Add(_("1.8"));
+    m_spacingLineStrings.Add(_("1.9"));
     m_spacingLineStrings.Add(_("2"));
     m_spacingLine = new wxComboBox( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, _("Single"), wxDefaultPosition, wxSize(90, -1), m_spacingLineStrings, wxCB_READONLY );
     m_spacingLine->SetStringSelection(_("Single"));
@@ -437,12 +445,8 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow()
 
     int spacingIndex = m_spacingLine->GetSelection();
     int lineSpacing = 0;
-    if (spacingIndex == 0)
-        lineSpacing = 10;
-    else if (spacingIndex == 1)
-        lineSpacing = 15;
-    else if (spacingIndex == 2)
-        lineSpacing = 20;
+    if (spacingIndex != -1)
+        lineSpacing = 10 + spacingIndex;
 
     if (lineSpacing == 0)
         attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING));
@@ -526,12 +530,8 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow()
         int index = 0;
 
         int lineSpacing = attr->GetLineSpacing();
-        if (lineSpacing == 10)
-            index = 0;
-        else if (lineSpacing == 15)
-            index = 1;
-        else if (lineSpacing == 20)
-            index = 2;
+        if (lineSpacing >= 10 && lineSpacing <= 20)
+            index = lineSpacing - 10;
         else
             index = -1;
 
index 731634e4925171870acf8f91e9c4fe6df7df31a3..00b24a319af00dd37f138f9b4404694048b34202 100644 (file)
@@ -520,6 +520,8 @@ void wxRichTextStyleListBox::UpdateStyles()
 {
     if (GetStyleSheet())
     {
+        int oldSel = GetSelection();
+
         SetSelection(wxNOT_FOUND);
 
         m_styleNames.Clear();
@@ -546,9 +548,15 @@ void wxRichTextStyleListBox::UpdateStyles()
 
         Refresh();
 
-        if (GetItemCount() > 0)
+        int newSel = -1;
+        if (oldSel >= 0 && oldSel < (int) GetItemCount())
+            newSel = oldSel;
+        else if (GetItemCount() > 0)
+            newSel = 0;
+
+        if (newSel >= 0)
         {
-            SetSelection(0);
+            SetSelection(newSel);
             SendSelectedEvent();
         }
     }
@@ -940,6 +948,7 @@ void wxRichTextStyleListCtrl::OnChooseType(wxCommandEvent& event)
             return;
 
         wxRichTextStyleListBox::wxRichTextStyleType styleType = StyleIndexToType(event.GetSelection());
+        m_styleListBox->SetSelection(-1);
         m_styleListBox->SetStyleType(styleType);
     }
 }