From 3a96148b357bd162401b4756be979d335e7ff2e4 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Tue, 29 Sep 1998 17:32:35 +0000 Subject: [PATCH] use new menu bar (no more mercutio) --- cmd/macfe/central/uapp.cp | 34 ++++++++++++++++++++++++++++++---- cmd/macfe/central/uapp.h | 2 +- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/cmd/macfe/central/uapp.cp b/cmd/macfe/central/uapp.cp index 49ed024d2835..72c892faa511 100644 --- a/cmd/macfe/central/uapp.cp +++ b/cmd/macfe/central/uapp.cp @@ -43,6 +43,7 @@ #include #include +#include // macfe //#include "NavigationServicesSupport.h" @@ -1861,11 +1862,12 @@ void CFrontApp::OpenBookmarksFile( FSSpec* inFileSpec, CBrowserWindow * /*win*/, { Try_ { - vector url(500); + const int kBufferLen = 500; + vector url (kBufferLen); OSErr err = ReadBookmarksFile(url, *inFileSpec); ThrowIfOSErr_(err); - URL_Struct * request = NET_CreateURLStruct( url.begin(), NET_DONT_RELOAD ); + URL_Struct * request = NET_CreateURLStruct( &(*url.begin()), NET_DONT_RELOAD ); CURLDispatcher::DispatchURL(request, NULL); } Catch_(inErr) @@ -1954,6 +1956,23 @@ void CFrontApp::PrintDocument(FSSpec* inFileSpec) PrintDocument( inFileSpec ); } + +// +// MakeMenuBar +// +// Overidden to make an appearance-savvy menu bar. +// +void +CFrontApp::MakeMenuBar() +{ + if ( UEnvironment::HasFeature( env_HasAppearance ) ) + new LAppearanceMBAR(MBAR_Initial); + else + new LMenuBar(MBAR_Initial); + LMenuBar::GetCurrentMenuBar()->SetModifierKeys ( cmdKey | shiftKey ); +} + + // --------------------------------------------------------------------------- // ¥ ClickMenuBar // --------------------------------------------------------------------------- @@ -3198,7 +3217,6 @@ void CFrontApp::DoHelpMenuItem( short itemNum ) } } -extern pascal long MDEF_MenuKey( long theMessage, short theModifiers, MenuHandle hMenu ); //----------------------------------- void CFrontApp::EventKeyDown( const EventRecord& inMacEvent ) @@ -3235,7 +3253,14 @@ void CFrontApp::EventKeyDown( const EventRecord& inMacEvent ) { CTargetedUpdateMenuRegistry::SetCommands(CFrontApp::GetCommandsToUpdateBeforeSelectingMenu()); CTargetedUpdateMenuRegistry::UpdateMenus(); - + + // MacOS8 can do the weird key combos for us w/out Mercutio. + SInt32 unused; + LAppearanceMBAR* bar = dynamic_cast(LMenuBar::GetCurrentMenuBar()); + if ( bar ) + keyCommand = bar->FindKeyCommand ( inMacEvent, unused ); + +#if 0 menuChoice = MDEF_MenuKey( inMacEvent.message, inMacEvent.modifiers, ::GetMenu( 666 ) ); @@ -3258,6 +3283,7 @@ void CFrontApp::EventKeyDown( const EventRecord& inMacEvent ) keyCommand = LMenuBar::GetCurrentMenuBar()->FindCommand( HiWord(menuChoice), LoWord(menuChoice)); +#endif } } SignalIf_(LCommander::GetTarget() == nil); diff --git a/cmd/macfe/central/uapp.h b/cmd/macfe/central/uapp.h index 0388dbd849d2..5f7eb30ef12a 100644 --- a/cmd/macfe/central/uapp.h +++ b/cmd/macfe/central/uapp.h @@ -144,8 +144,8 @@ public: return sCommandsToUpdateBeforeSelectingMenu; } + virtual void MakeMenuBar(); virtual void ClickMenuBar(const EventRecord& inMacEvent); - virtual void SetMenubar( ResIDT mbar, Boolean inUpdateNow = false ); // If appleMenu is 0, do not rebuild it virtual void UpdateMenus(); void UpdateHierarchicalMenus();