[Libreoffice-commits] .: vcl/aqua vcl/inc vcl/source vcl/unx

Lubos Lunak llunak at kemper.freedesktop.org
Wed Apr 20 08:06:43 PDT 2011


 vcl/aqua/source/window/salframe.cxx      |    1 +
 vcl/inc/vcl/settings.hxx                 |    5 +++++
 vcl/source/app/settings.cxx              |    3 +++
 vcl/source/control/edit.cxx              |   18 +++++++++++-------
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |    1 +
 5 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 1fa896b817d15198311f5ea268bd41864a4c2c09
Author: Christian Dywan <christian.dywan at lanedo.com>
Date:   Thu Apr 14 19:41:41 2011 +0200

    Only accelerators in Edit popup on Windows and KDE
    
    The new style setting AcceleratorsInContextMenus defaults to True and
    is disabled for GNOME and OSX.
    
    Fixes: fdo#36239

diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 77a3dcb..f37182f 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.SetAcceleratorsInContextMenus( sal_False );
     
     rSettings.SetStyleSettings( aStyleSettings );
 
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index 1f68ec9..e5a824c 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                            mnAcceleratorsInContextMenus;
     Wallpaper                       maWorkspaceGradient;
     const void*                     mpFontOptions;
 };
@@ -735,6 +736,10 @@ public:
                                         { CopyData(); mpData->mnSkipDisabledInMenus = bSkipDisabledInMenus; }
     sal_Bool							GetSkipDisabledInMenus() const
                                         { return (sal_Bool) mpData->mnSkipDisabledInMenus; }
+    void                                                       SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus )
+                                        { CopyData(); mpData->mnAcceleratorsInContextMenus = bAcceleratorsInContextMenus; }
+    sal_Bool							GetAcceleratorsInContextMenus() const
+                                        { return mpData->mnAcceleratorsInContextMenus; }
 
     void                            SetCairoFontOptions( const void *pOptions )
                                         { CopyData(); mpData->mpFontOptions = pOptions;  }
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index c479315..b256f04 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;
+    mnAcceleratorsInContextMenus	= rData.mnAcceleratorsInContextMenus;
     mnToolbarIconSize			= rData.mnToolbarIconSize;
     mnSymbolsStyle				= rData.mnSymbolsStyle;
     mnPreferredSymbolsStyle			= rData.mnPreferredSymbolsStyle;
@@ -617,6 +618,7 @@ void ImplStyleData::SetStandardStyles()
     mnUseFlatMenues 			= 0;
     mbPreferredUseImagesInMenus	        = sal_True;
     mnSkipDisabledInMenus		= (sal_uInt16)sal_False;
+    mnAcceleratorsInContextMenus	= sal_True;
 
     Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
     maWorkspaceGradient = Wallpaper( aGrad );
@@ -1077,6 +1079,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->mnAcceleratorsInContextMenus	== rSet.mpData->mnAcceleratorsInContextMenus)		&&
          (mpData->maFontColor				== rSet.mpData->maFontColor ))
         return sal_True;
     else
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 30e0296..fb352f3 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2933,13 +2933,17 @@ PopupMenu* Edit::CreatePopupMenu()
         return new PopupMenu();
 
     PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) );
-    pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) );
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    if ( rStyleSettings.GetAcceleratorsInContextMenus() )
+    {
+        pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) );
+        pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) );
+    }
     return pPopup;
 }
 
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index d73b197..6a31d2d 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -3352,6 +3352,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
 
     // menu disabled entries handling
     aStyleSet.SetSkipDisabledInMenus( sal_True );
+    aStyleSet.SetAcceleratorsInContextMenus( sal_False );
     // menu colors
     GtkStyle* pMenuStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gMenuWidget );
     GtkStyle* pMenuItemStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenuItemMenuWidget );


More information about the Libreoffice-commits mailing list