draw only in OnPaint
This commit is contained in:
parent
4cf118ea0b
commit
ec4cbb79ed
|
@ -5,6 +5,13 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2008-Mar-31 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
+all
|
||||
Tweaked class MsgPanel so that the screen drawing only happens from
|
||||
its OnPaint() function.
|
||||
|
||||
|
||||
2008-Mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
+eeschema
|
||||
|
@ -16,7 +23,6 @@ email address.
|
|||
Added comments in gestfich.cpp to explain the default paths used by kicad to find help files and lib files
|
||||
|
||||
|
||||
|
||||
2008-Mar-30 UPDATE Jonas Diemer <diemer-at-gmx.de>
|
||||
================================================================================
|
||||
+eeschema
|
||||
|
|
|
@ -29,12 +29,12 @@ WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id,
|
|||
{
|
||||
m_Parent = parent;
|
||||
SetFont( *g_MsgFont );
|
||||
m_last_x = 0;
|
||||
}
|
||||
|
||||
|
||||
WinEDA_MsgPanel::~WinEDA_MsgPanel()
|
||||
{
|
||||
m_Items.clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
|
|||
{
|
||||
wxPaintDC dc( this );
|
||||
|
||||
//EraseMsgBox( &dc );
|
||||
erase( &dc );
|
||||
|
||||
dc.SetBackground( *wxBLACK_BRUSH );
|
||||
dc.SetBackgroundMode( wxSOLID );
|
||||
|
@ -77,36 +77,33 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
|||
* color = couleur d'affichage
|
||||
*/
|
||||
{
|
||||
static int old_pos_X;
|
||||
wxPoint pos;
|
||||
wxSize FontSizeInPixels, DrawSize;
|
||||
wxSize drawSize = GetClientSize();
|
||||
|
||||
|
||||
// Get size of the font
|
||||
wxSize fontSizeInPixels;
|
||||
{
|
||||
wxClientDC dc( this );
|
||||
|
||||
DrawSize = GetClientSize();
|
||||
|
||||
dc.SetBackground( *wxBLACK_BRUSH );
|
||||
dc.SetBackgroundMode( wxSOLID );
|
||||
|
||||
dc.SetTextBackground( GetBackgroundColour() );
|
||||
|
||||
dc.SetFont( *g_MsgFont );
|
||||
dc.GetTextExtent( wxT( "W" ), &FontSizeInPixels.x, &FontSizeInPixels.y );
|
||||
dc.GetTextExtent( wxT( "W" ), &fontSizeInPixels.x, &fontSizeInPixels.y );
|
||||
|
||||
} // destroy wxClientDC ASAP
|
||||
|
||||
if( pos_X >= 0 )
|
||||
{
|
||||
old_pos_X = pos.x = pos_X * (FontSizeInPixels.x + 2);
|
||||
m_last_x = pos.x = pos_X * (fontSizeInPixels.x + 2);
|
||||
}
|
||||
else
|
||||
pos.x = old_pos_X;
|
||||
pos.x = m_last_x;
|
||||
|
||||
MsgItem item;
|
||||
|
||||
item.m_X = pos.x;
|
||||
|
||||
item.m_UpperY = (DrawSize.y / 2) - FontSizeInPixels.y;
|
||||
item.m_LowerY = DrawSize.y - FontSizeInPixels.y;
|
||||
item.m_UpperY = (drawSize.y / 2) - fontSizeInPixels.y;
|
||||
item.m_LowerY = drawSize.y - fontSizeInPixels.y;
|
||||
|
||||
item.m_UpperText = texte_H;
|
||||
item.m_LowerText = texte_L;
|
||||
|
@ -137,7 +134,7 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
|||
m_Items.push_back( item );
|
||||
}
|
||||
|
||||
showItem( dc, item );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,29 +165,25 @@ void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem )
|
|||
/****************************************/
|
||||
void WinEDA_MsgPanel::EraseMsgBox()
|
||||
/****************************************/
|
||||
|
||||
/* Effacement de la fenetre d'affichage des messages de bas d'ecran
|
||||
*/
|
||||
{
|
||||
wxClientDC dc( this );
|
||||
|
||||
EraseMsgBox( &dc );
|
||||
m_Items.clear();
|
||||
m_last_x = 0;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
void WinEDA_MsgPanel::EraseMsgBox( wxDC* DC )
|
||||
void WinEDA_MsgPanel::erase( wxDC* DC )
|
||||
/*******************************************/
|
||||
{
|
||||
wxSize size;
|
||||
wxColor color;
|
||||
wxPen pen;
|
||||
wxBrush brush;
|
||||
|
||||
size = GetClientSize();
|
||||
color = GetBackgroundColour();
|
||||
wxSize size = GetClientSize();
|
||||
wxColor color = GetBackgroundColour();
|
||||
|
||||
pen.SetColour( color );
|
||||
|
||||
brush.SetColour( color );
|
||||
brush.SetStyle( wxSOLID );
|
||||
|
||||
|
@ -198,9 +191,8 @@ void WinEDA_MsgPanel::EraseMsgBox( wxDC* DC )
|
|||
DC->SetBrush( brush );
|
||||
|
||||
DC->DrawRectangle( 0, 0, size.x, size.y );
|
||||
|
||||
DC->SetBrush( wxNullBrush );
|
||||
DC->SetPen( wxNullPen );
|
||||
|
||||
m_Items.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,8 @@ public:
|
|||
|
||||
class WinEDA_DrawFrame : public WinEDA_BasicFrame
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
WinEDA_DrawPanel* DrawPanel; // Draw area
|
||||
WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques
|
||||
|
@ -541,9 +543,13 @@ class WinEDA_MsgPanel : public wxPanel
|
|||
{
|
||||
protected:
|
||||
std::vector<MsgItem> m_Items;
|
||||
int m_last_x; ///< the last used x coordinate
|
||||
|
||||
|
||||
void showItem( wxDC& dc, const MsgItem& aItem );
|
||||
|
||||
void erase( wxDC* DC );
|
||||
|
||||
public:
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
int m_BgColor; // couleur de fond
|
||||
|
@ -556,7 +562,6 @@ public:
|
|||
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void EraseMsgBox();
|
||||
void EraseMsgBox( wxDC* DC );
|
||||
void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
||||
const wxString& texte_L, int color );
|
||||
|
||||
|
|
Loading…
Reference in New Issue