* Some bugs fixed
* Starting enhancements in Libedit: menubar and commands to "plot" current component in PNG or SVF file (SVG file not fully working, must be refined)
This commit is contained in:
charras 2010-03-18 20:35:29 +00:00
parent 2c15036eb3
commit 7f23d262f2
30 changed files with 1663 additions and 876 deletions

View File

@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-mar-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Eeschema
Some bugs fixed
Starting enhancements in Libedit: menubar and commands to "plot"
current component in PNG or SVF file (SVG file not fully working, must be refined)
2010-mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++ All: ++ All:

View File

@ -6,10 +6,10 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-03-13)" #define KICAD_BUILD_VERSION "(2010-03-17)"
#endif #endif
#define VERSION_STABILITY "final" #define VERSION_STABILITY "unstable"
/** Function GetBuildVersion() /** Function GetBuildVersion()
* Return the build date and version * Return the build date and version

View File

@ -18,7 +18,7 @@
static const bool s_PlotBlackAndWhite = FALSE; static const bool s_PlotBlackAndWhite = FALSE;
static const bool Print_Sheet_Ref = TRUE; static const bool Print_Sheet_Ref = TRUE;
static bool DrawPage( WinEDA_DrawPanel* panel ); static bool DrawPage( WinEDA_DrawFrame* aFrame );
/* calls the function to copy the current page or the current bock to /* calls the function to copy the current page or the current bock to
@ -26,7 +26,7 @@ static bool DrawPage( WinEDA_DrawPanel* panel );
*/ */
void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event ) void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
{ {
DrawPage( DrawPanel ); DrawPage( this );
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
@ -43,7 +43,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
* to export drawings to other applications (word processing ...) * to export drawings to other applications (word processing ...)
* This is not suitable for copy command within eeschema or pcbnew * This is not suitable for copy command within eeschema or pcbnew
*/ */
bool DrawPage( WinEDA_DrawPanel* panel ) bool DrawPage( WinEDA_DrawFrame* aFrame )
{ {
bool success = TRUE; bool success = TRUE;
@ -55,10 +55,10 @@ bool DrawPage( WinEDA_DrawPanel* panel )
int ClipboardSizeX, ClipboardSizeY; int ClipboardSizeX, ClipboardSizeY;
bool DrawBlock = FALSE; bool DrawBlock = FALSE;
wxRect DrawArea; wxRect DrawArea;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen();
/* scale is the ratio resolution/internal units */ /* scale is the ratio resolution/internal units */
float scale = 82.0 / panel->GetParent()->m_InternalUnits; float scale = 82.0 / aFrame->m_InternalUnits;
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE ) if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
@ -80,25 +80,26 @@ bool DrawPage( WinEDA_DrawPanel* panel )
wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/; wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/;
EDA_Rect tmp = panel->m_ClipBox; EDA_Rect tmp = aFrame->DrawPanel->m_ClipBox;
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
GRForceBlackPen( s_PlotBlackAndWhite ); GRForceBlackPen( s_PlotBlackAndWhite );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
dc.SetUserScale( scale, scale ); dc.SetUserScale( scale, scale );
ClipboardSizeX = dc.MaxX() + 10; ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10; ClipboardSizeY = dc.MaxY() + 10;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 ); aFrame->DrawPanel->m_ClipBox.SetX( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); aFrame->DrawPanel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); aFrame->DrawPanel->m_ClipBox.SetWidth( 0x7FFFFF0 );
aFrame->DrawPanel->m_ClipBox.SetHeight( 0x7FFFFF0 );
if( DrawBlock ) if( DrawBlock )
{ {
dc.SetClippingRegion( DrawArea ); dc.SetClippingRegion( DrawArea );
} }
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false, NULL ); aFrame->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; aFrame->DrawPanel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close(); wxMetafile* mf = dc.Close();
if( mf ) if( mf )

View File

@ -30,7 +30,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
wxString m_PageSizeBoxChoices[] = { _("Size A4"), _("Size A3"), _("Size A2"), _("Size A1"), _("Size A0"), _("Size A"), _("Size B"), _("Size C"), _("Size D"), _("Size E"), _("User size") }; wxString m_PageSizeBoxChoices[] = { _("Size A4"), _("Size A3"), _("Size A2"), _("Size A1"), _("Size A0"), _("Size A"), _("Size B"), _("Size C"), _("Size D"), _("Size E"), _("User size") };
int m_PageSizeBoxNChoices = sizeof( m_PageSizeBoxChoices ) / sizeof( wxString ); int m_PageSizeBoxNChoices = sizeof( m_PageSizeBoxChoices ) / sizeof( wxString );
m_PageSizeBox = new wxRadioBox( this, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS ); m_PageSizeBox = new wxRadioBox( this, wxID_ANY, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS );
m_PageSizeBox->SetSelection( 1 ); m_PageSizeBox->SetSelection( 1 );
LeftColumnSizer->Add( m_PageSizeBox, 0, wxALL|wxEXPAND, 5 ); LeftColumnSizer->Add( m_PageSizeBox, 0, wxALL|wxEXPAND, 5 );

View File

@ -113,7 +113,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">wxRadioBox</property> <property name="label">Page Size:</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>

View File

@ -184,6 +184,18 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
{ {
} }
/** Virtual function PrintPage
* used to print a page
* this basic function must be derived to be used for printing
* because WinEDA_DrawFrame does not know how to print a page
* This is the reason it is a virtual function
*/
void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData)
{
wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error"));
}
// Virtual function // Virtual function
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )

View File

@ -91,12 +91,14 @@ set(EESCHEMA_SRCS
libeditframe.cpp libeditframe.cpp
libedit_onleftclick.cpp libedit_onleftclick.cpp
libedit_onrightclick.cpp libedit_onrightclick.cpp
libedit_plot_component.cpp
libedit_undo_redo.cpp libedit_undo_redo.cpp
lib_export.cpp lib_export.cpp
libfield.cpp libfield.cpp
load_one_schematic_file.cpp load_one_schematic_file.cpp
locate.cpp locate.cpp
menubar.cpp menubar.cpp
menubar_libedit.cpp
netform.cpp netform.cpp
netlist_control.cpp netlist_control.cpp
netlist.cpp netlist.cpp

View File

@ -229,15 +229,15 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetX( -0x3FFFFF0 );
panel->m_ClipBox.SetY( 0 ); panel->m_ClipBox.SetY( -0x3FFFFF0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed
// to print floating point numbers like 1.3) // to print floating point numbers like 1.3)
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false, NULL ); m_Parent->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
SetLocaleTo_Default( ); // revert to the current locale SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;

View File

@ -65,7 +65,7 @@ void DialogLabelEditor::InitDialog()
wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER ); wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER );
m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") ); m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
m_textLabel->SetMinSize( wxSize( -1, 60 ) ); m_textLabel->SetMinSize( wxSize( -1, 60 ) );
m_textControlSizer->Insert( 1, m_textLabel, 0, wxLEFT | wxEXPAND, 3 ); m_textControlSizer->wxSizer::Insert( 1, m_textLabel, 0, wxLEFT | wxEXPAND, 3 );
multiLine = true; multiLine = true;
} }

View File

@ -380,7 +380,7 @@ void SCH_PRINTOUT::DrawPage()
wxBitmap psuedoBitmap( 1, 1 ); wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC; wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap ); memDC.SelectObject( psuedoBitmap );
panel->PrintPage( &memDC, true, 0xFFFFFFFF, false, NULL ); parent->PrintPage( &memDC, true, 0xFFFFFFFF, false );
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ), wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() ); memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
@ -408,7 +408,7 @@ void SCH_PRINTOUT::DrawPage()
ActiveScreen->m_IsPrinting = true; ActiveScreen->m_IsPrinting = true;
int bg_color = g_DrawBgColor; int bg_color = g_DrawBgColor;
panel->PrintPage( dc, printReference, 0xFFFFFFFF, false, NULL ); parent->PrintPage( dc, printReference, 0xFFFFFFFF, false );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
ActiveScreen->m_IsPrinting = false; ActiveScreen->m_IsPrinting = false;

View File

@ -157,7 +157,7 @@ void DIALOG_SCH_FIND::SetFindEntries( const wxArrayString& aEntries )
{ {
m_comboFind->Append( aEntries ); m_comboFind->Append( aEntries );
if( !m_comboFind->IsEmpty() ) if( m_comboFind->GetCount() )
m_comboFind->SetSelection( 0 ); m_comboFind->SetSelection( 0 );
} }
@ -166,6 +166,6 @@ void DIALOG_SCH_FIND::SetReplaceEntries( const wxArrayString& aEntries )
{ {
m_comboReplace->Append( aEntries ); m_comboReplace->Append( aEntries );
if( !m_comboReplace->IsEmpty() ) if( m_comboReplace->GetCount() )
m_comboReplace->SetSelection( 0 ); m_comboReplace->SetSelection( 0 );
} }

View File

@ -94,16 +94,16 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here) * @param aData = a pointer on an auxiliary data (not used here)
*/ */
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, void WinEDA_SchematicFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode, int aPrintMask, bool aPrintMirrorMode,
void * aData) void * aData)
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
RedrawStructList( this, aDC, ActiveScreen->EEDrawList, GR_COPY ); RedrawStructList( DrawPanel, aDC, ActiveScreen->EEDrawList, GR_COPY );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness ); TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
wxEndBusyCursor(); wxEndBusyCursor();
} }

View File

@ -62,7 +62,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
break; break;
LoadProjectFile( fn.GetFullPath(), TRUE ); LoadProjectFile( dlg.GetPath(), TRUE );
} }
break; break;

View File

@ -175,6 +175,11 @@ enum id_eeschema_frm
ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT,
/* Library editor menubar IDs */
ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
ID_LIBEDIT_GEN_PNG_FILE,
ID_LIBEDIT_GEN_SVG_FILE,
/* Library viewer horizontal toolbar IDs */ /* Library viewer horizontal toolbar IDs */
ID_LIBVIEW_NEXT, ID_LIBVIEW_NEXT,
ID_LIBVIEW_PREVIOUS, ID_LIBVIEW_PREVIOUS,

View File

@ -94,7 +94,15 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
CreateScreens(); CreateScreens();
screen = (SCH_SCREEN*) GetScreen(); screen = (SCH_SCREEN*) GetScreen();
wxSetWorkingDirectory( wxPathOnly( FullFileName ) ); wxFileName fn = FullFileName;
if( fn.IsRelative() )
{
fn.MakeAbsolute();
FullFileName = fn.GetFullPath();
}
wxLogDebug( wxT( "Loading schematic " ) + FullFileName );
wxSetWorkingDirectory( fn.GetPath() );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
g_RootSheet->SetFileName( FullFileName ); g_RootSheet->SetFileName( FullFileName );
SetStatusText( wxEmptyString ); SetStatusText( wxEmptyString );
@ -150,7 +158,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
* so if the <name>-cache.lib is not found, the old way will be tried * so if the <name>-cache.lib is not found, the old way will be tried
*/ */
bool use_oldcachename = false; bool use_oldcachename = false;
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName; fn = g_RootSheet->m_AssociatedScreen->m_FileName;
wxString cachename = fn.GetName() + wxT("-cache"); wxString cachename = fn.GetName() + wxT("-cache");
fn.SetName( cachename ); fn.SetName( cachename );
fn.SetExt( CompLibFileExtension ); fn.SetExt( CompLibFileExtension );

View File

@ -5,6 +5,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "appl_wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
@ -248,12 +249,34 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
return; return;
} }
fn = wxFileName( m_library->GetFullFileName() ); if( event.GetId() == ID_LIBEDIT_SAVE_CURRENT_LIB_AS )
{ // Get a new name for the library
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Component Library Name:" ), default_path,
wxEmptyString, CompLibFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
msg = _( "Modify library file \"" ) + fn.GetFullPath() + _( "\"?" ); if( dlg.ShowModal() == wxID_CANCEL )
return;
if( !IsOK( this, msg ) ) fn = dlg.GetPath();
return;
/* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */
if( fn.GetExt().IsEmpty() )
fn.SetExt( SymbolFileExtension );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
}
else
{
fn = wxFileName( m_library->GetFullFileName() );
msg = _( "Modify library file \"" ) + fn.GetFullPath() + _( "\"?" );
if( !IsOK( this, msg ) )
return;
}
bool success = m_library->Save( fn.GetFullPath(), true ); bool success = m_library->Save( fn.GetFullPath(), true );

View File

@ -0,0 +1,115 @@
/*******************************************/
/* EESchema - libedit_plot_component.cpp */
/*******************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "appl_wxstruct.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gestfich.h"
#include "eeschema_id.h"
#include "program.h"
#include "general.h"
//#include "protos.h"
#include "libeditframe.h"
#include "class_library.h"
/** function OnPlotCurrentComponent
* plot in SVG or PNG format the curren component
*/
void WinEDA_LibeditFrame::OnPlotCurrentComponent( wxCommandEvent& event )
{
LIB_COMPONENT* cmp = GetComponent();
if( cmp == NULL )
{
wxMessageBox( _( "No component" ) );
return;
}
switch( event.GetId() )
{
case ID_LIBEDIT_GEN_PNG_FILE:
{
bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
wxString mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
wxString FullFileName =
EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
if( FullFileName.IsEmpty() )
return;
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
}
break;
case ID_LIBEDIT_GEN_SVG_FILE:
GetScreen()->m_FileName = cmp->GetName();
WinEDA_DrawFrame::SVG_Print( event );
break;
}
}
/** function CreatePNGorJPEGFile
* Create an image (screenshot) of the current component.
* Output file format is png or jpeg
* @param aFileName = the full filename
* @param aFmt_jpeg = true to use JPEG file format, false to use PNG file format
*/
void WinEDA_LibeditFrame::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg )
{
wxSize image_size = DrawPanel->GetClientSize();
wxClientDC dc( DrawPanel );
wxBitmap bitmap( image_size.x, image_size.y );
wxMemoryDC memdc;
memdc.SelectObject( bitmap );
memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
memdc.SelectObject( wxNullBitmap );
wxImage image = bitmap.ConvertToImage();
if( !image.SaveFile( aFileName,
aFmt_jpeg ? wxBITMAP_TYPE_JPEG :
wxBITMAP_TYPE_PNG ) )
{
wxString msg;
msg.Printf( _( "Can't save file <%s>" ), GetChars( aFileName ) );
wxMessageBox( msg );
}
image.Destroy();
}
/** Virtual function PrintPage
* used to print a page.
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here)
*/
void WinEDA_LibeditFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData)
{
if( m_component )
m_component->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), m_unit,
m_convert, GR_DEFAULT_DRAWMODE );
}

View File

@ -115,6 +115,16 @@ EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
/* menubar commands */
EVT_MENU( ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
WinEDA_LibeditFrame::SaveActiveLibrary )
EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE,
WinEDA_LibeditFrame::OnPlotCurrentComponent )
EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE,
WinEDA_LibeditFrame::OnPlotCurrentComponent )
EVT_MENU( ID_GENERAL_HELP,
WinEDA_DrawFrame::GetKicadHelp )
/* Context menu events and commands. */ /* Context menu events and commands. */
EVT_MENU( ID_LIBEDIT_EDIT_PIN, WinEDA_LibeditFrame::OnEditPin ) EVT_MENU( ID_LIBEDIT_EDIT_PIN, WinEDA_LibeditFrame::OnEditPin )
@ -192,6 +202,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
DrawPanel->m_Block_Enable = true; DrawPanel->m_Block_Enable = true;
EnsureActiveLibExists(); EnsureActiveLibExists();
ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
DisplayLibInfos(); DisplayLibInfos();

View File

@ -34,12 +34,15 @@ public:
~WinEDA_LibeditFrame(); ~WinEDA_LibeditFrame();
void ReCreateMenuBar();
/** Function EnsureActiveLibExists /** Function EnsureActiveLibExists
* Must be called after the libraries are reloaded * Must be called after the libraries are reloaded
* (for instance after loading a schematic project) * (for instance after loading a schematic project)
*/ */
static void EnsureActiveLibExists(); static void EnsureActiveLibExists();
void OnPlotCurrentComponent( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnImportPart( wxCommandEvent& event ); void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event ); void OnExportPart( wxCommandEvent& event );
@ -263,6 +266,28 @@ protected:
friend class Dialog_BodyGraphicText_Properties; friend class Dialog_BodyGraphicText_Properties;
/** function CreatePNGorJPEGFile
* Create an image (screenshot) of the current component.
* Output file format is png or jpeg
* @param aFileName = the full filename
* @param aFmt_jpeg = true to use JPEG ffile format, false to use PNG file format
*/
void CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg );
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -30,7 +30,7 @@ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
BOARD* Pcb, int drawmode ); BOARD* Pcb, int drawmode );
/** Function PrintPage /** virtual Function PrintPage
* Used to print the board (on printer, or when creating SVF files). * Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context * @param aDC = the print device context
@ -39,7 +39,7 @@ static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (not used here: can be NULL) * @param aData = a pointer to an optional data (not used here: can be NULL)
*/ */
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer, void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer,
bool aPrintMirrorMode, void * aData ) bool aPrintMirrorMode, void * aData )
{ {
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
@ -55,14 +55,14 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintma
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch; DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
g_DisplayPolygonsModeSketch = 0; g_DisplayPolygonsModeSketch = 0;
m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( aDC, GR_COPY, aPrintmasklayer ); Trace_Gerber( aDC, GR_COPY, aPrintmasklayer );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), 0 ); TraceWorkSheet( aDC, GetScreen(), 0 );
m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg; g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;

View File

@ -358,6 +358,17 @@ public:
// currently: do nothing in gerbview. // currently: do nothing in gerbview.
} }
/** Virtual function PrintPage
* used to print a page
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -83,20 +83,6 @@ public:
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
/** Function PrintPage
* Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer
* @param aDC = the print device context
* @param aPrint_Sheet_Ref = true to print frame references
* @param aPrint_Sheet_Ref = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used)
*/
void PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref,
int aPrintMask,
bool aPrintMirrorMode,
void* aData );
/** Function DrawBackGround /** Function DrawBackGround
* @param DC = current Device Context * @param DC = current Device Context

View File

@ -224,6 +224,18 @@ public:
*/ */
void SetSheetNumberAndCount(); void SetSheetNumberAndCount();
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
/** /**
* Show the print dialog * Show the print dialog
*/ */

View File

@ -146,6 +146,19 @@ public:
*/ */
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
void GetKicadAbout( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event );
/** Function IsGridVisible() , virtual /** Function IsGridVisible() , virtual

View File

@ -402,6 +402,19 @@ public:
*/ */
void ClearMsgPanel( void ); void ClearMsgPanel( void );
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
}; };

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -265,7 +265,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like // to print floating point numbers like
// 1.3) // 1.3)
panel->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters); m_Parent->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters);
SetLocaleTo_Default(); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;

View File

@ -6,8 +6,8 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "printout_controler.h" #include "printout_controler.h"
@ -29,7 +29,7 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule,
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (NULL if not used) * @param aData = a pointer to an optional data (NULL if not used)
*/ */
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
bool aPrint_Sheet_Ref, bool aPrint_Sheet_Ref,
int aPrintMaskLayer, int aPrintMaskLayer,
bool aPrintMirrorMode, bool aPrintMirrorMode,
@ -39,8 +39,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int drawmode = GR_COPY; int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
TRACK* pt_piste; TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent; BOARD* Pcb = GetBoard();
BOARD* Pcb = frame->GetBoard();
int defaultPenSize = 50; int defaultPenSize = 50;
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
@ -63,21 +62,21 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
DisplayOpt.DisplayViaFill = false; DisplayOpt.DisplayViaFill = false;
} }
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false; m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
bool nctmp = frame->GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE); bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE);
frame->GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false); GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false);
DisplayOpt.DisplayPadIsol = false; DisplayOpt.DisplayPadIsol = false;
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0; DisplayOpt.DisplayNetNamesMode = 0;
m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
// The OR mode is used in color mode, but be aware the backgroud *must be // The OR mode is used in color mode, but be aware the backgroud *must be
// BLACK. In the print page dialog, we first plrint in BLACK, and after // BLACK. In the print page dialog, we first plrint in BLACK, and after
@ -99,7 +98,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 ) if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
break; break;
item->Draw( this, aDC, drawmode ); item->Draw( DrawPanel, aDC, drawmode );
break; break;
case TYPE_MARKER_PCB: case TYPE_MARKER_PCB:
@ -119,14 +118,14 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int rayon = pt_piste->m_Width >> 1; int rayon = pt_piste->m_Width >> 1;
int color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+pt_piste->m_Shape); int color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+pt_piste->m_Shape);
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox, aDC, GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.x,
pt_piste->m_Start.y, pt_piste->m_Start.y,
rayon, rayon,
0, color, color ); 0, color, color );
} }
else else
pt_piste->Draw( this, aDC, drawmode ); pt_piste->Draw( DrawPanel, aDC, drawmode );
} }
pt_piste = Pcb->m_Zone; pt_piste = Pcb->m_Zone;
@ -134,7 +133,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; continue;
pt_piste->Draw( this, aDC, drawmode ); pt_piste->Draw( DrawPanel, aDC, drawmode );
} }
@ -145,7 +144,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 ) if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 )
continue; continue;
zone->DrawFilledArea( this, aDC, drawmode ); zone->DrawFilledArea( DrawPanel, aDC, drawmode );
} }
// Draw footprints, this is done at last in order to print the pad holes in // Draw footprints, this is done at last in order to print the pad holes in
@ -155,7 +154,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
D_PAD::m_PadSketchModePenSize = defaultPenSize; D_PAD::m_PadSketchModePenSize = defaultPenSize;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
} }
D_PAD::m_PadSketchModePenSize = tmp; D_PAD::m_PadSketchModePenSize = tmp;
@ -179,7 +178,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
diameter = min( SMALL_DRILL, pt_piste->GetDrillValue()); diameter = min( SMALL_DRILL, pt_piste->GetDrillValue());
else else
diameter = pt_piste->GetDrillValue(); diameter = pt_piste->GetDrillValue();
GRFilledCircle( &m_ClipBox, aDC, GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.y, pt_piste->m_Start.x, pt_piste->m_Start.y,
diameter/2, diameter/2,
0, color, color ); 0, color, color );
@ -189,16 +188,16 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
} }
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), defaultPenSize ); TraceWorkSheet( aDC, GetScreen(), defaultPenSize );
m_PrintIsMirrored = false; DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
frame->GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp); GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
} }

View File

@ -280,7 +280,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
g_DrawBgColor = WHITE; g_DrawBgColor = WHITE;
/* when printing in color mode, we use the graphic OR mode that gives the same look as the screen /* when printing in color mode, we use the graphic OR mode that gives the same look as the screen
* But because the backgroud is white when printing, we must use a trick: * But because the background is white when printing, we must use a trick:
* In order to plot on a white background in OR mode we must: * In order to plot on a white background in OR mode we must:
* 1 - Plot all items in black, this creates a local black backgroud * 1 - Plot all items in black, this creates a local black backgroud
* 2 - Plot in OR mode on black "local" background * 2 - Plot in OR mode on black "local" background
@ -288,11 +288,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if( !m_PrintParams.m_Print_Black_and_White ) if( !m_PrintParams.m_Print_Black_and_White )
{ // Creates a "local" black background { // Creates a "local" black background
GRForceBlackPen( true ); GRForceBlackPen( true );
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams ); m_Parent->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
GRForceBlackPen( false ); GRForceBlackPen( false );
} }
panel->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams ); m_Parent->PrintPage( dc, 0, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
m_Parent->GetBaseScreen()->m_IsPrinting = false; m_Parent->GetBaseScreen()->m_IsPrinting = false;