From 9c628f1cdfd180a760528e4677dcfb37e19b9e64 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 20 May 2018 09:54:01 +0200 Subject: [PATCH 1/7] Switch to the vs 2017 toolkit --- build/aegisub.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/aegisub.props b/build/aegisub.props index 0acc3d501..3ce0962fa 100644 --- a/build/aegisub.props +++ b/build/aegisub.props @@ -34,7 +34,7 @@ true Unicode MultiByte - v140_xp + v141_xp From 5cfa896f98a8f7349dfd1871c7dc066eedb33f72 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 20 May 2018 09:54:30 +0200 Subject: [PATCH 2/7] Drop Windows XP support --- build/aegisub.props | 2 +- libaegisub/windows/fs.cpp | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/build/aegisub.props b/build/aegisub.props index 3ce0962fa..aa07badea 100644 --- a/build/aegisub.props +++ b/build/aegisub.props @@ -34,7 +34,7 @@ true Unicode MultiByte - v141_xp + v141 diff --git a/libaegisub/windows/fs.cpp b/libaegisub/windows/fs.cpp index 5c2a2385f..8102c6ee3 100644 --- a/libaegisub/windows/fs.cpp +++ b/libaegisub/windows/fs.cpp @@ -33,19 +33,6 @@ namespace bfs = boost::filesystem; #undef CreateDirectory -namespace { - FINDEX_INFO_LEVELS find_info_level() { - OSVERSIONINFO osvi = {}; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osvi); - - if (osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1)) - return FindExInfoBasic; - else - return FindExInfoStandard; - } -} - namespace agi { namespace fs { std::string ShortName(path const& p) { std::wstring out(MAX_PATH + 1, 0); @@ -98,7 +85,7 @@ DirectoryIterator::DirectoryIterator(path const& p, std::string const& filter) : privdata(new PrivData) { WIN32_FIND_DATA data; - privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), find_info_level(), &data, FindExSearchNameMatch, nullptr, 0); + privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), FindExInfoBasic, &data, FindExSearchNameMatch, nullptr, 0); if (privdata->h == INVALID_HANDLE_VALUE) { privdata.reset(); return; From bbd5a0aadb9bf1efdc065a43ef964414f2fb966d Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 22 May 2018 20:37:55 +0200 Subject: [PATCH 3/7] Fix a typo in install.targets --- build/install.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/install.targets b/build/install.targets index b43e8f7cd..818536fbb 100644 --- a/build/install.targets +++ b/build/install.targets @@ -10,7 +10,7 @@ Date: Wed, 23 May 2018 08:21:04 +0200 Subject: [PATCH 4/7] Use absolute paths for the default dependencies paths --- build/DefaultConfiguration.props | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/build/DefaultConfiguration.props b/build/DefaultConfiguration.props index 785021381..504b2637e 100644 --- a/build/DefaultConfiguration.props +++ b/build/DefaultConfiguration.props @@ -49,16 +49,17 @@ updates.aegisub.org /trunk - ..\..\vendor\boost - ..\..\vendor\ffms2 - ..\..\vendor\ffmpeg - ..\..\vendor\fftw - ..\..\vendor\freetype2 - ..\..\vendor\fribidi - ..\..\vendor\googletest - ..\..\vendor\icu\source - ..\..\vendor\libass - ..\..\vendor\wxWidgets - ..\..\vendor\wxWidgets\src\zlib + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\vendor)) + $(VendorRoot)\boost + $(VendorRoot)\ffms2 + $(VendorRoot)\ffmpeg + $(VendorRoot)\fftw + $(VendorRoot)\freetype2 + $(VendorRoot)\fribidi + $(VendorRoot)\googletest + $(VendorRoot)\icu\source + $(VendorRoot)\libass + $(VendorRoot)\wxWidgets + $(VendorRoot)\wxWidgets\src\zlib From 4fdc5efb69f530d2e7319544fa8b2eab1bde37c9 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 25 May 2018 08:26:26 +0200 Subject: [PATCH 5/7] Explicitly declare DataBlockCache as moveable to make vs17 happy --- src/audio_renderer.cpp | 12 ++++++------ src/audio_renderer.h | 2 +- src/audio_renderer_spectrum.cpp | 2 +- src/block_cache.h | 8 +++++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/audio_renderer.cpp b/src/audio_renderer.cpp index d2286dd68..e90586b02 100644 --- a/src/audio_renderer.cpp +++ b/src/audio_renderer.cpp @@ -67,6 +67,7 @@ size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const AudioRenderer::AudioRenderer() { + bitmaps.reserve(AudioStyle_MAX); for (int i = 0; i < AudioStyle_MAX; ++i) bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this)); @@ -157,21 +158,20 @@ size_t AudioRenderer::NumBlocks(const int64_t samples) const return static_cast(duration / pixel_ms / cache_bitmap_width); } -const wxBitmap *AudioRenderer::GetCachedBitmap(const int i, const AudioRenderingStyle style) +wxBitmap const& AudioRenderer::GetCachedBitmap(const int i, const AudioRenderingStyle style) { assert(provider); assert(renderer); bool created = false; - wxBitmap *bmp = bitmaps[style].Get(i, &created); - assert(bmp); + auto& bmp = bitmaps[style].Get(i, &created); if (created) { - renderer->Render(*bmp, i*cache_bitmap_width, style); + renderer->Render(bmp, i*cache_bitmap_width, style); needs_age = true; } - assert(bmp->IsOk()); + assert(bmp.IsOk()); return bmp; } @@ -201,7 +201,7 @@ void AudioRenderer::Render(wxDC &dc, wxPoint origin, const int start, const int for (int i = firstbitmap; i <= lastbitmap; ++i) { - dc.DrawBitmap(*GetCachedBitmap(i, style), origin); + dc.DrawBitmap(GetCachedBitmap(i, style), origin); origin.x += cache_bitmap_width; } diff --git a/src/audio_renderer.h b/src/audio_renderer.h index 7bfeb2428..1d88be3cb 100644 --- a/src/audio_renderer.h +++ b/src/audio_renderer.h @@ -111,7 +111,7 @@ class AudioRenderer { /// /// Will attempt retrieving the requested bitmap from the cache, creating it /// if the cache doesn't have it. - const wxBitmap *GetCachedBitmap(int i, AudioRenderingStyle style); + wxBitmap const& GetCachedBitmap(int i, AudioRenderingStyle style); /// @brief Update the block count in the bitmap caches /// diff --git a/src/audio_renderer_spectrum.cpp b/src/audio_renderer_spectrum.cpp index 9d79feaa8..7884f1006 100644 --- a/src/audio_renderer_spectrum.cpp +++ b/src/audio_renderer_spectrum.cpp @@ -240,7 +240,7 @@ void AudioSpectrumRenderer::Render(wxBitmap &bmp, int start, AudioRenderingStyle { // Derived audio data size_t block_index = (size_t)(ax * pixel_ms * provider->GetSampleRate() / 1000) >> derivation_dist; - float *power = cache->Get(block_index); + float *power = &cache->Get(block_index); // Prepare bitmap writing unsigned char *px = imgdata + (imgheight-1) * stride + (ax - start) * 3; diff --git a/src/block_cache.h b/src/block_cache.h index 35ad0eedd..9fcaf42e7 100644 --- a/src/block_cache.h +++ b/src/block_cache.h @@ -109,6 +109,8 @@ public: SetBlockCount(block_count); } + DataBlockCache(DataBlockCache&&) = default; + DataBlockCache& operator=(DataBlockCache&&) = default; /// @brief Change the number of blocks in cache /// @param block_count New number of blocks to hold @@ -158,12 +160,12 @@ public: /// @return A pointer to the block in cache /// /// It is legal to pass 0 (null) for created, in this case nothing is returned in it. - BlockT *Get(size_t i, bool *created = nullptr) + BlockT& Get(size_t i, bool *created = nullptr) { size_t mbi = i >> MacroblockExponent; assert(mbi < data.size()); - MacroBlock &mb = data[mbi]; + auto &mb = data[mbi]; // Move this macroblock to the front of the age list if (mb.blocks.empty()) @@ -193,6 +195,6 @@ public: else if (created) *created = false; - return b; + return *b; } }; From a32bf7acdcc4de63a7b20df7d2f5f57d24ae0104 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 25 May 2018 19:40:25 +0200 Subject: [PATCH 6/7] Set ffmpeg's yasm include paths correctly --- build/ffmpeg/ffmpeg.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ffmpeg/ffmpeg.vcxproj b/build/ffmpeg/ffmpeg.vcxproj index fcdb21772..8f9959679 100644 --- a/build/ffmpeg/ffmpeg.vcxproj +++ b/build/ffmpeg/ffmpeg.vcxproj @@ -54,7 +54,7 @@ $(FfmpegSrcDir)\ - %(Include) -I$(MSBuildThisFileDirectory) -I$(MSBuildThisFileDirectory)$(FfmpegSrcDir) + %(Include) -I$(MSBuildThisFileDirectory) -I$(FfmpegSrcDir) %(Config) -DPREFIX -Pconfig-x86.asm %(Config) -Pconfig-x64.asm From a4bde47c5cbf33003148db12cd1d94d86cc72a39 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 28 May 2018 21:24:23 +0200 Subject: [PATCH 7/7] Fix MRU menus (#48) Broken in 9bbfdddde046c151b4ebaa06de10b2d51216cbec. I don't understand why the author made such a change, so I left their solution with #ifdef guard. --- src/menu.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/menu.cpp b/src/menu.cpp index 13e054baa..99edbcf7d 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -419,7 +419,7 @@ class AutomationMenu final : public wxMenu { WorkItem *FindOrMakeSubitem(std::string const &name) { auto sub = std::find_if(subitems.begin(), subitems.end(), [&](WorkItem const &item) { return item.displayname == name; }); if (sub != subitems.end()) return &*sub; - + subitems.emplace_back(name); return &subitems.back(); } @@ -529,8 +529,13 @@ namespace menu { } } +#ifdef __WXMAC__ menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm); +#else + window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); + window->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm); +#endif #ifdef __WXMAC__ bind_events(menu.get());