Commit 521d43c4 authored by jean-pierre charras's avatar jean-pierre charras

eeschema: fix 2 issues:

1- incorrect mouse cursor position when clicking on an ERC error message from dialog ERC window to go to the corresponding marker.
2- broken behavior of hierarchy navigator (horizontal toolbar, hierarchy tool)
parent ac0979fa
...@@ -175,6 +175,7 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event ) ...@@ -175,6 +175,7 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
} }
m_Parent->GetScreen()->SetCrossHairPosition(pos);
m_Parent->RedrawScreen( pos, true ); m_Parent->RedrawScreen( pos, true );
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/******************/ /******************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
...@@ -25,7 +24,7 @@ enum ...@@ -25,7 +24,7 @@ enum
}; };
class WinEDA_HierFrame; class HIERARCHY_NAVIG_DLG;
/* This class derived from wxTreeItemData stores the SCH_SHEET_PATH of each /* This class derived from wxTreeItemData stores the SCH_SHEET_PATH of each
* sheet in hierarchy in each TreeItem, in its associated data buffer * sheet in hierarchy in each TreeItem, in its associated data buffer
...@@ -41,23 +40,23 @@ public: ...@@ -41,23 +40,23 @@ public:
}; };
/* Class to handle hierarchy tree. */ /* Class to handle hierarchy tree. */
class WinEDA_Tree : public wxTreeCtrl class HIERARCHY_TREE : public wxTreeCtrl
{ {
private: private:
WinEDA_HierFrame* m_Parent; HIERARCHY_NAVIG_DLG* m_Parent;
wxImageList* imageList; wxImageList* imageList;
public: public:
WinEDA_Tree() { } HIERARCHY_TREE() { }
WinEDA_Tree( WinEDA_HierFrame* parent ); HIERARCHY_TREE( HIERARCHY_NAVIG_DLG* parent );
DECLARE_DYNAMIC_CLASS( WinEDA_Tree ) DECLARE_DYNAMIC_CLASS( HIERARCHY_TREE )
}; };
IMPLEMENT_DYNAMIC_CLASS( WinEDA_Tree, wxTreeCtrl ) IMPLEMENT_DYNAMIC_CLASS( HIERARCHY_TREE, wxTreeCtrl )
WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) : HIERARCHY_TREE::HIERARCHY_TREE( HIERARCHY_NAVIG_DLG* parent ) :
wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY, wxDefaultPosition, wxDefaultSize, wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY, wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) ) wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) )
{ {
...@@ -73,11 +72,11 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) : ...@@ -73,11 +72,11 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
} }
class WinEDA_HierFrame : public wxDialog class HIERARCHY_NAVIG_DLG : public wxDialog
{ {
public: public:
SCH_EDIT_FRAME* m_Parent; SCH_EDIT_FRAME* m_Parent;
WinEDA_Tree* m_Tree; HIERARCHY_TREE* m_Tree;
int m_nbsheets; int m_nbsheets;
wxDC* m_DC; wxDC* m_DC;
...@@ -86,10 +85,10 @@ private: ...@@ -86,10 +85,10 @@ private:
int maxposx; int maxposx;
public: public:
WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ); HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos );
void BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu ); void BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu );
~WinEDA_HierFrame(); ~HIERARCHY_NAVIG_DLG();
void OnSelect( wxTreeEvent& event ); void OnSelect( wxTreeEvent& event );
...@@ -99,28 +98,28 @@ private: ...@@ -99,28 +98,28 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog ) BEGIN_EVENT_TABLE( HIERARCHY_NAVIG_DLG, wxDialog )
EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY, WinEDA_HierFrame::OnSelect ) EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY, HIERARCHY_NAVIG_DLG::OnSelect )
END_EVENT_TABLE() END_EVENT_TABLE()
void SCH_EDIT_FRAME::InstallHierarchyFrame( wxDC* DC, wxPoint& pos ) void SCH_EDIT_FRAME::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
{ {
WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos ); HIERARCHY_NAVIG_DLG* treeframe = new HIERARCHY_NAVIG_DLG( this, DC, pos );
treeframe->ShowModal(); treeframe->ShowModal();
treeframe->Destroy(); treeframe->Destroy();
} }
WinEDA_HierFrame::WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) : HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) :
wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), DIALOG_STYLE ) wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), DIALOG_STYLE )
{ {
wxTreeItemId cellule; wxTreeItemId cellule;
m_Parent = parent; m_Parent = parent;
m_DC = DC; m_DC = DC;
m_Tree = new WinEDA_Tree( this ); m_Tree = new HIERARCHY_TREE( this );
m_nbsheets = 1; m_nbsheets = 1;
...@@ -159,23 +158,22 @@ WinEDA_HierFrame::WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPo ...@@ -159,23 +158,22 @@ WinEDA_HierFrame::WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPo
} }
WinEDA_HierFrame::~WinEDA_HierFrame() HIERARCHY_NAVIG_DLG::~HIERARCHY_NAVIG_DLG()
{ {
} }
void WinEDA_HierFrame::OnQuit( wxCommandEvent& event ) void HIERARCHY_NAVIG_DLG::OnQuit( wxCommandEvent& event )
{ {
// true is to force the frame to close // true is to force the frame to close
Close( true ); Close( true );
} }
/* Routine to create the tree in the navigation hierarchy /* Routine to create the hierarchical tree of the schematic
* Schematic
* This routine is re-entrant! * This routine is re-entrant!
*/ */
void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu ) void HIERARCHY_NAVIG_DLG::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu )
{ {
wxTreeItemId menu; wxTreeItemId menu;
...@@ -237,13 +235,13 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* pre ...@@ -237,13 +235,13 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* pre
/* Called on a double-click on a tree item: /* Called on a double-click on a tree item:
* Open the selected sheet, and display the corresponding screen * Open the selected sheet, and display the corresponding screen
*/ */
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event ) void HIERARCHY_NAVIG_DLG::OnSelect( wxTreeEvent& event )
{ {
wxTreeItemId ItemSel = m_Tree->GetSelection(); wxTreeItemId ItemSel = m_Tree->GetSelection();
SCH_SHEET* sheet = ( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath.Last(); *(m_Parent->m_CurrentSheet) =
m_Parent->m_CurrentSheet->Push( sheet ); ( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath;
m_Parent->DisplayCurrentSheet(); m_Parent->DisplayCurrentSheet();
Close( true ); Close( true );
} }
......
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