MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / command_menu_init

Function command_menu_init

src/plugin/Plugin.cpp:280–336  ·  view source on GitHub ↗

Initialization of your plug-in commands You should fill your plug-ins commands here

Source from the content-addressed store, hash-verified

278// Initialization of your plug-in commands
279// You should fill your plug-ins commands here
280void command_menu_init() {
281 //
282 // Firstly we get the parameters from your plugin config file (if any)
283 //
284
285 // get path of plugin configuration
286 ::SendMessage(npp_data.npp_handle, NPPM_GETPLUGINSCONFIGDIR, MAX_PATH, reinterpret_cast<LPARAM>(ini_file_path));
287
288 // if config path doesn't exist, we create it
289 if (PathFileExists(ini_file_path) == FALSE) {
290 ::CreateDirectory(ini_file_path, nullptr);
291 }
292
293 // make your plugin config file full file path name
294 PathAppend(ini_file_path, config_file_name);
295
296 //--------------------------------------------//
297 //-- STEP 3. CUSTOMIZE YOUR PLUGIN COMMANDS --//
298 //--------------------------------------------//
299 // with function :
300 // setCommand(int index, // zero based number to indicate
301 // the order of command
302 // wchar_t *commandName, // the command name that you
303 // want to see in plugin menu
304 // PFUNCPLUGINCMD functionPointer, // the symbol of function
305 // (function pointer) associated with this command. The body should
306 // be defined below. See Step 4.
307 // ShortcutKey *shortcut, // optional. Define a shortcut
308 // to trigger this command
309 // bool check0nInit // optional. Make this menu item
310 // be checked visually
311 // );
312 action_index[Action::toggle_auto_spell_check] = set_next_command(rc_str(IDS_AUTO_SPELL_CHECK).c_str(), switch_auto_check_text);
313 action_index[Action::find_next_error] = set_next_command(rc_str(IDS_FIND_NEXT_ERROR).c_str(), find_next_mistake);
314 action_index[Action::find_prev_error] = set_next_command(rc_str(IDS_FIND_PREV_ERROR).c_str(), find_prev_mistake);
315
316 action_index[Action::quick_language_change] = set_next_command(rc_str(IDS_CHANGE_CURRENT_LANG).c_str(), quick_lang_change_context);
317
318 set_next_command(L"---", nullptr);
319
320 action_index[Action::settings] = set_next_command(rc_str(IDS_SETTINGS).c_str(), start_settings);
321 action_index[Action::copy_all_misspellings] = set_next_command(rc_str(IDS_COPY_ALL_MISSPELLED).c_str(), copy_misspellings_to_clipboard);
322 action_index[Action::erase_all_misspellings] = set_next_command(rc_str(IDS_ERASE_ALL_MISSPELLED).c_str(), erase_misspellings);
323 action_index[Action::reload_user_dictionaries] = set_next_command(rc_str(IDS_RELOAD_HUNSPELL).c_str(), reload_hunspell_dictionaries);
324 action_index[Action::toggle_debug_logging] = set_next_command(rc_str(IDS_SWITCH_DEBUG_LOGGING).c_str(), switch_debug_logging);
325 action_index[Action::open_debug_log] = set_next_command(rc_str(IDS_OPEN_DEBUG_LOG).c_str(), open_debug_log);
326 action_index[Action::online_manual] = set_next_command(rc_str(IDS_ONLINE_MANUAL).c_str(), start_manual);
327 action_index[Action::about] = set_next_command(rc_str(IDS_ABOUT).c_str(), start_about_dlg);
328 action_index[Action::show_spell_check_menu_at_cursor] =
329 set_next_command(rc_str(IDS_SHOW_SPELL_CHECK_MENU_AT_CURSOR).c_str(), show_spell_check_menu_at_cursor);
330
331 action_index[Action::replace_with_1st_suggestion] = set_next_command(rc_str(IDS_REPLACE_WITH_1ST_SUGGESTION).c_str(), replace_with_1st_suggestion);
332
333 action_index[Action::ignore_for_current_session] = set_next_command(rc_str(IDS_IGNORE_WORD_AT_CURSOR).c_str(), ignore_for_current_session);
334 action_index[Action::mark_lines_with_misspelling] = set_next_command(rc_str(IDS_BOOKMARK_LINES_WITH_MISSPELLING).c_str(), mark_lines_with_misspelling);
335 // add further set_next_command at the bottom to avoid breaking configured hotkeys
336}
337

Callers 1

setInfoFunction · 0.85

Calls 3

set_next_commandFunction · 0.85
rc_strFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected