diff --git a/aegisub/libaegisub/common/cajun/writer.cpp b/aegisub/libaegisub/common/cajun/writer.cpp index 998d23ff4708f4732f36ff2ed19efd66a0c6a35e..61a12163e6f51aca18257c7e97d69d8e92f82f69 100644 --- a/aegisub/libaegisub/common/cajun/writer.cpp +++ b/aegisub/libaegisub/common/cajun/writer.cpp @@ -20,14 +20,9 @@ TODO: */ -namespace json -{ +namespace json { -Writer::Writer(std::ostream& ostr) -: m_ostr(ostr) -, tab_depth(0) -{ -} +Writer::Writer(std::ostream& ostr) : m_ostr(ostr) { } void Writer::Write(Array const& array) { if (array.empty()) diff --git a/aegisub/libaegisub/common/charset_conv.cpp b/aegisub/libaegisub/common/charset_conv.cpp index 0865ae4ea46638fc076aa0b06d801decb67bd89a..9bd77bb78f8cbc4c30d0fce2cfbeb720ae7c592a 100644 --- a/aegisub/libaegisub/common/charset_conv.cpp +++ b/aegisub/libaegisub/common/charset_conv.cpp @@ -285,9 +285,7 @@ namespace { namespace agi { namespace charset { IconvWrapper::IconvWrapper(const char* sourceEncoding, const char* destEncoding, bool enableSubst) -: toNulLen(0) -, fromNulLen(0) -, conv(get_converter(enableSubst, sourceEncoding, destEncoding)) +: conv(get_converter(enableSubst, sourceEncoding, destEncoding)) { // These need to be set only after we verify that the source and dest // charsets are valid diff --git a/aegisub/libaegisub/common/color.cpp b/aegisub/libaegisub/common/color.cpp index 730e49adc8ea28118cd0bb6a976e24dbc1a2119c..1822779115b1cd8b11a77c599e466e9555902af7 100644 --- a/aegisub/libaegisub/common/color.cpp +++ b/aegisub/libaegisub/common/color.cpp @@ -23,15 +23,11 @@ namespace agi { -Color::Color() : r(0), g(0), b(0), a(0) { } - Color::Color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) : r(r), g(g), b(b), a(a) { } -Color::Color(std::string const& str) -: r(0), g(0), b(0), a(0) -{ +Color::Color(std::string const& str) { parser::parse(*this, str); } diff --git a/aegisub/libaegisub/common/log.cpp b/aegisub/libaegisub/common/log.cpp index 46aace6b15fb0615c9934b41523fcb4e5c7e462e..20bb57281e8749656dd889dc9490e8ee783728cc 100644 --- a/aegisub/libaegisub/common/log.cpp +++ b/aegisub/libaegisub/common/log.cpp @@ -44,10 +44,7 @@ LogSink *log; /// Keep this ordered the same as Severity const char *Severity_ID = "EAWID"; -LogSink::LogSink() -: messages(250) -, queue(dispatch::Create()) -{ } +LogSink::LogSink() : queue(dispatch::Create()) { } LogSink::~LogSink() { // The destructor for emitters may try to log messages, so disable all the @@ -86,13 +83,8 @@ decltype(LogSink::messages) LogSink::GetMessages() const { Message::Message(const char *section, Severity severity, const char *file, const char *func, int line) : msg(buffer, sizeof buffer) +, sm{section, severity, file, func, line, util::time_log(), ""} { - sm.section = section; - sm.severity = severity; - sm.file = file; - sm.func = func; - sm.line = line; - sm.tv = util::time_log(); } Message::~Message() { diff --git a/aegisub/libaegisub/common/vfr.cpp b/aegisub/libaegisub/common/vfr.cpp index 252c1f554413f12eef84f4a46f0e648fca69b795..15dadf99a0d362570732dda6fa6049b6a86bd252 100644 --- a/aegisub/libaegisub/common/vfr.cpp +++ b/aegisub/libaegisub/common/vfr.cpp @@ -151,8 +151,6 @@ namespace vfr { Framerate::Framerate(double fps) : denominator(default_denominator) , numerator(int64_t(fps * denominator)) -, last(0) -, drop(false) { if (fps < 0.) throw BadFPS("FPS must be greater than zero"); if (fps > 1000.) throw BadFPS("FPS must not be greater than 1000"); @@ -162,7 +160,6 @@ Framerate::Framerate(double fps) Framerate::Framerate(int64_t numerator, int64_t denominator, bool drop) : denominator(denominator) , numerator(numerator) -, last(0) , drop(drop && numerator % denominator != 0) { if (numerator <= 0 || denominator <= 0) @@ -181,14 +178,12 @@ void Framerate::SetFromTimecodes() { Framerate::Framerate(std::vector<int> timecodes) : timecodes(std::move(timecodes)) -, drop(false) { SetFromTimecodes(); } Framerate::Framerate(std::initializer_list<int> timecodes) : timecodes(timecodes) -, drop(false) { SetFromTimecodes(); } @@ -203,8 +198,6 @@ void Framerate::swap(Framerate &right) throw() { Framerate::Framerate(fs::path const& filename) : denominator(default_denominator) -, numerator(0) -, drop(false) { auto file = agi::io::Open(filename); auto encoding = agi::charset::Detect(filename); diff --git a/aegisub/libaegisub/include/libaegisub/cajun/writer.h b/aegisub/libaegisub/include/libaegisub/cajun/writer.h index 0eb4c94a2f76937f1f2d89c6af33bc19241a31fc..f663927e3c7841df382dc32135c3ebfaa7619810 100644 --- a/aegisub/libaegisub/include/libaegisub/cajun/writer.h +++ b/aegisub/libaegisub/include/libaegisub/cajun/writer.h @@ -35,7 +35,7 @@ class Writer : private ConstVisitor { void Visit(const Null& null) override; std::ostream& m_ostr; - int tab_depth; + int tab_depth = 0; public: template <typename ElementTypeT> @@ -51,5 +51,4 @@ inline std::ostream& operator <<(std::ostream& ostr, UnknownElement const& eleme return ostr; } - } // End namespace diff --git a/aegisub/libaegisub/include/libaegisub/charset_conv.h b/aegisub/libaegisub/include/libaegisub/charset_conv.h index 4d7352eb976c22a721bca0bd9be0cf227a6dd853..fb7048ed29fcd64a197c56aabc7ef1e34790709b 100644 --- a/aegisub/libaegisub/include/libaegisub/charset_conv.h +++ b/aegisub/libaegisub/include/libaegisub/charset_conv.h @@ -46,8 +46,8 @@ struct Converter { /// @brief A C++ wrapper for iconv class IconvWrapper { - size_t toNulLen; - size_t fromNulLen; + size_t toNulLen = 0; + size_t fromNulLen = 0; std::unique_ptr<Converter> conv; public: diff --git a/aegisub/libaegisub/include/libaegisub/color.h b/aegisub/libaegisub/include/libaegisub/color.h index d84427e517a30efa2c82db5df6af286ed5c5e6dd..b45b58fb93c24b85bea2bfa0e1a6f8b4ed9eeaa0 100644 --- a/aegisub/libaegisub/include/libaegisub/color.h +++ b/aegisub/libaegisub/include/libaegisub/color.h @@ -18,12 +18,12 @@ namespace agi { struct Color { - unsigned char r; ///< Red component - unsigned char g; ///< Green component - unsigned char b; ///< Blue component - unsigned char a; ///< Alpha component + unsigned char r = 0; ///< Red component + unsigned char g = 0; ///< Green component + unsigned char b = 0; ///< Blue component + unsigned char a = 0; ///< Alpha component - Color(); + Color() { } Color(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0); Color(std::string const& str); diff --git a/aegisub/libaegisub/include/libaegisub/log.h b/aegisub/libaegisub/include/libaegisub/log.h index 3d6e72304578aa4459da2c614bc307e4949becce..26bdb801daf4c84b42dfee692eda7f9ea7183d83 100644 --- a/aegisub/libaegisub/include/libaegisub/log.h +++ b/aegisub/libaegisub/include/libaegisub/log.h @@ -83,7 +83,7 @@ class Emitter; /// Log sink, single destination for all messages class LogSink { - boost::circular_buffer<SinkMessage> messages; + boost::circular_buffer<SinkMessage> messages{250}; std::unique_ptr<dispatch::Queue> queue; /// List of pointers to emitters diff --git a/aegisub/libaegisub/include/libaegisub/vfr.h b/aegisub/libaegisub/include/libaegisub/vfr.h index b8cc8cdd4221cb630f74f0976ea1d9d9b39d2a33..d38edfdac3e4ee73b4e7b08d8298092f81b70df8 100644 --- a/aegisub/libaegisub/include/libaegisub/vfr.h +++ b/aegisub/libaegisub/include/libaegisub/vfr.h @@ -64,24 +64,24 @@ class Framerate { /// Denominator of the FPS /// /// For v1 VFR, the assumed FPS is used, for v2 the average FPS - int64_t denominator; + int64_t denominator = 0; /// Numerator of the FPS /// /// For v1 VFR, the assumed FPS is used, for v2 the average FPS - int64_t numerator; + int64_t numerator = 0; /// Unrounded frame-seconds of the final frame in timecodes. For CFR and v2, /// this is simply frame count * denominator, but for v1 it's the /// "unrounded" frame count, since override ranges generally don't exactly /// cover timebase-unit ranges of time. This is needed to match mkvmerge's /// rounding past the end of the final override range. - int64_t last; + int64_t last = 0; /// Start time in milliseconds of each frame std::vector<int> timecodes; /// Does this frame rate need drop frames and have them enabled? - bool drop; + bool drop = false; /// Set FPS properties from the timecodes vector void SetFromTimecodes(); diff --git a/aegisub/src/ass_dialogue.cpp b/aegisub/src/ass_dialogue.cpp index 6c86fe502feb8dd5101fe2ba799ea99c80126f6f..19f9568e22b5b4dd0a08d05049139ae7af87c9ef 100644 --- a/aegisub/src/ass_dialogue.cpp +++ b/aegisub/src/ass_dialogue.cpp @@ -55,11 +55,6 @@ static int next_id = 0; AssDialogue::AssDialogue() : Id(++next_id) -, Comment(false) -, Layer(0) -, Start(0) -, End(5000) -, Style("Default") { memset(Margin, 0, sizeof Margin); } diff --git a/aegisub/src/ass_dialogue.h b/aegisub/src/ass_dialogue.h index 530dae808ada5dd42ab13b5164e25599d313ae37..85b5a6f7160a5c7774f4c6ea0e2cd57ba401d984 100644 --- a/aegisub/src/ass_dialogue.h +++ b/aegisub/src/ass_dialogue.h @@ -136,17 +136,17 @@ public: const int Id; /// Is this a comment line? - bool Comment; + bool Comment = false; /// Layer number - int Layer; + int Layer = 0; /// Margins: 0 = Left, 1 = Right, 2 = Top (Vertical) int Margin[3]; /// Starting time - AssTime Start; + AssTime Start = 0; /// Ending time - AssTime End; + AssTime End = 5000; /// Style name - boost::flyweight<std::string> Style; + boost::flyweight<std::string> Style{ "Default" }; /// Actor name boost::flyweight<std::string> Actor; /// Effect name diff --git a/aegisub/src/ass_exporter.cpp b/aegisub/src/ass_exporter.cpp index 12d02558ed4e7ef10846d1cb8a0bb0cd368c95b3..fa2da55fe5d673378fb27200c0efa28df7efd1be 100644 --- a/aegisub/src/ass_exporter.cpp +++ b/aegisub/src/ass_exporter.cpp @@ -45,11 +45,7 @@ #include <memory> #include <wx/sizer.h> -AssExporter::AssExporter(agi::Context *c) -: c(c) -, is_default(true) -{ -} +AssExporter::AssExporter(agi::Context *c) : c(c) { } void AssExporter::DrawSettings(wxWindow *parent, wxSizer *target_sizer) { is_default = false; diff --git a/aegisub/src/ass_exporter.h b/aegisub/src/ass_exporter.h index 7afcf50accd73f3b9b1598ffca48809b7f2a2ae7..6c2670046084d6b7b01495dbb72869bdaaaf9952 100644 --- a/aegisub/src/ass_exporter.h +++ b/aegisub/src/ass_exporter.h @@ -58,7 +58,7 @@ class AssExporter { /// Have the config windows been created, or should filters simply use /// their default settings - bool is_default; + bool is_default = true; public: AssExporter(agi::Context *c); diff --git a/aegisub/src/ass_karaoke.cpp b/aegisub/src/ass_karaoke.cpp index 90ffc7c81fa4bb4f6164adfd1f5e1bdd62164bb2..b22b9e48f27a40a81941db1ac239f3887c62d824 100644 --- a/aegisub/src/ass_karaoke.cpp +++ b/aegisub/src/ass_karaoke.cpp @@ -50,9 +50,7 @@ std::string AssKaraoke::Syllable::GetText(bool k_tag) const { } -AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize) -: no_announce(false) -{ +AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize) { if (line) SetLine(line, auto_split, normalize); } diff --git a/aegisub/src/ass_karaoke.h b/aegisub/src/ass_karaoke.h index 2ff8161d45055417a32d032551d4dc34e89cb7d3..a612a4150ae821b928236c2cf332dbc5837c7282 100644 --- a/aegisub/src/ass_karaoke.h +++ b/aegisub/src/ass_karaoke.h @@ -50,7 +50,7 @@ public: private: std::vector<Syllable> syls; - bool no_announce; + bool no_announce = false; agi::signal::Signal<> AnnounceSyllablesChanged; void ParseSyllables(AssDialogue *line, Syllable &syl); diff --git a/aegisub/src/ass_override.cpp b/aegisub/src/ass_override.cpp index d6a0fe85a0280320c8960fb5aa0b6371a264d075..55bffde9742a092f99ede967ba309e75ebd9719e 100644 --- a/aegisub/src/ass_override.cpp +++ b/aegisub/src/ass_override.cpp @@ -54,7 +54,6 @@ using namespace boost::adaptors; AssOverrideParameter::AssOverrideParameter(VariableDataType type, AssParameterClass classification) : type(type) , classification(classification) -, omitted(true) { } diff --git a/aegisub/src/ass_override.h b/aegisub/src/ass_override.h index 0eb94c099590e967ae44644a2a434ec7e2074b29..9e2119c48371dcbaaca59c212c46c1276c431292 100644 --- a/aegisub/src/ass_override.h +++ b/aegisub/src/ass_override.h @@ -77,7 +77,7 @@ public: AssParameterClass classification; /// Is this parameter actually present? - bool omitted; + bool omitted = true; VariableDataType GetType() const { return type; } template<class T> void Set(T param); diff --git a/aegisub/src/ass_parser.cpp b/aegisub/src/ass_parser.cpp index 2663b63a9cc6670c30dea7b5634993aa7dd72f8e..883142b5ef870e49f74a28a046c79f532d4ab303 100644 --- a/aegisub/src/ass_parser.cpp +++ b/aegisub/src/ass_parser.cpp @@ -31,7 +31,6 @@ AssParser::AssParser(AssFile *target, int version) : target(target) , version(version) -, attach(nullptr) , state(&AssParser::ParseScriptInfoLine) { std::fill(begin(insertion_positions), end(insertion_positions), nullptr); diff --git a/aegisub/src/ass_style.cpp b/aegisub/src/ass_style.cpp index 9781d927ccb8fc608d778129900a076b748b55bb..88f55192924cd0d208e6c6c3b9fcd086c54cc622 100644 --- a/aegisub/src/ass_style.cpp +++ b/aegisub/src/ass_style.cpp @@ -49,26 +49,7 @@ #include <wx/intl.h> -AssStyle::AssStyle() -: name("Default") -, font("Arial") -, fontsize(20.) -, primary(255, 255, 255) -, secondary(255, 0, 0) -, bold(false) -, italic(false) -, underline(false) -, strikeout(false) -, scalex(100.) -, scaley(100.) -, spacing(0.) -, angle(0.) -, borderstyle(1) -, outline_w(2.) -, shadow_w(2.) -, alignment(2) -, encoding(1) -{ +AssStyle::AssStyle() { std::fill(Margin.begin(), Margin.end(), 10); UpdateData(); diff --git a/aegisub/src/ass_style.h b/aegisub/src/ass_style.h index ead95b777966fe383d1d2c5abd5552347100b4d3..aa4af02d44804a56e5cdf4a6baf0940fbdd5a9d9 100644 --- a/aegisub/src/ass_style.h +++ b/aegisub/src/ass_style.h @@ -43,30 +43,30 @@ class AssStyle : public AssEntry { std::string data; public: - std::string name; ///< Name of the style; must be case-insensitively unique within a file despite being case-sensitive - std::string font; ///< Font face name - double fontsize; ///< Font size + std::string name = "Default"; ///< Name of the style; must be case-insensitively unique within a file despite being case-sensitive + std::string font = "Arial"; ///< Font face name + double fontsize = 20.; ///< Font size - agi::Color primary; ///< Default text color - agi::Color secondary; ///< Text color for not-yet-reached karaoke syllables - agi::Color outline; ///< Outline color - agi::Color shadow; ///< Shadow color + agi::Color primary{ 255, 255, 255 }; ///< Default text color + agi::Color secondary{ 255, 0, 0 }; ///< Text color for not-yet-reached karaoke syllables + agi::Color outline{ 0, 0, 0 }; ///< Outline color + agi::Color shadow{ 0, 0, 0 }; ///< Shadow color - bool bold; - bool italic; - bool underline; - bool strikeout; + bool bold = false; + bool italic = false; + bool underline = false; + bool strikeout = false; - double scalex; ///< Font x scale with 100 = 100% - double scaley; ///< Font y scale with 100 = 100% - double spacing; ///< Additional spacing between characters in pixels - double angle; ///< Counterclockwise z rotation in degrees - int borderstyle; ///< 1: Normal; 3: Opaque box; others are unused in Aegisub - double outline_w; ///< Outline width in pixels - double shadow_w; ///< Shadow distance in pixels - int alignment; ///< \an-style line alignment - std::array<int, 3> Margin; ///< Left/Right/Vertical - int encoding; ///< ASS font encoding needed for some non-unicode fonts + double scalex = 100.; ///< Font x scale with 100 = 100% + double scaley = 100.; ///< Font y scale with 100 = 100% + double spacing = 0.; ///< Additional spacing between characters in pixels + double angle = 0.1; ///< Counterclockwise z rotation in degrees + int borderstyle = 1; ///< 1: Normal; 3: Opaque box; others are unused in Aegisub + double outline_w = 2.; ///< Outline width in pixels + double shadow_w = 2.; ///< Shadow distance in pixels + int alignment = 2; ///< \an-style line alignment + std::array<int, 3> Margin; ///< Left / Right / Vertical + int encoding = 1; ///< ASS font encoding needed for some non-unicode fonts /// Update the raw line data after one or more of the public members have been changed void UpdateData(); diff --git a/aegisub/src/ass_time.cpp b/aegisub/src/ass_time.cpp index 589ceef259fbd43cfae390831ae0204dc17cba40..57fd968526e080b3ab3cc4f587ab9fc904dae673 100644 --- a/aegisub/src/ass_time.cpp +++ b/aegisub/src/ass_time.cpp @@ -35,9 +35,7 @@ AssTime::AssTime(int time) : time(mid(0, time, 10 * 60 * 60 * 1000 - 1)) { } -AssTime::AssTime(std::string const& text) -: time(0) -{ +AssTime::AssTime(std::string const& text) { int after_decimal = -1; int current = 0; for (char c : text | boost::adaptors::filtered(boost::is_any_of(",.0123456789:"))) { diff --git a/aegisub/src/ass_time.h b/aegisub/src/ass_time.h index 6210df06ab6721cffbfb52c6a5eb4c7a8c284b53..2e04a7f66e84d7fead51c07622ae8226e34d3ed1 100644 --- a/aegisub/src/ass_time.h +++ b/aegisub/src/ass_time.h @@ -27,7 +27,7 @@ class AssTime { /// Time in milliseconds - int time; + int time = 0; public: AssTime(int ms = 0); diff --git a/aegisub/src/audio_box.cpp b/aegisub/src/audio_box.cpp index 57b9ae3efd1df547c023be6f1e0f61b87579555a..c474e7f4c7b6619356e947772a271b34953980f9 100644 --- a/aegisub/src/audio_box.cpp +++ b/aegisub/src/audio_box.cpp @@ -83,7 +83,6 @@ AudioBox::AudioBox(wxWindow *parent, agi::Context *context) , HorizontalZoom(new wxSlider(panel, Audio_Horizontal_Zoom, -OPT_GET("Audio/Zoom/Horizontal")->GetInt(), -50, 30, wxDefaultPosition, wxSize(-1, 20), wxSL_VERTICAL|wxSL_BOTH)) , VerticalZoom(new wxSlider(panel, Audio_Vertical_Zoom, OPT_GET("Audio/Zoom/Vertical")->GetInt(), 0, 100, wxDefaultPosition, wxSize(-1, 20), wxSL_VERTICAL|wxSL_BOTH|wxSL_INVERSE)) , VolumeBar(new wxSlider(panel, Audio_Volume, OPT_GET("Audio/Volume")->GetInt(), 0, 100, wxDefaultPosition, wxSize(-1, 20), wxSL_VERTICAL|wxSL_BOTH|wxSL_INVERSE)) -, mouse_zoom_accum(0) { SetSashVisible(wxSASH_BOTTOM, true); Bind(wxEVT_SASH_DRAGGED, &AudioBox::OnSashDrag, this); diff --git a/aegisub/src/audio_box.h b/aegisub/src/audio_box.h index 7de60aac049e58106592e4f6e970603d1271d6fd..ee5ca6078692e78860f903813fa8ea6d8e8f417c 100644 --- a/aegisub/src/audio_box.h +++ b/aegisub/src/audio_box.h @@ -74,7 +74,7 @@ class AudioBox : public wxSashWindow { wxSlider *VolumeBar; // Mouse wheel zoom accumulator - int mouse_zoom_accum; + int mouse_zoom_accum = 0; void SetHorizontalZoom(int new_zoom); void OnAudioOpen(); diff --git a/aegisub/src/audio_display.cpp b/aegisub/src/audio_display.cpp index 4c8a4ae2f15359dd84674dbf5399a7b0a300d174..5d33fc6af64bbfe0a831717310ac1ec757245e77 100644 --- a/aegisub/src/audio_display.cpp +++ b/aegisub/src/audio_display.cpp @@ -559,14 +559,6 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C , controller(controller) , scrollbar(agi::util::make_unique<AudioDisplayScrollbar>(this)) , timeline(agi::util::make_unique<AudioDisplayTimeline>(this)) -, dragged_object(nullptr) -, scroll_left(0) -, pixel_audio_width(0) -, ms_per_pixel(0.0) -, scale_amplitude(1.0f) -, audio_top(0) -, audio_height(0) -, track_cursor_pos(-1) { style_ranges[0] = AudioStyle_Normal; diff --git a/aegisub/src/audio_display.h b/aegisub/src/audio_display.h index 1fe34f7c88a41d2bd70fd728c964c35984fe9565..ecf9b6ec96b60a860a111189035331098051db03 100644 --- a/aegisub/src/audio_display.h +++ b/aegisub/src/audio_display.h @@ -124,7 +124,7 @@ class AudioDisplay: public wxWindow { /// Current object on display being dragged, if any - AudioDisplayInteractionObject *dragged_object; + AudioDisplayInteractionObject *dragged_object = nullptr; /// Change the dragged object and update mouse capture void SetDraggedObject(AudioDisplayInteractionObject *new_obj); @@ -133,22 +133,22 @@ class AudioDisplay: public wxWindow { wxTimer scroll_timer; /// Leftmost pixel in the virtual audio image being displayed - int scroll_left; + int scroll_left = 0; /// Total width of the audio in pixels - int pixel_audio_width; + int pixel_audio_width = 0; /// Horizontal zoom measured in millisecond per pixels - double ms_per_pixel; + double ms_per_pixel = 0.; /// Amplitude scaling ("vertical zoom") as a factor, 1.0 is neutral - float scale_amplitude; + float scale_amplitude = 1.f; /// Top of the main audio area in pixels - int audio_top; + int audio_top = 0; /// Height of main audio area in pixels - int audio_height; + int audio_height = 0; /// Width of the audio marker feet in pixels static const int foot_size = 6; @@ -157,7 +157,7 @@ class AudioDisplay: public wxWindow { int zoom_level; /// Absolute pixel position of the tracking cursor (mouse or playback) - int track_cursor_pos; + int track_cursor_pos = -1; /// Label to show by track cursor wxString track_cursor_label; /// Bounding rectangle last drawn track cursor label diff --git a/aegisub/src/audio_karaoke.cpp b/aegisub/src/audio_karaoke.cpp index 828a9545cb597dd33a5f7d1fe0882b53e8a9c2ef..d8ec4bff05d1074f19b1d083051394b8ca40e8c9 100644 --- a/aegisub/src/audio_karaoke.cpp +++ b/aegisub/src/audio_karaoke.cpp @@ -68,15 +68,7 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c) , audio_opened(c->audioController->AddAudioOpenListener(&AudioKaraoke::OnAudioOpened, this)) , audio_closed(c->audioController->AddAudioCloseListener(&AudioKaraoke::OnAudioClosed, this)) , active_line_changed(c->selectionController->AddActiveLineListener(&AudioKaraoke::OnActiveLineChanged, this)) -, active_line(nullptr) , kara(agi::util::make_unique<AssKaraoke>()) -, scroll_x(0) -, scroll_dir(0) -, char_height(0) -, char_width(0) -, mouse_pos(0) -, click_will_remove_split(false) -, enabled(false) { using std::bind; diff --git a/aegisub/src/audio_karaoke.h b/aegisub/src/audio_karaoke.h index 0be1050881ebcc123e2d04756a451f945ee9f4e6..cf4a293a634d75ce198f318c806fe8dbc1286283 100644 --- a/aegisub/src/audio_karaoke.h +++ b/aegisub/src/audio_karaoke.h @@ -76,7 +76,7 @@ class AudioKaraoke : public wxWindow { agi::signal::Connection active_line_changed; /// Currently active dialogue line - AssDialogue *active_line; + AssDialogue *active_line = nullptr; /// Karaoke data std::unique_ptr<AssKaraoke> kara; @@ -101,18 +101,18 @@ class AudioKaraoke : public wxWindow { /// Cached width of characters from GetTextExtent std::unordered_map<std::string, int> char_widths; - int scroll_x; ///< Distance the display has been shifted to the left in pixels - int scroll_dir; ///< Direction the display will be scrolled on scroll_timer ticks (+/- 1) + int scroll_x = 0; ///< Distance the display has been shifted to the left in pixels + int scroll_dir = 0; ///< Direction the display will be scrolled on scroll_timer ticks (+/- 1) wxTimer scroll_timer; ///< Timer to scroll every 50ms when user holds down scroll button - int char_height; ///< Maximum character height in pixels - int char_width; ///< Maximum character width in pixels - int mouse_pos; ///< Last x coordinate of the mouse - bool click_will_remove_split; ///< If true a click at mouse_pos will remove a split rather than adding one + int char_height = 0; ///< Maximum character height in pixels + int char_width = 0; ///< Maximum character width in pixels + int mouse_pos = 0; ///< Last x coordinate of the mouse + bool click_will_remove_split = false; ///< If true a click at mouse_pos will remove a split rather than adding one wxFont split_font; ///< Font used in the split/join interface - bool enabled; ///< Is karaoke mode enabled? + bool enabled = false; ///< Is karaoke mode enabled? wxButton *accept_button; ///< Accept pending splits button wxButton *cancel_button; ///< Revert pending changes diff --git a/aegisub/src/audio_player_openal.cpp b/aegisub/src/audio_player_openal.cpp index b9be1c7c3908bed96e47650215fa7687e1ebfa73..a3dbc75da7877522bea7dd30338dcbfb31e8781a 100644 --- a/aegisub/src/audio_player_openal.cpp +++ b/aegisub/src/audio_player_openal.cpp @@ -52,20 +52,8 @@ DEFINE_SIMPLE_EXCEPTION(OpenALException, agi::AudioPlayerOpenError, "audio/open/ OpenALPlayer::OpenALPlayer(AudioProvider *provider) : AudioPlayer(provider) -, playing(false) -, volume(1.f) , samplerate(provider->GetSampleRate()) , bpf(provider->GetChannels() * provider->GetBytesPerSample()) -, start_frame(0) -, cur_frame(0) -, end_frame(0) -, device(nullptr) -, context(nullptr) -, source(0) -, buf_first_free(0) -, buf_first_queued(0) -, buffers_free(0) -, buffers_played(0) { try { // Open device diff --git a/aegisub/src/audio_player_openal.h b/aegisub/src/audio_player_openal.h index ddd8221221016140cc5cfc2cd2a58274c7772e5e..bdb64dc223ceef62dfb74f87ea7b04866d3ed0a6 100644 --- a/aegisub/src/audio_player_openal.h +++ b/aegisub/src/audio_player_openal.h @@ -55,32 +55,32 @@ class OpenALPlayer : public AudioPlayer, wxTimer { /// Number of OpenAL buffers to use static const ALsizei num_buffers = 8; - bool playing; ///< Is audio currently playing? + bool playing = false; ///< Is audio currently playing? - float volume; ///< Current audio volume + float volume = 1.f; ///< Current audio volume ALsizei samplerate; ///< Sample rate of the audio int bpf; ///< Bytes per frame - int64_t start_frame; ///< First frame of playbacka - int64_t cur_frame; ///< Next frame to write to playback buffers - int64_t end_frame; ///< Last frame to play + int64_t start_frame = 0; ///< First frame of playbacka + int64_t cur_frame = 0; ///< Next frame to write to playback buffers + int64_t end_frame = 0; ///< Last frame to play - ALCdevice *device; ///< OpenAL device handle - ALCcontext *context; ///< OpenAL sound context + ALCdevice *device = nullptr; ///< OpenAL device handle + ALCcontext *context = nullptr; ///< OpenAL sound context ALuint buffers[num_buffers]; ///< OpenAL sound buffers - ALuint source; ///< OpenAL playback source + ALuint source = 0; ///< OpenAL playback source /// Index into buffers, first free (unqueued) buffer to be filled - ALsizei buf_first_free; + ALsizei buf_first_free = 0; /// Index into buffers, first queued (non-free) buffer - ALsizei buf_first_queued; + ALsizei buf_first_queued = 0; /// Number of free buffers - ALsizei buffers_free; + ALsizei buffers_free = 0; /// Number of buffers which have been fully played since playback was last started - ALsizei buffers_played; + ALsizei buffers_played = 0; wxStopWatch playback_segment_timer; diff --git a/aegisub/src/audio_player_oss.cpp b/aegisub/src/audio_player_oss.cpp index 95470dd40632d31f983c95d5abf647f0fb7ea23c..35198cbadc97891ccefa7f52afca6611d56b6802 100644 --- a/aegisub/src/audio_player_oss.cpp +++ b/aegisub/src/audio_player_oss.cpp @@ -50,15 +50,6 @@ DEFINE_SIMPLE_EXCEPTION(OSSError, agi::AudioPlayerOpenError, "audio/player/open/ OSSPlayer::OSSPlayer(AudioProvider *provider) : AudioPlayer(provider) -, rate(0) -, thread(0) -, playing(false) -, volume(1.0f) -, start_frame(0) -, cur_frame(0) -, end_frame(0) -, bpf(0) -, dspdev(0) { OpenStream(); } diff --git a/aegisub/src/audio_player_oss.h b/aegisub/src/audio_player_oss.h index eb8cd52c008480a9c1b75f57f50f993e95b00750..6bc7631207dc02b21fa4ce25805615d8f05e65ab 100644 --- a/aegisub/src/audio_player_oss.h +++ b/aegisub/src/audio_player_oss.h @@ -69,31 +69,31 @@ class OSSPlayer : public AudioPlayer { friend class OSSPlayerThread; /// sample rate of audio - unsigned int rate; + unsigned int rate = 0; /// Worker thread that does the actual writing - OSSPlayerThread *thread; + OSSPlayerThread *thread = nullptr; /// Is the player currently playing? - volatile bool playing; + volatile bool playing = false; /// Current volume level - volatile float volume; + volatile float volume = 1.f; /// first frame of playback - volatile unsigned long start_frame; + volatile unsigned long start_frame = 0; /// last written frame + 1 - volatile unsigned long cur_frame; + volatile unsigned long cur_frame = 0; /// last frame to play - volatile unsigned long end_frame; + volatile unsigned long end_frame = 0; /// bytes per frame - unsigned long bpf; + unsigned long bpf = 0; /// OSS audio device handle - volatile int dspdev; + volatile int dspdev = 0; void OpenStream(); diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index 27dbb5c21262982d110340a0bd52c1726a61dc20..f99cc7c180167f672bce45dd76bb6850df6918b5 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -69,12 +69,7 @@ static const PaHostApiTypeId pa_host_api_priority[] = { }; static const size_t pa_host_api_priority_count = sizeof(pa_host_api_priority) / sizeof(pa_host_api_priority[0]); -PortAudioPlayer::PortAudioPlayer(AudioProvider *provider) -: AudioPlayer(provider) -, volume(1.0f) -, pa_start(0.0) -, stream(0) -{ +PortAudioPlayer::PortAudioPlayer(AudioProvider *provider) : AudioPlayer(provider) { PaError err = Pa_Initialize(); if (err != paNoError) @@ -131,7 +126,7 @@ PortAudioPlayer::~PortAudioPlayer() { } void PortAudioPlayer::OpenStream() { - DeviceVec *device_ids = 0; + DeviceVec *device_ids = nullptr; std::string device_name = OPT_GET("Player/Audio/PortAudio/Device Name")->GetString(); if (devices.count(device_name)) { diff --git a/aegisub/src/audio_player_portaudio.h b/aegisub/src/audio_player_portaudio.h index f64fb16e2dfdd2a5eb935a7ae0b4f977c9a1b26d..1c5ad5767389d82ddf2a4ac99ba8300881c84322 100644 --- a/aegisub/src/audio_player_portaudio.h +++ b/aegisub/src/audio_player_portaudio.h @@ -57,13 +57,13 @@ class PortAudioPlayer : public AudioPlayer { /// The index of the default output devices sorted by host API priority DeviceVec default_device; - float volume; ///< Current volume level - int64_t current; ///< Current position - int64_t start; ///< Start position - int64_t end; ///< End position - PaTime pa_start; ///< PortAudio internal start position + float volume = 1.f; ///< Current volume level + int64_t current = 0; ///< Current position + int64_t start = 0; ///< Start position + int64_t end = 0; ///< End position + PaTime pa_start; ///< PortAudio internal start position - PaStream *stream; ///< PortAudio stream + PaStream *stream = nullptr; ///< PortAudio stream /// @brief PortAudio callback, used to fill buffer for playback, and prime the playback buffer. /// @param inputBuffer Input buffer. diff --git a/aegisub/src/audio_player_pulse.cpp b/aegisub/src/audio_player_pulse.cpp index 09801b7b7472c76e4e4b2b951eb4c39d1e844528..a6cfb6cdad61a7553c3ed7d76154ac20797bd754 100644 --- a/aegisub/src/audio_player_pulse.cpp +++ b/aegisub/src/audio_player_pulse.cpp @@ -48,20 +48,7 @@ #include <libaegisub/log.h> -PulseAudioPlayer::PulseAudioPlayer(AudioProvider *provider) -: AudioPlayer(provider) -, volume(1.0f) -, is_playing(false) -, start_frame(0) -, cur_frame(0) -, end_frame(0) -, bpf(0) -, context_notify(0, 1) -, context_success(0, 1) -, stream_notify(0, 1) -, stream_success(0, 1) -, paerror(0) -{ +PulseAudioPlayer::PulseAudioPlayer(AudioProvider *provider) : AudioPlayer(provider) { // Initialise a mainloop mainloop = pa_threaded_mainloop_new(); if (!mainloop) diff --git a/aegisub/src/audio_player_pulse.h b/aegisub/src/audio_player_pulse.h index f2f3428ba0bc6e5bc3aa6516ba4eb34f1c735ad2..28865f5d94d5b7fd2b31f0550f040c2db0b367b5 100644 --- a/aegisub/src/audio_player_pulse.h +++ b/aegisub/src/audio_player_pulse.h @@ -40,34 +40,34 @@ class PulseAudioPlayer; class PulseAudioPlayer : public AudioPlayer { - float volume; - bool is_playing; + float volume = 1.f; + bool is_playing = false; - volatile unsigned long start_frame; - volatile unsigned long cur_frame; - volatile unsigned long end_frame; + volatile unsigned long start_frame = 0; + volatile unsigned long cur_frame = 0; + volatile unsigned long end_frame = 0; - unsigned long bpf; // bytes per frame + unsigned long bpf = 0; // bytes per frame - wxSemaphore context_notify; - wxSemaphore context_success; + wxSemaphore context_notify{0, 1}; + wxSemaphore context_success{0, 1}; volatile int context_success_val; - wxSemaphore stream_notify; - wxSemaphore stream_success; + wxSemaphore stream_notify{0, 1}; + wxSemaphore stream_success{0, 1}; volatile int stream_success_val; - pa_threaded_mainloop *mainloop; // pulseaudio mainloop handle - pa_context *context; // connection context + pa_threaded_mainloop *mainloop = nullptr; // pulseaudio mainloop handle + pa_context *context = nullptr; // connection context volatile pa_context_state_t cstate; - pa_stream *stream; + pa_stream *stream = nullptr; volatile pa_stream_state_t sstate; volatile pa_usec_t play_start_time; // timestamp when playback was started - int paerror; + int paerror = 0; /// Called by PA to notify about contetxt operation completion static void pa_context_success(pa_context *c, int success, PulseAudioPlayer *thread); diff --git a/aegisub/src/audio_provider.cpp b/aegisub/src/audio_provider.cpp index 820238e1d5df46d6310905fb5e74d2a6ff2de8fe..5786a39f12055249c59a79b73e706c2254cb5063 100644 --- a/aegisub/src/audio_provider.cpp +++ b/aegisub/src/audio_provider.cpp @@ -110,12 +110,10 @@ void AudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const { namespace { struct provider_creator { - bool found_file; - bool found_audio; + bool found_file = false; + bool found_audio = false; std::string msg; - provider_creator() : found_file(false) , found_audio(false) { } - template<typename Factory> std::unique_ptr<AudioProvider> try_create(std::string const& name, Factory&& create) { try { diff --git a/aegisub/src/audio_provider_pcm.cpp b/aegisub/src/audio_provider_pcm.cpp index f45fec3c6ac4d56109f8b98bef940f62e54d04f8..8e3377814041be193f409aba5ace0e649391c2bd 100644 --- a/aegisub/src/audio_provider_pcm.cpp +++ b/aegisub/src/audio_provider_pcm.cpp @@ -52,11 +52,8 @@ #endif PCMAudioProvider::PCMAudioProvider(agi::fs::path const& filename) -: current_mapping(nullptr) -, mapping_start(0) -, mapping_length(0) #ifdef _WIN32 -, file_handle(0, CloseHandle) +: file_handle(0, CloseHandle) , file_mapping(0, CloseHandle) { file_handle = CreateFile( @@ -81,7 +78,7 @@ PCMAudioProvider::PCMAudioProvider(agi::fs::path const& filename) if (file_mapping == 0) throw agi::AudioProviderOpenError("Failed creating file mapping", 0); #else -, file_handle(open(filename.c_str(), O_RDONLY), close) +: file_handle(open(filename.c_str(), O_RDONLY), close) { if (file_handle == -1) throw agi::fs::FileNotFound(filename.string()); diff --git a/aegisub/src/audio_provider_pcm.h b/aegisub/src/audio_provider_pcm.h index 3025f3ebd653c937c8985348649cd86a469d3921..fbd4cbf11f82d0fa9926cbf16b80b7d821b341a6 100644 --- a/aegisub/src/audio_provider_pcm.h +++ b/aegisub/src/audio_provider_pcm.h @@ -44,17 +44,17 @@ #include <libaegisub/scoped_ptr.h> class PCMAudioProvider : public AudioProvider { - mutable void *current_mapping; + mutable void *current_mapping = nullptr; #ifdef _WIN32 - mutable int64_t mapping_start; - mutable size_t mapping_length; + mutable int64_t mapping_start = 0; + mutable size_t mapping_length = 0; agi::scoped_holder<HANDLE, BOOL (__stdcall *)(HANDLE)> file_handle; agi::scoped_holder<HANDLE, BOOL (__stdcall *)(HANDLE)> file_mapping; #else - mutable off_t mapping_start; - mutable size_t mapping_length; + mutable off_t mapping_start = 0; + mutable size_t mapping_length = 0; agi::scoped_holder<int, int(*)(int)> file_handle; #endif @@ -65,7 +65,7 @@ protected: char * EnsureRangeAccessible(int64_t range_start, int64_t range_length) const; // Ensure that the given range of bytes are accessible in the file mapping and return a pointer to the first byte of the requested range /// Size of the opened file - int64_t file_size; + int64_t file_size = 0; struct IndexPoint { int64_t start_byte; diff --git a/aegisub/src/audio_renderer.cpp b/aegisub/src/audio_renderer.cpp index 94b486b65ee477eb85007663c9338df74c5ea928..8b96ac97566a7c8b428e4a7afd03bd76f9d0832f 100644 --- a/aegisub/src/audio_renderer.cpp +++ b/aegisub/src/audio_renderer.cpp @@ -65,14 +65,6 @@ size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const AudioRenderer::AudioRenderer() -: pixel_ms(0) -, pixel_height(0) -, amplitude_scale(0) -, cache_bitmap_width(32) // arbitrary value for now -, cache_bitmap_maxsize(0) -, cache_renderer_maxsize(0) -, renderer(nullptr) -, provider(nullptr) { for (int i = 0; i < AudioStyle_MAX; ++i) bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this)); diff --git a/aegisub/src/audio_renderer.h b/aegisub/src/audio_renderer.h index 7ab7ef9f4db4ae2672190a7c4085abe5a68a1827..91f83df90664c01b1c1aca913195e13fd78af346 100644 --- a/aegisub/src/audio_renderer.h +++ b/aegisub/src/audio_renderer.h @@ -89,31 +89,31 @@ class AudioRenderer { friend struct AudioRendererBitmapCacheBitmapFactory; /// Horizontal zoom level, milliseconds per pixel - double pixel_ms; + double pixel_ms = 0.f; /// Rendering height in pixels - int pixel_height; + int pixel_height = 0; /// Vertical zoom level/amplitude scale - float amplitude_scale; + float amplitude_scale = 0.f; /// Width of bitmaps to store in cache - const int cache_bitmap_width; + const int cache_bitmap_width = 32; // Completely arbitrary value /// Cached bitmaps for audio ranges std::vector<AudioRendererBitmapCache> bitmaps; /// Number of blocks in the bitmap caches - size_t cache_numblocks; + size_t cache_numblocks = 0; /// The maximum allowed size of each bitmap cache, in bytes - size_t cache_bitmap_maxsize; + size_t cache_bitmap_maxsize = 0; /// The maximum allowed size of the renderer's cache, in bytes - size_t cache_renderer_maxsize; + size_t cache_renderer_maxsize = 0; /// Do the caches need to be aged? - bool needs_age; + bool needs_age = false; /// Actual renderer for bitmaps - AudioRendererBitmapProvider *renderer; + AudioRendererBitmapProvider *renderer = nullptr; /// Audio provider to use as source - AudioProvider *provider; + AudioProvider *provider = nullptr; /// @brief Make sure bitmap index i is in cache /// @param i Index of bitmap to get into cache diff --git a/aegisub/src/audio_renderer_spectrum.cpp b/aegisub/src/audio_renderer_spectrum.cpp index d16b92e1a5669c3274f31ea65474e8c1db7cc242..017c34468cf59e38a4306955aa99e24df51fe43c 100644 --- a/aegisub/src/audio_renderer_spectrum.cpp +++ b/aegisub/src/audio_renderer_spectrum.cpp @@ -97,13 +97,6 @@ public: AudioSpectrumRenderer::AudioSpectrumRenderer(std::string const& color_scheme_name) -: derivation_size(8) -, derivation_dist(8) -#ifdef WITH_FFTW3 -, dft_plan(nullptr) -, dft_input(nullptr) -, dft_output(nullptr) -#endif { colors.reserve(AudioStyle_MAX); for (int i = 0; i < AudioStyle_MAX; ++i) diff --git a/aegisub/src/audio_renderer_spectrum.h b/aegisub/src/audio_renderer_spectrum.h index f66c9b182c31c715d9d38ac2c8a4ed23515c76c3..b322c1c3208e1c6365b16ecf12a2be79990ddfdf 100644 --- a/aegisub/src/audio_renderer_spectrum.h +++ b/aegisub/src/audio_renderer_spectrum.h @@ -62,10 +62,10 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider { std::vector<AudioColorScheme> colors; /// Binary logarithm of number of samples to use in deriving frequency-power data - size_t derivation_size; + size_t derivation_size = 0; /// Binary logarithm of number of samples between the start of derivations - size_t derivation_dist; + size_t derivation_dist = 0; /// @brief Reset in response to changing audio provider /// @@ -92,11 +92,11 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider { #ifdef WITH_FFTW3 /// FFTW plan data - fftw_plan dft_plan; + fftw_plan dft_plan = nullptr; /// Pre-allocated input array for FFTW - double *dft_input; + double *dft_input = nullptr; /// Pre-allocated output array for FFTW - fftw_complex *dft_output; + fftw_complex *dft_output = nullptr; #else /// Pre-allocated scratch area for doing FFT derivations std::vector<float> fft_scratch; diff --git a/aegisub/src/audio_renderer_waveform.cpp b/aegisub/src/audio_renderer_waveform.cpp index 6bafa6e4637b00902e3dcc4a7d058e7f70be218b..4ebdd3ce9aacb4093415cd70008e2f709f10903d 100644 --- a/aegisub/src/audio_renderer_waveform.cpp +++ b/aegisub/src/audio_renderer_waveform.cpp @@ -55,8 +55,7 @@ enum { }; AudioWaveformRenderer::AudioWaveformRenderer(std::string const& color_scheme_name) -: audio_buffer(nullptr) -, render_averages(OPT_GET("Audio/Display/Waveform Style")->GetInt() == Waveform_MaxAvg) +: render_averages(OPT_GET("Audio/Display/Waveform Style")->GetInt() == Waveform_MaxAvg) { colors.reserve(AudioStyle_MAX); for (int i = 0; i < AudioStyle_MAX; ++i) diff --git a/aegisub/src/audio_renderer_waveform.h b/aegisub/src/audio_renderer_waveform.h index 3fdd7a690a421768f22905051860202ec2e860f1..e1f80d09a5542b7dcf0d9c6850820ff25dc5e79a 100644 --- a/aegisub/src/audio_renderer_waveform.h +++ b/aegisub/src/audio_renderer_waveform.h @@ -45,7 +45,7 @@ class AudioWaveformRenderer : public AudioRendererBitmapProvider { std::vector<AudioColorScheme> colors; /// Pre-allocated buffer for audio fetched from provider - char *audio_buffer; + char *audio_buffer = nullptr; /// Whether to render max+avg or just max bool render_averages; diff --git a/aegisub/src/audio_timing_karaoke.cpp b/aegisub/src/audio_timing_karaoke.cpp index 5e95847d0c651cf69fa0f1be9c6518466242dd55..6be7398ad7f91b04c08936ab018275f3efe46047 100644 --- a/aegisub/src/audio_timing_karaoke.cpp +++ b/aegisub/src/audio_timing_karaoke.cpp @@ -89,7 +89,7 @@ class AudioTimingControllerKaraoke : public AudioTimingController { AssDialogue *active_line; ///< Currently active line AssKaraoke *kara; ///< Parsed karaoke model provided by karaoke controller - size_t cur_syl; ///< Index of currently selected syllable in the line + size_t cur_syl = 0; ///< Index of currently selected syllable in the line /// Pen used for the mid-syllable markers Pen separator_pen; @@ -114,8 +114,8 @@ class AudioTimingControllerKaraoke : public AudioTimingController { /// Labels containing the stripped text of each syllable std::vector<AudioLabel> labels; - bool auto_commit; ///< Should changes be automatically commited? - int commit_id; ///< Last commit id used for an autocommit + bool auto_commit; ///< Should changes be automatically commited? + int commit_id = -1; ///< Last commit id used for an autocommit bool pending_changes; ///< Are there any pending changes to be committed? void OnAutoCommitChange(agi::OptionValue const& opt); @@ -160,7 +160,6 @@ AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssK , c(c) , active_line(c->selectionController->GetActiveLine()) , kara(kara) -, cur_syl(0) , separator_pen("Colour/Audio Display/Syllable Boundaries", "Audio/Line Boundaries Thickness", wxPENSTYLE_DOT) , start_pen("Colour/Audio Display/Line boundary Start", "Audio/Line Boundaries Thickness") , end_pen("Colour/Audio Display/Line boundary End", "Audio/Line Boundaries Thickness") @@ -169,7 +168,6 @@ AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssK , keyframes_provider(c, "Audio/Display/Draw/Keyframes in Karaoke Mode") , video_position_provider(c) , auto_commit(OPT_GET("Audio/Auto/Commit")->GetBool()) -, commit_id(-1) { slots.push_back(kara->AddSyllablesChangedListener(&AudioTimingControllerKaraoke::Revert, this)); slots.push_back(OPT_SUB("Audio/Auto/Commit", &AudioTimingControllerKaraoke::OnAutoCommitChange, this)); diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index 22aac6490c4dfb73d303492d72475c268e59eabb..9422bf962e1fe8d209b0bcfd8ddaefe24d0c0c65 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -100,16 +100,8 @@ namespace std { BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context, const wxSize& size, long style, const wxString& name) : wxWindow(parent, -1, wxDefaultPosition, size, style, name) -, lineHeight(1) // non-zero to avoid div by 0 -, holding(false) , scrollBar(new wxScrollBar(this, GRID_SCROLLBAR, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL)) -, byFrame(false) -, extendRow(-1) -, active_line(nullptr) -, batch_level(0) -, batch_active_line_changed(false) , seek_listener(context->videoController->AddSeekListener(std::bind(&BaseGrid::Refresh, this, false, nullptr))) -, yPos(0) , context(context) { scrollBar->SetScrollbar(0,10,100,10); diff --git a/aegisub/src/base_grid.h b/aegisub/src/base_grid.h index 7894d8393527638465415afff5e5e20b2d25b994..2d829fd04ee4f6a460b150bbaf0f45d5f8121b6a 100644 --- a/aegisub/src/base_grid.h +++ b/aegisub/src/base_grid.h @@ -50,27 +50,27 @@ namespace agi { class AssDialogue; class BaseGrid : public wxWindow, public SubtitleSelectionController { - int lineHeight; ///< Height of a line in pixels in the current font - bool holding; ///< Is a drag selection in process? + int lineHeight = 1; ///< Height of a line in pixels in the current font + bool holding = false; ///< Is a drag selection in process? wxFont font; ///< Current grid font wxScrollBar *scrollBar; ///< The grid's scrollbar - bool byFrame; ///< Should times be displayed as frame numbers + bool byFrame = false; ///< Should times be displayed as frame numbers wxBrush rowColors[7]; ///< Cached brushes used for row backgrounds /// Row from which the selection shrinks/grows from when selecting via the /// keyboard, shift-clicking or dragging - int extendRow; + int extendRow = -1; - Selection selection; ///< Currently selected lines - AssDialogue *active_line; ///< The currently active line or 0 if none + Selection selection; ///< Currently selected lines + AssDialogue *active_line = nullptr; ///< The currently active line or 0 if none std::vector<AssDialogue*> index_line_map; ///< Row number -> dialogue line std::map<AssDialogue*,int> line_index_map; ///< Dialogue line -> row number /// Selection batch nesting depth; changes are commited only when this /// hits zero - int batch_level; + int batch_level = 0; /// Has the active line been changed in the current batch? - bool batch_active_line_changed; + bool batch_active_line_changed = false; /// Lines which will be added to the selection when the current batch is /// completed; should be disjoint from selection Selection batch_selection_added; @@ -112,7 +112,7 @@ class BaseGrid : public wxWindow, public SubtitleSelectionController { bool showCol[10]; ///< Column visibility mask - int yPos; + int yPos = 0; void AdjustScrollbar(); void SetColumnWidths(); diff --git a/aegisub/src/dialog_kara_timing_copy.cpp b/aegisub/src/dialog_kara_timing_copy.cpp index d5a8d8a64af862d8ed256525564a5d2e2bfc9e43..75f130df2fd2e068b3308b81eb46c475377479fc 100644 --- a/aegisub/src/dialog_kara_timing_copy.cpp +++ b/aegisub/src/dialog_kara_timing_copy.cpp @@ -451,8 +451,6 @@ bool KaraokeLineMatchDisplay::UndoMatch() DialogKanjiTimer::DialogKanjiTimer(agi::Context *c) : wxDialog(c->parent, -1, _("Kanji timing")) , subs(c->ass) -, currentSourceLine(nullptr) -, currentDestinationLine(nullptr) { SetIcon(GETICON(kara_timing_copier_16)); diff --git a/aegisub/src/dialog_kara_timing_copy.h b/aegisub/src/dialog_kara_timing_copy.h index a26da06779a6479ef8f7a15ecea90a51aea9cce7..c74f0ba1a1a64740d763736f71c38a83104bf517 100644 --- a/aegisub/src/dialog_kara_timing_copy.h +++ b/aegisub/src/dialog_kara_timing_copy.h @@ -55,8 +55,8 @@ class DialogKanjiTimer : public wxDialog { std::vector<std::pair<AssDialogue*, std::string>> LinesToChange; - AssEntry *currentSourceLine; - AssEntry *currentDestinationLine; + AssEntry *currentSourceLine = nullptr; + AssEntry *currentDestinationLine = nullptr; void OnClose(wxCommandEvent &event); void OnStart(wxCommandEvent &event); diff --git a/aegisub/src/dialog_progress.cpp b/aegisub/src/dialog_progress.cpp index 6c9552d796406c8f947f62ecec154814a1afa92d..330925ca36c6f55431a2e2715c8ea12b7cf3eb7f 100644 --- a/aegisub/src/dialog_progress.cpp +++ b/aegisub/src/dialog_progress.cpp @@ -115,8 +115,6 @@ public: DialogProgress::DialogProgress(wxWindow *parent, wxString const& title_text, wxString const& message) : wxDialog(parent, -1, title_text, wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED) , pulse_timer(GetEventHandler()) -, progress_current(0) -, progress_target(0) { title = new wxStaticText(this, -1, title_text, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE); gauge = new wxGauge(this, -1, 300, wxDefaultPosition, wxSize(300,20)); diff --git a/aegisub/src/dialog_progress.h b/aegisub/src/dialog_progress.h index 9b7c87cd5db4d247bf8de91d2e0dad208dd171cb..14b1c31a90493ecddfcd2c3e303ed682164421b9 100644 --- a/aegisub/src/dialog_progress.h +++ b/aegisub/src/dialog_progress.h @@ -44,11 +44,11 @@ class DialogProgress : public wxDialog, public agi::BackgroundRunner { wxTimer pulse_timer; wxString pending_log; - int progress_anim_start_value; - int progress_current; - int progress_target; + int progress_anim_start_value = 0; + int progress_current = 0; + int progress_target = 0; std::chrono::steady_clock::time_point progress_anim_start_time; - int progress_anim_duration; + int progress_anim_duration = 0; void OnShow(wxShowEvent&); void OnCancel(wxCommandEvent &); diff --git a/aegisub/src/dialog_spellchecker.cpp b/aegisub/src/dialog_spellchecker.cpp index 2fb735784183d14233db983b56418233dd848002..007c0d4cfe556cb9c95693f1aa00a253c04578f9 100644 --- a/aegisub/src/dialog_spellchecker.cpp +++ b/aegisub/src/dialog_spellchecker.cpp @@ -54,9 +54,6 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context) : wxDialog(context->parent, -1, _("Spell Checker")) , context(context) , spellchecker(SpellCheckerFactory::GetSpellChecker()) -, start_line(nullptr) -, active_line(nullptr) -, has_looped(false) { SetIcon(GETICON(spellcheck_toolbutton_16)); diff --git a/aegisub/src/dialog_spellchecker.h b/aegisub/src/dialog_spellchecker.h index bd57e0b6a2a8b01c81893404a3d1878a18b87ba4..d295442e929c596ad9121ac7ba23dff605ac72f3 100644 --- a/aegisub/src/dialog_spellchecker.h +++ b/aegisub/src/dialog_spellchecker.h @@ -59,9 +59,9 @@ class DialogSpellChecker : public wxDialog { wxButton *add_button; ///< Add word to currently active dictionary wxButton *remove_button; ///< Remove word from currently active dictionary - AssDialogue *start_line; ///< The first line checked - AssDialogue *active_line; ///< The most recently checked line - bool has_looped; ///< Has the search already looped from the end to beginning? + AssDialogue *start_line = nullptr; ///< The first line checked + AssDialogue *active_line = nullptr; ///< The most recently checked line + bool has_looped = false; ///< Has the search already looped from the end to beginning? /// Find the next misspelled word and close the dialog if there are none /// @return Are there any more misspelled words? diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index d1b6c80a6d6776f0cff9e0253aae24a4331de030..44a751a6b84c6eaa0b033e071edb23eddcab5678 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -142,7 +142,6 @@ static wxTextCtrl *num_text_ctrl(wxWindow *parent, double *value, bool allow_neg DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Context *c, AssStyleStorage *store, std::string const& new_name, wxArrayString const& font_list) : wxDialog (parent, -1, _("Style Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , c(c) -, is_new(false) , style(style) , store(store) { diff --git a/aegisub/src/dialog_style_editor.h b/aegisub/src/dialog_style_editor.h index 1ed54586917ff64f64a08ca427475caac2419eed..76e21b995b24b05e249be185dfd683b2f7c0d688 100644 --- a/aegisub/src/dialog_style_editor.h +++ b/aegisub/src/dialog_style_editor.h @@ -54,7 +54,7 @@ class DialogStyleEditor : public wxDialog { /// If true, the style was just created and so the user should not be /// asked if they want to change any existing lines should they rename /// the style - bool is_new; + bool is_new = false; /// The style currently being edited AssStyle *style; diff --git a/aegisub/src/dialog_styling_assistant.cpp b/aegisub/src/dialog_styling_assistant.cpp index 9e6a1da344d35a91530bdfc18abf71b16121f7a8..d8ff9f8d4d637162e5dcb8a74bb0da857794352f 100644 --- a/aegisub/src/dialog_styling_assistant.cpp +++ b/aegisub/src/dialog_styling_assistant.cpp @@ -56,7 +56,6 @@ DialogStyling::DialogStyling(agi::Context *context) : wxDialog(context->parent, -1, _("Styling Assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX) , c(context) , active_line_connection(context->selectionController->AddActiveLineListener(&DialogStyling::OnActiveLineChanged, this)) -, active_line(nullptr) { SetIcon(GETICON(styling_toolbutton_16)); diff --git a/aegisub/src/dialog_styling_assistant.h b/aegisub/src/dialog_styling_assistant.h index 5fbe5d7293bf4bdc9bb32f401567f8018f63125a..74820308eb87ba71410a7a01b45a95bf4c309a7c 100644 --- a/aegisub/src/dialog_styling_assistant.h +++ b/aegisub/src/dialog_styling_assistant.h @@ -55,7 +55,7 @@ class DialogStyling : public wxDialog { void OnActiveLineChanged(AssDialogue *); - AssDialogue *active_line; + AssDialogue *active_line = nullptr; std::unique_ptr<PersistLocation> persist; diff --git a/aegisub/src/dialog_translation.cpp b/aegisub/src/dialog_translation.cpp index 993a4461a645571fc3a7a2653bf80df5a74ab916..5c0dc43d156aba01a962d627ced43919221c1db6 100644 --- a/aegisub/src/dialog_translation.cpp +++ b/aegisub/src/dialog_translation.cpp @@ -66,10 +66,8 @@ DialogTranslation::DialogTranslation(agi::Context *c) , file_change_connection(c->ass->AddCommitListener(&DialogTranslation::OnExternalCommit, this)) , active_line_connection(c->selectionController->AddActiveLineListener(&DialogTranslation::OnActiveLineChanged, this)) , active_line(c->selectionController->GetActiveLine()) -, cur_block(0) , line_count(count_if(c->ass->Line.begin(), c->ass->Line.end(), cast<AssDialogue*>())) , line_number(count_if(c->ass->Line.begin(), c->ass->Line.iterator_to(*active_line), cast<AssDialogue*>()) + 1) -, switching_lines(false) { SetIcon(GETICON(translation_toolbutton_16)); diff --git a/aegisub/src/dialog_translation.h b/aegisub/src/dialog_translation.h index 0a30643856206c8e3c1e84bab08b265215cf9870..70202f212019e7ef6b3fd69f6d17ff0e333fe071 100644 --- a/aegisub/src/dialog_translation.h +++ b/aegisub/src/dialog_translation.h @@ -47,7 +47,7 @@ class DialogTranslation : public wxDialog { /// The parsed dialogue blocks for the active line boost::ptr_vector<AssDialogueBlock> blocks; /// Which dialogue block in the active line is currently being translated - size_t cur_block; + size_t cur_block = 0; /// Total number of dialogue lines in the file size_t line_count; @@ -55,7 +55,7 @@ class DialogTranslation : public wxDialog { size_t line_number; /// Should active line change announcements be ignored? - bool switching_lines; + bool switching_lines = false; wxStaticText *line_number_display; ScintillaTextCtrl *original_text; diff --git a/aegisub/src/export_framerate.cpp b/aegisub/src/export_framerate.cpp index 2ad31d137c4e3397200ded3a7fd45423c1b27515..aa71f2602f22662ecdf9e8636344daf290379672 100644 --- a/aegisub/src/export_framerate.cpp +++ b/aegisub/src/export_framerate.cpp @@ -59,14 +59,6 @@ AssTransformFramerateFilter::AssTransformFramerateFilter() : AssExportFilter(from_wx(_("Transform Framerate")), from_wx(_("Transform subtitle times, including those in override tags, from an input framerate to an output framerate.\n\nThis is useful for converting regular time subtitles to VFRaC time subtitles for hardsubbing.\nIt can also be used to convert subtitles to a different speed video, such as NTSC to PAL speedup.")), 1000) -, c(nullptr) -, line(nullptr) -, newStart(0) -, newEnd(0) -, newK(0) -, oldK(0) -, Input(nullptr) -, Output(nullptr) { } diff --git a/aegisub/src/export_framerate.h b/aegisub/src/export_framerate.h index 71f46c6ccb5fdd84f36e083af1efd2504fb7c2d2..803cdfe850bd6f7bf5de2dec88e3fd0f402897ce 100644 --- a/aegisub/src/export_framerate.h +++ b/aegisub/src/export_framerate.h @@ -45,16 +45,16 @@ class wxTextCtrl; /// @class AssTransformFramerateFilter /// @brief Transform subtitle times, including those in override tags, from an input framerate to an output framerate class AssTransformFramerateFilter : public AssExportFilter { - agi::Context *c; - AssDialogue *line; - int newStart; - int newEnd; - int newK; - int oldK; + agi::Context *c = nullptr; + AssDialogue *line = nullptr; + int newStart = 0; + int newEnd = 0; + int newK = 0; + int oldK = 0; - // Yes, these are backwards - const agi::vfr::Framerate *Input; ///< Destination frame rate - const agi::vfr::Framerate *Output; ///< Source frame rate + // Yes, these are backwards. It sort of makes sense if you think about what it's doing. + const agi::vfr::Framerate *Input = nullptr; ///< Destination frame rate + const agi::vfr::Framerate *Output = nullptr; ///< Source frame rate agi::vfr::Framerate t1,t2; diff --git a/aegisub/src/font_file_lister.cpp b/aegisub/src/font_file_lister.cpp index b7f6920aef3c733a8d9e99cef7c38aee2e71ba5e..9a7316e8ddf2e89e1a5f81e2c72694a37ba16153 100644 --- a/aegisub/src/font_file_lister.cpp +++ b/aegisub/src/font_file_lister.cpp @@ -64,8 +64,6 @@ namespace { FontCollector::FontCollector(FontCollectorStatusCallback status_callback, FontFileLister &lister) : status_callback(std::move(status_callback)) , lister(lister) -, missing(0) -, missing_glyphs(0) { } diff --git a/aegisub/src/font_file_lister.h b/aegisub/src/font_file_lister.h index 87efd4a5bcfd88dfec318d846d55b107c25028ed..9448b7a35c36d177dc1235453f047970e27819ab 100644 --- a/aegisub/src/font_file_lister.h +++ b/aegisub/src/font_file_lister.h @@ -87,9 +87,9 @@ class FontCollector { /// Paths to found required font files std::set<agi::fs::path> results; /// Number of fonts which could not be found - int missing; + int missing = 0; /// Number of fonts which were found, but did not contain all used glyphs - int missing_glyphs; + int missing_glyphs = 0; /// Gather all of the unique styles with text on a line void ProcessDialogueLine(const AssDialogue *line, int index); diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index b3ae45cc0f75cfbb44c024db0552d776f06ae5e7..3e8659ac6ff46ee0248480ae44e80b5313ac8040 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -183,10 +183,6 @@ public: FrameMain::FrameMain() : wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) , context(agi::util::make_unique<agi::Context>()) -, showVideo(true) -, showAudio(true) -, blockVideoLoad(false) -, blockAudioLoad(false) { StartupLog("Entering FrameMain constructor"); diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index a51060682ea9c689a319d52c9efc9e536a115e24..3b360dc19298c4225374e68dc01e2ee4576e927d 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -66,14 +66,14 @@ class FrameMain: public wxFrame { void Thaw(void) {} #endif - bool showVideo; ///< Is the video display shown? - bool showAudio; ///< Is the audio display shown? - wxTimer StatusClear; ///< Status bar timeout timer + bool showVideo = true; ///< Is the video display shown? + bool showAudio = true; ///< Is the audio display shown? + wxTimer StatusClear; ///< Status bar timeout timer /// Block video loading; used when both video and subtitles are opened at /// the same time, so that the video associated with the subtitles (if any) /// isn't loaded - bool blockVideoLoad; - bool blockAudioLoad; + bool blockVideoLoad = false; + bool blockAudioLoad = false; void InitToolbar(); void InitContents(); diff --git a/aegisub/src/gl_text.cpp b/aegisub/src/gl_text.cpp index 2d883dc017a82c87e2b81bc98408441013558c01..82d63cecca51a17ec18cb2cee5b14f987be547f6 100644 --- a/aegisub/src/gl_text.cpp +++ b/aegisub/src/gl_text.cpp @@ -229,19 +229,8 @@ public: } -OpenGLText::OpenGLText() -: r(1.f) -, g(1.f) -, b(1.f) -, a(1.f) -, fontSize(0) -, fontBold(false) -, fontItalics(false) -{ -} - -OpenGLText::~OpenGLText() { -} +OpenGLText::OpenGLText() { } +OpenGLText::~OpenGLText() { } void OpenGLText::SetFont(std::string const& face, int size, bool bold, bool italics) { // No change required diff --git a/aegisub/src/gl_text.h b/aegisub/src/gl_text.h index dbb0a3991cea1d094806c079bdeab69250095436..aeb888bef93614d8a3909a7a311d1932952d4e16 100644 --- a/aegisub/src/gl_text.h +++ b/aegisub/src/gl_text.h @@ -50,11 +50,11 @@ namespace agi { struct Color; } typedef boost::container::map<int, OpenGLTextGlyph> glyphMap; class OpenGLText { - float r,g,b,a; + float r = 1.f, g = 1.f, b = 1.f, a = 1.f; - int fontSize; - bool fontBold; - bool fontItalics; + int fontSize = 0; + bool fontBold = false; + bool fontItalics = false; std::string fontFace; wxFont font; @@ -62,8 +62,8 @@ class OpenGLText { std::vector<OpenGLTextTexture> textures; - OpenGLText(OpenGLText const&); - OpenGLText& operator=(OpenGLText const&); + OpenGLText(OpenGLText const&) = delete; + OpenGLText& operator=(OpenGLText const&) = delete; /// @brief Get the glyph for the character chr, creating it if necessary /// @param chr Character to get the glyph of diff --git a/aegisub/src/hotkey_data_view_model.cpp b/aegisub/src/hotkey_data_view_model.cpp index 7c338efc36fbbf9379b48f48f231c0e81455223c..8ef05da47b660b5db41c8da2c480b85db596ded3 100644 --- a/aegisub/src/hotkey_data_view_model.cpp +++ b/aegisub/src/hotkey_data_view_model.cpp @@ -261,7 +261,6 @@ public: HotkeyDataViewModel::HotkeyDataViewModel(Preferences *parent) : root(agi::util::make_unique<HotkeyModelRoot>(this)) , parent(parent) -, has_pending_changes(false) { } diff --git a/aegisub/src/hotkey_data_view_model.h b/aegisub/src/hotkey_data_view_model.h index 8937edaad10fe15e600c7185c441558859bc7414..e0c7bfecc144b5c97316fe9edf72719fff6aa933 100644 --- a/aegisub/src/hotkey_data_view_model.h +++ b/aegisub/src/hotkey_data_view_model.h @@ -31,7 +31,7 @@ class Preferences; class HotkeyDataViewModel : public wxDataViewModel { std::unique_ptr<HotkeyModelRoot> root; Preferences *parent; - bool has_pending_changes; + bool has_pending_changes = false; /// Get the real item from the wrapper, or root if it's wrapping nullptr const HotkeyModelItem *get(wxDataViewItem const& item) const; diff --git a/aegisub/src/mkv_wrap.cpp b/aegisub/src/mkv_wrap.cpp index 2867b6d70714dd9db6a289cbd3bbe247b56c7c0e..3534682768a9e1b95a36e548172a165d1fb13242 100644 --- a/aegisub/src/mkv_wrap.cpp +++ b/aegisub/src/mkv_wrap.cpp @@ -66,8 +66,8 @@ public: MkvStdIO(agi::fs::path const& filename); ~MkvStdIO() { if (fp) fclose(fp); } - FILE *fp; - int error; + FILE *fp = nullptr; + int error = 0; }; #define CACHESIZE 1024 @@ -284,9 +284,7 @@ longlong StdIoGetFileSize(InputStream *st) { return epos; } -MkvStdIO::MkvStdIO(agi::fs::path const& filename) -: error(0) -{ +MkvStdIO::MkvStdIO(agi::fs::path const& filename) { read = StdIoRead; scan = StdIoScan; getcachesize = [](InputStream *) -> unsigned int { return CACHESIZE; }; diff --git a/aegisub/src/spline.cpp b/aegisub/src/spline.cpp index 866c479b1baed7650315e00a5d3aae352b77b064..68599daa450714e9c97f55a3394ca64d67ccd97b 100644 --- a/aegisub/src/spline.cpp +++ b/aegisub/src/spline.cpp @@ -46,8 +46,6 @@ Spline::Spline(const VisualToolBase &tl) : coord_translator(tl) -, scale(1) -, raw_scale(1) { } diff --git a/aegisub/src/spline.h b/aegisub/src/spline.h index 6024782daa72e58d44729bbe7dc4feb17e7eca9d..9ce54de9d8811264ad52dbe41af140221017576e 100644 --- a/aegisub/src/spline.h +++ b/aegisub/src/spline.h @@ -43,8 +43,8 @@ class Spline : private std::list<SplineCurve> { /// Visual tool to do the conversion between script and video pixels const VisualToolBase &coord_translator; /// Spline scale - int scale; - int raw_scale; + int scale = 0; + int raw_scale = 0; /// Video coordinates -> Script coordinates Vector2D ToScript(Vector2D vec) const; diff --git a/aegisub/src/subs_controller.cpp b/aegisub/src/subs_controller.cpp index 5bf93544abef36196cb2230702ba5f474c3984cb..a03051069900f4e27911bf0672275423329a108b 100644 --- a/aegisub/src/subs_controller.cpp +++ b/aegisub/src/subs_controller.cpp @@ -59,9 +59,6 @@ struct SubsController::UndoInfo { SubsController::SubsController(agi::Context *context) : context(context) , undo_connection(context->ass->AddUndoManager(&SubsController::OnCommit, this)) -, commit_id(0) -, saved_commit_id(0) -, autosaved_commit_id(0) { autosave_timer_changed(&autosave_timer); OPT_SUB("App/Auto/Save", autosave_timer_changed, &autosave_timer); diff --git a/aegisub/src/subs_controller.h b/aegisub/src/subs_controller.h index 04e1e6c45cb924e3aa06a3383c96db93c2e8c069..6ca52a351a2cbc8ac65f97a8e6dd9a4c4b3d26f1 100644 --- a/aegisub/src/subs_controller.h +++ b/aegisub/src/subs_controller.h @@ -37,11 +37,11 @@ class SubsController { boost::container::list<UndoInfo> redo_stack; /// Revision counter for undo coalescing and modified state tracking - int commit_id; + int commit_id = 0; /// Last saved version of this file - int saved_commit_id; + int saved_commit_id = 0; /// Last autosaved version of this file - int autosaved_commit_id; + int autosaved_commit_id = 0; /// Timer for triggering autosaves wxTimer autosave_timer; diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index 61371c09c88bbe0e50cc191be1257dbfea51ac89..451b653a40a64411297079218803b895b24698af 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -93,11 +93,7 @@ void time_edit_char_hook(wxKeyEvent &event) { SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxRAISED_BORDER, "SubsEditBox") -, line(nullptr) -, button_bar_split(true) -, controls_enabled(true) , c(context) -, commit_id(-1) , undo_timer(GetEventHandler()) { using std::bind; diff --git a/aegisub/src/subs_edit_box.h b/aegisub/src/subs_edit_box.h index b46fd1128421501c6ea0f0d6e2c3f64d4c23afdc..a75001b2454f3e4ba3a1cf808aec9b563aea9d73 100644 --- a/aegisub/src/subs_edit_box.h +++ b/aegisub/src/subs_edit_box.h @@ -78,14 +78,14 @@ class SubsEditBox : public wxPanel { std::deque<agi::signal::Connection> connections; /// Currently active dialogue line - AssDialogue *line; + AssDialogue *line = nullptr; /// Last seen grid selection SubtitleSelection sel; /// Are the buttons currently split into two lines? - bool button_bar_split; + bool button_bar_split = true; /// Are the controls currently enabled? - bool controls_enabled; + bool controls_enabled = true; agi::Context *c; @@ -120,7 +120,7 @@ class SubsEditBox : public wxPanel { void CommitText(wxString const& desc); /// Last commit ID for undo coalescing - int commit_id; + int commit_id = -1; /// Last used commit message to avoid coalescing different types of changes wxString last_commit_type; diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index 9073083877e86190ef7f72e67289675fee20fa79..9922138edae79388fcf3bfebec9c47b30046dca0 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -86,7 +86,6 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a : ScintillaTextCtrl(parent, -1, "", wxDefaultPosition, wsize, style) , spellchecker(SpellCheckerFactory::GetSpellChecker()) , context(context) -, calltip_position(0) { // Set properties SetWrapMode(wxSTC_WRAP_WORD); diff --git a/aegisub/src/subs_edit_ctrl.h b/aegisub/src/subs_edit_ctrl.h index fd754c4bc0bae3b363da0b4281faeebba361a5dd..84b611f4db13ecdbf070106d906c07d626b0cf6c 100644 --- a/aegisub/src/subs_edit_ctrl.h +++ b/aegisub/src/subs_edit_ctrl.h @@ -78,7 +78,7 @@ class SubsTextEditCtrl : public ScintillaTextCtrl { std::string calltip_text; /// Position of the currently show calltip - size_t calltip_position; + size_t calltip_position = 0; /// Cursor position which the current calltip is for int cursor_pos; diff --git a/aegisub/src/subtitles_provider_libass.cpp b/aegisub/src/subtitles_provider_libass.cpp index 97dd60d2da4bd7e1d9754dd599b10213f1d653eb..1347b50feeff5f61a3c29bebc1805d226c795ff0 100644 --- a/aegisub/src/subtitles_provider_libass.cpp +++ b/aegisub/src/subtitles_provider_libass.cpp @@ -83,10 +83,7 @@ void msg_callback(int level, const char *fmt, va_list args, void *) { #endif } -LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) -: ass_renderer(nullptr) -, ass_track(nullptr) -{ +LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) { auto done = std::make_shared<bool>(false); auto renderer = std::make_shared<ASS_Renderer*>(nullptr); cache_queue->Async([=]{ diff --git a/aegisub/src/subtitles_provider_libass.h b/aegisub/src/subtitles_provider_libass.h index 2a818c3cde02bd3969ba07e73529c5afbcc41ad4..cbce7873db264a5d5dda10fbfed30b4e2bfffd6e 100644 --- a/aegisub/src/subtitles_provider_libass.h +++ b/aegisub/src/subtitles_provider_libass.h @@ -39,8 +39,8 @@ extern "C" { } class LibassSubtitlesProvider : public SubtitlesProvider { - ASS_Renderer* ass_renderer; - ASS_Track* ass_track; + ASS_Renderer* ass_renderer = nullptr; + ASS_Track* ass_track = nullptr; public: LibassSubtitlesProvider(std::string); diff --git a/aegisub/src/threaded_frame_source.cpp b/aegisub/src/threaded_frame_source.cpp index 955ddb8ed5619f80e5501610c22d2d082ef00742..9cf07337634469351a07c92cde1493215793eda6 100644 --- a/aegisub/src/threaded_frame_source.cpp +++ b/aegisub/src/threaded_frame_source.cpp @@ -114,10 +114,6 @@ ThreadedFrameSource::ThreadedFrameSource(agi::fs::path const& video_filename, st , subs_provider(get_subs_provider(parent)) , video_provider(VideoProviderFactory::GetProvider(video_filename, colormatrix)) , parent(parent) -, frame_number(-1) -, time(-1.) -, single_frame(-1) -, version(0) { } diff --git a/aegisub/src/threaded_frame_source.h b/aegisub/src/threaded_frame_source.h index 1bcb7156aa13b2fee25b70b292aa60a41f93642d..fa722324574bcdbb1071ef8f4e5040c03ee305ff 100644 --- a/aegisub/src/threaded_frame_source.h +++ b/aegisub/src/threaded_frame_source.h @@ -50,8 +50,8 @@ class ThreadedFrameSource { /// Event handler to send FrameReady events to wxEvtHandler *parent; - int frame_number; ///< Last frame number requested - double time; ///< Time of the frame to pass to the subtitle renderer + int frame_number = -1; ///< Last frame number requested + double time = -1.; ///< Time of the frame to pass to the subtitle renderer /// Copy of the subtitles file to avoid having to touch the project context std::unique_ptr<AssFile> subs; @@ -59,7 +59,7 @@ class ThreadedFrameSource { /// If >= 0, the subtitles provider current has just the lines visible on /// that frame loaded. If -1, the entire file is loaded. If -2, the /// currently loaded file is out of date. - int single_frame; + int single_frame = -1; std::shared_ptr<VideoFrame> ProcFrame(int frame, double time, bool raw = false); @@ -68,7 +68,7 @@ class ThreadedFrameSource { /// Monotonic counter used to drop frames when changes arrive faster than /// they can be rendered - std::atomic<uint_fast32_t> version; + std::atomic<uint_fast32_t> version{ 0 }; public: /// @brief Load the passed subtitle file diff --git a/aegisub/src/timeedit_ctrl.cpp b/aegisub/src/timeedit_ctrl.cpp index 4e5379a43fc3ff58de2f5f84c6f957b6113888fb..8cb7efdc79f9dbd5602ec8f806d084a193631d28 100644 --- a/aegisub/src/timeedit_ctrl.cpp +++ b/aegisub/src/timeedit_ctrl.cpp @@ -60,7 +60,6 @@ enum { TimeEdit::TimeEdit(wxWindow* parent, wxWindowID id, agi::Context *c, const std::string& value, const wxSize& size, bool asEnd) : wxTextCtrl(parent, id, to_wx(value), wxDefaultPosition, size, wxTE_CENTRE | wxTE_PROCESS_ENTER) , c(c) -, byFrame(false) , isEnd(asEnd) , insert(!OPT_GET("Subtitle/Time Edit/Insert Mode")->GetBool()) , insert_opt(OPT_SUB("Subtitle/Time Edit/Insert Mode", &TimeEdit::OnInsertChanged, this)) diff --git a/aegisub/src/timeedit_ctrl.h b/aegisub/src/timeedit_ctrl.h index 30b650fca01c0707d97fefdde29e85f04c11c539..fd570f32add8abe1a086bceaa3fc0885f709497d 100644 --- a/aegisub/src/timeedit_ctrl.h +++ b/aegisub/src/timeedit_ctrl.h @@ -48,8 +48,8 @@ namespace agi { /// This control constrains values to valid times, and can display the time /// being edited as either a h:mm:ss.cc formatted time, or a frame number class TimeEdit : public wxTextCtrl { + bool byFrame = false; ///< Is the time displayed as a frame number? agi::Context *c; ///< Project context - bool byFrame; ///< Is the time displayed as a frame number? bool isEnd; ///< Should the time be treated as an end time for time <-> frame conversions? AssTime time; ///< The time, which may be displayed as either a frame number or time bool insert; ///< If true, disable overwriting behavior in time mode diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index ff549cb673267f7eeddefd0a32757249a2398bc9..a6b8913ff868b25d5ba795233996bda46a194729 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -60,14 +60,7 @@ VideoContext::VideoContext() : playback(this) -, start_ms(0) -, end_frame(0) -, frame_n(0) -, ar_value(1.) -, ar_type(AspectRatio::Default) -, has_subtitles(false) , playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video")) -, no_amend(false) { Bind(EVT_VIDEO_ERROR, &VideoContext::OnVideoError, this); Bind(EVT_SUBTITLES_ERROR, &VideoContext::OnSubtitlesError, this); diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h index f8a808e42f86c3a90c8201c358380a279d239e21..ea2c72e45b3c76a48e2645a9f622f45bf475f7b9 100644 --- a/aegisub/src/video_context.h +++ b/aegisub/src/video_context.h @@ -110,24 +110,24 @@ class VideoContext : public wxEvtHandler { /// The start time of the first frame of the current playback; undefined if /// video is not currently playing - int start_ms; + int start_ms = 0; /// The last frame to play if video is currently playing - int end_frame; + int end_frame = 0; /// The frame number which was last requested from the video provider, /// which may not be the same thing as the currently displayed frame - int frame_n; + int frame_n = 0; /// The picture aspect ratio of the video if the aspect ratio has been /// overridden by the user - double ar_value; + double ar_value = 1.; /// The current AR type - AspectRatio ar_type; + AspectRatio ar_type = AspectRatio::Default; /// Does the currently loaded video file have subtitles muxed into it? - bool has_subtitles; + bool has_subtitles = false; /// Filename of the currently loaded timecodes file, or empty if timecodes /// have not been overridden @@ -140,7 +140,7 @@ class VideoContext : public wxEvtHandler { /// be kept in perfect sync. Saving the file can add lines to the file /// without a commit, breaking this sync, so force a non-amend after each /// save. - bool no_amend; + bool no_amend = false; void OnPlayTimer(wxTimerEvent &event); diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 26a695ac11f6be57837e825ac86605bce237a96f..1db23d5f38c2627d50ea3c84e5a08626fbad497e 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -95,11 +95,6 @@ VideoDisplay::VideoDisplay( : wxGLCanvas(parent, -1, attribList) , autohideTools(OPT_GET("Tool/Visual/Autohide")) , con(c) -, viewport_left(0) -, viewport_width(0) -, viewport_bottom(0) -, viewport_top(0) -, viewport_height(0) , zoomValue(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125) , toolBar(visualSubToolBar) , zoomBox(zoomBox) diff --git a/aegisub/src/video_display.h b/aegisub/src/video_display.h index 96c9636d3f74d5a0950ae042f72bb96634766ca6..977c5f829f6d024d0f641e6530dda92b2ba5cac5 100644 --- a/aegisub/src/video_display.h +++ b/aegisub/src/video_display.h @@ -73,15 +73,15 @@ class VideoDisplay : public wxGLCanvas { Vector2D last_mouse_pos, mouse_pos; /// Screen pixels between the left of the canvas and the left of the video - int viewport_left; + int viewport_left = 0; /// The width of the video in screen pixels - int viewport_width; + int viewport_width = 0; /// Screen pixels between the bottom of the canvas and the bottom of the video; used for glViewport - int viewport_bottom; + int viewport_bottom = 0; /// Screen pixels between the bottom of the canvas and the top of the video; used for coordinate space conversion - int viewport_top; + int viewport_top = 0; /// The height of the video in screen pixels - int viewport_height; + int viewport_height = 0; /// The current zoom level, where 1.0 = 100% double zoomValue; diff --git a/aegisub/src/video_out_gl.cpp b/aegisub/src/video_out_gl.cpp index f68e36b08aba6d3de3ec755704ae4e9598bcb095..cbfe2c251160c0d013b2d7b60a2f3c87da94fd1e 100644 --- a/aegisub/src/video_out_gl.cpp +++ b/aegisub/src/video_out_gl.cpp @@ -50,16 +50,10 @@ /// @brief Structure tracking all precomputable information about a subtexture struct VideoOutGL::TextureInfo { - GLuint textureID; - int dataOffset; - int sourceH; - int sourceW; - TextureInfo() - : textureID(0) - , dataOffset(0) - , sourceH(0) - , sourceW(0) - { } + GLuint textureID = 0; + int dataOffset = 0; + int sourceH = 0; + int sourceW = 0; }; /// @brief Test if a texture can be created @@ -76,21 +70,7 @@ static bool TestTexture(int width, int height, GLint format) { return format != 0; } -VideoOutGL::VideoOutGL() -: maxTextureSize(0) -, supportsRectangularTextures(false) -, internalFormat(0) -, frameWidth(0) -, frameHeight(0) -, frameFormat(0) -, frameFlipped(false) -, textureIdList() -, textureList() -, dl(0) -, textureCount(0) -, textureRows(0) -, textureCols(0) -{ } +VideoOutGL::VideoOutGL() { } /// @brief Runtime detection of required OpenGL capabilities void VideoOutGL::DetectOpenGLCapabilities() { diff --git a/aegisub/src/video_out_gl.h b/aegisub/src/video_out_gl.h index 39abe4a35c9ff3099b9488e4fbee7415d1cdfd97..be690eae17420648fc209d4a6b09e72be7a9e113 100644 --- a/aegisub/src/video_out_gl.h +++ b/aegisub/src/video_out_gl.h @@ -31,38 +31,38 @@ class VideoOutGL { struct TextureInfo; /// The maximum texture size supported by the user's graphics card - int maxTextureSize; + int maxTextureSize = 0; /// Whether rectangular textures are supported by the user's graphics card - bool supportsRectangularTextures; + bool supportsRectangularTextures = false; /// The internalformat to use - int internalFormat; + int internalFormat = 0; /// The frame height which the texture grid has been set up for - int frameWidth; + int frameWidth = 0; /// The frame width which the texture grid has been set up for - int frameHeight; + int frameHeight = 0; /// The frame format which the texture grid has been set up for - GLenum frameFormat; + GLenum frameFormat = 0; /// Whether the grid is set up for flipped video - bool frameFlipped; + bool frameFlipped = false; /// List of OpenGL texture ids used in the grid std::vector<GLuint> textureIdList; /// List of precalculated texture display information std::vector<TextureInfo> textureList; /// OpenGL display list which draws the frames - GLuint dl; + GLuint dl = 0; /// The total texture count - int textureCount; + int textureCount = 0; /// The number of rows of textures - int textureRows; + int textureRows = 0; /// The number of columns of textures - int textureCols; + int textureCols = 0; void DetectOpenGLCapabilities(); void InitTextures(int width, int height, GLenum format, int bpp, bool flipped); - VideoOutGL(const VideoOutGL &); - VideoOutGL& operator=(const VideoOutGL&); + VideoOutGL(const VideoOutGL &) = delete; + VideoOutGL& operator=(const VideoOutGL&) = delete; public: /// @brief Set the frame to be displayed when Render() is called /// @param frame The frame to be displayed diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index c12df4abc05c3fc007cdcb404c5ed2dad6f0b146..b0d359dc4efb2378a03d8300fb35922f2f56c5df 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -74,9 +74,6 @@ std::string colormatrix_description(int cs, int cr) { FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try : VideoSource(nullptr, FFMS_DestroyVideoSource) -, VideoInfo(nullptr) -, Width(-1) -, Height(-1) { ErrInfo.Buffer = FFMSErrMsg; ErrInfo.BufferSize = sizeof(FFMSErrMsg); diff --git a/aegisub/src/video_provider_ffmpegsource.h b/aegisub/src/video_provider_ffmpegsource.h index 11db850f476e2ab77e9a097f2cb3a29585422a09..f9793fbec999fc215c12c20ebc6147b067ba011a 100644 --- a/aegisub/src/video_provider_ffmpegsource.h +++ b/aegisub/src/video_provider_ffmpegsource.h @@ -41,10 +41,10 @@ class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider { /// video source object agi::scoped_holder<FFMS_VideoSource*, void (FFMS_CC*)(FFMS_VideoSource*)> VideoSource; - const FFMS_VideoProperties *VideoInfo; ///< video properties + const FFMS_VideoProperties *VideoInfo = nullptr; ///< video properties - int Width; ///< width in pixels - int Height; ///< height in pixels + int Width = -1; ///< width in pixels + int Height = -1; ///< height in pixels double DAR; ///< display aspect ratio std::vector<int> KeyFramesList; ///< list of keyframes agi::vfr::Framerate Timecodes; ///< vfr object diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index eec44a6d8e6ce854f1aa9698c80ae5394b183f97..8ffbd8c29d4d2b6278753869a2aad404b1c05aba 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -58,15 +58,7 @@ /// @brief Constructor /// @param filename The filename to open -YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(agi::fs::path const& filename, std::string const&) -: sf(nullptr) -, inited(false) -, w (0) -, h (0) -, num_frames(-1) -, pixfmt(Y4M_PIXFMT_NONE) -, imode(Y4M_ILACE_NOTSET) -{ +YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(agi::fs::path const& filename, std::string const&) { fps_rat.num = -1; fps_rat.den = 1; diff --git a/aegisub/src/video_provider_yuv4mpeg.h b/aegisub/src/video_provider_yuv4mpeg.h index 370aac7992d4226b22db09d46e85e78c4dae18a9..d6017085392332d641e2b6d9e51ac06121d19a45 100644 --- a/aegisub/src/video_provider_yuv4mpeg.h +++ b/aegisub/src/video_provider_yuv4mpeg.h @@ -100,17 +100,17 @@ class YUV4MPEGVideoProvider : public VideoProvider { Y4M_FFLAG_C_UNKNOWN = 0x0800 /// unknown (only allowed for non-4:2:0 sampling) }; - FILE *sf; /// source file - bool inited; /// initialization state + FILE *sf = nullptr; /// source file + bool inited = false; /// initialization state - int w, h; /// frame width/height - int num_frames; /// length of file in frames + int w = 0, h = 0; /// frame width/height + int num_frames = -1; /// length of file in frames int frame_sz; /// size of each frame in bytes int luma_sz; /// size of the luma plane of each frame, in bytes int chroma_sz; /// size of one of the two chroma planes of each frame, in bytes - Y4M_PixelFormat pixfmt; /// colorspace/pixel format - Y4M_InterlacingMode imode; /// interlacing mode (for the entire stream) + Y4M_PixelFormat pixfmt = Y4M_PIXFMT_NONE; /// colorspace/pixel format + Y4M_InterlacingMode imode = Y4M_ILACE_NOTSET; /// interlacing mode (for the entire stream) struct { int num; /// numerator int den; /// denominator diff --git a/aegisub/src/video_slider.cpp b/aegisub/src/video_slider.cpp index f86fee77a17b9aa7f847f7a6b12e93407703682d..db5fa076d362f008c7467934799c8b61b6878ada 100644 --- a/aegisub/src/video_slider.cpp +++ b/aegisub/src/video_slider.cpp @@ -50,8 +50,6 @@ VideoSlider::VideoSlider (wxWindow* parent, agi::Context *c) : wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE) , c(c) -, val(0) -, max(1) { SetClientSize(20,25); SetMinSize(wxSize(20, 25)); diff --git a/aegisub/src/video_slider.h b/aegisub/src/video_slider.h index d37dfee2f62ffec6e1c953f00bb8b99d2c4c9438..8ae03025c2a76f9ae6da69e1f9d43e61a8c1a95f 100644 --- a/aegisub/src/video_slider.h +++ b/aegisub/src/video_slider.h @@ -49,8 +49,8 @@ class VideoSlider: public wxWindow { std::vector<int> keyframes; ///< Currently loaded keyframes std::vector<agi::signal::Connection> slots; - int val; ///< Current frame number - int max; ///< Last frame number + int val = 0; ///< Current frame number + int max = 1; ///< Last frame number /// Get the frame number for the given x coordinate int GetValueAtX(int x); diff --git a/aegisub/src/visual_feature.cpp b/aegisub/src/visual_feature.cpp index 2a94edd89d73d734313d601da210d0ca70f21bdc..366694b0c93a8a2f40a8acdeedf768cf1b688ccb 100644 --- a/aegisub/src/visual_feature.cpp +++ b/aegisub/src/visual_feature.cpp @@ -37,13 +37,6 @@ #include "gl_wrap.h" #include "visual_feature.h" -VisualDraggableFeature::VisualDraggableFeature() -: type(DRAG_NONE) -, layer(0) -, line(nullptr) -{ -} - bool VisualDraggableFeature::IsMouseOver(Vector2D mouse_pos) const { if (!pos) return false; diff --git a/aegisub/src/visual_feature.h b/aegisub/src/visual_feature.h index ef4c935b56d51e19ca972f76bb070daf34a3011d..4b3fb6ed00cf8a02b31f566fffc41974d953c1eb 100644 --- a/aegisub/src/visual_feature.h +++ b/aegisub/src/visual_feature.h @@ -60,13 +60,10 @@ class VisualDraggableFeature : public boost::intrusive::make_list_base_hook<boos Vector2D start; ///< position before the last drag operation began public: - /// Constructor - VisualDraggableFeature(); - - DraggableFeatureType type; ///< Shape of feature - Vector2D pos; ///< Position of this feature - int layer; ///< Layer; Higher = above - AssDialogue* line; ///< The dialogue line this feature is for; may be nullptr + DraggableFeatureType type = DRAG_NONE; ///< Shape of feature + Vector2D pos; ///< Position of this feature + int layer = 0; ///< Layer; Higher = above + AssDialogue* line = nullptr; ///< The dialogue line this feature is for; may be nullptr /// @brief Is the given point over this feature? /// @param mouse_pos Position of the mouse diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index a24a235a6bb5ad5df82d8c0bcfc4389575c66cac..c32a40a1d9246e212e2a804c3a1351f1579faffd 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -53,15 +53,8 @@ const wxColour VisualToolBase::colour[] = { VisualToolBase::VisualToolBase(VideoDisplay *parent, agi::Context *context) : c(context) , parent(parent) -, holding(false) -, active_line(nullptr) -, dragging(false) , frame_number(c->videoController->GetFrameN()) -, shift_down(false) -, ctrl_down(false) -, alt_down(false) , file_changed_connection(c->ass->AddCommitListener(&VisualToolBase::OnCommit, this)) -, commit_id(-1) { int script_w, script_h; c->ass->GetResolution(script_w, script_h); @@ -169,8 +162,6 @@ Vector2D VisualToolBase::FromScriptCoords(Vector2D point) const { template<class FeatureType> VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, agi::Context *context) : VisualToolBase(parent, context) -, sel_changed(false) -, active_feature(nullptr) { } diff --git a/aegisub/src/visual_tool.h b/aegisub/src/visual_tool.h index 01632f3e613b513ae63bd256ab6d3a43c102e310..1d4b14abc7ba549ae3ad60fd2c94fd2e93713068 100644 --- a/aegisub/src/visual_tool.h +++ b/aegisub/src/visual_tool.h @@ -92,15 +92,15 @@ protected: agi::Context *c; VideoDisplay *parent; - bool holding; ///< Is a hold currently in progress? - AssDialogue *active_line; ///< Active dialogue line; nullptr if it is not visible on the current frame - bool dragging; ///< Is a drag currently in progress? + bool holding = false; ///< Is a hold currently in progress? + AssDialogue *active_line = nullptr; ///< Active dialogue line; nullptr if it is not visible on the current frame + bool dragging = false; ///< Is a drag currently in progress? int frame_number; ///< Current frame number - bool shift_down; ///< Is shift down? - bool ctrl_down; ///< Is ctrl down? - bool alt_down; ///< Is alt down? + bool shift_down = false; ///< Is shift down? + bool ctrl_down = false; ///< Is ctrl down? + bool alt_down = false; ///< Is alt down? Vector2D mouse_pos; ///< Last seen mouse position Vector2D drag_start; ///< Mouse position at the beginning of the last drag @@ -109,7 +109,7 @@ protected: Vector2D video_res; ///< Video resolution agi::signal::Connection file_changed_connection; - int commit_id; ///< Last used commit id for coalescing + int commit_id = -1; ///< Last used commit id for coalescing /// @brief Commit the current file state /// @param message Description of changes for undo @@ -153,7 +153,7 @@ protected: typedef agi::owning_intrusive_list<FeatureType> feature_list; private: - bool sel_changed; /// Has the selection already been changed in the current click? + bool sel_changed = false; /// Has the selection already been changed in the current click? /// @brief Called when a hold is begun /// @return Should the hold actually happen? @@ -176,7 +176,7 @@ protected: std::set<FeatureType *> sel_features; ///< Currently selected visual features /// Topmost feature under the mouse; generally only valid during a drag - FeatureType *active_feature; + FeatureType *active_feature = nullptr; /// List of features which are drawn and can be clicked on /// List is used here for the iterator invalidation properties feature_list features; diff --git a/aegisub/src/visual_tool_clip.cpp b/aegisub/src/visual_tool_clip.cpp index ad9965a89b9c999acd46cb48f7b9b3703aa0d61c..c7f8ce6a868e107c20781d9ab23dd198bcfdb4a7 100644 --- a/aegisub/src/visual_tool_clip.cpp +++ b/aegisub/src/visual_tool_clip.cpp @@ -34,7 +34,6 @@ VisualToolClip::VisualToolClip(VideoDisplay *parent, agi::Context *context) : VisualTool<ClipCorner>(parent, context) , cur_1(0, 0) , cur_2(video_res) -, inverse(false) { ClipCorner *feats[4]; for (auto& feat : feats) { diff --git a/aegisub/src/visual_tool_clip.h b/aegisub/src/visual_tool_clip.h index 443def1ed33deed1aaa1a39bd928aea7e28ee038..651657eacf00c601b8643a5243d95c6181319ff9 100644 --- a/aegisub/src/visual_tool_clip.h +++ b/aegisub/src/visual_tool_clip.h @@ -33,7 +33,7 @@ class VisualToolClip : public VisualTool<ClipCorner> { Vector2D cur_1; Vector2D cur_2; - bool inverse; ///< Is this currently in iclip mode? + bool inverse = false; ///< Is this currently in iclip mode? bool InitializeHold() override; void UpdateHold() override; diff --git a/aegisub/src/visual_tool_drag.cpp b/aegisub/src/visual_tool_drag.cpp index 7eacf62e66f35e8e69550f1de6cd59be63eaac9b..8ef89b34ebd20e290a4d1705a9ce7cbd293b3cf3 100644 --- a/aegisub/src/visual_tool_drag.cpp +++ b/aegisub/src/visual_tool_drag.cpp @@ -48,8 +48,6 @@ static const DraggableFeatureType DRAG_END = DRAG_BIG_CIRCLE; VisualToolDrag::VisualToolDrag(VideoDisplay *parent, agi::Context *context) : VisualTool<VisualToolDragDraggableFeature>(parent, context) -, primary(nullptr) -, button_is_move(true) { c->selectionController->GetSelectedSet(selection); connections.push_back(c->selectionController->AddSelectionListener(&VisualToolDrag::OnSelectedSetChanged, this)); diff --git a/aegisub/src/visual_tool_drag.h b/aegisub/src/visual_tool_drag.h index 461e9909dd5baf5e929628024bd1203d0e4a764a..ce1e604abd35c137a84261dcba85e413674bec10 100644 --- a/aegisub/src/visual_tool_drag.h +++ b/aegisub/src/visual_tool_drag.h @@ -43,13 +43,13 @@ class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> { /// Equal to curFeature during drags; possibly different at all other times /// nullptr if no features have been clicked on or the last clicked on one no /// longer exists - Feature *primary; + Feature *primary = nullptr; /// The last announced selection set SubtitleSelection selection; /// When the button is pressed, will it convert the line to a move (vs. from /// move to pos)? Used to avoid changing the button's icon unnecessarily - bool button_is_move; + bool button_is_move = false; /// @brief Create the features for a line /// @param diag Line to create the features for diff --git a/aegisub/src/visual_tool_rotatexy.cpp b/aegisub/src/visual_tool_rotatexy.cpp index 294dbf9bbe55d6380051d70dec6be23469c28c1f..7df36e07ab3dd3a0e142fe49f68d96c37ab4ef4f 100644 --- a/aegisub/src/visual_tool_rotatexy.cpp +++ b/aegisub/src/visual_tool_rotatexy.cpp @@ -27,11 +27,6 @@ VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, agi::Context *context) : VisualTool<VisualDraggableFeature>(parent, context) -, angle_x(0) -, angle_y(0) -, angle_z(0) -, orig_x(0) -, orig_y(0) { org = new Feature; org->type = DRAG_BIG_TRIANGLE; diff --git a/aegisub/src/visual_tool_rotatexy.h b/aegisub/src/visual_tool_rotatexy.h index 4df6a93ffa4e922a4e21ce16bfd79d1a1bb84edb..9379ba8af2020e39f6a8920b87038d76fa346648 100644 --- a/aegisub/src/visual_tool_rotatexy.h +++ b/aegisub/src/visual_tool_rotatexy.h @@ -23,12 +23,12 @@ #include "visual_tool.h" class VisualToolRotateXY : public VisualTool<VisualDraggableFeature> { - float angle_x; /// Current x rotation - float angle_y; /// Current y rotation - float angle_z; /// Current z rotation + float angle_x = 0.f; /// Current x rotation + float angle_y = 0.f; /// Current y rotation + float angle_z = 0.f; /// Current z rotation - float orig_x; ///< x rotation at the beginning of the current hold - float orig_y; ///< y rotation at the beginning of the current hold + float orig_x = 0.f; ///< x rotation at the beginning of the current hold + float orig_y = 0.f; ///< y rotation at the beginning of the current hold Feature *org; diff --git a/aegisub/src/visual_tool_rotatez.cpp b/aegisub/src/visual_tool_rotatez.cpp index ae83a948a8a0a5bc69cb3fc521166a8ff413e9a2..a23b935e164b9a3a6a71273aec21475191c00cf7 100644 --- a/aegisub/src/visual_tool_rotatez.cpp +++ b/aegisub/src/visual_tool_rotatez.cpp @@ -32,10 +32,6 @@ static const float rad2deg = 180.f / 3.1415926536f; VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, agi::Context *context) : VisualTool<VisualDraggableFeature>(parent, context) -, angle(0) -, orig_angle(0) -, rotation_x(0) -, rotation_y(0) , org(new Feature) { features.push_back(*org); diff --git a/aegisub/src/visual_tool_rotatez.h b/aegisub/src/visual_tool_rotatez.h index 336e9720ddb82a3aabaa1ea01caf76e50a9c0a1c..b1083947cfaa96756afdc7d32b5e262cb67fa873 100644 --- a/aegisub/src/visual_tool_rotatez.h +++ b/aegisub/src/visual_tool_rotatez.h @@ -23,13 +23,13 @@ #include "visual_tool.h" class VisualToolRotateZ : public VisualTool<VisualDraggableFeature> { - float angle; ///< Current Z rotation - float orig_angle; ///< Z rotation at the beginning of the current hold + float angle = 0.f; ///< Current Z rotation + float orig_angle = 0.f; ///< Z rotation at the beginning of the current hold Vector2D pos; ///< Position of the dialogue line Vector2D scale; ///< Current scale - float rotation_x; ///< Current X rotation - float rotation_y; ///< Current Y rotation + float rotation_x = 0.f; ///< Current X rotation + float rotation_y = 0.f; ///< Current Y rotation Feature *org; ///< The origin feature diff --git a/aegisub/src/visual_tool_scale.cpp b/aegisub/src/visual_tool_scale.cpp index 362fafc04300dcb925c655daa8baa7ac041053a8..8e4670ac2ff869399867d8962c4c0d81ddb5b7f8 100644 --- a/aegisub/src/visual_tool_scale.cpp +++ b/aegisub/src/visual_tool_scale.cpp @@ -28,9 +28,6 @@ VisualToolScale::VisualToolScale(VideoDisplay *parent, agi::Context *context) : VisualTool<VisualDraggableFeature>(parent, context) -, rx(0) -, ry(0) -, rz(0) { } diff --git a/aegisub/src/visual_tool_scale.h b/aegisub/src/visual_tool_scale.h index 1cb069344dcbc9db8ae7ee86a31934e139eb3a75..623f73ce4c22192c8e8600205c7eeddbebc02f21 100644 --- a/aegisub/src/visual_tool_scale.h +++ b/aegisub/src/visual_tool_scale.h @@ -27,9 +27,9 @@ class VisualToolScale : public VisualTool<VisualDraggableFeature> { Vector2D initial_scale; ///< The scale at the beginning of the current hold Vector2D pos; ///< Position of the line - float rx; ///< X rotation - float ry; ///< Y rotation - float rz; ///< Z rotation + float rx = 0.f; ///< X rotation + float ry = 0.f; ///< Y rotation + float rz = 0.f; ///< Z rotation bool InitializeHold() override; void UpdateHold() override; diff --git a/aegisub/src/visual_tool_vector_clip.cpp b/aegisub/src/visual_tool_vector_clip.cpp index c9c8f9a4933de9f756169b20b34b89965fa9e80e..0619b625fee69e1abdd8aef98d589c971b4bb0da 100644 --- a/aegisub/src/visual_tool_vector_clip.cpp +++ b/aegisub/src/visual_tool_vector_clip.cpp @@ -52,9 +52,6 @@ enum { VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, agi::Context *context) : VisualTool<VisualToolVectorClipDraggableFeature>(parent, context) , spline(*this) -, toolBar(nullptr) -, mode(0) -, inverse(false) { } diff --git a/aegisub/src/visual_tool_vector_clip.h b/aegisub/src/visual_tool_vector_clip.h index 11cd541a64a7ee3383e9f53d6889a8096e2e2efd..761a262197a0007588c41447207ae1640f922dc2 100644 --- a/aegisub/src/visual_tool_vector_clip.h +++ b/aegisub/src/visual_tool_vector_clip.h @@ -42,9 +42,9 @@ struct VisualToolVectorClipDraggableFeature : public VisualDraggableFeature { class VisualToolVectorClip : public VisualTool<VisualToolVectorClipDraggableFeature> { Spline spline; /// The current spline - wxToolBar *toolBar; /// The subtoolbar - int mode; /// 0-7 - bool inverse; /// is iclip? + wxToolBar *toolBar = nullptr; /// The subtoolbar + int mode = 0; /// 0-7 + bool inverse = false; /// is iclip? std::set<Feature *> box_added;