Loading common/class_bitmap_base.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -49,8 +49,9 @@ BITMAP_BASE::BITMAP_BASE( const wxPoint& pos ) m_Scale = 1.0; // 1.0 = original bitmap size m_Scale = 1.0; // 1.0 = original bitmap size m_bitmap = NULL; m_bitmap = NULL; m_image = NULL; m_image = NULL; m_pixelScaleFactor = 3.33; // a value OK for bitmaps using 300 PPI m_ppi = 300; // the bitmap definition. the default is 300PPI // (Eeschema uses currently 1000PPI m_pixelScaleFactor = 1000.0 / m_ppi; // a value OK for bitmaps using 300 PPI // for Eeschema which uses currently 1000PPI } } Loading @@ -72,6 +73,7 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem ) *m_image = *aItem->m_image; *m_image = *aItem->m_image; *m_bitmap = *aItem->m_bitmap; *m_bitmap = *aItem->m_bitmap; m_Scale = aItem->m_Scale; m_Scale = aItem->m_Scale; m_ppi = aItem->m_ppi; m_pixelScaleFactor = aItem->m_pixelScaleFactor; m_pixelScaleFactor = aItem->m_pixelScaleFactor; } } Loading common/page_layout/class_worksheet_dataitem.cpp +34 −0 Original line number Original line Diff line number Diff line Loading @@ -540,4 +540,38 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize() } } } } /* set the pixel scale factor of the bitmap * this factor depend on the application internal unit * and the PPI bitmap factor * the pixel scale factor should be initialized before drawing the bitmap */ void WORKSHEET_DATAITEM_BITMAP::SetPixelScaleFactor() { if( m_ImageBitmap ) { // m_WSunits2Iu is the page layout unit to application internal unit // i.e. the mm to to application internal unit // however the bitmap definition is always known in pixels per inches double scale = m_WSunits2Iu * 25.4 / m_ImageBitmap->GetPPI(); m_ImageBitmap->SetPixelScaleFactor( scale ); } } /* return the PPI of the bitmap */ int WORKSHEET_DATAITEM_BITMAP::GetPPI() const { if( m_ImageBitmap ) return m_ImageBitmap->GetPPI() / m_ImageBitmap->m_Scale; return 300; } /*adjust the PPI of the bitmap */ void WORKSHEET_DATAITEM_BITMAP::SetPPI( int aBitmapPPI ) { if( m_ImageBitmap ) m_ImageBitmap->m_Scale = (double) m_ImageBitmap->GetPPI() / aBitmapPPI; } include/class_bitmap_base.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ private: // to convert the bitmap size (in pixels) // to convert the bitmap size (in pixels) // to internal KiCad units // to internal KiCad units // Usually does not change // Usually does not change int m_ppi; // the bitmap definition. the default is 300PPI public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); Loading Loading @@ -128,7 +129,7 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); */ */ int GetPPI() const int GetPPI() const { { return 300; return m_ppi; } } /** /** Loading include/class_worksheet_dataitem.h +12 −11 Original line number Original line Diff line number Diff line Loading @@ -485,6 +485,17 @@ public: */ */ virtual bool HasEndPoint() { return false; } virtual bool HasEndPoint() { return false; } /** * @return the PPI of the bitmap */ int GetPPI() const; /** * adjust the PPI of the bitmap * @param aBitmapPPI = the ned PPI for the bitmap */ void SetPPI( int aBitmapPPI ); /** /** * set the pixel scale factor of the bitmap * set the pixel scale factor of the bitmap * this factor depend on the application internal unit * this factor depend on the application internal unit Loading @@ -492,17 +503,7 @@ public: * the pixel scale factor is the pixel size to application internal unit * the pixel scale factor is the pixel size to application internal unit * and should be initialized before printing or drawing the bitmap * and should be initialized before printing or drawing the bitmap */ */ void SetPixelScaleFactor() void SetPixelScaleFactor(); { if( m_ImageBitmap ) { // m_WSunits2Iu is the page layout unit to application internal unit // i.e. the mm to to application internal unit // however the bitmap definition is always known in pixels per inches double scale = m_WSunits2Iu * 25.4 / m_ImageBitmap->GetPPI(); m_ImageBitmap->SetPixelScaleFactor( scale ); } } }; }; Loading pagelayout_editor/dialogs/properties_frame_base.cpp +20 −9 Original line number Original line Diff line number Diff line Loading @@ -317,28 +317,27 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c bSizerMain->Add( m_SizerEndPosition, 0, 0, 5 ); bSizerMain->Add( m_SizerEndPosition, 0, 0, 5 ); wxBoxSizer* bSizerLineThickness; m_SizerLineThickness = new wxBoxSizer( wxHORIZONTAL ); bSizerLineThickness = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bSizerthickness; wxBoxSizer* bSizerThickness; bSizerthickness = new wxBoxSizer( wxVERTICAL ); bSizerThickness = new wxBoxSizer( wxVERTICAL ); m_staticTextThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextThickness->Wrap( -1 ); m_staticTextThickness->Wrap( -1 ); bSizerthickness->Add( m_staticTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bSizerThickness->Add( m_staticTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerthickness->Add( m_textCtrlThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerThickness->Add( m_textCtrlThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerLineThickness->Add( bSizerthickness, 0, wxEXPAND, 5 ); m_SizerLineThickness->Add( bSizerThickness, 0, wxEXPAND, 5 ); m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 to use default"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 to use default"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoThickness->Wrap( -1 ); m_staticTextInfoThickness->Wrap( -1 ); bSizerLineThickness->Add( m_staticTextInfoThickness, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); m_SizerLineThickness->Add( m_staticTextInfoThickness, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); bSizerMain->Add( bSizerLineThickness, 0, 0, 5 ); bSizerMain->Add( m_SizerLineThickness, 0, 0, 5 ); m_SizerRotation = new wxBoxSizer( wxVERTICAL ); m_SizerRotation = new wxBoxSizer( wxVERTICAL ); Loading @@ -361,6 +360,18 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c bSizerMain->Add( m_SizerRotation, 0, wxEXPAND, 5 ); bSizerMain->Add( m_SizerRotation, 0, wxEXPAND, 5 ); m_SizerBitmapPPI = new wxBoxSizer( wxHORIZONTAL ); m_staticTextBitmapPPI = new wxStaticText( m_swItemProperties, wxID_ANY, _("Bitmap PPI"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextBitmapPPI->Wrap( -1 ); m_SizerBitmapPPI->Add( m_staticTextBitmapPPI, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); m_textCtrlBitmapPPI = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_SizerBitmapPPI->Add( m_textCtrlBitmapPPI, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); bSizerMain->Add( m_SizerBitmapPPI, 0, wxEXPAND, 5 ); m_staticline4 = new wxStaticLine( m_swItemProperties, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline4 = new wxStaticLine( m_swItemProperties, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizerMain->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerMain->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); Loading Loading
common/class_bitmap_base.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -49,8 +49,9 @@ BITMAP_BASE::BITMAP_BASE( const wxPoint& pos ) m_Scale = 1.0; // 1.0 = original bitmap size m_Scale = 1.0; // 1.0 = original bitmap size m_bitmap = NULL; m_bitmap = NULL; m_image = NULL; m_image = NULL; m_pixelScaleFactor = 3.33; // a value OK for bitmaps using 300 PPI m_ppi = 300; // the bitmap definition. the default is 300PPI // (Eeschema uses currently 1000PPI m_pixelScaleFactor = 1000.0 / m_ppi; // a value OK for bitmaps using 300 PPI // for Eeschema which uses currently 1000PPI } } Loading @@ -72,6 +73,7 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem ) *m_image = *aItem->m_image; *m_image = *aItem->m_image; *m_bitmap = *aItem->m_bitmap; *m_bitmap = *aItem->m_bitmap; m_Scale = aItem->m_Scale; m_Scale = aItem->m_Scale; m_ppi = aItem->m_ppi; m_pixelScaleFactor = aItem->m_pixelScaleFactor; m_pixelScaleFactor = aItem->m_pixelScaleFactor; } } Loading
common/page_layout/class_worksheet_dataitem.cpp +34 −0 Original line number Original line Diff line number Diff line Loading @@ -540,4 +540,38 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize() } } } } /* set the pixel scale factor of the bitmap * this factor depend on the application internal unit * and the PPI bitmap factor * the pixel scale factor should be initialized before drawing the bitmap */ void WORKSHEET_DATAITEM_BITMAP::SetPixelScaleFactor() { if( m_ImageBitmap ) { // m_WSunits2Iu is the page layout unit to application internal unit // i.e. the mm to to application internal unit // however the bitmap definition is always known in pixels per inches double scale = m_WSunits2Iu * 25.4 / m_ImageBitmap->GetPPI(); m_ImageBitmap->SetPixelScaleFactor( scale ); } } /* return the PPI of the bitmap */ int WORKSHEET_DATAITEM_BITMAP::GetPPI() const { if( m_ImageBitmap ) return m_ImageBitmap->GetPPI() / m_ImageBitmap->m_Scale; return 300; } /*adjust the PPI of the bitmap */ void WORKSHEET_DATAITEM_BITMAP::SetPPI( int aBitmapPPI ) { if( m_ImageBitmap ) m_ImageBitmap->m_Scale = (double) m_ImageBitmap->GetPPI() / aBitmapPPI; }
include/class_bitmap_base.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ private: // to convert the bitmap size (in pixels) // to convert the bitmap size (in pixels) // to internal KiCad units // to internal KiCad units // Usually does not change // Usually does not change int m_ppi; // the bitmap definition. the default is 300PPI public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); Loading Loading @@ -128,7 +129,7 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); */ */ int GetPPI() const int GetPPI() const { { return 300; return m_ppi; } } /** /** Loading
include/class_worksheet_dataitem.h +12 −11 Original line number Original line Diff line number Diff line Loading @@ -485,6 +485,17 @@ public: */ */ virtual bool HasEndPoint() { return false; } virtual bool HasEndPoint() { return false; } /** * @return the PPI of the bitmap */ int GetPPI() const; /** * adjust the PPI of the bitmap * @param aBitmapPPI = the ned PPI for the bitmap */ void SetPPI( int aBitmapPPI ); /** /** * set the pixel scale factor of the bitmap * set the pixel scale factor of the bitmap * this factor depend on the application internal unit * this factor depend on the application internal unit Loading @@ -492,17 +503,7 @@ public: * the pixel scale factor is the pixel size to application internal unit * the pixel scale factor is the pixel size to application internal unit * and should be initialized before printing or drawing the bitmap * and should be initialized before printing or drawing the bitmap */ */ void SetPixelScaleFactor() void SetPixelScaleFactor(); { if( m_ImageBitmap ) { // m_WSunits2Iu is the page layout unit to application internal unit // i.e. the mm to to application internal unit // however the bitmap definition is always known in pixels per inches double scale = m_WSunits2Iu * 25.4 / m_ImageBitmap->GetPPI(); m_ImageBitmap->SetPixelScaleFactor( scale ); } } }; }; Loading
pagelayout_editor/dialogs/properties_frame_base.cpp +20 −9 Original line number Original line Diff line number Diff line Loading @@ -317,28 +317,27 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c bSizerMain->Add( m_SizerEndPosition, 0, 0, 5 ); bSizerMain->Add( m_SizerEndPosition, 0, 0, 5 ); wxBoxSizer* bSizerLineThickness; m_SizerLineThickness = new wxBoxSizer( wxHORIZONTAL ); bSizerLineThickness = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bSizerthickness; wxBoxSizer* bSizerThickness; bSizerthickness = new wxBoxSizer( wxVERTICAL ); bSizerThickness = new wxBoxSizer( wxVERTICAL ); m_staticTextThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextThickness->Wrap( -1 ); m_staticTextThickness->Wrap( -1 ); bSizerthickness->Add( m_staticTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bSizerThickness->Add( m_staticTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerthickness->Add( m_textCtrlThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerThickness->Add( m_textCtrlThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerLineThickness->Add( bSizerthickness, 0, wxEXPAND, 5 ); m_SizerLineThickness->Add( bSizerThickness, 0, wxEXPAND, 5 ); m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 to use default"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 to use default"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoThickness->Wrap( -1 ); m_staticTextInfoThickness->Wrap( -1 ); bSizerLineThickness->Add( m_staticTextInfoThickness, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); m_SizerLineThickness->Add( m_staticTextInfoThickness, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); bSizerMain->Add( bSizerLineThickness, 0, 0, 5 ); bSizerMain->Add( m_SizerLineThickness, 0, 0, 5 ); m_SizerRotation = new wxBoxSizer( wxVERTICAL ); m_SizerRotation = new wxBoxSizer( wxVERTICAL ); Loading @@ -361,6 +360,18 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c bSizerMain->Add( m_SizerRotation, 0, wxEXPAND, 5 ); bSizerMain->Add( m_SizerRotation, 0, wxEXPAND, 5 ); m_SizerBitmapPPI = new wxBoxSizer( wxHORIZONTAL ); m_staticTextBitmapPPI = new wxStaticText( m_swItemProperties, wxID_ANY, _("Bitmap PPI"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextBitmapPPI->Wrap( -1 ); m_SizerBitmapPPI->Add( m_staticTextBitmapPPI, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); m_textCtrlBitmapPPI = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_SizerBitmapPPI->Add( m_textCtrlBitmapPPI, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); bSizerMain->Add( m_SizerBitmapPPI, 0, wxEXPAND, 5 ); m_staticline4 = new wxStaticLine( m_swItemProperties, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline4 = new wxStaticLine( m_swItemProperties, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizerMain->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerMain->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); Loading