Eeschema: fixed bug when edit a component reference using the component dialog editor
Code cleaning and using DrawPanel->Refresh() instead of ReDraw() when possible.
This commit is contained in:
parent
3432474c96
commit
6efce74c96
|
@ -139,10 +139,10 @@ check_find_package_result(OPENGL_FOUND "OpenGL")
|
|||
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
|
||||
|
||||
if( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
|
||||
find_package(wxWidgets COMPONENTS gl html adv core net base aui QUIET)
|
||||
# find_package(wxWidgets COMPONENTS gl html adv core net base QUIET)
|
||||
find_package(wxWidgets COMPONENTS gl aui adv html core net base QUIET)
|
||||
# find_package(wxWidgets COMPONENTS gl adv html core net base QUIET)
|
||||
else( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
|
||||
find_package(wxWidgets COMPONENTS gl html adv core net base QUIET)
|
||||
find_package(wxWidgets COMPONENTS gl adv html core net base QUIET)
|
||||
endif( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
|
||||
check_find_package_result(wxWidgets_FOUND "wxWidgets")
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
|||
int flag;
|
||||
bool Modify = FALSE;
|
||||
|
||||
WinEDA_SchematicFrame* frame;
|
||||
|
||||
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||
|
||||
DrawList = EEDrawList;
|
||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||
{
|
||||
|
@ -63,7 +59,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
|||
}
|
||||
}
|
||||
|
||||
WinEDA_SchematicFrame* frame;
|
||||
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||
frame->TestDanglingEnds( EEDrawList, DC );
|
||||
|
||||
return Modify;
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,8 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
|
|||
|
||||
if( screen->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
if( oldpos != screen->m_Curseur )
|
||||
|
@ -372,7 +373,8 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
|
|||
|
||||
if( screen->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
if( oldpos != screen->m_Curseur )
|
||||
|
@ -464,7 +466,8 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
|||
|
||||
if( screen->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
if( oldpos != screen->m_Curseur )
|
||||
|
|
|
@ -273,6 +273,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
// copy all the fields back, and change the length of m_Fields.
|
||||
m_Cmp->SetFields( m_FieldsBuf );
|
||||
|
||||
// Reference has a specific initialisation, depending on the current active sheet
|
||||
// because for a given component, in a complexe hierarchy, there are more than one
|
||||
// reference.
|
||||
m_Cmp->SetRef( m_Parent->GetSheet(), m_FieldsBuf[REFERENCE].m_Text );
|
||||
|
||||
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
|
||||
m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, NULL );
|
||||
|
|
|
@ -224,33 +224,10 @@ Error: %s" ),
|
|||
}
|
||||
|
||||
|
||||
/* Create a new screen
|
||||
*
|
||||
* This screen is chained with OldScreen. The timestamp value is assigned to
|
||||
* the parameter NewScreen-> TimeStamp
|
||||
*/
|
||||
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN* OldScreen,
|
||||
int TimeStamp )
|
||||
{
|
||||
SCH_SCREEN* NewScreen;
|
||||
|
||||
NewScreen = new SCH_SCREEN();
|
||||
|
||||
NewScreen->SetRefreshReq();
|
||||
if( OldScreen )
|
||||
NewScreen->m_Company = OldScreen->m_Company;
|
||||
NewScreen->m_TimeStamp = TimeStamp;
|
||||
|
||||
NewScreen->SetBack( OldScreen );
|
||||
|
||||
return NewScreen;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the entire project and create an archive for components.
|
||||
*
|
||||
* The library archive name is <root_name>.cache.lib
|
||||
* The library archive name is <root_name>-cache.lib
|
||||
*/
|
||||
void WinEDA_SchematicFrame::SaveProject()
|
||||
{
|
||||
|
|
|
@ -111,12 +111,15 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
Panel->ForceCloseManageCurseur = NULL;
|
||||
|
||||
if( item->m_Flags & IS_NEW )
|
||||
{
|
||||
if( DC )
|
||||
{
|
||||
if( item->Type() == COMPONENT_ARC_DRAW_TYPE )
|
||||
Panel->GetParent()->RedrawActiveWindow( DC, TRUE );
|
||||
Panel->GetParent()->DrawPanel->Refresh( );
|
||||
else
|
||||
item->Draw( Panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
|
||||
DefaultTransformMatrix );
|
||||
}
|
||||
|
||||
SAFE_DELETE( item );
|
||||
parent->SetDrawItem( NULL );
|
||||
|
|
|
@ -287,9 +287,6 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event )
|
|||
// Now, we must recalculate the position and size of subwindows
|
||||
wxSizeEvent SizeEv;
|
||||
OnSize( SizeEv );
|
||||
|
||||
// Ensure the panel is always redrawn (sometimes some garbage remains):
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -351,6 +348,9 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
|
|||
#endif
|
||||
|
||||
SizeEv.Skip();
|
||||
|
||||
// Ensure the panel is always redrawn (sometimes some garbage remains):
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
|
||||
// We must return here, instead of proceeding.
|
||||
// If we let the cursor move during a refresh request,
|
||||
|
@ -105,7 +106,8 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
|
|
|
@ -65,7 +65,7 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
|
|||
case ID_NEW_BOARD:
|
||||
Clear_Pcb( true );
|
||||
Zoom_Automatique( false );
|
||||
GetScreen()->SetRefreshReq();
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case ID_GERBVIEW_LOAD_DRILL_FILE:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "hotkeys.h"
|
||||
|
||||
#include "gerbview.h"
|
||||
#include "protos.h"
|
||||
#include "class_drawpanel.h"
|
||||
|
||||
/* How to add a new hotkey:
|
||||
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
|
||||
|
@ -139,7 +139,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
|
||||
case HK_SWITCH_TRACK_DISPLAY_MODE:
|
||||
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
|
||||
GetScreen()->SetRefreshReq();
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
case HK_SWITCH_LAYER_TO_PREVIOUS:
|
||||
|
|
|
@ -233,7 +233,6 @@ public:
|
|||
bool aSetFielsAttributeToVisible );
|
||||
|
||||
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
||||
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
|
||||
|
||||
// General search:
|
||||
|
||||
|
|
|
@ -397,3 +397,31 @@ bool NETCLASS::ReadDescr( FILE* aFile, int* aLineNum )
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetTrackMinWidth() const
|
||||
{
|
||||
return m_Parent->m_BoardSettings->m_TrackMinWidth;
|
||||
}
|
||||
|
||||
int NETCLASS::GetViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->m_BoardSettings->m_ViasMinSize;
|
||||
}
|
||||
|
||||
int NETCLASS::GetViaMinDrill() const
|
||||
{
|
||||
return m_Parent->m_BoardSettings->m_ViasMinDrill;
|
||||
}
|
||||
|
||||
int NETCLASS::GetuViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->m_BoardSettings->m_MicroViasMinSize;
|
||||
}
|
||||
|
||||
int NETCLASS::GetuViaMinDrill() const
|
||||
{
|
||||
return m_Parent->m_BoardSettings->m_MicroViasMinDrill;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,18 +163,23 @@ public:
|
|||
void SetClearance( int aClearance ) { m_Clearance = aClearance; }
|
||||
|
||||
int GetTrackWidth() const { return m_TrackWidth; }
|
||||
int GetTrackMinWidth() const;
|
||||
void SetTrackWidth( int aWidth ) { m_TrackWidth = aWidth; }
|
||||
|
||||
int GetViaDiameter() const { return m_ViaDia; }
|
||||
int GetViaMinDiameter() const;
|
||||
void SetViaDiameter( int aDia ) { m_ViaDia = aDia; }
|
||||
|
||||
int GetViaDrill() const { return m_ViaDrill; }
|
||||
int GetViaMinDrill() const;
|
||||
void SetViaDrill( int aSize ) { m_ViaDrill = aSize; }
|
||||
|
||||
int GetuViaDiameter() const { return m_uViaDia; }
|
||||
int GetuViaMinDiameter() const;
|
||||
void SetuViaDiameter( int aSize ) { m_uViaDia = aSize; }
|
||||
|
||||
int GetuViaDrill() const { return m_uViaDrill; }
|
||||
int GetuViaMinDrill() const;
|
||||
void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; }
|
||||
|
||||
|
||||
|
|
|
@ -368,10 +368,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
|
||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
// test if the via size is smaller than minimum
|
||||
if( aRefSeg->Shape() == VIA_MICROVIA )
|
||||
{
|
||||
if( aRefSeg->m_Width < netclass->GetuViaDiameter() )
|
||||
if( aRefSeg->m_Width < netclass->GetuViaMinDiameter() )
|
||||
{
|
||||
m_currentMarker = fillMarker( aRefSeg, NULL,
|
||||
DRCE_TOO_SMALL_MICROVIA, m_currentMarker );
|
||||
|
@ -739,7 +739,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( aRefSeg->m_Width < netclass->GetViaDiameter() )
|
||||
if( aRefSeg->m_Width < netclass->GetViaMinDiameter() )
|
||||
{
|
||||
m_currentMarker = fillMarker( aRefSeg, NULL,
|
||||
DRCE_TOO_SMALL_VIA, m_currentMarker );
|
||||
|
@ -784,7 +784,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
}
|
||||
else // This is a track segment
|
||||
{
|
||||
if( aRefSeg->m_Width < netclass->GetTrackWidth() )
|
||||
if( aRefSeg->m_Width < netclass->GetTrackMinWidth() )
|
||||
{
|
||||
m_currentMarker = fillMarker( aRefSeg, NULL,
|
||||
DRCE_TOO_SMALL_TRACK_WIDTH, m_currentMarker );
|
||||
|
|
|
@ -436,7 +436,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
|
||||
// We must return here, instead of proceeding.
|
||||
// If we let the cursor move during a refresh request,
|
||||
|
@ -515,9 +515,9 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
if( GetScreen()->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
|||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
DrawPanel->ManageCurseur = Montre_Position_Empreinte;
|
||||
DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule;
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
|
||||
// Erase the module.
|
||||
if( DC )
|
||||
|
@ -290,7 +290,7 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
* The ratsnest and pad list are recalculated
|
||||
* @param module = footprint to delete
|
||||
* @param DC = currentDevice Context. if NULL: do not redraw new ratsnest and
|
||||
* dirty rectangle
|
||||
* screen
|
||||
* @param aPromptBeforeDeleting : if true: ask for confirmation before deleting
|
||||
*/
|
||||
bool WinEDA_PcbFrame::Delete_Module( MODULE* module,
|
||||
|
@ -307,9 +307,9 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module,
|
|||
/* Confirm module delete. */
|
||||
if( aAskBeforeDeleting )
|
||||
{
|
||||
msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text
|
||||
<< wxT( " (" ) << _( "Value " ) << module->m_Value->m_Text
|
||||
<< wxT( ") ?" );
|
||||
msg.Printf( _( "Delete Module %s (value %s) ?"),
|
||||
GetChars(module->m_Reference->m_Text),
|
||||
GetChars(module->m_Value->m_Text) );
|
||||
if( !IsOK( this, msg ) )
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -318,13 +318,6 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module,
|
|||
|
||||
GetScreen()->SetModify();
|
||||
|
||||
/* Erase ratsnest if needed
|
||||
* Dirty rectangle is not used here because usually using a XOR draw mode
|
||||
* gives good results (very few artifacts) for ratsnest
|
||||
*/
|
||||
if( g_Show_Ratsnest )
|
||||
DrawGeneralRatsnest( DC );
|
||||
|
||||
/* Remove module from list, and put it in undo command list */
|
||||
m_Pcb->m_Modules.Remove( module );
|
||||
module->SetState( DELETED, ON );
|
||||
|
@ -332,11 +325,11 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module,
|
|||
|
||||
Compile_Ratsnest( DC, true );
|
||||
|
||||
// redraw the area where the module was
|
||||
// Redraw the full screen to ensure perfect display of board and ratsnest.
|
||||
if( DC )
|
||||
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
return TRUE;
|
||||
DrawPanel->Refresh( );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -493,7 +486,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
|
|||
Compile_Ratsnest( DC, true );
|
||||
|
||||
if( DC )
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
DrawPanel->Refresh( );
|
||||
|
||||
module->DisplayInfo( this );
|
||||
|
||||
|
@ -502,7 +495,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
|
|||
|
||||
/*
|
||||
* Rotate the footprint angle degrees in the direction < 0.
|
||||
* If incremental == TRUE, the rotation is made from the last orientation,
|
||||
* If incremental == true, the rotation is made from the last orientation,
|
||||
* If the module is placed in the absolute orientation angle.
|
||||
* If DC == NULL, the component does not redraw.
|
||||
* Otherwise, it erases and redraws turns
|
||||
|
@ -549,18 +542,19 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
|
|||
|
||||
if( DC )
|
||||
{
|
||||
if( !( module->m_Flags & IS_MOVED ) ) /* Rotation simple */
|
||||
{
|
||||
if( !( module->m_Flags & IS_MOVED ) )
|
||||
{ // not beiing moved: redraw the module and update ratsnest
|
||||
module->Draw( DrawPanel, DC, GR_OR );
|
||||
|
||||
Compile_Ratsnest( DC, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // Beiing moved: just redraw it
|
||||
DrawModuleOutlines( DrawPanel, DC, module );
|
||||
Dessine_Segments_Dragges( DrawPanel, DC );
|
||||
}
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
|
||||
if( module->m_Flags == 0 ) // module not in edit: redraw full screen
|
||||
DrawPanel->Refresh( );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue