[Libreoffice-commits] core.git: 2 commits - cui/uiconfig svx/inc svx/source

Caolán McNamara caolanm at redhat.com
Tue Apr 2 05:35:54 PDT 2013


 cui/uiconfig/ui/cellalignment.ui  |  123 +++++++++++++++-----------------------
 svx/inc/svx/dialcontrol.hxx       |    3 
 svx/source/dialog/dialcontrol.cxx |   53 ++++++++++++----
 3 files changed, 92 insertions(+), 87 deletions(-)

New commits:
commit 67e5e3763f31fdc906c8e9b3239b636bce3139ed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 2 13:28:50 2013 +0100

    various efforts to consistently apply HIG rules
    
    Change-Id: I1056635b0bd6f1220a7cf7cc1182a37c7d104a9a

diff --git a/cui/uiconfig/ui/cellalignment.ui b/cui/uiconfig/ui/cellalignment.ui
index 2b9f4fb..631d875 100644
--- a/cui/uiconfig/ui/cellalignment.ui
+++ b/cui/uiconfig/ui/cellalignment.ui
@@ -34,8 +34,9 @@
               <object class="GtkGrid" id="grid10">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
                 <property name="row_spacing">6</property>
-                <property name="column_spacing">12</property>
+                <property name="column_spacing">24</property>
                 <child>
                   <object class="GtkGrid" id="grid3">
                     <property name="visible">True</property>
@@ -115,6 +116,8 @@
                   <object class="svxlo-DialControl" id="dialcontrol">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="halign">center</property>
+                    <property name="valign">center</property>
                     <property name="active">True</property>
                   </object>
                   <packing>
@@ -154,7 +157,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
-                        <property name="margin_left">25</property>
+                        <property name="margin_left">12</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0.5</property>
                         <property name="inconsistent">True</property>
@@ -214,6 +217,7 @@
               <object class="GtkGrid" id="grid1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="margin_bottom">1</property>
                 <property name="row_spacing">6</property>
                 <property name="column_spacing">12</property>
                 <child>
@@ -260,7 +264,7 @@
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="no_show_all">True</property>
-                    <property name="margin_left">25</property>
+                    <property name="margin_left">12</property>
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="inconsistent">True</property>
@@ -273,6 +277,45 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkHBox" id="boxDirection">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="LabelTxtDir">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Te_xt direction</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">comboTextDirBox</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="svxlo-FrameDirectionListBox" id="comboTextDirBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>
@@ -311,6 +354,7 @@
               <object class="GtkGrid" id="grid2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
                 <property name="border_width">6</property>
                 <property name="row_spacing">6</property>
                 <property name="column_spacing">12</property>
@@ -382,6 +426,7 @@
                   <object class="GtkComboBox" id="comboboxHorzAlign">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
                     <property name="model">liststoreHorzAlign</property>
                   </object>
                   <packing>
@@ -395,6 +440,7 @@
                   <object class="GtkComboBox" id="comboboxVertAlign">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
                     <property name="model">liststoreVertAlign</property>
                   </object>
                   <packing>
@@ -427,46 +473,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkHBox" id="boxDirection">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="border_width">6</property>
-        <property name="spacing">12</property>
-        <child>
-          <object class="GtkLabel" id="LabelTxtDir">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Te_xt direction</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">comboTextDirBox</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="svxlo-FrameDirectionListBox" id="comboTextDirBox">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkBox" id="boxStrings">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -518,7 +524,7 @@
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">4</property>
+        <property name="top_attach">3</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
@@ -596,33 +602,4 @@
       </row>
     </data>
   </object>
-  <object class="GtkSizeGroup" id="sizegroup1">
-    <property name="mode">both</property>
-    <property name="ignore_hidden">True</property>
-    <widgets>
-      <widget name="spinIndentFrom:0.00pt"/>
-      <widget name="labelHorzAlign"/>
-      <widget name="labelVertAlign"/>
-      <widget name="labelIndent"/>
-      <widget name="comboboxHorzAlign"/>
-      <widget name="comboboxVertAlign"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="sizegroup2">
-    <property name="ignore_hidden">True</property>
-    <widgets>
-      <widget name="checkWrapTextAuto"/>
-      <widget name="checkShrinkFitCellSize"/>
-      <widget name="checkHyphActive"/>
-      <widget name="LabelTxtDir"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="sizegroup3">
-    <widgets>
-      <widget name="orientation"/>
-      <widget name="properties"/>
-      <widget name="alignment"/>
-      <widget name="boxDirection"/>
-    </widgets>
-  </object>
 </interface>
commit b4a42246835e9f3eb2b8a11384fe4210fe9cfef0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 2 13:27:16 2013 +0100

    teach DialControl how to resize
    
    Change-Id: Icb6cf6ce3dfcb37fc06b4222c272a1abf893dc73

diff --git a/svx/inc/svx/dialcontrol.hxx b/svx/inc/svx/dialcontrol.hxx
index 578695d..26aa073 100644
--- a/svx/inc/svx/dialcontrol.hxx
+++ b/svx/inc/svx/dialcontrol.hxx
@@ -66,6 +66,9 @@ public:
     virtual void        KeyInput( const KeyEvent& rKEvt );
     virtual void        LoseFocus();
 
+    virtual Size        GetOptimalSize() const;
+    virtual void        Resize();
+
     /** Returns true, if the control is not in "don't care" state. */
     bool                HasRotation() const;
     /** Sets the control to "don't care" state. */
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index a5a1eac..f96271f 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -40,7 +40,8 @@ class DialControlBmp : public VirtualDevice
 public:
     explicit            DialControlBmp( Window& rParent );
 
-    void                InitBitmap( const Size& rSize, const Font& rFont );
+    void                InitBitmap(const Font& rFont);
+    void                SetSize(const Size& rSize);
     void                CopyBackground( const DialControlBmp& rSrc );
     void                DrawBackground( const Size& rSize, bool bEnabled );
     void                DrawElements( const String& rText, sal_Int32 nAngle );
@@ -52,7 +53,7 @@ private:
     const Color&        GetButtonLineColor() const;
     const Color&        GetButtonFillColor( bool bMain ) const;
 
-    void                Init( const Size& rSize );
+    void                Init();
     void                DrawBackground();
 
     Window&             mrParent;
@@ -74,15 +75,16 @@ DialControlBmp::DialControlBmp( Window& rParent ) :
     EnableRTL( sal_False );
 }
 
-void DialControlBmp::InitBitmap( const Size& rSize, const Font& rFont )
+void DialControlBmp::InitBitmap(const Font& rFont)
 {
-    Init( rSize );
-    SetFont( rFont );
+    Init();
+    SetFont(rFont);
 }
 
 void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
 {
-    Init( rSrc.maRect.GetSize() );
+    Init();
+    SetSize(rSrc.maRect.GetSize());
     mbEnabled = rSrc.mbEnabled;
     Point aPos;
     DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
@@ -90,7 +92,8 @@ void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
 
 void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
 {
-    Init( rSize );
+    Init();
+    SetSize(rSize);
     mbEnabled = bEnabled;
     DrawBackground();
 }
@@ -157,15 +160,19 @@ const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
     return mbEnabled ? (bMain ? rSett.GetMenuColor() : rSett.GetHighlightColor()) : rSett.GetDisableColor();
 }
 
-void DialControlBmp::Init( const Size& rSize )
+void DialControlBmp::Init()
+{
+    SetSettings(mrParent.GetSettings());
+    SetBackground();
+}
+
+void DialControlBmp::SetSize( const Size& rSize )
 {
-    SetSettings( mrParent.GetSettings() );
     maRect.SetPos( Point( 0, 0 ) );
     maRect.SetSize( rSize );
     mnCenterX = rSize.Width() / 2;
     mnCenterY = rSize.Height() / 2;
     SetOutputSize( rSize );
-    SetBackground();
 }
 
 void DialControlBmp::DrawBackground()
@@ -249,6 +256,7 @@ struct DialControl_Impl
 
     explicit            DialControl_Impl( Window& rParent );
     void                Init( const Size& rWinSize, const Font& rWinFont );
+    void                SetSize( const Size& rWinSize );
 };
 
 // ----------------------------------------------------------------------------
@@ -268,17 +276,23 @@ DialControl_Impl::DialControl_Impl( Window& rParent ) :
 
 void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
 {
+    maWinFont = rWinFont;
+    maWinFont.SetTransparent(true);
+    maBmpBuffered.InitBitmap(maWinFont);
+    SetSize(rWinSize);
+}
+
+void DialControl_Impl::SetSize( const Size& rWinSize )
+{
     // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position
     maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 );
-    maWinFont = rWinFont;
 
     mnCenterX = maWinSize.Width() / 2;
     mnCenterY = maWinSize.Height() / 2;
-    maWinFont.SetTransparent( sal_True );
 
     maBmpEnabled.DrawBackground( maWinSize, true );
     maBmpDisabled.DrawBackground( maWinSize, false );
-    maBmpBuffered.InitBitmap( maWinSize, maWinFont );
+    maBmpBuffered.SetSize( maWinSize );
 }
 
 // ============================================================================
@@ -303,7 +317,13 @@ DialControl::~DialControl()
 
 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeDialControl(Window *pParent, VclBuilder::stringmap &)
 {
- return new DialControl(pParent, WB_BORDER | WB_TABSTOP);
+    return new DialControl(pParent, WB_TABSTOP);
+}
+
+void DialControl::Resize()
+{
+    mpImpl->SetSize(GetOutputSizePixel());
+    InvalidateControl();
 }
 
 void DialControl::Paint( const Rectangle&  )
@@ -408,6 +428,11 @@ sal_Int32 DialControl::GetRotation() const
     return mpImpl->mnAngle;
 }
 
+Size DialControl::GetOptimalSize() const
+{
+    return LogicToPixel(Size(42 , 43), MAP_APPFONT);
+}
+
 void DialControl::SetRotation( sal_Int32 nAngle )
 {
     ImplSetRotation( nAngle, false );


More information about the Libreoffice-commits mailing list