Ensure auto zoom is enabled when it's the first file
This commit is contained in:
parent
8f4ff1e954
commit
109e40c3a6
|
@ -193,7 +193,17 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
// Set the busy cursor
|
// Set the busy cursor
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
|
|
||||||
return LoadListOfGerberAndDrillFiles( currentPath, filenamesList );
|
bool isFirstFile = GetImagesList()->GetLoadedImageCount() == 0;
|
||||||
|
|
||||||
|
bool success = LoadListOfGerberAndDrillFiles( currentPath, filenamesList );
|
||||||
|
|
||||||
|
// Auto zoom is only applied if there is only one file loaded
|
||||||
|
if ( isFirstFile )
|
||||||
|
{
|
||||||
|
Zoom_Automatique( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,13 @@ GERBER_FILE_IMAGE* GERBER_FILE_IMAGE_LIST::GetGbrImage( int aIdx )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned GERBER_FILE_IMAGE_LIST::GetLoadedImageCount()
|
||||||
|
{
|
||||||
|
auto notNull = []( GERBER_FILE_IMAGE* image ){ return image != nullptr; };
|
||||||
|
return std::count_if( m_GERBER_List.begin(), m_GERBER_List.end(), notNull );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int GERBER_FILE_IMAGE_LIST::AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx )
|
int GERBER_FILE_IMAGE_LIST::AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx )
|
||||||
{
|
{
|
||||||
int idx = aIdx;
|
int idx = aIdx;
|
||||||
|
|
|
@ -121,6 +121,13 @@ public:
|
||||||
*/
|
*/
|
||||||
std::unordered_map<int, int> SortImagesByZOrder();
|
std::unordered_map<int, int> SortImagesByZOrder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get number of loaded images
|
||||||
|
*
|
||||||
|
* @return number of images loaded
|
||||||
|
*/
|
||||||
|
unsigned GetLoadedImageCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the list of loaded images (1 image = 1 gerber file)
|
// the list of loaded images (1 image = 1 gerber file)
|
||||||
std::vector<GERBER_FILE_IMAGE*> m_GERBER_List;
|
std::vector<GERBER_FILE_IMAGE*> m_GERBER_List;
|
||||||
|
|
Loading…
Reference in New Issue