Commit 36c316e7 authored by dickelbeck's avatar dickelbeck
Browse files

DRC dialog work

parent 15b70020
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -4,6 +4,19 @@ Started 2007-June-11
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.


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>
2007-Dec-02 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+eeschema:
+eeschema:
@@ -14,8 +27,7 @@ email address.
2007-Dec-2 UPDATE   Dick Hollenbeck <dick@softplc.com>
2007-Dec-2 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+pcbnew
+pcbnew
    drc.cpp and dialog_drc.cpp intermediate update.  More hours to go
    drc.cpp and dialog_drc.cpp intermediate update.
    before completion.
    
    


2007-Nov-30 UPDATE   Dick Hollenbeck <dick@softplc.com>
2007-Nov-30 UPDATE   Dick Hollenbeck <dick@softplc.com>
+10 −0
Original line number Original line Diff line number Diff line
@@ -440,6 +440,16 @@ public:
     */
     */
    GENERAL_COLLECTORS_GUIDE    GetCollectorsGuide();
    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 */
    /* Place un repere sur l'ecran au point de coordonnees PCB pos */
    void                        place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
    void                        place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
                                                int DrawMode, int color, int type );
                                                int DrawMode, int color, int type );
+26 −0
Original line number Original line Diff line number Diff line
@@ -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 )
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
/*************************************************/
/*************************************************/
+55 −20
Original line number Original line Diff line number Diff line
@@ -139,6 +139,20 @@ public:
    }
    }




    /**
     * 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
     * Function OnGetItem
     * returns the html text associated with the DRC_ITEM given by index 'n'.
     * returns the html text associated with the DRC_ITEM given by index 'n'.
@@ -677,7 +691,7 @@ void DrcDialog::OnOkClick( wxCommandEvent& event )


    SetReturnCode( wxID_OK );
    SetReturnCode( wxID_OK );
    m_tester->DestroyDialog();
    m_tester->DestroyDialog();
    event.Skip();
//    event.Skip();
}
}




@@ -693,7 +707,7 @@ void DrcDialog::OnCancelClick( wxCommandEvent& event )


    SetReturnCode( wxID_CANCEL );
    SetReturnCode( wxID_CANCEL );
    m_tester->DestroyDialog();
    m_tester->DestroyDialog();
    event.Skip();
//    event.Skip();
}
}




@@ -713,7 +727,7 @@ void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
        m_RptFilenameCtrl->Enable(false);
        m_RptFilenameCtrl->Enable(false);
        m_BrowseButton->Enable(false);
        m_BrowseButton->Enable(false);
    }
    }
    event.Skip();
//    event.Skip();
}
}




@@ -749,13 +763,24 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )


    if( selection != wxNOT_FOUND )
    if( selection != wxNOT_FOUND )
    {
    {
        //printf("get item number %d\n", selection );

        // Find the selected MARKER in the PCB, position cursor there.
        // 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() );
        }
    }
    }


    event.Skip();
    // On linux, the double click is being propagated to the parent.  The
    // call to StopPropagation was an attempt to prevent this.
    
    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 )
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
{
{
    // @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
    event.Skip();
    event.Skip();
}
}


@@ -775,10 +801,8 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )


void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
{
{
////@begin wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
    // @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
    // Before editing this code, remove the block markers.
    event.Skip();
    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 )
    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() );
        }
    }
    }


    event.Skip();
    // On linux, the double click is being propagated to the parent.  The
    // call to StopPropagation was an attempt to prevent this.
    
    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.
        // until a MARKER is selected, this button is not enabled.
        m_DeleteCurrentMarkerButton->Enable(true);
        m_DeleteCurrentMarkerButton->Enable(true);
        //printf("get Marker number %d\n", selection );
    }
    }
    
    
    event.Skip();
    event.Skip();
@@ -819,7 +856,8 @@ void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
    
    
    if( selection != wxNOT_FOUND )
    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();
    event.Skip();
@@ -857,7 +895,7 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
        if( selectedIndex != wxNOT_FOUND )
        if( selectedIndex != wxNOT_FOUND )
        {
        {
            m_ClearanceListBox->DeleteItem( selectedIndex );
            m_ClearanceListBox->DeleteItem( selectedIndex );
            m_Parent->ReDrawPanel();
            RedrawDrawPanel();
        }
        }
    }
    }
    
    
@@ -867,13 +905,10 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
        if( selectedIndex != wxNOT_FOUND )
        if( selectedIndex != wxNOT_FOUND )
        {
        {
            m_UnconnectedListBox->DeleteItem( selectedIndex );
            m_UnconnectedListBox->DeleteItem( selectedIndex );
            m_Parent->ReDrawPanel();
            RedrawDrawPanel();
        }
        }
    }
    }
    
    
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog.
//    event.Skip();
    // Before editing this code, remove the block markers.
    event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog. 
}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -299,6 +299,9 @@ private:
    BOARD*              m_pcb;
    BOARD*              m_pcb;
    DrcDialog*          m_ui;
    DrcDialog*          m_ui;


    std::vector<DRC_ITEM>   m_unconnected;
    
    
    /** 
    /** 
     * Function updatePointers
     * Function updatePointers
     * is a private helper function used to update needed pointers from the
     * is a private helper function used to update needed pointers from the
Loading