mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-31 14:13:50 +01:00 
			
		
		
		
	Avoid Objective-C
This commit is contained in:
		| @@ -2979,7 +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>"; }; | ||||
| 		5E0A0E301D23019A00CD2567 /* MenusMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 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>"; }; | ||||
|   | ||||
| @@ -9,15 +9,19 @@ | ||||
| #include "Audacity.h" | ||||
| #include "Project.h" | ||||
|  | ||||
| #undef USE_COCOA | ||||
|  | ||||
| #ifdef USE_COCOA | ||||
| #include <AppKit/AppKit.h> | ||||
| #include <wx/osx/private.h> | ||||
| #endif | ||||
|  | ||||
| void AudacityProject::OnMacMinimize() | ||||
| { | ||||
|    auto window = wxWindow::FindFocus(); | ||||
|    while (window && ! window->IsTopLevel()) | ||||
|       window = window->GetParent(); | ||||
|    auto window = this; | ||||
|    if (window) { | ||||
| #ifdef USE_COCOA | ||||
|       // Adapted from mbarman.mm in wxWidgets 3.0.2 | ||||
|       auto peer = window->GetPeer(); | ||||
|       peer->GetWXPeer(); | ||||
|       auto widget = static_cast<wxWidgetCocoaImpl*>(peer)->GetWXWidget(); | ||||
| @@ -25,24 +29,32 @@ void AudacityProject::OnMacMinimize() | ||||
|       if (nsWindow) { | ||||
|          [nsWindow performMiniaturize:widget]; | ||||
|       } | ||||
|       if (nsWindow) { | ||||
|          this->UpdateMenus(); | ||||
|       } | ||||
| #else | ||||
|       window->Iconize(true); | ||||
| #endif | ||||
|  | ||||
|       // So that the Minimize menu command disables | ||||
|       window->UpdateMenus(); | ||||
|    } | ||||
| } | ||||
|  | ||||
| void AudacityProject::OnMacZoom() | ||||
| { | ||||
|    auto window = wxWindow::FindFocus(); | ||||
|    while (window && ! window->IsTopLevel()) | ||||
|       window = window->GetParent(); | ||||
|    auto window = this; | ||||
|    auto topWindow = static_cast<wxTopLevelWindow*>(window); | ||||
|    auto maximized = topWindow->IsMaximized(); | ||||
|    if (window) { | ||||
| #ifdef USE_COCOA | ||||
|       // Adapted from mbarman.mm in wxWidgets 3.0.2 | ||||
|       auto peer = window->GetPeer(); | ||||
|       peer->GetWXPeer(); | ||||
|       auto widget = static_cast<wxWidgetCocoaImpl*>(peer)->GetWXWidget(); | ||||
|       auto nsWindow = [widget window]; | ||||
|       if (nsWindow) | ||||
|          [nsWindow performZoom:widget]; | ||||
| #else | ||||
|       topWindow->Maximize(!maximized); | ||||
| #endif | ||||
|    } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user