Commit ed5585eb authored by jean-pierre charras's avatar jean-pierre charras

Libedit: fix bug (svg export does not work)

other minor fixes.
parent f13e0203
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <online_help.h> #include <online_help.h>
#include <id.h> #include <id.h>
#include <confirm.h>
#include <eda_doc.h> #include <eda_doc.h>
#include <wxstruct.h> #include <wxstruct.h>
#include <macros.h> #include <macros.h>
...@@ -310,7 +309,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, ...@@ -310,7 +309,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
if( !wxFileName::FileExists( fn ) ) if( !wxFileName::FileExists( fn ) )
{ {
msg = type + _( " file <" ) + fn + _( "> was not found." ); msg = type + _( " file <" ) + fn + _( "> was not found." );
DisplayError( this, msg ); wxMessageBox( msg );
fileHistory->RemoveFileFromHistory( i ); fileHistory->RemoveFileFromHistory( i );
fn = wxEmptyString; fn = wxEmptyString;
} }
...@@ -349,7 +348,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -349,7 +348,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{ {
msg.Printf( _( "Help file %s could not be found." ), msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().GetHelpFileName() ) ); GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg ); wxMessageBox( msg );
} }
else else
{ {
...@@ -376,7 +375,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -376,7 +375,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
else else
{ {
msg.Printf( _( "Help file %s not found." ), GetChars( wxGetApp().GetHelpFileName() ) ); msg.Printf( _( "Help file %s not found." ), GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg ); wxMessageBox( msg );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
...@@ -386,7 +385,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -386,7 +385,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{ {
msg.Printf( _( "Help file %s could not be found." ), msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().GetHelpFileName() ) ); GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg ); wxMessageBox( msg );
} }
else else
{ {
...@@ -589,7 +588,7 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName ) ...@@ -589,7 +588,7 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
if( !msg.IsEmpty() ) if( !msg.IsEmpty() )
{ {
DisplayError( this, msg ); wxMessageBox( msg );
return false; return false;
} }
...@@ -643,7 +642,7 @@ edits you made?" ), ...@@ -643,7 +642,7 @@ edits you made?" ),
if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) ) if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{ {
msg = _( "Could not create backup file " ) + backupFileName.GetFullPath(); msg = _( "Could not create backup file " ) + backupFileName.GetFullPath();
DisplayError( this, msg ); wxMessageBox( msg );
} }
} }
......
install(DIRECTORY complex_hierarchy ecc83 electric flat_hierarchy interf_u microwave install(DIRECTORY complex_hierarchy ecc83 electric flat_hierarchy
kit-dev-coldfire-xilinx_5213 interf_u microwave
pic_programmer pspice "sonde xilinx" test_xil_95108 video pic_programmer pspice "sonde xilinx" test_xil_95108 video
DESTINATION ${KICAD_DEMOS} DESTINATION ${KICAD_DEMOS}
COMPONENT resources COMPONENT resources
......
...@@ -228,7 +228,13 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -228,7 +228,13 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
screen->Draw( panel, &dc, GR_COPY ); if( frame->IsType( SCHEMATIC_FRAME ) )
screen->Draw( panel, &dc, GR_COPY );
if( frame->IsType( LIBEDITOR_FRAME ) )
((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc,
wxPoint(sheetSize.x/2,
sheetSize.y/2) );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness ); frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
......
...@@ -250,13 +250,8 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib ...@@ -250,13 +250,8 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib
} }
void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void LIB_EDIT_FRAME::RedrawComponent( wxDC* aDC, wxPoint aOffset )
{ {
if( GetScreen() == NULL )
return;
m_canvas->DrawBackGround( DC );
if( m_component ) if( m_component )
{ {
// display reference like in schematic (a reference U is shown U? or U?A) // display reference like in schematic (a reference U is shown U? or U?A)
...@@ -266,10 +261,20 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -266,10 +261,20 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
wxString fieldText = Field->m_Text; wxString fieldText = Field->m_Text;
wxString fieldfullText = Field->GetFullText( m_unit ); wxString fieldfullText = Field->GetFullText( m_unit );
Field->m_Text = fieldfullText; Field->m_Text = fieldfullText;
m_component->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_component->Draw( m_canvas, aDC, aOffset, m_unit,
m_convert, GR_DEFAULT_DRAWMODE ); m_convert, GR_DEFAULT_DRAWMODE );
Field->m_Text = fieldText; Field->m_Text = fieldText;
} }
}
void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( GetScreen() == NULL )
return;
m_canvas->DrawBackGround( DC );
RedrawComponent( DC, wxPoint( 0, 0 ) );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <general.h> #include <general.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <dialogs/dialog_SVG_print.h>
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
...@@ -128,6 +129,11 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j ...@@ -128,6 +129,11 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
} }
void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName )
{
DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() );
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData) void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData)
{ {
if( ! m_component ) if( ! m_component )
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include <hotkeys.h> #include <hotkeys.h>
#include <dialogs/dialog_lib_edit_text.h> #include <dialogs/dialog_lib_edit_text.h>
#include <dialogs/dialog_SVG_print.h>
#include <dialogs/dialog_edit_component_in_lib.h> #include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_libedit_dimensions.h> #include <dialogs/dialog_libedit_dimensions.h>
...@@ -926,11 +925,6 @@ void LIB_EDIT_FRAME::ClearTempCopyComponent() ...@@ -926,11 +925,6 @@ void LIB_EDIT_FRAME::ClearTempCopyComponent()
} }
void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName )
{
DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() );
}
void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem ) void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
{ {
......
...@@ -247,7 +247,26 @@ public: ...@@ -247,7 +247,26 @@ public:
*/ */
void DisplayLibInfos(); void DisplayLibInfos();
/**
* Function RedrawComponent
* Redraw the current component loaded in library editor
* Display reference like in schematic (a reference U is shown U? or U?A)
* accordint to the current selected unit and De Morgan selection
* although it is stored without ? and part id.
* @param aDC = the current device context
* @param aOffset = a draw offset. usually à,0 to draw on the screen, but
* can be set to page size / 2 to draw or print in SVG format.
*/
void RedrawComponent( wxDC* aDC, wxPoint aOffset );
/**
* Function RedrawActiveWindow
* Redraw the current component loaded in library editor, an axes
* Display reference like in schematic (a reference U is shown U? or U?A)
* update status bar and info shown in the bottom of the window
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
......
...@@ -530,7 +530,9 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -530,7 +530,9 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return true; return true;
} }
// note: SCH_SCREEN::Draw is useful only for schematic.
// library editor and library viewer do not use a draw list, and therefore
// SCH_SCREEN::Draw draws nothing
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aColor ) void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aColor )
{ {
for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() ) for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() )
......
// /////////////////////////////////////////////////////////////////////////// /*
// Name: dialog_mask_clearance.cpp * This program source code file is part of KiCad, a free EDA CAD application.
// Author: jean-pierre Charras *
// Modified by: * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
// Created: 17 feb 2009 *
// Licence: GPL * This program is free software; you can redistribute it and/or
// /////////////////////////////////////////////////////////////////////////// * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_mask_clearance.cpp
*/
#include <fctsys.h> #include <fctsys.h>
#include <confirm.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
......
...@@ -155,6 +155,10 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -155,6 +155,10 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
frame->Zoom_Automatique( true ); frame->Zoom_Automatique( true );
// Load config and default values before loading a board file
// Some will be overwritten after loading the board file
frame->LoadProjectSettings( fn.GetFullPath() );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( fn.IsOk() ) if( fn.IsOk() )
{ {
...@@ -180,8 +184,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -180,8 +184,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
} }
} }
frame->LoadProjectSettings( fn.GetFullPath() );
// update the layer names in the listbox // update the layer names in the listbox
frame->ReCreateLayerBox( NULL ); frame->ReCreateLayerBox( NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment