kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #01143
Re: Re: redraw on erase track segment
-
To:
kicad-devel@xxxxxxxxxxxxxxx
-
From:
Dick Hollenbeck <dick@...>
-
Date:
Wed, 05 Mar 2008 15:16:27 -0600
-
In-reply-to:
<47CEFE50.4070806@...>
-
User-agent:
Thunderbird 2.0.0.12 (X11/20080227)
Jean-Pierre,
I have the track's bounding box now. How do I scale it to a dirty
rectangle?
Here is what I have now:
// redraw the area where the track was
EDA_Rect dirty = Track->GetBoundingBox();
/* saw this going in the opposite direction from what I think I need:
curpos.x = ScreenPos.x * GetZoom();
curpos.y = ScreenPos.y * GetZoom();
curpos.x += m_DrawOrg.x;
curpos.y += m_DrawOrg.y;
*/
// here is the reverse:
int zoom = GetZoom();
wxPoint drwOrig = GetScreen()->m_DrawOrg;
dirty.m_Pos.x = (dirty.m_Pos.x - drwOrig.x) / zoom;
dirty.m_Pos.y = (dirty.m_Pos.y - drwOrig.y) / zoom;
dirty.m_Size.x = (dirty.m_Size.x - drwOrig.x) / zoom;
dirty.m_Size.y = (dirty.m_Size.y - drwOrig.y) / zoom;
// pass wxRect() via EDA_Rect::operator wxRect() overload
// convert from EDA_Rect to wxRect, no problem here
wxRect dirtyR = dirty;
DrawPanel->Refresh( TRUE, &dirtyR );
Does this look right?
I also believe ReDraw() must be called only once.
Yes, I'm having a look at this too. I put a debug counter in there to
learn some interesting things.
Dick
Follow ups
References