Move make_unique to its own header file

Rebuilding the entire project after touching util.h gets old fast.
This commit is contained in:
Thomas Goyne 2014-04-23 13:53:24 -07:00
parent c248dc56da
commit 6fc4c8da14
101 changed files with 506 additions and 474 deletions

View File

@ -65,6 +65,7 @@
<ClInclude Include="$(SrcDir)include\libaegisub\line_iterator.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\line_iterator.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\line_wrap.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\line_wrap.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\log.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\log.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\make_unique.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\mru.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\mru.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\of_type_adaptor.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\of_type_adaptor.h" />
<ClInclude Include="$(SrcDir)include\libaegisub\option.h" /> <ClInclude Include="$(SrcDir)include\libaegisub\option.h" />

View File

@ -170,6 +170,9 @@
<ClInclude Include="$(SrcDir)include\libaegisub\character_count.h"> <ClInclude Include="$(SrcDir)include\libaegisub\character_count.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SrcDir)include\libaegisub\make_unique.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(SrcDir)windows\lagi_pre.cpp"> <ClCompile Include="$(SrcDir)windows\lagi_pre.cpp">

View File

@ -17,6 +17,7 @@
#include "libaegisub/file_mapping.h" #include "libaegisub/file_mapping.h"
#include "libaegisub/fs.h" #include "libaegisub/fs.h"
#include "libaegisub/make_unique.h"
#include "libaegisub/util.h" #include "libaegisub/util.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -58,7 +59,7 @@ char *map(int64_t s_offset, uint64_t length, boost::interprocess::mode_t mode,
throw std::bad_alloc(); throw std::bad_alloc();
try { try {
region = agi::util::make_unique<mapped_region>(file, mode, mapping_start, static_cast<size_t>(length)); region = agi::make_unique<mapped_region>(file, mode, mapping_start, static_cast<size_t>(length));
} }
catch (interprocess_exception const&) { catch (interprocess_exception const&) {
throw agi::fs::FileSystemUnknownError("Failed mapping a view of the file"); throw agi::fs::FileSystemUnknownError("Failed mapping a view of the file");

View File

@ -21,6 +21,7 @@
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include "libaegisub/fs.h" #include "libaegisub/fs.h"
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/make_unique.h"
#include "libaegisub/path.h" #include "libaegisub/path.h"
#include "libaegisub/util.h" #include "libaegisub/util.h"
@ -34,7 +35,7 @@ std::unique_ptr<std::istream> Open(fs::path const& file, bool binary) {
LOG_D("agi/io/open/file") << file; LOG_D("agi/io/open/file") << file;
acs::CheckFileRead(file); acs::CheckFileRead(file);
auto stream = util::make_unique<boost::filesystem::ifstream>(file, (binary ? std::ios::binary : std::ios::in)); auto stream = agi::make_unique<boost::filesystem::ifstream>(file, (binary ? std::ios::binary : std::ios::in));
if (stream->fail()) if (stream->fail())
throw IOFatal("Unknown fatal error as occurred"); throw IOFatal("Unknown fatal error as occurred");
@ -56,7 +57,7 @@ Save::Save(fs::path const& file, bool binary)
// Not an error // Not an error
} }
fp = util::make_unique<boost::filesystem::ofstream>(tmp_name, binary ? std::ios::binary : std::ios::out); fp = agi::make_unique<boost::filesystem::ofstream>(tmp_name, binary ? std::ios::binary : std::ios::out);
if (!fp->good()) if (!fp->good())
throw fs::WriteDenied(tmp_name); throw fs::WriteDenied(tmp_name);
} }

View File

@ -21,7 +21,7 @@
#include "libaegisub/fs.h" #include "libaegisub/fs.h"
#include "libaegisub/io.h" #include "libaegisub/io.h"
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>

View File

@ -25,7 +25,7 @@
#include <libaegisub/color.h> #include <libaegisub/color.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/option_value.h> #include <libaegisub/option_value.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -75,7 +75,7 @@ std::unique_ptr<OptionValue> ConfigVisitor::ReadArray(json::Array const& src, st
arr.push_back((typename OptionValueType::value_type::value_type)(obj.begin()->second)); arr.push_back((typename OptionValueType::value_type::value_type)(obj.begin()->second));
} }
return util::make_unique<OptionValueType>(name, std::move(arr)); return agi::make_unique<OptionValueType>(name, std::move(arr));
} }
void ConfigVisitor::Visit(const json::Array& array) { void ConfigVisitor::Visit(const json::Array& array) {
@ -107,11 +107,11 @@ void ConfigVisitor::Visit(const json::Array& array) {
} }
void ConfigVisitor::Visit(const json::Integer& number) { void ConfigVisitor::Visit(const json::Integer& number) {
AddOptionValue(util::make_unique<OptionValueInt>(name, number)); AddOptionValue(agi::make_unique<OptionValueInt>(name, number));
} }
void ConfigVisitor::Visit(const json::Double& number) { void ConfigVisitor::Visit(const json::Double& number) {
AddOptionValue(util::make_unique<OptionValueDouble>(name, number)); AddOptionValue(agi::make_unique<OptionValueDouble>(name, number));
} }
void ConfigVisitor::Visit(const json::String& string) { void ConfigVisitor::Visit(const json::String& string) {
@ -121,14 +121,14 @@ void ConfigVisitor::Visit(const json::String& string) {
(size >= 10 && boost::starts_with(string, "rgb(")) || (size >= 10 && boost::starts_with(string, "rgb(")) ||
((size == 9 || size == 10) && boost::starts_with(string, "&H"))) ((size == 9 || size == 10) && boost::starts_with(string, "&H")))
{ {
AddOptionValue(util::make_unique<OptionValueColor>(name, string)); AddOptionValue(agi::make_unique<OptionValueColor>(name, string));
} else { } else {
AddOptionValue(util::make_unique<OptionValueString>(name, string)); AddOptionValue(agi::make_unique<OptionValueString>(name, string));
} }
} }
void ConfigVisitor::Visit(const json::Boolean& boolean) { void ConfigVisitor::Visit(const json::Boolean& boolean) {
AddOptionValue(util::make_unique<OptionValueBool>(name, boolean)); AddOptionValue(agi::make_unique<OptionValueBool>(name, boolean));
} }
void ConfigVisitor::Visit(const json::Null& null) { void ConfigVisitor::Visit(const json::Null& null) {

View File

@ -21,7 +21,7 @@
#include "libaegisub/path.h" #include "libaegisub/path.h"
#include "libaegisub/fs.h" #include "libaegisub/fs.h"
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>

View File

@ -21,7 +21,7 @@
#include "libaegisub/charset_conv.h" #include "libaegisub/charset_conv.h"
#include "libaegisub/file_mapping.h" #include "libaegisub/file_mapping.h"
#include "libaegisub/line_iterator.h" #include "libaegisub/line_iterator.h"
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>
@ -33,7 +33,7 @@ using boost::phoenix::placeholders::_1;
namespace agi { namespace agi {
Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_path) Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_path)
: dat(util::make_unique<read_file_mapping>(dat_path)) : dat(make_unique<read_file_mapping>(dat_path))
{ {
read_file_mapping idx_file(idx_path); read_file_mapping idx_file(idx_path);
boost::interprocess::ibufferstream idx(idx_file.read(), static_cast<size_t>(idx_file.size())); boost::interprocess::ibufferstream idx(idx_file.read(), static_cast<size_t>(idx_file.size()));

View File

@ -0,0 +1,24 @@
// Copyright (c) 2014, Thomas Goyne <plorkyeran@aegisub.org>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Aegisub Project http://www.aegisub.org/
#include <memory>
namespace agi {
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
}

View File

@ -57,11 +57,6 @@ namespace agi {
/// @param name New name for the thread /// @param name New name for the thread
void SetThreadName(const char *name); void SetThreadName(const char *name);
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
/// A thin wrapper around this_thread::sleep_for that uses std::thread on /// A thin wrapper around this_thread::sleep_for that uses std::thread on
/// Windows (to avoid having to compile boost.thread) and boost::thread /// Windows (to avoid having to compile boost.thread) and boost::thread
/// elsewhere (because libstcc++ 4.7 is missing it). /// elsewhere (because libstcc++ 4.7 is missing it).

View File

@ -23,7 +23,7 @@
#include <unistd.h> #include <unistd.h>
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
namespace agi { namespace agi {
namespace log { namespace log {

View File

@ -16,7 +16,7 @@
/// @brief Unix utility methods. /// @brief Unix utility methods.
/// @ingroup libaegisub unix /// @ingroup libaegisub unix
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
#include <boost/thread.hpp> #include <boost/thread.hpp>

View File

@ -23,7 +23,7 @@
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/charset_conv_win.h" #include "libaegisub/charset_conv_win.h"
#include "libaegisub/util.h" #include "libaegisub/make_unique.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -20,7 +20,7 @@
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>

View File

@ -37,7 +37,7 @@
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <libaegisub/split.h> #include <libaegisub/split.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
@ -171,7 +171,7 @@ std::vector<std::unique_ptr<AssDialogueBlock>> AssDialogue::ParseTags() const {
// Empty line, make an empty block // Empty line, make an empty block
if (Text.get().empty()) { if (Text.get().empty()) {
Blocks.push_back(agi::util::make_unique<AssDialogueBlockPlain>()); Blocks.push_back(agi::make_unique<AssDialogueBlockPlain>());
return Blocks; return Blocks;
} }
@ -196,11 +196,11 @@ std::vector<std::unique_ptr<AssDialogueBlock>> AssDialogue::ParseTags() const {
if (work.size() && work.find('\\') == std::string::npos) { if (work.size() && work.find('\\') == std::string::npos) {
//We've found an override block with no backslashes //We've found an override block with no backslashes
//We're going to assume it's a comment and not consider it an override block //We're going to assume it's a comment and not consider it an override block
Blocks.push_back(agi::util::make_unique<AssDialogueBlockComment>(work)); Blocks.push_back(agi::make_unique<AssDialogueBlockComment>(work));
} }
else { else {
// Create block // Create block
auto block = agi::util::make_unique<AssDialogueBlockOverride>(work); auto block = agi::make_unique<AssDialogueBlockOverride>(work);
block->ParseTags(); block->ParseTags();
// Look for \p in block // Look for \p in block
@ -228,9 +228,9 @@ plain:
} }
if (drawingLevel == 0) if (drawingLevel == 0)
Blocks.push_back(agi::util::make_unique<AssDialogueBlockPlain>(work)); Blocks.push_back(agi::make_unique<AssDialogueBlockPlain>(work));
else else
Blocks.push_back(agi::util::make_unique<AssDialogueBlockDrawing>(work, drawingLevel)); Blocks.push_back(agi::make_unique<AssDialogueBlockDrawing>(work, drawingLevel));
} }
return Blocks; return Blocks;

View File

@ -38,7 +38,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/color.h> #include <libaegisub/color.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -114,7 +114,7 @@ template<> agi::Color AssOverrideParameter::Get<agi::Color>() const {
template<> AssDialogueBlockOverride *AssOverrideParameter::Get<AssDialogueBlockOverride*>() const { template<> AssDialogueBlockOverride *AssOverrideParameter::Get<AssDialogueBlockOverride*>() const {
if (!block.get()) { if (!block.get()) {
block = agi::util::make_unique<AssDialogueBlockOverride>(Get<std::string>()); block = agi::make_unique<AssDialogueBlockOverride>(Get<std::string>());
block->ParseTags(); block->ParseTags();
} }
return block.get(); return block.get();

View File

@ -21,7 +21,7 @@
#include "ass_style.h" #include "ass_style.h"
#include "subtitle_format.h" #include "subtitle_format.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@ -105,12 +105,12 @@ void AssParser::ParseStyleLine(std::string const& data) {
void AssParser::ParseFontLine(std::string const& data) { void AssParser::ParseFontLine(std::string const& data) {
if (boost::starts_with(data, "fontname: ")) if (boost::starts_with(data, "fontname: "))
attach = agi::util::make_unique<AssAttachment>(data, AssEntryGroup::FONT); attach = agi::make_unique<AssAttachment>(data, AssEntryGroup::FONT);
} }
void AssParser::ParseGraphicsLine(std::string const& data) { void AssParser::ParseGraphicsLine(std::string const& data) {
if (boost::starts_with(data, "filename: ")) if (boost::starts_with(data, "filename: "))
attach = agi::util::make_unique<AssAttachment>(data, AssEntryGroup::GRAPHIC); attach = agi::make_unique<AssAttachment>(data, AssEntryGroup::GRAPHIC);
} }
void AssParser::AddLine(std::string const& data) { void AssParser::AddLine(std::string const& data) {

View File

@ -39,7 +39,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/line_iterator.h> #include <libaegisub/line_iterator.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -67,7 +67,7 @@ void AssStyleStorage::Load(agi::fs::path const& filename) {
auto in = agi::io::Open(file); auto in = agi::io::Open(file);
for (auto const& line : agi::line_iterator<std::string>(*in)) { for (auto const& line : agi::line_iterator<std::string>(*in)) {
try { try {
style.emplace_back(agi::util::make_unique<AssStyle>(line)); style.emplace_back(agi::make_unique<AssStyle>(line));
} catch(...) { } catch(...) {
/* just ignore invalid lines for now */ /* just ignore invalid lines for now */
} }

View File

@ -52,7 +52,7 @@
#include "utils.h" #include "utils.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -551,10 +551,10 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C
: wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxBORDER_SIMPLE) : wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxBORDER_SIMPLE)
, audio_open_connection(controller->AddAudioOpenListener(&AudioDisplay::OnAudioOpen, this)) , audio_open_connection(controller->AddAudioOpenListener(&AudioDisplay::OnAudioOpen, this))
, context(context) , context(context)
, audio_renderer(agi::util::make_unique<AudioRenderer>()) , audio_renderer(agi::make_unique<AudioRenderer>())
, controller(controller) , controller(controller)
, scrollbar(agi::util::make_unique<AudioDisplayScrollbar>(this)) , scrollbar(agi::make_unique<AudioDisplayScrollbar>(this))
, timeline(agi::util::make_unique<AudioDisplayTimeline>(this)) , timeline(agi::make_unique<AudioDisplayTimeline>(this))
{ {
style_ranges[0] = AudioStyle_Normal; style_ranges[0] = AudioStyle_Normal;
@ -722,7 +722,7 @@ void AudioDisplay::ReloadRenderingSettings()
if (OPT_GET("Audio/Spectrum")->GetBool()) if (OPT_GET("Audio/Spectrum")->GetBool())
{ {
colour_scheme_name = OPT_GET("Colour/Audio Display/Spectrum")->GetString(); colour_scheme_name = OPT_GET("Colour/Audio Display/Spectrum")->GetString();
auto audio_spectrum_renderer = agi::util::make_unique<AudioSpectrumRenderer>(colour_scheme_name); auto audio_spectrum_renderer = agi::make_unique<AudioSpectrumRenderer>(colour_scheme_name);
int64_t spectrum_quality = OPT_GET("Audio/Renderer/Spectrum/Quality")->GetInt(); int64_t spectrum_quality = OPT_GET("Audio/Renderer/Spectrum/Quality")->GetInt();
#ifdef WITH_FFTW3 #ifdef WITH_FFTW3
@ -744,7 +744,7 @@ void AudioDisplay::ReloadRenderingSettings()
else else
{ {
colour_scheme_name = OPT_GET("Colour/Audio Display/Waveform")->GetString(); colour_scheme_name = OPT_GET("Colour/Audio Display/Waveform")->GetString();
audio_renderer_provider = agi::util::make_unique<AudioWaveformRenderer>(colour_scheme_name); audio_renderer_provider = agi::make_unique<AudioWaveformRenderer>(colour_scheme_name);
} }
audio_renderer->SetRenderer(audio_renderer_provider.get()); audio_renderer->SetRenderer(audio_renderer_provider.get());
@ -1087,7 +1087,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
if (markers.size()) if (markers.size())
{ {
RemoveTrackCursor(); RemoveTrackCursor();
audio_marker = agi::util::make_unique<AudioMarkerInteractionObject>(markers, timing, this, (wxMouseButton)event.GetButton()); audio_marker = agi::make_unique<AudioMarkerInteractionObject>(markers, timing, this, (wxMouseButton)event.GetButton());
SetDraggedObject(audio_marker.get()); SetDraggedObject(audio_marker.get());
return; return;
} }

View File

@ -35,7 +35,7 @@
#include "selection_controller.h" #include "selection_controller.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/locale/boundary.hpp> #include <boost/locale/boundary.hpp>
@ -66,7 +66,7 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c)
, audio_opened(c->audioController->AddAudioOpenListener(&AudioKaraoke::OnAudioOpened, this)) , audio_opened(c->audioController->AddAudioOpenListener(&AudioKaraoke::OnAudioOpened, this))
, audio_closed(c->audioController->AddAudioCloseListener(&AudioKaraoke::OnAudioClosed, this)) , audio_closed(c->audioController->AddAudioCloseListener(&AudioKaraoke::OnAudioClosed, this))
, active_line_changed(c->selectionController->AddActiveLineListener(&AudioKaraoke::OnActiveLineChanged, this)) , active_line_changed(c->selectionController->AddActiveLineListener(&AudioKaraoke::OnActiveLineChanged, this))
, kara(agi::util::make_unique<AssKaraoke>()) , kara(agi::make_unique<AssKaraoke>())
{ {
using std::bind; using std::bind;

View File

@ -26,7 +26,7 @@
#include "pen.h" #include "pen.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -48,7 +48,7 @@ AudioMarkerProviderKeyframes::AudioMarkerProviderKeyframes(agi::Context *c, cons
, timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this)) , timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this))
, enabled_slot(OPT_SUB(opt_name, &AudioMarkerProviderKeyframes::Update, this)) , enabled_slot(OPT_SUB(opt_name, &AudioMarkerProviderKeyframes::Update, this))
, enabled_opt(OPT_GET(opt_name)) , enabled_opt(OPT_GET(opt_name))
, style(agi::util::make_unique<Pen>("Colour/Audio Display/Keyframe")) , style(agi::make_unique<Pen>("Colour/Audio Display/Keyframe"))
{ {
Update(); Update();
} }
@ -122,7 +122,7 @@ void VideoPositionMarkerProvider::Update(int frame_number) {
void VideoPositionMarkerProvider::OptChanged(agi::OptionValue const& opt) { void VideoPositionMarkerProvider::OptChanged(agi::OptionValue const& opt) {
if (opt.GetBool()) { if (opt.GetBool()) {
video_seek_slot.Unblock(); video_seek_slot.Unblock();
marker = agi::util::make_unique<VideoPositionMarker>(); marker = agi::make_unique<VideoPositionMarker>();
marker->SetPosition(vc->GetFrameN()); marker->SetPosition(vc->GetFrameN());
} }
else { else {
@ -137,7 +137,7 @@ void VideoPositionMarkerProvider::GetMarkers(const TimeRange &range, AudioMarker
} }
SecondsMarkerProvider::SecondsMarkerProvider() SecondsMarkerProvider::SecondsMarkerProvider()
: pen(agi::util::make_unique<Pen>("Colour/Audio Display/Seconds Line", 1, wxPENSTYLE_DOT)) : pen(agi::make_unique<Pen>("Colour/Audio Display/Seconds Line", 1, wxPENSTYLE_DOT))
, enabled(OPT_GET("Audio/Display/Draw/Seconds")) , enabled(OPT_GET("Audio/Display/Draw/Seconds"))
, enabled_opt_changed(OPT_SUB("Audio/Display/Draw/Seconds", &SecondsMarkerProvider::EnabledOptChanged, this)) , enabled_opt_changed(OPT_SUB("Audio/Display/Draw/Seconds", &SecondsMarkerProvider::EnabledOptChanged, this))
{ {

View File

@ -42,7 +42,7 @@
#include "options.h" #include "options.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
@ -461,7 +461,7 @@ void AlsaPlayer::SetVolume(double vol)
std::unique_ptr<AudioPlayer> CreateAlsaPlayer(AudioProvider *provider, wxWindow *) std::unique_ptr<AudioPlayer> CreateAlsaPlayer(AudioProvider *provider, wxWindow *)
{ {
return agi::util::make_unique<AlsaPlayer>(provider); return agi::make_unique<AlsaPlayer>(provider);
} }
#endif // WITH_ALSA #endif // WITH_ALSA

View File

@ -41,7 +41,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <dsound.h> #include <dsound.h>
@ -368,7 +368,7 @@ void DirectSoundPlayerThread::Stop() {
} }
std::unique_ptr<AudioPlayer> CreateDirectSoundPlayer(AudioProvider *provider, wxWindow *parent) { std::unique_ptr<AudioPlayer> CreateDirectSoundPlayer(AudioProvider *provider, wxWindow *parent) {
return agi::util::make_unique<DirectSoundPlayer>(provider, parent); return agi::make_unique<DirectSoundPlayer>(provider, parent);
} }
#endif // WITH_DIRECTSOUND #endif // WITH_DIRECTSOUND

View File

@ -43,7 +43,7 @@
#include <libaegisub/scoped_ptr.h> #include <libaegisub/scoped_ptr.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <process.h> #include <process.h>
@ -821,7 +821,7 @@ DirectSoundPlayer2::DirectSoundPlayer2(AudioProvider *provider, wxWindow *parent
try try
{ {
thread = agi::util::make_unique<DirectSoundPlayer2Thread>(provider, WantedLatency, BufferLength, parent); thread = agi::make_unique<DirectSoundPlayer2Thread>(provider, WantedLatency, BufferLength, parent);
} }
catch (const char *msg) catch (const char *msg)
{ {
@ -936,7 +936,7 @@ void DirectSoundPlayer2::SetVolume(double vol)
} }
std::unique_ptr<AudioPlayer> CreateDirectSound2Player(AudioProvider *provider, wxWindow *parent) { std::unique_ptr<AudioPlayer> CreateDirectSound2Player(AudioProvider *provider, wxWindow *parent) {
return agi::util::make_unique<DirectSoundPlayer2>(provider, parent); return agi::make_unique<DirectSoundPlayer2>(provider, parent);
} }
#endif // WITH_DIRECTSOUND #endif // WITH_DIRECTSOUND

View File

@ -40,7 +40,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#include <al.h> #include <al.h>
@ -286,7 +286,7 @@ int64_t OpenALPlayer::GetCurrentPosition()
std::unique_ptr<AudioPlayer> CreateOpenALPlayer(AudioProvider *provider, wxWindow *) std::unique_ptr<AudioPlayer> CreateOpenALPlayer(AudioProvider *provider, wxWindow *)
{ {
return agi::util::make_unique<OpenALPlayer>(provider); return agi::make_unique<OpenALPlayer>(provider);
} }
#endif // WITH_OPENAL #endif // WITH_OPENAL

View File

@ -40,7 +40,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -281,7 +281,7 @@ int64_t OSSPlayer::GetCurrentPosition()
} }
std::unique_ptr<AudioPlayer> CreateOSSPlayer(AudioProvider *provider, wxWindow *) { std::unique_ptr<AudioPlayer> CreateOSSPlayer(AudioProvider *provider, wxWindow *) {
return agi::util::make_unique<OSSPlayer>(provider); return agi::make_unique<OSSPlayer>(provider);
} }
#endif // WITH_OSS #endif // WITH_OSS

View File

@ -42,7 +42,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
DEFINE_SIMPLE_EXCEPTION(PortAudioError, agi::AudioPlayerOpenError, "audio/player/open/portaudio") DEFINE_SIMPLE_EXCEPTION(PortAudioError, agi::AudioPlayerOpenError, "audio/player/open/portaudio")
@ -282,7 +282,7 @@ bool PortAudioPlayer::IsPlaying() {
} }
std::unique_ptr<AudioPlayer> CreatePortAudioPlayer(AudioProvider *provider, wxWindow *) { std::unique_ptr<AudioPlayer> CreatePortAudioPlayer(AudioProvider *provider, wxWindow *) {
return agi::util::make_unique<PortAudioPlayer>(provider); return agi::make_unique<PortAudioPlayer>(provider);
} }
#endif // WITH_PORTAUDIO #endif // WITH_PORTAUDIO

View File

@ -40,7 +40,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <cstdio> #include <cstdio>
#include <pulse/pulseaudio.h> #include <pulse/pulseaudio.h>
@ -334,6 +334,6 @@ void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread)
} }
std::unique_ptr<AudioPlayer> CreatePulseAudioPlayer(AudioProvider *provider, wxWindow *) { std::unique_ptr<AudioPlayer> CreatePulseAudioPlayer(AudioProvider *provider, wxWindow *) {
return agi::util::make_unique<PulseAudioPlayer>(provider); return agi::make_unique<PulseAudioPlayer>(provider);
} }
#endif // WITH_LIBPULSE #endif // WITH_LIBPULSE

View File

@ -43,7 +43,7 @@
#include <libaegisub/background_runner.h> #include <libaegisub/background_runner.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>

View File

@ -45,7 +45,7 @@
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <mutex> #include <mutex>
@ -146,6 +146,6 @@ void AvisynthAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count)
} }
std::unique_ptr<AudioProvider> CreateAvisynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) { std::unique_ptr<AudioProvider> CreateAvisynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) {
return agi::util::make_unique<AvisynthAudioProvider>(file); return agi::make_unique<AvisynthAudioProvider>(file);
} }
#endif #endif

View File

@ -24,7 +24,7 @@
#include "audio_controller.h" #include "audio_controller.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <limits> #include <limits>
@ -131,7 +131,7 @@ public:
} }
}; };
/// Sample doubler with linear interpolation for the agi::util::make_unique<samples> /// Sample doubler with linear interpolation for the agi::make_unique<samples>
/// Requires 16-bit mono input /// Requires 16-bit mono input
class SampleDoublingAudioProvider final : public AudioProviderWrapper { class SampleDoublingAudioProvider final : public AudioProviderWrapper {
public: public:
@ -177,25 +177,25 @@ std::unique_ptr<AudioProvider> CreateConvertAudioProvider(std::unique_ptr<AudioP
if (provider->AreSamplesFloat()) { if (provider->AreSamplesFloat()) {
LOG_D("audio_provider") << "Converting float to S16"; LOG_D("audio_provider") << "Converting float to S16";
if (provider->GetBytesPerSample() == sizeof(float)) if (provider->GetBytesPerSample() == sizeof(float))
provider = agi::util::make_unique<FloatConvertAudioProvider<float, int16_t>>(std::move(provider)); provider = agi::make_unique<FloatConvertAudioProvider<float, int16_t>>(std::move(provider));
else else
provider = agi::util::make_unique<FloatConvertAudioProvider<double, int16_t>>(std::move(provider)); provider = agi::make_unique<FloatConvertAudioProvider<double, int16_t>>(std::move(provider));
} }
if (provider->GetBytesPerSample() != 2) { if (provider->GetBytesPerSample() != 2) {
LOG_D("audio_provider") << "Converting " << provider->GetBytesPerSample() << " bytes per sample or wrong endian to S16"; LOG_D("audio_provider") << "Converting " << provider->GetBytesPerSample() << " bytes per sample or wrong endian to S16";
provider = agi::util::make_unique<BitdepthConvertAudioProvider<int16_t>>(std::move(provider)); provider = agi::make_unique<BitdepthConvertAudioProvider<int16_t>>(std::move(provider));
} }
// We currently only support mono audio // We currently only support mono audio
if (provider->GetChannels() != 1) { if (provider->GetChannels() != 1) {
LOG_D("audio_provider") << "Downmixing to mono from " << provider->GetChannels() << " channels"; LOG_D("audio_provider") << "Downmixing to mono from " << provider->GetChannels() << " channels";
provider = agi::util::make_unique<DownmixAudioProvider>(std::move(provider)); provider = agi::make_unique<DownmixAudioProvider>(std::move(provider));
} }
// Some players don't like low sample rate audio // Some players don't like low sample rate audio
while (provider->GetSampleRate() < 32000) { while (provider->GetSampleRate() < 32000) {
LOG_D("audio_provider") << "Doubling sample rate"; LOG_D("audio_provider") << "Doubling sample rate";
provider = agi::util::make_unique<SampleDoublingAudioProvider>(std::move(provider)); provider = agi::make_unique<SampleDoublingAudioProvider>(std::move(provider));
} }
return provider; return provider;

View File

@ -35,7 +35,7 @@
#include "include/aegisub/audio_provider.h" #include "include/aegisub/audio_provider.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -89,5 +89,5 @@ public:
std::unique_ptr<AudioProvider> CreateDummyAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) { std::unique_ptr<AudioProvider> CreateDummyAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) {
if (!boost::starts_with(file.string(), "dummy-audio:")) if (!boost::starts_with(file.string(), "dummy-audio:"))
return {}; return {};
return agi::util::make_unique<DummyAudioProvider>(file); return agi::make_unique<DummyAudioProvider>(file);
} }

View File

@ -40,7 +40,7 @@
#include "options.h" #include "options.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <map> #include <map>
@ -207,7 +207,7 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
} }
std::unique_ptr<AudioProvider> CreateFFmpegSourceAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *br) { std::unique_ptr<AudioProvider> CreateFFmpegSourceAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *br) {
return agi::util::make_unique<FFmpegSourceAudioProvider>(file, br); return agi::make_unique<FFmpegSourceAudioProvider>(file, br);
} }
#endif /* WITH_FFMS2 */ #endif /* WITH_FFMS2 */

View File

@ -23,7 +23,7 @@
#include <libaegisub/file_mapping.h> #include <libaegisub/file_mapping.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
@ -72,7 +72,7 @@ public:
% (long long)time(nullptr) % (long long)time(nullptr)
% (long long)boost::interprocess::ipcdetail::get_current_process_id()); % (long long)boost::interprocess::ipcdetail::get_current_process_id());
file = agi::util::make_unique<agi::temp_file_mapping>(cache_dir / filename, num_samples * bytes_per_sample); file = agi::make_unique<agi::temp_file_mapping>(cache_dir / filename, num_samples * bytes_per_sample);
decoder = std::thread([&] { decoder = std::thread([&] {
int64_t block = 65536; int64_t block = 65536;
for (int64_t i = 0; i < num_samples; i += block) { for (int64_t i = 0; i < num_samples; i += block) {
@ -92,5 +92,5 @@ public:
} }
std::unique_ptr<AudioProvider> CreateHDAudioProvider(std::unique_ptr<AudioProvider> src) { std::unique_ptr<AudioProvider> CreateHDAudioProvider(std::unique_ptr<AudioProvider> src) {
return agi::util::make_unique<HDAudioProvider>(std::move(src)); return agi::make_unique<HDAudioProvider>(std::move(src));
} }

View File

@ -18,7 +18,7 @@
#include "include/aegisub/audio_provider.h" #include "include/aegisub/audio_provider.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
@ -41,5 +41,5 @@ public:
} }
std::unique_ptr<AudioProvider> CreateLockAudioProvider(std::unique_ptr<AudioProvider> src) { std::unique_ptr<AudioProvider> CreateLockAudioProvider(std::unique_ptr<AudioProvider> src) {
return agi::util::make_unique<LockAudioProvider>(std::move(src)); return agi::make_unique<LockAudioProvider>(std::move(src));
} }

View File

@ -40,7 +40,7 @@
#include <libaegisub/file_mapping.h> #include <libaegisub/file_mapping.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <vector> #include <vector>
@ -51,7 +51,7 @@ protected:
std::unique_ptr<agi::read_file_mapping> file; std::unique_ptr<agi::read_file_mapping> file;
PCMAudioProvider(agi::fs::path const& filename) PCMAudioProvider(agi::fs::path const& filename)
: file(agi::util::make_unique<agi::read_file_mapping>(filename)) : file(agi::make_unique<agi::read_file_mapping>(filename))
{ {
float_samples = false; float_samples = false;
} }
@ -365,7 +365,7 @@ std::unique_ptr<AudioProvider> CreatePCMAudioProvider(agi::fs::path const& filen
std::string msg; std::string msg;
try { try {
return agi::util::make_unique<RiffWavPCMAudioProvider>(filename); return agi::make_unique<RiffWavPCMAudioProvider>(filename);
} }
catch (agi::AudioDataNotFoundError const& err) { catch (agi::AudioDataNotFoundError const& err) {
msg = "RIFF PCM WAV audio provider: " + err.GetMessage(); msg = "RIFF PCM WAV audio provider: " + err.GetMessage();
@ -376,7 +376,7 @@ std::unique_ptr<AudioProvider> CreatePCMAudioProvider(agi::fs::path const& filen
} }
try { try {
return agi::util::make_unique<Wave64AudioProvider>(filename); return agi::make_unique<Wave64AudioProvider>(filename);
} }
catch (agi::AudioDataNotFoundError const& err) { catch (agi::AudioDataNotFoundError const& err) {
msg += "\nWave64 audio provider: " + err.GetMessage(); msg += "\nWave64 audio provider: " + err.GetMessage();

View File

@ -37,7 +37,7 @@
#include "audio_controller.h" #include "audio_controller.h"
#include "compat.h" #include "compat.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <array> #include <array>
#include <boost/container/stable_vector.hpp> #include <boost/container/stable_vector.hpp>
@ -112,5 +112,5 @@ void RAMAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) const
} }
std::unique_ptr<AudioProvider> CreateRAMAudioProvider(std::unique_ptr<AudioProvider> src) { std::unique_ptr<AudioProvider> CreateRAMAudioProvider(std::unique_ptr<AudioProvider> src) {
return agi::util::make_unique<RAMAudioProvider>(std::move(src)); return agi::make_unique<RAMAudioProvider>(std::move(src));
} }

View File

@ -35,7 +35,7 @@
#include "include/aegisub/audio_provider.h" #include "include/aegisub/audio_provider.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
@ -61,7 +61,7 @@ AudioRendererBitmapCacheBitmapFactory::AudioRendererBitmapCacheBitmapFactory(Aud
std::unique_ptr<wxBitmap> AudioRendererBitmapCacheBitmapFactory::ProduceBlock(int /* i */) std::unique_ptr<wxBitmap> AudioRendererBitmapCacheBitmapFactory::ProduceBlock(int /* i */)
{ {
return agi::util::make_unique<wxBitmap>(renderer->cache_bitmap_width, renderer->pixel_height, 24); return agi::make_unique<wxBitmap>(renderer->cache_bitmap_width, renderer->pixel_height, 24);
} }
size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const

View File

@ -42,7 +42,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -123,7 +123,7 @@ void AudioSpectrumRenderer::RecreateCache()
if (provider) if (provider)
{ {
size_t block_count = (size_t)((provider->GetNumSamples() + (size_t)(1<<derivation_dist) - 1) >> derivation_dist); size_t block_count = (size_t)((provider->GetNumSamples() + (size_t)(1<<derivation_dist) - 1) >> derivation_dist);
cache = agi::util::make_unique<AudioSpectrumCache>(block_count, this); cache = agi::make_unique<AudioSpectrumCache>(block_count, this);
#ifdef WITH_FFTW3 #ifdef WITH_FFTW3
dft_input = fftw_alloc_real(2<<derivation_size); dft_input = fftw_alloc_real(2<<derivation_size);

View File

@ -43,7 +43,7 @@
#include "selection_controller.h" #include "selection_controller.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/range/algorithm.hpp> #include <boost/range/algorithm.hpp>
#include <cstdint> #include <cstdint>
@ -411,7 +411,7 @@ public:
std::unique_ptr<AudioTimingController> CreateDialogueTimingController(agi::Context *c) std::unique_ptr<AudioTimingController> CreateDialogueTimingController(agi::Context *c)
{ {
return agi::util::make_unique<AudioTimingControllerDialogue>(c); return agi::make_unique<AudioTimingControllerDialogue>(c);
} }
AudioTimingControllerDialogue::AudioTimingControllerDialogue(agi::Context *c) AudioTimingControllerDialogue::AudioTimingControllerDialogue(agi::Context *c)

View File

@ -34,7 +34,7 @@
#include "selection_controller.h" #include "selection_controller.h"
#include "utils.h" #include "utils.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/range/algorithm/copy.hpp> #include <boost/range/algorithm/copy.hpp>
#include <boost/range/adaptor/filtered.hpp> #include <boost/range/adaptor/filtered.hpp>
@ -152,7 +152,7 @@ public:
std::unique_ptr<AudioTimingController> CreateKaraokeTimingController(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed) std::unique_ptr<AudioTimingController> CreateKaraokeTimingController(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed)
{ {
return agi::util::make_unique<AudioTimingControllerKaraoke>(c, kara, file_changed); return agi::make_unique<AudioTimingControllerKaraoke>(c, kara, file_changed);
} }
AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed) AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed)

View File

@ -48,7 +48,7 @@
#include <libaegisub/dispatch.h> #include <libaegisub/dispatch.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
@ -482,7 +482,7 @@ namespace Automation4 {
wxLogError(_("The file was not recognised as an Automation script: %s"), filename.wstring()); wxLogError(_("The file was not recognised as an Automation script: %s"), filename.wstring());
} }
return create_unknown ? agi::util::make_unique<UnknownScript>(filename) : nullptr; return create_unknown ? agi::make_unique<UnknownScript>(filename) : nullptr;
} }
std::vector<std::unique_ptr<ScriptFactory>>& ScriptFactory::Factories() std::vector<std::unique_ptr<ScriptFactory>>& ScriptFactory::Factories()

View File

@ -53,7 +53,7 @@
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
@ -773,7 +773,7 @@ namespace Automation4 {
int LuaCommand::LuaRegister(lua_State *L) int LuaCommand::LuaRegister(lua_State *L)
{ {
static std::mutex mutex; static std::mutex mutex;
auto command = agi::util::make_unique<LuaCommand>(L); auto command = agi::make_unique<LuaCommand>(L);
{ {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
cmd::reg(std::move(command)); cmd::reg(std::move(command));
@ -1048,7 +1048,7 @@ namespace Automation4 {
int LuaExportFilter::LuaRegister(lua_State *L) int LuaExportFilter::LuaRegister(lua_State *L)
{ {
static std::mutex mutex; static std::mutex mutex;
auto filter = agi::util::make_unique<LuaExportFilter>(L); auto filter = agi::make_unique<LuaExportFilter>(L);
{ {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
AssExportFilterChain::Register(std::move(filter)); AssExportFilterChain::Register(std::move(filter));
@ -1130,7 +1130,7 @@ namespace Automation4 {
std::unique_ptr<Script> LuaScriptFactory::Produce(agi::fs::path const& filename) const std::unique_ptr<Script> LuaScriptFactory::Produce(agi::fs::path const& filename) const
{ {
if (agi::fs::HasExtension(filename, "lua") || agi::fs::HasExtension(filename, "moon")) if (agi::fs::HasExtension(filename, "lua") || agi::fs::HasExtension(filename, "moon"))
return agi::util::make_unique<LuaScript>(filename); return agi::make_unique<LuaScript>(filename);
return nullptr; return nullptr;
} }
} }

View File

@ -43,7 +43,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@ -241,7 +241,7 @@ namespace Automation4 {
try { try {
if (lclass == "info") if (lclass == "info")
result = agi::util::make_unique<AssInfo>(get_string_field(L, "key", "info"), get_string_field(L, "value", "info")); result = agi::make_unique<AssInfo>(get_string_field(L, "key", "info"), get_string_field(L, "value", "info"));
else if (lclass == "style") { else if (lclass == "style") {
auto sty = new AssStyle; auto sty = new AssStyle;
result.reset(sty); result.reset(sty);
@ -357,7 +357,7 @@ namespace Automation4 {
// Just in case an insane user inserted non-info lines into the // Just in case an insane user inserted non-info lines into the
// script info section... // script info section...
while (lines[i]) ++i; while (lines[i]) ++i;
lines_to_delete.emplace_back(agi::util::make_unique<AssInfo>(info)); lines_to_delete.emplace_back(agi::make_unique<AssInfo>(info));
lines[i++] = lines_to_delete.back().get(); lines[i++] = lines_to_delete.back().get();
} }
script_info_copied = true; script_info_copied = true;

View File

@ -42,7 +42,7 @@
#include "utils.h" #include "utils.h"
#include "validators.h" #include "validators.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include <boost/range/adaptors.hpp> #include <boost/range/adaptors.hpp>
@ -426,26 +426,26 @@ namespace Automation4 {
// Check control class and create relevant control // Check control class and create relevant control
if (controlclass == "label") if (controlclass == "label")
ctl = agi::util::make_unique<LuaControl::Label>(L); ctl = agi::make_unique<LuaControl::Label>(L);
else if (controlclass == "edit") else if (controlclass == "edit")
ctl = agi::util::make_unique<LuaControl::Edit>(L); ctl = agi::make_unique<LuaControl::Edit>(L);
else if (controlclass == "intedit") else if (controlclass == "intedit")
ctl = agi::util::make_unique<LuaControl::IntEdit>(L); ctl = agi::make_unique<LuaControl::IntEdit>(L);
else if (controlclass == "floatedit") else if (controlclass == "floatedit")
ctl = agi::util::make_unique<LuaControl::FloatEdit>(L); ctl = agi::make_unique<LuaControl::FloatEdit>(L);
else if (controlclass == "textbox") else if (controlclass == "textbox")
ctl = agi::util::make_unique<LuaControl::Textbox>(L); ctl = agi::make_unique<LuaControl::Textbox>(L);
else if (controlclass == "dropdown") else if (controlclass == "dropdown")
ctl = agi::util::make_unique<LuaControl::Dropdown>(L); ctl = agi::make_unique<LuaControl::Dropdown>(L);
else if (controlclass == "checkbox") else if (controlclass == "checkbox")
ctl = agi::util::make_unique<LuaControl::Checkbox>(L); ctl = agi::make_unique<LuaControl::Checkbox>(L);
else if (controlclass == "color") else if (controlclass == "color")
ctl = agi::util::make_unique<LuaControl::Color>(L, false); ctl = agi::make_unique<LuaControl::Color>(L, false);
else if (controlclass == "coloralpha") else if (controlclass == "coloralpha")
ctl = agi::util::make_unique<LuaControl::Color>(L, true); ctl = agi::make_unique<LuaControl::Color>(L, true);
else if (controlclass == "alpha") else if (controlclass == "alpha")
// FIXME // FIXME
ctl = agi::util::make_unique<LuaControl::Edit>(L); ctl = agi::make_unique<LuaControl::Edit>(L);
else else
luaL_error(L, "bad control table entry"); luaL_error(L, "bad control table entry");

View File

@ -34,7 +34,7 @@
#include "command.h" #include "command.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include "../audio_controller.h" #include "../audio_controller.h"
#include "../compat.h" #include "../compat.h"
@ -273,20 +273,20 @@ struct app_updates final : public Command {
namespace cmd { namespace cmd {
void init_app() { void init_app() {
reg(agi::util::make_unique<app_about>()); reg(agi::make_unique<app_about>());
reg(agi::util::make_unique<app_display_audio_subs>()); reg(agi::make_unique<app_display_audio_subs>());
reg(agi::util::make_unique<app_display_full>()); reg(agi::make_unique<app_display_full>());
reg(agi::util::make_unique<app_display_subs>()); reg(agi::make_unique<app_display_subs>());
reg(agi::util::make_unique<app_display_video_subs>()); reg(agi::make_unique<app_display_video_subs>());
reg(agi::util::make_unique<app_exit>()); reg(agi::make_unique<app_exit>());
reg(agi::util::make_unique<app_language>()); reg(agi::make_unique<app_language>());
reg(agi::util::make_unique<app_log>()); reg(agi::make_unique<app_log>());
reg(agi::util::make_unique<app_new_window>()); reg(agi::make_unique<app_new_window>());
reg(agi::util::make_unique<app_options>()); reg(agi::make_unique<app_options>());
reg(agi::util::make_unique<app_toggle_global_hotkeys>()); reg(agi::make_unique<app_toggle_global_hotkeys>());
reg(agi::util::make_unique<app_toggle_toolbar>()); reg(agi::make_unique<app_toggle_toolbar>());
#ifdef WITH_UPDATE_CHECKER #ifdef WITH_UPDATE_CHECKER
reg(agi::util::make_unique<app_updates>()); reg(agi::make_unique<app_updates>());
#endif #endif
} }
} }

View File

@ -44,7 +44,7 @@
#include "../utils.h" #include "../utils.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -555,36 +555,36 @@ struct audio_karaoke final : public Command {
namespace cmd { namespace cmd {
void init_audio() { void init_audio() {
reg(agi::util::make_unique<audio_autocommit>()); reg(agi::make_unique<audio_autocommit>());
reg(agi::util::make_unique<audio_autonext>()); reg(agi::make_unique<audio_autonext>());
reg(agi::util::make_unique<audio_autoscroll>()); reg(agi::make_unique<audio_autoscroll>());
reg(agi::util::make_unique<audio_close>()); reg(agi::make_unique<audio_close>());
reg(agi::util::make_unique<audio_commit>()); reg(agi::make_unique<audio_commit>());
reg(agi::util::make_unique<audio_commit_default>()); reg(agi::make_unique<audio_commit_default>());
reg(agi::util::make_unique<audio_commit_next>()); reg(agi::make_unique<audio_commit_next>());
reg(agi::util::make_unique<audio_commit_stay>()); reg(agi::make_unique<audio_commit_stay>());
reg(agi::util::make_unique<audio_go_to>()); reg(agi::make_unique<audio_go_to>());
reg(agi::util::make_unique<audio_karaoke>()); reg(agi::make_unique<audio_karaoke>());
reg(agi::util::make_unique<audio_open>()); reg(agi::make_unique<audio_open>());
reg(agi::util::make_unique<audio_open_blank>()); reg(agi::make_unique<audio_open_blank>());
reg(agi::util::make_unique<audio_open_noise>()); reg(agi::make_unique<audio_open_noise>());
reg(agi::util::make_unique<audio_open_video>()); reg(agi::make_unique<audio_open_video>());
reg(agi::util::make_unique<audio_play_after>()); reg(agi::make_unique<audio_play_after>());
reg(agi::util::make_unique<audio_play_before>()); reg(agi::make_unique<audio_play_before>());
reg(agi::util::make_unique<audio_play_begin>()); reg(agi::make_unique<audio_play_begin>());
reg(agi::util::make_unique<audio_play_end>()); reg(agi::make_unique<audio_play_end>());
reg(agi::util::make_unique<audio_play_current_selection>()); reg(agi::make_unique<audio_play_current_selection>());
reg(agi::util::make_unique<audio_play_current_line>()); reg(agi::make_unique<audio_play_current_line>());
reg(agi::util::make_unique<audio_play_selection>()); reg(agi::make_unique<audio_play_selection>());
reg(agi::util::make_unique<audio_play_to_end>()); reg(agi::make_unique<audio_play_to_end>());
reg(agi::util::make_unique<audio_play_toggle>()); reg(agi::make_unique<audio_play_toggle>());
reg(agi::util::make_unique<audio_save_clip>()); reg(agi::make_unique<audio_save_clip>());
reg(agi::util::make_unique<audio_scroll_left>()); reg(agi::make_unique<audio_scroll_left>());
reg(agi::util::make_unique<audio_scroll_right>()); reg(agi::make_unique<audio_scroll_right>());
reg(agi::util::make_unique<audio_stop>()); reg(agi::make_unique<audio_stop>());
reg(agi::util::make_unique<audio_toggle_spectrum>()); reg(agi::make_unique<audio_toggle_spectrum>());
reg(agi::util::make_unique<audio_vertical_link>()); reg(agi::make_unique<audio_vertical_link>());
reg(agi::util::make_unique<audio_view_spectrum>()); reg(agi::make_unique<audio_view_spectrum>());
reg(agi::util::make_unique<audio_view_waveform>()); reg(agi::make_unique<audio_view_waveform>());
} }
} }

View File

@ -42,7 +42,7 @@
#include "../utils.h" #include "../utils.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace { namespace {
using cmd::Command; using cmd::Command;
@ -107,9 +107,9 @@ struct meta final : public Command {
namespace cmd { namespace cmd {
void init_automation() { void init_automation() {
reg(agi::util::make_unique<meta>()); reg(agi::make_unique<meta>());
reg(agi::util::make_unique<open_manager>()); reg(agi::make_unique<open_manager>());
reg(agi::util::make_unique<reload_all>()); reg(agi::make_unique<reload_all>());
reg(agi::util::make_unique<reload_autoload>()); reg(agi::make_unique<reload_autoload>());
} }
} }

View File

@ -53,7 +53,7 @@
#include <libaegisub/address_of_adaptor.h> #include <libaegisub/address_of_adaptor.h>
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -1254,37 +1254,37 @@ struct edit_insert_original final : public Command {
namespace cmd { namespace cmd {
void init_edit() { void init_edit() {
reg(agi::util::make_unique<edit_color_primary>()); reg(agi::make_unique<edit_color_primary>());
reg(agi::util::make_unique<edit_color_secondary>()); reg(agi::make_unique<edit_color_secondary>());
reg(agi::util::make_unique<edit_color_outline>()); reg(agi::make_unique<edit_color_outline>());
reg(agi::util::make_unique<edit_color_shadow>()); reg(agi::make_unique<edit_color_shadow>());
reg(agi::util::make_unique<edit_font>()); reg(agi::make_unique<edit_font>());
reg(agi::util::make_unique<edit_find_replace>()); reg(agi::make_unique<edit_find_replace>());
reg(agi::util::make_unique<edit_line_copy>()); reg(agi::make_unique<edit_line_copy>());
reg(agi::util::make_unique<edit_line_cut>()); reg(agi::make_unique<edit_line_cut>());
reg(agi::util::make_unique<edit_line_delete>()); reg(agi::make_unique<edit_line_delete>());
reg(agi::util::make_unique<edit_line_duplicate>()); reg(agi::make_unique<edit_line_duplicate>());
reg(agi::util::make_unique<edit_line_duplicate_shift>()); reg(agi::make_unique<edit_line_duplicate_shift>());
reg(agi::util::make_unique<edit_line_duplicate_shift_back>()); reg(agi::make_unique<edit_line_duplicate_shift_back>());
reg(agi::util::make_unique<edit_line_join_as_karaoke>()); reg(agi::make_unique<edit_line_join_as_karaoke>());
reg(agi::util::make_unique<edit_line_join_concatenate>()); reg(agi::make_unique<edit_line_join_concatenate>());
reg(agi::util::make_unique<edit_line_join_keep_first>()); reg(agi::make_unique<edit_line_join_keep_first>());
reg(agi::util::make_unique<edit_line_paste>()); reg(agi::make_unique<edit_line_paste>());
reg(agi::util::make_unique<edit_line_paste_over>()); reg(agi::make_unique<edit_line_paste_over>());
reg(agi::util::make_unique<edit_line_recombine>()); reg(agi::make_unique<edit_line_recombine>());
reg(agi::util::make_unique<edit_line_split_by_karaoke>()); reg(agi::make_unique<edit_line_split_by_karaoke>());
reg(agi::util::make_unique<edit_line_split_estimate>()); reg(agi::make_unique<edit_line_split_estimate>());
reg(agi::util::make_unique<edit_line_split_preserve>()); reg(agi::make_unique<edit_line_split_preserve>());
reg(agi::util::make_unique<edit_line_split_video>()); reg(agi::make_unique<edit_line_split_video>());
reg(agi::util::make_unique<edit_style_bold>()); reg(agi::make_unique<edit_style_bold>());
reg(agi::util::make_unique<edit_style_italic>()); reg(agi::make_unique<edit_style_italic>());
reg(agi::util::make_unique<edit_style_underline>()); reg(agi::make_unique<edit_style_underline>());
reg(agi::util::make_unique<edit_style_strikeout>()); reg(agi::make_unique<edit_style_strikeout>());
reg(agi::util::make_unique<edit_redo>()); reg(agi::make_unique<edit_redo>());
reg(agi::util::make_unique<edit_undo>()); reg(agi::make_unique<edit_undo>());
reg(agi::util::make_unique<edit_revert>()); reg(agi::make_unique<edit_revert>());
reg(agi::util::make_unique<edit_insert_original>()); reg(agi::make_unique<edit_insert_original>());
reg(agi::util::make_unique<edit_clear>()); reg(agi::make_unique<edit_clear>());
reg(agi::util::make_unique<edit_clear_text>()); reg(agi::make_unique<edit_clear_text>());
} }
} }

View File

@ -42,7 +42,7 @@
#include "../selection_controller.h" #include "../selection_controller.h"
#include "../utils.h" #include "../utils.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace { namespace {
using cmd::Command; using cmd::Command;
@ -403,27 +403,27 @@ struct grid_swap final : public Command {
namespace cmd { namespace cmd {
void init_grid() { void init_grid() {
reg(agi::util::make_unique<grid_line_next>()); reg(agi::make_unique<grid_line_next>());
reg(agi::util::make_unique<grid_line_next_create>()); reg(agi::make_unique<grid_line_next_create>());
reg(agi::util::make_unique<grid_line_prev>()); reg(agi::make_unique<grid_line_prev>());
reg(agi::util::make_unique<grid_sort_actor>()); reg(agi::make_unique<grid_sort_actor>());
reg(agi::util::make_unique<grid_sort_effect>()); reg(agi::make_unique<grid_sort_effect>());
reg(agi::util::make_unique<grid_sort_end>()); reg(agi::make_unique<grid_sort_end>());
reg(agi::util::make_unique<grid_sort_layer>()); reg(agi::make_unique<grid_sort_layer>());
reg(agi::util::make_unique<grid_sort_start>()); reg(agi::make_unique<grid_sort_start>());
reg(agi::util::make_unique<grid_sort_style>()); reg(agi::make_unique<grid_sort_style>());
reg(agi::util::make_unique<grid_sort_actor_selected>()); reg(agi::make_unique<grid_sort_actor_selected>());
reg(agi::util::make_unique<grid_sort_effect_selected>()); reg(agi::make_unique<grid_sort_effect_selected>());
reg(agi::util::make_unique<grid_sort_end_selected>()); reg(agi::make_unique<grid_sort_end_selected>());
reg(agi::util::make_unique<grid_sort_layer_selected>()); reg(agi::make_unique<grid_sort_layer_selected>());
reg(agi::util::make_unique<grid_sort_start_selected>()); reg(agi::make_unique<grid_sort_start_selected>());
reg(agi::util::make_unique<grid_sort_style_selected>()); reg(agi::make_unique<grid_sort_style_selected>());
reg(agi::util::make_unique<grid_move_down>()); reg(agi::make_unique<grid_move_down>());
reg(agi::util::make_unique<grid_move_up>()); reg(agi::make_unique<grid_move_up>());
reg(agi::util::make_unique<grid_swap>()); reg(agi::make_unique<grid_swap>());
reg(agi::util::make_unique<grid_tag_cycle_hiding>()); reg(agi::make_unique<grid_tag_cycle_hiding>());
reg(agi::util::make_unique<grid_tags_hide>()); reg(agi::make_unique<grid_tags_hide>());
reg(agi::util::make_unique<grid_tags_show>()); reg(agi::make_unique<grid_tags_show>());
reg(agi::util::make_unique<grid_tags_simplify>()); reg(agi::make_unique<grid_tags_simplify>());
} }
} }

View File

@ -36,7 +36,7 @@
#include "../libresrc/libresrc.h" #include "../libresrc/libresrc.h"
#include "../options.h" #include "../options.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -127,11 +127,11 @@ struct help_website final : public Command {
namespace cmd { namespace cmd {
void init_help() { void init_help() {
reg(agi::util::make_unique<help_bugs>()); reg(agi::make_unique<help_bugs>());
reg(agi::util::make_unique<help_contents>()); reg(agi::make_unique<help_contents>());
reg(agi::util::make_unique<help_forums>()); reg(agi::make_unique<help_forums>());
reg(agi::util::make_unique<help_irc>()); reg(agi::make_unique<help_irc>());
reg(agi::util::make_unique<help_video>()); reg(agi::make_unique<help_video>());
reg(agi::util::make_unique<help_website>()); reg(agi::make_unique<help_website>());
} }
} }

View File

@ -37,7 +37,7 @@
#include "../utils.h" #include "../utils.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace { namespace {
using cmd::Command; using cmd::Command;
@ -100,8 +100,8 @@ struct keyframe_save final : public Command {
namespace cmd { namespace cmd {
void init_keyframe() { void init_keyframe() {
reg(agi::util::make_unique<keyframe_close>()); reg(agi::make_unique<keyframe_close>());
reg(agi::util::make_unique<keyframe_open>()); reg(agi::make_unique<keyframe_open>());
reg(agi::util::make_unique<keyframe_save>()); reg(agi::make_unique<keyframe_save>());
} }
} }

View File

@ -37,7 +37,7 @@
#include "../subs_controller.h" #include "../subs_controller.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -128,18 +128,18 @@ public:
namespace cmd { namespace cmd {
void init_recent() { void init_recent() {
reg(agi::util::make_unique<recent_audio>()); reg(agi::make_unique<recent_audio>());
reg(agi::util::make_unique<recent_keyframes>()); reg(agi::make_unique<recent_keyframes>());
reg(agi::util::make_unique<recent_subtitle>()); reg(agi::make_unique<recent_subtitle>());
reg(agi::util::make_unique<recent_timecodes>()); reg(agi::make_unique<recent_timecodes>());
reg(agi::util::make_unique<recent_video>()); reg(agi::make_unique<recent_video>());
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
reg(agi::util::make_unique<mru_wrapper<recent_audio_entry>>(i)); reg(agi::make_unique<mru_wrapper<recent_audio_entry>>(i));
reg(agi::util::make_unique<mru_wrapper<recent_keyframes_entry>>(i)); reg(agi::make_unique<mru_wrapper<recent_keyframes_entry>>(i));
reg(agi::util::make_unique<mru_wrapper<recent_subtitle_entry>>(i)); reg(agi::make_unique<mru_wrapper<recent_subtitle_entry>>(i));
reg(agi::util::make_unique<mru_wrapper<recent_timecodes_entry>>(i)); reg(agi::make_unique<mru_wrapper<recent_timecodes_entry>>(i));
reg(agi::util::make_unique<mru_wrapper<recent_video_entry>>(i)); reg(agi::make_unique<mru_wrapper<recent_video_entry>>(i));
} }
} }
} }

View File

@ -52,7 +52,7 @@
#include <libaegisub/address_of_adaptor.h> #include <libaegisub/address_of_adaptor.h>
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/range/algorithm.hpp> #include <boost/range/algorithm.hpp>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -424,23 +424,23 @@ struct subtitle_spellcheck final : public Command {
namespace cmd { namespace cmd {
void init_subtitle() { void init_subtitle() {
reg(agi::util::make_unique<subtitle_attachment>()); reg(agi::make_unique<subtitle_attachment>());
reg(agi::util::make_unique<subtitle_find>()); reg(agi::make_unique<subtitle_find>());
reg(agi::util::make_unique<subtitle_find_next>()); reg(agi::make_unique<subtitle_find_next>());
reg(agi::util::make_unique<subtitle_insert_after>()); reg(agi::make_unique<subtitle_insert_after>());
reg(agi::util::make_unique<subtitle_insert_after_videotime>()); reg(agi::make_unique<subtitle_insert_after_videotime>());
reg(agi::util::make_unique<subtitle_insert_before>()); reg(agi::make_unique<subtitle_insert_before>());
reg(agi::util::make_unique<subtitle_insert_before_videotime>()); reg(agi::make_unique<subtitle_insert_before_videotime>());
reg(agi::util::make_unique<subtitle_new>()); reg(agi::make_unique<subtitle_new>());
reg(agi::util::make_unique<subtitle_open>()); reg(agi::make_unique<subtitle_open>());
reg(agi::util::make_unique<subtitle_open_autosave>()); reg(agi::make_unique<subtitle_open_autosave>());
reg(agi::util::make_unique<subtitle_open_charset>()); reg(agi::make_unique<subtitle_open_charset>());
reg(agi::util::make_unique<subtitle_open_video>()); reg(agi::make_unique<subtitle_open_video>());
reg(agi::util::make_unique<subtitle_properties>()); reg(agi::make_unique<subtitle_properties>());
reg(agi::util::make_unique<subtitle_save>()); reg(agi::make_unique<subtitle_save>());
reg(agi::util::make_unique<subtitle_save_as>()); reg(agi::make_unique<subtitle_save_as>());
reg(agi::util::make_unique<subtitle_select_all>()); reg(agi::make_unique<subtitle_select_all>());
reg(agi::util::make_unique<subtitle_select_visible>()); reg(agi::make_unique<subtitle_select_visible>());
reg(agi::util::make_unique<subtitle_spellcheck>()); reg(agi::make_unique<subtitle_spellcheck>());
} }
} }

View File

@ -43,7 +43,7 @@
#include "../selection_controller.h" #include "../selection_controller.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -378,23 +378,23 @@ struct time_prev final : public Command {
namespace cmd { namespace cmd {
void init_time() { void init_time() {
reg(agi::util::make_unique<time_add_lead_both>()); reg(agi::make_unique<time_add_lead_both>());
reg(agi::util::make_unique<time_add_lead_in>()); reg(agi::make_unique<time_add_lead_in>());
reg(agi::util::make_unique<time_add_lead_out>()); reg(agi::make_unique<time_add_lead_out>());
reg(agi::util::make_unique<time_continuous_end>()); reg(agi::make_unique<time_continuous_end>());
reg(agi::util::make_unique<time_continuous_start>()); reg(agi::make_unique<time_continuous_start>());
reg(agi::util::make_unique<time_frame_current>()); reg(agi::make_unique<time_frame_current>());
reg(agi::util::make_unique<time_length_decrease>()); reg(agi::make_unique<time_length_decrease>());
reg(agi::util::make_unique<time_length_decrease_shift>()); reg(agi::make_unique<time_length_decrease_shift>());
reg(agi::util::make_unique<time_length_increase>()); reg(agi::make_unique<time_length_increase>());
reg(agi::util::make_unique<time_length_increase_shift>()); reg(agi::make_unique<time_length_increase_shift>());
reg(agi::util::make_unique<time_next>()); reg(agi::make_unique<time_next>());
reg(agi::util::make_unique<time_prev>()); reg(agi::make_unique<time_prev>());
reg(agi::util::make_unique<time_shift>()); reg(agi::make_unique<time_shift>());
reg(agi::util::make_unique<time_snap_end_video>()); reg(agi::make_unique<time_snap_end_video>());
reg(agi::util::make_unique<time_snap_scene>()); reg(agi::make_unique<time_snap_scene>());
reg(agi::util::make_unique<time_snap_start_video>()); reg(agi::make_unique<time_snap_start_video>());
reg(agi::util::make_unique<time_start_decrease>()); reg(agi::make_unique<time_start_decrease>());
reg(agi::util::make_unique<time_start_increase>()); reg(agi::make_unique<time_start_increase>());
} }
} }

View File

@ -37,7 +37,7 @@
#include "../utils.h" #include "../utils.h"
#include "../video_context.h" #include "../video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace { namespace {
using cmd::Command; using cmd::Command;
@ -97,8 +97,8 @@ struct timecode_save final : public Command {
namespace cmd { namespace cmd {
void init_timecode() { void init_timecode() {
reg(agi::util::make_unique<timecode_close>()); reg(agi::make_unique<timecode_close>());
reg(agi::util::make_unique<timecode_open>()); reg(agi::make_unique<timecode_open>());
reg(agi::util::make_unique<timecode_save>()); reg(agi::make_unique<timecode_save>());
} }
} }

View File

@ -50,7 +50,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include <wx/utils.h> #include <wx/utils.h>
@ -284,25 +284,25 @@ struct tool_translation_assistant_insert final : public tool_translation_assista
namespace cmd { namespace cmd {
void init_tool() { void init_tool() {
reg(agi::util::make_unique<tool_export>()); reg(agi::make_unique<tool_export>());
reg(agi::util::make_unique<tool_font_collector>()); reg(agi::make_unique<tool_font_collector>());
reg(agi::util::make_unique<tool_line_select>()); reg(agi::make_unique<tool_line_select>());
reg(agi::util::make_unique<tool_resampleres>()); reg(agi::make_unique<tool_resampleres>());
reg(agi::util::make_unique<tool_style_assistant>()); reg(agi::make_unique<tool_style_assistant>());
reg(agi::util::make_unique<tool_styling_assistant_commit>()); reg(agi::make_unique<tool_styling_assistant_commit>());
reg(agi::util::make_unique<tool_styling_assistant_preview>()); reg(agi::make_unique<tool_styling_assistant_preview>());
reg(agi::util::make_unique<tool_style_manager>()); reg(agi::make_unique<tool_style_manager>());
reg(agi::util::make_unique<tool_time_kanji>()); reg(agi::make_unique<tool_time_kanji>());
reg(agi::util::make_unique<tool_time_postprocess>()); reg(agi::make_unique<tool_time_postprocess>());
reg(agi::util::make_unique<tool_translation_assistant>()); reg(agi::make_unique<tool_translation_assistant>());
#ifdef _WIN32 #ifdef _WIN32
if (agi::fs::FileExists(config::path->Decode("?data/ASSDraw3.exe"))) if (agi::fs::FileExists(config::path->Decode("?data/ASSDraw3.exe")))
reg(agi::util::make_unique<tool_assdraw>()); reg(agi::make_unique<tool_assdraw>());
#endif #endif
reg(agi::util::make_unique<tool_translation_assistant_commit>()); reg(agi::make_unique<tool_translation_assistant_commit>());
reg(agi::util::make_unique<tool_translation_assistant_preview>()); reg(agi::make_unique<tool_translation_assistant_preview>());
reg(agi::util::make_unique<tool_translation_assistant_next>()); reg(agi::make_unique<tool_translation_assistant_next>());
reg(agi::util::make_unique<tool_translation_assistant_prev>()); reg(agi::make_unique<tool_translation_assistant_prev>());
reg(agi::util::make_unique<tool_translation_assistant_insert>()); reg(agi::make_unique<tool_translation_assistant_insert>());
} }
} }

View File

@ -54,6 +54,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
@ -739,43 +740,43 @@ struct video_zoom_out final : public validator_video_attached {
namespace cmd { namespace cmd {
void init_video() { void init_video() {
reg(agi::util::make_unique<video_aspect_cinematic>()); reg(agi::make_unique<video_aspect_cinematic>());
reg(agi::util::make_unique<video_aspect_custom>()); reg(agi::make_unique<video_aspect_custom>());
reg(agi::util::make_unique<video_aspect_default>()); reg(agi::make_unique<video_aspect_default>());
reg(agi::util::make_unique<video_aspect_full>()); reg(agi::make_unique<video_aspect_full>());
reg(agi::util::make_unique<video_aspect_wide>()); reg(agi::make_unique<video_aspect_wide>());
reg(agi::util::make_unique<video_close>()); reg(agi::make_unique<video_close>());
reg(agi::util::make_unique<video_copy_coordinates>()); reg(agi::make_unique<video_copy_coordinates>());
reg(agi::util::make_unique<video_cycle_subtitles_provider>()); reg(agi::make_unique<video_cycle_subtitles_provider>());
reg(agi::util::make_unique<video_detach>()); reg(agi::make_unique<video_detach>());
reg(agi::util::make_unique<video_details>()); reg(agi::make_unique<video_details>());
reg(agi::util::make_unique<video_focus_seek>()); reg(agi::make_unique<video_focus_seek>());
reg(agi::util::make_unique<video_frame_copy>()); reg(agi::make_unique<video_frame_copy>());
reg(agi::util::make_unique<video_frame_copy_raw>()); reg(agi::make_unique<video_frame_copy_raw>());
reg(agi::util::make_unique<video_frame_next>()); reg(agi::make_unique<video_frame_next>());
reg(agi::util::make_unique<video_frame_next_boundary>()); reg(agi::make_unique<video_frame_next_boundary>());
reg(agi::util::make_unique<video_frame_next_keyframe>()); reg(agi::make_unique<video_frame_next_keyframe>());
reg(agi::util::make_unique<video_frame_next_large>()); reg(agi::make_unique<video_frame_next_large>());
reg(agi::util::make_unique<video_frame_prev>()); reg(agi::make_unique<video_frame_prev>());
reg(agi::util::make_unique<video_frame_prev_boundary>()); reg(agi::make_unique<video_frame_prev_boundary>());
reg(agi::util::make_unique<video_frame_prev_keyframe>()); reg(agi::make_unique<video_frame_prev_keyframe>());
reg(agi::util::make_unique<video_frame_prev_large>()); reg(agi::make_unique<video_frame_prev_large>());
reg(agi::util::make_unique<video_frame_save>()); reg(agi::make_unique<video_frame_save>());
reg(agi::util::make_unique<video_frame_save_raw>()); reg(agi::make_unique<video_frame_save_raw>());
reg(agi::util::make_unique<video_jump>()); reg(agi::make_unique<video_jump>());
reg(agi::util::make_unique<video_jump_end>()); reg(agi::make_unique<video_jump_end>());
reg(agi::util::make_unique<video_jump_start>()); reg(agi::make_unique<video_jump_start>());
reg(agi::util::make_unique<video_open>()); reg(agi::make_unique<video_open>());
reg(agi::util::make_unique<video_open_dummy>()); reg(agi::make_unique<video_open_dummy>());
reg(agi::util::make_unique<video_opt_autoscroll>()); reg(agi::make_unique<video_opt_autoscroll>());
reg(agi::util::make_unique<video_play>()); reg(agi::make_unique<video_play>());
reg(agi::util::make_unique<video_play_line>()); reg(agi::make_unique<video_play_line>());
reg(agi::util::make_unique<video_show_overscan>()); reg(agi::make_unique<video_show_overscan>());
reg(agi::util::make_unique<video_stop>()); reg(agi::make_unique<video_stop>());
reg(agi::util::make_unique<video_zoom_100>()); reg(agi::make_unique<video_zoom_100>());
reg(agi::util::make_unique<video_zoom_200>()); reg(agi::make_unique<video_zoom_200>());
reg(agi::util::make_unique<video_zoom_50>()); reg(agi::make_unique<video_zoom_50>());
reg(agi::util::make_unique<video_zoom_in>()); reg(agi::make_unique<video_zoom_in>());
reg(agi::util::make_unique<video_zoom_out>()); reg(agi::make_unique<video_zoom_out>());
} }
} }

View File

@ -29,7 +29,7 @@
#include "../visual_tool_scale.h" #include "../visual_tool_scale.h"
#include "../visual_tool_vector_clip.h" #include "../visual_tool_vector_clip.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace { namespace {
using cmd::Command; using cmd::Command;
@ -47,7 +47,7 @@ namespace {
} }
void operator()(agi::Context *c) override { void operator()(agi::Context *c) override {
c->videoDisplay->SetTool(agi::util::make_unique<T>(c->videoDisplay, c)); c->videoDisplay->SetTool(agi::make_unique<T>(c->videoDisplay, c));
} }
}; };
@ -110,12 +110,12 @@ namespace {
namespace cmd { namespace cmd {
void init_visual_tools() { void init_visual_tools() {
reg(agi::util::make_unique<visual_mode_cross>()); reg(agi::make_unique<visual_mode_cross>());
reg(agi::util::make_unique<visual_mode_drag>()); reg(agi::make_unique<visual_mode_drag>());
reg(agi::util::make_unique<visual_mode_rotate_z>()); reg(agi::make_unique<visual_mode_rotate_z>());
reg(agi::util::make_unique<visual_mode_rotate_xy>()); reg(agi::make_unique<visual_mode_rotate_xy>());
reg(agi::util::make_unique<visual_mode_scale>()); reg(agi::make_unique<visual_mode_scale>());
reg(agi::util::make_unique<visual_mode_clip>()); reg(agi::make_unique<visual_mode_clip>());
reg(agi::util::make_unique<visual_mode_vector_clip>()); reg(agi::make_unique<visual_mode_vector_clip>());
} }
} }

View File

@ -27,20 +27,20 @@
#include "text_selection_controller.h" #include "text_selection_controller.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
namespace agi { namespace agi {
Context::Context() Context::Context()
: ass(util::make_unique<AssFile>()) : ass(make_unique<AssFile>())
, textSelectionController(util::make_unique<TextSelectionController>()) , textSelectionController(make_unique<TextSelectionController>())
, subsController(util::make_unique<SubsController>(this)) , subsController(make_unique<SubsController>(this))
, local_scripts(util::make_unique<Automation4::LocalScriptManager>(this)) , local_scripts(make_unique<Automation4::LocalScriptManager>(this))
, videoController(util::make_unique<VideoContext>(this)) , videoController(make_unique<VideoContext>(this))
, audioController(util::make_unique<AudioController>(this)) , audioController(make_unique<AudioController>(this))
, selectionController(util::make_unique<SelectionController>(this)) , selectionController(make_unique<SelectionController>(this))
, initialLineState(util::make_unique<InitialLineState>(this)) , initialLineState(make_unique<InitialLineState>(this))
, search(util::make_unique<SearchReplaceEngine>(this)) , search(make_unique<SearchReplaceEngine>(this))
, dialog(util::make_unique<DialogManager>()) , dialog(make_unique<DialogManager>())
{ {
subsController->SetSelectionController(selectionController.get()); subsController->SetSelectionController(selectionController.get());
} }

View File

@ -19,6 +19,7 @@
#include "version.h" #include "version.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <atomic> #include <atomic>
@ -120,7 +121,7 @@ void Initialize(agi::fs::path const& path) {
wcscpy_s(crash_dump_path + len, MAX_PATH - len, L".dmp"); wcscpy_s(crash_dump_path + len, MAX_PATH - len, L".dmp");
if (!dump_thread) if (!dump_thread)
dump_thread = agi::util::make_unique<dump_thread_state>(); dump_thread = agi::make_unique<dump_thread_state>();
} }
void Cleanup() { void Cleanup() {

View File

@ -44,7 +44,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/scoped_ptr.h> #include <libaegisub/scoped_ptr.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -663,7 +663,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color,
SetSizerAndFit(main_sizer); SetSizerAndFit(main_sizer);
persist = agi::util::make_unique<PersistLocation>(this, "Tool/Colour Picker"); persist = agi::make_unique<PersistLocation>(this, "Tool/Colour Picker");
// Fill the controls // Fill the controls
int mode = OPT_GET("Tool/Colour Picker/Mode")->GetInt(); int mode = OPT_GET("Tool/Colour Picker/Mode")->GetInt();

View File

@ -43,7 +43,7 @@
#include "video_context.h" #include "video_context.h"
#include "video_display.h" #include "video_display.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
@ -79,7 +79,7 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context)
videoBox->SetMinSize(wxSize(1,1)); videoBox->SetMinSize(wxSize(1,1));
SetMinSize(wxSize(1,1)); SetMinSize(wxSize(1,1));
persist = agi::util::make_unique<PersistLocation>(this, "Video/Detached"); persist = agi::make_unique<PersistLocation>(this, "Video/Detached");
int display_index = wxDisplay::GetFromWindow(this); int display_index = wxDisplay::GetFromWindow(this);
// Ensure that the dialog is no larger than the screen // Ensure that the dialog is no larger than the screen

View File

@ -44,7 +44,7 @@
#include "utils.h" #include "utils.h"
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
@ -76,7 +76,7 @@ static void swap(wxCheckListBox *list, int idx, int sel_dir) {
DialogExport::DialogExport(agi::Context *c) DialogExport::DialogExport(agi::Context *c)
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX) : wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
, c(c) , c(c)
, exporter(agi::util::make_unique<AssExporter>(c)) , exporter(agi::make_unique<AssExporter>(c))
{ {
SetIcon(GETICON(export_menu_16)); SetIcon(GETICON(export_menu_16));
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);

View File

@ -26,7 +26,7 @@
#include "text_file_writer.h" #include "text_file_writer.h"
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
@ -214,13 +214,13 @@ agi::vfr::Framerate EbuExportSettings::GetFramerate() const {
std::unique_ptr<agi::charset::IconvWrapper> EbuExportSettings::GetTextEncoder() const { std::unique_ptr<agi::charset::IconvWrapper> EbuExportSettings::GetTextEncoder() const {
using namespace agi; using namespace agi;
switch (text_encoding) { switch (text_encoding) {
case iso6937_2: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-6937-2"); case iso6937_2: return make_unique<charset::IconvWrapper>("utf-8", "ISO-6937-2");
case iso8859_5: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-5"); case iso8859_5: return make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-5");
case iso8859_6: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-6"); case iso8859_6: return make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-6");
case iso8859_7: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-7"); case iso8859_7: return make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-7");
case iso8859_8: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-8"); case iso8859_8: return make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-8");
case utf8: return util::make_unique<charset::IconvWrapper>("utf-8", "utf-8"); case utf8: return make_unique<charset::IconvWrapper>("utf-8", "utf-8");
default: return util::make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-1"); default: return make_unique<charset::IconvWrapper>("utf-8", "ISO-8859-1");
} }
} }

View File

@ -38,7 +38,7 @@
#include <libaegisub/dispatch.h> #include <libaegisub/dispatch.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
@ -111,9 +111,9 @@ void FontsCollectorThread(AssFile *subs, agi::fs::path const& destination, FcMod
return; return;
} }
out = agi::util::make_unique<wxFFileOutputStream>(destination.wstring()); out = agi::make_unique<wxFFileOutputStream>(destination.wstring());
if (out->IsOk()) if (out->IsOk())
zip = agi::util::make_unique<wxZipOutputStream>(*out); zip = agi::make_unique<wxZipOutputStream>(*out);
if (!out->IsOk() || !zip || !zip->IsOk()) { if (!out->IsOk() || !zip || !zip->IsOk()) {
AppendText(wxString::Format(_("* Failed to open %s.\n"), destination.wstring()), 2); AppendText(wxString::Format(_("* Failed to open %s.\n"), destination.wstring()), 2);

View File

@ -28,7 +28,7 @@
#include "utils.h" #include "utils.h"
#include "validators.h" #include "validators.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <functional> #include <functional>
@ -45,7 +45,7 @@
DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace) DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace)
: wxDialog(c->parent, -1, replace ? _("Replace") : _("Find")) : wxDialog(c->parent, -1, replace ? _("Replace") : _("Find"))
, c(c) , c(c)
, settings(agi::util::make_unique<SearchReplaceSettings>()) , settings(agi::make_unique<SearchReplaceSettings>())
, has_replace(replace) , has_replace(replace)
{ {
auto recent_find(lagi_MRU_wxAS("Find")); auto recent_find(lagi_MRU_wxAS("Find"));

View File

@ -38,7 +38,7 @@
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <libaegisub/cajun/elements.h> #include <libaegisub/cajun/elements.h>
#include <libaegisub/cajun/reader.h> #include <libaegisub/cajun/reader.h>
@ -99,7 +99,7 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context)
: wxDialog(context->parent, -1, _("Shift Times")) : wxDialog(context->parent, -1, _("Shift Times"))
, context(context) , context(context)
, history_filename(config::path->Decode("?user/shift_history.json")) , history_filename(config::path->Decode("?user/shift_history.json"))
, history(agi::util::make_unique<json::Array>()) , history(agi::make_unique<json::Array>())
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this)) , timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
, selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this)) , selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this))
{ {

View File

@ -51,7 +51,7 @@
#include "validators.h" #include "validators.h"
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -153,7 +153,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
style = this->style = new AssStyle; style = this->style = new AssStyle;
} }
work = agi::util::make_unique<AssStyle>(*style); work = agi::make_unique<AssStyle>(*style);
SetIcon(GETICON(style_toolbutton_16)); SetIcon(GETICON(style_toolbutton_16));
@ -359,7 +359,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
StyleName->SetInsertionPoint(0); StyleName->SetInsertionPoint(0);
StyleName->SetInsertionPoint(-1); StyleName->SetInsertionPoint(-1);
persist = agi::util::make_unique<PersistLocation>(this, "Tool/Style Editor", true); persist = agi::make_unique<PersistLocation>(this, "Tool/Style Editor", true);
Bind(wxEVT_CHILD_FOCUS, &DialogStyleEditor::OnChildFocus, this); Bind(wxEVT_CHILD_FOCUS, &DialogStyleEditor::OnChildFocus, this);

View File

@ -53,7 +53,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/split.h> #include <libaegisub/split.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
@ -224,7 +224,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context)
SetSizerAndFit(MainSizer); SetSizerAndFit(MainSizer);
// Position window // Position window
persist = agi::util::make_unique<PersistLocation>(this, "Tool/Style Manager"); persist = agi::make_unique<PersistLocation>(this, "Tool/Style Manager");
// Populate lists // Populate lists
LoadCatalog(); LoadCatalog();
@ -334,7 +334,7 @@ void DialogStyleManager::LoadCatalog() {
// Create a default storage if there are none // Create a default storage if there are none
if (CatalogList->IsListEmpty()) { if (CatalogList->IsListEmpty()) {
Store.Load(config::path->Decode("?user/catalog/Default.sty")); Store.Load(config::path->Decode("?user/catalog/Default.sty"));
Store.push_back(agi::util::make_unique<AssStyle>()); Store.push_back(agi::make_unique<AssStyle>());
Store.Save(); Store.Save();
CatalogList->Append("Default"); CatalogList->Append("Default");
} }
@ -415,7 +415,7 @@ void DialogStyleManager::OnCopyToStorage() {
} }
} }
else { else {
Store.push_back(agi::util::make_unique<AssStyle>(*styleMap.at(selections[i]))); Store.push_back(agi::make_unique<AssStyle>(*styleMap.at(selections[i])));
copied.push_back(styleName); copied.push_back(styleName);
} }
} }

View File

@ -36,7 +36,7 @@
#include "selection_controller.h" #include "selection_controller.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/colour.h> #include <wx/colour.h>
@ -135,7 +135,7 @@ DialogStyling::DialogStyling(agi::Context *context)
SetSizerAndFit(main_sizer); SetSizerAndFit(main_sizer);
persist = agi::util::make_unique<PersistLocation>(this, "Tool/Styling Assistant"); persist = agi::make_unique<PersistLocation>(this, "Tool/Styling Assistant");
Bind(wxEVT_ACTIVATE, &DialogStyling::OnActivate, this); Bind(wxEVT_ACTIVATE, &DialogStyling::OnActivate, this);
Bind(wxEVT_CHAR_HOOK, &DialogStyling::OnCharHook, this); Bind(wxEVT_CHAR_HOOK, &DialogStyling::OnCharHook, this);

View File

@ -37,7 +37,7 @@
#include "utils.h" #include "utils.h"
#include "video_context.h" #include "video_context.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -150,7 +150,7 @@ DialogTranslation::DialogTranslation(agi::Context *c)
SetSizerAndFit(main_sizer); SetSizerAndFit(main_sizer);
persist = agi::util::make_unique<PersistLocation>(this, "Tool/Translation Assistant"); persist = agi::make_unique<PersistLocation>(this, "Tool/Translation Assistant");
Bind(wxEVT_KEY_DOWN, &DialogTranslation::OnKeyDown, this); Bind(wxEVT_KEY_DOWN, &DialogTranslation::OnKeyDown, this);

View File

@ -22,7 +22,7 @@
#include "font_file_lister_fontconfig.h" #include "font_file_lister_fontconfig.h"
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#ifdef __APPLE__ #ifdef __APPLE__
#include <libaegisub/util_osx.h> #include <libaegisub/util_osx.h>

View File

@ -63,6 +63,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
@ -176,7 +177,7 @@ public:
FrameMain::FrameMain() FrameMain::FrameMain()
: wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) : wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
, context(agi::util::make_unique<agi::Context>()) , context(agi::make_unique<agi::Context>())
{ {
StartupLog("Entering FrameMain constructor"); StartupLog("Entering FrameMain constructor");

View File

@ -21,7 +21,7 @@
#include <unordered_map> #include <unordered_map>
class AssDialogue; class AssDialogue;
class wxClientDC; class wxDC;
class wxString; class wxString;
namespace agi { struct Context; } namespace agi { struct Context; }
@ -70,4 +70,4 @@ public:
void SetVisible(bool new_value) { visible = new_value; } void SetVisible(bool new_value) { visible = new_value; }
}; };
std::vector<std::unique_ptr<GridColumn>> GetGridColumns(); std::vector<std::unique_ptr<GridColumn>> GetGridColumns();

View File

@ -23,7 +23,7 @@
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
#include <libaegisub/hotkey.h> #include <libaegisub/hotkey.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include "command/command.h" #include "command/command.h"
#include "compat.h" #include "compat.h"
@ -259,7 +259,7 @@ public:
}; };
HotkeyDataViewModel::HotkeyDataViewModel(Preferences *parent) HotkeyDataViewModel::HotkeyDataViewModel(Preferences *parent)
: root(agi::util::make_unique<HotkeyModelRoot>(this)) : root(agi::make_unique<HotkeyModelRoot>(this))
, parent(parent) , parent(parent)
{ {
} }

View File

@ -61,6 +61,7 @@
#include <libaegisub/hotkey.h> #include <libaegisub/hotkey.h>
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
@ -145,7 +146,7 @@ bool AegisubApp::OnInit() {
agi::log::log = new agi::log::LogSink; agi::log::log = new agi::log::LogSink;
#ifdef _DEBUG #ifdef _DEBUG
agi::log::log->Subscribe(agi::util::make_unique<agi::log::EmitSTDOUT>()); agi::log::log->Subscribe(agi::make_unique<agi::log::EmitSTDOUT>());
#endif #endif
// Set config file // Set config file
@ -170,7 +171,7 @@ bool AegisubApp::OnInit() {
StartupLog("Create log writer"); StartupLog("Create log writer");
auto path_log = config::path->Decode("?user/log/"); auto path_log = config::path->Decode("?user/log/");
agi::fs::CreateDirectory(path_log); agi::fs::CreateDirectory(path_log);
agi::log::log->Subscribe(agi::util::make_unique<agi::log::JsonEmitter>(path_log)); agi::log::log->Subscribe(agi::make_unique<agi::log::JsonEmitter>(path_log));
CleanCache(path_log, "*.json", 10, 100); CleanCache(path_log, "*.json", 10, 100);
StartupLog("Load user configuration"); StartupLog("Load user configuration");
@ -242,7 +243,7 @@ bool AegisubApp::OnInit() {
exception_message = _("Oops, Aegisub has crashed!\n\nAn attempt has been made to save a copy of your file to:\n\n%s\n\nAegisub will now close."); exception_message = _("Oops, Aegisub has crashed!\n\nAn attempt has been made to save a copy of your file to:\n\n%s\n\nAegisub will now close.");
// Load plugins // Load plugins
Automation4::ScriptFactory::Register(agi::util::make_unique<Automation4::LuaScriptFactory>()); Automation4::ScriptFactory::Register(agi::make_unique<Automation4::LuaScriptFactory>());
libass::CacheFonts(); libass::CacheFonts();
// Load Automation scripts // Load Automation scripts
@ -251,8 +252,8 @@ bool AegisubApp::OnInit() {
// Load export filters // Load export filters
StartupLog("Register export filters"); StartupLog("Register export filters");
AssExportFilterChain::Register(agi::util::make_unique<AssFixStylesFilter>()); AssExportFilterChain::Register(agi::make_unique<AssFixStylesFilter>());
AssExportFilterChain::Register(agi::util::make_unique<AssTransformFramerateFilter>()); AssExportFilterChain::Register(agi::make_unique<AssTransformFramerateFilter>());
StartupLog("Install PNG handler"); StartupLog("Install PNG handler");
wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxPNGHandler);

View File

@ -32,7 +32,7 @@
#include <libaegisub/json.h> #include <libaegisub/json.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <deque> #include <deque>
@ -415,7 +415,7 @@ public:
namespace menu { namespace menu {
void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) { void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) {
auto menu = agi::util::make_unique<CommandMenuBar>(c); auto menu = agi::make_unique<CommandMenuBar>(c);
for (auto const& item : get_menu(name)) { for (auto const& item : get_menu(name)) {
std::string submenu, disp; std::string submenu, disp;
read_entry(item, "submenu", &submenu); read_entry(item, "submenu", &submenu);
@ -438,7 +438,7 @@ namespace menu {
} }
std::unique_ptr<wxMenu> GetMenu(std::string const& name, agi::Context *c) { std::unique_ptr<wxMenu> GetMenu(std::string const& name, agi::Context *c) {
auto menu = agi::util::make_unique<CommandMenu>(c); auto menu = agi::make_unique<CommandMenu>(c);
build_menu(name, c, &menu->cm, menu.get()); build_menu(name, c, &menu->cm, menu.get());
menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm); menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm);

View File

@ -28,7 +28,7 @@
#include "video_provider_manager.h" #include "video_provider_manager.h"
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/combobox.h> #include <wx/combobox.h>
@ -52,7 +52,7 @@
type(std::string const& n, Preferences *p) : name(n), parent(p) { } \ type(std::string const& n, Preferences *p) : name(n), parent(p) { } \
void operator()(evttype& evt) { \ void operator()(evttype& evt) { \
evt.Skip(); \ evt.Skip(); \
parent->SetOption(agi::util::make_unique<agi::opt>(name, body));\ parent->SetOption(agi::make_unique<agi::opt>(name, body));\
} \ } \
} }

View File

@ -17,11 +17,11 @@
#include "include/aegisub/spellchecker.h" #include "include/aegisub/spellchecker.h"
#include "spellchecker_hunspell.h" #include "spellchecker_hunspell.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
std::unique_ptr<agi::SpellChecker> SpellCheckerFactory::GetSpellChecker() { std::unique_ptr<agi::SpellChecker> SpellCheckerFactory::GetSpellChecker() {
#ifdef WITH_HUNSPELL #ifdef WITH_HUNSPELL
return agi::util::make_unique<HunspellSpellChecker>(); return agi::make_unique<HunspellSpellChecker>();
#else #else
return {}; return {};
#endif #endif

View File

@ -29,7 +29,7 @@
#include <libaegisub/line_iterator.h> #include <libaegisub/line_iterator.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/range/algorithm.hpp> #include <boost/range/algorithm.hpp>
@ -198,11 +198,11 @@ void HunspellSpellChecker::OnLanguageChanged() {
LOG_I("dictionary/file") << dic; LOG_I("dictionary/file") << dic;
hunspell = agi::util::make_unique<Hunspell>(agi::fs::ShortName(aff).c_str(), agi::fs::ShortName(dic).c_str()); hunspell = agi::make_unique<Hunspell>(agi::fs::ShortName(aff).c_str(), agi::fs::ShortName(dic).c_str());
if (!hunspell) return; if (!hunspell) return;
conv = agi::util::make_unique<agi::charset::IconvWrapper>("utf-8", hunspell->get_dic_encoding()); conv = agi::make_unique<agi::charset::IconvWrapper>("utf-8", hunspell->get_dic_encoding());
rconv = agi::util::make_unique<agi::charset::IconvWrapper>(hunspell->get_dic_encoding(), "utf-8"); rconv = agi::make_unique<agi::charset::IconvWrapper>(hunspell->get_dic_encoding(), "utf-8");
userDicPath = config::path->Decode("?user/dictionaries")/str(boost::format("user_%s.dic") % language); userDicPath = config::path->Decode("?user/dictionaries")/str(boost::format("user_%s.dic") % language);
ReadUserDictionary(); ReadUserDictionary();

View File

@ -48,7 +48,7 @@
#include <libaegisub/ass/dialogue_parser.h> #include <libaegisub/ass/dialogue_parser.h>
#include <libaegisub/calltip_provider.h> #include <libaegisub/calltip_provider.h>
#include <libaegisub/spellchecker.h> #include <libaegisub/spellchecker.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
@ -83,7 +83,7 @@ enum {
SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, agi::Context *context) SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, agi::Context *context)
: ScintillaTextCtrl(parent, -1, "", wxDefaultPosition, wsize, style) : ScintillaTextCtrl(parent, -1, "", wxDefaultPosition, wsize, style)
, spellchecker(SpellCheckerFactory::GetSpellChecker()) , spellchecker(SpellCheckerFactory::GetSpellChecker())
, thesaurus(agi::util::make_unique<Thesaurus>()) , thesaurus(agi::make_unique<Thesaurus>())
, context(context) , context(context)
{ {
// Set properties // Set properties
@ -259,7 +259,7 @@ void SubsTextEditCtrl::UpdateCallTip() {
cursor_pos = pos; cursor_pos = pos;
if (!calltip_provider) if (!calltip_provider)
calltip_provider = agi::util::make_unique<agi::CalltipProvider>(); calltip_provider = agi::make_unique<agi::CalltipProvider>();
agi::Calltip new_calltip = calltip_provider->GetCalltip(tokenized_line, line_text, pos); agi::Calltip new_calltip = calltip_provider->GetCalltip(tokenized_line, line_text, pos);

View File

@ -41,7 +41,7 @@
#include "video_frame.h" #include "video_frame.h"
#include "video_provider_dummy.h" #include "video_provider_dummy.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/dcclient.h> #include <wx/dcclient.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -50,7 +50,7 @@ SubtitlesPreview::SubtitlesPreview(wxWindow *parent, wxSize size, int winStyle,
: wxWindow(parent, -1, wxDefaultPosition, size, winStyle) : wxWindow(parent, -1, wxDefaultPosition, size, winStyle)
, style(new AssStyle) , style(new AssStyle)
, back_color(col) , back_color(col)
, sub_file(agi::util::make_unique<AssFile>()) , sub_file(agi::make_unique<AssFile>())
, line(new AssDialogue) , line(new AssDialogue)
{ {
line->Text = "{\\q2}preview"; line->Text = "{\\q2}preview";
@ -93,7 +93,7 @@ void SubtitlesPreview::SetText(std::string const& text) {
void SubtitlesPreview::SetColour(agi::Color col) { void SubtitlesPreview::SetColour(agi::Color col) {
if (col != back_color) { if (col != back_color) {
back_color = col; back_color = col;
vid = agi::util::make_unique<DummyVideoProvider>(0.0, 10, bmp->GetWidth(), bmp->GetHeight(), back_color, true); vid = agi::make_unique<DummyVideoProvider>(0.0, 10, bmp->GetWidth(), bmp->GetHeight(), back_color, true);
UpdateBitmap(); UpdateBitmap();
} }
} }
@ -126,11 +126,11 @@ void SubtitlesPreview::OnSize(wxSizeEvent &evt) {
int w = evt.GetSize().GetWidth(); int w = evt.GetSize().GetWidth();
int h = evt.GetSize().GetHeight(); int h = evt.GetSize().GetHeight();
bmp = agi::util::make_unique<wxBitmap>(w, h, -1); bmp = agi::make_unique<wxBitmap>(w, h, -1);
vid = agi::util::make_unique<DummyVideoProvider>(0.0, 10, w, h, back_color, true); vid = agi::make_unique<DummyVideoProvider>(0.0, 10, w, h, back_color, true);
try { try {
if (!progress) if (!progress)
progress = agi::util::make_unique<DialogProgress>(this); progress = agi::make_unique<DialogProgress>(this);
if (!provider) if (!provider)
provider = SubtitlesProviderFactory::GetProvider(progress.get()); provider = SubtitlesProviderFactory::GetProvider(progress.get());
} }

View File

@ -54,7 +54,7 @@
#include "video_context.h" #include "video_context.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
@ -272,15 +272,15 @@ void SubtitleFormat::MergeIdentical(AssFile &file) {
void SubtitleFormat::LoadFormats() { void SubtitleFormat::LoadFormats() {
if (formats.empty()) { if (formats.empty()) {
formats.emplace_back(agi::util::make_unique<AssSubtitleFormat>()); formats.emplace_back(agi::make_unique<AssSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<Ebu3264SubtitleFormat>()); formats.emplace_back(agi::make_unique<Ebu3264SubtitleFormat>());
formats.emplace_back(agi::util::make_unique<EncoreSubtitleFormat>()); formats.emplace_back(agi::make_unique<EncoreSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<MKVSubtitleFormat>()); formats.emplace_back(agi::make_unique<MKVSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<MicroDVDSubtitleFormat>()); formats.emplace_back(agi::make_unique<MicroDVDSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<SRTSubtitleFormat>()); formats.emplace_back(agi::make_unique<SRTSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<TTXTSubtitleFormat>()); formats.emplace_back(agi::make_unique<TTXTSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<TXTSubtitleFormat>()); formats.emplace_back(agi::make_unique<TXTSubtitleFormat>());
formats.emplace_back(agi::util::make_unique<TranStationSubtitleFormat>()); formats.emplace_back(agi::make_unique<TranStationSubtitleFormat>());
} }
} }

View File

@ -43,7 +43,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/scoped_ptr.h> #include <libaegisub/scoped_ptr.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <libaegisub/vfr.h> #include <libaegisub/vfr.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -139,7 +139,7 @@ std::vector<std::string> List() {
} }
std::unique_ptr<SubtitlesProvider> Create(std::string const& name, agi::BackgroundRunner *) { std::unique_ptr<SubtitlesProvider> Create(std::string const& name, agi::BackgroundRunner *) {
return agi::util::make_unique<CSRISubtitlesProvider>(name); return agi::make_unique<CSRISubtitlesProvider>(name);
} }
} }
#endif // WITH_CSRI #endif // WITH_CSRI

View File

@ -45,6 +45,7 @@
#include <libaegisub/background_runner.h> #include <libaegisub/background_runner.h>
#include <libaegisub/dispatch.h> #include <libaegisub/dispatch.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <atomic> #include <atomic>
@ -227,7 +228,7 @@ void LibassSubtitlesProvider::DrawSubtitles(VideoFrame &frame,double time) {
namespace libass { namespace libass {
std::unique_ptr<SubtitlesProvider> Create(std::string const&, agi::BackgroundRunner *br) { std::unique_ptr<SubtitlesProvider> Create(std::string const&, agi::BackgroundRunner *br) {
return agi::util::make_unique<LibassSubtitlesProvider>(br); return agi::make_unique<LibassSubtitlesProvider>(br);
} }
void CacheFonts() { void CacheFonts() {

View File

@ -17,7 +17,7 @@
#include "text_file_reader.h" #include "text_file_reader.h"
#include <libaegisub/file_mapping.h> #include <libaegisub/file_mapping.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -25,8 +25,8 @@
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>
TextFileReader::TextFileReader(agi::fs::path const& filename, std::string encoding, bool trim) TextFileReader::TextFileReader(agi::fs::path const& filename, std::string encoding, bool trim)
: file(agi::util::make_unique<agi::read_file_mapping>(filename)) : file(agi::make_unique<agi::read_file_mapping>(filename))
, stream(agi::util::make_unique<boost::interprocess::ibufferstream>(file->read(), file->size())) , stream(agi::make_unique<boost::interprocess::ibufferstream>(file->read(), file->size()))
, trim(trim) , trim(trim)
, iter(agi::line_iterator<std::string>(*stream, encoding)) , iter(agi::line_iterator<std::string>(*stream, encoding))
{ {

View File

@ -25,7 +25,7 @@
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -37,7 +37,7 @@ TextFileWriter::TextFileWriter(agi::fs::path const& filename, std::string encodi
if (encoding.empty()) if (encoding.empty())
encoding = OPT_GET("App/Save Charset")->GetString(); encoding = OPT_GET("App/Save Charset")->GetString();
if (boost::iequals(encoding, "utf-8")) if (boost::iequals(encoding, "utf-8"))
conv = agi::util::make_unique<agi::charset::IconvWrapper>("utf-8", encoding.c_str(), true); conv = agi::make_unique<agi::charset::IconvWrapper>("utf-8", encoding.c_str(), true);
try { try {
// Write the BOM // Write the BOM

View File

@ -32,7 +32,7 @@
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/thesaurus.h> #include <libaegisub/thesaurus.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
Thesaurus::Thesaurus() Thesaurus::Thesaurus()
: lang_listener(OPT_SUB("Tool/Thesaurus/Language", &Thesaurus::OnLanguageChanged, this)) : lang_listener(OPT_SUB("Tool/Thesaurus/Language", &Thesaurus::OnLanguageChanged, this))
@ -100,7 +100,7 @@ void Thesaurus::OnLanguageChanged() {
agi::dispatch::Background().Async([=]{ agi::dispatch::Background().Async([=]{
try { try {
auto thes = agi::util::make_unique<agi::Thesaurus>(dat, idx); auto thes = agi::make_unique<agi::Thesaurus>(dat, idx);
agi::dispatch::Main().Sync([&thes, this]{ agi::dispatch::Main().Sync([&thes, this]{
impl = std::move(thes); impl = std::move(thes);
}); });

View File

@ -31,7 +31,7 @@
#include <libaegisub/json.h> #include <libaegisub/json.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/signal.h> #include <libaegisub/signal.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>

View File

@ -54,7 +54,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/keyframe.h> #include <libaegisub/keyframe.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -117,7 +117,7 @@ void VideoContext::SetVideo(const agi::fs::path &filename) {
if (!progress) if (!progress)
progress = new DialogProgress(context->parent); progress = new DialogProgress(context->parent);
auto old_matrix = context->ass->GetScriptInfo("YCbCr Matrix"); auto old_matrix = context->ass->GetScriptInfo("YCbCr Matrix");
provider = agi::util::make_unique<ThreadedFrameSource>(filename, old_matrix, this, progress); provider = agi::make_unique<ThreadedFrameSource>(filename, old_matrix, this, progress);
video_provider = provider->GetVideoProvider(); video_provider = provider->GetVideoProvider();
video_filename = filename; video_filename = filename;

View File

@ -51,7 +51,7 @@
#include "video_frame.h" #include "video_frame.h"
#include "visual_tool.h" #include "visual_tool.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
@ -98,7 +98,7 @@ VideoDisplay::VideoDisplay(
, toolBar(visualSubToolBar) , toolBar(visualSubToolBar)
, zoomBox(zoomBox) , zoomBox(zoomBox)
, freeSize(freeSize) , freeSize(freeSize)
, retina_helper(agi::util::make_unique<RetinaHelper>(this)) , retina_helper(agi::make_unique<RetinaHelper>(this))
, scale_factor(retina_helper->GetScaleFactor()) , scale_factor(retina_helper->GetScaleFactor())
, scale_factor_connection(retina_helper->AddScaleFactorListener([=](int new_scale_factor) { , scale_factor_connection(retina_helper->AddScaleFactorListener([=](int new_scale_factor) {
double new_zoom = zoomValue * new_scale_factor / scale_factor; double new_zoom = zoomValue * new_scale_factor / scale_factor;
@ -150,7 +150,7 @@ bool VideoDisplay::InitContext() {
return false; return false;
if (!glContext) if (!glContext)
glContext = agi::util::make_unique<wxGLContext>(this); glContext = agi::make_unique<wxGLContext>(this);
SetCurrent(*glContext); SetCurrent(*glContext);
return true; return true;
@ -166,7 +166,7 @@ void VideoDisplay::Render() try {
return; return;
if (!videoOut) if (!videoOut)
videoOut = agi::util::make_unique<VideoOutGL>(); videoOut = agi::make_unique<VideoOutGL>();
if (!tool) if (!tool)
cmd::call("video/tool/cross", con); cmd::call("video/tool/cross", con);

View File

@ -43,7 +43,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <mutex> #include <mutex>
@ -310,6 +310,6 @@ std::shared_ptr<VideoFrame> AvisynthVideoProvider::GetFrame(int n) {
namespace agi { class BackgroundRunner; } namespace agi { class BackgroundRunner; }
std::unique_ptr<VideoProvider> CreateAvisynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { std::unique_ptr<VideoProvider> CreateAvisynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) {
return agi::util::make_unique<AvisynthVideoProvider>(path, colormatrix); return agi::make_unique<AvisynthVideoProvider>(path, colormatrix);
} }
#endif // HAVE_AVISYNTH #endif // HAVE_AVISYNTH

View File

@ -19,7 +19,7 @@
#include "options.h" #include "options.h"
#include "video_frame.h" #include "video_frame.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <list> #include <list>
@ -93,5 +93,5 @@ std::shared_ptr<VideoFrame> VideoProviderCache::GetFrame(int n) {
} }
std::unique_ptr<VideoProvider> CreateCacheVideoProvider(std::unique_ptr<VideoProvider> parent) { std::unique_ptr<VideoProvider> CreateCacheVideoProvider(std::unique_ptr<VideoProvider> parent) {
return agi::util::make_unique<VideoProviderCache>(std::move(parent)); return agi::make_unique<VideoProviderCache>(std::move(parent));
} }

View File

@ -39,6 +39,7 @@
#include <libaegisub/color.h> #include <libaegisub/color.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
@ -121,5 +122,5 @@ std::unique_ptr<VideoProvider> CreateDummyVideoProvider(agi::fs::path const& fil
bool pattern = toks[i] == "c"; bool pattern = toks[i] == "c";
return agi::util::make_unique<DummyVideoProvider>(fps, frames, width, height, agi::Color(red, green, blue), pattern); return agi::make_unique<DummyVideoProvider>(fps, frames, width, height, agi::Color(red, green, blue), pattern);
} }

View File

@ -43,7 +43,7 @@
#include "video_frame.h" #include "video_frame.h"
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <wx/choicdlg.h> #include <wx/choicdlg.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@ -285,7 +285,7 @@ std::shared_ptr<VideoFrame> FFmpegSourceVideoProvider::GetFrame(int n) {
} }
std::unique_ptr<VideoProvider> CreateFFmpegSourceVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *br) { std::unique_ptr<VideoProvider> CreateFFmpegSourceVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *br) {
return agi::util::make_unique<FFmpegSourceVideoProvider>(path, colormatrix, br); return agi::make_unique<FFmpegSourceVideoProvider>(path, colormatrix, br);
} }
#endif /* WITH_FFMS2 */ #endif /* WITH_FFMS2 */

View File

@ -22,7 +22,7 @@
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>

View File

@ -41,6 +41,7 @@
#include <libaegisub/file_mapping.h> #include <libaegisub/file_mapping.h>
#include <libaegisub/fs.h> #include <libaegisub/fs.h>
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/util.h> #include <libaegisub/util.h>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@ -446,5 +447,5 @@ std::shared_ptr<VideoFrame> YUV4MPEGVideoProvider::GetFrame(int n) {
namespace agi { class BackgroundRunner; } namespace agi { class BackgroundRunner; }
std::unique_ptr<VideoProvider> CreateYUV4MPEGVideoProvider(agi::fs::path const& path, std::string const&, agi::BackgroundRunner *) { std::unique_ptr<VideoProvider> CreateYUV4MPEGVideoProvider(agi::fs::path const& path, std::string const&, agi::BackgroundRunner *) {
return agi::util::make_unique<YUV4MPEGVideoProvider>(path); return agi::make_unique<YUV4MPEGVideoProvider>(path);
} }

View File

@ -26,13 +26,13 @@
#include "video_display.h" #include "video_display.h"
#include <libaegisub/color.h> #include <libaegisub/color.h>
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <boost/format.hpp> #include <boost/format.hpp>
VisualToolCross::VisualToolCross(VideoDisplay *parent, agi::Context *context) VisualToolCross::VisualToolCross(VideoDisplay *parent, agi::Context *context)
: VisualTool<VisualDraggableFeature>(parent, context) : VisualTool<VisualDraggableFeature>(parent, context)
, gl_text(agi::util::make_unique<OpenGLText>()) , gl_text(agi::make_unique<OpenGLText>())
{ {
parent->SetCursor(wxCursor(wxCURSOR_BLANK)); parent->SetCursor(wxCursor(wxCURSOR_BLANK));
} }

View File

@ -30,7 +30,7 @@
#include "video_context.h" #include "video_context.h"
#include "video_display.h" #include "video_display.h"
#include <libaegisub/util.h> #include <libaegisub/make_unique.h>
#include <algorithm> #include <algorithm>
#include <boost/format.hpp> #include <boost/format.hpp>
@ -230,7 +230,7 @@ void VisualToolDrag::MakeFeatures(AssDialogue *diag, feature_list::iterator pos)
Vector2D p1 = FromScriptCoords(GetLinePosition(diag)); Vector2D p1 = FromScriptCoords(GetLinePosition(diag));
// Create \pos feature // Create \pos feature
auto feat = agi::util::make_unique<Feature>(); auto feat = agi::make_unique<Feature>();
auto parent = feat.get(); auto parent = feat.get();
feat->pos = p1; feat->pos = p1;
feat->type = DRAG_START; feat->type = DRAG_START;
@ -245,7 +245,7 @@ void VisualToolDrag::MakeFeatures(AssDialogue *diag, feature_list::iterator pos)
// Create move destination feature // Create move destination feature
if (GetLineMove(diag, p1, p2, t1, t2)) { if (GetLineMove(diag, p1, p2, t1, t2)) {
feat = agi::util::make_unique<Feature>(); feat = agi::make_unique<Feature>();
feat->pos = FromScriptCoords(p2); feat->pos = FromScriptCoords(p2);
feat->layer = 1; feat->layer = 1;
feat->type = DRAG_END; feat->type = DRAG_END;
@ -261,7 +261,7 @@ void VisualToolDrag::MakeFeatures(AssDialogue *diag, feature_list::iterator pos)
// Create org feature // Create org feature
if (Vector2D org = GetLineOrigin(diag)) { if (Vector2D org = GetLineOrigin(diag)) {
feat = agi::util::make_unique<Feature>(); feat = agi::make_unique<Feature>();
feat->pos = FromScriptCoords(org); feat->pos = FromScriptCoords(org);
feat->layer = -1; feat->layer = -1;
feat->type = DRAG_ORIGIN; feat->type = DRAG_ORIGIN;

Some files were not shown because too many files have changed in this diff Show More