1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-06 17:13:49 +01:00

Merge remote-tracking branch 'leio/wx3.0-compat'

Adds back wxWidgets 3.0 support, at the cost of reintroducing a couple
of minor visual bugs.

Reference-to: https://github.com/tenacityteam/tenacity/pull/300
This commit is contained in:
Sol Fisher Romanoff
2021-09-12 17:09:48 +03:00
5 changed files with 47 additions and 9 deletions

View File

@@ -5,8 +5,12 @@
### Linux
Most distributions do not package all of Tenacity's dependencies (yet).
wxWidgets 3.1 is required for building Tenacity but many distributions only
package wxWidgets 3.0. [PortMidi](https://github.com/mixxxdj/portmidi) and
wxWidgets 3.1 is suggested for building Tenacity but many distributions only
package wxWidgets 3.0. When 3.0 is used instead of 3.1, the main user visible
known drawback is that a few user interface texts will not be localized, and
the effects of not having various wxWidgets bug fixes that have not been
backported to the stable 3.0 series.
[PortMidi](https://github.com/mixxxdj/portmidi) and
[PortSMF](https://github.com/tenacityteam/portsmf) are required for MIDI support
but some distributions do not package PortSMF (Tenacity can still build without
MIDI support). [libsbsms](https://github.com/claytonotey/libsbsms) is an
@@ -64,7 +68,7 @@ to the CMake configuration step.
package called `libjack0`, you may need to install `libjack-jack2-dev` instead
of `libjack-dev`.
- wxWidgets 3.1 is required but not packaged in Debian or Ubuntu. Refer
- wxWidgets 3.1 is suggested but not packaged in Debian or Ubuntu. Refer
to the
[wxWidgets documentation](https://docs.wxwidgets.org/3.1/overview_cmake.html)
for how to install it from source code, or see the [previous section](#wxwidgets-from-source). The above package list
@@ -78,6 +82,12 @@ example, if you installed wxWidgets to /home/user/local:
export WX_CONFIG=/home/user/local/bin/wx-config
```
- Alternatively, you may skip installing wxWidgets 3.1 and use 3.0 instead:
```
sudo apt-get install libwxgtk3.0-dev
```
#### Fedora
First, if you want to build Tenacity with FFmpeg support, enable the
@@ -114,7 +124,8 @@ export WX_CONFIG=/home/user/local/bin/wx-config
#### Arch
Install `wxgtk3-dev-light` with your AUR helper of choice, for example:
To use wxWidgets 3.1, install `wxgtk3-dev-light` with your AUR helper of
choice, for example:
```
paru -S wxgtk3-dev-light
@@ -127,6 +138,9 @@ this AUR package:
export WX_CONFIG=/usr/bin/wx-config-gtk3-3.1
```
Alternatively, install `wxgtk3` with pacman to use wxWidgets 3.0, and set
`WX_CONFIG=/usr/bin/wx-config-gtk3`.
Install the rest of the build dependencies from the main Arch repository:
```
@@ -144,7 +158,7 @@ community repository:
sudo apk add cmake samurai lame-dev libsndfile-dev soxr-dev sqlite-dev portaudio-dev portmidi-dev libid3tag-dev soundtouch-dev libmad-dev ffmpeg-dev
```
wxWidgets 3.1 is required but not packaged in Alpine Linux. Refer to the
wxWidgets 3.1 is suggested but not packaged in Alpine Linux. Refer to the
[wxWidgets documentation](https://github.com/wxWidgets/wxWidgets/blob/master/docs/gtk/install.md)
for how to install it from source code, and make sure to set
`--disable-xlocale` in the configuration.
@@ -155,6 +169,9 @@ To install wxWidgets' dependencies:
sudo apk add gtk+3.0-dev zlib-dev libpng-dev tiff-dev libjpeg-turbo-dev expat-dev
```
Alternatively, install `wxgtk3-dev` with apk to use wxWidgets 3.0, and set
`WX_CONFIG=/usr/bin/wx-config-gtk3`.
TODO: add portsmf and libsbsms to this package list when aports are accepted.

View File

@@ -801,11 +801,19 @@ if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows" )
endif()
if( NOT WIN32 )
set( wxWidgets_CONFIG_OPTIONS --version=3.1 )
# wxWidgets 3.1 can be explicitly selected if both 3.0 and 3.1 are installed by setting
# the WX_CONFIG environment variable to path of the wx-config script for 3.1.
find_package(
wxWidgets 3.1
wxWidgets 3.0
COMPONENTS adv base core html qa xml net
)
if(NOT wxWidgets_FOUND)
message(FATAL_ERROR "wxWidgets NOT found. "
"Install wxWidgets and its development headers and try again. "
"If wxWidgets is installed, set the WX_CONFIG environment variable to the path of the wx-config script.")
endif()
include( ${wxWidgets_USE_FILE} )
# The FindwxWidgets.cmake module does not create an IMPORT target, so hack one together. This makes it easy to add the compile definitions
# to the lib-strings and lib-strings-utils targets.

View File

@@ -97,7 +97,12 @@ wxString TranslatableString::DoSubstitute( const Formatter &formatter,
return formatter
? formatter( format, debug ? Request::DebugFormat : Request::Format )
: // come here for most translatable strings, which have no formatting
( debug ? format : wxGetTranslation( format, wxString{}, context ) );
( debug ? format : wxGetTranslation(
format
#if HAS_I18N_CONTEXTS
, wxString{}, context
#endif
) );
}
wxString TranslatableString::DoChooseFormat(

View File

@@ -1049,7 +1049,9 @@ bool AudacityApp::OnInit() {
wxFileSystem::AddHandler(safenew wxZipFSHandler);
// encouraged by wxwidgets
#if wxCHECK_VERSION(3, 1, 1)
wxStandardPaths::Get().SetFileLayout(wxStandardPaths::FileLayout::FileLayout_XDG);
#endif
//
// Paths: set search path and temp dir path

View File

@@ -47,6 +47,10 @@ used throughout Audacity into this one place.
#include <windows.h>
#endif
#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 1, 1)
#include <glib.h>
#endif
static wxString gConfigDir;
static wxString gDataDir;
@@ -244,8 +248,10 @@ FilePath FileNames::ConfigDir()
gConfigDir = portablePrefsPath.GetFullPath();
} else {
// Use OS-provided user data dir folder
#if defined(__WSMSW__)
#if defined(__WXMSW__)
wxString configDir(wxStandardPaths::Get().GetUserConfigDir() + wxT("\\Tenacity"));
#elif defined(__WXGTK__) && !wxCHECK_VERSION(3, 1, 1)
wxString configDir = wxString::Format(wxT("%s/tenacity"), g_get_user_config_dir());
#else
wxString configDir(wxStandardPaths::Get().GetUserConfigDir() + wxT("/tenacity"));
#endif