Skip to content

Commit c5c4cee

Browse files
authored
Merge pull request #61 from mimaraka/develop
v2.0-beta1.0
2 parents ec93d32 + 3809244 commit c5c4cee

File tree

179 files changed

+3120
-1567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+3120
-1567
lines changed

THIRD_PARTY_LICENSES.md

Lines changed: 767 additions & 0 deletions
Large diffs are not rendered by default.

curve_editor/actctx_helper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include "actctx_helper.hpp"
2-
#include "constants.hpp"
32
#include "resource.h"
3+
#include "util.hpp"
44
#include <WinBase.h>
55

66

77

8-
namespace cved {
8+
namespace curve_editor {
99
bool ActCtxHelper::init() noexcept {
1010
ACTCTXA actctx{
1111
.cbSize = sizeof(ACTCTXA),
1212
.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID,
1313
.lpResourceName = MAKEINTRESOURCEA(ID_MANIFEST_VISUALSTYLE),
14-
.hModule = ::GetModuleHandleA(global::PLUGIN_DLL_NAME)
14+
.hModule = util::get_hinst()
1515
};
1616
HANDLE tmp = NULL;
1717
::GetCurrentActCtx(&tmp);
@@ -39,4 +39,4 @@ namespace cved {
3939
if (hactctx_) ::ReleaseActCtx(hactctx_);
4040
return ret;
4141
}
42-
} // namespace cved
42+
} // namespace curve_editor

curve_editor/actctx_helper.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66

7-
namespace cved {
7+
namespace curve_editor {
88
class ActCtxHelper {
99
ULONG_PTR cookie_ = 0ul;
1010
HANDLE hactctx_ = NULL;
@@ -13,4 +13,4 @@ namespace cved {
1313
bool init() noexcept;
1414
bool exit();
1515
};
16-
} // namespace cved
16+
} // namespace curve_editor

curve_editor/config.cpp

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include "config.hpp"
2-
#include "constants.hpp"
32
#include "curve_editor.hpp"
43
#include "global.hpp"
4+
#include "preset_manager.hpp"
55
#include "string_table.hpp"
6+
#include "util.hpp"
67
#include <fstream>
78

89

910

10-
namespace cved::global {
11+
namespace curve_editor::global {
1112
Config::Config() noexcept :
1213
edit_mode_{ EditMode::Normal },
1314
layout_mode_{ LayoutMode::Horizontal },
@@ -36,9 +37,9 @@ namespace cved::global {
3637
::GetModuleFileNameA(NULL, path_str, MAX_PATH);
3738
std::filesystem::path path_aviutl{ path_str };
3839
dir_aviutl_ = path_aviutl.parent_path();
39-
::GetModuleFileNameA(::GetModuleHandleA(global::PLUGIN_DLL_NAME), path_str, MAX_PATH);
40+
::GetModuleFileNameA(util::get_hinst(), path_str, MAX_PATH);
4041
std::filesystem::path path_plugin{ path_str };
41-
dir_plugin_ = path_plugin.parent_path() / "curve_editor";
42+
dir_plugin_ = path_plugin.parent_path() / global::PLUGIN_NAME;
4243
}
4344

4445
bool Config::set_language(Language language) noexcept {
@@ -154,28 +155,31 @@ namespace cved::global {
154155
if (data.contains("preferences")) {
155156
pref_.from_json(data["preferences"]);
156157
}
157-
set_from_json(this, data, GET_KEY(edit_mode_), &Config::set_edit_mode);
158-
set_from_json(this, data, GET_KEY(layout_mode_), &Config::set_layout_mode);
158+
if (data.contains("preset_list_config")) {
159+
global::preset_manager.list_config_from_json(data["preset_list_config"]);
160+
}
161+
util::set_from_json(this, data, GET_KEY(edit_mode_), &Config::set_edit_mode);
162+
util::set_from_json(this, data, GET_KEY(layout_mode_), &Config::set_layout_mode);
159163
if (data[GET_KEY(apply_mode_)].is_array()) {
160164
size_t count = 0u;
161165
for (const auto& el : data[GET_KEY(apply_mode_)]) {
162166
if (count >= apply_mode_.size()) break;
163167
set_apply_mode((EditMode)count++, (ApplyMode)el);
164168
}
165169
}
166-
set_from_json(data, GET_KEY(curve_code_bezier_), curve_code_bezier_);
167-
set_from_json(data, GET_KEY(curve_code_elastic_), curve_code_elastic_);
168-
set_from_json(data, GET_KEY(curve_code_bounce_), curve_code_bounce_);
169-
set_from_json(this, data, GET_KEY(show_library_), &Config::set_show_library);
170-
set_from_json(this, data, GET_KEY(show_velocity_graph_), &Config::set_show_velocity_graph);
171-
set_from_json(this, data, GET_KEY(show_x_label_), &Config::set_show_x_label);
172-
set_from_json(this, data, GET_KEY(show_y_label_), &Config::set_show_y_label);
173-
set_from_json(this, data, GET_KEY(align_handle_), &Config::set_align_handle);
174-
set_from_json(this, data, GET_KEY(ignore_autosaver_warning_), &Config::set_ignore_autosaver_warning);
175-
set_from_json(this, data, GET_KEY(separator_pos_), &Config::set_separator_pos);
176-
set_from_json(this, data, GET_KEY(preset_size_), &Config::set_preset_size);
177-
set_from_json(data, "select_window_width", select_window_size_.width);
178-
set_from_json(data, "select_window_height", select_window_size_.height);
170+
util::set_from_json(data, GET_KEY(curve_code_bezier_), curve_code_bezier_);
171+
util::set_from_json(data, GET_KEY(curve_code_elastic_), curve_code_elastic_);
172+
util::set_from_json(data, GET_KEY(curve_code_bounce_), curve_code_bounce_);
173+
util::set_from_json(this, data, GET_KEY(show_library_), &Config::set_show_library);
174+
util::set_from_json(this, data, GET_KEY(show_velocity_graph_), &Config::set_show_velocity_graph);
175+
util::set_from_json(this, data, GET_KEY(show_x_label_), &Config::set_show_x_label);
176+
util::set_from_json(this, data, GET_KEY(show_y_label_), &Config::set_show_y_label);
177+
util::set_from_json(this, data, GET_KEY(align_handle_), &Config::set_align_handle);
178+
util::set_from_json(this, data, GET_KEY(ignore_autosaver_warning_), &Config::set_ignore_autosaver_warning);
179+
util::set_from_json(this, data, GET_KEY(separator_pos_), &Config::set_separator_pos);
180+
util::set_from_json(this, data, GET_KEY(preset_size_), &Config::set_preset_size);
181+
util::set_from_json(data, "select_window_width", select_window_size_.width);
182+
util::set_from_json(data, "select_window_height", select_window_size_.height);
179183
}
180184
catch (const nlohmann::json::exception&) {
181185
return false;
@@ -185,17 +189,20 @@ namespace cved::global {
185189

186190
// jsonファイルを保存
187191
bool Config::save_json() {
188-
nlohmann::json data_pref;
189-
pref_.to_json(&data_pref);
190-
191-
nlohmann::json data = {
192-
{"preferences", data_pref},
192+
nlohmann::json json_pref;
193+
pref_.to_json(json_pref);
194+
nlohmann::json json_preset_list_config;
195+
global::preset_manager.list_config_to_json(json_preset_list_config);
196+
197+
nlohmann::json json = {
198+
{"preferences", json_pref},
199+
{"preset_list_config", json_preset_list_config},
193200
{GET_KEY(edit_mode_), edit_mode_},
194201
{GET_KEY(layout_mode_), layout_mode_},
195202
{GET_KEY(apply_mode_), apply_mode_},
196-
{"curve_code_bezier", editor.editor_graph().curve_bezier()->encode()},
197-
{"curve_code_elastic", editor.editor_graph().curve_elastic()->encode()},
198-
{"curve_code_bounce", editor.editor_graph().curve_bounce()->encode()},
203+
{"curve_code_bezier", editor.editor_graph().curve_bezier().encode()},
204+
{"curve_code_elastic", editor.editor_graph().curve_elastic().encode()},
205+
{"curve_code_bounce", editor.editor_graph().curve_bounce().encode()},
199206
{GET_KEY(show_library_), show_library_},
200207
{GET_KEY(show_x_label_), show_x_label_},
201208
{GET_KEY(show_y_label_), show_y_label_},
@@ -210,9 +217,9 @@ namespace cved::global {
210217

211218
std::ofstream ofs{ dir_plugin_ / CONFIG_FILE_NAME };
212219
if (!ofs) return false;
213-
ofs << data.dump(2);
220+
ofs << json.dump(2);
214221
return true;
215222
}
216223

217224
#undef GET_KEY
218-
} // namespace cved::global
225+
} // namespace curve_editor::global

curve_editor/config.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111

12-
namespace cved::global {
12+
namespace curve_editor::global {
1313
inline class Config {
1414
private:
1515
static constexpr char CONFIG_FILE_NAME[] = "config.json";
@@ -110,8 +110,8 @@ namespace cved::global {
110110
auto get_notify_update() const noexcept { return pref_.notify_update; }
111111
void set_notify_update(bool notify_update) noexcept { pref_.notify_update = notify_update; }
112112

113-
auto get_set_bg_image() const noexcept { return pref_.set_bg_image; }
114-
void set_set_bg_image(bool set_bg_image) noexcept { pref_.set_bg_image = set_bg_image; }
113+
auto get_show_bg_image() const noexcept { return pref_.show_bg_image; }
114+
void set_show_bg_image(bool show_bg_image) noexcept { pref_.show_bg_image = show_bg_image; }
115115

116116
auto get_bg_image_path() const noexcept { return pref_.bg_image_path; }
117117
void set_bg_image_path(const std::filesystem::path& bg_image_path) noexcept { pref_.bg_image_path = bg_image_path; }
@@ -148,4 +148,4 @@ namespace cved::global {
148148
bool load_json();
149149
bool save_json();
150150
} config;
151-
} // namespace cved::global
151+
} // namespace curve_editor::global

curve_editor/constants.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66

7-
namespace cved::global {
7+
namespace curve_editor::global {
88
inline constexpr size_t CURVE_ID_MAX = 524288u;
99

1010
inline constexpr auto CURVE_NAME_NORMAL = "normal";
@@ -20,14 +20,15 @@ namespace cved::global {
2020
inline constexpr auto MODIFIER_NAME_SINE_WAVE = "sine_wave";
2121
inline constexpr auto MODIFIER_NAME_SQUARE_WAVE = "square_wave";
2222

23-
inline constexpr auto PLUGIN_NAME = "Curve Editor";
24-
inline constexpr auto PLUGIN_DLL_NAME = "curve_editor.auf";
23+
inline constexpr auto PLUGIN_NAME = "curve_editor";
24+
inline constexpr auto PLUGIN_DISPLAY_NAME = "Curve Editor";
25+
inline constexpr auto PLUGIN_EXT = "auf";
2526
inline constexpr auto PLUGIN_VERSION = mkaul::Version{
2627
mkaul::VersionNumber{2},
27-
mkaul::PreviewType{mkaul::PreviewType::Type::Alpha},
28-
mkaul::VersionNumber{2, 2, 1}
28+
mkaul::PreviewType{mkaul::PreviewType::Type::Beta},
29+
mkaul::VersionNumber{1}
2930
};
3031
inline constexpr auto PLUGIN_DEVELOPER = "mimaraka";
3132
inline constexpr auto PLUGIN_TRANSLATOR = "Deepdive";
3233
inline constexpr auto PLUGIN_GITHUB_URL = "https://github.com/mimaraka/aviutl-plugin-curve_editor";
33-
} // namespace cved
34+
} // namespace curve_editor

curve_editor/context_menu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55

6-
namespace cved {
6+
namespace curve_editor {
77
void ContextMenu::init() noexcept {
88
menu_ = ::CreatePopupMenu();
99
for (size_t i = 1; auto & item : items_) {
@@ -46,4 +46,4 @@ namespace cved {
4646
return false;
4747
}
4848
}
49-
} // namespace cved
49+
} // namespace curve_editor

curve_editor/context_menu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77

8-
namespace cved {
8+
namespace curve_editor {
99
class ContextMenu {
1010
HMENU menu_;
1111
std::vector<MenuItem> items_;
@@ -25,4 +25,4 @@ namespace cved {
2525
const mkaul::Point<LONG>* p_custom_pt_screen = nullptr
2626
) noexcept;
2727
};
28-
} // namespace cved
28+
} // namespace curve_editor

curve_editor/curve_base.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44

5-
namespace cved {
5+
namespace curve_editor {
66
double Curve::get_value(double progress, double start, double end) const noexcept {
77
return curve_function(progress, start, end);
88
}
@@ -27,4 +27,4 @@ namespace cved {
2727
data["type"] = get_name();
2828
return data;
2929
}
30-
} // namespace cved
30+
} // namespace curve_editor

curve_editor/curve_base.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
#include "curve_id_manager.hpp"
44
#include <cereal/cereal.hpp>
5-
#include <mkaul/graphics.hpp>
65
#include <nlohmann/json.hpp>
76

87

98

10-
namespace cved {
9+
namespace curve_editor {
1110
// カーブ(抽象クラス)
1211
class Curve {
1312
bool locked_;
@@ -21,14 +20,22 @@ namespace cved {
2120
{}
2221
// コピーコンストラクタ
2322
Curve(const Curve& curve) noexcept :
24-
id_{global::id_manager.create_id(this)},
23+
id_{ global::id_manager.create_id(this) },
2524
locked_{ curve.locked_ }
2625
{}
2726
// 仮想デストラクタ
2827
virtual ~Curve() noexcept {
2928
global::id_manager.remove_id(id_);
3029
}
3130

31+
// コピー代入演算子
32+
Curve& operator=(const Curve& curve) noexcept {
33+
locked_ = curve.locked_;
34+
return *this;
35+
}
36+
37+
virtual std::unique_ptr<Curve> clone() const noexcept = 0;
38+
3239
// カーブの値を取得
3340
[[nodiscard]] virtual double curve_function(double progress, double start, double end) const noexcept = 0;
3441
[[nodiscard]] virtual double get_value(double progress, double start, double end) const noexcept;
@@ -53,6 +60,6 @@ namespace cved {
5360
archive(locked_);
5461
}
5562
};
56-
} // namespace cved
63+
} // namespace curve_editor
5764

58-
CEREAL_CLASS_VERSION(cved::Curve, 0)
65+
CEREAL_CLASS_VERSION(curve_editor::Curve, 0)

0 commit comments

Comments
 (0)