mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 00:19:27 +02:00
Bugs 1119, 1198: Bring back the Mac Window menu, at least partly...
... This poor imitation of the standard Mac Window menu only includes Minimize and Zoom. But this may be adequate for the complaints in Bug1198, when the yellow title bar button is hidden and unreachable.
This commit is contained in:
parent
056a578f08
commit
617fdb387f
@ -1209,6 +1209,7 @@
|
||||
28FE4A080ABF4E960056F5C4 /* mmx_optimized.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28FE4A060ABF4E960056F5C4 /* mmx_optimized.cpp */; };
|
||||
28FE4A090ABF4E960056F5C4 /* sse_optimized.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28FE4A070ABF4E960056F5C4 /* sse_optimized.cpp */; };
|
||||
5E02BFF21D1164DF00EB7578 /* Distortion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E02BFF01D1164DF00EB7578 /* Distortion.cpp */; };
|
||||
5E0A0E311D23019A00CD2567 /* MenusMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E0A0E301D23019A00CD2567 /* MenusMac.cpp */; };
|
||||
5E74D2E31CC4429700D88B0B /* EditCursorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DD1CC4429700D88B0B /* EditCursorOverlay.cpp */; };
|
||||
5E74D2E41CC4429700D88B0B /* PlayIndicatorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DF1CC4429700D88B0B /* PlayIndicatorOverlay.cpp */; };
|
||||
5E74D2E51CC4429700D88B0B /* Scrubbing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2E11CC4429700D88B0B /* Scrubbing.cpp */; };
|
||||
@ -2978,6 +2979,7 @@
|
||||
28FEC1B21A12B6FB00FACE48 /* EffectAutomationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EffectAutomationParameters.h; path = ../include/audacity/EffectAutomationParameters.h; sourceTree = SOURCE_ROOT; };
|
||||
5E02BFF01D1164DF00EB7578 /* Distortion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Distortion.cpp; sourceTree = "<group>"; };
|
||||
5E02BFF11D1164DF00EB7578 /* Distortion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Distortion.h; sourceTree = "<group>"; };
|
||||
5E0A0E301D23019A00CD2567 /* MenusMac.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = MenusMac.cpp; sourceTree = "<group>"; };
|
||||
5E4685F81CCA9D84008741F2 /* CommandFunctors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommandFunctors.h; sourceTree = "<group>"; };
|
||||
5E61EE0C1CBAA6BB0009FCF1 /* MemoryX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryX.h; sourceTree = "<group>"; };
|
||||
5E74D2D91CC4427B00D88B0B /* TrackPanelCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelCell.h; sourceTree = "<group>"; };
|
||||
@ -3863,6 +3865,7 @@
|
||||
1865A9B61004490500946EE6 /* LyricsWindow.cpp */,
|
||||
28EBA7FF0A78FAF800C8BB1F /* Matrix.cpp */,
|
||||
1790B0A709883BFD008A330A /* Menus.cpp */,
|
||||
5E0A0E301D23019A00CD2567 /* MenusMac.cpp */,
|
||||
1790B0AB09883BFD008A330A /* Mix.cpp */,
|
||||
289E75081006D0BD00CEF79B /* MixerBoard.cpp */,
|
||||
280A8B4519F4403B0091DE70 /* ModuleManager.cpp */,
|
||||
@ -7438,6 +7441,7 @@
|
||||
283A11AA0A2C0E15004372C4 /* ShuttleGui.cpp in Sources */,
|
||||
283A11AB0A2C0E15004372C4 /* Theme.cpp in Sources */,
|
||||
28456AC20A2C180E00C23C1E /* ThemePrefs.cpp in Sources */,
|
||||
5E0A0E311D23019A00CD2567 /* MenusMac.cpp in Sources */,
|
||||
28F1D81D0A2D0019005506A7 /* AttachableScrollBar.cpp in Sources */,
|
||||
28F1D81E0A2D0019005506A7 /* ExpandingToolBar.cpp in Sources */,
|
||||
28F1D81F0A2D0019005506A7 /* ImageRoll.cpp in Sources */,
|
||||
|
@ -94,8 +94,8 @@ enum CommandFlag : unsigned long long
|
||||
CanStopAudioStreamFlag = 0x40000000,
|
||||
RulerHasFocus
|
||||
= 0x80000000ULL, // prl
|
||||
// nextOneHas33BitsWow
|
||||
// = 0x100000000ULL, // prl
|
||||
NotMinimizedFlag
|
||||
= 0x100000000ULL, // prl
|
||||
|
||||
NoFlagsSpecifed = ~0ULL
|
||||
};
|
||||
|
@ -1021,6 +1021,27 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
c->EndMenu();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// poor imitation of the Mac Windows Menu
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
c->BeginMenu(_("&Window"));
|
||||
c->AddItem(wxT("MacMinimize"), _("&Minimize"), FN(OnMacMinimize),
|
||||
wxT("Ctrl+M"), NotMinimizedFlag, NotMinimizedFlag);
|
||||
c->AddItem(wxT("MacZoom"), _("&Zoom"), FN(OnMacZoom),
|
||||
wxT(""), NotMinimizedFlag, NotMinimizedFlag);
|
||||
#if 0
|
||||
c->AddSeparator();
|
||||
c->AddItem(wxT("MacBringAllToFront"),
|
||||
_("&Bring All to Front"), FN(OnMacBringAllToFront),
|
||||
wxT(""), AlwaysEnabledFlag, AlwaysEnabledFlag);
|
||||
#endif
|
||||
c->EndMenu();
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Help Menu
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -1773,6 +1794,13 @@ CommandFlag AudacityProject::GetUpdateFlags()
|
||||
if (bar->ControlToolBar::CanStopAudioStream())
|
||||
flags |= CanStopAudioStreamFlag;
|
||||
|
||||
if (auto focus = wxWindow::FindFocus()) {
|
||||
while (focus && !focus->IsTopLevel())
|
||||
focus = focus->GetParent();
|
||||
if (focus && !static_cast<wxTopLevelWindow*>(focus)->IsIconized())
|
||||
flags |= NotMinimizedFlag;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -1864,8 +1892,8 @@ void AudacityProject::UpdateMenus(bool checkActive)
|
||||
if (this != GetActiveProject())
|
||||
return;
|
||||
|
||||
if (checkActive && !IsActive())
|
||||
return;
|
||||
//if (checkActive && !IsActive())
|
||||
// return;
|
||||
|
||||
auto flags = GetUpdateFlags();
|
||||
auto flags2 = flags;
|
||||
|
@ -184,6 +184,10 @@ void OnSnapToNearest();
|
||||
void OnSnapToPrior();
|
||||
void OnFullScreen();
|
||||
|
||||
void OnMacMinimize();
|
||||
void OnMacZoom();
|
||||
void OnMacBringAllToFront();
|
||||
|
||||
// File Menu
|
||||
|
||||
void OnNew();
|
||||
|
51
src/MenusMac.cpp
Normal file
51
src/MenusMac.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
//
|
||||
// MenusMac.cpp
|
||||
// Audacity
|
||||
//
|
||||
// Created by Paul Licameli on 6/28/16.
|
||||
//
|
||||
//
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "Project.h"
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <wx/osx/private.h>
|
||||
|
||||
void AudacityProject::OnMacMinimize()
|
||||
{
|
||||
auto window = wxWindow::FindFocus();
|
||||
while (window && ! window->IsTopLevel())
|
||||
window = window->GetParent();
|
||||
if (window) {
|
||||
auto peer = window->GetPeer();
|
||||
peer->GetWXPeer();
|
||||
auto widget = static_cast<wxWidgetCocoaImpl*>(peer)->GetWXWidget();
|
||||
auto nsWindow = [widget window];
|
||||
if (nsWindow) {
|
||||
[nsWindow performMiniaturize:widget];
|
||||
}
|
||||
if (nsWindow) {
|
||||
this->UpdateMenus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnMacZoom()
|
||||
{
|
||||
auto window = wxWindow::FindFocus();
|
||||
while (window && ! window->IsTopLevel())
|
||||
window = window->GetParent();
|
||||
if (window) {
|
||||
auto peer = window->GetPeer();
|
||||
peer->GetWXPeer();
|
||||
auto widget = static_cast<wxWidgetCocoaImpl*>(peer)->GetWXWidget();
|
||||
auto nsWindow = [widget window];
|
||||
if (nsWindow)
|
||||
[nsWindow performZoom:widget];
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnMacBringAllToFront()
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user