Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello!

2012/1/13 Ivan Timofeev <timofeev.i.s@gmail.com>

Hello,

13.01.2012 18:15, Tomcsik Bence Tibor пишет:

Hi,

Bug 33794 solved.


IMHO it's better to pass some additional parameter to the layoutButton
function ( e.g. int i_nExtraWidth = 0 ) and change:

   nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on
the safe side

to:

   nTextWidth += maButtonImageSize.Width() + 8 + i_nExtraWidth;

; then use i_nExtraWidth = 18 (as you suggested in the patch: 26 - 8 = 18)
for the "Open..." button.

What do you think?

Regards,
Ivan


You are absolutely right.
Because of your idea, I checked the code again, and I realized that I
calculated twice the widths.. There's no need to do the maximum search,
because the layoutButton function does it and hereafter considers the extra
width.
Passing the int i_nExtraWidth parameter to the layoutButton function will
fix the bug much easier.
Thank you for the idea. I send the new patch.
From d0f61faddc9f4486931ac75f6eeac2503e686e96 Mon Sep 17 00:00:00 2001
From: Tomcsik Bence <tomcsikbence@gmail.com>
Date: Sat, 14 Jan 2012 00:14:45 +0100
Subject: [PATCH] I added a new parameter to the layoutButton function fdo#33794

By adding a int i_nExtraWidth parameter to the layoutButton function
there will be enough space for the open button and its black triangle.
---
 framework/source/services/backingwindow.cxx |   20 ++++++++++----------
 framework/source/services/backingwindow.hxx |    2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/framework/source/services/backingwindow.cxx 
b/framework/source/services/backingwindow.cxx
index a28f80f..2db5879 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -572,33 +572,33 @@ void BackingWindow::initControls()
     }
 
     // layout the buttons
-    layoutButton( WRITER_URL, 0, aFileNewAppsAvailable,
+    layoutButton( WRITER_URL, 0, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SWRITER,
                   maWriterButton, aMnemns );
-    layoutButton( DRAW_URL, 1, aFileNewAppsAvailable,
+    layoutButton( DRAW_URL, 1, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SDRAW,
                   maDrawButton, aMnemns );
     nYPos += maButtonImageSize.Height() + 10;
-    layoutButton( CALC_URL, 0, aFileNewAppsAvailable,
+    layoutButton( CALC_URL, 0, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SCALC,
                   maCalcButton, aMnemns );
-    layoutButton( BASE_URL, 1, aFileNewAppsAvailable,
+    layoutButton( BASE_URL, 1, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SDATABASE,
                   maDBButton, aMnemns );
     nYPos += maButtonImageSize.Height() + 10;
-    layoutButton( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable,
+    layoutButton( IMPRESS_WIZARD_URL, 0, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SIMPRESS,
                   maImpressButton, aMnemns );
-    layoutButton( MATH_URL, 1, aFileNewAppsAvailable,
+    layoutButton( MATH_URL, 1, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SMATH,
                   maMathButton, aMnemns );
 
     nYPos += 3*maButtonImageSize.Height() / 2;
 
-    layoutButton( NULL, 0, aFileNewAppsAvailable,
+    layoutButton( NULL, 0, 18, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SWRITER,
                   maOpenButton, aMnemns, maOpenString );
-    layoutButton( NULL, 1, aFileNewAppsAvailable,
+    layoutButton( NULL, 1, 0, aFileNewAppsAvailable,
                   aModuleOptions, SvtModuleOptions::E_SWRITER,
                   maTemplateButton, aMnemns, maTemplateString );
     nYPos += 10;
@@ -664,7 +664,7 @@ void BackingWindow::loadImage( const ResId& i_rId, PushButton& i_rButton )
 }
 
 void BackingWindow::layoutButton(
-                          const char* i_pURL, int nColumn,
+                          const char* i_pURL, int nColumn, int i_nExtraWidth,
                           const std::set<rtl::OUString>& i_rURLS,
                           SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
                           PushButton& i_rBtn,
@@ -690,7 +690,7 @@ void BackingWindow::layoutButton(
 
     long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() );
 
-    nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on the safe side
+    nTextWidth += maButtonImageSize.Width() + 8 + i_nExtraWidth; // add some fuzz to be on the 
safe side
     if( nColumn >= 0 && nColumn < static_cast<int>(SAL_N_ELEMENTS(mnColumnWidth)) )
     {
         if( nTextWidth > mnColumnWidth[nColumn] )
diff --git a/framework/source/services/backingwindow.hxx 
b/framework/source/services/backingwindow.hxx
index 410862f..179a632 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -144,7 +144,7 @@ namespace framework
 
         void loadImage( const ResId& i_rId, PushButton& i_rButton );
 
-        void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS,
+        void layoutButton( const char* i_pURL, int nColumn, int i_nExtraWidth, const 
std::set<rtl::OUString>& i_rURLS,
                            SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
                            PushButton& i_rBtn,
                            MnemonicGenerator& i_rMnemonicGen,
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.