Skip to content

Commit cb7ff87

Browse files
committed
Fixed encoding of some default settings.
+ Slight fixes to comments / variable names.
1 parent 0330ad5 commit cb7ff87

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

reactive_dlg.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ struct DropdownList : SettingDlg {
628628

629629

630630
////////////////////////////////
631-
// アニメーション効果の名前表示
631+
// フィルタ効果のスクリプト名表示
632632
////////////////////////////////
633633
struct FilterName : SettingDlg {
634634
private:
@@ -1000,12 +1000,6 @@ struct Easings : SettingDlg {
10001000
flag_loaded = 1 << 7;
10011001
};
10021002

1003-
// to store buffer for the tooltip text.
1004-
#ifndef _DEBUG
1005-
constinit // somehow it causes an error for debug build.
1006-
#endif
1007-
static inline std::string curr_tooltip_text{};
1008-
10091003
// formatting the tooltip text according to the track mode.
10101004
static std::string format_tooltip(ExEdit::Object::TrackMode const& mode, int32_t param)
10111005
{
@@ -1078,6 +1072,11 @@ struct Easings : SettingDlg {
10781072
auto const& mode = obj.track_mode[idx];
10791073
if (mode.num == 0) break; // 移動無し
10801074

1075+
#ifndef _DEBUG
1076+
constinit // somehow it causes an error for debug build.
1077+
#endif
1078+
static std::string curr_tooltip_text{};
1079+
10811080
// store the string and return it.
10821081
curr_tooltip_text = format_tooltip(mode, obj.track_param[idx]);
10831082
reinterpret_cast<NMTTDISPINFOA*>(lparam)->lpszText = curr_tooltip_text.data();
@@ -1289,19 +1288,19 @@ inline constinit struct Settings {
12891288

12901289
void load(const char* ini_file)
12911290
{
1292-
auto read_raw = [&](auto def, const char* section, const char* key) {
1291+
auto read_raw = [&](auto def, char const* section, char const* key) {
12931292
return static_cast<decltype(def)>(
12941293
::GetPrivateProfileIntA(section, key, static_cast<int32_t>(def), ini_file));
12951294
};
1296-
auto read_modkey = [&](modkeys def, const char* section, const char* key) {
1295+
auto read_modkey = [&](modkeys def, char const* section, char const* key) {
12971296
char str[std::bit_ceil(std::size("ctrl + shift + alt ****"))];
12981297
::GetPrivateProfileStringA(section, key, def.canon_name(), str, std::size(str), ini_file);
12991298
return modkeys{ str, def };
13001299
};
1301-
auto read_string = [&]<size_t max_len>(const char* def, const char* section, const char* key, const char* nil) {
1300+
auto read_string = [&]<size_t max_len>(char8_t const* def, char const* section, char const* key, char8_t const* nil) {
13021301
char str[max_len + 1];
1303-
::GetPrivateProfileStringA(section, key, def, str, std::size(str), ini_file);
1304-
if (std::strcmp(str, nil) == 0)
1302+
::GetPrivateProfileStringA(section, key, reinterpret_cast<char const*>(def), str, std::size(str), ini_file);
1303+
if (std::strcmp(str, reinterpret_cast<char const*>(nil)) == 0)
13051304
return std::unique_ptr<std::wstring>{ nullptr };
13061305
return std::make_unique<std::wstring>(Encodes::to_wstring(str));
13071306
};
@@ -1325,8 +1324,8 @@ inline constinit struct Settings {
13251324
[&](auto x) { return std::clamp(x, textTweaks.min_tabstops, textTweaks.max_tabstops); }, /* id */);
13261325
load_gen (textTweaks., tabstops_script, "TextBox.Tweaks",
13271326
[&](auto x) { return std::clamp(x, textTweaks.min_tabstops, textTweaks.max_tabstops); }, /* id */);
1328-
load_str (textTweaks., replace_tab_text, "TextBox.Tweaks", "\t", textTweaks.max_replace_tab_length);
1329-
load_str (textTweaks., replace_tab_script, "TextBox.Tweaks", "\t", textTweaks.max_replace_tab_length);
1327+
load_str (textTweaks., replace_tab_text, "TextBox.Tweaks", u8"\t", textTweaks.max_replace_tab_length);
1328+
load_str (textTweaks., replace_tab_script, "TextBox.Tweaks", u8"\t", textTweaks.max_replace_tab_length);
13301329

13311330
load_bool(trackKbd., updown, "Track.Keyboard");
13321331
load_bool(trackKbd., updown_clamp, "Track.Keyboard");
@@ -1357,12 +1356,12 @@ inline constinit struct Settings {
13571356

13581357
load_bool(dropdownKbd., search, "Dropdown.Keyboard");
13591358

1360-
load_str0(filterName., anim_eff_fmt, "FilterName", "{}(アニメーション効果)", filterName.max_fmt_length, "");
1361-
load_str0(filterName., cust_std_fmt, "FilterName", "{}(カスタムオブジェクト)[標準描画]", filterName.max_fmt_length, "");
1362-
load_str0(filterName., cust_ext_fmt, "FilterName", "{}(カスタムオブジェクト)[拡張描画]", filterName.max_fmt_length, "");
1363-
load_str0(filterName., cust_particle_fmt, "FilterName", "{}(カスタムオブジェクト)[パーティクル出力]", filterName.max_fmt_length, "");
1364-
load_str0(filterName., cam_eff_fmt, "FilterName", "{}(カメラ効果)", filterName.max_fmt_length, "");
1365-
load_str0(filterName., scn_change_fmt, "FilterName", "{}(シーンチェンジ)", filterName.max_fmt_length, "");
1359+
load_str0(filterName., anim_eff_fmt, "FilterName", u8"{}(アニメーション効果)", filterName.max_fmt_length, u8"");
1360+
load_str0(filterName., cust_std_fmt, "FilterName", u8"{}(カスタムオブジェクト)[標準描画]", filterName.max_fmt_length, u8"");
1361+
load_str0(filterName., cust_ext_fmt, "FilterName", u8"{}(カスタムオブジェクト)[拡張描画]", filterName.max_fmt_length, u8"");
1362+
load_str0(filterName., cust_particle_fmt, "FilterName", u8"{}(カスタムオブジェクト)[パーティクル出力]", filterName.max_fmt_length, u8"");
1363+
load_str0(filterName., cam_eff_fmt, "FilterName", u8"{}(カメラ効果)", filterName.max_fmt_length, u8"");
1364+
load_str0(filterName., scn_change_fmt, "FilterName", u8"{}(シーンチェンジ)", filterName.max_fmt_length, u8"");
13661365

13671366
load_bool(easings., linked_track_invert_shift, "Easings");
13681367
load_bool(easings., wheel_click, "Easings");
@@ -2152,7 +2151,7 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
21522151
// 看板.
21532152
////////////////////////////////
21542153
#define PLUGIN_NAME "Reactive Dialog"
2155-
#define PLUGIN_VERSION "v1.62"
2154+
#define PLUGIN_VERSION "v1.63-beta1"
21562155
#define PLUGIN_AUTHOR "sigma-axis"
21572156
#define PLUGIN_INFO_FMT(name, ver, author) (name##" "##ver##" by "##author)
21582157
#define PLUGIN_INFO PLUGIN_INFO_FMT(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

slim_formatter.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
2424
////////////////////////////////
2525
class slim_formatter {
2626
std::wstring base{};
27-
std::vector<size_t> holes{}; // the 'holes' where the animation name is placed in.
27+
std::vector<size_t> holes{}; // the 'holes' where the parameter is placed in.
2828

2929
public:
30-
constexpr std::wstring operator()(std::wstring const& name) const
30+
constexpr std::wstring operator()(std::wstring const& param) const
3131
{
32-
std::wstring ret(base.size() + name.size() * holes.size(), L'\0');
32+
std::wstring ret(base.size() + param.size() * holes.size(), L'\0');
3333

34-
// alternatingly copy to `ret` the strings `base` and `name`.
34+
// alternatingly copy to `ret` the strings `base` and `param`.
3535
size_t l = 0; auto p = ret.data();
3636
for (auto i : holes) {
3737
base.copy(p, i - l, l);
3838
p += i - l;
3939

40-
name.copy(p, name.size());
41-
p += name.size();
40+
param.copy(p, param.size());
41+
p += param.size();
4242

4343
l = i;
4444
}

0 commit comments

Comments
 (0)