Change search path order, wxDC zoom updates, and code clean ups.
Add helpers for inserting paths to and removing paths from search list. Moved user defined path before default library paths in search list. Renamed m_Draw_Auxiliary_Axis to DrawAuxiliaryAxis. Changed parameter to fix wxDC set mode from FALSE to GR_COPY. Minor wxDC zoom improvements.
This commit is contained in:
parent
a98c2415df
commit
d96039a1fb
|
@ -573,6 +573,7 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC )
|
|||
void WinEDA_DrawFrame::AdjustScrollBars()
|
||||
/*********************************************/
|
||||
{
|
||||
#ifndef WX_ZOOM
|
||||
int xUnit, yUnit;
|
||||
wxSize draw_size, panel_size;
|
||||
wxSize scrollbar_number;
|
||||
|
@ -652,6 +653,7 @@ void WinEDA_DrawFrame::AdjustScrollBars()
|
|||
screen->m_ScrollbarNumber.y,
|
||||
screen->m_ScrollbarPos.x,
|
||||
screen->m_ScrollbarPos.y, TRUE );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -197,13 +197,18 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
|
|||
GRResetPenAndBrush( DC );
|
||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||
#ifdef WX_ZOOM
|
||||
double scale = GetScreen()->GetScalingFactor( );
|
||||
double scale = GetScreen()->GetScalingFactor();
|
||||
wxPoint origin = GetScreen()->m_DrawOrg;
|
||||
wxLogDebug( wxT( "DC user scale factor: %0.3f, X origin: %d, Y " \
|
||||
"origin: %d" ), scale, origin.x, origin.y );
|
||||
DoPrepareDC( *DC );
|
||||
DC->SetUserScale( scale, scale );
|
||||
DC->SetLogicalOrigin( origin.x, origin.y );
|
||||
DoPrepareDC( *DC );
|
||||
|
||||
int x, y;
|
||||
wxPoint logicalPos = GetScreen()->m_Curseur - origin;;
|
||||
CalcScrolledPosition( logicalPos.x, logicalPos.y, &x, &y );
|
||||
Scroll( x, y );
|
||||
#endif
|
||||
SetBoundaryBox();
|
||||
}
|
||||
|
@ -596,9 +601,10 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
|||
#endif
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
screen->Unscale( m_ClipBox.m_Pos );
|
||||
screen->Unscale( m_ClipBox.m_Size );
|
||||
m_ClipBox.m_Pos.x = paintDC.DeviceToLogicalX( m_ClipBox.m_Pos.x );
|
||||
m_ClipBox.m_Pos.y = paintDC.DeviceToLogicalY( m_ClipBox.m_Pos.y );
|
||||
m_ClipBox.m_Size.SetWidth( paintDC.DeviceToLogicalXRel( m_ClipBox.m_Size.GetWidth() ) );
|
||||
m_ClipBox.m_Size.SetHeight( paintDC.DeviceToLogicalXRel( m_ClipBox.m_Size.GetHeight() ) );
|
||||
#else
|
||||
PaintClipBox.Offset( org );
|
||||
m_ClipBox.SetX( PaintClipBox.GetX() );
|
||||
|
@ -627,7 +633,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
|||
{
|
||||
wxDCClipper dcclip( paintDC, PaintClipBox );
|
||||
|
||||
ReDraw( &paintDC, TRUE );
|
||||
ReDraw( &paintDC, true );
|
||||
}
|
||||
|
||||
m_ClipBox = tmp;
|
||||
|
@ -658,11 +664,6 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
|
|||
g_GhostColor = WHITE;
|
||||
}
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
double scale = Screen->GetScalingFactor( );
|
||||
DC->SetUserScale( scale, scale );
|
||||
#endif
|
||||
|
||||
if( erasebg )
|
||||
PrepareGraphicContext( DC );
|
||||
|
||||
|
@ -742,6 +743,13 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
|||
size = GetClientSize();
|
||||
screen->Unscale( size );
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
org.x = DC->DeviceToLogicalX( org.x );
|
||||
org.y = DC->DeviceToLogicalY( org.y );
|
||||
size.SetWidth( DC->DeviceToLogicalXRel( size.GetWidth() ) );
|
||||
size.SetHeight( DC->DeviceToLogicalXRel( size.GetHeight() ) );
|
||||
#endif
|
||||
|
||||
if( drawgrid )
|
||||
{
|
||||
m_Parent->PutOnGrid( &org );
|
||||
|
@ -767,7 +775,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
|||
}
|
||||
|
||||
/* Draw axis */
|
||||
if( m_Parent->m_Draw_Axis )
|
||||
if( m_Parent->m_Draw_Axis )
|
||||
{
|
||||
/* Draw the Y axis */
|
||||
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
|
||||
|
@ -778,16 +786,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
|||
screen->ReturnPageSize().x, 0, 0, Color );
|
||||
}
|
||||
|
||||
/* Draw auxiliary axis */
|
||||
if( m_Parent->m_Draw_Auxiliary_Axis )
|
||||
{
|
||||
m_Draw_Auxiliary_Axis( DC, FALSE );
|
||||
}
|
||||
DrawAuxiliaryAxis( DC, GR_COPY );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
|
||||
void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode )
|
||||
/********************************************************************/
|
||||
|
||||
/** m_Draw_Auxiliary_Axis
|
||||
|
@ -795,8 +799,9 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
|
|||
* for gerber and excellon files
|
||||
*/
|
||||
{
|
||||
if( m_Parent->m_Auxiliary_Axis_Position.x == 0
|
||||
&& m_Parent->m_Auxiliary_Axis_Position.y == 0 )
|
||||
if( !m_Parent->m_Draw_Auxiliary_Axis
|
||||
|| ( m_Parent->m_Auxiliary_Axis_Position.x == 0
|
||||
&& m_Parent->m_Auxiliary_Axis_Position.y == 0 ) )
|
||||
return;
|
||||
|
||||
int Color = DARKRED;
|
||||
|
|
|
@ -1023,7 +1023,38 @@ wxString WinEDA_App::FindLibraryPath( const wxString& fileName )
|
|||
if( wxFileName::FileExists( fileName ) )
|
||||
return fileName;
|
||||
else
|
||||
return GetLibraryPathList().FindValidPath( fileName );
|
||||
return m_libSearchPaths.FindValidPath( fileName );
|
||||
}
|
||||
|
||||
void WinEDA_App::RemoveLibraryPath( const wxString& path )
|
||||
{
|
||||
if( m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) != wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Removing path <%s> from library path search list." ),
|
||||
path.c_str() );
|
||||
m_libSearchPaths.Remove( path );
|
||||
}
|
||||
}
|
||||
|
||||
void WinEDA_App::InsertLibraryPath( const wxString& path, size_t index )
|
||||
{
|
||||
if( wxFileName::DirExists( path )
|
||||
&& m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) == wxNOT_FOUND )
|
||||
{
|
||||
if( index >= m_libSearchPaths.GetCount() )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||
path.c_str() );
|
||||
m_libSearchPaths.Add( path );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug( wxT( "Inserting path <%s> in library path search " \
|
||||
"list at index position %d." ),
|
||||
path.c_str(), index );
|
||||
m_libSearchPaths.Insert( path, index );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,10 +60,8 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
|
|||
/* Update the library search path list if a new project file is loaded. */
|
||||
if( m_projectFileName != fn )
|
||||
{
|
||||
if( m_libSearchPaths.Index( fn.GetPath() ) != wxNOT_FOUND )
|
||||
m_libSearchPaths.Remove( fn.GetPath() );
|
||||
|
||||
m_libSearchPaths.Insert( fn.GetPath(), 0 );
|
||||
RemoveLibraryPath( m_projectFileName.GetPath() );
|
||||
InsertLibraryPath( fn.GetPath(), 0 );
|
||||
m_projectFileName = fn;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,7 @@ void Read_Config( const wxString& FileName )
|
|||
if( fn.GetExt() != ProjectFileExtension )
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
if( wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) != wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Removing path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Remove( g_UserLibDirBuffer );
|
||||
}
|
||||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(),
|
||||
GROUP, ParamCfgList, FALSE );
|
||||
|
@ -52,13 +47,8 @@ void Read_Config( const wxString& FileName )
|
|||
if( g_NetlistFileExtension.IsEmpty() )
|
||||
g_NetlistFileExtension = wxT( "net" );
|
||||
|
||||
if( wxFileName::DirExists( g_UserLibDirBuffer )
|
||||
&& wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) == wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Add( g_UserLibDirBuffer );
|
||||
}
|
||||
/* User library path takes precedent over default library search paths. */
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -159,12 +159,7 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
|||
* extension (.pro). */
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
if( wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) != wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Removing path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Remove( g_UserLibDirBuffer );
|
||||
}
|
||||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
|
||||
if( !wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, ParamCfgList,
|
||||
ForceRereadConfig ? FALSE : TRUE ) )
|
||||
|
@ -173,13 +168,8 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
|||
IsRead = FALSE;
|
||||
}
|
||||
|
||||
if( wxFileName::DirExists( g_UserLibDirBuffer )
|
||||
&& wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) == wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Add( g_UserLibDirBuffer );
|
||||
}
|
||||
/* User library path takes precedent over default library search paths. */
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
|
||||
// If the list is void, load the libraries "power.lib" and "device.lib"
|
||||
if( g_LibName_List.GetCount() == 0 )
|
||||
|
|
|
@ -153,11 +153,11 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
// Loading the project library cache
|
||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
fn.SetExt( wxT( "cache.lib" ) );
|
||||
wxLogDebug( wxT( "Load schematic cache library file <%s>" ),
|
||||
fn.GetFullPath().c_str() );
|
||||
|
||||
if( fn.FileExists() )
|
||||
{
|
||||
wxLogDebug( wxT( "Load schematic cache library file <%s>" ),
|
||||
fn.GetFullPath().c_str() );
|
||||
msg = wxT( "Load " ) + fn.GetFullPath();
|
||||
LibraryStruct* LibCache = LoadLibraryName( this, fn.GetFullPath(),
|
||||
fn.GetName() );
|
||||
|
|
|
@ -137,6 +137,8 @@ public:
|
|||
{
|
||||
return FindLibraryPath( fileName.GetFullPath() );
|
||||
}
|
||||
void RemoveLibraryPath( const wxString& path );
|
||||
void InsertLibraryPath( const wxString& path, size_t index );
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
void ReDraw( wxDC* DC, bool erasebg = TRUE );
|
||||
void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask, bool aPrintMirrorMode );
|
||||
void DrawBackGround( wxDC* DC );
|
||||
void m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode );
|
||||
void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
|
||||
|
|
|
@ -317,9 +317,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
||||
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_XOR );
|
||||
DrawPanel->DrawAuxiliaryAxis( DC, GR_XOR );
|
||||
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
|
||||
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY );
|
||||
DrawPanel->DrawAuxiliaryAxis( DC, GR_COPY );
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
|
|
|
@ -171,12 +171,7 @@ bool Read_Config( const wxString& projectFileName )
|
|||
fn.SetExt( ProjectFileExtension );
|
||||
}
|
||||
|
||||
if( wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) != wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Removing path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Remove( g_UserLibDirBuffer );
|
||||
}
|
||||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
|
||||
/* Init des valeurs par defaut */
|
||||
g_LibName_List.Clear();
|
||||
|
@ -184,16 +179,10 @@ bool Read_Config( const wxString& projectFileName )
|
|||
wxGetApp().ReadProjectConfig( fn.GetFullPath(),
|
||||
GROUP, ParamCfgList, FALSE );
|
||||
|
||||
/* User library path takes precedent over default library search paths. */
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
|
||||
/* Traitement des variables particulieres: */
|
||||
|
||||
if( wxFileName::DirExists( g_UserLibDirBuffer )
|
||||
&& wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) == wxNOT_FOUND )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||
g_UserLibDirBuffer.c_str() );
|
||||
wxGetApp().GetLibraryPathList().Add( g_UserLibDirBuffer );
|
||||
}
|
||||
|
||||
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
|
||||
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
|
||||
|
||||
|
|
Loading…
Reference in New Issue