Beispiel #1
0
void wxWindowDFB::Update()
{
    if ( !IsShown() || IsFrozen() )
        return;

    GetParent()->Update();
}
Beispiel #2
0
void FrameMain::SetDisplayMode(int video, int audio) {
	if (!IsShownOnScreen()) return;

	bool sv = false, sa = false;

	if (video == -1) sv = showVideo;
	else if (video)  sv = context->videoController->IsLoaded() && !context->dialog->Get<DialogDetachedVideo>();

	if (audio == -1) sa = showAudio;
	else if (audio)  sa = context->audioController->IsAudioOpen();

	// See if anything changed
	if (sv == showVideo && sa == showAudio) return;

	showVideo = sv;
	showAudio = sa;

	bool didFreeze = !IsFrozen();
	if (didFreeze) Freeze();

	context->videoController->Stop();

	TopSizer->Show(videoBox, showVideo, true);
	ToolsSizer->Show(audioBox, showAudio, true);

	MainSizer->CalcMin();
	MainSizer->RecalcSizes();
	MainSizer->Layout();
	Layout();

	if (didFreeze) Thaw();
}
Beispiel #3
0
void b2Body::Freeze()
{
	/*
	check !IsFrozenByUser() - to prevent duplicate call DestroyProxy
	check !IsFrozen() - to prevent freeze bodies frozen automatically 
	on reaches the boundary of the world AABB.
	*/
	if (!IsFrozenByUser() && !IsFrozen()) 
	{
		/*
		e_frozenByUserFlag required to prevent unfreeze body, 
		frozen automatically on reaches the boundary of the world AABB.
		*/
		m_flags |= e_frozenByUserFlag;
		m_flags |= e_frozenFlag;
		for (b2Fixture* f = GetFixtureList(); f; f = f->m_next)
		{
			f->DestroyProxy(m_world->m_broadPhase);
		}

		for (b2JointEdge* j = m_jointList; j; j = j->next)
		{
			j->other->Freeze();
		}
	}
}
Beispiel #4
0
void wxWindowDFB::RefreshWindowRect(const wxRect& rect)
{
    if ( !IsShown() || IsFrozen() )
        return;

    DoRefreshRect(rect);
}
Beispiel #5
0
void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
{
    if ( IsFrozen() )
    {
        // Don't paint anything if the window is frozen.
        m_refreshAfterThaw = true;
        return;
    }

#if wxDEBUG_LEVEL >= 2
    // FIXME_MGL -- debugging stuff, to be removed!
    static int debugPaintEvents = -1;
    if ( debugPaintEvents == -1 )
        debugPaintEvents = wxGetEnv(wxT("WXMGL_DEBUG_PAINT_EVENTS"), NULL);
    if ( debugPaintEvents )
    {
        dc->setColorRGB(255,0,255);
        dc->fillRect(-1000,-1000,2000,2000);
        wxMilliSleep(50);
    }
#endif // wxDEBUG_LEVEL >= 2

    MGLRegion clip;
    dc->getClipRegion(clip);
    m_updateRegion = wxRegion(clip);
    m_paintMGLDC = dc;

#if wxUSE_CARET
    // must hide caret temporarily, otherwise we'd get rendering artifacts
    wxCaret *caret = GetCaret();
    if ( caret )
        caret->Hide();
#endif // wxUSE_CARET

    if ( m_eraseBackground != 0 )
    {
        wxWindowDC dc((wxWindow*)this);
        wxEraseEvent eventEr(m_windowId, &dc);
        eventEr.SetEventObject(this);
        HandleWindowEvent(eventEr);
    }
    m_eraseBackground = -1;

    wxNcPaintEvent eventNc(GetId());
    eventNc.SetEventObject(this);
    HandleWindowEvent(eventNc);

    wxPaintEvent eventPt(GetId());
    eventPt.SetEventObject(this);
    HandleWindowEvent(eventPt);

#if wxUSE_CARET
    if ( caret )
        caret->Show();
#endif // wxUSE_CARET

    m_paintMGLDC = NULL;
    m_updateRegion.Clear();
}
Beispiel #6
0
void wxMenuBar::Refresh()
{
    if ( IsFrozen() )
        return;

    wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );

    DrawMenuBar(GetHwndOf(GetFrame()));
}
Beispiel #7
0
void wxChoice::DoClear()
{
    SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);

    if ( !IsFrozen() )
        MSWUpdateDropDownHeight();

    InvalidateBestSize();
}
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
        wxDataViewItemAttr& aAttr ) const
{
    if( IsFrozen() )
        return false;

    // change attributes only for the name field
    if( aCol != 0 )
        return false;

    auto node = ToNode( aItem );
    wxCHECK( node, false );

    switch( node->Type )
    {
        case CMP_TREE_NODE::LIB:
            // mark modified libs with bold font
            aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) );

#ifdef __WXGTK__
            // The native wxGTK+ impl ignores background colour, so set the text colour instead.
            // This works reasonably well in dark themes, and quite poorly in light ones....
            if( node->Name == m_libMgr->GetCurrentLib() )
                aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
            // mark the current library with background color
            if( node->Name == m_libMgr->GetCurrentLib() )
                aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
            break;

        case CMP_TREE_NODE::LIBID:
            // mark modified part with bold font
            aAttr.SetBold( m_libMgr->IsPartModified( node->Name, node->Parent->Name ) );

            // mark aliases with italic font
            aAttr.SetItalic( !node->IsRoot );

#ifdef __WXGTK__
            // The native wxGTK+ impl ignores background colour, so set the text colour instead.
            // This works reasonably well in dark themes, and quite poorly in light ones....
            if( node->LibId == m_libMgr->GetCurrentLibId() )
                aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
            // mark the current part with background color
            if( node->LibId == m_libMgr->GetCurrentLibId() )
                aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
            break;

        default:
            return false;
    }

    return true;
}
Beispiel #9
0
void wxChoice::Clear()
{
    Free();

    SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);

    if ( !IsFrozen() )
        UpdateVisibleHeight();

    InvalidateBestSize();
}
Beispiel #10
0
void wxChoice::DoDeleteOneItem(unsigned int n)
{
    wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );

    SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);

    if ( !IsFrozen() )
        MSWUpdateDropDownHeight();

    InvalidateBestSize();
}
Beispiel #11
0
bool b2Body::SetXForm(const b2Vec2& position, float32 angle)
{
	b2Assert(m_world->m_lock == false);
	if (m_world->m_lock == true)
	{
		return true;
	}

	if (IsFrozen())
	{
		return false;
	}

	m_xf.R.Set(angle);
	m_xf.position = position;

	m_sweep.c0 = m_sweep.c = b2Mul(m_xf, m_sweep.localCenter);
	m_sweep.a0 = m_sweep.a = angle;

	bool freeze = false;
	for (b2Shape* s = m_shapeList; s; s = s->m_next)
	{
		bool inRange = s->Synchronize(m_world->m_broadPhase, m_xf, m_xf);

		if (inRange == false)
		{
			freeze = true;
			break;
		}
	}

	if (freeze == true)
	{
		m_flags |= e_frozenFlag;
		m_linearVelocity.SetZero();
		m_angularVelocity = 0.0f;
		for (b2Shape* s = m_shapeList; s; s = s->m_next)
		{
			s->DestroyProxy(m_world->m_broadPhase);
		}

		// Failure
		return false;
	}

	// Success
	m_world->m_broadPhase->Commit();
	return true;
}
Beispiel #12
0
void ProcList::OnSelected(wxListEvent& event)
{
	if (IsFrozen() || updating)
		return; // the list is being populated or updated
	updating = true;

	assert(GetWindowStyle() & wxLC_REPORT);

	const Database::Symbol *symbol = database->getAddrInfo(GetItemData(event.m_itemIndex))->symbol;
	if (isroot)
		theMainWin->inspectSymbol(symbol);
	else
		theMainWin->focusSymbol(symbol);

	updating = false;
}
Beispiel #13
0
void wxChoice::Delete(unsigned int n)
{
    wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );

    if ( HasClientObjectData() )
    {
        delete GetClientObject(n);
    }

    SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);

    if ( !IsFrozen() )
        UpdateVisibleHeight();

    InvalidateBestSize();
}
Beispiel #14
0
void rvVehicleSpline::Think( void ) {
	float moveAmount = 0.0f;

	if ( positions[0].IsOccupied ( ) && !IsFrozen () && IsMovementEnabled ( ) )	{	

		if ( accelWithStrafe != 0.0f ) {
			moveAmount = positions[0].mInputCmd.rightmove * accelWithStrafe;
		} else {
			moveAmount = positions[0].mInputCmd.forwardmove;
		}
		
		moveAmount = Sign( moveAmount );
	}

	physicsObj.SetSpeed( idealSpeed * moveAmount );

	rvVehicle::Think( );
}
Beispiel #15
0
int wxChoice::DoAppend(const wxString& item)
{
    int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LPARAM)item.c_str());
    if ( n == CB_ERR )
    {
        wxLogLastError(wxT("SendMessage(CB_ADDSTRING)"));
    }
    else // ok
    {
        // we need to refresh our size in order to have enough space for the
        // newly added items
        if ( !IsFrozen() )
            UpdateVisibleHeight();
    }

    InvalidateBestSize();
    return n;
}
Beispiel #16
0
void wxMenuBar::Refresh()
{
    if ( IsFrozen() )
        return;

    wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );

#if defined(WINCE_WITHOUT_COMMANDBAR)
    if (GetToolBar())
    {
        CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
    }
#elif defined(WINCE_WITH_COMMANDBAR)
    if (m_commandBar)
        DrawMenuBar((HWND) m_commandBar);
#else
    DrawMenuBar(GetHwndOf(GetFrame()));
#endif
}
Beispiel #17
0
int wxChoice::DoInsert(const wxString& item, unsigned int pos)
{
    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));

    int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str());
    if ( n == CB_ERR )
    {
        wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)"));
    }
    else // ok
    {
        if ( !IsFrozen() )
            UpdateVisibleHeight();
    }

    InvalidateBestSize();
    return n;
}
Beispiel #18
0
void wxWindowDFB::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
{
    if ( !IsShown() || IsFrozen() )
        return;

    // NB[1]: We intentionally ignore the eraseBack argument here. This is
    //        because of the way wxDFB's painting is implemented: the refresh
    //        request is propagated up to wxTLW, which is then painted in
    //        top-down order. This means that this window's area is first
    //        painted by its parent and this window is then painted over it, so
    //        it's not safe to not paint this window's background even if
    //        eraseBack=false.
    // NB[2]: wxWindow::Refresh() takes the rectangle in client coords, but
    //        wxUniv translates it to window coords before passing it to
    //        wxWindowDFB::Refresh(), so we can directly pass the rect to
    //        DoRefreshRect (which takes window, not client, coords) here.
    if ( rect )
        DoRefreshRect(*rect);
    else
        DoRefreshWindow();
}
Beispiel #19
0
int wxChoice::DoInsertItems(const wxArrayStringsAdapter& items,
                            unsigned int pos,
                            void **clientData, wxClientDataType type)
{
    MSWAllocStorage(items, CB_INITSTORAGE);

    const bool append = pos == GetCount();

    // use CB_ADDSTRING when appending at the end to make sure the control is
    // resorted if it has wxCB_SORT style
    const unsigned msg = append ? CB_ADDSTRING : CB_INSERTSTRING;

    if ( append )
        pos = 0;

    int n = wxNOT_FOUND;
    const unsigned numItems = items.GetCount();
    for ( unsigned i = 0; i < numItems; ++i )
    {
        n = MSWInsertOrAppendItem(pos, items[i], msg);
        if ( n == wxNOT_FOUND )
            return n;

        if ( !append )
            pos++;

        AssignNewItemClientData(n, clientData, i, type);
    }

    // we need to refresh our size in order to have enough space for the
    // newly added items
    if ( !IsFrozen() )
        MSWUpdateDropDownHeight();

    InvalidateBestSize();

    return n;
}
/*
================
rvVehicleAnimated::Think
================
*/
void rvVehicleAnimated::Think ( void ) {

	rvVehicle::Think();	

	float rate = 0.0f;
	usercmd_t& cmd = positions[0].mInputCmd;
	idVec3 delta;

	if( positions[0].IsOccupied() && !IsFrozen() && IsMovementEnabled() )	{
		
		if (( g_vehicleMode.GetInteger() == 0 && !( cmd.buttons & BUTTON_STRAFE )) || 	// If we're in the old driving mode and we aren't strafing or...
			( g_vehicleMode.GetInteger() != 0 && ( cmd.buttons & BUTTON_STRAFE )))		// If we're in the new driving mode and we are strafing
		{
			rate = SignZero(cmd.forwardmove) * turnRate;
			rate *= idMath::MidPointLerp( 0.0f, 0.9f, 1.0f, idMath::Fabs(cmd.rightmove) / 127.0f );
			viewAngles.yaw += Sign(cmd.rightmove) * rate * MS2SEC(gameLocal.GetMSec());	
		}
	}

	viewAngles.Normalize360();
	animator.GetDelta( gameLocal.time - gameLocal.GetMSec(), gameLocal.time, delta );
	delta += additionalDelta;

	idStr alignmentJoint;
	if ( g_vehicleMode.GetInteger() != 0 && spawnArgs.GetString( "alignment_joint", 0, alignmentJoint ) ) {
		idVec3 offset;
		idMat3 axis;
		GetJointWorldTransform( animator.GetJointHandle( alignmentJoint ), gameLocal.time, offset, axis );
		delta *= axis;
	} else {
		viewAxis = viewAngles.ToMat3() * physicsObj.GetGravityAxis();
		delta *= viewAxis;
	}
			
	physicsObj.SetDelta( delta );
	additionalDelta.Zero();
}
void LIB_MANAGER_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
                                    unsigned int aCol ) const
{
    if( IsFrozen() )
    {
        aVariant = wxEmptyString;
        return;
    }

    auto node = ToNode( aItem );
    wxASSERT( node );

    switch( aCol )
    {
    case 0:
        aVariant = node->Name;

        // mark modified libs with an asterix
        if( node->Type == CMP_TREE_NODE::LIB && m_libMgr->IsLibraryModified( node->Name ) )
            aVariant = node->Name + " *";

        // mark modified parts with an asterix
        if( node->Type == CMP_TREE_NODE::LIBID
                && m_libMgr->IsPartModified( node->Name, node->Parent->Name ) )
            aVariant = node->Name + " *";

        break;

    case 1:
        aVariant = node->Desc;
        break;

    default:    // column == -1 is used for default Compare function
        aVariant = node->Name;
        break;
    }
}
Beispiel #22
0
void wxWindowMGL::Update()
{
    if ( !IsFrozen() )
        MGL_wmUpdateDC(g_winMng);
}
Beispiel #23
0
void wxNonOwnedWindow::HandleQueuedPaintRequests()
{
    if ( m_toPaint->IsEmpty() )
        return; // nothing to do

    if ( IsFrozen() || !IsShown() )
    {
        // nothing to do if the window is frozen or hidden; clear the queue
        // and return (note that it's OK to clear the queue even if the window
        // is frozen, because Thaw() calls Refresh()):
        m_toPaint->Clear();
        return;
    }

    // process queued paint requests:
    wxRect winRect(wxPoint(0, 0), GetSize());
    wxRect paintedRect;

    // important note: all DCs created from now until m_isPainting is reset to
    // false will not update the front buffer as this flag indicates that we'll
    // blit the entire back buffer to front soon
    m_isPainting = true;

    int requestsCount = 0;

    wxRect request;
    while ( m_toPaint->GetNext(request) )
    {
        requestsCount++;
        wxRect clipped(request);
        clipped.Intersect(winRect);
        if ( clipped.IsEmpty() )
            continue; // nothing to refresh

        wxLogTrace(TRACE_PAINT,
                   "%p ('%s'): processing paint request [%i,%i,%i,%i]",
                   this, GetName().c_str(),
                   clipped.x, clipped.y, clipped.GetRight(), clipped.GetBottom());

        PaintWindow(clipped);

        // remember rectangle covering all repainted areas:
        if ( paintedRect.IsEmpty() )
            paintedRect = clipped;
        else
            paintedRect.Union(clipped);
    }

    m_isPainting = false;

    m_toPaint->Clear();

    if ( paintedRect.IsEmpty() )
        return; // no painting occurred, no need to flip

    // Flip the surface to make the changes visible. Note that the rectangle we
    // flip is *superset* of the union of repainted rectangles (created as
    // "rectangles union" by wxRect::Union) and so some parts of the back
    // buffer that we didn't touch in this HandleQueuedPaintRequests call will
    // be copied to the front buffer as well. This is safe/correct thing to do
    // *only* because wx always use wxIDirectFBSurface::FlipToFront() and so
    // the back and front buffers contain the same data.
    //
    // Note that we do _not_ split m_toPaint into disjoint rectangles and
    // do FlipToFront() for each of them, because that could result in visible
    // updating of the screen; instead, we prefer to flip everything at once.

    DFBRegion r = {paintedRect.GetLeft(), paintedRect.GetTop(),
                   paintedRect.GetRight(), paintedRect.GetBottom()};
    DFBRegion *rptr = (winRect == paintedRect) ? NULL : &r;

    GetDfbSurface()->FlipToFront(rptr);

    wxLogTrace(TRACE_PAINT,
               "%p ('%s'): processed %i paint requests, flipped surface: [%i,%i,%i,%i]",
               this, GetName().c_str(),
               requestsCount,
               paintedRect.x, paintedRect.y,
               paintedRect.GetRight(), paintedRect.GetBottom());
}
Beispiel #24
0
NS_IMETHODIMP
morkObject::IsFrozenMdbObject(nsIMdbEnv* mev, mdb_bool* outIsReadonly)
{
  *outIsReadonly = IsFrozen();
  return NS_OK;
}
Beispiel #25
0
void wxSTEditorTreeCtrl::UpdateFromNotebook()
{
    if (IsFrozen()) return;

    wxSTERecursionGuard guard(m_rGuard_UpdateFromNotebook);
    if (guard.IsInside()) return;

    if (m_notePageId) SetItemBold(m_notePageId, false);
    m_notePageId = wxTreeItemId(); // reset to unknown

    wxSTEditorNotebook *noteBook = GetSTEditorNotebook();
    if (!noteBook)
        return;

    int n;
    int page_count = noteBook->GetPageCount();
    int note_sel   = noteBook->GetSelection();

    wxTreeItemId id, selId;

    // Check for and add a hidden root item to the treectrl
    wxTreeItemId rootId = GetRootItem();
    if (!rootId)
        rootId = AddRoot(wxT("Root"), -1, -1, NULL);

    // Check for and add a "Opened files" item to the treectrl
    wxArrayString openedfilesPath; openedfilesPath.Add(_("Opened files"));
    wxTreeItemId openedId = FindOrInsertItem(openedfilesPath, STE_TREECTRL_FIND_OR_INSERT);

    wxLongToLongHashMap windowToSTETreeItemDataMap = m_windowToSTETreeItemDataMap;

    Freeze();

    for (n = 0; n < page_count; n++)
    {
        id = wxTreeItemId(); // start fresh

        wxSTEditor* editor = noteBook->GetEditor(n);
        wxWindow* notePage = noteBook->GetPage(n);
        wxSTETreeItemData* steTreeItemData = NULL;

        // If this editor was already added to the tree, check if it's still correct
        if (editor && editor->GetTreeItemData())
        {
            // get and check the old tree item id, the filename/path could have changed
            steTreeItemData = editor->GetTreeItemData();

            if (steTreeItemData)
                id = steTreeItemData->m_id;

            if (steTreeItemData)
            {
                if ((steTreeItemData->m_notePage == notePage) &&
                    (steTreeItemData->m_fileName == editor->GetFileName()))
                {
                    // the page didn't change name, but do resync page number
                    steTreeItemData->m_page_num = n;
                    windowToSTETreeItemDataMap.erase((long)notePage);
                }
                else
                    steTreeItemData = NULL;
            }

            // Something changed, redo it
            if (id && !steTreeItemData)
            {
                // Erase refs to this page, we will recreate it
                m_windowToSTETreeItemDataMap.erase((long)notePage);
                windowToSTETreeItemDataMap.erase((long)notePage);
                DeleteItem(id, true, -1, openedId);

                // null it and add it correctly later
                id = wxTreeItemId();
                editor->SetTreeItemData(NULL);
            }
        }

        bool modified = editor->IsModified();

        if (!id)
        {
            // Create new data to add to the wxTreeItem
            steTreeItemData = new wxSTETreeItemData(n, notePage);

            // Only connect the destroy handler once
            if (m_windowDestroyMap.find((long)notePage) == m_windowDestroyMap.end())
            {
                m_windowDestroyMap[(long)notePage] = 1;

                notePage->Connect(wxID_ANY, wxEVT_DESTROY,
                                  wxWindowDestroyEventHandler(wxSTEditorTreeCtrl::OnWindowDestroy),
                                  NULL, this);
            }

            if (editor)
            {
                modified = editor->IsModified();
                steTreeItemData->m_root = _("Opened files");
                steTreeItemData->m_fileName = editor->GetFileName();
                wxFileName fn(steTreeItemData->m_fileName);

                // Don't need to Normalize() since it is done in wxSTEditor::SetFilename()
                //if (fn.FileExists()) fn.Normalize();

                switch (m_display_type)
                {
                    case SHOW_FILENAME_ONLY :
                    {
                        steTreeItemData->m_treePath.Add(steTreeItemData->m_root);
                        steTreeItemData->m_treePath.Add(fn.GetFullName());
                        break;
                    }
                    case SHOW_FILEPATH_ONLY :
                    {
                        steTreeItemData->m_treePath.Add(steTreeItemData->m_root);
                        steTreeItemData->m_treePath.Add(fn.GetFullPath());
                        break;
                    }
                    case SHOW_PATH_THEN_FILENAME :
                    {
                        steTreeItemData->m_treePath.Add(steTreeItemData->m_root);
                        steTreeItemData->m_treePath.Add(fn.GetPath());
                        steTreeItemData->m_treePath.Add(fn.GetFullName());
                        break;
                    }
                    case SHOW_ALL_PATHS :
                    {
                        steTreeItemData->m_treePath.Add(steTreeItemData->m_root);

                        wxArrayString dirs = fn.GetDirs();
                        for (size_t i = 0; i < dirs.GetCount(); ++i)
                            steTreeItemData->m_treePath.Add(dirs[i]);

                        steTreeItemData->m_treePath.Add(fn.GetFullName());
                        break;
                    }
                }
            }
            else
            {
                steTreeItemData->m_root = _("Others");
                steTreeItemData->m_fileName = noteBook->GetPageText(n);

                steTreeItemData->m_treePath.Add(steTreeItemData->m_root);
                steTreeItemData->m_treePath.Add(steTreeItemData->m_fileName.GetFullPath());
            }

            // Always insert a new editor since if we already did, it'd have a treeitem id.
            // For other windows, who knows, you can only have one tree node per notebook page name
            if (editor)
            {
                id = FindOrInsertItem(steTreeItemData->m_treePath, STE_TREECTRL_INSERT);
                SetItemImage(id, STE_TREECTRL_IMAGE_EDITOR);
                editor->SetTreeItemData(steTreeItemData);
                steTreeItemData->m_steRefData = editor->GetSTERefData();
            }
            else
            {
                id = FindOrInsertItem(steTreeItemData->m_treePath, STE_TREECTRL_FIND_OR_INSERT);
                SetItemImage(id, STE_TREECTRL_IMAGE_OTHER);
            }

            // must set new data before deleting old in MSW since it checks old before setting new
            wxTreeItemData* oldData = GetItemData(id);
            steTreeItemData->m_id = id;
            SetItemData(id, steTreeItemData);
            if (oldData) delete oldData;

            m_windowToSTETreeItemDataMap[(long)notePage] = (long)steTreeItemData;
        }

        // we should have valid id at this point
        if (n == note_sel)
            selId = id;

        SetItemTextColour(id, modified ? *wxRED : *wxBLACK);
    }

    wxLongToLongHashMap::iterator it;
    for( it = windowToSTETreeItemDataMap.begin(); it != windowToSTETreeItemDataMap.end(); ++it )
    {
        wxSTETreeItemData* oldData = (wxSTETreeItemData*)it->second;
        DeleteItem(oldData->m_id, true, -1, openedId);
        m_windowToSTETreeItemDataMap.erase(it->first);
    }

    if (selId)
    {
        m_notePageId = selId;
        SetItemBold(selId, true);
        SelectItem(selId);
    }

    SortAllChildren(GetRootItem());
    Thaw();
}
Beispiel #26
0
void wxWindowDFB::PaintWindow(const wxRect& rect)
{
    wxCHECK_RET( !IsFrozen() && IsShown(), "shouldn't be called" );

    wxLogTrace(TRACE_PAINT,
               "%p ('%s'): painting region [%i,%i,%i,%i]",
               this, GetName().c_str(),
               rect.x, rect.y, rect.GetRight(), rect.GetBottom());

    m_updateRegion = rect;

    // FIXME_DFB: don't waste time rendering the area if it's fully covered
    //            by some children, go directly to rendering the children
    //            (unless some child has HasTransparentBackground()=true!)

    // NB: unconditionally send wxEraseEvent, because our implementation of
    //     wxWindow::Refresh() ignores the eraseBack argument
    wxWindowDC dc((wxWindow*)this);
    wxEraseEvent eventEr(m_windowId, &dc);
    eventEr.SetEventObject(this);
    HandleWindowEvent(eventEr);

    wxRect clientRect(GetClientRect());

    // only send wxNcPaintEvent if drawing at least part of nonclient area:
    if ( !clientRect.Contains(rect) )
    {
        wxNcPaintEvent eventNc(GetId());
        eventNc.SetEventObject(this);
        HandleWindowEvent(eventNc);
    }
    else
    {
        wxLogTrace(TRACE_PAINT, "%p ('%s'): not sending wxNcPaintEvent",
                   this, GetName().c_str());
    }

    // only send wxPaintEvent if drawing at least part of client area:
    if ( rect.Intersects(clientRect) )
    {
        wxPaintEvent eventPt(GetId());
        eventPt.SetEventObject(this);
        HandleWindowEvent(eventPt);
    }
    else
    {
        wxLogTrace(TRACE_PAINT, "%p ('%s'): not sending wxPaintEvent",
                   this, GetName().c_str());
    }

    // draw window's overlays on top of the painted window, if we have any:
    PaintOverlays(rect);

    m_updateRegion.Clear();

    // client area portion of 'rect':
    wxRect rectClientOnly(rect);
    rectClientOnly.Intersect(clientRect);

    // paint the children:
    wxPoint origin = GetClientAreaOrigin();
    wxWindowList& children = GetChildren();
    for ( wxWindowList::iterator i = children.begin();
          i != children.end(); ++i )
    {
        wxWindow *child = *i;

        if ( child->IsFrozen() || !child->IsShown() )
            continue; // don't paint anything if the window is frozen or hidden

        // compute child's area to repaint
        wxRect childrect(child->GetRect());
        childrect.Offset(origin);

        if ( child->CanBeOutsideClientArea() )
            childrect.Intersect(rect);
        else
            childrect.Intersect(rectClientOnly);

        if ( childrect.IsEmpty() )
            continue;

        // and repaint it:
        childrect.Offset(-child->GetPosition());
        childrect.Offset(-origin);
        child->PaintWindow(childrect);
    }
}
Beispiel #27
0
void LogView::OnIdle(wxIdleEvent& event)
{
    if (IsFrozen())
        Thaw();
}