MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / init

Function init

src/hotkey.cpp:79–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78agi::hotkey::Hotkey *inst = nullptr;
79void init() {
80 inst = new agi::hotkey::Hotkey(
81 config::path->Decode("?user/hotkey.json"),
82 GET_DEFAULT_CONFIG(default_hotkey));
83
84 auto migrations = OPT_GET("App/Hotkey Migrations")->GetListString();
85
86 if (boost::find(migrations, "7035") == end(migrations)) {
87 migrate_hotkeys(added_hotkeys_7035);
88 migrations.emplace_back("7035");
89 }
90
91 if (boost::find(migrations, "7070") == end(migrations)) {
92 migrate_hotkeys(added_hotkeys_7070);
93 migrations.emplace_back("7070");
94 }
95
96 if (boost::find(migrations, "edit/line/duplicate/shift_back") == end(migrations)) {
97 migrate_hotkeys(added_hotkeys_shift_back);
98 migrations.emplace_back("edit/line/duplicate/shift_back");
99 }
100
101 if (boost::find(migrations, "duplicate -> split") == end(migrations)) {
102 auto hk_map = hotkey::inst->GetHotkeyMap();
103 for (auto const& hotkey : boost::make_iterator_range(hk_map.equal_range("edit/line/duplicate/shift"))) {
104 auto combo = agi::hotkey::Combo(hotkey.second.Context(), "edit/line/split/before", hotkey.second.Str());
105 hk_map.emplace(combo.CmdName(), combo);
106 }
107 for (auto const& hotkey : boost::make_iterator_range(hk_map.equal_range("edit/line/duplicate/shift_back"))) {
108 auto combo = agi::hotkey::Combo(hotkey.second.Context(), "edit/line/split/after", hotkey.second.Str());
109 hk_map.emplace(combo.CmdName(), combo);
110 }
111
112 hk_map.erase("edit/line/duplicate/shift");
113 hk_map.erase("edit/line/duplicate/shift_back");
114
115 hotkey::inst->SetHotkeyMap(std::move(hk_map));
116 migrations.emplace_back("duplicate -> split");
117 }
118
119#ifdef __WXMAC__
120 if (boost::find(migrations, "app/minimize") == end(migrations)) {
121 migrate_hotkeys(added_hotkeys_minimize);
122 migrations.emplace_back("app/minimize");
123 }
124#endif
125
126 OPT_SET("App/Hotkey Migrations")->SetListString(std::move(migrations));
127}
128
129void clear() {
130 delete inst;

Callers 3

OnInitMethod · 0.85
TEST_FFunction · 0.85
dialogue_tokensMethod · 0.85

Calls 9

migrate_hotkeysFunction · 0.85
ComboClass · 0.85
DecodeMethod · 0.80
CmdNameMethod · 0.80
eraseMethod · 0.80
SetHotkeyMapMethod · 0.80
endFunction · 0.50
ContextMethod · 0.45
StrMethod · 0.45

Tested by 1

TEST_FFunction · 0.68