Commit 1671432a authored by jean-pierre charras's avatar jean-pierre charras

All: Fix an usually unwanted behavior in kicad: When closing a dialog (mainly...

All: Fix an usually unwanted behavior in kicad: When closing a dialog (mainly ERC, DRC and recently a component selection by the library viewer on a double click) the mouse release left button event (which is seen by the parent after closing the dialog, becuse it is actually made in the parent) generate an unwanted command (item selection, component place ...)
This event can be now skipped if needed by calling  EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent() from the dialog.
Very minor other fixes
parents 3e7c4a76 14fcf7f9
...@@ -209,6 +209,20 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event ) ...@@ -209,6 +209,20 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
event.Skip(); event.Skip();
} }
/* function SkipNextLeftButtonReleaseEvent
* after calling this function, if the left mouse button
* is down, the next left mouse button release event will be ignored.
* It is is usefull for instance when closing a dialog on a mouse click,
* to skip the next mouse left button release event
* by the parent window, because the mouse button
* clicked on the dialog is often released in the parent frame,
* and therefore creates a left button released mouse event
* which can be unwanted in some cases
*/
void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
{
m_canvas->SetIgnoreLeftButtonReleaseEvent( true );
}
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent ) void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{ {
......
...@@ -105,6 +105,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -105,6 +105,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_panScrollbarLimits = false; m_panScrollbarLimits = false;
m_enableAutoPan = true; m_enableAutoPan = true;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
m_ignoreNextLeftButtonRelease = false;
m_mouseCaptureCallback = NULL; m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL;
...@@ -118,6 +119,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -118,6 +119,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_requestAutoPan = false; m_requestAutoPan = false;
m_enableBlockCommands = false; m_enableBlockCommands = false;
m_minDragEventCount = 0;
#ifdef __WXMAC__ #ifdef __WXMAC__
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS; m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
...@@ -874,14 +876,6 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -874,14 +876,6 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
* on a double click.
*/
static bool ignoreNextLeftButtonRelease = false;
static EDA_DRAW_PANEL* LastPanel = NULL;
int localrealbutt = 0, localbutt = 0; int localrealbutt = 0, localbutt = 0;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
...@@ -893,18 +887,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -893,18 +887,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
*/ */
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5 #define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
/* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
* and m_canStartBlock >= 0
* in order to avoid spurious block commands.
*/
static int MinDragEventCount;
if( event.Leaving() ) if( event.Leaving() )
{
m_canStartBlock = -1; m_canStartBlock = -1;
}
if( !IsMouseCaptured() ) // No mouse capture in progress. if( !IsMouseCaptured() ) // No mouse capture in progress.
m_requestAutoPan = false; m_requestAutoPan = false;
...@@ -915,9 +899,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -915,9 +899,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
return; return;
if( !event.IsButton() && !event.Moving() && !event.Dragging() ) if( !event.IsButton() && !event.Moving() && !event.Dragging() )
{
return; return;
}
if( event.RightDown() ) if( event.RightDown() )
{ {
...@@ -970,26 +952,29 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -970,26 +952,29 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// inhibit a response to the mouse left button release, // inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new // because we have a double click, and we do not want a new
// OnLeftClick command at end of this Double Click // OnLeftClick command at end of this Double Click
ignoreNextLeftButtonRelease = true; m_ignoreNextLeftButtonRelease = true;
} }
else if( event.LeftUp() ) else if( event.LeftUp() )
{ {
// A block command is in progress: a left up is the end of block // A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen // or this is the end of a double click, already seen
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease ) // Note also m_ignoreNextLeftButtonRelease can be set by
// the call to OnLeftClick(), so do not change it after calling OnLeftClick
bool ignoreEvt = m_ignoreNextLeftButtonRelease;
m_ignoreNextLeftButtonRelease = false;
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) ); GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
ignoreNextLeftButtonRelease = false;
} }
else if( !event.LeftIsDown() )
if( !event.LeftIsDown() )
{ {
/* be sure there is a response to a left button release command /* be sure there is a response to a left button release command
* even when a LeftUp event is not seen. This happens when a * even when a LeftUp event is not seen. This happens when a
* double click opens a dialog box, and the release mouse button * double click opens a dialog box, and the release mouse button
* is made when the dialog box is open. * is made when the dialog box is opened.
*/ */
ignoreNextLeftButtonRelease = false; m_ignoreNextLeftButtonRelease = false;
} }
if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) && m_enableMiddleButtonPan ) if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) && m_enableMiddleButtonPan )
...@@ -1115,9 +1100,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1115,9 +1100,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
/*******************************/ /*******************************/
// Command block can't start if mouse is dragging a new panel // Command block can't start if mouse is dragging a new panel
if( LastPanel != this ) static EDA_DRAW_PANEL* lastPanel;
if( lastPanel != this )
{ {
MinDragEventCount = 0; m_minDragEventCount = 0;
m_canStartBlock = -1; m_canStartBlock = -1;
} }
...@@ -1129,7 +1115,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1129,7 +1115,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
*/ */
if( !event.LeftIsDown() && !event.MiddleIsDown() ) if( !event.LeftIsDown() && !event.MiddleIsDown() )
{ {
MinDragEventCount = 0; m_minDragEventCount = 0;
m_canStartBlock = 0; m_canStartBlock = 0;
/* Remember the last cursor position when a drag mouse starts /* Remember the last cursor position when a drag mouse starts
...@@ -1155,7 +1141,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1155,7 +1141,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
m_requestAutoPan = false; m_requestAutoPan = false;
GetParent()->HandleBlockPlace( &DC ); GetParent()->HandleBlockPlace( &DC );
ignoreNextLeftButtonRelease = true; m_ignoreNextLeftButtonRelease = true;
} }
} }
else if( ( m_canStartBlock >= 0 ) else if( ( m_canStartBlock >= 0 )
...@@ -1174,8 +1160,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1174,8 +1160,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// A block command is started if the drag is enough. A small // A block command is started if the drag is enough. A small
// drag is ignored (it is certainly a little mouse move when // drag is ignored (it is certainly a little mouse move when
// clicking) not really a drag mouse // clicking) not really a drag mouse
if( MinDragEventCount < MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND ) if( m_minDragEventCount < MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND )
MinDragEventCount++; m_minDragEventCount++;
else else
{ {
if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) ) if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) )
...@@ -1250,7 +1236,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1250,7 +1236,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
GetParent()->PrintMsg( msg_debug ); GetParent()->PrintMsg( msg_debug );
#endif #endif
LastPanel = this; lastPanel = this;
} }
......
...@@ -205,6 +205,11 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event ) ...@@ -205,6 +205,11 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event )
{ {
m_parent->GetScreen()->SetCrossHairPosition( m_lastMarkerFound->m_Pos ); m_parent->GetScreen()->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true); m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true);
// prevent a mouse left button release event in
// coming from the ERC dialog double click
// ( the button is released after closing this dialog and will generate
// an unwanted event in parent frame)
m_parent->SkipNextLeftButtonReleaseEvent();
EndModal( 1 ); EndModal( 1 );
} }
} }
......
...@@ -216,7 +216,6 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, ...@@ -216,7 +216,6 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
{ {
int unit = 1; int unit = 1;
int convert = 1; int convert = 1;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
m_canvas->SetIgnoreMouseEvents( true ); m_canvas->SetIgnoreMouseEvents( true );
......
...@@ -100,10 +100,10 @@ static wxAcceleratorEntry accels[] = ...@@ -100,10 +100,10 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" ) #define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
wxSemaphore* semaphore, long style ) : wxSemaphore* aSemaphore, long aStyle ) :
SCH_BASE_FRAME( father, VIEWER_FRAME_TYPE, _( "Library Browser" ), SCH_BASE_FRAME( aParent, VIEWER_FRAME_TYPE, _( "Library Browser" ),
wxDefaultPosition, wxDefaultSize, style, GetLibViewerFrameName() ) wxDefaultPosition, wxDefaultSize, aStyle, GetLibViewerFrameName() )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
...@@ -121,7 +121,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, ...@@ -121,7 +121,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
m_LibList = NULL; m_LibList = NULL;
m_LibListWindow = NULL; m_LibListWindow = NULL;
m_CmpListWindow = NULL; m_CmpListWindow = NULL;
m_Semaphore = semaphore; m_Semaphore = aSemaphore;
if( m_Semaphore ) if( m_Semaphore )
SetModalMode( true ); SetModalMode( true );
m_exportToEeschemaCmpName.Empty(); m_exportToEeschemaCmpName.Empty();
...@@ -146,7 +146,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, ...@@ -146,7 +146,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
wxPoint win_pos( 0, 0 ); wxPoint win_pos( 0, 0 );
if( Library == NULL ) if( aLibrary == NULL )
{ {
// Creates the libraries window display // Creates the libraries window display
m_LibListWindow = m_LibListWindow =
...@@ -163,7 +163,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, ...@@ -163,7 +163,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
} }
else else
{ {
m_libraryName = Library->GetName(); m_libraryName = aLibrary->GetName();
m_entryName.Clear(); m_entryName.Clear();
m_unit = 1; m_unit = 1;
m_convert = 1; m_convert = 1;
...@@ -507,7 +507,7 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) ...@@ -507,7 +507,7 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
// Prevent the double click from being as a single click in the parent // Prevent the double click from being as a single click in the parent
// window which would cause the part to be parked rather than staying // window which would cause the part to be parked rather than staying
// in drag mode. // in drag mode.
event.StopPropagation(); ((SCH_BASE_FRAME*) GetParent())->SkipNextLeftButtonReleaseEvent();
} }
} }
......
...@@ -73,9 +73,9 @@ protected: ...@@ -73,9 +73,9 @@ protected:
static int m_convert; static int m_convert;
public: public:
LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL, LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary = NULL,
wxSemaphore* semaphore = NULL, wxSemaphore* aSemaphore = NULL,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );
~LIB_VIEW_FRAME(); ~LIB_VIEW_FRAME();
......
...@@ -83,8 +83,20 @@ private: ...@@ -83,8 +83,20 @@ private:
bool m_ignoreMouseEvents; ///< Ignore mouse events when true. bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
* on a double click.
*/
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
bool m_enableBlockCommands; ///< True enables block commands. bool m_enableBlockCommands; ///< True enables block commands.
int m_minDragEventCount; /* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
* in order to avoid spurious block commands. */
/// True when drawing in mirror mode. Used by the draw arc function, because arcs /// True when drawing in mirror mode. Used by the draw arc function, because arcs
/// are oriented, and in mirror mode, orientations are reversed. /// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored; bool m_PrintIsMirrored;
...@@ -134,6 +146,8 @@ public: ...@@ -134,6 +146,8 @@ public:
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; } void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; } void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; } bool GetPrintMirrored() const { return m_PrintIsMirrored; }
......
...@@ -498,6 +498,19 @@ public: ...@@ -498,6 +498,19 @@ public:
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
/** function SkipNextLeftButtonReleaseEvent
* after calling this function, if the left mouse button
* is down, the next left mouse button release event will be ignored.
* It is is usefull for instance when closing a dialog on a mouse click,
* to skip the next mouse left button release event
* by the parent window, because the mouse button
* clicked on the dialog is often released in the parent frame,
* and therefore creates a left button released mouse event
* which can be unwanted in some cases
*/
void SkipNextLeftButtonReleaseEvent();
virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem = NULL ); EDA_ITEM* aItem = NULL );
......
...@@ -494,6 +494,27 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -494,6 +494,27 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
frame->AppendMsgPanel( _( "Orient" ), msg, BROWN ); frame->AppendMsgPanel( _( "Orient" ), msg, BROWN );
/* Controls on right side of the dialog */
switch( m_Attributs & 255 )
{
case 0:
msg = _("Normal");
break;
case MOD_CMS:
msg = _("Insert");
break;
case MOD_VIRTUAL:
msg = _("Virtual");
break;
default:
msg = wxT("???");
break;
}
frame->AppendMsgPanel( _( "Attrib" ), msg, BROWN );
frame->AppendMsgPanel( _( "Module" ), m_LibRef, BLUE ); frame->AppendMsgPanel( _( "Module" ), m_LibRef, BLUE );
if( m_3D_Drawings != NULL ) if( m_3D_Drawings != NULL )
......
...@@ -347,7 +347,9 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event ) ...@@ -347,7 +347,9 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
// no destruction so we can preserve listbox cursor // no destruction so we can preserve listbox cursor
Show( false ); Show( false );
event.StopPropagation(); // still get the popup window. // We do not want the clarification popup window.
// when releasing the left button in the main window
m_Parent->SkipNextLeftButtonReleaseEvent();
} }
} }
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -77,8 +77,8 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare ...@@ -77,8 +77,8 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
wxStaticBoxSizer* sbSizerMsg; wxStaticBoxSizer* sbSizerMsg;
sbSizerMsg = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL ); sbSizerMsg = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,70 ) ); m_messagesBox->SetMinSize( wxSize( -1,150 ) );
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 ); sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
...@@ -97,7 +97,6 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare ...@@ -97,7 +97,6 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
this->SetSizer( m_MainSizer ); this->SetSizer( m_MainSizer );
this->Layout(); this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_GEN_MODULE_POSITION_BASE</property> <property name="name">DIALOG_GEN_MODULE_POSITION_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">510,351</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Position Files:</property> <property name="title">Position Files:</property>
...@@ -717,7 +717,7 @@ ...@@ -717,7 +717,7 @@
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">-1,70</property> <property name="minimum_size">-1,150</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_messagesBox</property> <property name="name">m_messagesBox</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
...@@ -728,7 +728,7 @@ ...@@ -728,7 +728,7 @@
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size">-1,-1</property>
<property name="style">wxTE_MULTILINE|wxTE_READONLY</property> <property name="style">wxTE_MULTILINE|wxTE_READONLY</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -57,7 +57,7 @@ class DIALOG_GEN_MODULE_POSITION_BASE : public DIALOG_SHIM ...@@ -57,7 +57,7 @@ class DIALOG_GEN_MODULE_POSITION_BASE : public DIALOG_SHIM
public: public:
DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Position Files:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Position Files:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 510,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GEN_MODULE_POSITION_BASE(); ~DIALOG_GEN_MODULE_POSITION_BASE();
}; };
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#define MinimalHeaderKey wxT( "DrillMinHeader" ) #define MinimalHeaderKey wxT( "DrillMinHeader" )
#define UnitDrillInchKey wxT( "DrillUnit" ) #define UnitDrillInchKey wxT( "DrillUnit" )
#define DrillOriginIsAuxAxisKey wxT( "DrillAuxAxis" ) #define DrillOriginIsAuxAxisKey wxT( "DrillAuxAxis" )
#define DrillMapFileTypeKey wxT( "DrillMapFileType" )
// list of allowed precision for EXCELLON files, for integer format: // list of allowed precision for EXCELLON files, for integer format:
// Due to difference between inches and mm, // Due to difference between inches and mm,
...@@ -98,11 +99,12 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL() ...@@ -98,11 +99,12 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL()
void DIALOG_GENDRILL::initDialog() void DIALOG_GENDRILL::initDialog()
{ {
m_config->Read( ZerosFormatKey, &DIALOG_GENDRILL::m_ZerosFormat ); m_config->Read( ZerosFormatKey, &m_ZerosFormat );
m_config->Read( MirrorKey, &DIALOG_GENDRILL::m_Mirror ); m_config->Read( MirrorKey, &m_Mirror );
m_config->Read( MinimalHeaderKey, &DIALOG_GENDRILL::m_MinimalHeader ); m_config->Read( MinimalHeaderKey, &m_MinimalHeader );
m_config->Read( UnitDrillInchKey, &DIALOG_GENDRILL::m_UnitDrillIsInch ); m_config->Read( UnitDrillInchKey, &m_UnitDrillIsInch );
m_config->Read( DrillOriginIsAuxAxisKey, &DIALOG_GENDRILL::m_DrillOriginIsAuxAxis ); m_config->Read( DrillOriginIsAuxAxisKey, &m_DrillOriginIsAuxAxis );
m_config->Read( DrillMapFileTypeKey, &m_mapFileType );
InitDisplayParams(); InitDisplayParams();
} }
...@@ -114,20 +116,15 @@ void DIALOG_GENDRILL::InitDisplayParams() ...@@ -114,20 +116,15 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 ); m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 );
m_Choice_Zeros_Format->SetSelection( m_ZerosFormat ); m_Choice_Zeros_Format->SetSelection( m_ZerosFormat );
UpdatePrecisionOptions(); UpdatePrecisionOptions();
m_Check_Minimal->SetValue( m_MinimalHeader ); m_Check_Minimal->SetValue( m_MinimalHeader );
if( m_DrillOriginIsAuxAxis ) if( m_DrillOriginIsAuxAxis )
m_Choice_Drill_Offset->SetSelection( 1 ); m_Choice_Drill_Offset->SetSelection( 1 );
m_Check_Mirror->SetValue( m_Mirror ); m_Check_Mirror->SetValue( m_Mirror );
m_Choice_Drill_Map->SetSelection( m_mapFileType ); m_Choice_Drill_Map->SetSelection( m_mapFileType );
m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) ); m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) ); m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
// See if we have some buried vias or/and microvias, and display // See if we have some buried vias or/and microvias, and display
...@@ -171,7 +168,7 @@ void DIALOG_GENDRILL::InitDisplayParams() ...@@ -171,7 +168,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
} }
else else
{ {
if( std::min( pad->GetDrillSize().x, pad->GetDrillSize().y ) != 0 ) if( pad->GetDrillSize().x != 0 && pad->GetDrillSize().y != 0 )
{ {
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED ) if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++; m_notplatedPadsHoleCount++;
...@@ -217,6 +214,7 @@ void DIALOG_GENDRILL::UpdateConfig() ...@@ -217,6 +214,7 @@ void DIALOG_GENDRILL::UpdateConfig()
m_config->Write( MinimalHeaderKey, m_MinimalHeader ); m_config->Write( MinimalHeaderKey, m_MinimalHeader );
m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch ); m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
m_config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis ); m_config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis );
m_config->Write( DrillMapFileTypeKey, m_mapFileType );
} }
...@@ -335,7 +333,7 @@ void DIALOG_GENDRILL::SetParams() ...@@ -335,7 +333,7 @@ void DIALOG_GENDRILL::SetParams()
/** /**
* Function GenDrillAndMapFiles * Function GenDrillAndMapFiles
* Calls the functions to create EXCELLON drill files and/or drill map files * Calls the functions to create EXCELLON drill files and/or drill map files
* >When all holes are through, only one excellon file is created. * >When all holes are through holes, only one excellon file is created.
* >When there are some partial holes (some blind or buried vias), * >When there are some partial holes (some blind or buried vias),
* one excellon file is created, for all plated through holes, * one excellon file is created, for all plated through holes,
* and one file per layer pair, which have one or more holes, excluding * and one file per layer pair, which have one or more holes, excluding
......
...@@ -300,23 +300,23 @@ void DIALOG_PAD_PROPERTIES::initValues() ...@@ -300,23 +300,23 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() ); m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
// Display current unit name in dialog: // Display current unit name in dialog:
m_PadPosX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadPosX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadPosY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadPosY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadDrill_X_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadDrill_X_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadDrill_Y_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadDrill_Y_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadShapeSizeX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadShapeSizeX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadShapeSizeY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadShapeSizeY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadShapeOffsetX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadShapeOffsetY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadShapeDelta_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadShapeDelta_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_PadLengthDie_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_PadLengthDie_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
// Display current pad masks clearances units // Display current pad masks clearances units
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderMaskMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderPasteMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_ThermalWidthUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_ThermalWidthUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_ThermalGapUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_ThermalGapUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
// Display current pad parameters units: // Display current pad parameters units:
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->GetPosition().x ); PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->GetPosition().x );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -48,8 +48,8 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -48,8 +48,8 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxID_PADNETNAMECTRL wxID_PADNETNAMECTRL
}; };
wxNotebook* m_notebook1; wxNotebook* m_notebook;
wxPanel* m_panel2; wxPanel* m_panelGeneral;
wxStaticText* m_PadNumText; wxStaticText* m_PadNumText;
wxTextCtrl* m_PadNumCtrl; wxTextCtrl* m_PadNumCtrl;
wxStaticText* m_PadNameText; wxStaticText* m_PadNameText;
...@@ -95,7 +95,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -95,7 +95,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_staticModuleRotValue; wxStaticText* m_staticModuleRotValue;
wxStaticText* m_staticTitleModuleSide; wxStaticText* m_staticTitleModuleSide;
wxStaticText* m_staticModuleSideValue; wxStaticText* m_staticModuleSideValue;
wxStaticText* m_staticTextWarningPadFlipped;
wxStaticText* m_staticText47; wxStaticText* m_staticText47;
wxChoice* m_DrillShapeCtrl; wxChoice* m_DrillShapeCtrl;
wxStaticText* m_staticText51; wxStaticText* m_staticText51;
...@@ -118,7 +117,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -118,7 +117,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxCheckBox* m_PadLayerDraft; wxCheckBox* m_PadLayerDraft;
wxCheckBox* m_PadLayerECO1; wxCheckBox* m_PadLayerECO1;
wxCheckBox* m_PadLayerECO2; wxCheckBox* m_PadLayerECO2;
wxPanel* m_panelShowPad;
wxPanel* m_localSettingsPanel; wxPanel* m_localSettingsPanel;
wxStaticText* m_staticTextNetClearance; wxStaticText* m_staticTextNetClearance;
wxTextCtrl* m_NetClearanceValueCtrl; wxTextCtrl* m_NetClearanceValueCtrl;
...@@ -134,7 +132,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -134,7 +132,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_SolderPasteRatioMarginUnits; wxStaticText* m_SolderPasteRatioMarginUnits;
wxStaticText* m_staticText40; wxStaticText* m_staticText40;
wxChoice* m_ZoneConnectionChoice; wxChoice* m_ZoneConnectionChoice;
wxStaticText* m_staticText43;
wxStaticText* m_staticText49; wxStaticText* m_staticText49;
wxTextCtrl* m_ThermalWidthCtrl; wxTextCtrl* m_ThermalWidthCtrl;
wxStaticText* m_ThermalWidthUnits; wxStaticText* m_ThermalWidthUnits;
...@@ -142,6 +139,8 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -142,6 +139,8 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxTextCtrl* m_ThermalGapCtrl; wxTextCtrl* m_ThermalGapCtrl;
wxStaticText* m_ThermalGapUnits; wxStaticText* m_ThermalGapUnits;
wxStaticText* m_staticTextWarning; wxStaticText* m_staticTextWarning;
wxPanel* m_panelShowPad;
wxStaticText* m_staticTextWarningPadFlipped;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
...@@ -160,7 +159,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM ...@@ -160,7 +159,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
public: public:
DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 857,618 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 857,630 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER );
~DIALOG_PAD_PROPERTIES_BASE(); ~DIALOG_PAD_PROPERTIES_BASE();
}; };
......
...@@ -338,6 +338,18 @@ void PCB_EDIT_FRAME::GenFootprintsPositionFile( wxCommandEvent& event ) ...@@ -338,6 +338,18 @@ void PCB_EDIT_FRAME::GenFootprintsPositionFile( wxCommandEvent& event )
* aSide = 0 -> Back (bottom) side) * aSide = 0 -> Back (bottom) side)
* aSide = 1 -> Front (top) side) * aSide = 1 -> Front (top) side)
* aSide = 2 -> both sides * aSide = 2 -> both sides
*
* The format is:
* ### Module positions - created on 04/12/2012 15:24:24 ###
* ### Printed by Pcbnew version pcbnew (2012-11-30 BZR 3828)-testing
* ## Unit = inches, Angle = deg.
* ## Side : Front
* # Ref Val Package PosX PosY Rot Side
* C123 0,1uF/50V SM0603 1.6024 -2.6280 180.0 Front
* C124 0,1uF/50V SM0603 1.6063 -2.7579 180.0 Front
* C125 0,1uF/50V SM0603 1.6010 -2.8310 180.0 Front
* ## End
*
*/ */
int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
bool aUnitsMM, bool aUnitsMM,
...@@ -385,6 +397,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, ...@@ -385,6 +397,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
continue; continue;
} }
} }
else
continue; continue;
} }
...@@ -425,15 +438,14 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, ...@@ -425,15 +438,14 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
list.push_back( item ); list.push_back( item );
} }
if( moduleCount > 1 ) if( list.size() > 1 )
sort( list.begin(), list.end(), sortFPlist ); sort( list.begin(), list.end(), sortFPlist );
wxString frontLayerName = GetBoard()->GetLayerName( LAYER_N_FRONT ); wxString frontLayerName = GetBoard()->GetLayerName( LAYER_N_FRONT );
wxString backLayerName = GetBoard()->GetLayerName( LAYER_N_BACK ); wxString backLayerName = GetBoard()->GetLayerName( LAYER_N_BACK );
// Switch the locale to standard C (needed to print floating point // Switch the locale to standard C (needed to print floating point numbers)
// numbers like 1.3) LOCALE_IO toggle;
SetLocaleTo_C_standard( );
// Write file header // Write file header
sprintf( line, "### Module positions - created on %s ###\n", TO_UTF8( DateAndTime() ) ); sprintf( line, "### Module positions - created on %s ###\n", TO_UTF8( DateAndTime() ) );
...@@ -494,8 +506,6 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, ...@@ -494,8 +506,6 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
// Write EOF // Write EOF
fputs( "## End\n", file ); fputs( "## End\n", file );
SetLocaleTo_Default( ); // revert to the current locale
fclose( file ); fclose( file );
return moduleCount; return moduleCount;
} }
......
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