当前位置: 首页>>代码示例>>C++>>正文


C++ wxGetApp函数代码示例

本文整理汇总了C++中wxGetApp函数的典型用法代码示例。如果您正苦于以下问题:C++ wxGetApp函数的具体用法?C++ wxGetApp怎么用?C++ wxGetApp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxGetApp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: filter_dlg_shared_state

	filter_dlg_shared_state() {
		app = &(wxGetApp());
	}
开发者ID:JGRennison,项目名称:retcon,代码行数:3,代码来源:filter-dlg.cpp

示例2: 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);
//.........这里部分代码省略.........
开发者ID:CassieMarie,项目名称:heekscad,代码行数:101,代码来源:SelectMode.cpp

示例3: Run

	void Run(){
		wxGetApp().m_marked_list->m_filter = -1;
		wxGetApp().m_frame->RefreshInputCanvas();
	}
开发者ID:CassieMarie,项目名称:heekscad,代码行数:4,代码来源:SelectMode.cpp

示例4: wxFrame

// ------------------------------------------------------------------------
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"));

//.........这里部分代码省略.........
开发者ID:jimmyleith,项目名称:pcsx2,代码行数:101,代码来源:MainFrame.cpp

示例5: wxPoint

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();
			}
		}
	}
}
开发者ID:CassieMarie,项目名称:heekscad,代码行数:66,代码来源:SelectMode.cpp

示例6: WXUNUSED

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"));
}
开发者ID:DanAurea,项目名称:boinc,代码行数:67,代码来源:ViewWork.cpp

示例7: wxGetApp

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)) {
//.........这里部分代码省略.........
开发者ID:DanAurea,项目名称:boinc,代码行数:101,代码来源:ViewWork.cpp

示例8: GetRect

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
//.........这里部分代码省略.........
开发者ID:WilliamStilte,项目名称:boinc,代码行数:101,代码来源:sg_TaskPanel.cpp

示例9: wxGetApp

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;
//.........这里部分代码省略.........
开发者ID:WilliamStilte,项目名称:boinc,代码行数:101,代码来源:sg_TaskPanel.cpp

示例10: LockRead

/// 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;
}
开发者ID:Avi2011class,项目名称:audacity,代码行数:83,代码来源:ODPCMAliasBlockFile.cpp

示例11: wxGetApp

   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,
开发者ID:ruthmagnus,项目名称:audacity,代码行数:31,代码来源:Languages.cpp

示例12: wxGetApp

wxInt32 CViewTransfers::GetDocCount() {
    return wxGetApp().GetDocument()->GetTransferCount();
}
开发者ID:Murph9000,项目名称:boinc-v2,代码行数:3,代码来源:ViewTransfers.cpp

示例13: wxGetApp

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);

}
开发者ID:pmansvelder,项目名称:Rocrail,代码行数:61,代码来源:opendcc.cpp

示例14: wxGetApp

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"));
}
开发者ID:hanxue,项目名称:Boinc,代码行数:62,代码来源:BOINCBaseFrame.cpp

示例15: wxLogTrace

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);
//.........这里部分代码省略.........
开发者ID:WilliamStilte,项目名称:boinc,代码行数:101,代码来源:sg_TaskPanel.cpp


注:本文中的wxGetApp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。