result_t edit_name_action(cli_t *context, const char * name_) { if(name_ == 0) return e_bad_parameter; result_t result; handle_t stream; if(failed(stream_open(get_context(context), name_, &stream))) { if(failed(result = stream_create(get_context(context), name_, &stream))) return result; } // open the editor and edit the script. return edit_script(context, name_, stream); }
//---------------------------------------------------------------------------------------------------------------------- // WM_COMMAND //---------------------------------------------------------------------------------------------------------------------- void cWinMain :: wm_command ( WPARAM wParam, LPARAM lParam ) { UNREFERENCED_PARAMETER ( lParam ); UNREFERENCED_PARAMETER ( wParam ); WORD wID = LOWORD(wParam); WORD wEvent = HIWORD(wParam); UNREFERENCED_PARAMETER ( wEvent ); switch ( wID ) { case ID_ABOUT: { cDlgAbout d; d.make_dlg(); } break; case ID_ACTIVE_WINDOW_TRACKING_SETTINGS: { cDlgSettingsActiveWindowTracking d; d.make_dlg (); } break; case ID_APPEARANCE_SETTINGS: { cDlgSettingsAppearance d; d.make_dlg (); } break; case ID_CLEAR: PostMessage ( DlgMonitor.hwnd, WM_COMMAND, ID_CLEAR, ID_CLEAR ); break; case ID_CONNECTION_SETTINGS: { cDlgSettingsConnection d; d.make_dlg (); } break; case ID_CREATE_DESKTOP_SHORTCUT: create_click_once_shortcut (); break; case ID_EXIT: DestroyWindow(hwnd); break; case ID_MOUSEOVER_SETTINGS: { cDlgMouseOver d; d.make_dlg (); } break; case ID_PERFORMANCE_SETTINGS: { cDlgSettingsPerformance d; d.make_dlg (); } break; case ID_PREDEFINED_HOTKEYS: { cFigPredefinedHotkeys * p = g_FigMgr.get_predefined_hotkeys(); cDlgFigPredefinedHotkeys d; d.make_dlg ( p ); } break; case ID_SHOW_APP_LOG: show_app_data_file ( L"mojo.log.txt" ); break; case ID_SHOW_APP_SETTINGS: show_app_data_file ( L"mojo.settings.txt" ); break; case ID_SHOW_ENGINE_LOG: show_app_data_file ( L"mojo_engine.log.txt" ); break; case ID_SHOW_ENGINE_SETTINGS: show_app_data_file ( L"mojo_engine.settings.txt" ); break; case ID_SHOW_INSTALLATION_DIRECTORY: { cStrW s1, s2; s1 = L"Location of Mojo's executable files:\n\n"; get_module_directory ( & s2 ); s1 += s2; message_box ( s1.cstr() ); } break; case ID_SHOW_LICENSE_DIALOG: { cDlgLicense d; d.make_dlg(); } break; case ID_TEST: ::test (); break; case ID_TEST_SET_TRIGGER: { cDlgSetTrigger d; mojo::cTrigger t; d.make_dlg(&t); } case ID_TOGGLE_BROADCAST: toggle_broadcast (); break; case ID_TOGGLE_HOTKEYS: toggle_hotkeys (); message_box ( L"Hotkeys aren't implemented yet." ); break; case ID_TOGGLE_MOUSEOVER: toggle_mouseover (); break; case ID_VIEW_COMPUTERS: g_Settings.uView = computers; set_view(); break; case ID_VIEW_MONITOR: g_Settings.uView = monitor; set_view(); break; case ID_VIEW_TOONS: g_Settings.uView = toons; set_view(); break; case ID_VIEW_WOWS: g_Settings.uView = wows; set_view(); break; #if 0 case ID_RESTORE_DEFAULT_SETTINGS: g_Settings.restore_defaults(); break; case ID_SETTINGS_MOUSEOVER: { cDlgMouseOver d; d.make_dlg(); } break; case ID_HIDE_HOTKEYNET: set_tray_icon (); ShowWindow ( g_hwnd, SW_HIDE ); break; case ID_TOGGLE_SHOW_STATE: ShowWindow ( g_hwnd, IsWindowVisible(g_hwnd) ? SW_HIDE : SW_RESTORE ); break; case ID_TOGGLE_HOTKEYS: toggle_hotkeys(); break; case ID_DEBUG: debug(); break; case ID_ASK_QUESTION: show_forum(); break; case ID_REPORT_BUG: report_bug (); break; case ID_INSTRUCTIONS: show_instructions (); break; case ID_SETTINGS_CONNECTION: { cDlgSettingsConnection d; d.make_dlg(); } break; case ID_SETTINGS_SECURITY: { cDlgSettingsSecurity d; d.make_dlg(); } break; case ID_SETTINGS_START_UP: { cDlgSettingsStartUp d; d.make_dlg(); } break; case ID_SETTINGS_DISPLAY: { cDlgSettingsDisplay d; d.make_dlg(); } break; case ID_INSTALLATION_OPTIONS: installation_options (); break; case ID_CREATE_SHORTCUT: create_clickonce_shortcut (); break; case ID_CREATE_SCRIPT: if ( create_script () ) load_script_sub(); break; case ID_OPEN_DEBUG_LOG: open_text_file ( g_Log.filename() ); break; case ID_LOAD_SCRIPT: g_Monitor.clear(); load_script(); break; case ID_RELOAD_SCRIPT: g_Monitor.clear(); load_script_sub (); break; case ID_EDIT_SCRIPT: edit_script(); break; case IDM_ABOUT: { cDlgMessageBox d; d.make_dlg(); } break; #endif } }