14.12.2011 17:01, Michael Meeks пишет:
On Wed, 2011-12-14 at 15:32 +0400, Ivan Timofeev wrote:If I understood you right, the MENU_FLAG_SHOWCHECKIMAGES flag was introduced to control whether a simple check mark [x] or an image should be painted with a checkable menu item; if it is so, it don't work anyway. But may be I missed some piece of logic again :)So - you're right; sorry for the noise ! :-) How does it look with your fix in place ? :-)
see the attaches :)I've tweaked menu.cxx a bit and have added "Checkable = TRUE ; \" to some (not all) indigent menu items in sw/source/ui/app/mn.src, don't know whether this is a right solution. If so, we should very carefully visit all such src files.
And somehow we should enable MENU_FLAG_SHOWCHECKIMAGES for win I think. I have not enough time to do that now, crazy pre-session weeks have started! :)
Regards, Ivan
Attachment:
refined-menu.png
Description: PNG image
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index edcaa8e..71d72ee 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -76,41 +76,50 @@
{\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_WEIGHT\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_POSTURE\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_OVERLINE\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_UNDERLINE\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_SHADOWED\
};\
MenuItem\
{\
+ Checkable = TRUE ; \
ITEM_FORMAT_ATTR_CHAR_CONTOUR\
};\
SEPARATOR ; \
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_SET_SUPER_SCRIPT ; \
HelpId = CMD_FN_SET_SUPER_SCRIPT ; \
Text [ en-US ] = "Superscript" ; \
};\
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_SET_SUB_SCRIPT ; \
HelpId = CMD_FN_SET_SUB_SCRIPT ; \
Text [ en-US ] = "Subscript" ; \
@@ -1141,18 +1150,22 @@ Menu MN_ANNOTATION_POPUPMENU
{
MenuItem\
{\
+ Checkable = TRUE ;\
ITEM_FORMAT_ATTR_CHAR_WEIGHT\
};\
MenuItem\
{\
+ Checkable = TRUE ;\
ITEM_FORMAT_ATTR_CHAR_POSTURE\
};\
MenuItem\
{\
+ Checkable = TRUE ;\
ITEM_FORMAT_ATTR_CHAR_UNDERLINE\
};\
MenuItem\
{\
+ Checkable = TRUE ;\
ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\
};\
SEPARATOR ;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index e143dfe..9f6ac6e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2434,7 +2434,8 @@ Size Menu::ImplCalcSize( Window* pWin )
}
// Image:
- if ( !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType ==
MENUITEM_STRINGIMAGE ) ) )
+ if ( !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType ==
MENUITEM_STRINGIMAGE ) ) &&
+ ( (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pData->HasCheck() ) )
{
Size aImgSz = pData->aImage.GetSizePixel();
aImgSz.Height() += 4; // add a border for native marks
@@ -2748,7 +2749,8 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY,
MenuItemDa
// however do not do this if native checks will be painted since
// the selection color too often does not fit the theme's check and/or radio
- if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType ==
MENUITEM_STRINGIMAGE ) ) )
+ if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType ==
MENUITEM_STRINGIMAGE ) ) ||
+ (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) == 0 )
{
if ( pWin->IsNativeControlSupported( CTRL_MENU_POPUP,
(pData->nBits & MIB_RADIOCHECK)