Issue 15208 - fix ugly 'new' icon sizing ... (patch)
Summary: fix ugly 'new' icon sizing ... (patch)
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 Beta2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0.2
Assignee: pb
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-02 15:20 UTC by mmeeks
Modified: 2006-05-04 07:53 UTC (History)
4 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
The patch for review. (1.66 KB, patch)
2006-01-12 10:55 UTC, kendy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description mmeeks 2003-06-02 15:20:02 UTC
The 'New' icon is clearly 32x32 instead of the same size as the rest of the
toolbar icons (in my case this is 24x24) - This patch scales the icons (& our
alpha) to be the right size so as to avoid bloating the UI accidentally :-)

Index: sfx2/source/toolbox/tbxitem.cxx
===================================================================
RCS file: /cvs/framework/sfx2/source/toolbox/tbxitem.cxx,v
retrieving revision 1.30
diff -u -p -u -r1.30 tbxitem.cxx
--- sfx2/source/toolbox/tbxitem.cxx     4 Apr 2003 17:39:32 -0000       1.30
+++ sfx2/source/toolbox/tbxitem.cxx     2 Jun 2003 14:16:35 -0000
@@ -746,19 +746,29 @@ BOOL Impl_ExistURLInMenu( const PopupMen
 
 void SfxAppToolBoxControl_Impl::SetImage( const String &rURL )
 {
-    /* We accept URL's here only, which exist as items of our internal popup menu.
-       All other ones will be ignored and a fallback is used ... */
-    String aURL = rURL;
-    String sFallback;
-    BOOL bValid = Impl_ExistURLInMenu(pMenu,aURL,&sFallback);
-    if (!bValid)
-        aURL = sFallback;
+       /* We accept URL's here only, which exist as items of our internal popup
menu.
+          All other ones will be ignored and a fallback is used ... */
+       String aURL = rURL;
+       String sFallback;
+       BOOL bValid = Impl_ExistURLInMenu(pMenu,aURL,&sFallback);
+       if (!bValid)
+               aURL = sFallback;
 
        BOOL bBig = ( SfxImageManager::GetCurrentSymbolSet() == SFX_SYMBOLS_LARGE );
-    GetToolBox().SetItemImage( GetId(),
-                                                         
SvFileInformationManager::GetImage( INetURLObject( aURL ),
-                                                          bBig,
-                                                              
GetToolBox().GetBackground().GetColor().IsDark() ) );
+       Image aI = SvFileInformationManager::GetImage( INetURLObject( aURL ), bBig,
+                                                     
GetToolBox().GetBackground().GetColor().IsDark() );
+       Size aBigSize( 24, 24 );
+       if ( bBig && aI.GetSizePixel() != aBigSize )
+       {
+               BitmapEx aScaleBmp( aI.GetBitmap(), aI.GetMaskBitmap() );
+               aScaleBmp.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
+               Image aSizedImage( aScaleBmp );
+
+               GetToolBox().SetItemImage( GetId(), aSizedImage);
+       } 
+       else
+               GetToolBox().SetItemImage( GetId(), aI);
+
        aLastURL = aURL;
 }
 
Thanks.
Comment 1 thorsten.martens 2003-06-02 15:40:17 UTC
TM->HR: Please have a look, thanks !
Comment 2 jens-heiner.rechtien 2003-06-04 10:14:43 UTC
HR->CD: please comment.
Comment 3 carsten.driesner 2003-06-11 07:51:37 UTC
CD->OS: This patch corrects the problem with the 'New' icon having a
different size than all other icons. But I think it's not the correct
place to do it. The "SvFileInformationManager::GetImage" method
provides the image so I think this function should scale the images
correctly. It is used by many other code parts of OOo and then they
also have to be adapted. So it makes more sense to implement scaling
into "SvFileInformationManager::GetImage".
As discussed, Oliver please take over. PB maintains the
SvFileInformationManager class.
Comment 4 mmeeks 2003-06-11 09:02:38 UTC
You're a braver man than I to touch the SvFileInformationManager. That
seems designed to track two icon sizes: 16x16 and 32x32. Many of the
places it is used the 32x32 looks ~ok - eg. Tools->Options many pages
have a header icon that looks 'good' at that size,

I imagine the best quality result would be to pass a 'size' parameter
to the API; specifying whether a 32x32,16x16 or 24x24 icon was
required and scaling automatically.

Having said that it'd very obviously be better to have new 24x24
artwork here rather than scaling the (rather scraggly) 32x32s to 24x24
IMHO.
Comment 5 Oliver Specht 2003-06-18 08:55:19 UTC
OS: Target, Prio, Platform and OS changed. Reassigned to PB.
Comment 6 pb 2003-06-18 09:42:15 UTC
Accepted
Comment 7 mmeeks 2003-07-24 17:54:54 UTC
This really won't be fixed for a year and a half ?
Comment 8 mmeeks 2003-07-24 18:00:04 UTC
Ah; I see from another bug, that the 1.1.1 milestone was only added
recently; is there any chance of re-assiging it to that ? - the
toolbar looks somewhat horrifically bloated with the single out-sized
'new' icon in it.
Comment 9 stefan.baltzer 2004-06-08 11:49:26 UTC
SBA: Target set to OOo Later.
Comment 10 mmeeks 2004-11-11 17:39:04 UTC
ok - so this is still looking uglier than the average backside; particularly
with 24x24 'big' icons in the toolbar. Comments for how to make this more
flexible (detecting the size of other toolbar icons etc.) appreciated:

--- sfx2/source/toolbox/tbxitem.cxx
+++ sfx2/source/toolbox/tbxitem.cxx
@@ -1485,10 +1485,20 @@
         aURL = sFallback;
 
 	BOOL bBig = ( SfxImageManager::GetCurrentSymbolSet() == SFX_SYMBOLS_LARGE );
-    GetToolBox().SetItemImage( GetId(),
-							   SvFileInformationManager::GetImage( INetURLObject( aURL ),
-							   bBig,
-								GetToolBox().GetBackground().GetColor().IsDark() ) );
+
+	Image aI = SvFileInformationManager::GetImage( INetURLObject( aURL ), bBig,
+												   GetToolBox().GetBackground().GetColor().IsDark() );
+
+	Size aBigSize( 24, 24 );
+	if ( bBig && aI.GetSizePixel() != aBigSize )
+	{
+		BitmapEx aScaleBmpEx( aI.GetBitmapEx() );
+		aScaleBmpEx.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
+		GetToolBox().SetItemImage( GetId(), Image( aScaleBmpEx ) );
+	} 
+	else
+		GetToolBox().SetItemImage( GetId(), aI);
+
 	aLastURL = aURL;
 }
 
HTH.
Comment 11 kendy 2006-01-12 10:51:35 UTC
So - now when the iconswitching1 CWS is integrated (issue 36518), we can do it  
better - according to the used theme.  Would the following patch be acceptable,  
please? 
 
Please note that the patch I am going to attach depends on the one from issue 
41833. 
   
If it is acceptable, I'd like to commit it to CWS iconswitching2, and target it 
2.0.2. 
Comment 12 kendy 2006-01-12 10:55:53 UTC
Created attachment 33139 [details]
The patch for review.
Comment 13 kendy 2006-01-13 15:12:43 UTC
Added ka to Cc: 
Comment 14 kendy 2006-01-17 07:32:26 UTC
Committed to CWS iconswitching2.
Comment 15 kendy 2006-02-06 12:19:35 UTC
Works well for me & ka has approved the patch in a private mail.
Comment 16 pb 2006-05-04 07:53:07 UTC
pb: integrated -> closed.