All: fix a minor issue in drawtext.cpp
Pcbnew: load footprint from modview: Because modview allows user to choose the footprint library, the selected library is forced when the footprint is loaded. I am not sure this is 100% better, but this new behavior has some advantages, mainly in the footprint editor (you can load a footprint outside the selected library)
This commit is contained in:
parent
e5740af069
commit
e07590f930
|
@ -389,7 +389,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
|
||||||
|
|
||||||
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single
|
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single
|
||||||
* graphic line */
|
* graphic line */
|
||||||
if( aDC && ( aDC->LogicalToDeviceYRel( std::abs( aSize.y ) ) < MIN_TEXT_SIZE ))
|
if( aDC && ( aDC->LogicalToDeviceYRel( std::abs( aSize.y ) ) < MIN_DRAWABLE_TEXT_SIZE ))
|
||||||
{
|
{
|
||||||
// draw the text as a line always vertically centered
|
// draw the text as a line always vertically centered
|
||||||
wxPoint end( current_char_pos.x + dx, current_char_pos.y );
|
wxPoint end( current_char_pos.x + dx, current_char_pos.y );
|
||||||
|
|
|
@ -10,9 +10,20 @@
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
|
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
|
||||||
|
|
||||||
/// Minimum dimension in pixel for drawing text
|
/* Minimum dimension in pixel for drawing/no drawing a text
|
||||||
|
* used in Pcbnew to decide to draw (or not) some texts
|
||||||
|
* ( like net names on pads/tracks )
|
||||||
|
* When a text height is smaller than MIN_TEXT_SIZE,
|
||||||
|
* it is not drawn by Pcbnew
|
||||||
|
*/
|
||||||
#define MIN_TEXT_SIZE 5
|
#define MIN_TEXT_SIZE 5
|
||||||
|
|
||||||
|
/* Absolute minimum dimension in pixel to draw a text as text or a line
|
||||||
|
* When a text height is smaller than MIN_DRAWABLE_TEXT_SIZE,
|
||||||
|
* it is drawn, but like a line by the draw text function
|
||||||
|
*/
|
||||||
|
#define MIN_DRAWABLE_TEXT_SIZE 3
|
||||||
|
|
||||||
class EDA_DRAW_PANEL;
|
class EDA_DRAW_PANEL;
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,12 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
|
||||||
wxMilliSleep( 50 );
|
wxMilliSleep( 50 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fpname = viewer->GetSelectedFootprint();
|
// Returnd the full fp name, i.e. the lib name and th fp name,
|
||||||
|
// separated by a '/'
|
||||||
|
// (/ is now an illegal char in fp names)
|
||||||
|
wxString fpname = viewer->GetSelectedLibraryFullName();
|
||||||
|
fpname << wxT("/") << viewer->GetSelectedFootprint();
|
||||||
|
|
||||||
viewer->Destroy();
|
viewer->Destroy();
|
||||||
|
|
||||||
return fpname;
|
return fpname;
|
||||||
|
@ -146,6 +151,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
MODULE* module;
|
MODULE* module;
|
||||||
wxPoint curspos = GetScreen()->GetCrossHairPosition();
|
wxPoint curspos = GetScreen()->GetCrossHairPosition();
|
||||||
wxString moduleName, keys;
|
wxString moduleName, keys;
|
||||||
|
wxString libName = aLibrary;
|
||||||
bool allowWildSeach = true;
|
bool allowWildSeach = true;
|
||||||
|
|
||||||
static wxArrayString HistoryList;
|
static wxArrayString HistoryList;
|
||||||
|
@ -162,7 +168,12 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
|
|
||||||
if( dlg.m_GetExtraFunction )
|
if( dlg.m_GetExtraFunction )
|
||||||
{
|
{
|
||||||
moduleName = SelectFootprintFromLibBrowser();
|
// SelectFootprintFromLibBrowser() returns the
|
||||||
|
// "full" footprint name, i.e.
|
||||||
|
// <lib_name>/<footprint name>
|
||||||
|
wxString full_fpname = SelectFootprintFromLibBrowser();
|
||||||
|
moduleName = full_fpname.AfterLast( '/' );
|
||||||
|
libName = full_fpname.BeforeLast( '/' );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -179,7 +190,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
{
|
{
|
||||||
allowWildSeach = false;
|
allowWildSeach = false;
|
||||||
keys = moduleName;
|
keys = moduleName;
|
||||||
moduleName = Select_1_Module_From_List( this, aLibrary, wxEmptyString, keys );
|
moduleName = Select_1_Module_From_List( this, libName, wxEmptyString, keys );
|
||||||
|
|
||||||
if( moduleName.IsEmpty() ) // Cancel command
|
if( moduleName.IsEmpty() ) // Cancel command
|
||||||
{
|
{
|
||||||
|
@ -191,7 +202,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
|| ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
|
|| ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
|
||||||
{
|
{
|
||||||
allowWildSeach = false;
|
allowWildSeach = false;
|
||||||
moduleName = Select_1_Module_From_List( this, aLibrary, moduleName, wxEmptyString );
|
moduleName = Select_1_Module_From_List( this, libName, moduleName, wxEmptyString );
|
||||||
|
|
||||||
if( moduleName.IsEmpty() )
|
if( moduleName.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -200,7 +211,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module = GetModuleLibrary( aLibrary, moduleName, false );
|
module = GetModuleLibrary( libName, moduleName, false );
|
||||||
|
|
||||||
if( !module && allowWildSeach ) // Search with wild card
|
if( !module && allowWildSeach ) // Search with wild card
|
||||||
{
|
{
|
||||||
|
@ -209,7 +220,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
|
wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
|
||||||
moduleName = wildname;
|
moduleName = wildname;
|
||||||
|
|
||||||
moduleName = Select_1_Module_From_List( this, aLibrary, moduleName, wxEmptyString );
|
moduleName = Select_1_Module_From_List( this, libName, moduleName, wxEmptyString );
|
||||||
|
|
||||||
if( moduleName.IsEmpty() )
|
if( moduleName.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -218,7 +229,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
module = GetModuleLibrary( aLibrary, moduleName, true );
|
module = GetModuleLibrary( libName, moduleName, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,13 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString FOOTPRINT_VIEWER_FRAME::GetSelectedLibraryFullName( void )
|
||||||
|
{
|
||||||
|
wxString fullname = m_libraryName + wxT(".") + LegacyFootprintLibPathExtension;
|
||||||
|
return fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Routine to view one selected library content. */
|
/* Routine to view one selected library content. */
|
||||||
void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
|
void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
|
||||||
{
|
{
|
||||||
|
@ -171,8 +178,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
// Delete the current footprint
|
// Delete the current footprint
|
||||||
GetBoard()->m_Modules.DeleteAll();
|
GetBoard()->m_Modules.DeleteAll();
|
||||||
GetModuleLibrary( m_libraryName + wxT(".") + LegacyFootprintLibPathExtension,
|
GetModuleLibrary( GetSelectedLibraryFullName(), m_footprintName, true );
|
||||||
m_footprintName, true );
|
|
||||||
Update3D_Frame();
|
Update3D_Frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,10 @@ private:
|
||||||
wxString m_configPath; // subpath for configuration
|
wxString m_configPath; // subpath for configuration
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static wxString m_libraryName; // Current selected libary
|
static wxString m_libraryName; // Current selected libary
|
||||||
static wxString m_footprintName; // Current selected footprint
|
static wxString m_footprintName; // Current selected footprint
|
||||||
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
|
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
|
||||||
// the selected footprint is here
|
// the selected footprint is here
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent, wxSemaphore* semaphore = NULL,
|
FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent, wxSemaphore* semaphore = NULL,
|
||||||
|
@ -84,6 +84,7 @@ public:
|
||||||
static FOOTPRINT_VIEWER_FRAME* GetActiveFootprintViewer();
|
static FOOTPRINT_VIEWER_FRAME* GetActiveFootprintViewer();
|
||||||
|
|
||||||
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
|
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
|
||||||
|
const wxString GetSelectedLibraryFullName( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue