/** * Function OnSelectOptionToolbar * called to validate current choices */ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { int id = event.GetId(); bool state; switch( id ) { case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG: state = ! m_show_layer_manager_tools; id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR; break; default: state = m_optionsToolBar->GetToolToggled( id ); break; } switch( id ) { case ID_TB_OPTIONS_SHOW_POLAR_COORD: m_DisplayOptions.m_DisplayPolarCood = state; break; case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH: m_DisplayOptions.m_DisplayFlashedItemsFill = not state; m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_LINES_SKETCH: m_DisplayOptions.m_DisplayLinesFill = not state; m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH: m_DisplayOptions.m_DisplayPolygonsFill = not state; m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_DCODES: SetElementVisibility( DCODES_VISIBLE, state ); m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS: SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, state ); m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR: // show/hide auxiliary Vertical layers and visibility manager toolbar m_show_layer_manager_tools = state; m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.Update(); GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, m_show_layer_manager_tools ? _("Hide &Layers Manager" ) : _("Show &Layers Manager" )); break; default: wxMessageBox( wxT( "GERBVIEW_FRAME::OnSelectOptionToolbar error" ) ); break; } }
void MainFrame::OnMapChange(wxCommandEvent &event) { Cartographer->SetActiveMapByIndex( event.GetId() ); }
void MainFrame::UpdateUI(wxCommandEvent& event) { event.Skip(); bool is_running, is_stopped, is_ready; if(event.GetEventType() == wxEVT_DBG_COMMAND) { switch(event.GetId()) { case DID_START_EMU: case DID_STARTED_EMU: is_running = true; is_stopped = false; is_ready = false; break; case DID_STOP_EMU: case DID_STOPPED_EMU: is_running = false; is_stopped = true; is_ready = false; m_sys_menu_opened = false; break; case DID_PAUSE_EMU: case DID_PAUSED_EMU: is_running = false; is_stopped = false; is_ready = false; break; case DID_RESUME_EMU: case DID_RESUMED_EMU: is_running = true; is_stopped = false; is_ready = false; break; case DID_READY_EMU: is_running = false; is_stopped = false; is_ready = true; break; case DID_REGISTRED_CALLBACK: is_running = Emu.IsRunning(); is_stopped = Emu.IsStopped(); is_ready = Emu.IsReady(); break; default: return; } if (event.GetId() == DID_STOPPED_EMU) { if (rpcs3::config.misc.exit_on_stop.value()) { wxGetApp().Exit(); } } } else { is_running = Emu.IsRunning(); is_stopped = Emu.IsStopped(); is_ready = Emu.IsReady(); } // Update menu items based on the state of the emulator wxMenuBar& menubar( *GetMenuBar() ); // Emulation wxMenuItem& pause = *menubar.FindItem(id_sys_pause); wxMenuItem& stop = *menubar.FindItem(id_sys_stop); pause.SetItemLabel(is_running ? "&Pause\tCtrl + P" : is_ready ? "&Start\tCtrl + F" : "&Resume\tCtrl + F"); pause.Enable(!is_stopped); stop.Enable(!is_stopped); // PS3 Commands wxMenuItem& send_exit = *menubar.FindItem(id_sys_send_exit); wxMenuItem& send_open_menu = *menubar.FindItem(id_sys_send_open_menu); bool enable_commands = !is_stopped; send_open_menu.SetItemLabel(wxString::Format("Press &PS buton %s", (m_sys_menu_opened ? "close" : "open"))); send_open_menu.Enable(enable_commands); send_exit.Enable(enable_commands); // Tools wxMenuItem& kernel_explorer = *menubar.FindItem(id_tools_kernel_explorer); wxMenuItem& memory_viewer = *menubar.FindItem(id_tools_memory_viewer); wxMenuItem& rsx_debugger = *menubar.FindItem(id_tools_rsx_debugger); wxMenuItem& string_search = *menubar.FindItem(id_tools_string_search); kernel_explorer.Enable(!is_stopped); memory_viewer.Enable(!is_stopped); rsx_debugger.Enable(!is_stopped); string_search.Enable(!is_stopped); }
// // void frmOdaGet::OnFtpThreadMessage(wxCommandEvent &event) // // Events sent back by FTP thread void frmOdaGet::OnFtpThreadMessage(wxCommandEvent &event) { wxString String; switch (event.GetId()) { case FTP_BADURL: { String = wxString::Format(wxT("Invalid URL: %s\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case FTP_CONNECTED: { String = wxString::Format(wxT("Connected to %s:%u\n"), event.GetString().c_str(), event.GetInt()); m_LocationDisplay->AppendText(String); } break; case FTP_DISCONNECTED: { String = wxString::Format(wxT("Failed to connect to %s:%u\n"), event.GetString().c_str(), event.GetInt()); m_LocationDisplay->AppendText(String); } break; case FTP_GOTFILEINFO: { m_FileSize = event.GetInt(); if (m_FileSize > 0) { String = wxString::Format(wxT("File size is %d\n"), m_FileSize); m_DownloadGauge->SetRange(event.GetInt()); } else { String = wxT("File size not available\n"); m_DownloadGauge->SetRange(10); } m_LocationDisplay->AppendText(String); } break; case FTP_DOWNLOADING: { String = wxString::Format(wxT("Now downloading file to %s\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case FTP_DOWNLOADERROR: { String = wxString::Format(wxT("Download of file %s failed\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case FTP_DOWNLOADTERMINATED: { String = wxT("User stopped download\n"); m_LocationDisplay->AppendText(String); } break; case SIZE_UPDATE: { if (m_FileSize > 0) { int i = m_DownloadGauge->GetValue(); m_DownloadGauge->SetValue(event.GetInt() + i); } else { // Our pseudo-progress indicator m_DownloadGauge->SetValue(m_DownloadGauge->GetValue() ? 0 : 10); } } break; case FTP_DOWNLOADCOMPLETE: { String = wxT("Download complete\n"); m_LocationDisplay->AppendText(String); } break; default: break; } }
void MainWindow::OnPopup(wxCommandEvent& event) { switch (event.GetId()) { case POEM_NEXT: // Another poem/page TheMainWindow->NextPage(); break; case POEM_PREVIOUS: // Previous page TheMainWindow->PreviousPage(); break; case POEM_SEARCH: // Search - with dialog TheMainWindow->Search(true); break; case POEM_NEXT_MATCH: // Search - without dialog (next match) TheMainWindow->Search(false); break; case POEM_MINIMIZE: TheMainWindow->Iconize(true); break; #if wxUSE_CLIPBOARD case POEM_COPY: wxTheClipboard->UsePrimarySelection(); if (wxTheClipboard->Open()) { static wxString s; s = poem_buffer; s.Replace( wxT("@P"),wxEmptyString); s.Replace( wxT("@A "),wxEmptyString); s.Replace( wxT("@A"),wxEmptyString); s.Replace( wxT("@T "),wxEmptyString); s.Replace( wxT("@T"),wxEmptyString); wxTextDataObject *data = new wxTextDataObject( s.c_str() ); if (!wxTheClipboard->SetData( data )) wxMessageBox(wxT("Error while copying to the clipboard.")); } else { wxMessageBox(wxT("Error opening the clipboard.")); } wxTheClipboard->Close(); break; #endif case POEM_BIGGER_TEXT: pointSize ++; CreateFonts(); TheMainWindow->Resize(); break; case POEM_SMALLER_TEXT: if (pointSize > 2) { pointSize --; CreateFonts(); TheMainWindow->Resize(); } break; case POEM_ABOUT: (void)wxMessageBox(wxT("wxPoem Version 1.1\nJulian Smart (c) 1995"), wxT("About wxPoem"), wxOK, TheMainWindow); break; case POEM_EXIT: // Exit TheMainWindow->Close(true); break; default: break; } }
void wxApproxModWnd::OnEvent(wxCommandEvent & event) { opt = static_cast<mod_approx>(event.GetId()); }
void AfficheModifFamille::OnSaisie(wxCommandEvent & event) { if ((event.GetId() == ID_AfficheModifFamilleLatin || event.GetId() == ID_AfficheModifFamilleComment)) { OKButton->Enable(true); OKButton->SetDefault(); } }
void NewtonDemos::OnSelectSolverQuality(wxCommandEvent& event) { BEGIN_MENU_OPTION(); m_solverModeQuality = dClamp(event.GetId() - ID_SOLVER_QUALITY, 0, 1); END_MENU_OPTION(); }
void NewtonDemos::OnSelectBroadPhase(wxCommandEvent& event) { BEGIN_MENU_OPTION(); m_broadPhaseType = dClamp (event.GetId() - ID_BROADPHSE_TYPE0, 0, 1); END_MENU_OPTION(); }
void myPanel::OnClickActionButton(wxCommandEvent& event){ this->curAction = this->actions[event.GetId()]; this->actionsHandler(this->curAction); }
void NewtonDemos::OnSelectSolverMode(wxCommandEvent& event) { BEGIN_MENU_OPTION(); m_solverModeIndex = dClamp (event.GetId() - ID_SOLVER_MODE, 0, int (sizeof (m_solverModes)/sizeof (m_solverModes[0]))); END_MENU_OPTION(); }
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev) { InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]); m_emu_config_diag->ShowModal(); m_emu_config_diag->Destroy(); }
void InterpreterDisAsmFrame::HandleCommand(wxCommandEvent& event) { cpu_thread* thr = (cpu_thread*)event.GetClientData(); event.Skip(); if (!thr) { switch (event.GetId()) { case DID_STOPPED_EMU: UpdateUnitList(); break; case DID_PAUSED_EMU: //DoUpdate(); break; } } else if (cpu && thr == cpu) { switch (event.GetId()) { case DID_PAUSE_THREAD: m_btn_run->Disable(); m_btn_step->Disable(); m_btn_pause->Disable(); break; case DID_PAUSED_THREAD: m_btn_run->Enable(); m_btn_step->Enable(); m_btn_pause->Disable(); DoUpdate(); break; case DID_START_THREAD: case DID_EXEC_THREAD: case DID_RESUME_THREAD: m_btn_run->Disable(); m_btn_step->Disable(); m_btn_pause->Enable(); break; case DID_REMOVE_THREAD: case DID_STOP_THREAD: m_btn_run->Disable(); m_btn_step->Disable(); m_btn_pause->Disable(); if (event.GetId() == DID_REMOVE_THREAD) { //m_choice_units->SetSelection(-1); //wxCommandEvent event; //event.SetInt(-1); //event.SetClientData(nullptr); //OnSelectUnit(event); UpdateUnitList(); //DoUpdate(); } break; } } else { switch (event.GetId()) { case DID_CREATE_THREAD: UpdateUnitList(); if (m_choice_units->GetSelection() == -1) { //m_choice_units->SetSelection(0); //wxCommandEvent event; //event.SetInt(0); //event.SetClientData(&Emu.GetCPU().GetThreads()[0]); //OnSelectUnit(event); } break; case DID_REMOVED_THREAD: UpdateUnitList(); break; } } }
void WebFrame::OnHistory(wxCommandEvent& evt) { m_browser->LoadHistoryItem(m_histMenuItems[evt.GetId()]); }
void wxGxObjectDialog::OnCommand(wxCommandEvent& event) { event.Skip(); Command(GetCommand(event.GetId())); }
void BookmarkView::onMenuItem(wxCommandEvent& event) { if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) { onAddGroup(event); } }
void wxGxObjectDialog::OnDropDownCommand(wxCommandEvent& event) { event.Skip(); if(m_pDropDownCommand) m_pDropDownCommand->OnDropDownCommand(event.GetId()); }
void EditorBase::OnContextMenuEntry(wxCommandEvent& event) { // we have a single event handler for all popup menu entries // This was ported from cbEditor and used for the basic operations: // Switch to, close, save, etc. const int id = event.GetId(); m_pData->m_CloseMe = false; if (id == idCloseMe) { if (m_pData->m_DisplayingPopupMenu) m_pData->m_CloseMe = true; // defer delete 'this' until after PopupMenu() call returns else Manager::Get()->GetEditorManager()->Close(this); } else if (id == idCloseAll) { if (m_pData->m_DisplayingPopupMenu) { Manager::Get()->GetEditorManager()->CloseAllExcept(this); m_pData->m_CloseMe = true; // defer delete 'this' until after PopupMenu() call returns } else Manager::Get()->GetEditorManager()->CloseAll(); } else if (id == idCloseAllOthers) { Manager::Get()->GetEditorManager()->CloseAllExcept(this); } else if (id == idSaveMe) { Save(); } else if (id == idSaveAll) { Manager::Get()->GetEditorManager()->SaveAll(); } else if (id >= idSwitchFile1 && id <= idSwitchFileMax) { // "Switch to..." item EditorBase *const ed = m_SwitchTo[id]; if (ed) { Manager::Get()->GetEditorManager()->SetActiveEditor(ed); } m_SwitchTo.clear(); } else if(wxMinimumVersion<2,6,1>::eval) { if (id == idGoogleCode) { wxLaunchDefaultBrowser(wxString(_T("http://www.google.com/codesearch?q=")) << URLEncode(lastWord)); } else if (id == idGoogle) { wxLaunchDefaultBrowser(wxString(_T("http://www.google.com/search?q=")) << URLEncode(lastWord)); } else if (id == idMsdn) { wxLaunchDefaultBrowser(wxString(_T("http://social.msdn.microsoft.com/Search/en-US/?query=")) << URLEncode(lastWord) << _T("&ac=8")); } } else { event.Skip(); } }
// update gui void NetPlayDiag::OnThread(wxCommandEvent& event) { // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); wxString selection; if (m_player_lbox->GetSelection() != wxNOT_FOUND) selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed selection.erase(selection.find_last_of("|") + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { if (selection == m_player_lbox->GetString(i).Mid(0, selection.length())) { m_player_lbox->SetSelection(i); break; } } } // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; bool focus = (wxWindow::FindFocus() == this || (wxWindow::FindFocus() != nullptr && wxWindow::FindFocus()->GetParent() == this) || (wxWindow::FindFocus() != nullptr && wxWindow::FindFocus()->GetParent() != nullptr && wxWindow::FindFocus()->GetParent()->GetParent() == this)); if (netplay_server != nullptr && numPlayers < m_playerids.size() && !focus) { RequestUserAttention(); } numPlayers = m_playerids.size(); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME : // update selected game :/ { m_selected_game.assign(WxStrToStr(event.GetString())); m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME : // client start game :/ { netplay_client->StartGame(FindGame()); } break; case NP_GUI_EVT_STOP_GAME : // client stop game { netplay_client->StopGame(); } break; } // chat messages while (chat_msgs.Size()) { std::string s; chat_msgs.Pop(s); //PanicAlert("message: %s", s.c_str()); m_chat_text->AppendText(StrToWxStr(s).Append('\n')); } }
void Edit::OnHilightLang (wxCommandEvent &event) { InitializePrefs (g_LanguagePrefs [event.GetId() - myID_HILIGHTFIRST].name); }
void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) { PCB_SCREEN* screen = (PCB_SCREEN*) ( m_Parent->GetScreen() ); wxPoint locate_pos; wxString msg; bool FindMarker = false; BOARD_ITEM* foundItem = 0; switch( event.GetId() ) { case ID_FIND_ITEM: s_ItemCount = 0; break; case ID_FIND_MARKER: s_MarkerCount = 0; // fall thru case ID_FIND_NEXT_MARKER: FindMarker = true; break; } s_OldStringFound = m_NewText->GetValue(); m_Parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); if( FindMarker ) { MARKER_PCB* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ ); if( marker ) { foundItem = marker; locate_pos = marker->GetPosition(); } } else { int StartCount = 0; for( MODULE* module = m_Parent->GetBoard()->m_Modules; module; module = module->Next() ) { if( WildCompareString( s_OldStringFound, module->GetReference().GetData(), false ) ) { StartCount++; if( StartCount > s_ItemCount ) { foundItem = module; locate_pos = module->GetPosition(); s_ItemCount++; break; } } if( WildCompareString( s_OldStringFound, module->m_Value->m_Text.GetData(), false ) ) { StartCount++; if( StartCount > s_ItemCount ) { foundItem = module; locate_pos = module->m_Pos; s_ItemCount++; break; } } } } if( foundItem ) { m_Parent->SetCurItem( foundItem ); if( FindMarker ) msg = _( "Marker found" ); else msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) ); m_Parent->SetStatusText( msg ); m_Parent->CursorGoto( locate_pos ); EndModal( 1 ); } else { m_Parent->SetStatusText( wxEmptyString ); if( FindMarker ) msg = _( "Marker not found" ); else msg.Printf( _( "<%s> Not Found" ), GetChars( s_OldStringFound ) ); DisplayError( this, msg, 10 ); EndModal( 0 ); } }
void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event ) { #define ROT_ANGLE 10.0 int id = event.GetId(); bool isChecked = event.IsChecked(); switch( id ) { case ID_TOOL_SET_VISIBLE_ITEMS: Install_3D_ViewOptionDialog( event ); break; case ID_RELOAD3D_BOARD: NewDisplay(); return; break; case ID_ROTATE3D_X_POS: g_Parm_3D_Visu.m_ROTX += ROT_ANGLE; break; case ID_ROTATE3D_X_NEG: g_Parm_3D_Visu.m_ROTX -= ROT_ANGLE; break; case ID_ROTATE3D_Y_POS: g_Parm_3D_Visu.m_ROTY += ROT_ANGLE; break; case ID_ROTATE3D_Y_NEG: g_Parm_3D_Visu.m_ROTY -= ROT_ANGLE; break; case ID_ROTATE3D_Z_POS: g_Parm_3D_Visu.m_ROTZ += ROT_ANGLE; break; case ID_ROTATE3D_Z_NEG: g_Parm_3D_Visu.m_ROTZ -= ROT_ANGLE; break; case ID_MOVE3D_LEFT: m_canvas->SetView3D( WXK_LEFT ); return; case ID_MOVE3D_RIGHT: m_canvas->SetView3D( WXK_RIGHT ); return; case ID_MOVE3D_UP: m_canvas->SetView3D( WXK_UP ); return; case ID_MOVE3D_DOWN: m_canvas->SetView3D( WXK_DOWN ); return; case ID_ORTHO: ToggleOrtho(); return; case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_JPEG: m_canvas->TakeScreenshot( event ); break; case ID_MENU3D_BGCOLOR_SELECTION: Set3DBgColor(); return; case ID_MENU3D_REALISTIC_MODE: g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked ); NewDisplay(); return; case ID_MENU3D_SHOW_BOARD_BODY: g_Parm_3D_Visu.SetFlag( FL_SHOW_BOARD_BODY, isChecked ); NewDisplay(); return; case ID_MENU3D_AXIS_ONOFF: g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked ); m_canvas->Refresh(); return; case ID_MENU3D_MODULE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked ); m_canvas->Refresh(); return; case ID_MENU3D_USE_COPPER_THICKNESS: g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked ); NewDisplay(GL_ID_BOARD); return; case ID_MENU3D_ZONE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked ); NewDisplay(GL_ID_BOARD); return; case ID_MENU3D_ADHESIVE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked ); NewDisplay(GL_ID_TECH_LAYERS); return; case ID_MENU3D_SILKSCREEN_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked ); NewDisplay(GL_ID_TECH_LAYERS); return; case ID_MENU3D_SOLDER_MASK_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked ); NewDisplay(GL_ID_TECH_LAYERS); return; case ID_MENU3D_SOLDER_PASTE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked ); NewDisplay(GL_ID_TECH_LAYERS); return; case ID_MENU3D_COMMENTS_ONOFF: g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked ); NewDisplay(GL_ID_AUX_LAYERS); return; case ID_MENU3D_ECO_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked ); NewDisplay(GL_ID_AUX_LAYERS); return; default: wxLogMessage( wxT( "EDA_3D_FRAME::Process_Special_Functions() error: unknown command" ) ); return; } m_canvas->Refresh( true ); m_canvas->DisplayStatus(); }
// // void frmOdaGet::OnHttpThreadMessage(wxCommandEvent &event) // // Events sent back by HTTP thread void frmOdaGet::OnHttpThreadMessage(wxCommandEvent &event) { wxString String; switch (event.GetId()) { case HTTP_BADURL: { String = wxString::Format(wxT("Invalid URL: %s\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case HTTP_CONNECTED: { String = wxString::Format(wxT("Connected to %s:%u\n"), event.GetString().c_str(), event.GetInt()); m_LocationDisplay->AppendText(String); } break; case HTTP_DISCONNECTED: { String = wxString::Format(wxT("Failed to connect to %s:%u\n"), event.GetString().c_str(), event.GetInt()); m_LocationDisplay->AppendText(String); } break; case HTTP_GOTFILEINFO: { String = wxString::Format(wxT("File size is %llu\n"), (size_t)event.GetInt()); m_DownloadGauge->SetRange((size_t)event.GetInt()); m_LocationDisplay->AppendText(String); } break; case HTTP_DOWNLOADING: { String = wxString::Format(wxT("Now downloading file to %s\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case HTTP_DOWNLOADERROR: { String = wxString::Format(wxT("Download of file %s failed\n"), event.GetString().c_str()); m_LocationDisplay->AppendText(String); } break; case HTTP_DOWNLOADTERMINATED: { String = wxT("User stopped download\n"); m_LocationDisplay->AppendText(String); } break; case SIZE_UPDATE: { int i = m_DownloadGauge->GetValue(); m_DownloadGauge->SetValue((size_t)event.GetInt() + i); } break; case HTTP_DOWNLOADCOMPLETE: { String = wxT("Download complete\n"); m_LocationDisplay->AppendText(String); } break; default: break; } }
void MainFrame::UpdateUI(wxCommandEvent& event) { event.Skip(); bool is_running, is_stopped, is_ready; if(event.GetEventType() == wxEVT_DBG_COMMAND) { switch(event.GetId()) { case DID_START_EMU: case DID_STARTED_EMU: is_running = true; is_stopped = false; is_ready = false; break; case DID_STOP_EMU: case DID_STOPPED_EMU: is_running = false; is_stopped = true; is_ready = false; m_sys_menu_opened = false; break; case DID_PAUSE_EMU: case DID_PAUSED_EMU: is_running = false; is_stopped = false; is_ready = false; break; case DID_RESUME_EMU: case DID_RESUMED_EMU: is_running = true; is_stopped = false; is_ready = false; break; case DID_READY_EMU: is_running = false; is_stopped = false; is_ready = true; break; case DID_REGISTRED_CALLBACK: is_running = Emu.IsRunning(); is_stopped = Emu.IsStopped(); is_ready = Emu.IsReady(); break; default: return; } } else { is_running = Emu.IsRunning(); is_stopped = Emu.IsStopped(); is_ready = Emu.IsReady(); } wxMenuBar& menubar( *GetMenuBar() ); wxMenuItem& pause = *menubar.FindItem( id_sys_pause ); wxMenuItem& stop = *menubar.FindItem( id_sys_stop ); wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit ); wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu ); pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + C" : "Resume\tCtrl + C"); pause.Enable(!is_stopped); stop.Enable(!is_stopped); //send_exit.Enable(false); bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount(); send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", wxString(m_sys_menu_opened ? "close" : "open").wx_str())); send_open_menu.Enable(enable_commands); send_exit.Enable(enable_commands); //m_aui_mgr.Update(); //wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg ); //GetEventHandler()->AddPendingEvent( refit ); }
void TranslDlg::OnCommand(wxCommandEvent& event) {//============================================= #define N_PH_LIST N_PHONEME_LIST void *vp; int translate_text = 0; char buf[1000]; char phon_out[N_PH_LIST*2]; int clause_tone; int clause_count; int use_ipa = 0; FILE *f; int fd_temp; char fname_temp[100]; static int n_ph_list; static PHONEME_LIST ph_list[N_PH_LIST+1]; if(translator==NULL) { wxLogError(_T("Voice not set")); return; } option_phonemes = 0; switch(event.GetId()) { case T_RULES: case MENU_SPEAK_RULES: #ifdef PLATFORM_POSIX strcpy(fname_temp,"/tmp/espeakXXXXXX"); if((fd_temp = mkstemp(fname_temp)) >= 0) { close(fd_temp); if((f = fopen(fname_temp,"w+")) != NULL) { f_trans = f; // write translation rule trace to a temp file } } #else strcpy(fname_temp,tmpnam(NULL)); if((f = fopen(fname_temp,"w+")) != NULL) { f_trans = f; // write translation rule trace to a temp file } #endif t_phonetic->SetDefaultStyle(style_phonetic); translate_text = 2; break; case T_TRANSLATE: case MENU_SPEAK_TRANSLATE: t_phonetic->SetDefaultStyle(style_phonetic); translate_text = 1; break; case T_TRANSLATE_IPA: case MENU_SPEAK_IPA: t_phonetic->SetDefaultStyle(style_phonetic_large); translate_text = 3; use_ipa = 1; break; case T_PROCESS: case MENU_SPEAK_TEXT: myframe->OnProsody(event); prosodycanvas->LayoutData(ph_list,n_ph_list); myframe->Refresh(); option_phoneme_events = espeakINITIALIZE_PHONEME_EVENTS; option_log_frames = 1; MakeWave2(ph_list,n_ph_list); option_log_frames = 0; break; } if(translate_text) { option_phonemes = translate_text; option_multibyte = espeakCHARS_AUTO; SpeakNextClause(NULL,NULL,2); // stop speaking file strncpy0(buf,t_source->GetValue().mb_str(wxConvUTF8),sizeof(buf)); phon_out[0] = 0; n_ph_list = 0; clause_count = 0; vp = buf; InitText(0); while((vp != NULL) && (n_ph_list < N_PH_LIST)) { vp = TranslateClause(translator,NULL,vp,&clause_tone,NULL); CalcPitches(translator,clause_tone); CalcLengths(translator); GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa); if(clause_count++ > 0) strcat(phon_out," ||"); strcat(phon_out,translator->phon_out); t_phonetic->SetValue(wxString(translator->phon_out,wxConvUTF8)); if((n_ph_list + n_phoneme_list) >= N_PH_LIST) { n_phoneme_list = N_PH_LIST - n_ph_list; } memcpy(&ph_list[n_ph_list],phoneme_list,sizeof(PHONEME_LIST)*n_phoneme_list); n_ph_list += n_phoneme_list; } ph_list[N_PH_LIST].ph = NULL; // to recognize overrun off list (in Generate() ) t_phonetic->Clear(); if(option_phonemes == 2) { option_phonemes=0; rewind(f_trans); while(fgets(buf,sizeof(buf),f_trans) != NULL) { t_phonetic->AppendText(wxString(buf,wxConvUTF8)); } t_phonetic->AppendText(_T("---\n")); if(f_trans != NULL) fclose(f_trans); remove(fname_temp); } t_phonetic->AppendText(wxString(phon_out,wxConvUTF8)); } } // end of TranslDlg::OnCommand
/* Event handler for tracks and vias size selection (and some options) * relative to toolbars and popup events */ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) { int ii; int id = event.GetId(); /* Note: none of these events require aborting the current command (if any) * (like move, edit or block command) * so we do not test for a current command in progress and call * m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); */ switch( id ) { case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: GetDesignSettings().m_UseConnectedTrackWidth = not GetDesignSettings().m_UseConnectedTrackWidth; break; case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().SetTrackWidthIndex( 0 ); GetDesignSettings().SetViaSizeIndex( 0 ); break; case ID_POPUP_PCB_SELECT_AUTO_WIDTH: m_canvas->MoveCursorToCrossHair(); GetDesignSettings().m_UseConnectedTrackWidth = true; break; case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_WIDTH2: // this is a custom value selection case ID_POPUP_PCB_SELECT_WIDTH3: case ID_POPUP_PCB_SELECT_WIDTH4: case ID_POPUP_PCB_SELECT_WIDTH5: case ID_POPUP_PCB_SELECT_WIDTH6: case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH9: case ID_POPUP_PCB_SELECT_WIDTH10: case ID_POPUP_PCB_SELECT_WIDTH11: case ID_POPUP_PCB_SELECT_WIDTH12: case ID_POPUP_PCB_SELECT_WIDTH13: case ID_POPUP_PCB_SELECT_WIDTH14: case ID_POPUP_PCB_SELECT_WIDTH15: case ID_POPUP_PCB_SELECT_WIDTH16: m_canvas->MoveCursorToCrossHair(); GetDesignSettings().m_UseConnectedTrackWidth = false; ii = id - ID_POPUP_PCB_SELECT_WIDTH1; GetDesignSettings().SetTrackWidthIndex( ii ); break; case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_VIASIZE2: // this is a custom value selection case ID_POPUP_PCB_SELECT_VIASIZE3: case ID_POPUP_PCB_SELECT_VIASIZE4: case ID_POPUP_PCB_SELECT_VIASIZE5: case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE7: case ID_POPUP_PCB_SELECT_VIASIZE8: case ID_POPUP_PCB_SELECT_VIASIZE9: case ID_POPUP_PCB_SELECT_VIASIZE10: case ID_POPUP_PCB_SELECT_VIASIZE11: case ID_POPUP_PCB_SELECT_VIASIZE12: case ID_POPUP_PCB_SELECT_VIASIZE13: case ID_POPUP_PCB_SELECT_VIASIZE14: case ID_POPUP_PCB_SELECT_VIASIZE15: case ID_POPUP_PCB_SELECT_VIASIZE16: // select the new current value for via size (via diameter) m_canvas->MoveCursorToCrossHair(); ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; GetDesignSettings().SetViaSizeIndex( ii ); break; case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: ii = m_SelTrackWidthBox->GetSelection(); if( ii == int( m_SelTrackWidthBox->GetCount() - 2 ) ) { // this is the separator m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() ); } else if( ii == int( m_SelTrackWidthBox->GetCount() - 1 ) ) { m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() ); DoShowBoardSetupDialog( _( "Tracks & Vias" ) ); } else GetDesignSettings().SetTrackWidthIndex( ii ); break; case ID_AUX_TOOLBAR_PCB_VIA_SIZE: ii = m_SelViaSizeBox->GetSelection(); if( ii == int( m_SelViaSizeBox->GetCount() - 2 ) ) { // this is the separator m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() ); } else if( ii == int( m_SelViaSizeBox->GetCount() - 1 ) ) { m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() ); DoShowBoardSetupDialog( _( "Tracks & Vias" ) ); } else GetDesignSettings().SetViaSizeIndex( ii ); break; default: wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") ); break; } // Refresh track in progress, if any, by forcing a mouse event, // to call the current function attached to the mouse /*if( m_canvas->IsMouseCaptured() ) { wxMouseEvent event(wxEVT_MOTION); wxPostEvent( m_canvas, event ); }*/ //+hp //Refresh canvas, that we can see changes instantly. I use this because it dont,t throw mouse up-left corner. if( m_canvas->IsMouseCaptured() ) m_canvas->Refresh(); }
void MyFrame::OnOverlay(wxCommandEvent& evt) { pGuider->SetOverlayMode(evt.GetId() - MENU_XHAIR0); }
void ddColumnOptionIcon::OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view) { changeIcon((ddColumnOptionType)event.GetId()); }
void Dialogs::BaseConfigurationDialog::OnSomethingChanged( wxCommandEvent& evt ) { evt.Skip(); if( (evt.GetId() != wxID_OK) && (evt.GetId() != wxID_CANCEL) && (evt.GetId() != wxID_APPLY) ) SomethingChanged(); }
/* Handles the selection of tools, menu, and popup menu commands. */ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); switch( id ) { case wxID_CUT: case wxID_COPY: case ID_POPUP_DELETE_BLOCK: case ID_POPUP_PLACE_BLOCK: case ID_POPUP_ZOOM_BLOCK: break; case ID_POPUP_CANCEL_CURRENT_COMMAND: m_canvas->EndMouseCapture(); if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE ) { /* Should not be executed, except bug */ GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE ); GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK ); GetScreen()->m_BlockLocate.ClearItemsList(); } if( GetToolId() == ID_NO_TOOL_SELECTED ) SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); else m_canvas->SetCursor( (wxStockCursor) m_canvas->GetCurrentCursor() ); break; default: m_canvas->EndMouseCapture(); break; } INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( id ) { case ID_GERBVIEW_SET_PAGE_BORDER: { DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this ); if( dlg.ShowModal() == wxID_OK ) m_canvas->Refresh(); } break; case ID_GERBVIEW_GLOBAL_DELETE: Erase_Current_Layer( true ); ClearMsgPanel(); break; case ID_NO_TOOL_SELECTED: SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_POPUP_CLOSE_CURRENT_TOOL: SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_POPUP_CANCEL_CURRENT_COMMAND: break; case ID_GERBVIEW_SHOW_LIST_DCODES: Liste_D_Codes(); break; case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE ); m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; case ID_POPUP_ZOOM_BLOCK: GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM ); GetScreen()->m_BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE ); GetScreen()->m_BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; default: wxFAIL_MSG( wxT( "GERBVIEW_FRAME::Process_Special_Functions error" ) ); break; } }