From 2427b402710b24a27e8f7db4527979c5bdd8209f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 12 Mar 2015 18:43:39 +0100 Subject: [PATCH] Fix Bug #1431423 (pcbnew: edited 3d model filename is not saved). Eechema, libedit, pin dialog editor: show pin texts in pin preview canvas. --- eeschema/dialogs/dialog_lib_edit_pin.cpp | 8 ++++---- pcbnew/class_module.cpp | 9 +++++++-- pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp | 11 +++++++++++ pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp | 11 +++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index 1c99632449..dcb691af12 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -84,13 +84,13 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) scale *= 0.9; dc.SetUserScale( scale, scale ); - wxPoint offset = bBox.Centre(); - NEGATE( offset.x ); - NEGATE( offset.y ); + wxPoint offset = -bBox.Centre(); GRResetPenAndBrush( &dc ); + bool drawpinTexts = true; // this is a dummy param. We use its reference + // as non null value for m_dummyPin->Draw m_dummyPin->Draw( NULL, &dc, offset, UNSPECIFIED_COLOR, GR_COPY, - NULL, DefaultTransform ); + &drawpinTexts, DefaultTransform ); m_dummyPin->SetParent(NULL); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 41441e5c19..7b0ca93f8c 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -62,7 +62,7 @@ MODULE::MODULE( BOARD* parent ) : m_CntRot90 = m_CntRot180 = 0; m_Surface = 0.0; m_Link = 0; - m_LastEditTime = time( NULL ); + m_LastEditTime = 0; m_LocalClearance = 0; m_LocalSolderMaskMargin = 0; m_LocalSolderPasteMargin = 0; @@ -551,8 +551,13 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) // Display last date the component was edited (useful in Module Editor). wxDateTime date( m_LastEditTime ); + + if( m_LastEditTime && date.IsValid() ) // Date format: see http://www.cplusplus.com/reference/ctime/strftime - msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year + msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year + else + msg = _( "Unknown" ); + aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) ); // display schematic path diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index cf9f15161f..cb961d4533 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -448,7 +448,18 @@ void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName() if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) return; //Aborted by user +#ifdef __WINDOWS__ + // In Kicad files, filenames and paths are stored using Unix notation + // So be sure the unix notation is still used + filename.Replace( wxT( "\\" ), wxT( "/" ) ); +#endif + m_3D_ShapeNameListBox->SetString( idx, filename ); + + S3D_MASTER* new3DShape = new S3D_MASTER( NULL ); + new3DShape->SetShape3DName( filename ); + delete m_Shapes3D_list[idx]; + m_Shapes3D_list[idx] = new3DShape; } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index e2186c5f0f..cddef8afbb 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -310,7 +310,18 @@ void DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName() if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) return; //Aborted by user +#ifdef __WINDOWS__ + // In Kicad files, filenames and paths are stored using Unix notation + // So be sure the unix notation is still used + filename.Replace( wxT( "\\" ), wxT( "/" ) ); +#endif + m_3D_ShapeNameListBox->SetString( idx, filename ); + + S3D_MASTER* new3DShape = new S3D_MASTER( NULL ); + new3DShape->SetShape3DName( filename ); + delete m_shapes3D_list[idx]; + m_shapes3D_list[idx] = new3DShape; }