Commit 1f3f11ca authored by jean-pierre charras's avatar jean-pierre charras

Add margin values control in pl_editor, and remove margin definition from class PAGE_INFO.

parent 50743cf3
...@@ -126,25 +126,6 @@ inline void PAGE_INFO::updatePortrait() ...@@ -126,25 +126,6 @@ inline void PAGE_INFO::updatePortrait()
} }
void PAGE_INFO::setMargins()
{
if( IsGOST() )
{
m_left_margin = Mm2mils( 20 ); // 20mm
m_right_margin = // 5mm
m_top_margin = // 5mm
m_bottom_margin = Mm2mils( 5 ); // 5mm
}
else
{
m_left_margin =
m_right_margin =
m_top_margin =
m_bottom_margin = Mm2mils( 10 );
}
}
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) : PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) :
m_type( aType ), m_type( aType ),
m_size( aSizeMils ), m_size( aSizeMils ),
...@@ -152,8 +133,6 @@ PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSiz ...@@ -152,8 +133,6 @@ PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSiz
{ {
updatePortrait(); updatePortrait();
setMargins();
// This constructor is protected, and only used by const PAGE_INFO's known // This constructor is protected, and only used by const PAGE_INFO's known
// only to class implementation, so no further changes to "this" object are // only to class implementation, so no further changes to "this" object are
// expected. Therefore we should also setMargin() again when copying this // expected. Therefore we should also setMargin() again when copying this
...@@ -222,8 +201,6 @@ bool PAGE_INFO::SetType( const wxString& aType, bool IsPortrait ) ...@@ -222,8 +201,6 @@ bool PAGE_INFO::SetType( const wxString& aType, bool IsPortrait )
updatePortrait(); updatePortrait();
} }
setMargins();
return rc; return rc;
} }
......
...@@ -77,15 +77,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, ...@@ -77,15 +77,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
/* Note: Page sizes values are given in mils /* Note: Page sizes values are given in mils
*/ */
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0; double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
wxSize pageSize = aPageInfo.GetSizeMils(); // in mils
wxPoint LTmargin;
LTmargin.x = aPageInfo.GetLeftMarginMils() * iusPerMil;
LTmargin.y = aPageInfo.GetTopMarginMils() * iusPerMil;
wxPoint RBmargin;
RBmargin.x = aPageInfo.GetRightMarginMils() * iusPerMil;
RBmargin.y = aPageInfo.GetBottomMarginMils() * iusPerMil;
EDA_COLOR_T plotColor = plotter->GetColorMode() ? RED : BLACK; EDA_COLOR_T plotColor = plotter->GetColorMode() ? RED : BLACK;
plotter->SetColor( plotColor ); plotter->SetColor( plotColor );
...@@ -96,10 +87,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, ...@@ -96,10 +87,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
wxFileName fn( aFilename ); wxFileName fn( aFilename );
// Prepare plot parameters // Prepare plot parameters
drawList.SetMargins( LTmargin, RBmargin);
drawList.SetPenSize(PLOTTER::DEFAULT_LINE_WIDTH ); drawList.SetPenSize(PLOTTER::DEFAULT_LINE_WIDTH );
drawList.SetMilsToIUfactor( iusPerMil ); drawList.SetMilsToIUfactor( iusPerMil );
drawList.SetPageSize( pageSize );
drawList.SetSheetNumber( aSheetNumber ); drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aNumberOfSheets ); drawList.SetSheetCount( aNumberOfSheets );
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
......
...@@ -563,13 +563,14 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) ...@@ -563,13 +563,14 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
g_GhostColor = WHITE; g_GhostColor = WHITE;
} }
if( erasebg )
EraseScreen( DC );
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
DC->SetBackground( *wxBLACK_BRUSH ); DC->SetBackground( g_DrawBgColor == BLACK ? *wxBLACK_BRUSH : *wxWHITE_BRUSH );
DC->SetBackgroundMode( wxSOLID ); DC->SetBackgroundMode( wxSOLID );
if( erasebg )
EraseScreen( DC );
GetParent()->RedrawActiveWindow( DC, erasebg ); GetParent()->RedrawActiveWindow( DC, erasebg );
// Verfies that the clipping is working correctly. If these two sets of numbers are // Verfies that the clipping is working correctly. If these two sets of numbers are
......
...@@ -682,7 +682,7 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDesc ...@@ -682,7 +682,7 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDesc
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT; wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext; wxString mask = wxT( "*." ) + ext;
wxString path = wxGetCwd(); wxString path = wxGetCwd();
wxString filename; wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ), filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
path, path,
...@@ -710,7 +710,7 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescLi ...@@ -710,7 +710,7 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescLi
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT; wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext; wxString mask = wxT( "*." ) + ext;
wxString path = wxGetCwd(); wxString path = wxGetCwd();
wxString filename; wxString filename = wxGetApp().GetAppName() + wxT( "." ) + ext;
filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ), filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
path, path,
......
...@@ -72,7 +72,7 @@ double WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.0; ...@@ -72,7 +72,7 @@ double WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.0;
bool WORKSHEET_DATAITEM::m_SpecialMode = false; bool WORKSHEET_DATAITEM::m_SpecialMode = false;
EDA_COLOR_T WORKSHEET_DATAITEM::m_Color = RED; // the default color to draw items EDA_COLOR_T WORKSHEET_DATAITEM::m_Color = RED; // the default color to draw items
EDA_COLOR_T WORKSHEET_DATAITEM::m_AltColor = RED; // an alternate color to draw items EDA_COLOR_T WORKSHEET_DATAITEM::m_AltColor = RED; // an alternate color to draw items
EDA_COLOR_T WORKSHEET_DATAITEM::m_SelectedColor = YELLOW; // the color to draw selected items EDA_COLOR_T WORKSHEET_DATAITEM::m_SelectedColor = BROWN; // the color to draw selected items
// The constructor: // The constructor:
WORKSHEET_DATAITEM::WORKSHEET_DATAITEM( WS_ItemType aType ) WORKSHEET_DATAITEM::WORKSHEET_DATAITEM( WS_ItemType aType )
......
...@@ -61,6 +61,36 @@ ...@@ -61,6 +61,36 @@
// It is accessible by WORKSHEET_LAYOUT::GetTheInstance() // It is accessible by WORKSHEET_LAYOUT::GetTheInstance()
WORKSHEET_LAYOUT wksTheInstance; WORKSHEET_LAYOUT wksTheInstance;
WORKSHEET_LAYOUT::WORKSHEET_LAYOUT()
{
m_allowVoidList = false;
m_leftMargin = 10.0; // the left page margin in mm
m_rightMargin = 10.0; // the right page margin in mm
m_topMargin = 10.0; // the top page margin in mm
m_bottomMargin = 10.0; // the bottom page margin in mm
}
void WORKSHEET_LAYOUT::SetLeftMargin( double aMargin )
{
m_leftMargin = aMargin; // the left page margin in mm
}
void WORKSHEET_LAYOUT::SetRightMargin( double aMargin )
{
m_rightMargin = aMargin; // the right page margin in mm
}
void WORKSHEET_LAYOUT::SetTopMargin( double aMargin )
{
m_topMargin = aMargin; // the top page margin in mm
}
void WORKSHEET_LAYOUT::SetBottomMargin( double aMargin )
{
m_bottomMargin = aMargin; // the bottom page margin in mm
}
void WORKSHEET_LAYOUT::ClearList() void WORKSHEET_LAYOUT::ClearList()
{ {
for( unsigned ii = 0; ii < m_list.size(); ii++ ) for( unsigned ii = 0; ii < m_list.size(); ii++ )
......
...@@ -167,7 +167,8 @@ extern const char defaultPageLayout[]; ...@@ -167,7 +167,8 @@ extern const char defaultPageLayout[];
// Default page layout (sizes are in mm) // Default page layout (sizes are in mm)
const char defaultPageLayout[] = "( page_layout\n" const char defaultPageLayout[] = "( page_layout\n"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )" "(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15)\n"
"(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n" "(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
"(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n" "(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n"
"(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n" "(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n"
......
...@@ -69,7 +69,7 @@ private: ...@@ -69,7 +69,7 @@ private:
*/ */
double parseDouble(); double parseDouble();
void parseSetup() throw( IO_ERROR, PARSE_ERROR ); void parseSetup( WORKSHEET_LAYOUT* aLayout ) throw( IO_ERROR, PARSE_ERROR );
void parseGraphic( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR ); void parseGraphic( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR );
void parseText( WORKSHEET_DATAITEM_TEXT * aItem ) throw( IO_ERROR, PARSE_ERROR ); void parseText( WORKSHEET_DATAITEM_TEXT * aItem ) throw( IO_ERROR, PARSE_ERROR );
void parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem ) void parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
...@@ -110,7 +110,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout ) ...@@ -110,7 +110,7 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
switch( token ) switch( token )
{ {
case T_setup: // Defines default values for graphic items case T_setup: // Defines default values for graphic items
parseSetup(); parseSetup( aLayout );
break; break;
case T_line: case T_line:
...@@ -145,7 +145,8 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout ) ...@@ -145,7 +145,8 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
} }
} }
void PAGE_LAYOUT_READER_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) void PAGE_LAYOUT_READER_PARSER::parseSetup( WORKSHEET_LAYOUT* aLayout )
throw( IO_ERROR, PARSE_ERROR )
{ {
T token; T token;
while( ( token = NextTok() ) != T_RIGHT ) while( ( token = NextTok() ) != T_RIGHT )
...@@ -174,6 +175,26 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -174,6 +175,26 @@ void PAGE_LAYOUT_READER_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
NeedRIGHT(); NeedRIGHT();
break; break;
case T_left_margin:
aLayout->SetLeftMargin( parseDouble() );
NeedRIGHT();
break;
case T_right_margin:
aLayout->SetRightMargin( parseDouble() );
NeedRIGHT();
break;
case T_top_margin:
aLayout->SetTopMargin( parseDouble() );
NeedRIGHT();
break;
case T_bottom_margin:
aLayout->SetBottomMargin( parseDouble() );
NeedRIGHT();
break;
default: default:
Unexpected( CurText() ); Unexpected( CurText() );
break; break;
......
page_layout page_layout
setup setup
left_margin
right_margin
top_margin
bottom_margin
linewidth linewidth
textlinewidth textlinewidth
textsize textsize
......
...@@ -67,17 +67,21 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -67,17 +67,21 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor ) EDA_COLOR_T aColor, EDA_COLOR_T aAltColor )
{ {
#define milsTomm (25.4/1000) #define milsTomm (25.4/1000)
#define mmTomils (1000/25.4)
m_titleBlock = &aTitleBlock; m_titleBlock = &aTitleBlock;
m_paperFormat = &aPageInfo.GetType(); m_paperFormat = &aPageInfo.GetType();
wxPoint LTmargin( aPageInfo.GetLeftMarginMils(), aPageInfo.GetTopMarginMils() ); WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
wxPoint RBmargin( aPageInfo.GetRightMarginMils(), aPageInfo.GetBottomMarginMils() );
wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
Mm2mils( pglayout.GetTopMargin() ) );
wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
Mm2mils( pglayout.GetBottomMargin() ) );
SetMargins( LTmargin, RBmargin ); SetMargins( LTmargin, RBmargin );
SetPageSize( aPageInfo.GetSizeMils() ); SetPageSize( aPageInfo.GetSizeMils() );
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
// Build the basic layout shape, if the layout list is empty // Build the basic layout shape, if the layout list is empty
if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() ) if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() )
pglayout.SetPageLayout(); pglayout.SetPageLayout();
......
...@@ -991,8 +991,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -991,8 +991,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
wxString paperFormat = aPageInfo.GetType(); wxString paperFormat = aPageInfo.GetType();
WS_DRAW_ITEM_TEXT* gtext; WS_DRAW_ITEM_TEXT* gtext;
wxPoint LTmargin( aPageInfo.GetLeftMarginMils(), aPageInfo.GetTopMarginMils() ); wxPoint LTmargin( Mm2mils( 20 ), Mm2mils( 5 ) );
wxPoint RBmargin( aPageInfo.GetRightMarginMils(), aPageInfo.GetBottomMarginMils() ); wxPoint RBmargin( Mm2mils( 5 ), Mm2mils( 5 ) );
SetMargins( LTmargin, RBmargin ); SetMargins( LTmargin, RBmargin );
SetPageSize( aPageInfo.GetSizeMils() ); SetPageSize( aPageInfo.GetSizeMils() );
......
...@@ -44,7 +44,8 @@ enum EDA_APP_T { ...@@ -44,7 +44,8 @@ enum EDA_APP_T {
APP_PCBNEW_T, APP_PCBNEW_T,
APP_CVPCB_T, APP_CVPCB_T,
APP_GERBVIEW_T, APP_GERBVIEW_T,
APP_KICAD_T APP_KICAD_T,
APP_PL_EDITOR_T
}; };
class wxConfigBase; class wxConfigBase;
......
...@@ -302,54 +302,6 @@ public: ...@@ -302,54 +302,6 @@ public:
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); } const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif #endif
/**
* Function GetLeftMarginMils.
* @return int - logical page left margin in mils.
*/
int GetLeftMarginMils() const { return m_left_margin; }
/**
* Function GetLeftMarginMils.
* @return int - logical page right margin in mils.
*/
int GetRightMarginMils() const { return m_right_margin; }
/**
* Function GetLeftMarginMils.
* @return int - logical page top margin in mils.
*/
int GetTopMarginMils() const { return m_top_margin; }
/**
* Function GetBottomMarginMils.
* @return int - logical page bottom margin in mils.
*/
int GetBottomMarginMils() const { return m_bottom_margin; }
/**
* Function SetLeftMarginMils
* sets left page margin to @a aMargin in mils.
*/
void SetLeftMarginMils( int aMargin ) { m_left_margin = aMargin; }
/**
* Function SetRightMarginMils
* sets right page margin to @a aMargin in mils.
*/
void SetRightMarginMils( int aMargin ) { m_right_margin = aMargin; }
/**
* Function SetTopMarginMils
* sets top page margin to @a aMargin in mils.
*/
void SetTopMarginMils( int aMargin ) { m_top_margin = aMargin; }
/**
* Function SetBottomMarginMils
* sets bottom page margin to @a aMargin in mils.
*/
void SetBottomMarginMils( int aMargin ) { m_bottom_margin = aMargin; }
/** /**
* Function SetCustomWidthMils * Function SetCustomWidthMils
* sets the width of Custom page in mils, for any custom page * sets the width of Custom page in mils, for any custom page
...@@ -429,12 +381,6 @@ private: ...@@ -429,12 +381,6 @@ private:
#define MIN_PAGE_SIZE 4000 #define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000 #define MAX_PAGE_SIZE 48000
int m_left_margin;
int m_right_margin;
int m_top_margin;
int m_bottom_margin;
bool m_portrait; ///< true if portrait, false if landscape bool m_portrait; ///< true if portrait, false if landscape
wxPaperSize m_paper_id; ///< wx' style paper id. wxPaperSize m_paper_id; ///< wx' style paper id.
......
...@@ -460,9 +460,13 @@ class WORKSHEET_LAYOUT ...@@ -460,9 +460,13 @@ class WORKSHEET_LAYOUT
// will be loaded the first time // will be loaded the first time
// WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList // WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList
// is run (useful mainly for page layout editor) // is run (useful mainly for page layout editor)
double m_leftMargin; // the left page margin in mm
double m_rightMargin; // the right page margin in mm
double m_topMargin; // the top page margin in mm
double m_bottomMargin; // the bottom page margin in mm
public: public:
WORKSHEET_LAYOUT() { m_allowVoidList = false; } WORKSHEET_LAYOUT();
~WORKSHEET_LAYOUT() {ClearList(); } ~WORKSHEET_LAYOUT() {ClearList(); }
/** /**
...@@ -475,6 +479,17 @@ public: ...@@ -475,6 +479,17 @@ public:
return wksTheInstance; return wksTheInstance;
} }
// Accessors:
double GetLeftMargin() { return m_leftMargin; }
double GetRightMargin() { return m_rightMargin; }
double GetTopMargin() { return m_topMargin; }
double GetBottomMargin() { return m_bottomMargin; }
void SetLeftMargin( double aMargin );
void SetRightMargin( double aMargin );
void SetTopMargin( double aMargin );
void SetBottomMargin( double aMargin );
/** /**
* In Kicad applications, a page layout description is needed * In Kicad applications, a page layout description is needed
* So if the list is empty, a default description is loaded, * So if the list is empty, a default description is loaded,
......
...@@ -63,12 +63,15 @@ public: ...@@ -63,12 +63,15 @@ public:
*/ */
class PLEDITOR_PREVIEW_FRAME : public wxPreviewFrame class PLEDITOR_PREVIEW_FRAME : public wxPreviewFrame
{ {
PL_EDITOR_FRAME* m_parent;
public: public:
PLEDITOR_PREVIEW_FRAME( wxPrintPreview* aPreview, PL_EDITOR_FRAME* aParent, PLEDITOR_PREVIEW_FRAME( wxPrintPreview* aPreview, PL_EDITOR_FRAME* aParent,
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition, const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize ) : const wxSize& aSize = wxDefaultSize ) :
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize ) wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
{ {
m_parent = aParent;
} }
bool Show( bool show ) // overload bool Show( bool show ) // overload
...@@ -79,10 +82,20 @@ public: ...@@ -79,10 +82,20 @@ public:
// If showing, use previous position and size. // If showing, use previous position and size.
if( show ) if( show )
{ {
ret = wxPreviewFrame::Show( show ); bool centre = false;
if( s_size.x == 0 || s_size.y == 0 )
{
s_size = (m_parent->GetSize() * 3) / 4;
s_pos = wxDefaultPosition;
centre = true;
}
if( s_size.x != 0 && s_size.y != 0 )
SetSize( s_pos.x, s_pos.y, s_size.x, s_size.y, 0 ); SetSize( s_pos.x, s_pos.y, s_size.x, s_size.y, 0 );
if( centre )
Center();
ret = wxPreviewFrame::Show( show );
} }
else else
{ {
...@@ -191,7 +204,6 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum ) ...@@ -191,7 +204,6 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
int InvokeDialogPrint( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData, int InvokeDialogPrint( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData,
wxPageSetupDialogData* aPageSetupData ) wxPageSetupDialogData* aPageSetupData )
{ {
PLEDITOR_PRINTOUT dlg( aCaller, _("Print Page Layout") );
int pageCount = 2; int pageCount = 2;
wxPrintDialogData printDialogData( *aPrintData ); wxPrintDialogData printDialogData( *aPrintData );
...@@ -224,12 +236,11 @@ int InvokeDialogPrintPreview( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData ...@@ -224,12 +236,11 @@ int InvokeDialogPrintPreview( PL_EDITOR_FRAME* aCaller, wxPrintData* aPrintData
new PLEDITOR_PRINTOUT( aCaller, title ), new PLEDITOR_PRINTOUT( aCaller, title ),
aPrintData ); aPrintData );
preview->SetZoom( 100 ); preview->SetZoom( 70 );
PLEDITOR_PREVIEW_FRAME* frame = new PLEDITOR_PREVIEW_FRAME( preview, aCaller, title ); PLEDITOR_PREVIEW_FRAME* frame = new PLEDITOR_PREVIEW_FRAME( preview, aCaller, title );
frame->Initialize(); frame->Initialize();
frame->Center();
frame->Show( true ); frame->Show( true );
return 1; return 1;
......
...@@ -19,12 +19,16 @@ ...@@ -19,12 +19,16 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/statline.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/panel.h> #include <wx/panel.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -37,19 +41,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel ...@@ -37,19 +41,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel
private: private:
protected: protected:
wxScrolledWindow* m_scrolledLeftWindow; wxNotebook* m_notebook;
wxStaticText* m_staticTextDefVal; wxScrolledWindow* m_swItemProperties;
wxStaticText* m_staticTextDefTsX;
wxTextCtrl* m_textCtrlDefaultTextSizeX;
wxStaticText* m_staticTextDefTsY;
wxTextCtrl* m_textCtrlDefaultTextSizeY;
wxStaticText* m_staticTextDefLineW;
wxTextCtrl* m_textCtrlDefaultLineWidth;
wxStaticText* m_staticText22;
wxTextCtrl* m_textCtrlDefaultTextThickness;
wxStaticLine* m_staticline7;
wxButton* m_buttonOK;
wxStaticLine* m_staticline8;
wxStaticText* m_staticTextType; wxStaticText* m_staticTextType;
wxTextCtrl* m_textCtrlType; wxTextCtrl* m_textCtrlType;
wxStaticText* m_staticTextPageOpt; wxStaticText* m_staticTextPageOpt;
...@@ -74,6 +67,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel ...@@ -74,6 +67,8 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxStaticText* m_staticTextConstraintY; wxStaticText* m_staticTextConstraintY;
wxTextCtrl* m_textCtrlConstraintY; wxTextCtrl* m_textCtrlConstraintY;
wxStaticLine* m_staticline6; wxStaticLine* m_staticline6;
wxButton* m_buttonOK;
wxStaticLine* m_staticline8;
wxStaticText* m_staticTextComment; wxStaticText* m_staticTextComment;
wxTextCtrl* m_textCtrlComment; wxTextCtrl* m_textCtrlComment;
wxStaticLine* m_staticline2; wxStaticLine* m_staticline2;
...@@ -108,7 +103,28 @@ class PANEL_PROPERTIES_BASE : public wxPanel ...@@ -108,7 +103,28 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxTextCtrl* m_textCtrlStepX; wxTextCtrl* m_textCtrlStepX;
wxStaticText* m_staticTextStepY; wxStaticText* m_staticTextStepY;
wxTextCtrl* m_textCtrlStepY; wxTextCtrl* m_textCtrlStepY;
wxStaticLine* m_staticline3; wxScrolledWindow* m_swGeneralOpts;
wxStaticText* m_staticTextDefVal;
wxStaticText* m_staticTextDefTsX;
wxTextCtrl* m_textCtrlDefaultTextSizeX;
wxStaticText* m_staticTextDefTsY;
wxTextCtrl* m_textCtrlDefaultTextSizeY;
wxStaticText* m_staticTextDefLineW;
wxTextCtrl* m_textCtrlDefaultLineWidth;
wxStaticText* m_staticText22;
wxTextCtrl* m_textCtrlDefaultTextThickness;
wxStaticLine* m_staticline9;
wxStaticText* m_staticTextMargins;
wxStaticText* m_staticTextLeftMargin;
wxTextCtrl* m_textCtrlLeftMargin;
wxStaticText* m_staticTextDefRightMargin;
wxTextCtrl* m_textCtrlRightMargin;
wxStaticText* m_staticTextTopMargin;
wxTextCtrl* m_textCtrlTopMargin;
wxStaticText* m_staticTextBottomMargin;
wxTextCtrl* m_textCtrlDefaultBottomMargin;
wxStaticLine* m_staticline10;
wxButton* m_buttonGeneralOptsOK;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); } virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); }
...@@ -116,7 +132,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel ...@@ -116,7 +132,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
public: public:
PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 315,756 ), long style = wxTAB_TRAVERSAL ); PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 315,739 ), long style = wxTAB_TRAVERSAL );
~PANEL_PROPERTIES_BASE(); ~PANEL_PROPERTIES_BASE();
}; };
......
...@@ -49,12 +49,10 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME ) ...@@ -49,12 +49,10 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
// menu Preferences // menu Preferences
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
PL_EDITOR_FRAME::Process_Config ) PL_EDITOR_FRAME::Process_Config )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage )
// menu Postprocess
EVT_MENU( ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR, EVT_MENU( ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR,
EDA_BASE_FRAME::OnSelectPreferredEditor ) EDA_BASE_FRAME::OnSelectPreferredEditor )
EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Config )
// Menu Help // Menu Help
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <worksheet_shape_builder.h> #include <worksheet_shape_builder.h>
#include <pl_editor_frame.h> #include <pl_editor_frame.h>
#include <properties_frame.h>
#include <pl_editor_id.h> #include <pl_editor_id.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
...@@ -59,8 +60,8 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event ) ...@@ -59,8 +60,8 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); msg.Printf( _("File <%s> loaded"), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
} }
RebuildDesignTree();
m_canvas->Refresh(); OnNewPageLayout();
} }
} }
...@@ -95,18 +96,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) ...@@ -95,18 +96,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
{ {
case ID_LOAD_DEFAULT_PAGE_LAYOUT: case ID_LOAD_DEFAULT_PAGE_LAYOUT:
pglayout.SetPageLayout(); pglayout.SetPageLayout();
RebuildDesignTree(); OnNewPageLayout();
m_canvas->Refresh();
GetScreen()->ClrModify();
break; break;
case wxID_NEW: case wxID_NEW:
pglayout.AllowVoidList( true ); pglayout.AllowVoidList( true );
SetCurrFileName( wxEmptyString ); SetCurrFileName( wxEmptyString );
pglayout.ClearList(); pglayout.ClearList();
RebuildDesignTree(); OnNewPageLayout();
m_canvas->Refresh();
GetScreen()->ClrModify();
break; break;
case ID_OPEN_POLYGON_DESCR_FILE: case ID_OPEN_POLYGON_DESCR_FILE:
...@@ -153,8 +150,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) ...@@ -153,8 +150,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
} }
else else
{ {
RebuildDesignTree(); OnNewPageLayout();
m_canvas->Refresh();
msg.Printf( _("File <%s> loaded"), GetChars( filename ) ); msg.Printf( _("File <%s> loaded"), GetChars( filename ) );
SetStatusText( msg ); SetStatusText( msg );
} }
......
/** /**
* @file gerbview/hotkeys.cpp * @file gerbview/hotkeys.cpp
*/ */
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 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
*/
#include <fctsys.h> #include <fctsys.h>
#include <common.h> #include <common.h>
...@@ -16,15 +39,13 @@ ...@@ -16,15 +39,13 @@
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
* add a new EDA_HOTKEY entry like: * add a new EDA_HOTKEY entry like:
* static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the * 'Command Label' is the name used in hotkey list display, and the identifier in the
* hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch * hotkey list file
* in OnHotKey() function. default key value is the default hotkey for this command. * 'MY_NEW_ID_FUNCTION' is the id event function used in the switch in OnHotKey() function.
* Can be overrided by the user hotkey list file add the HkMyNewEntry pointer in the * 'Default key value' is the default hotkey for this command.
* s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) Add the * Can be overrided by the user hotkey list
* new code in the switch in OnHotKey() function. when the variable PopupOn is true, * Add the 'HkMyNewEntry' pointer in the s_PlEditor_Hotkey_List list
* an item is currently edited. This can be usefull if the new function cannot be * Add the new code in the switch in OnHotKey() function.
* executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
* *
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX) * Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp) * is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
...@@ -41,13 +62,12 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ...@@ -41,13 +62,12 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
// List of common hotkey descriptors // List of common hotkey descriptors
EDA_HOTKEY* s_PlEditor_Hotkey_List[] = { EDA_HOTKEY* s_PlEditor_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkZoomAuto, &HkResetLocalCoord,
NULL NULL
}; };
...@@ -61,16 +81,16 @@ struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] = ...@@ -61,16 +81,16 @@ struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] =
}; };
/* /* OnHotKey.
* Function OnHotKey.
* ** Commands are case insensitive ** * ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor * Some commands are relative to the item under the mouse cursor
* aDC = current device context * aDC = current device context
* aHotkeyCode = hotkey code (ascii or wxWidget code for special keys) * aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* aPosition The cursor position in logical (drawing) units. * aPosition The cursor position in logical (drawing) units.
* aItem = NULL or pointer on a EDA_ITEM under the mouse cursor * aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/ */
void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem ) void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
const wxPoint& aPosition, EDA_ITEM* aItem )
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
......
...@@ -109,40 +109,34 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void ) ...@@ -109,40 +109,34 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void )
_( "Quit Pl_Editor" ), _( "Quit Pl_Editor" ),
KiBitmap( exit_xpm ) ); KiBitmap( exit_xpm ) );
// Menu for configuration and preferences // Menu for preferences
wxMenu* configMenu = new wxMenu; wxMenu* preferencesMenu = new wxMenu;
// Options (Preferences on WXMAC) // Options (Preferences on WXMAC)
#ifdef __WXMAC__ #ifdef __WXMAC__
configMenu->Append(wxID_PREFERENCES); preferencesMenu->Append(wxID_PREFERENCES);
#else #else
AddMenuItem( configMenu, AddMenuItem( preferencesMenu,
wxID_PREFERENCES, wxID_PREFERENCES,
_( "&Options" ), _( "&Options" ),
_( "Set options to draw items" ), wxEmptyString,
KiBitmap( preference_xpm ) ); KiBitmap( preference_xpm ) );
#endif // __WXMAC__ #endif // __WXMAC__
// Language submenu // Text editor selection
wxGetApp().AddMenuLanguageList( configMenu ); AddMenuItem( preferencesMenu,
// Hotkey submenu
AddHotkeyConfigMenu( configMenu );
// Menu miscellaneous
wxMenu* miscellaneousMenu = new wxMenu;
// Separator
miscellaneousMenu->AppendSeparator();
// Text editor
AddMenuItem( miscellaneousMenu,
ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR, ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ), _( "&Text Editor" ),
_( "Select your preferred text editor" ), _( "Select your preferred text editor" ),
KiBitmap( editor_xpm ) ); KiBitmap( editor_xpm ) );
// Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
// Hotkey submenu
AddHotkeyConfigMenu( preferencesMenu );
// Menu Help // Menu Help
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
...@@ -165,8 +159,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void ) ...@@ -165,8 +159,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar( void )
// Append menus to the menubar // Append menus to the menubar
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( configMenu, _( "&Preferences" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();
......
...@@ -179,12 +179,24 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const ...@@ -179,12 +179,24 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
// Setup // Setup
int nestLevel = 1; int nestLevel = 1;
// Write default values:
m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) ); m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) );
m_out->Print( 0, "(textsize %s %s)", m_out->Print( 0, "(textsize %s %s)",
double2Str( TB_DEFAULT_TEXTSIZE ).c_str(), double2Str( TB_DEFAULT_TEXTSIZE ).c_str(),
double2Str( TB_DEFAULT_TEXTSIZE ).c_str() ); double2Str( TB_DEFAULT_TEXTSIZE ).c_str() );
m_out->Print( 0, "(linewidth %s)", double2Str( 0.15 ).c_str() ); m_out->Print( 0, "(linewidth %s)", double2Str( 0.15 ).c_str() );
m_out->Print( 0, "(textlinewidth %s)", double2Str( 0.15 ).c_str() ); m_out->Print( 0, "(textlinewidth %s)", double2Str( 0.15 ).c_str() );
m_out->Print( 0, "\n" );
// Write margin values
m_out->Print( nestLevel, "(%s %s)", getTokenName( T_left_margin ),
double2Str( aPageLayout->GetLeftMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_right_margin ),
double2Str( aPageLayout->GetRightMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_top_margin ),
double2Str( aPageLayout->GetTopMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_bottom_margin ),
double2Str( aPageLayout->GetBottomMargin() ).c_str() );
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
// Save the graphical items on the page layout // Save the graphical items on the page layout
......
...@@ -64,7 +64,7 @@ bool EDA_APP::OnInit() ...@@ -64,7 +64,7 @@ bool EDA_APP::OnInit()
{ {
wxFileName fn; wxFileName fn;
InitEDA_Appl( wxT( "pl_editor" ), APP_GERBVIEW_T ); InitEDA_Appl( wxT( "pl_editor" ), APP_PL_EDITOR_T );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
...@@ -87,7 +87,7 @@ bool EDA_APP::OnInit() ...@@ -87,7 +87,7 @@ bool EDA_APP::OnInit()
PL_EDITOR_FRAME * frame = new PL_EDITOR_FRAME( NULL, wxT( "PlEditorFrame" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) ); PL_EDITOR_FRAME * frame = new PL_EDITOR_FRAME( NULL, wxT( "PlEditorFrame" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
//ainframe title: // frame title:
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() ); frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
SetTopWindow( frame ); SetTopWindow( frame );
...@@ -96,6 +96,7 @@ bool EDA_APP::OnInit() ...@@ -96,6 +96,7 @@ bool EDA_APP::OnInit()
frame->GetScreen()->m_FirstRedraw = false; frame->GetScreen()->m_FirstRedraw = false;
bool descrLoaded = false;
if( argc > 1 ) if( argc > 1 )
{ {
fn = argv[1]; fn = argv[1];
...@@ -111,10 +112,16 @@ bool EDA_APP::OnInit() ...@@ -111,10 +112,16 @@ bool EDA_APP::OnInit()
fn.GetFullPath().GetData() ); fn.GetFullPath().GetData() );
wxMessageBox( msg ); wxMessageBox( msg );
} }
else
descrLoaded = true;
} }
} }
frame->RebuildDesignTree(); if( !descrLoaded )
{
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout();
frame->OnNewPageLayout();
}
return true; return true;
} }
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <pl_editor_frame.h> #include <pl_editor_frame.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <dialog_hotkeys_editor.h> #include <dialog_hotkeys_editor.h>
#include <pl_editor_id.h>
#define GROUP wxT("/pl_editor") #define GROUP wxT("/pl_editor")
...@@ -49,6 +50,25 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -49,6 +50,25 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case wxID_PREFERENCES:
break;
// Standard basic hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, s_PlEditor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_PlEditor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( s_PlEditor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
DisplayHotkeyList( this, s_PlEditor_Hokeys_Descr );
break;
default: default:
wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Config error" ) ); wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Config error" ) );
......
...@@ -464,12 +464,23 @@ void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, ...@@ -464,12 +464,23 @@ void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg ) void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
{ {
GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2; GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
if( aEraseBg )
m_canvas->EraseScreen( aDC );
m_canvas->DrawBackGround( aDC ); m_canvas->DrawBackGround( aDC );
const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
WORKSHEET_DATAITEM* selecteditem = GetSelectedItem(); WORKSHEET_DATAITEM* selecteditem = GetSelectedItem();
// the color to draw selected items
if( g_DrawBgColor == WHITE )
WORKSHEET_DATAITEM::m_SelectedColor = DARKCYAN;
else
WORKSHEET_DATAITEM::m_SelectedColor = YELLOW;
for( unsigned ii = 0; ; ii++ ) for( unsigned ii = 0; ; ii++ )
{ {
WORKSHEET_DATAITEM* item = pglayout.GetItem( ii ); WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
...@@ -634,3 +645,14 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) ...@@ -634,3 +645,14 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
return item; return item;
} }
/* Must be called to initialize parameters when a new page layout
* description is loaded
*/
void PL_EDITOR_FRAME::OnNewPageLayout()
{
GetScreen()->ClrModify();
m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
RebuildDesignTree();
m_canvas->Refresh();
}
...@@ -102,6 +102,12 @@ public: ...@@ -102,6 +102,12 @@ public:
void UpdateStatusBar(); // overload EDA_DRAW_FRAME void UpdateStatusBar(); // overload EDA_DRAW_FRAME
/**
* Must be called to initialize parameters when a new page layout
* description is loaded
*/
void OnNewPageLayout();
/** /**
* creates or updates the right vertical toolbar. * creates or updates the right vertical toolbar.
* @note This is currently not used. * @note This is currently not used.
......
...@@ -49,23 +49,85 @@ wxSize PROPERTIES_FRAME::GetMinSize() const ...@@ -49,23 +49,85 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
return wxSize( 150, -1 ); return wxSize( 150, -1 );
} }
// Data transfert from item to widgets in properties frame
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem ) // Data transfert from general properties to widgets
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
{ {
wxString msg; wxString msg;
// Set default parameters // Set default parameters
msg.Printf( wxT("%.3f"), aItem->m_DefaultLineWidth ); msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultLineWidth );
m_textCtrlDefaultLineWidth->SetValue( msg ); m_textCtrlDefaultLineWidth->SetValue( msg );
msg.Printf( wxT("%.3f"), aItem->m_DefaultTextSize.x ); msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextSize.x );
m_textCtrlDefaultTextSizeX->SetValue( msg ); m_textCtrlDefaultTextSizeX->SetValue( msg );
msg.Printf( wxT("%.3f"), aItem->m_DefaultTextSize.y ); msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextSize.y );
m_textCtrlDefaultTextSizeY->SetValue( msg ); m_textCtrlDefaultTextSizeY->SetValue( msg );
msg.Printf( wxT("%.3f"), aItem->m_DefaultTextThickness ); msg.Printf( wxT("%.3f"), WORKSHEET_DATAITEM::m_DefaultTextThickness );
m_textCtrlDefaultTextThickness->SetValue( msg ); m_textCtrlDefaultTextThickness->SetValue( msg );
// Set page margins values
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
msg.Printf( wxT("%.3f"), pglayout.GetRightMargin() );
m_textCtrlRightMargin->SetValue( msg );
msg.Printf( wxT("%.3f"), pglayout.GetBottomMargin() );
m_textCtrlDefaultBottomMargin->SetValue( msg );
msg.Printf( wxT("%.3f"), pglayout.GetLeftMargin() );
m_textCtrlLeftMargin->SetValue( msg );
msg.Printf( wxT("%.3f"), pglayout.GetTopMargin() );
m_textCtrlTopMargin->SetValue( msg );
}
// Data transfert from widgets to general properties
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
{
double dtmp;
wxString msg;
// Import default parameters from widgets
msg = m_textCtrlDefaultLineWidth->GetValue();
msg.ToDouble( &dtmp );
WORKSHEET_DATAITEM::m_DefaultLineWidth = dtmp;
msg = m_textCtrlDefaultTextSizeX->GetValue();
msg.ToDouble( &dtmp );
WORKSHEET_DATAITEM::m_DefaultTextSize.x = dtmp;
msg = m_textCtrlDefaultTextSizeY->GetValue();
msg.ToDouble( &dtmp );
WORKSHEET_DATAITEM::m_DefaultTextSize.y = dtmp;
msg = m_textCtrlDefaultTextThickness->GetValue();
msg.ToDouble( &dtmp );
WORKSHEET_DATAITEM::m_DefaultTextThickness = dtmp;
// Get page margins values
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
msg = m_textCtrlRightMargin->GetValue();
msg.ToDouble( &dtmp );
pglayout.SetRightMargin( dtmp );
msg = m_textCtrlDefaultBottomMargin->GetValue();
msg.ToDouble( &dtmp );
pglayout.SetBottomMargin( dtmp );
// cordinates of the left top corner are the left and top margins
msg = m_textCtrlLeftMargin->GetValue();
msg.ToDouble( &dtmp );
pglayout.SetLeftMargin( dtmp );
msg = m_textCtrlTopMargin->GetValue();
msg.ToDouble( &dtmp );
pglayout.SetTopMargin( dtmp );
return true;
}
// Data transfert from item to widgets in properties frame
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
{
wxString msg;
// Set parameters common to all WORKSHEET_DATAITEM types // Set parameters common to all WORKSHEET_DATAITEM types
m_textCtrlType->SetValue( aItem->GetClassName() ); m_textCtrlType->SetValue( aItem->GetClassName() );
m_textCtrlComment->SetValue( aItem->m_Info ); m_textCtrlComment->SetValue( aItem->m_Info );
...@@ -210,8 +272,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem ) ...@@ -210,8 +272,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
m_textCtrlStepY->SetValue( msg ); m_textCtrlStepY->SetValue( msg );
// The number of widgets was modified // The number of widgets was modified
Layout(); m_swItemProperties->Layout();
Refresh(); m_swItemProperties->Refresh();
} }
// Event function called by clicking on the OK button // Event function called by clicking on the OK button
...@@ -221,6 +283,8 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event ) ...@@ -221,6 +283,8 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
if( item ) if( item )
CopyPrmsFromPanelToItem( item ); CopyPrmsFromPanelToItem( item );
CopyPrmsFromPanelToGeneral();
m_parent->OnModify(); m_parent->OnModify();
m_parent->GetCanvas()->Refresh(); m_parent->GetCanvas()->Refresh();
} }
...@@ -234,22 +298,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem ) ...@@ -234,22 +298,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
double dtmp; double dtmp;
wxString msg; wxString msg;
// Import default parameters
msg = m_textCtrlDefaultLineWidth->GetValue();
msg.ToDouble( &dtmp );
aItem->m_DefaultLineWidth = dtmp;
msg = m_textCtrlDefaultTextSizeX->GetValue();
msg.ToDouble( &dtmp );
aItem->m_DefaultTextSize.x = dtmp;
msg = m_textCtrlDefaultTextSizeY->GetValue();
msg.ToDouble( &dtmp );
aItem->m_DefaultTextSize.y = dtmp;
msg = m_textCtrlDefaultTextThickness->GetValue();
msg.ToDouble( &dtmp );
aItem->m_DefaultTextThickness = dtmp;
// Import common parameters: // Import common parameters:
aItem->m_Info = m_textCtrlComment->GetValue(); aItem->m_Info = m_textCtrlComment->GetValue();
......
...@@ -50,6 +50,12 @@ public: ...@@ -50,6 +50,12 @@ public:
void OnAcceptPrms( wxCommandEvent& event ); void OnAcceptPrms( wxCommandEvent& event );
// Data transfert from general properties to widgets
void CopyPrmsFromGeneralToPanel();
// Data transfert from widgets to general properties
bool CopyPrmsFromPanelToGeneral();
// Data transfert from item to widgets in properties frame // Data transfert from item to widgets in properties frame
void CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem ); void CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem );
......
( page_layout
( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )
( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) )
( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )
( line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )
( line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 ltcorner) (font (size 1.3 1.3))
(justify center)(repeat 100) (incry 50) )
( line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 rtcorner) (font (size 1.3 1.3))
(justify center) (repeat 100) (incry 50) )
( tbtext "Date: %D" (pos 87 6.9) )
( line (start 110 5.5) end 2 5.5) )
( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) )
( line (start 110 8.5) end 2 8.5) )
( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) )
( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) )
( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) )
( line (start 110 12.5) end 2 12.5) )
( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) )
( tbtext "File: %F" (pos 109 14.3) )
( line (start 110 18.5) end 2 18.5) )
( tbtext "Sheet: %P" (pos 109 17) )
( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) )
( tbtext "%C0" (comment "Comment 0") (pos 109 23) )
( tbtext "%C1" (comment "Comment 1") (pos 109 26) )
( tbtext "%C2" (comment "Comment 2") (pos 109 29) )
( tbtext "%C3" (comment "Comment 3") (pos 109 32) )
( line (start 90 8.5) end 90 5.5) )
( line (start 26 8.5) end 26 2) )
)
( page_layout ( page_layout
(setup(textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)) ( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )
(rect (name item1:Rect) (start 110 34) (end 2 2)) ( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) )
(rect (name item2:Rect) (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2)) ( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
(line (name item3:Line) (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50)) ( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
(tbtext 1 (name item4:Text) (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) (incrlabel 0)) ( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )
(line (name item5:Line) (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50)) ( line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )
(tbtext 1 (name item6:Text) (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) (incrlabel 0)) ( tbtext "1" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )
(line (name item7:Line) (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50)) ( line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )
(tbtext A (name item8:Text) (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) (incrlabel 0)) ( tbtext "A" (pos 1 25 ltcorner) (font (size 1.3 1.3))
(line (name item9:Line) (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50)) (justify center)(repeat 100) (incry 50) )
(tbtext A (name item10:Text) (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) (incrlabel 0)) ( line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )
(tbtext "Date: %D" (name item11:Text) (pos 87 6.9)) ( tbtext "A" (pos 1 25 rtcorner) (font (size 1.3 1.3))
(line (name item12:Line) (start 110 5.5) (end 2 5.5)) (justify center) (repeat 100) (incry 50) )
(tbtext %K (name item13:Text) (pos 109 4.1)) ( tbtext "Date: %D" (pos 87 6.9) )
(line (name item14:Line) (start 110 8.5) (end 2 8.5)) ( line (start 110 5.5) end 2 5.5) )
(tbtext "Rev: %R" (name item15:Text) (pos 24 6.9) (font bold)) ( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) )
(tbtext "Size: %Z" (name item16:Text) (pos 109 6.9)) ( line (start 110 8.5) end 2 8.5) )
(tbtext "Id: %S/%N" (name item17:Text) (pos 24 4.1)) ( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) )
(line (name item18:Line) (start 110 12.5) (end 2 12.5)) ( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) )
(tbtext "Title: %T" (name item19:Text) (pos 109 10.7) (font (size 2 2) bold)) ( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) )
(tbtext "File: %F" (name item20:Text) (pos 109 14.3)) ( line (start 110 12.5) end 2 12.5) )
(line (name item21:Line) (start 110 18.5) (end 2 18.5)) ( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) )
(tbtext "Sheet: %P" (name item22:Text) (pos 109 17)) ( tbtext "File: %F" (pos 109 14.3) )
(tbtext %Y (name item23:Text) (pos 109 20) (font bold)) ( line (start 110 18.5) end 2 18.5) )
(tbtext %C0 (name item24:Text) (pos 109 23)) ( tbtext "Sheet: %P" (pos 109 17) )
(tbtext %C1 (name item25:Text) (pos 109 26)) ( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) )
(tbtext %C2 (name item26:Text) (pos 109 29)) ( tbtext "%C0" (comment "Comment 0") (pos 109 23) )
(tbtext %C3 (name item27:Text) (pos 109 32)) ( tbtext "%C1" (comment "Comment 1") (pos 109 26) )
(line (name item28:Line) (start 90 8.5) (end 90 5.5)) ( tbtext "%C2" (comment "Comment 2") (pos 109 29) )
(line (name item29:Line) (start 26 8.5) (end 26 2)) ( tbtext "%C3" (comment "Comment 3") (pos 109 32) )
(rect (name item30:Rect) (start 157 34) (end 110 2)) ( line (start 90 8.5) end 90 5.5) )
( line (start 26 8.5) end 26 2) )
) )
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