DRC dialog work

This commit is contained in:
dickelbeck 2007-12-04 07:04:53 +00:00
parent 15b7002012
commit 36c316e7e0
6 changed files with 112 additions and 40 deletions

View File

@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Dec-4 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* drc.cpp and dialog_drc.cpp intermediate update.
Added double click support on a MARKER in the listbox. On Linux, it pops up the
menu from PcbGeneralLocateAndDisplay() for some reason after repositioning the
cursor. That is not intended, but after several attempts to work around
it, I realized it is not so bad to have this happen.
A few more hours to go for the unconnected tab.
* Added WinEDA_BasePcbFrame::CursorGoto( const wxPoint& ) by factoring it
out of pcbnew/find.cpp
2007-Dec-02 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema:
@ -14,8 +27,7 @@ email address.
2007-Dec-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
drc.cpp and dialog_drc.cpp intermediate update. More hours to go
before completion.
drc.cpp and dialog_drc.cpp intermediate update.
2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -440,6 +440,16 @@ public:
*/
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
/**
* Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if the
* requested point is out of view.
* @param aPos The point to go to.
*/
void CursorGoto( const wxPoint& aPos );
/* Place un repere sur l'ecran au point de coordonnees PCB pos */
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type );

View File

@ -96,6 +96,32 @@ int WinEDA_BasePcbFrame::BestZoom( void )
}
void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
{
// factored out of pcbnew/find.cpp
PCB_SCREEN* screen = GetScreen();
wxClientDC dc( DrawPanel );
/* Il y a peut-etre necessite de recadrer le dessin: */
if( !DrawPanel->IsPointOnDisplay( aPos ) )
{
screen->m_Curseur = aPos;
Recadre_Trace( TRUE );
}
else
{
// Positionnement du curseur sur l'item
DrawPanel->CursorOff( &dc );
screen->m_Curseur = aPos;
GRMouseWarp( DrawPanel, screen->m_Curseur );
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
/*************************************************/
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
/*************************************************/

View File

@ -138,6 +138,20 @@ public:
Refresh();
}
/**
* Function GetItem
* returns a requested DRC_ITEM* or NULL.
*/
const DRC_ITEM* GetItem( int aIndex )
{
if( m_list )
{
return m_list->GetItem( aIndex );
}
return NULL;
}
/**
* Function OnGetItem
@ -677,7 +691,7 @@ void DrcDialog::OnOkClick( wxCommandEvent& event )
SetReturnCode( wxID_OK );
m_tester->DestroyDialog();
event.Skip();
// event.Skip();
}
@ -693,7 +707,7 @@ void DrcDialog::OnCancelClick( wxCommandEvent& event )
SetReturnCode( wxID_CANCEL );
m_tester->DestroyDialog();
event.Skip();
// event.Skip();
}
@ -713,7 +727,7 @@ void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
m_RptFilenameCtrl->Enable(false);
m_BrowseButton->Enable(false);
}
event.Skip();
// event.Skip();
}
@ -749,13 +763,24 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
if( selection != wxNOT_FOUND )
{
//printf("get item number %d\n", selection );
// Find the selected MARKER in the PCB, position cursor there.
// Do not close this dialog for users with dual screens.
// Then close the dialog.
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
if( item )
{
// after the goto, process a button OK command later.
wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
::wxPostEvent( GetEventHandler(), cmd );
m_Parent->CursorGoto( item->GetPosition() );
}
}
// On linux, the double click is being propagated to the parent. The
// call to StopPropagation was an attempt to prevent this.
event.Skip();
event.StopPropagation(); // we handled the double click event here.
// well that didn't work, we still get a popup menu
}
@ -765,6 +790,7 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
{
// @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
event.Skip();
}
@ -775,10 +801,8 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
{
////@begin wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
// Before editing this code, remove the block markers.
// @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
event.Skip();
////@end wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
}
@ -792,10 +816,24 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
if( selection != wxNOT_FOUND )
{
//printf("get item number %d\n", selection );
// Find the selected DRC_ITEM in the DRC, position cursor there.
// Then close the dialog.
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
if( item )
{
// after the goto, process a button OK command later.
wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
::wxPostEvent( GetEventHandler(), cmd );
m_Parent->CursorGoto( item->GetPosition() );
}
}
// On linux, the double click is being propagated to the parent. The
// call to StopPropagation was an attempt to prevent this.
event.Skip();
event.StopPropagation(); // we handled the double click event here.
// well that didn't work, we still get a popup menu
}
@ -807,7 +845,6 @@ void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable(true);
//printf("get Marker number %d\n", selection );
}
event.Skip();
@ -819,7 +856,8 @@ void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
if( selection != wxNOT_FOUND )
{
printf("get Unconnected item number %d\n", selection );
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable(true);
}
event.Skip();
@ -857,7 +895,7 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
if( selectedIndex != wxNOT_FOUND )
{
m_ClearanceListBox->DeleteItem( selectedIndex );
m_Parent->ReDrawPanel();
RedrawDrawPanel();
}
}
@ -867,13 +905,10 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
if( selectedIndex != wxNOT_FOUND )
{
m_UnconnectedListBox->DeleteItem( selectedIndex );
m_Parent->ReDrawPanel();
RedrawDrawPanel();
}
}
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog.
// event.Skip();
}

View File

@ -299,6 +299,9 @@ private:
BOARD* m_pcb;
DrcDialog* m_ui;
std::vector<DRC_ITEM> m_unconnected;
/**
* Function updatePointers
* is a private helper function used to update needed pointers from the

View File

@ -115,25 +115,11 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
if( FindMarker )
msg = _( "Marker found" );
else
msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() );
m_Parent->Affiche_Message( msg );
msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() );
/* Il y a peut-etre necessite de recadrer le dessin: */
if( !m_Parent->DrawPanel->IsPointOnDisplay( locate_pos ) )
{
screen->m_Curseur = locate_pos;
m_Parent->Recadre_Trace( TRUE );
}
else
{
// Positionnement du curseur sur l'item
m_Parent->DrawPanel->CursorOff( m_DC );
screen->m_Curseur = locate_pos;
GRMouseWarp( m_Parent->DrawPanel, screen->m_Curseur );
m_Parent->DrawPanel->MouseToCursorSchema();
m_Parent->DrawPanel->CursorOn( m_DC );
}
m_Parent->Affiche_Message( msg );
m_Parent->CursorGoto( locate_pos );
EndModal( 1 );
}