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
This commit is contained in:
Christian Dywan 2011-04-14 19:41:41 +02:00 committed by Luboš Luňák
parent 14d735f714
commit bef3653901
5 changed files with 21 additions and 7 deletions

View file

@ -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 );

View file

@ -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; }

View file

@ -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

View file

@ -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;
}

View file

@ -3337,6 +3337,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 );