Am 27.04.2011 13:01:36 schrieb Christoph Noack:
> Just a small question ... do I get it right that the disabled menu items
> get hidden instead of being "grayed out"? Real interest: could you
> please explain what the rationale for the change is? As far as I know,
> there is currently no platform guideline that requires that (or even
> allows that) - but I might be wrong.
Yes, disabled becomes hidden effectively. That is *current* behaviour on all
systems as far as I can tell, so I'm not introducing anything new, to make that
clear.
I explicitly want to change this for GTK+ because it is wrong behaviour.
As far as I know, OS X and KDE are the only platforms doing this (I'll ignore
Maemo). I don't know the exact guideline, I didn't find clear documentation
about it but for example the web page context menu on OS X does it and editor
popups I saw in KDE.
That said, Lubos or anyone else, please correct me if my observation is wrong,
I'll adapt the patch accordingly.
I updated the patch and attached a second one to get ird of
UpdateApplicationSettings which for no good reason tries to flip the same
switch in a very misleading way.
ciao,
Christian
From e6d2363785af7e8021afe358be66db233d360fc4 Mon Sep 17 00:00:00 2001
From: Christian Dywan <christian.dy...@lanedo.com>
Date: Thu, 21 Apr 2011 15:14:32 +0200
Subject: [PATCH] Introduce HideDisabledMenuItems style setting
The STYLE_OPTION_HIDEDISABLED flag is removed.
The setting is enabled for KDE and OSX.
---
svtools/source/edit/svmedit.cxx | 3 ---
vcl/aqua/source/window/salframe.cxx | 1 +
vcl/inc/vcl/settings.hxx | 6 +++++-
vcl/source/app/settings.cxx | 3 +++
vcl/source/control/edit.cxx | 7 ++++---
vcl/unx/kde/salnativewidgets-kde.cxx | 1 +
vcl/unx/kde4/KDESalFrame.cxx | 1 +
7 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index b182446..b1f8919 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -859,9 +859,6 @@ void TextWindow::Command( const CommandEvent& rCEvt )
if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
{
PopupMenu* pPopup = Edit::CreatePopupMenu();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED )
- pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
if ( !mpExtTextView->HasSelection() )
{
pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False );
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index f37182f..4b41148 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1320,6 +1320,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
// images in menus false for MacOSX
aStyleSettings.SetPreferredUseImagesInMenus( false );
+ aStyleSettings.SetHideDisabledMenuItems( sal_True );
aStyleSettings.SetAcceleratorsInContextMenus( sal_False );
rSettings.SetStyleSettings( aStyleSettings );
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index e5a824c..4f16997 100644
--- a/vcl/inc/vcl/settings.hxx
+++ b/vcl/inc/vcl/settings.hxx
@@ -434,6 +434,7 @@ private:
sal_uLong mnSymbolsStyle;
sal_uLong mnPreferredSymbolsStyle;
sal_uInt16 mnSkipDisabledInMenus;
+ sal_Bool mbHideDisabledMenuItems;
sal_Bool mnAcceleratorsInContextMenus;
Wallpaper maWorkspaceGradient;
const void* mpFontOptions;
@@ -456,7 +457,6 @@ private:
#define STYLE_OPTION_SPINARROW ((sal_uLong)0x00000080)
#define STYLE_OPTION_SPINUPDOWN ((sal_uLong)0x00000100)
#define STYLE_OPTION_NOMNEMONICS ((sal_uLong)0x00000200)
-#define STYLE_OPTION_HIDEDISABLED ((sal_uLong)0x00100000)
#define DRAGFULL_OPTION_WINDOWMOVE ((sal_uLong)0x00000001)
#define DRAGFULL_OPTION_WINDOWSIZE ((sal_uLong)0x00000002)
@@ -736,6 +736,10 @@ public:
{ CopyData(); mpData->mnSkipDisabledInMenus = bSkipDisabledInMenus; }
sal_Bool GetSkipDisabledInMenus() const
{ return (sal_Bool) mpData->mnSkipDisabledInMenus; }
+ void SetHideDisabledMenuItems( sal_Bool bHideDisabledMenuItems )
+ { CopyData(); mpData->mbHideDisabledMenuItems = bHideDisabledMenuItems; }
+ sal_Bool GetHideDisabledMenuItems() const
+ { return mpData->mbHideDisabledMenuItems; }
void SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus )
{ CopyData(); mpData->mnAcceleratorsInContextMenus = bAcceleratorsInContextMenus; }
sal_Bool GetAcceleratorsInContextMenus() const
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index b256f04..388a043 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -529,6 +529,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
mnUseImagesInMenus = rData.mnUseImagesInMenus;
mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus;
+ mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus;
mnToolbarIconSize = rData.mnToolbarIconSize;
mnSymbolsStyle = rData.mnSymbolsStyle;
@@ -618,6 +619,7 @@ void ImplStyleData::SetStandardStyles()
mnUseFlatMenues = 0;
mbPreferredUseImagesInMenus = sal_True;
mnSkipDisabledInMenus = (sal_uInt16)sal_False;
+ mbHideDisabledMenuItems = sal_False;
mnAcceleratorsInContextMenus = sal_True;
Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
@@ -1079,6 +1081,7 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const
(mpData->mnUseImagesInMenus == rSet.mpData->mnUseImagesInMenus) &&
(mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) &&
(mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) &&
+ (mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) &&
(mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) &&
(mpData->maFontColor == rSet.mpData->maFontColor ))
return sal_True;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index fb352f3..14c69a0 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2094,9 +2094,6 @@ void Edit::Command( const CommandEvent& rCEvt )
if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
{
PopupMenu* pPopup = Edit::CreatePopupMenu();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED )
- pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
if ( !maSelection.Len() )
{
@@ -2934,6 +2931,10 @@ PopupMenu* Edit::CreatePopupMenu()
PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ if ( rStyleSettings.GetHideDisabledMenuItems() )
+ pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
+ else
+ pPopup->SetMenuFlags ( MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
if ( rStyleSettings.GetAcceleratorsInContextMenus() )
{
pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index d0fa4a0..5707586 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -1970,6 +1970,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Menu
aStyleSettings.SetSkipDisabledInMenus( sal_True );
+ aStyleSettings.SetHideDisabledMenuItems( sal_True );
KMenuBar *pMenuBar = qMainWindow.menuBar();
if ( pMenuBar )
{
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 8ed5078..68f9e5c 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -308,6 +308,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Menu
style.SetSkipDisabledInMenus( TRUE );
+ style.SetHideDisabledMenuItems( sal_True );
KMenuBar* pMenuBar = new KMenuBar();
if ( pMenuBar )
{
--
1.7.1
From ebb9e1b2991a96bc82e177a876c14d7b3de85972 Mon Sep 17 00:00:00 2001
From: Christian Dywan <christian.dy...@lanedo.com>
Date: Wed, 27 Apr 2011 12:56:40 +0200
Subject: [PATCH] Remove UpdateApplicationSettings function
The function did nothing else than set STYLE_OPTION_HIDEDISABLED.
It was also extremely misleading when reading the code.
---
sfx2/source/appl/app.cxx | 1 -
sfx2/source/appl/appdata.cxx | 14 --------------
sfx2/source/inc/appdata.hxx | 1 -
3 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 4f7a7bd..4d4e9c6 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -330,7 +330,6 @@ SfxApplication::SfxApplication()
SvtViewOptions::AcquireOptions();
pAppData_Impl = new SfxAppData_Impl( this );
- pAppData_Impl->UpdateApplicationSettings( SvtMenuOptions().IsEntryHidingEnabled() );
pAppData_Impl->m_xImeStatusWindow->init();
pApp->PreInit();
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 0eb99fa..327af69 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -149,20 +149,6 @@ SfxAppData_Impl::~SfxAppData_Impl()
delete pBasMgrListener;
}
-void SfxAppData_Impl::UpdateApplicationSettings( sal_Bool bDontHide )
-{
- AllSettings aAllSet = Application::GetSettings();
- StyleSettings aStyleSet = aAllSet.GetStyleSettings();
- sal_uInt32 nStyleOptions = aStyleSet.GetOptions();
- if ( bDontHide )
- nStyleOptions &= ~STYLE_OPTION_HIDEDISABLED;
- else
- nStyleOptions |= STYLE_OPTION_HIDEDISABLED;
- aStyleSet.SetOptions( nStyleOptions );
- aAllSet.SetStyleSettings( aStyleSet );
- Application::SetSettings( aAllSet );
-}
-
SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates()
{
if ( !pTemplates )
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 8df9b89..1b6f286 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -164,7 +164,6 @@ public:
SfxAppData_Impl( SfxApplication* );
~SfxAppData_Impl();
- void UpdateApplicationSettings( sal_Bool bDontHide );
SfxDocumentTemplates* GetDocumentTemplates();
void DeInitDDE();
--
1.7.1
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice