filter_dlg_shared_state() { app = &(wxGetApp()); }
void CSelectMode::OnDragging( wxMouseEvent& event ) { if(event.MiddleIsDown()) { wxPoint dm; dm.x = event.GetX() - CurrentPoint.x; dm.y = event.GetY() - CurrentPoint.y; if(wxGetApp().ctrl_does_rotate == event.ControlDown()) { if(wxGetApp().m_rotate_mode) { wxGetApp().m_current_viewport->m_view_point.Turn(dm); } else { wxGetApp().m_current_viewport->m_view_point.TurnVertical(dm); } } else { wxGetApp().m_current_viewport->m_view_point.Shift(dm, wxPoint(event.GetX(), event.GetY())); } wxGetApp().m_current_viewport->m_need_update = true; wxGetApp().m_current_viewport->m_need_refresh = true; } else if(event.LeftIsDown()) { if(wxGetApp().drag_gripper) { double to[3], from[3]; wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY())); extract(wxGetApp().m_digitizing->digitized_point.m_point, to); wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point; extract(wxGetApp().grip_from, from); wxGetApp().drag_gripper->OnGripperMoved(from, to); wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]); wxGetApp().grip_from = make_point(from); } else if(abs(button_down_point.x - event.GetX())>2 || abs(button_down_point.y - event.GetY())>2) { if(wxGetApp().m_dragging_moves_objects && !window_box_exists) { std::list<HeeksObj*> selected_objects_dragged; wxGetApp().m_show_grippers_on_drag = true; if( wxGetApp().m_marked_list->list().size() > 0) { for(std::list<HeeksObj*>::iterator It = wxGetApp().m_marked_list->list().begin(); It != wxGetApp().m_marked_list->list().end(); It++) { HeeksObj* object = *It; if(object->CanBeDragged())selected_objects_dragged.push_back(object); } } else { MarkedObjectManyOfSame marked_object; wxGetApp().FindMarkedObject(button_down_point, &marked_object); if(marked_object.m_map.size()>0){ HeeksObj* object = marked_object.GetFirstOfTopOnly(); double min_depth = 0.0; HeeksObj* closest_object = NULL; while(object) { if(object->CanBeDragged()) { double depth = marked_object.GetDepth(); if(closest_object == NULL || depth<min_depth) { min_depth = depth; closest_object = object; } } object = marked_object.Increment(); } if(selected_objects_dragged.size() == 0 && closest_object){ selected_objects_dragged.push_back(closest_object); wxGetApp().m_show_grippers_on_drag = false; } } } if(selected_objects_dragged.size() > 0) { wxGetApp().drag_gripper = &drag_object_gripper; wxGetApp().m_digitizing->SetOnlyCoords(wxGetApp().drag_gripper, true); wxGetApp().m_digitizing->digitize(button_down_point); wxGetApp().grip_from = wxGetApp().m_digitizing->digitized_point.m_point; wxGetApp().grip_to = wxGetApp().grip_from; double from[3]; from[0] = wxGetApp().grip_from.X(); from[1] = wxGetApp().grip_from.Y(); from[2] = wxGetApp().grip_from.Z(); wxGetApp().drag_gripper->OnGripperGrabbed(selected_objects_dragged, wxGetApp().m_show_grippers_on_drag, from); wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]); double to[3]; wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY())); extract(wxGetApp().m_digitizing->digitized_point.m_point, to); wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point; extract(wxGetApp().grip_from, from); wxGetApp().drag_gripper->OnGripperMoved(from, to); wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]); return; } } if(window_box_exists && wxGetApp().m_mouse_move_highlighting) { m_highlighted_objects.clear(); GetObjectsInWindow(event, m_highlighted_objects); wxGetApp().Repaint(); } // do window selection if(!m_just_one) { wxGetApp().m_current_viewport->SetXOR(); if(window_box_exists)wxGetApp().m_current_viewport->DrawWindow(window_box, true); // undraw the window window_box.x = button_down_point.x; window_box.width = event.GetX() - button_down_point.x; window_box.y = wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - button_down_point.y; window_box.height = button_down_point.y - event.GetY(); wxGetApp().m_current_viewport->DrawWindow(window_box, true);// draw the window wxGetApp().m_current_viewport->EndXOR(); window_box_exists = true; } } } CurrentPoint = wxPoint(event.GetX(), event.GetY()); }
void Run(){ wxGetApp().m_marked_list->m_filter = -1; wxGetApp().m_frame->RefreshInputCanvas(); }
// ------------------------------------------------------------------------ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) ) , m_statusbar( *CreateStatusBar(2, 0) ) , m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() ) // All menu components must be created on the heap! , m_menubar( *new wxMenuBar() ) , m_menuCDVD ( *new wxMenu() ) , m_menuSys ( *new wxMenu() ) , m_menuConfig ( *new wxMenu() ) , m_menuMisc ( *new wxMenu() ) , m_menuDebug ( *new wxMenu() ) , m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) ) , m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ) , m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, _("Show Console"), wxEmptyString, wxITEM_CHECK ) ) , m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, _("Console to Stdio"), wxEmptyString, wxITEM_CHECK ) ) { m_RestartEmuOnDelete = false; for( int i=0; i<PluginId_Count; ++i ) m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i ); // ------------------------------------------------------------------------ // Initial menubar setup. This needs to be done first so that the menu bar's visible size // can be factored into the window size (which ends up being background+status+menus) //m_menubar.Append( &m_menuBoot, _("&Boot") ); m_menubar.Append( &m_menuSys, _("&System") ); m_menubar.Append( &m_menuCDVD, _("CD&VD") ); m_menubar.Append( &m_menuConfig, _("&Config") ); m_menubar.Append( &m_menuMisc, _("&Misc") ); #ifdef PCSX2_DEVBUILD m_menubar.Append( &m_menuDebug, _("&Debug") ); #endif SetMenuBar( &m_menubar ); // ------------------------------------------------------------------------ wxSize backsize( m_background.GetSize() ); wxString wintitle; if( PCSX2_isReleaseVersion ) { // stable releases, with a simple title. wintitle.Printf( _("%s %d.%d.%d"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo ); } else { // beta / development editions, which feature revision number and compile date. wintitle.Printf( _("%s %d.%d.%d.%d%s (svn) %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() ); } SetTitle( wintitle ); // Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and // loses the transparency information when loading bitmaps into icons. But for some reason // I cannot get it to work despite following various examples to the letter. SetIcons( wxGetApp().GetIconBundle() ); int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) }; m_statusbar.SetStatusWidths(2, m_statusbar_widths); //m_statusbar.SetStatusText( L"The Status is Good!", 0); m_statusbar.SetStatusText( wxEmptyString, 0); wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) ); joe.Add( &m_background ); SetSizerAndFit( &joe ); // Use default window position if the configured windowpos is invalid (partially offscreen) if( g_Conf->MainGuiPosition == wxDefaultPosition || !pxIsValidWindowPosition( *this, g_Conf->MainGuiPosition) ) g_Conf->MainGuiPosition = GetScreenPosition(); else SetPosition( g_Conf->MainGuiPosition ); // Updating console log positions after the main window has been fitted to its sizer ensures // proper docked positioning, since the main window's size is invalid until after the sizer // has been set/fit. InitLogBoxPosition( g_Conf->ProgLogBox ); // ------------------------------------------------------------------------ // Some of the items in the System menu are configured by the UpdateCoreStatus() method. m_menuSys.Append(MenuId_Boot_CDVD, _("Initializing...")); m_menuSys.Append(MenuId_Boot_CDVD2, _("Initializing...")); m_menuSys.Append(MenuId_Boot_ELF, _("Run ELF..."), _("For running raw PS2 binaries directly")); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_SuspendResume, _("Initializing...")); m_menuSys.AppendSeparator(); //m_menuSys.Append(MenuId_Sys_Close, _("Close"), // _("Stops emulation and closes the GS window.")); m_menuSys.Append(MenuId_Sys_LoadStates, _("Load state"), &m_LoadStatesSubmenu); m_menuSys.Append(MenuId_Sys_SaveStates, _("Save state"), &m_SaveStatesSubmenu); m_menuSys.Append(MenuId_EnableBackupStates, _("Backup before save"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_EnablePatches, _("Automatic Gamefixes"), _("Automatically applies needed Gamefixes to known problematic games"), wxITEM_CHECK); m_menuSys.Append(MenuId_EnableCheats, _("Enable Cheats"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableWideScreenPatches, _("Enable Widescreen Patches"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableHostFs, _("Enable Host Filesystem"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_Shutdown, _("Shutdown"), _("Wipes all internal VM states and shuts down plugins.")); m_menuSys.Append(MenuId_Exit, _("Exit"), AddAppName(_("Closing %s may be hazardous to your health"))); // ------------------------------------------------------------------------ wxMenu& isoRecents( wxGetApp().GetRecentIsoMenu() ); //m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_IsoSelector, _("Iso Selector"), &isoRecents ); m_menuCDVD.Append( GetPluginMenuId_Settings(PluginId_CDVD), _("Plugin Menu"), m_PluginMenuPacks[PluginId_CDVD] ); m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_Src_Iso, _("Iso"), _("Makes the specified ISO image the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_Plugin, _("Plugin"), _("Uses an external plugin as the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_NoDisc, _("No disc"), _("Use this to boot into your virtual PS2's BIOS configuration."), wxITEM_RADIO ); //m_menuCDVD.AppendSeparator(); //m_menuCDVD.Append( MenuId_SkipBiosToggle,_("Enable BOOT2 injection"), // _("Skips PS2 splash screens when booting from Iso or DVD media"), wxITEM_CHECK ); // ------------------------------------------------------------------------ m_menuConfig.Append(MenuId_Config_SysSettings, _("Emulation &Settings") ); m_menuConfig.Append(MenuId_Config_McdSettings, _("&Memory cards") ); m_menuConfig.Append(MenuId_Config_BIOS, _("&Plugin/BIOS Selector") ); if (IsDebugBuild) m_menuConfig.Append(MenuId_Config_GameDatabase, _("Game Database Editor") ); // Empty menu // m_menuConfig.Append(MenuId_Config_Language, _("Appearance...") ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_GS, _("&Video (GS)"), m_PluginMenuPacks[PluginId_GS]); m_menuConfig.Append(MenuId_Config_SPU2, _("&Audio (SPU2)"), m_PluginMenuPacks[PluginId_SPU2]); m_menuConfig.Append(MenuId_Config_PAD, _("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]); m_menuConfig.Append(MenuId_Config_DEV9, _("Dev9"), m_PluginMenuPacks[PluginId_DEV9]); m_menuConfig.Append(MenuId_Config_USB, _("USB"), m_PluginMenuPacks[PluginId_USB]); m_menuConfig.Append(MenuId_Config_FireWire, _("Firewire"), m_PluginMenuPacks[PluginId_FW]); //m_menuConfig.AppendSeparator(); //m_menuConfig.Append(MenuId_Config_Patches, _("Patches (unimplemented)"), wxEmptyString); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_Multitap0Toggle, _("Multitap 1"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.Append(MenuId_Config_Multitap1Toggle, _("Multitap 2"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_ResetAll, _("Clear all settings..."), AddAppName(_("Clears all %s settings and re-runs the startup wizard."))); // ------------------------------------------------------------------------ m_menuMisc.Append( &m_MenuItem_Console ); #ifdef __LINUX__ m_menuMisc.Append( &m_MenuItem_Console_Stdio ); #endif //Todo: Though not many people need this one :p //m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); //m_menuMisc.AppendSeparator(); // No dialogs implemented for these yet... //m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL); m_menuMisc.AppendSeparator(); //Todo: //There's a great working "open website" in the about panel. Less clutter by just using that. //m_menuMisc.Append(MenuId_Website, _("Visit Website..."), // _("Opens your web-browser to our favorite website.")); m_menuMisc.Append(MenuId_About, _("About...") ); m_menuMisc.AppendSeparator(); m_menuMisc.Append( MenuId_ChangeLang, L"Change Language" ); // Always in English #ifdef PCSX2_DEVBUILD m_menuDebug.Append(MenuId_Debug_Open, _("Open Debug Window..."), wxEmptyString); //m_menuDebug.Append(MenuId_Debug_MemoryDump, _("Memory Dump..."), wxEmptyString); m_menuDebug.Append(MenuId_Debug_Logging, _("Logging..."), wxEmptyString); #endif m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible ); ConnectMenus(); Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) ); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (MainEmuFrame::OnCloseWindow) ); Connect( wxEVT_SET_FOCUS, wxFocusEventHandler (MainEmuFrame::OnFocus) ); Connect( wxEVT_ACTIVATE, wxActivateEventHandler (MainEmuFrame::OnActivate) ); PushEventHandler( &wxGetApp().GetRecentIsoManager() ); SetDropTarget( new IsoDropTarget( this ) ); ApplyCoreStatus(); ApplySettings(); }
void CSelectMode::OnLeftDown( wxMouseEvent& event ) { button_down_point = wxPoint(event.GetX(), event.GetY()); CurrentPoint = button_down_point; m_button_down = true; m_highlighted_objects.clear(); if(wxGetApp().m_dragging_moves_objects) { MarkedObjectManyOfSame marked_object; wxGetApp().FindMarkedObject(button_down_point, &marked_object); if(marked_object.m_map.size()>0) { HeeksObj* object = marked_object.GetFirstOfTopOnly(); if (event.ShiftDown()) { // Augment the marked_object list with objects that 'look' like // the one selected. CCorrelationTool correlate(wxGetApp().m_min_correlation_factor, wxGetApp().m_max_scale_threshold, wxGetApp().m_number_of_sample_points, wxGetApp().m_correlate_by_color ); std::list<HeeksObj *> similar_objects = correlate.SimilarSymbols( object ); std::list<HeeksObj *>::const_iterator l_itSymbol; for (l_itSymbol = similar_objects.begin(); l_itSymbol != similar_objects.end(); l_itSymbol++) { HeeksObj *ob = *l_itSymbol; if (! wxGetApp().m_marked_list->ObjectMarked(ob)) { wxGetApp().m_marked_list->Add(ob, true); } } // End for } // End if - then while(object) { if(object->GetType() == GripperType) { wxGetApp().m_current_viewport->DrawFront(); wxGetApp().drag_gripper = (Gripper*)object; wxGetApp().m_digitizing->SetOnlyCoords(wxGetApp().drag_gripper, true); wxGetApp().m_digitizing->digitize(button_down_point); wxGetApp().grip_from = wxGetApp().m_digitizing->digitized_point.m_point; wxGetApp().grip_to = wxGetApp().grip_from; double from[3]; from[0] = wxGetApp().grip_from.X(); from[1] = wxGetApp().grip_from.Y(); from[2] = wxGetApp().grip_from.Z(); std::list<HeeksObj*> selected_objects; for(std::list<HeeksObj*>::iterator It = wxGetApp().m_marked_list->list().begin(); It != wxGetApp().m_marked_list->list().end(); It++) { HeeksObj* object = *It; if(object->CanBeDragged())selected_objects.push_back(object); } wxGetApp().drag_gripper->OnGripperGrabbed(selected_objects, true, from); wxGetApp().grip_from = gp_Pnt(from[0], from[1], from[2]); wxGetApp().m_current_viewport->EndDrawFront(); return; } object = marked_object.Increment(); } } } }
void CViewWork::OnWorkAbort( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function Begin")); wxInt32 iAnswer = 0; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); CWork* work; int row, n; wxASSERT(pDoc); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); wxASSERT(m_pTaskPane); wxASSERT(m_pListPane); if (!pDoc->IsUserAuthorized()) return; n = m_pListPane->GetSelectedItemCount(); if (n == 1) { row = -1; row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) return; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[row])) { return; } strMessage.Printf( _("Are you sure you want to abort this task '%s'?\n(Progress: %s, Status: %s)"), (work->m_strName).c_str(), (work->m_strProgress).c_str(), (work->m_strStatus).c_str() ); } else { strMessage.Printf(_("Are you sure you want to abort these %d tasks?"), n); } iAnswer = wxGetApp().SafeMessageBox( strMessage, _("Abort task"), wxYES_NO | wxICON_QUESTION, this ); if (wxYES != iAnswer) { return; } row = -1; while (1) { // Step through all selected items row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) break; RESULT* result = pDoc->result(m_iSortedIndexes[row]); if (result) { pDoc->WorkAbort(result->project_url, result->name); } } UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function End")); }
void CViewWork::UpdateSelection() { int i, n, row; CTaskItemGroup* pGroup = NULL; RESULT* result = NULL; PROJECT* project = NULL; CC_STATUS status; CMainDocument* pDoc = wxGetApp().GetDocument(); std::string first_project_url; wxString strMachineName; bool wasSuspended=false; bool all_same_project=false; bool enableShowGraphics = false; bool enableShowVMConsole = false; bool enableSuspendResume = false; bool enableAbort = false; bool enableProperties = false; wxASSERT(NULL != pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(NULL != m_pTaskPane); CBOINCBaseView::PreUpdateSelection(); pGroup = m_TaskGroups[0]; n = m_pListPane->GetSelectedItemCount(); if (n > 0) { enableShowGraphics = true; enableShowVMConsole = true; enableSuspendResume = true; enableAbort = true; pDoc->GetCoreClientStatus(status); if (status.task_suspend_reason & ~(SUSPEND_REASON_CPU_THROTTLE)) { enableShowGraphics = false; enableShowVMConsole = false; } pDoc->GetConnectedComputerName(strMachineName); if (!pDoc->IsComputerNameLocal(strMachineName)) { enableShowGraphics = false; enableShowVMConsole = false; } } if (pDoc->m_ActiveTasksOnly) { m_pTaskPane->UpdateTask( pGroup->m_Tasks[BTN_ACTIVE_ONLY], _("Show all tasks"), _("Show all tasks.") ); } else { m_pTaskPane->UpdateTask( pGroup->m_Tasks[BTN_ACTIVE_ONLY], _("Show active tasks"), _("Show only active tasks.") ); } row = -1; for (i=0; i<n; i++) { // Step through all selected items row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) break; // Should never happen result = pDoc->result(m_iSortedIndexes[row]); if (!result) continue; if (i == 0) { wasSuspended = result->suspended_via_gui; if (result->suspended_via_gui) { m_pTaskPane->UpdateTask( pGroup->m_Tasks[BTN_SUSPEND], _("Resume"), _("Resume work for this task.") ); } else { m_pTaskPane->UpdateTask( pGroup->m_Tasks[BTN_SUSPEND], _("Suspend"), _("Suspend work for this task.") ); } } else { if (wasSuspended != result->suspended_via_gui) { // Disable Suspend / Resume button if the multiple selection // has a mix of suspended and not suspended tasks enableSuspendResume = false; } } // Disable Show VM console if the selected task hasn't registered a remote // desktop connection // if (!strlen(result->remote_desktop_addr)) { enableShowVMConsole = false; } // Disable Show Graphics button if the selected task can't display graphics // if (!strlen(result->web_graphics_url) && !strlen(result->graphics_exec_path)) { enableShowGraphics = false; } if (result->suspended_via_gui || result->project_suspended_via_gui || (result->scheduler_state != CPU_SCHED_SCHEDULED) ) { enableShowGraphics = false; } // Disable Abort button if any selected task already aborted if ( result->active_task_state == PROCESS_ABORT_PENDING || result->active_task_state == PROCESS_ABORTED || result->state == RESULT_ABORTED ) { enableAbort = false; } if (i == 0) { first_project_url = result->project_url; all_same_project = true; } else { if (first_project_url != result->project_url) { all_same_project = false; } } if (n == 1) { enableProperties = true; } } // To minimize flicker, set each button only once to the final desired state pGroup->m_Tasks[BTN_GRAPHICS]->m_pButton->Enable(enableShowGraphics); if (enableShowVMConsole) { pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Enable(); if (pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Show()) { m_pTaskPane->FitInside(); } } else { pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Disable(); if (pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Hide()) { m_pTaskPane->FitInside(); }; } pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume); pGroup->m_Tasks[BTN_ABORT]->m_pButton->Enable(enableAbort); pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties); if (all_same_project) { project = pDoc->state.lookup_project(result->project_url); UpdateWebsiteSelection(GRP_WEBSITES, project); if(m_TaskGroups.size()>1) { m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]); } } else { UpdateWebsiteSelection(GRP_WEBSITES, NULL); if(m_TaskGroups.size()>1) { m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]); } } CBOINCBaseView::PostUpdateSelection(); }
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) { double xRatio, yRatio, ratio; TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData(); if (selData == NULL) return; if (reload) { m_bCurrentSlideIsDefault = false; selData->lastSlideShown = -1; } int numSlides = (int)selData->slideShowFileNames.size(); #if TESTALLDESCRIPTIONS // For testing numSlides = 0; #endif if (numSlides <= 0) { #if HIDEDEFAULTSLIDE if (!reload) { return; } wxRect r = GetRect(); wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r); wxWindowDC dc(this); dc.DrawBitmap(backgroundBitmap, 0, 0); // Force redraws if text unchanged; hide all if not in all-projects list m_description->Show(false); Enable( false ); if (!m_bGotAllProjectsList) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); pDoc->rpc.get_all_projects_list(m_AllProjectsList); m_bGotAllProjectsList = true; } SetDescriptionText(); return; #else // HIDEDEFAULTSLIDE SetBackgroundColour(*wxBLACK); if (m_bCurrentSlideIsDefault) return; CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap(); if (m_SlideBitmap.Ok()) { m_bCurrentSlideIsDefault = true; } #endif // HIDEDEFAULTSLIDE } else { #if HIDEDEFAULTSLIDE m_description->Show(false); Enable( false ); #endif // HIDEDEFAULTSLIDE // TODO: Should we allow slide show to advance if task is not running? int newSlide = selData->lastSlideShown; if (selData->dotColor == runningIcon) { // Advance only if running if (changeSlide) { if (++newSlide >= numSlides) { newSlide = 0; } } } if (newSlide < 0) { newSlide = 0; } if (selData->lastSlideShown != newSlide) { // Don't update if only one slide selData->lastSlideShown = newSlide; wxBitmap *bm = new wxBitmap(); bm->LoadFile(selData->slideShowFileNames[newSlide], wxBITMAP_TYPE_ANY); if (bm->Ok()) { m_SlideBitmap = *bm; delete bm; m_bCurrentSlideIsDefault = false; } } } if (m_SlideBitmap.Ok()) { // Check to see if they need to be rescaled to fit in the window ratio = 1.0; xRatio = (double)SLIDESHOWWIDTH / (double)m_SlideBitmap.GetWidth(); yRatio = (double)SLIDESHOWHEIGHT / (double)m_SlideBitmap.GetHeight(); ratio = xRatio; if ( yRatio < ratio ) { ratio = yRatio; } if ( (ratio < 0.95) || (ratio > 1.05) ) { wxImage img = m_SlideBitmap.ConvertToImage(); img.Rescale((int) (m_SlideBitmap.GetWidth()*ratio), (int) (m_SlideBitmap.GetHeight()*ratio), (ratio > 1.0) ? wxIMAGE_QUALITY_BILINEAR : wxIMAGE_QUALITY_BOX_AVERAGE ); wxBitmap *bm = new wxBitmap(img); m_SlideBitmap = *bm; delete bm; } Refresh(); } }
void CSimpleTaskPanel::UpdatePanel(bool delayShow) { wxString s = wxEmptyString; wxString projName = wxEmptyString; TaskSelectionData *selData; CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); int workCount = pDoc->GetSimpleGUIWorkCount(); // Workaround for Linux refresh problem static bool wasDelayed = false; #ifndef __WXMAC__ Freeze(); #endif if ((workCount <= 0) || delayShow) { if ((workCount != m_oldWorkCount) || delayShow) { wasDelayed = true; m_myTasksLabel->Hide(); m_TaskSelectionCtrl->Hide(); m_TaskProjectLabel->Hide(); m_TaskProjectName->Hide(); #if SELECTBYRESULTNAME m_TaskApplicationName->Hide(); #endif // SELECTBYRESULTNAME m_SlideShowArea->Hide(); m_ElapsedTimeValue->Hide(); m_TimeRemainingValue->Hide(); if (m_ipctDoneX1000 >= 0) { m_ipctDoneX1000 = -1; m_ProgressBar->Hide(); } m_ProgressValueText->Hide(); m_TaskCommandsButton->Hide(); this->Layout(); #ifdef __WXMAC__ m_ProgressRect = m_ProgressBar->GetRect(); m_ProgressRect.Inflate(0, -2); m_ProgressRect.Offset(0, -2); #endif } DisplayIdleState(); } else { if ((m_oldWorkCount == 0) || wasDelayed) { wasDelayed = false; m_myTasksLabel->Show(); m_TaskSelectionCtrl->Show(); m_TaskProjectLabel->Show(); m_TaskProjectName->Show(); #if SELECTBYRESULTNAME m_TaskApplicationName->Show(); #endif // SELECTBYRESULTNAME m_SlideShowArea->Show(); m_ElapsedTimeValue->Show(); m_TimeRemainingValue->Show(); m_ProgressBar->Show(); m_ProgressValueText->Show(); m_TaskCommandsButton->Show(); this->Layout(); #ifdef __WXMAC__ m_ProgressRect = m_ProgressBar->GetRect(); m_ProgressRect.Inflate(0, -2); m_ProgressRect.Offset(0, -2); #endif } UpdateTaskSelectionList(false); // We now have valid result pointers, so extract our data int count = m_TaskSelectionCtrl->GetCount(); if (count <= 0) { m_CurrentTaskSelection = -1; } else { if ((m_CurrentTaskSelection < 0) || (m_CurrentTaskSelection > count -1)) { m_TaskSelectionCtrl->SetSelection(0); m_CurrentTaskSelection = 0; m_bStableTaskInfoChanged = true; } selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(m_CurrentTaskSelection); RESULT* result = selData->result; if (result) { if (m_bStableTaskInfoChanged) { #if SELECTBYRESULTNAME wxString str = wxEmptyString; GetApplicationAndProjectNames(result, &s, &projName); str.Printf(_("Application: %s"), s.c_str()); UpdateStaticText(&m_TaskApplicationName, str); UpdateStaticText(&m_TaskProjectName, projName); #else // SELECTBYRESULTNAME GetApplicationAndProjectNames(result, NULL, &projName); #endif // SELECTBYRESULTNAME UpdateStaticText(&m_TaskProjectName, projName); m_SlideShowArea->AdvanceSlideShow(false, true); m_bStableTaskInfoChanged = false; } double f = result->elapsed_time; if (f == 0.) f = result->current_cpu_time; // f = result->final_elapsed_time; UpdateStaticText(&m_ElapsedTimeValue, GetElapsedTimeString(f)); UpdateStaticText(&m_TimeRemainingValue, GetTimeRemainingString(result->estimated_cpu_time_remaining)); // fraction_done ranges from 0.0 to 1.0 so % done = fraction_done * 100. int pctDoneX1000 = result->fraction_done * 100000.0; // Update progress only if visible part has changed (xx.xxx) if (m_ipctDoneX1000 != pctDoneX1000) { int pctDone = pctDoneX1000 / 1000; if (m_ipctDoneX1000 != (pctDone * 1000)) { m_ProgressBar->SetValue(pctDone); } s.Printf(_("%.3f%%"), result->fraction_done*100); m_ipctDoneX1000 = pctDoneX1000; UpdateStaticText(&m_ProgressValueText, s); } UpdateStaticText(&m_StatusValueText, GetStatusString(result)); } else { UpdateStaticText(&m_TaskProjectName, m_sNotAvailableString); #if SELECTBYRESULTNAME UpdateStaticText(&m_TaskApplicationName, _("Application: Not available") ); #endif // SELECTBYRESULTNAME UpdateStaticText(&m_ElapsedTimeValue, GetElapsedTimeString(-1.0)); UpdateStaticText(&m_TimeRemainingValue, GetTimeRemainingString(-1.0)); if (m_ipctDoneX1000 >= 0) { m_ipctDoneX1000 = -1; m_ProgressBar->Hide(); } UpdateStaticText(&m_ProgressValueText, wxEmptyString); UpdateStaticText(&m_StatusValueText, GetStatusString(NULL)); } } } m_oldWorkCount = workCount; #ifndef __WXMAC__ Thaw(); #endif }
/// Reads the specified data from the aliased file, using libsndfile, /// and converts it to the given sample format. /// Copied from PCMAliasBlockFIle but wxLog calls taken out for thread safety /// /// @param data The buffer to read the sample data into. /// @param format The format to convert the data into /// @param start The offset within the block to begin reading /// @param len The number of samples to read int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, sampleCount start, sampleCount len) const { LockRead(); SF_INFO info; if(!mAliasedFileName.IsOk()){ // intentionally silenced memset(data,0,SAMPLE_SIZE(format)*len); UnlockRead(); return len; } memset(&info, 0, sizeof(info)); wxString aliasPath = mAliasedFileName.GetFullPath(); wxFile f; // will be closed when it goes out of scope SFFile sf; if (f.Exists(aliasPath) && f.Open(aliasPath)) { // Even though there is an sf_open() that takes a filename, use the one that // takes a file descriptor since wxWidgets can open a file with a Unicode name and // libsndfile can't (under Windows). sf.reset(SFCall<SNDFILE*>(sf_open_fd, f.fd(), SFM_READ, &info, FALSE)); } if (!sf) { memset(data,0,SAMPLE_SIZE(format)*len); mSilentAliasLog = TRUE; // Set a marker to display an error message if (!wxGetApp().ShouldShowMissingAliasedFileWarning()) wxGetApp().MarkAliasedFilesMissingWarning(this); UnlockRead(); return len; } mSilentAliasLog=FALSE; SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET); SampleBuffer buffer(len * info.channels, floatSample); int framesRead = 0; if (format == int16Sample && !sf_subtype_more_than_16_bits(info.format)) { // Special case: if the file is in 16-bit (or less) format, // and the calling method wants 16-bit data, go ahead and // read 16-bit data directly. This is a pretty common // case, as most audio files are 16-bit. framesRead = SFCall<sf_count_t>(sf_readf_short, sf.get(), (short *)buffer.ptr(), len); for (int i = 0; i < framesRead; i++) ((short *)data)[i] = ((short *)buffer.ptr())[(info.channels * i) + mAliasChannel]; } else { // Otherwise, let libsndfile handle the conversion and // scaling, and pass us normalized data as floats. We can // then convert to whatever format we want. framesRead = SFCall<sf_count_t>(sf_readf_float, sf.get(), (float *)buffer.ptr(), len); float *bufferPtr = &((float *)buffer.ptr())[mAliasChannel]; CopySamples((samplePtr)bufferPtr, floatSample, (samplePtr)data, format, framesRead, true, info.channels); } UnlockRead(); return framesRead; }
langCodes.Add("en"); langNames.Add("English"); langCodes.Add("es"); langNames.Add("Español"); langCodes.Add("fr"); langNames.Add("Français"); langCodes.Add("it"); langNames.Add("Italiano"); langCodes.Add("hu"); langNames.Add("Magyar"); langCodes.Add("nl"); langNames.Add("Nederlands"); langCodes.Add("pl"); langNames.Add("Polski"); langCodes.Add("ru"); langNames.Add("Russky"); langCodes.Add("sl"); langNames.Add("Slovenscina"); } #if 0 // This code doesn't work yet wxArrayString audacityPathList = wxGetApp().audacityPathList; wxArrayString results; langCodes.Add("en"); langNames.Add("English"); wxGetApp().AddUniquePathToPathList(wxString::Format("%s/share/locale", INSTALL_PREFIX), audacityPathList); wxGetApp().FindFilesInPathList("*/audacity.mo", audacityPathList, wxFILE, results); wxGetApp().FindFilesInPathList("*/LC_MESSAGES/audacity.mo", audacityPathList,
wxInt32 CViewTransfers::GetDocCount() { return wxGetApp().GetDocument()->GetTransferCount(); }
OpenDCCCtrlDlg::OpenDCCCtrlDlg( wxWindow* parent, iONode props, const char* devices ) { m_TabAlign = wxGetApp().getTabAlign(); Init(); Create(parent, -1, _T("OpenDCC")); m_Timer = new wxTimer( this, ME_SOTimer ); m_Progress = NULL; m_bCleanUpProgress = false; m_bStartUpProgress = false; m_bLenz = false; m_OpenDCCmode = 0; m_Props = props; m_Devices = devices; MemOp.set( m_soValue, 0, sizeof(m_soValue) ); m_TimerMutex = MutexOp.inst( NULL, True ); if( wDigInt.getopendcc(m_Props) == NULL ) { iONode opendccini = NodeOp.inst( wOpenDCC.name(), m_Props, ELEMENT_NODE ); NodeOp.addChild( m_Props, opendccini ); } initLabels(); initValues(); m_Notebook->SetAutoLayout(true); m_DecExceptionBox->Layout(); m_GeneralPanel->GetSizer()->Layout(); m_DecoderPanel->GetSizer()->Layout(); m_S88Panel->GetSizer()->Layout(); m_ProgrammingTab->GetSizer()->Layout(); m_SCDPanel->GetSizer()->Layout(); m_SwitchPanel->GetSizer()->Layout(); m_GeneralPanel->Fit(); m_DecoderPanel->Fit(); m_S88Panel->Fit(); m_ProgrammingTab->Fit(); m_SCDPanel->Fit(); m_SwitchPanel->Fit(); m_Notebook->Layout(); m_Notebook->Fit(); //m_Notebook->FitInside(); GetSizer()->Layout(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); this->Layout(); this->Fit(); m_DecoderPanel->Enable(false); m_S88Panel->Enable(false); m_ProgrammingTab->Enable(false); m_SCDPanel->Enable(false); m_SwitchPanel->Enable(false); }
void OpenDCCCtrlDlg::initLabels() { m_Notebook->SetPageText( 0, wxGetApp().getMsg( "general" ) ); m_Notebook->SetPageText( 1, wxGetApp().getMsg( "decoders" ) ); m_Notebook->SetPageText( 2, wxGetApp().getMsg( "s88" ) ); m_Notebook->SetPageText( 3, wxGetApp().getMsg( "pt" ) ); m_Notebook->SetPageText( 4, wxGetApp().getMsg( "shortcutchecking" ) ); m_Notebook->SetPageText( 5, wxGetApp().getMsg( "switches" ) ); // General m_labVersion->SetLabel( wxGetApp().getMsg( "version" ) ); m_labDevice->SetLabel( wxGetApp().getMsg( "device" ) ); m_Version->SetToolTip( wxGetApp().getTip( "version" ) ); m_Version->SetEditable(false); m_Baudrate->SetLabel( wxGetApp().getMsg( "bps" ) ); m_Baudrate->SetToolTip( wxGetApp().getTip( "bps" ) ); m_Mode->SetEditable(false); m_labSerialNumber->SetLabel( wxGetApp().getMsg( "odsernum" ) ); m_SerialNumber->SetToolTip( wxGetApp().getTip( "odsernum" ) ); m_PowerAtStartup->SetLabel( wxGetApp().getMsg( "poweronstartup" ) ); // Decoders m_DecExceptionBox->SetLabel( wxGetApp().getMsg( "exceptions" ) ); m_DecExceptions->InsertColumn(0, wxGetApp().getMsg( "address" ) ); m_DecExceptions->InsertColumn(1, wxGetApp().getMsg( "dccformat" ) ); m_DecSpeedSteps->SetLabel( wxGetApp().getMsg( "speedsteps" ) ); m_DecSpeedSteps->SetToolTip( wxGetApp().getTip( "speedsteps" ) ); // S88 m_labS88Timing->SetLabel( wxGetApp().getMsg( "timing" ) ); m_S88Timing->SetToolTip( wxGetApp().getTip( "timing" ) ); m_S88BusBox->SetLabel( wxGetApp().getMsg( "chains" ) ); m_labS88Bus1->SetLabel( wxGetApp().getMsg( "chain" ) + _T(" 1") ); m_S88Bus1->SetToolTip( wxGetApp().getTip( "chain" ) + _T(" 1") ); m_labS88Bus2->SetLabel( wxGetApp().getMsg( "chain" ) + _T(" 2") ); m_S88Bus2->SetToolTip( wxGetApp().getTip( "chain" ) + _T(" 2") ); m_labS88Bus3->SetLabel( wxGetApp().getMsg( "chain" ) + _T(" 3") ); m_S88Bus3->SetToolTip( wxGetApp().getTip( "chain" ) + _T(" 3") ); m_S88SettingsBox->SetLabel( wxGetApp().getMsg( "mode" ) ); m_S88Active->SetLabel( wxGetApp().getMsg( "activate" ) ); m_S88Active->SetToolTip( wxGetApp().getTip( "activate" ) ); m_S88TurnoutSensors->SetLabel( wxGetApp().getMsg( "swsensors" ) ); m_S88TurnoutSensors->SetToolTip( wxGetApp().getTip( "swsensors" ) ); m_SwitchSensorMode->SetLabel( wxGetApp().getMsg( "swsensormode" ) ); m_SwitchSensorMode->SetToolTip( wxGetApp().getTip( "swsensormode" ) ); m_labSwitchSensorOffset->SetLabel( wxGetApp().getMsg( "swsensoroffset" ) ); m_SwitchSensorOffset->SetToolTip( wxGetApp().getTip( "swsensoroffset" ) ); m_XpnFeedbackMapping->SetLabel( wxGetApp().getMsg( "xpnfbmapping" ) ); m_XpnFeedbackMapping->SetToolTip( wxGetApp().getTip( "xpnfbmapping" ) ); // PT m_labPTResets->SetLabel( wxGetApp().getMsg( "ptreset" ) ); m_PTResets->SetToolTip( wxGetApp().getTip( "ptreset" ) ); m_labPTCommands->SetLabel( wxGetApp().getMsg( "ptcommands" ) ); m_PTCommands->SetToolTip( wxGetApp().getTip( "ptcommands" ) ); m_labPTPOMrepeat->SetLabel( wxGetApp().getMsg( "ptpom" ) ); m_PTPOMrepeat->SetToolTip( wxGetApp().getTip( "ptpom" ) ); // SCD m_LabSCtimeMain->SetLabel( wxGetApp().getMsg( "scdmain" ) ); m_SCTimeMain->SetToolTip( wxGetApp().getTip( "scdmain" ) ); m_labSCTimePT->SetLabel( wxGetApp().getMsg( "scdpt" ) ); m_SCTimePT->SetToolTip( wxGetApp().getTip( "scdpt" ) ); // Switches m_SwitchInvert->SetLabel( wxGetApp().getMsg( "swinvert" ) ); m_SwitchInvert->SetToolTip( wxGetApp().getTip( "swinvert" ) ); m_labSwitchCommands->SetLabel( wxGetApp().getMsg( "swcommands" ) ); m_SwitchCommands->SetToolTip( wxGetApp().getTip( "swcommands" ) ); m_labSwitchTime->SetLabel( wxGetApp().getMsg( "switchtime" ) ); m_SwitchTime->SetToolTip( wxGetApp().getTip( "switchtime" ) ); }
void CBOINCBaseFrame::ShowConnectionFailedAlert() { CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); CMainDocument* pDoc = wxGetApp().GetDocument(); wxString strConnectedCompter = wxEmptyString; wxString strDialogTitle = wxEmptyString; wxString strDialogMessage = wxEmptyString; wxASSERT(pSkinAdvanced); wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowConnectionFailedAlert - Function Begin")); // Did BOINC crash on local computer? If so restart it and reconnect. pDoc->GetConnectedComputerName(strConnectedCompter); if (pDoc->IsComputerNameLocal(strConnectedCompter)) { if (pDoc->m_pClientManager->AutoRestart()) { boinc_sleep(0.5); // Allow time for Client to restart if (pDoc->m_pClientManager->IsBOINCCoreRunning()) { pDoc->Reconnect(); return; } } else { // Don't ask whether to reconnect to local client if it is not running if (!pDoc->m_pClientManager->IsBOINCCoreRunning()) { return; } } } // %s is the application name // i.e. 'BOINC Manager', 'GridRepublic Manager' strDialogTitle.Printf( _("%s - Connection Failed"), pSkinAdvanced->GetApplicationName().c_str() ); // 1st %s is the application name // i.e. 'BOINC Manager', 'GridRepublic Manager' // 2st %s is the project name // i.e. 'BOINC', 'GridRepublic' strDialogMessage.Printf( _("%s is not able to connect to a %s client.\nWould you like to try to connect again?"), pSkinAdvanced->GetApplicationName().c_str(), pSkinAdvanced->GetApplicationShortName().c_str() ); ShowAlert( strDialogTitle, strDialogMessage, wxYES_NO | wxICON_QUESTION, false, AlertProcessResponse ); // If we are minimized, set flag to show alert when maximized m_bShowConnectionFailedAlert = !IsShown(); wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowConnectionFailedAlert - Function End")); }
void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) { wxLogTrace(wxT("Function Start/End"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Function Begin")); int i, j, count, newIcon; TaskSelectionData *selData; RESULT* result; RESULT* ctrlResult; PROJECT* project; std::vector<bool>is_alive; bool needRefresh = false; wxString resname; CMainDocument* pDoc = wxGetApp().GetDocument(); CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); static bool bAlreadyRunning = false; wxASSERT(pDoc); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); if (bAlreadyRunning) { return; } bAlreadyRunning = true; count = m_TaskSelectionCtrl->GetCount(); // Mark all inactive (this lets us loop only once) for (i=0; i<count; ++i) { is_alive.push_back(false); } // First update existing entries and add new ones for(i = 0; i < (int) pDoc->results.results.size(); i++) { bool found = false; result = pDoc->result(i); // only check tasks that are active if ( result == NULL || !result->active_task ) { continue; } resname = wxEmptyString; #if SELECTBYRESULTNAME resname = wxString::FromUTF8(result->name); #else // SELECTBYRESULTNAME GetApplicationAndProjectNames(result, &resname, NULL); #endif // SELECTBYRESULTNAME // loop through the items already in Task Selection Control to find this result count = m_TaskSelectionCtrl->GetCount(); for(j = 0; j < count; ++j) { selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j); if (!strcmp(result->name, selData->result_name) && !strcmp(result->project_url, selData->project_url) ) { selData->result = result; found = true; is_alive.at(j) = true; break; // skip out of this loop } } // if it isn't currently in the list then we have a new one! lets add it if (!found) { int alphaOrder; for(j = 0; j < count; ++j) { alphaOrder = (m_TaskSelectionCtrl->GetString(j)).CmpNoCase(resname); #if SORTTASKLIST if (alphaOrder > 0) { break; // Insert the new item here (sorted by item label) } #endif // wxComboBox and wxBitmapComboBox have bugs on Windows when multiple // entries have identical text, so add enough spaces to make each // entry's text unique. if (alphaOrder == 0) { resname.Append((const wxChar *)wxT(" ")); #if !SORTTASKLIST j = -1; // If not sorted, check new name from start for duplicate #endif } } selData = new TaskSelectionData; selData->result = result; strncpy(selData->result_name, result->name, sizeof(selData->result_name)); strncpy(selData->project_url, result->project_url, sizeof(selData->project_url)); selData->dotColor = -1; FindSlideShowFiles(selData); project = pDoc->state.lookup_project(result->project_url); if (project) { selData->project_files_downloaded_time = project->project_files_downloaded_time; } else { selData->project_files_downloaded_time = 0.0; } #if SORTTASKLIST if (j < count) { std::vector<bool>::iterator iter = is_alive.begin(); m_TaskSelectionCtrl->Insert(resname, wxNullBitmap, j, (void*)selData); is_alive.insert(iter+j, true); if (j <= m_CurrentTaskSelection) { ++m_CurrentTaskSelection; m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection); } } else #endif { m_TaskSelectionCtrl->Append(resname, wxNullBitmap, (void*)selData); is_alive.push_back(true); } ++count; } // End if (!found) } // End for (i) loop // Check items in descending order so deletion won't change indexes of items yet to be checked for(j = count-1; j >=0; --j) { if(!is_alive.at(j)) { wxLogTrace(wxT("Function Status"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Task '%d' no longer alive"), j); selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j); wxLogTrace(wxT("Function Status"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - selData '%p' "), selData); wxLogTrace(wxT("Function Status"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - result_name '%s' "), selData->result_name); selData->slideShowFileNames.Clear(); wxLogTrace(wxT("Function Status"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Deleting selData")); delete selData; wxLogTrace(wxT("Function Status"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Deleting control data")); // Indicate to Delete() we have cleaned up the Selection Data m_TaskSelectionCtrl->SetClientData(j, NULL); m_TaskSelectionCtrl->Delete(j); if (j == m_CurrentTaskSelection) { int newCount = m_TaskSelectionCtrl->GetCount(); if (m_CurrentTaskSelection < newCount) { // Select the next item if one exists m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection); } else if (newCount > 0) { // Select the previous item if one exists m_CurrentTaskSelection = newCount-1; m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection); } else { m_CurrentTaskSelection = -1; m_TaskSelectionCtrl->SetSelection(wxNOT_FOUND); } m_bStableTaskInfoChanged = true; needRefresh = true; } else if (j < m_CurrentTaskSelection) { --m_CurrentTaskSelection; m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection); } } } if ((m_CurrentTaskSelection >= 0) && !m_bStableTaskInfoChanged) { selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(m_CurrentTaskSelection); project = pDoc->state.lookup_project(selData->project_url); if ( project && (project->project_files_downloaded_time > selData->project_files_downloaded_time) ) { FindSlideShowFiles(selData); selData->project_files_downloaded_time = project->project_files_downloaded_time; } } count = m_TaskSelectionCtrl->GetCount(); for(j = 0; j < count; ++j) { selData = (TaskSelectionData*)m_TaskSelectionCtrl->GetClientData(j); ctrlResult = selData->result; if (isRunning(ctrlResult)) { newIcon = runningIcon; } else if (ctrlResult->scheduler_state == CPU_SCHED_PREEMPTED) { newIcon = waitingIcon; } else { newIcon = suspendedIcon; } if (reskin || (newIcon != selData->dotColor)) { switch (newIcon) { case runningIcon: m_TaskSelectionCtrl->SetItemBitmap(j, *pSkinSimple->GetWorkunitRunningImage()->GetBitmap()); break; case waitingIcon: m_TaskSelectionCtrl->SetItemBitmap(j, *pSkinSimple->GetWorkunitWaitingImage()->GetBitmap()); break; case suspendedIcon: m_TaskSelectionCtrl->SetItemBitmap(j, *pSkinSimple->GetWorkunitSuspendedImage()->GetBitmap()); break; } selData->dotColor = newIcon; needRefresh = true; } } if (needRefresh) { m_TaskSelectionCtrl->Refresh(); } bAlreadyRunning = false; wxLogTrace(wxT("Function Start/End"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Function End")); }
int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallback> callback, mem_ptr_t<void> userData, u32 extParam) { cellSysutil.Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=%d, extParam=%d)", errorCode, callback.GetAddr(), userData, extParam); std::string errorMessage; switch(errorCode) { // Generic errors case 0x80010001: errorMessage = "The resource is temporarily unavailable."; break; case 0x80010002: errorMessage = "Invalid argument or flag."; break; case 0x80010003: errorMessage = "The feature is not yet implemented."; break; case 0x80010004: errorMessage = "Memory allocation failed."; break; case 0x80010005: errorMessage = "The resource with the specified identifier does not exist."; break; case 0x80010006: errorMessage = "The file does not exist."; break; case 0x80010007: errorMessage = "The file is in unrecognized format / The file is not a valid ELF file."; break; case 0x80010008: errorMessage = "Resource deadlock is avoided."; break; case 0x80010009: errorMessage = "Operation not permitted."; break; case 0x8001000A: errorMessage = "The device or resource is bus."; break; case 0x8001000B: errorMessage = "The operation is timed ou."; break; case 0x8001000C: errorMessage = "The operation is aborte."; break; case 0x8001000D: errorMessage = "Invalid memory access."; break; case 0x8001000F: errorMessage = "State of the target thread is invalid."; break; case 0x80010010: errorMessage = "Alignment is invalid."; break; case 0x80010011: errorMessage = "Shortage of the kernel resources."; break; case 0x80010012: errorMessage = "The file is a directory."; break; case 0x80010013: errorMessage = "Operation canceled."; break; case 0x80010014: errorMessage = "Entry already exists."; break; case 0x80010015: errorMessage = "Port is already connected."; break; case 0x80010016: errorMessage = "Port is not connected."; break; case 0x80010017: errorMessage = "Failure in authorizing SELF. Program authentication fail."; break; case 0x80010018: errorMessage = "The file is not MSELF."; break; case 0x80010019: errorMessage = "System version error."; break; case 0x8001001A: errorMessage = "Fatal system error occurred while authorizing SELF. SELF auth failure."; break; case 0x8001001B: errorMessage = "Math domain violation."; break; case 0x8001001C: errorMessage = "Math range violation."; break; case 0x8001001D: errorMessage = "Illegal multi-byte sequence in input."; break; case 0x8001001E: errorMessage = "File position error."; break; case 0x8001001F: errorMessage = "Syscall was interrupted."; break; case 0x80010020: errorMessage = "File too large."; break; case 0x80010021: errorMessage = "Too many links."; break; case 0x80010022: errorMessage = "File table overflow."; break; case 0x80010023: errorMessage = "No space left on device."; break; case 0x80010024: errorMessage = "Not a TTY."; break; case 0x80010025: errorMessage = "Broken pipe."; break; case 0x80010026: errorMessage = "Read-only filesystem."; break; case 0x80010027: errorMessage = "Illegal seek."; break; case 0x80010028: errorMessage = "Arg list too long."; break; case 0x80010029: errorMessage = "Access violation."; break; case 0x8001002A: errorMessage = "Invalid file descriptor."; break; case 0x8001002B: errorMessage = "Filesystem mounting failed."; break; case 0x8001002C: errorMessage = "Too many files open."; break; case 0x8001002D: errorMessage = "No device."; break; case 0x8001002E: errorMessage = "Not a directory."; break; case 0x8001002F: errorMessage = "No such device or IO."; break; case 0x80010030: errorMessage = "Cross-device link error."; break; case 0x80010031: errorMessage = "Bad Message."; break; case 0x80010032: errorMessage = "In progress."; break; case 0x80010033: errorMessage = "Message size error."; break; case 0x80010034: errorMessage = "Name too long."; break; case 0x80010035: errorMessage = "No lock."; break; case 0x80010036: errorMessage = "Not empty."; break; case 0x80010037: errorMessage = "Not supported."; break; case 0x80010038: errorMessage = "File-system specific error."; break; case 0x80010039: errorMessage = "Overflow occured."; break; case 0x8001003A: errorMessage = "Filesystem not mounted."; break; case 0x8001003B: errorMessage = "Not SData."; break; case 0x8001003C: errorMessage = "Incorrect version in sys_load_param."; break; case 0x8001003D: errorMessage = "Pointer is null."; break; case 0x8001003E: errorMessage = "Pointer is null."; break; default: errorMessage = "An error has occurred."; break; } char errorCodeHex [9]; sprintf(errorCodeHex, "%08x", errorCode); errorMessage.append("\n("); errorMessage.append(errorCodeHex); errorMessage.append(")\n"); u64 status; int res = wxMessageBox(errorMessage, wxGetApp().GetAppName(), wxICON_ERROR | wxOK); switch(res) { case wxOK: status = CELL_MSGDIALOG_BUTTON_OK; break; default: if(res) { status = CELL_MSGDIALOG_BUTTON_INVALID; break; } status = CELL_MSGDIALOG_BUTTON_NONE; break; } if(callback) callback(status, userData); return CELL_OK; }
void *MusikTagApplyThread::Entry() { //----------------------------------------// //--- events we'll post as we go along ---// //----------------------------------------// wxCommandEvent TagStartEvt ( wxEVT_COMMAND_MENU_SELECTED, MUSIK_TAG_THREAD_START ); wxCommandEvent TagProgEvt ( wxEVT_COMMAND_MENU_SELECTED, MUSIK_TAG_THREAD_PROG ); wxPostEvent( m_pPostDest, TagStartEvt ); float fPos = 0; int nLastProg = 0; int nCurrProg = 0; bool bRenameOK; wxGetApp().Library.BeginTransaction(); for( size_t i = 0; i < m_Songs.GetCount(); i++ ) { //-----------------------// //--- update progress ---// //-----------------------// fPos = (float)( i * 100 ) / (float)m_Songs.GetCount(); nCurrProg = (int)fPos; if ( nCurrProg > nLastProg ) { TagProgEvt.SetExtraLong( nCurrProg ); wxPostEvent( m_pPostDest, TagProgEvt ); } nLastProg = nCurrProg; if ( TestDestroy() ) break; else { MusikSongId & songid = m_Songs.Item( i ); if ( songid.Check1 == 1 ) { CMusikSong &song = songid.SongCopy(); //-----------------------// //--- rename the file ---// //-----------------------// bRenameOK = true; if ( wxGetApp().Prefs.bTagDlgRename == 1 ) { bRenameOK = wxGetApp().Library.RenameFile( song); if(false == bRenameOK) ::wxLogWarning(_("Renaming of file %s failed."),(const wxChar *)song.MetaData.Filename.GetFullPath()); songid.Check1 = 0; } //--------------------------// //--- write tags to file ---// //--------------------------// if ( wxGetApp().Prefs.bTagDlgWrite) { //-----------------------------------------// //--- rename will update the lib, so if ---// //--- we're not renaming, update db too ---// //-----------------------------------------// wxGetApp().Library.WriteTag( songid,wxGetApp().Prefs.bTagDlgClear); } else { //-----------------------------// //--- write tag for db only ,flag as dirty ---// //-----------------------------// wxGetApp().Library.UpdateItem( songid, true ); } } } } wxGetApp().Library.EndTransaction(); return NULL; }
wxInt32 CViewWork::GetDocCount() { return wxGetApp().GetDocument()->GetWorkCount(); }
InterpreterDisAsmFrame::InterpreterDisAsmFrame(wxWindow* parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(500, 700), wxTAB_TRAVERSAL) , PC(0) , CPU(nullptr) , m_item_count(30) , decoder(nullptr) , disasm(nullptr) { wxBoxSizer* s_p_main = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_b_main = new wxBoxSizer(wxHORIZONTAL); m_list = new wxListView(this); m_choice_units = new wxChoice(this, wxID_ANY); wxButton* b_go_to_addr = new wxButton(this, wxID_ANY, "Go To Address"); wxButton* b_go_to_pc = new wxButton(this, wxID_ANY, "Go To PC"); m_btn_step = new wxButton(this, wxID_ANY, "Step"); m_btn_run = new wxButton(this, wxID_ANY, "Run"); m_btn_pause = new wxButton(this, wxID_ANY, "Pause"); s_b_main->Add(b_go_to_addr, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(b_go_to_pc, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_btn_step, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_btn_run, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_btn_pause, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_choice_units, wxSizerFlags().Border(wxALL, 5)); //Registers m_regs = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_DONTWRAP|wxNO_BORDER|wxTE_RICH2); m_regs->SetEditable(false); //Call Stack m_calls = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_DONTWRAP|wxNO_BORDER|wxTE_RICH2); m_calls->SetEditable(false); m_list ->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); m_regs ->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); m_calls->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); wxBoxSizer* s_w_list = new wxBoxSizer(wxHORIZONTAL); s_w_list->Add(m_list, 2, wxEXPAND | wxLEFT | wxDOWN, 5); s_w_list->Add(m_regs, 1, wxEXPAND | wxRIGHT | wxDOWN, 5); s_w_list->Add(m_calls,1, wxEXPAND | wxRIGHT | wxDOWN, 5); s_p_main->Add(s_b_main, 0, wxEXPAND | wxLEFT | wxRIGHT, 5); s_p_main->Add(s_w_list, 1, wxEXPAND | wxDOWN, 5); SetSizer(s_p_main); Layout(); m_list->InsertColumn(0, "ASM"); for(uint i=0; i<m_item_count; ++i) { m_list->InsertItem(m_list->GetItemCount(), wxEmptyString); } m_regs ->Bind(wxEVT_TEXT, &InterpreterDisAsmFrame::OnUpdate, this); b_go_to_addr ->Bind(wxEVT_BUTTON, &InterpreterDisAsmFrame::Show_Val, this); b_go_to_pc ->Bind(wxEVT_BUTTON, &InterpreterDisAsmFrame::Show_PC, this); m_btn_step ->Bind(wxEVT_BUTTON, &InterpreterDisAsmFrame::DoStep, this); m_btn_run ->Bind(wxEVT_BUTTON, &InterpreterDisAsmFrame::DoRun, this); m_btn_pause ->Bind(wxEVT_BUTTON, &InterpreterDisAsmFrame::DoPause, this); m_list ->Bind(wxEVT_LIST_KEY_DOWN, &InterpreterDisAsmFrame::InstrKey, this); m_list ->Bind(wxEVT_LIST_ITEM_ACTIVATED, &InterpreterDisAsmFrame::DClick, this); m_list ->Bind(wxEVT_MOUSEWHEEL, &InterpreterDisAsmFrame::MouseWheel, this); m_choice_units->Bind(wxEVT_CHOICE, &InterpreterDisAsmFrame::OnSelectUnit, this); Bind(wxEVT_SIZE, &InterpreterDisAsmFrame::OnResize, this); Bind(wxEVT_KEY_DOWN, &InterpreterDisAsmFrame::OnKeyDown, this); wxGetApp().Bind(wxEVT_DBG_COMMAND, &InterpreterDisAsmFrame::HandleCommand, this); ShowAddr(CentrePc(PC)); UpdateUnitList(); }
bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; double x = 0.0; time_t tDocumentTime = (time_t)0; CWork* work; strDocumentText.Empty(); if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return false; } if (iColumnIndex < 0) return false; switch (m_iColumnIndexToColumnID[iColumnIndex]) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(work->m_strProjectName) || !strDocumentText2.IsSameAs(work->m_strProjectURL)) { work->m_strProjectName = strDocumentText; work->m_strProjectURL = strDocumentText2; return true; } break; case COLUMN_APPLICATION: GetDocApplicationName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strApplicationName)) { work->m_strApplicationName = strDocumentText; return true; } break; case COLUMN_NAME: GetDocName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strName)) { work->m_strName = strDocumentText; return true; } break; case COLUMN_CPUTIME: GetDocCPUTime(m_iSortedIndexes[iRowIndex], x); if (x != work->m_fCPUTime) { work->m_fCPUTime = x; work->m_strCPUTime = FormatTime(x); return true; } break; case COLUMN_PROGRESS: GetDocProgress(m_iSortedIndexes[iRowIndex], x); if (x != work->m_fProgress) { work->m_fProgress = x; FormatProgress(x, work->m_strProgress); return true; } break; case COLUMN_TOCOMPLETION: GetDocTimeToCompletion(m_iSortedIndexes[iRowIndex], x); if (x != work->m_fTimeToCompletion) { work->m_fTimeToCompletion = x; work->m_strTimeToCompletion = FormatTime(x); return true; } break; case COLUMN_REPORTDEADLINE: GetDocReportDeadline(m_iSortedIndexes[iRowIndex], tDocumentTime); if (tDocumentTime != work->m_tReportDeadline) { work->m_tReportDeadline = tDocumentTime; FormatReportDeadline(tDocumentTime, work->m_strReportDeadline); return true; } break; case COLUMN_STATUS: int i = m_iSortedIndexes[iRowIndex]; RESULT* result = wxGetApp().GetDocument()->result(i); strDocumentText = result_description(result); if (!strDocumentText.IsSameAs(work->m_strStatus)) { work->m_strStatus = strDocumentText; return true; } break; } return false; }
// Create a background bitmap simulating partial transparency void CSimplePanelBase::MakeBGBitMap() { wxRect r; wxBitmap rawBmp; wxBitmap whiteBmp; wxImage bgImage; wxImage whiteImage; register unsigned char *bgImagePixels; register unsigned char *whitePixels; register int i, j, k; CSimpleGUIPanel* backgroundPanel = (CSimpleGUIPanel*)GetParent(); wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT); wxBrush bgBrush(*wxWHITE); CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); int white_weight = pSkinSimple->GetPanelOpacity(); int image_weight = MAX_OPACITY - white_weight; // Workaround for CSimpleGUIPanel not reliably getting // Paint or EraseBackground events under Linux #if (!(defined(__WXMSW_) || defined(__WXMAC__))) backgroundPanel->SetBackgroundBitmap(); #endif GetPosition(&r.x, &r.y); GetSize(&r.width, &r.height); wxBitmap *bgBmp(backgroundPanel->GetBackgroundBitMap()); wxRect bgRect(0, 0, bgBmp->GetWidth(), bgBmp->GetHeight()); if (bgRect.Contains(r)) { rawBmp = bgBmp->GetSubBitmap(r); } else { fprintf(stderr, "SimpleGUI background image is too small\n"); rawBmp = wxBitmap(r.width, r.height); wxMemoryDC dc(rawBmp); wxPen rawPen(*wxBLACK, 1, wxTRANSPARENT); wxBrush rawBrush(*wxBLACK); dc.SetBackgroundMode(wxSOLID); dc.SetPen(rawPen); dc.SetBrush(rawBrush); dc.DrawRectangle(0, 0, r.width, r.height); } whiteBmp = wxBitmap(r.width, r.height); wxMemoryDC dc(whiteBmp); dc.SetBackgroundMode(wxSOLID); dc.SetPen(bgPen); dc.SetBrush(bgBrush); dc.DrawRoundedRectangle(0, 0, r.width, r.height, RECTANGLERADIUS); bgImage = rawBmp.ConvertToImage(); bgImagePixels = bgImage.GetData(); // RGBRGBRGB... whiteImage = whiteBmp.ConvertToImage(); whitePixels = whiteImage.GetData(); // RGBRGBRGB... for (i=0; i<r.width; ++i) { for (j=0; j<r.height; ++j) { if (*whitePixels) { k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight)); *bgImagePixels++ = k / MAX_OPACITY; k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight)); *bgImagePixels++ = k / MAX_OPACITY; k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight)); *bgImagePixels++ = k / MAX_OPACITY; } else { bgImagePixels += 3; whitePixels += 3; } } } m_TaskPanelBGBitMap = wxBitmap(bgImage); m_GotBGBitMap = true; }
void MainEmuFrame::DoGiveHelp(const wxString& text, bool show) { _parent::DoGiveHelp(text, show); wxGetApp().GetProgramLog()->DoGiveHelp(text, show); }
void DCC232Dlg::onHelp( wxCommandEvent& event ) { wxGetApp().openLink( "dcc232" ); }
void CSelectMode::OnLeftUp( wxMouseEvent& event ) { if(wxGetApp().drag_gripper) { double to[3], from[3]; wxGetApp().m_digitizing->digitize(wxPoint(event.GetX(), event.GetY())); extract(wxGetApp().m_digitizing->digitized_point.m_point, to); wxGetApp().grip_to = wxGetApp().m_digitizing->digitized_point.m_point; extract(wxGetApp().grip_from, from); wxGetApp().drag_gripper->OnGripperReleased(from, to); wxGetApp().m_digitizing->SetOnlyCoords(wxGetApp().drag_gripper, false); wxGetApp().drag_gripper = NULL; } else if(window_box_exists) { if(!event.ControlDown())wxGetApp().m_marked_list->Clear(true); std::list<HeeksObj*> obj_list; GetObjectsInWindow(event, obj_list); wxGetApp().m_marked_list->Add(obj_list, true); wxGetApp().m_current_viewport->DrawWindow(window_box, true); // undraw the window window_box_exists = false; } else { // select one object m_last_click_point = CClickPoint(); MarkedObjectOneOfEach marked_object; wxGetApp().FindMarkedObject(wxPoint(event.GetX(), event.GetY()), &marked_object); if(marked_object.m_map.size()>0){ HeeksObj* previously_marked = NULL; if(wxGetApp().m_marked_list->size() == 1) { previously_marked = *(wxGetApp().m_marked_list->list().begin()); } HeeksObj* o = marked_object.GetFirstOfTopOnly(); unsigned long depth = marked_object.GetDepth(); HeeksObj* object = o; while(o) { if(o == previously_marked) { object = o; break; } o = marked_object.Increment(); if(o) { // prefer highest order objects if(o->GetType() < object->GetType())object = o; } } if(!event.ShiftDown() && !event.ControlDown()) { wxGetApp().m_marked_list->Clear(true); } if (wxGetApp().m_marked_list->ObjectMarked(object)) { if (!event.ShiftDown()) { wxGetApp().m_marked_list->Remove(object, true); } } else { wxGetApp().m_marked_list->Add(object, true); m_last_click_point = CClickPoint(wxPoint(event.GetX(), event.GetY()), depth); gp_Lin ray = wxGetApp().m_current_viewport->m_view_point.SightLine(wxPoint(event.GetX(), event.GetY())); double ray_start[3], ray_direction[3]; extract(ray.Location(), ray_start); extract(ray.Direction(), ray_direction); marked_object.GetFirstOfTopOnly(); object->SetClickMarkPoint(marked_object.GetCurrent(), ray_start, ray_direction); } } else { if(!event.ShiftDown() && !event.ControlDown()) { wxGetApp().m_marked_list->Clear(true); } } } if(m_just_one && m_doing_a_main_loop && (wxGetApp().m_marked_list->size() > 0)) { ExitMainLoop(); } else { wxGetApp().m_current_viewport->m_need_refresh = true; } }
void DCC232Dlg::initLabels() { m_labIID->SetLabel( wxGetApp().getMsg( "iid" ) ); m_PortBox->GetStaticBox()->SetLabel( wxGetApp().getMsg( "device" ) ); m_labDevice->SetLabel( wxGetApp().getMsg( "port" ) ); m_SlotBox->GetStaticBox()->SetLabel( wxGetApp().getMsg( "slotmanagement" ) ); m_AutoPurge->SetLabel( wxGetApp().getMsg( "purgeslots" ) ); m_labPurgeTime->SetLabel( wxGetApp().getMsg( "purgetime" ) ); m_ShortCutBox->GetStaticBox()->SetLabel( wxGetApp().getMsg( "shortcutchecking" ) ); m_ShortcutDetection->SetLabel( wxGetApp().getMsg( "activate" ) ); m_InverseDSR->SetLabel( wxGetApp().getMsg( "inversedsr" ) ); m_labShortcutDelay->SetLabel( wxGetApp().getMsg( "delay" ) ); m_labShortcutDelayMs->SetLabel( wxGetApp().getMsg( "ms" ) ); m_FastCvGet->SetLabel( wxGetApp().getMsg( "fastcvget" ) ); }
void CSelectMode::OnFrontRender(){ if(wxGetApp().drag_gripper){ wxGetApp().drag_gripper->OnFrontRender(); } if(window_box_exists)wxGetApp().m_current_viewport->DrawWindow(window_box, true); }
void CBOINCBaseFrame::OnAlert(CFrameAlertEvent& event) { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnAlert - Function Begin")); static bool bAlreadyRunningLoop = false; if (!bAlreadyRunningLoop) { bAlreadyRunningLoop = true; #ifdef __WXMSW__ CTaskBarIcon* pTaskbar = wxGetApp().GetTaskBarIcon(); wxASSERT(pTaskbar); if ((IsShown() && !event.m_notification_only) || (IsShown() && !pTaskbar->IsBalloonsSupported())) { if (!event.m_notification_only) { int retval = 0; if (!IsShown()) { Show(); } retval = wxGetApp().SafeMessageBox(event.m_message, event.m_title, event.m_style, this); if (event.m_alert_event_type == AlertProcessResponse) { event.ProcessResponse(retval); } } } else { // If the main window is hidden or minimzed use the system tray ballon // to notify the user instead. This keeps dialogs from interfering // with people typing email messages or any other activity where they // do not want keyboard focus changed to another window while typing. unsigned int icon_type; if (wxICON_ERROR & event.m_style) { icon_type = NIIF_ERROR; } else if (wxICON_WARNING & event.m_style) { icon_type = NIIF_WARNING; } else if (wxICON_INFORMATION & event.m_style) { icon_type = NIIF_INFO; } else { icon_type = NIIF_NONE; } pTaskbar->SetBalloon( pTaskbar->m_iconTaskBarNormal, event.m_title, event.m_message, icon_type ); } #elif defined (__WXMAC__) // SafeMessageBox() / ProcessResponse() hangs the Manager if hidden. // Currently, the only non-notification-only alert is Connection Failed, // which is now has logic to be displayed when Manager is maximized. // Notification only events on platforms other than Windows are // currently discarded. Otherwise the application would be restored // and input focus set on the notification which interrupts whatever // the user was doing. if (IsShown() && !event.m_notification_only) { int retval = 0; retval = wxGetApp().SafeMessageBox(event.m_message, event.m_title, event.m_style, this); if (event.m_alert_event_type == AlertProcessResponse) { event.ProcessResponse(retval); } } #endif bAlreadyRunningLoop = false; } wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnAlert - Function End")); }
void Run(){ wxGetApp().m_marked_list->m_filter = MARKING_FILTER_FACE; wxGetApp().m_frame->RefreshInputCanvas(); }
void RigThread::run() { int retcode, status; termStatus = 0; std::cout << "Rig thread starting." << std::endl; rig = rig_init(rigModel); strncpy(rig->state.rigport.pathname, rigFile.c_str(), FILPATHLEN - 1); rig->state.rigport.parm.serial.rate = serialRate; retcode = rig_open(rig); if (retcode != 0) { std::cout << "Rig failed to init. " << std::endl; IOThread::terminate(); return; } char *info_buf = (char *)rig_get_info(rig); if (info_buf) { std::cout << "Rig info: " << info_buf << std::endl; } else { std::cout << "Rig info was NULL." << std::endl; } while (!stopping) { std::this_thread::sleep_for(std::chrono::milliseconds(150)); auto activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator(); auto lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator(); if (freqChanged.load() && (controlMode.load() || setOneShot.load())) { status = rig_get_freq(rig, RIG_VFO_CURR, &freq); if (status == 0 && !stopping) { if (freq != newFreq && setOneShot.load()) { freq = newFreq; rig_set_freq(rig, RIG_VFO_CURR, freq); // std::cout << "Set Rig Freq: %f" << newFreq << std::endl; } freqChanged.store(false); setOneShot.store(false); } else { termStatus = 0; break; } } else { freq_t checkFreq; status = rig_get_freq(rig, RIG_VFO_CURR, &checkFreq); if (status == 0 && !stopping) { if (checkFreq != freq && followMode.load()) { freq = checkFreq; if (followModem.load()) { if (lastDemod) { lastDemod->setFrequency(freq); lastDemod->updateLabel(freq); lastDemod->setFollow(true); } } else { wxGetApp().setFrequency((long long)checkFreq); } } else if (wxGetApp().getFrequency() != freq && controlMode.load() && !centerLock.load() && !followModem.load()) { freq = wxGetApp().getFrequency(); rig_set_freq(rig, RIG_VFO_CURR, freq); } else if (followModem.load()) { if (lastDemod) { if (lastDemod->getFrequency() != freq) { lastDemod->setFrequency(freq); lastDemod->updateLabel(freq); lastDemod->setFollow(true); } } } } else { termStatus = 0; break; } } if (!centerLock.load() && followModem.load() && wxGetApp().getFrequency() != freq && (lastDemod && lastDemod != activeDemod)) { wxGetApp().setFrequency((long long)freq); } // std::cout << "Rig Freq: " << freq << std::endl; } rig_close(rig); rig_cleanup(rig); std::cout << "Rig thread exiting status " << termStatus << "." << std::endl; };