diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 2031e96c69..26f4f5bbf7 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -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 * 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 wxPoint end( current_char_pos.x + dx, current_char_pos.y ); @@ -583,12 +583,12 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, aColor2 = c; } - DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize, - aH_justify, aV_justify, aWidth, aItalic, aBold, + DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize, + aH_justify, aV_justify, aWidth, aItalic, aBold, aCallback, aPlotter ); - - DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize, - aH_justify, aV_justify, aWidth / 4, aItalic, aBold, + + DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize, + aH_justify, aV_justify, aWidth / 4, aItalic, aBold, aCallback, aPlotter ); } diff --git a/include/drawtxt.h b/include/drawtxt.h index 8750f08836..7ef8b7198e 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -10,9 +10,20 @@ #include #include // 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 +/* 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 PLOTTER; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 847d9a70ed..20ac9c0b74 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -132,7 +132,12 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void ) 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(); return fpname; @@ -146,6 +151,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, MODULE* module; wxPoint curspos = GetScreen()->GetCrossHairPosition(); wxString moduleName, keys; + wxString libName = aLibrary; bool allowWildSeach = true; static wxArrayString HistoryList; @@ -162,7 +168,12 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, if( dlg.m_GetExtraFunction ) { - moduleName = SelectFootprintFromLibBrowser(); + // SelectFootprintFromLibBrowser() returns the + // "full" footprint name, i.e. + // / + wxString full_fpname = SelectFootprintFromLibBrowser(); + moduleName = full_fpname.AfterLast( '/' ); + libName = full_fpname.BeforeLast( '/' ); } else { @@ -179,7 +190,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, { allowWildSeach = false; 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 { @@ -191,7 +202,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, || ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card { 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() ) { @@ -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 { @@ -209,7 +220,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' ); 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() ) { @@ -218,7 +229,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, } else { - module = GetModuleLibrary( aLibrary, moduleName, true ); + module = GetModuleLibrary( libName, moduleName, true ); } } diff --git a/pcbnew/modview.cpp b/pcbnew/modview.cpp index 1f3548c02b..e366493cbc 100644 --- a/pcbnew/modview.cpp +++ b/pcbnew/modview.cpp @@ -87,7 +87,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event ) wxArrayString headers; headers.Add( wxT("Library") ); std::vector itemsToDisplay; - + // Conversion from wxArrayString to vector of ArrayString for( unsigned i = 0; i < g_LibraryNames.GetCount(); i++ ) { @@ -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. */ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) { @@ -171,8 +178,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) SetCurItem( NULL ); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); - GetModuleLibrary( m_libraryName + wxT(".") + LegacyFootprintLibPathExtension, - m_footprintName, true ); + GetModuleLibrary( GetSelectedLibraryFullName(), m_footprintName, true ); Update3D_Frame(); } diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h index 5704829522..4186a44b7c 100644 --- a/pcbnew/modview_frame.h +++ b/pcbnew/modview_frame.h @@ -58,10 +58,10 @@ private: wxString m_configPath; // subpath for configuration protected: - static wxString m_libraryName; // Current selected libary - static wxString m_footprintName; // Current selected footprint - static wxString m_selectedFootprintName; // When the viewer is used to select a footprint - // the selected footprint is here + static wxString m_libraryName; // Current selected libary + static wxString m_footprintName; // Current selected footprint + static wxString m_selectedFootprintName; // When the viewer is used to select a footprint + // the selected footprint is here public: FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent, wxSemaphore* semaphore = NULL, @@ -84,6 +84,7 @@ public: static FOOTPRINT_VIEWER_FRAME* GetActiveFootprintViewer(); wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; } + const wxString GetSelectedLibraryFullName( void ); private: