|
9 | 9 |
|
10 | 10 | namespace cved { |
11 | 11 | namespace global { |
12 | | - void Config::init(HINSTANCE hinst) noexcept { |
| 12 | + Config::Config() noexcept : |
| 13 | + edit_mode_{ EditMode::Normal }, |
| 14 | + layout_mode_{ LayoutMode::Horizontal }, |
| 15 | + apply_mode_{}, |
| 16 | + curve_code_bezier_{ 145674282 }, |
| 17 | + curve_code_elastic_{ 2554290 }, |
| 18 | + curve_code_bounce_{ 10612242 }, |
| 19 | + show_x_label_{ false }, |
| 20 | + show_y_label_{ true }, |
| 21 | + show_handle_{ true }, |
| 22 | + show_library_{ true }, |
| 23 | + show_velocity_graph_{ false }, |
| 24 | + align_handle_{ true }, |
| 25 | + ignore_autosaver_warning_{ false }, |
| 26 | + separator_pos_{ 0.56 }, |
| 27 | + preset_size_{ 64 } |
| 28 | + { |
13 | 29 | pref_.reset(); |
14 | | - edit_mode_ = EditMode::Normal; |
15 | | - layout_mode_ = LayoutMode::Vertical; |
16 | 30 | apply_mode_.fill(ApplyMode::Normal); |
17 | 31 | set_apply_mode(EditMode::Value, ApplyMode::IgnoreMidPoint); |
18 | | - curve_code_bezier_ = 145674282; |
19 | | - curve_code_elastic_ = 2554290; |
20 | | - curve_code_bounce_ = 10612242; |
21 | | - show_x_label_ = false; |
22 | | - show_y_label_ = true; |
23 | | - show_handle_ = true; |
24 | | - show_library_ = true; |
25 | | - show_velocity_graph_ = false; |
26 | | - align_handle_ = true; |
27 | | - ignore_autosaver_warning_ = false; |
28 | | - separator_pos_ = 1.; |
29 | | - preset_size_ = 50; |
| 32 | + set_apply_mode(EditMode::Script, ApplyMode::IgnoreMidPoint); |
30 | 33 |
|
31 | 34 | // AviUtlのディレクトリの取得 |
32 | 35 | char path_str[MAX_PATH]; |
33 | 36 | ::GetModuleFileNameA(NULL, path_str, MAX_PATH); |
34 | 37 | std::filesystem::path path_aviutl{ path_str }; |
35 | 38 | dir_aviutl_ = path_aviutl.parent_path(); |
36 | | - ::GetModuleFileNameA(hinst, path_str, MAX_PATH); |
| 39 | + ::GetModuleFileNameA(::GetModuleHandleA(global::PLUGIN_DLL_NAME), path_str, MAX_PATH); |
37 | 40 | std::filesystem::path path_plugin{ path_str }; |
38 | 41 | dir_plugin_ = path_plugin.parent_path() / "curve_editor"; |
39 | 42 | } |
@@ -67,9 +70,6 @@ namespace cved { |
67 | 70 |
|
68 | 71 | const char* Config::get_edit_mode_dispname(EditMode edit_mode) const noexcept { |
69 | 72 | using StringId = StringTable::StringId; |
70 | | - |
71 | | - if (!string_table.loaded()) return nullptr; |
72 | | - |
73 | 73 | switch (edit_mode) { |
74 | 74 | case EditMode::Normal: |
75 | 75 | return string_table[StringId::LabelEditModeNormal]; |
@@ -138,8 +138,8 @@ namespace cved { |
138 | 138 | separator_pos_ = mkaul::clamp(separator_pos, 0., 1.); |
139 | 139 | } |
140 | 140 |
|
141 | | - void Config::set_preset_size(int) noexcept { |
142 | | - |
| 141 | + void Config::set_preset_size(int preset_size) noexcept { |
| 142 | + preset_size_ = mkaul::clamp(preset_size, 20, 200); |
143 | 143 | } |
144 | 144 |
|
145 | 145 | #define GET_KEY(var) std::string{ #var, 0u, strlen(#var) - 1u}.c_str() |
@@ -206,7 +206,7 @@ namespace cved { |
206 | 206 |
|
207 | 207 | std::ofstream ofs{ dir_plugin_ / CONFIG_FILE_NAME }; |
208 | 208 | if (!ofs) return false; |
209 | | - ofs << data.dump(4); |
| 209 | + ofs << data.dump(2); |
210 | 210 | return true; |
211 | 211 | } |
212 | 212 |
|
|
0 commit comments