Commit 7f23d262 authored by charras's avatar charras

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)
parent 2c15036e
......@@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++ All:
......
......@@ -6,10 +6,10 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-03-13)"
#define KICAD_BUILD_VERSION "(2010-03-17)"
#endif
#define VERSION_STABILITY "final"
#define VERSION_STABILITY "unstable"
/** Function GetBuildVersion()
* Return the build date and version
......
......@@ -18,7 +18,7 @@
static const bool s_PlotBlackAndWhite = FALSE;
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
......@@ -26,7 +26,7 @@ static bool DrawPage( WinEDA_DrawPanel* panel );
*/
void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
{
DrawPage( DrawPanel );
DrawPage( this );
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 ...)
* This is not suitable for copy command within eeschema or pcbnew
*/
bool DrawPage( WinEDA_DrawPanel* panel )
bool DrawPage( WinEDA_DrawFrame* aFrame )
{
bool success = TRUE;
......@@ -55,10 +55,10 @@ bool DrawPage( WinEDA_DrawPanel* panel )
int ClipboardSizeX, ClipboardSizeY;
bool DrawBlock = FALSE;
wxRect DrawArea;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen();
/* 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 )
{
......@@ -80,25 +80,26 @@ bool DrawPage( WinEDA_DrawPanel* panel )
wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/;
EDA_Rect tmp = panel->m_ClipBox;
EDA_Rect tmp = aFrame->DrawPanel->m_ClipBox;
GRResetPenAndBrush( &dc );
GRForceBlackPen( s_PlotBlackAndWhite );
screen->m_IsPrinting = true;
dc.SetUserScale( scale, scale );
ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
aFrame->DrawPanel->m_ClipBox.SetX( 0 );
aFrame->DrawPanel->m_ClipBox.SetY( 0 );
aFrame->DrawPanel->m_ClipBox.SetWidth( 0x7FFFFF0 );
aFrame->DrawPanel->m_ClipBox.SetHeight( 0x7FFFFF0 );
if( DrawBlock )
{
dc.SetClippingRegion( DrawArea );
}
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false, NULL );
aFrame->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
aFrame->DrawPanel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close();
if( mf )
......
......@@ -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") };
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 );
LeftColumnSizer->Add( m_PageSizeBox, 0, wxALL|wxEXPAND, 5 );
......
......@@ -113,7 +113,7 @@
<property name="font"></property>
<property name="hidden">0</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="maximum_size"></property>
<property name="minimum_size"></property>
......
......@@ -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
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
......
......@@ -91,12 +91,14 @@ set(EESCHEMA_SRCS
libeditframe.cpp
libedit_onleftclick.cpp
libedit_onrightclick.cpp
libedit_plot_component.cpp
libedit_undo_redo.cpp
lib_export.cpp
libfield.cpp
load_one_schematic_file.cpp
locate.cpp
menubar.cpp
menubar_libedit.cpp
netform.cpp
netlist_control.cpp
netlist.cpp
......
......@@ -229,15 +229,15 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : true );
panel->m_ClipBox.SetX( 0 );
panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetX( -0x3FFFFF0 );
panel->m_ClipBox.SetY( -0x3FFFFF0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
screen->m_IsPrinting = true;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed
// 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
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
......
......@@ -65,7 +65,7 @@ void DialogLabelEditor::InitDialog()
wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER );
m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
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;
}
......
......@@ -380,7 +380,7 @@ void SCH_PRINTOUT::DrawPage()
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
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" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
......@@ -408,7 +408,7 @@ void SCH_PRINTOUT::DrawPage()
ActiveScreen->m_IsPrinting = true;
int bg_color = g_DrawBgColor;
panel->PrintPage( dc, printReference, 0xFFFFFFFF, false, NULL );
parent->PrintPage( dc, printReference, 0xFFFFFFFF, false );
g_DrawBgColor = bg_color;
ActiveScreen->m_IsPrinting = false;
......
......@@ -157,7 +157,7 @@ void DIALOG_SCH_FIND::SetFindEntries( const wxArrayString& aEntries )
{
m_comboFind->Append( aEntries );
if( !m_comboFind->IsEmpty() )
if( m_comboFind->GetCount() )
m_comboFind->SetSelection( 0 );
}
......@@ -166,6 +166,6 @@ void DIALOG_SCH_FIND::SetReplaceEntries( const wxArrayString& aEntries )
{
m_comboReplace->Append( aEntries );
if( !m_comboReplace->IsEmpty() )
if( m_comboReplace->GetCount() )
m_comboReplace->SetSelection( 0 );
}
......@@ -94,16 +94,16 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @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,
void * aData)
{
wxBeginBusyCursor();
RedrawStructList( this, aDC, ActiveScreen->EEDrawList, GR_COPY );
RedrawStructList( DrawPanel, aDC, ActiveScreen->EEDrawList, GR_COPY );
if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
wxEndBusyCursor();
}
......
......@@ -62,7 +62,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL )
break;
LoadProjectFile( fn.GetFullPath(), TRUE );
LoadProjectFile( dlg.GetPath(), TRUE );
}
break;
......
......@@ -174,6 +174,11 @@ enum id_eeschema_frm
ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM,
ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
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 */
ID_LIBVIEW_NEXT,
......
......@@ -94,7 +94,15 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
CreateScreens();
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;
g_RootSheet->SetFileName( FullFileName );
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
*/
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");
fn.SetName( cachename );
fn.SetExt( CompLibFileExtension );
......
......@@ -5,6 +5,7 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "appl_wxstruct.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gestfich.h"
......@@ -248,12 +249,34 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
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 ) )
return;
fn = dlg.GetPath();
/* 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 );
......
/*******************************************/
/* 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 );
}
......@@ -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,
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. */
EVT_MENU( ID_LIBEDIT_EDIT_PIN, WinEDA_LibeditFrame::OnEditPin )
......@@ -192,6 +202,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
DrawPanel->m_Block_Enable = true;
EnsureActiveLibExists();
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
DisplayLibInfos();
......
......@@ -34,12 +34,15 @@ public:
~WinEDA_LibeditFrame();
void ReCreateMenuBar();
/** Function EnsureActiveLibExists
* Must be called after the libraries are reloaded
* (for instance after loading a schematic project)
*/
static void EnsureActiveLibExists();
void OnPlotCurrentComponent( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event );
......@@ -263,6 +266,28 @@ protected:
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()
};
......
......@@ -30,7 +30,7 @@ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
BOARD* Pcb, int drawmode );
/** Function PrintPage
/** virtual 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
......@@ -39,7 +39,7 @@ static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC,
* @param aPrintMirrorMode = true to plot mirrored
* @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 )
{
DISPLAY_OPTIONS save_opt;
......@@ -55,14 +55,14 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintma
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
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 )
m_Parent->TraceWorkSheet( aDC, GetScreen(), 0 );
TraceWorkSheet( aDC, GetScreen(), 0 );
m_PrintIsMirrored = false;
DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
......
......@@ -183,7 +183,7 @@ public:
* called on a language menu selection
*/
virtual void SetLanguage( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
......@@ -358,6 +358,17 @@ public:
// 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()
};
......
......@@ -83,20 +83,6 @@ public:
void OnPaint( wxPaintEvent& 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
* @param DC = current Device Context
......
......@@ -224,6 +224,18 @@ public:
*/
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
*/
......
......@@ -146,6 +146,19 @@ public:
*/
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 );
/** Function IsGridVisible() , virtual
......
......@@ -402,6 +402,19 @@ public:
*/
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();
};
......
No preview for this file type
This diff is collapsed.
......@@ -265,7 +265,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like
// 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
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
......
......@@ -6,8 +6,8 @@
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbplot.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 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,
int aPrintMaskLayer,
bool aPrintMirrorMode,
......@@ -39,8 +39,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt;
TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent;
BOARD* Pcb = frame->GetBoard();
BOARD* Pcb = GetBoard();
int defaultPenSize = 50;
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
......@@ -63,21 +62,21 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
DisplayOpt.DisplayViaFill = false;
}
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
bool nctmp = frame->GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE);
frame->GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false);
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE);
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false);
DisplayOpt.DisplayPadIsol = false;
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 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
// 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 )
break;
item->Draw( this, aDC, drawmode );
item->Draw( DrawPanel, aDC, drawmode );
break;
case TYPE_MARKER_PCB:
......@@ -119,14 +118,14 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
int rayon = pt_piste->m_Width >> 1;
int color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+pt_piste->m_Shape);
GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox, aDC,
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
pt_piste->m_Start.x,
pt_piste->m_Start.y,
rayon,
0, color, color );
}
else
pt_piste->Draw( this, aDC, drawmode );
pt_piste->Draw( DrawPanel, aDC, drawmode );
}
pt_piste = Pcb->m_Zone;
......@@ -134,7 +133,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
{
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
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 )
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
......@@ -155,7 +154,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
D_PAD::m_PadSketchModePenSize = defaultPenSize;
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;
......@@ -179,7 +178,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
diameter = min( SMALL_DRILL, pt_piste->GetDrillValue());
else
diameter = pt_piste->GetDrillValue();
GRFilledCircle( &m_ClipBox, aDC,
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
pt_piste->m_Start.x, pt_piste->m_Start.y,
diameter/2,
0, color, color );
......@@ -189,16 +188,16 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
}
if( aPrint_Sheet_Ref )
m_Parent->TraceWorkSheet( aDC, GetScreen(), defaultPenSize );
TraceWorkSheet( aDC, GetScreen(), defaultPenSize );
m_PrintIsMirrored = false;
DrawPanel->m_PrintIsMirrored = false;
DisplayOpt = save_opt;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum;
frame->GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
}
......
......@@ -280,7 +280,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
g_DrawBgColor = WHITE;
/* 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:
* 1 - Plot all items in black, this creates a local black backgroud
* 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 )
{ // Creates a "local" black background
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 );
}
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;
m_Parent->GetBaseScreen()->m_IsPrinting = false;
......
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