reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 9367e1b8d68d0bf24d69a30775d5f49cc2388c2d
parent f32c826a00dd174e6ac31f0e132c2f0341d2d2f7
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Tue, 21 Jun 2016 14:19:07 -0400

refactoring!

Diffstat:
Mmacosx.tup | 2+-
Msrc/listview.cpp | 3+--
Msrc/menu.cpp | 1+
Msrc/time.cpp | 31+++++--------------------------
4 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/macosx.tup b/macosx.tup @@ -4,7 +4,7 @@ REAPACK_FILE = reaper_reapack@(SUFFIX).dylib CXXFLAGS := -Wall -Wextra -Werror CXXFLAGS += -Wno-unused-parameter -Wno-missing-field-initializers -CXXFLAGS += -Wno-unused-function +CXXFLAGS += -Wno-unused-function -Wno-missing-braces CXXFLAGS += -fdiagnostics-color -fstack-protector-strong -fvisibility=hidden CXXFLAGS += -pipe -fPIC -O2 -std=c++14 CXXFLAGS += -Ivendor -Ivendor/WDL -Ivendor/WDL/WDL -Ivendor/WDL/WDL/swell diff --git a/src/listview.cpp b/src/listview.cpp @@ -120,7 +120,6 @@ void ListView::removeRow(const int userIndex) ListView_DeleteItem(handle(), viewIndex); m_rows.erase(m_rows.begin() + userIndex); - } void ListView::resizeColumn(const int index, const int width) @@ -452,7 +451,7 @@ void ListView::resetColumns() bool ListView::restore(const string &data, const int userVersion) { - m_userVersion = userVersion; // for save() + m_userVersion = userVersion; // for save(). also enables advanced customization setExStyle(LVS_EX_HEADERDRAGDROP, true); // enable column reordering if(data.empty()) diff --git a/src/menu.cpp b/src/menu.cpp @@ -95,6 +95,7 @@ int Menu::show(const int x, const int y, HWND parent) const TPM_TOPALIGN | TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RETURNCMD, x, y, 0, parent, nullptr); + // both send the notification and return the command id SendMessage(parent, WM_COMMAND, command, 0); return command; diff --git a/src/time.cpp b/src/time.cpp @@ -17,6 +17,7 @@ #include "time.hpp" +#include <array> #include <iomanip> #include <sstream> @@ -57,35 +58,13 @@ string Time::toString() const int Time::compare(const Time &o) const { - if(year() > o.year()) - return 1; - else if(year() < o.year()) - return -1; - - if(month() > o.month()) - return 1; - else if(month() < o.month()) - return -1; - - if(day() > o.day()) - return 1; - else if(day() < o.day()) - return -1; + const array<int, 6> l{year(), month(), day(), hour(), minute(), second()}; + const array<int, 6> r{o.year(), o.month(), o.day(), o.hour(), o.minute(), o.second()}; - if(hour() > o.hour()) - return 1; - else if(hour() < o.hour()) + if(l < r) return -1; - - if(minute() > o.minute()) + else if(l > r) return 1; - else if(minute() < o.minute()) - return -1; - - if(second() > o.second()) - return 1; - else if(second() < o.second()) - return -1; return 0; }