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

Fixed minor bugs and printing problems, and others minor enhancements

parent ac00eede
...@@ -4,6 +4,11 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,11 @@ 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-apr-22, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew+Gerbview:
Fixed minor problems in printing.
2010-apr-19, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-apr-19, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++Pcbnew: ++Pcbnew:
......
...@@ -62,6 +62,7 @@ private: ...@@ -62,6 +62,7 @@ private:
void OnPageSetup( wxCommandEvent& event ); void OnPageSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event ); void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnScaleSelectionClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); } void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
void SetPrintParameters( ); void SetPrintParameters( );
...@@ -210,6 +211,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -210,6 +211,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
} }
m_ScaleOption->SetSelection( scale_idx ); m_ScaleOption->SetSelection( scale_idx );
scale_idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror); m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
...@@ -225,6 +228,12 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -225,6 +228,12 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustXscaleOpt->SetValue( msg ); m_FineAdjustXscaleOpt->SetValue( msg );
msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust ); msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust );
m_FineAdjustYscaleOpt->SetValue( msg ); m_FineAdjustYscaleOpt->SetValue( msg );
bool enable = (s_Parameters.m_PrintScale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
} }
/*************************************************/ /*************************************************/
...@@ -336,6 +345,16 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) ...@@ -336,6 +345,16 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
g_pcb_plot_options.ScaleAdjX = s_Parameters.m_YScaleAdjust; g_pcb_plot_options.ScaleAdjX = s_Parameters.m_YScaleAdjust;
} }
void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
{
double scale = s_ScaleList[m_ScaleOption->GetSelection()];
bool enable = (scale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
}
/**********************************************************/ /**********************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
/**********************************************************/ /**********************************************************/
......
...@@ -95,16 +95,16 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -95,16 +95,16 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
b_buttonsSizer = new wxBoxSizer( wxVERTICAL ); b_buttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_buttonOption, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); b_buttonsSizer->Add( m_buttonOption, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPreview = new wxButton( this, wxID_PREVIEW, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPreview = new wxButton( this, wxID_PREVIEW, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); b_buttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); b_buttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); b_buttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
...@@ -113,6 +113,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -113,6 +113,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this ); m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
...@@ -123,6 +124,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base() ...@@ -123,6 +124,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this ); m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
......
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event> <event name="OnRadioBox">OnScaleSelectionClick</event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
...@@ -601,7 +601,7 @@ ...@@ -601,7 +601,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -653,7 +653,7 @@ ...@@ -653,7 +653,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -705,7 +705,7 @@ ...@@ -705,7 +705,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -757,7 +757,7 @@ ...@@ -757,7 +757,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
......
...@@ -59,6 +59,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog ...@@ -59,6 +59,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnScaleSelectionClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPageSetup( wxCommandEvent& event ){ event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); }
......
...@@ -63,6 +63,7 @@ private: ...@@ -63,6 +63,7 @@ private:
void OnPageSetup( wxCommandEvent& event ); void OnPageSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event ); void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnScaleSelectionClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); } void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
void SetPrintParameters( ); void SetPrintParameters( );
...@@ -242,6 +243,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -242,6 +243,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
} }
m_ScaleOption->SetSelection( scale_idx ); m_ScaleOption->SetSelection( scale_idx );
scale_idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror); m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer); m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref ); m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref );
...@@ -265,6 +268,12 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -265,6 +268,12 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustXscaleOpt->SetValue( msg ); m_FineAdjustXscaleOpt->SetValue( msg );
msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust ); msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust );
m_FineAdjustYscaleOpt->SetValue( msg ); m_FineAdjustYscaleOpt->SetValue( msg );
bool enable = (s_Parameters.m_PrintScale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
} }
...@@ -423,6 +432,16 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() ...@@ -423,6 +432,16 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); ReturnStringFromValue( g_UnitMetric, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) );
} }
void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
{
double scale = s_ScaleList[m_ScaleOption->GetSelection()];
bool enable = (scale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
}
/**********************************************************/ /**********************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
......
...@@ -148,6 +148,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -148,6 +148,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this ); m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
...@@ -158,6 +159,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base() ...@@ -158,6 +159,7 @@ DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this ); m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this );
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event> <event name="OnRadioBox">OnScaleSelectionClick</event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
......
...@@ -67,6 +67,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog ...@@ -67,6 +67,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnScaleSelectionClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPageSetup( wxCommandEvent& event ){ event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); }
......
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "confirm.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "drawtxt.h"
/* Routines Locales */ /* Routines Locales */
static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC );
...@@ -23,10 +25,10 @@ static int status_cotation; /* = 0 : pas de cotation en cours ...@@ -23,10 +25,10 @@ static int status_cotation; /* = 0 : pas de cotation en cours
* Les routines generent une cotation de la forme * Les routines generent une cotation de la forme
* - cote usuelle: * - cote usuelle:
* *
| | * | |
| dist | * | dist |
|<---------->| * |<---------->|
| | * | |
* *
*/ */
...@@ -40,10 +42,10 @@ enum id_Cotation_properties { ...@@ -40,10 +42,10 @@ enum id_Cotation_properties {
}; };
/************************************/ /************************************/
/* class WinEDA_CotationPropertiesFrame */ /* class DIMENSION_EDITOR_DIALOG */
/************************************/ /************************************/
class WinEDA_CotationPropertiesFrame : public wxDialog class DIMENSION_EDITOR_DIALOG : public wxDialog
{ {
private: private:
...@@ -59,9 +61,9 @@ private: ...@@ -59,9 +61,9 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* parent, DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
COTATION* Cotation, wxDC* DC, const wxPoint& pos ); COTATION* Cotation, wxDC* DC, const wxPoint& pos );
~WinEDA_CotationPropertiesFrame() ~DIMENSION_EDITOR_DIALOG()
{ {
} }
...@@ -73,13 +75,13 @@ private: ...@@ -73,13 +75,13 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_CotationPropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( DIMENSION_EDITOR_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_CotationPropertiesFrame::OnOkClick ) EVT_BUTTON( wxID_OK, DIMENSION_EDITOR_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_CotationPropertiesFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, DIMENSION_EDITOR_DIALOG::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* parent, DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
COTATION* Cotation, wxDC* DC, COTATION* Cotation, wxDC* DC,
const wxPoint& framepos ) : const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Dimension properties" ), framepos, wxSize( 340, 270 ), wxDialog( parent, -1, _( "Dimension properties" ), framepos, wxSize( 340, 270 ),
...@@ -146,7 +148,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* ...@@ -146,7 +148,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
/**********************************************************************/ /**********************************************************************/
void WinEDA_CotationPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) ) void DIMENSION_EDITOR_DIALOG::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -154,7 +156,7 @@ void WinEDA_CotationPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (ev ...@@ -154,7 +156,7 @@ void WinEDA_CotationPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (ev
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event ) void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
/***********************************************************************************/ /***********************************************************************************/
{ {
if( m_DC ) // Effacement ancien texte if( m_DC ) // Effacement ancien texte
...@@ -169,8 +171,16 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event ) ...@@ -169,8 +171,16 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
} }
CurrentCotation->m_Text->m_Size = m_TxtSizeCtrl->GetValue(); CurrentCotation->m_Text->m_Size = m_TxtSizeCtrl->GetValue();
CurrentCotation->m_Text->m_Width = CurrentCotation->m_Width =
m_TxtWidthCtrl->GetValue(); int width = m_TxtWidthCtrl->GetValue();
int maxthickness = Clamp_Text_PenSize(width, CurrentCotation->m_Text->m_Size );
if( width > maxthickness )
{
DisplayError(NULL, _("The text thickness is too large for the text size. It will be clamped"));
width = maxthickness;
}
CurrentCotation->m_Text->m_Width = CurrentCotation->m_Width = width ;
CurrentCotation->m_Text->m_Mirror = (m_Mirror->GetSelection() == 1) ? true : false; CurrentCotation->m_Text->m_Mirror = (m_Mirror->GetSelection() == 1) ? true : false;
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER ); CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
...@@ -227,8 +237,6 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -227,8 +237,6 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->m_Flags = IS_NEW; Cotation->m_Flags = IS_NEW;
Cotation->SetLayer( getActiveLayer() ); Cotation->SetLayer( getActiveLayer() );
Cotation->m_Width = GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth;
Cotation->m_Text->m_Width = Cotation->m_Width;
Cotation->Barre_ox = Cotation->Barre_fx = pos.x; Cotation->Barre_ox = Cotation->Barre_fx = pos.x;
Cotation->Barre_oy = Cotation->Barre_fy = pos.y; Cotation->Barre_oy = Cotation->Barre_fy = pos.y;
...@@ -252,8 +260,14 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -252,8 +260,14 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->FlecheD2_oy = Cotation->FlecheD2_fy = pos.y; Cotation->FlecheD2_oy = Cotation->FlecheD2_fy = pos.y;
Cotation->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; Cotation->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
Cotation->m_Text->m_Width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, Cotation->m_Text->m_Size );
if( width > maxthickness )
{
width = maxthickness;
}
Cotation->m_Text->m_Width = Cotation->m_Width = width ;
Ajuste_Details_Cotation( Cotation ); Ajuste_Details_Cotation( Cotation );
Cotation->Draw( DrawPanel, DC, GR_XOR ); Cotation->Draw( DrawPanel, DC, GR_XOR );
...@@ -273,8 +287,11 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -273,8 +287,11 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->Draw( DrawPanel, DC, GR_OR ); Cotation->Draw( DrawPanel, DC, GR_OR );
Cotation->m_Flags = 0; Cotation->m_Flags = 0;
/* Insertion de la structure dans le Chainage .Drawings du PCB */ /* ADD this new item in list */
GetBoard()->Add( Cotation ); GetBoard()->Add( Cotation );
// Add store it in undo/redo list
SaveCopyInUndoList( Cotation, UR_NEW );
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
...@@ -347,8 +364,7 @@ void WinEDA_PcbFrame::Install_Edit_Cotation( COTATION* Cotation, ...@@ -347,8 +364,7 @@ void WinEDA_PcbFrame::Install_Edit_Cotation( COTATION* Cotation,
if( Cotation == NULL ) if( Cotation == NULL )
return; return;
WinEDA_CotationPropertiesFrame* frame = new WinEDA_CotationPropertiesFrame( this, DIMENSION_EDITOR_DIALOG* frame = new DIMENSION_EDITOR_DIALOG( this, Cotation, DC, pos );
Cotation, DC, pos );
Ajuste_Details_Cotation( Cotation, true ); Ajuste_Details_Cotation( Cotation, true );
frame->ShowModal(); frame->ShowModal();
......
...@@ -88,6 +88,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -88,6 +88,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
break; break;
case TYPE_COTATION:
// see above.
break;
default: default:
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
{ {
...@@ -348,7 +352,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -348,7 +352,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
} }
else else
DisplayError( this, wxT( "Internal err: Struct not COTATION" ) ); DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() error item is not a DIMENSION" ) );
break; break;
case ID_PCB_DELETE_ITEM_BUTT: case ID_PCB_DELETE_ITEM_BUTT:
......
...@@ -262,11 +262,17 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, ...@@ -262,11 +262,17 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
if( pt_texte->m_Mirror ) if( pt_texte->m_Mirror )
NEGATE( size.x ); // Text is mirrored NEGATE( size.x ); // Text is mirrored
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
// but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
// (like bold text) and we manage the thickness.
// So we set bold flag to true
bool allow_bold = pt_texte->m_Bold || thickness;
plotter->text( pos, BLACK, plotter->text( pos, BLACK,
pt_texte->m_Text, pt_texte->m_Text,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, allow_bold );
} }
...@@ -511,6 +517,12 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -511,6 +517,12 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
if( pt_texte->m_Mirror ) if( pt_texte->m_Mirror )
size.x = -size.x; size.x = -size.x;
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
// but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
// (like bold text) and we manage the thickness.
// So we set bold flag to true
bool allow_bold = pt_texte->m_Bold || thickness;
if( pt_texte->m_MultilineAllowed ) if( pt_texte->m_MultilineAllowed )
{ {
wxArrayString* list = wxStringSplit( pt_texte->m_Text, '\n' ); wxArrayString* list = wxStringSplit( pt_texte->m_Text, '\n' );
...@@ -526,7 +538,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -526,7 +538,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
txt, txt,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, allow_bold );
pos += offset; pos += offset;
} }
...@@ -537,7 +549,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -537,7 +549,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
pt_texte->m_Text, pt_texte->m_Text,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, allow_bold );
} }
......
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