Commit 5d5eb7d3 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fix a serious bug in EDA_RECT::Intersects

Kicad manager: code cleaning. Dead code removed and minor fixes. support of new .kicad_brd extension.
parent 8c0dc01f
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -344,11 +344,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
    // calculate the left common area coordinate:
    // calculate the left common area coordinate:
    int  left   = MAX( me.m_Pos.x, rect.m_Pos.x );
    int  left   = MAX( me.m_Pos.x, rect.m_Pos.x );
    // calculate the right common area coordinate:
    // calculate the right common area coordinate:
    int  right  = MIN( me.m_Pos.x + m_Size.x, rect.m_Pos.x + rect.m_Size.x );
    int  right  = MIN( me.m_Pos.x + me.m_Size.x, rect.m_Pos.x + rect.m_Size.x );
    // calculate the upper common area coordinate:
    // calculate the upper common area coordinate:
    int  top    = MAX( me.m_Pos.y, aRect.m_Pos.y );
    int  top    = MAX( me.m_Pos.y, aRect.m_Pos.y );
    // calculate the lower common area coordinate:
    // calculate the lower common area coordinate:
    int  bottom = MIN( me.m_Pos.y + m_Size.y, rect.m_Pos.y + rect.m_Size.y );
    int  bottom = MIN( me.m_Pos.y + me.m_Size.y, rect.m_Pos.y + rect.m_Size.y );


    // if a common area exists, it must have a positive (null accepted) size
    // if a common area exists, it must have a positive (null accepted) size
    if( left <= right && top <= bottom )
    if( left <= right && top <= bottom )
+6 −3
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@


#include <fctsys.h>
#include <fctsys.h>
#include <gestfich.h>
#include <gestfich.h>
#include <macros.h>


#include <kicad.h>
#include <kicad.h>
#include <tree_project_frame.h>
#include <tree_project_frame.h>
@@ -214,8 +215,9 @@ bool TREEPROJECT_ITEM::Delete( bool check )
/*******************************************/
/*******************************************/
/* delete a file */
/* delete a file */
{
{
    wxMessageDialog dialog( m_Parent,
    wxString msg;
                            _ ("Do you really want to delete ") + GetFileName(),
    msg.Printf( _("Do you really want to delete '%s'"), GetChars(GetFileName() ) );
    wxMessageDialog dialog( m_Parent, msg,
                            _( "Delete File" ), wxYES_NO | wxICON_QUESTION );
                            _( "Delete File" ), wxYES_NO | wxICON_QUESTION );


    if( !check || wxID_YES == dialog.ShowModal() )
    if( !check || wxID_YES == dialog.ShowModal() )
@@ -264,7 +266,8 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
        ExecuteFile( m_Parent, EESCHEMA_EXE, FullFileName );
        ExecuteFile( m_Parent, EESCHEMA_EXE, FullFileName );
        break;
        break;


    case TREE_PCB:
    case TREE_LEGACY_PCB:
    case TREE_SEXP_PCB:
        ExecuteFile( m_Parent, PCBNEW_EXE, FullFileName );
        ExecuteFile( m_Parent, PCBNEW_EXE, FullFileName );
        break;
        break;


+26 −1
Original line number Original line Diff line number Diff line
@@ -2,6 +2,30 @@
 * @file class_treeprojectfiles.cpp
 * @file class_treeprojectfiles.cpp
 * this is the wxTreeCtrl that shows a KiCad tree project files
 * this is the wxTreeCtrl that shows a KiCad tree project files
 */
 */
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004-2012 Jean-Pierre Charras
 * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */



#include <fctsys.h>
#include <fctsys.h>


@@ -38,7 +62,8 @@ TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) :


    m_ImageList->Add( KiBitmap( kicad_icon_small_xpm ) );       // TREE_PROJECT
    m_ImageList->Add( KiBitmap( kicad_icon_small_xpm ) );       // TREE_PROJECT
    m_ImageList->Add( KiBitmap( eeschema_xpm ) );               // TREE_SCHEMA
    m_ImageList->Add( KiBitmap( eeschema_xpm ) );               // TREE_SCHEMA
    m_ImageList->Add( KiBitmap( pcbnew_xpm ) );                 // TREE_PCB
    m_ImageList->Add( KiBitmap( pcbnew_xpm ) );                 // TREE_LEGACY_PCB
    m_ImageList->Add( KiBitmap( pcbnew_xpm ) );                 // TREE_SFMT_PCB
    m_ImageList->Add( KiBitmap( icon_gerbview_small_xpm ) );    // TREE_GERBER
    m_ImageList->Add( KiBitmap( icon_gerbview_small_xpm ) );    // TREE_GERBER
    m_ImageList->Add( KiBitmap( datasheet_xpm ) );              // TREE_PDF
    m_ImageList->Add( KiBitmap( datasheet_xpm ) );              // TREE_PDF
    m_ImageList->Add( KiBitmap( icon_txt_xpm ) );               // TREE_TXT
    m_ImageList->Add( KiBitmap( icon_txt_xpm ) );               // TREE_TXT
+25 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,31 @@
 * @brief Frame showing fast launch buttons and messages box
 * @brief Frame showing fast launch buttons and messages box
 */
 */


/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004-2012 Jean-Pierre Charras
 * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */


#include <fctsys.h>
#include <fctsys.h>
#include <macros.h>
#include <macros.h>


+25 −4
Original line number Original line Diff line number Diff line
@@ -2,9 +2,29 @@
/* files-io.cpp */
/* files-io.cpp */
/****************/
/****************/


#ifdef __GNUG__
/*
#pragma implementation
 * This program source code file is part of KiCad, a free EDA CAD application.
#endif
 *
 * Copyright (C) 2004-2012 Jean-Pierre Charras
 * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */


#include <fctsys.h>
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <appl_wxstruct.h>
@@ -110,7 +130,8 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
{
{
    /* List of file extensions to save. */
    /* List of file extensions to save. */
    static const wxChar* extentionList[] = {
    static const wxChar* extentionList[] = {
        wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
        wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ),
        wxT( "*.brd" ), wxT( "*.kicad_brd" ),
        wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
        wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
        wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
        wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
        NULL
        NULL
Loading