[Libreoffice] Icon/Image cleanup

Joseph Powers jpowers27 at cox.net
Sat Nov 6 03:56:56 PDT 2010


Ok, I went ahead and did some high-contrast cleanup work on libs-core. I was able to delete massive amounts of code and configuration items. The main issue I'm having is the masking:

#define DEFAULT_IDLIST \
    IdList = {                                          \
        /* Eingabezeile */                                                              \
        SID_INPUT_FUNCTION;                             /* 20047 */             \
        SID_INPUT_SUM;                                  /* 20048 */             \
        SID_INPUT_EQUAL;                                /* 20049 */             \
        SID_INPUT_CANCEL;                               \
        SID_INPUT_OK;                                   \
    };                                                  \
    IdCount = {                                         \
        5;                                              \
    };

ImageList RID_DEFAULTIMAGELIST_SC
{
    Prefix = "sc";
    MaskColor = STD_MASKCOLOR ;
    DEFAULT_IDLIST
};

Image RID_IMAGE_STATUSBAR_LOGO
{
    ImageBitmap = Bitmap { File = "logo.png" ; };
    MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
};

Please note that the MaskColor for high-contrast icons can be different then the one for standard icons. These may need adjusting.

The above gets compiled into a .res file; if anyone knows how & where it gets loaded back at runtime, could you share the secret please. I'd like to modify it in the future to split the Image, ImageList, & Bitmaps into their own files so they can be swapped out with the icon themes.

My patch currently just rips out some fairly simple code that goes basically like:

sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );

And some times they get fancy and load/cache both images:

Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) );
Image aImageHC( SfxResId( SFX_IMG_CLOSE_DOC_HC ) );
m_aToolbox.InsertItem( 1, GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageHC : aImage );

Then to make things more fun, they decided that having a list of images would be nice:

ImageList maImageList( SVX_RES( CD_IMAPDLG ) );
ImageList maImageListH( SVX_RES( CDH_IMAPDLG ) );
bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;

The above stuff is easy, just kill the HC Id in the .hrc, remove the Image... definitions from the .src, and remove the related code from the program.

The hard stuff comes later...

1. We have soft-coded ImageLists
	a. Need to modify the control classes that house these and make sweeping changes to cleanup the fallout cause by the API changes.

2. Determine how to handle the odd cases:
	a. We have code that detects changing from HC to Normal and back... Do we need this? Changing icon themes just work and HC is just at theme; thus, I don't see the need for this code.
	b. We change colors on some controls based on HC mode. Wouldn't it be better to create a 2nd color scheme for HC. (calling all artist... please switch the icons to HC, and then change the colors until it looks good(actually bad-it needs to be HC which isn't pretty). We'll then need to figure out how to package the colors for shipping.

I haven't played with the icons/images yet. That'll take work trying to figure out the build system (any volunteers?) So far, I've removed references for the following items:

backing_hc.png
backing_space_hc.png
backing_right_hc.png
backing_rtl_left_hc.png
backing_rtl_right_hc.png
extension_hc.png
register_hc.png
info_hc.png
template_hc.png
odt_32_hc.png
ods_32_hc.png
odp_32_hc.png
odg_32_hc.png
odb_32_hc.png
odf_32_hc.png
folder_32_hc.png
templates_32_hc.png
sch06300.png
shared_16_h.png
lock_16_h.png
caution_16_h.png
extension_32_h.png
sc10350_h.bmp
hlpbookopen_h.bmp
hlpbookclosed_h.bmp
hlpdoc_h.bmp
indexon_big_h.bmp
indexon_small_h.bmp
indexoff_small_h.bmp
indexoff_big_h.bmp
lch06301.bmp
sch06301.bmp
sch06303.bmp
sch06300.bmp
sch05504.bmp
favourite_h.bmp
sch05961.bmp
sch05711.bmp
lch06303.bmp
lch06300.bmp
lch05504.bmp
favourite_big_h.bmp
lch05961.bmp
lch05711.bmp
closedochc.png
fwthcirc_h.bmp
fwtoparc_h.bmp
fwbotarc_h.bmp
fwlftarc_h.bmp
fwrgtarc_h.bmp
fwbuttn1_h.bmp
fwbuttn2_h.bmp
fwbuttn3_h.bmp
fwbuttn4_h.bmp
nuh01.png
nuh04.png
nuh02.png
lngcheck_h.bmp
galicon_h.bmp
gallist_h.bmp
signet_11x16_h.png
caution_11x16_h.png
notcertificate_16_h.png
navigationball_10_h.png
slidezoomin_11_h.png
slidezoomout_11_h.png
perspective_16_h.bmp
parallel_16_h.bmp
directionnorthwest_22_h.bmp
directionnorth_22_h.bmp
directionnortheast_22_h.bmp
directionwest_22_h.bmp
directionstraight_22_h.bmp
directioneast_22_h.bmp
directionsouthwest_22_h.bmp
directionsouth_22_h.bmp
directionsoutheast_22_h.bmp
extrusion0inch_16_h.bmp
extrusion05inch_16_h.bmp
extrusion1inch_16_h.bmp
extrusion2inch_16_h.bmp
extrusion4inch_16_h.bmp
extrusioninfinity_16_h.bmp
lightofffromtopleft_22_h.bmp
lightofffromtop_22_h.bmp
lightofffromtopright_22_h.bmp
lightofffromleft_22_h.bmp
lightofffromright_22_h.bmp
lightofffrombottomleft_22_h.bmp
lightofffrombottom_22_h.bmp
lightofffrombottomright_22_h.bmp
lightonfromtopleft_22_h.bmp
lightonfromtop_22_h.bmp
lightonfromtopright_22_h.bmp
lightonfromleft_22_h.bmp
lightonfromright_22_h.bmp
lightonfrombottomright_22_h.bmp
brightlit_16_h.bmp
normallit_16_h.bmp
dimlit_16_h.bmp
lightfromtopleft_22_h.bmp
lightfromtop_22_h.bmp
lightfromtopright_22_h.bmp
lightfromleft_22_h.bmp
lightfromright_22_h.bmp
lightfromfront_22_h.bmp
lightfrombottomleft_22_h.bmp
lightfrombottom_22_h.bmp
lightfrombottomright_22_h.bmp
wireframe_16_h.bmp
matte_16_h.bmp
plastic_16_h.bmp
metal_16_h.bmp
fontworkalignleft_16_h.png
fontworkalignleft_26_h.png
fontworkaligncentered_16_h.png
fontworkaligncentered_26_h.png
fontworkalignright_16_h.png
fontworkalignright_26_h.png
fontworkalignjustified_16_h.png
fontworkalignjustified_26_h.png
fontworkalignstretch_16_h.png
fontworkalignstretch_26_h.png

Plus a few lists:
fph
sch
lch
idh
fwh
cdh
tbh
dah
sxh
frh

So far I haven't notices any additional break-age from these changes. The HC them has a few icons that disappear under Mac OS and changing the OS to HC just makes things worse; however, these are broken on the default build also... so no damage done.



Joe P.

PS: Sorry about the patch size, I'll try to break the other repos down by sub-directory.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-High-Contrast-Cleanup-Phase-1-calc.patch
Type: application/octet-stream
Size: 6368 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0005.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0005.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-High-Contrast-Cleanup-Phase-1-filters.patch
Type: application/octet-stream
Size: 1312 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0006.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0006.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-High-Contrast-Cleanup-Phase-1-libs-core.patch
Type: application/octet-stream
Size: 266479 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0007.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0007.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-High-Contrast-Cleanup-Phase-1-libs-gui.patch
Type: application/octet-stream
Size: 1754 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0008.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0008.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-High-Contrast-Cleanup-Phase-1-writer.patch
Type: application/octet-stream
Size: 19858 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0009.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101106/12247bcc/attachment-0009.htm>


More information about the LibreOffice mailing list