Libedit: fix bug (svg export does not work)

other minor fixes.
This commit is contained in:
jean-pierre charras 2012-03-06 15:08:59 +01:00
parent f13e020314
commit ed5585eb6c
11 changed files with 962 additions and 911 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,6 @@
#include <appl_wxstruct.h>
#include <online_help.h>
#include <id.h>
#include <confirm.h>
#include <eda_doc.h>
#include <wxstruct.h>
#include <macros.h>
@ -310,7 +309,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
if( !wxFileName::FileExists( fn ) )
{
msg = type + _( " file <" ) + fn + _( "> was not found." );
DisplayError( this, msg );
wxMessageBox( msg );
fileHistory->RemoveFileFromHistory( i );
fn = wxEmptyString;
}
@ -349,7 +348,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{
msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg );
wxMessageBox( msg );
}
else
{
@ -376,7 +375,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
else
{
msg.Printf( _( "Help file %s not found." ), GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg );
wxMessageBox( msg );
}
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
@ -386,7 +385,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{
msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg );
wxMessageBox( msg );
}
else
{
@ -589,7 +588,7 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
if( !msg.IsEmpty() )
{
DisplayError( this, msg );
wxMessageBox( msg );
return false;
}
@ -643,7 +642,7 @@ edits you made?" ),
if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg = _( "Could not create backup file " ) + backupFileName.GetFullPath();
DisplayError( this, msg );
wxMessageBox( msg );
}
}

View File

@ -1,4 +1,5 @@
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
DESTINATION ${KICAD_DEMOS}
COMPONENT resources

View File

@ -228,7 +228,13 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
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 )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );

View File

@ -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 )
{
// 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 )
wxString fieldText = Field->m_Text;
wxString fieldfullText = Field->GetFullText( m_unit );
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 );
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() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );

View File

@ -15,6 +15,7 @@
#include <general.h>
#include <libeditframe.h>
#include <class_library.h>
#include <dialogs/dialog_SVG_print.h>
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
@ -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)
{
if( ! m_component )

View File

@ -47,7 +47,6 @@
#include <hotkeys.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_libedit_dimensions.h>
@ -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 )
{

View File

@ -247,7 +247,26 @@ public:
*/
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 OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();

View File

@ -530,7 +530,9 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
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 )
{
for( SCH_ITEM* item = m_drawList.begin(); item != NULL; item = item->Next() )

View File

@ -1,13 +1,30 @@
// ///////////////////////////////////////////////////////////////////////////
// Name: dialog_mask_clearance.cpp
// Author: jean-pierre Charras
// Modified by:
// Created: 17 feb 2009
// Licence: GPL
// ///////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 <confirm.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>

View File

@ -155,6 +155,10 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
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. */
if( fn.IsOk() )
{
@ -180,8 +184,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
}
}
frame->LoadProjectSettings( fn.GetFullPath() );
// update the layer names in the listbox
frame->ReCreateLayerBox( NULL );