Skip to content

Commit

Permalink
Fix a serious bug in EDA_RECT::Intersects
Browse files Browse the repository at this point in the history
Kicad manager: code cleaning. Dead code removed and minor fixes. support of new .kicad_brd extension.
  • Loading branch information
jp-charras committed Apr 16, 2012
1 parent 8c0dc01 commit 5d5eb7d
Show file tree
Hide file tree
Showing 14 changed files with 710 additions and 758 deletions.
4 changes: 2 additions & 2 deletions common/base_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
// calculate the left common area coordinate:
int left = MAX( me.m_Pos.x, rect.m_Pos.x );
// 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:
int top = MAX( me.m_Pos.y, aRect.m_Pos.y );
// 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( left <= right && top <= bottom )
Expand Down
9 changes: 6 additions & 3 deletions kicad/class_treeproject_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

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

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

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

Expand Down
27 changes: 26 additions & 1 deletion kicad/class_treeprojectfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
* @file class_treeprojectfiles.cpp
* 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>

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

m_ImageList->Add( KiBitmap( kicad_icon_small_xpm ) ); // TREE_PROJECT
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( datasheet_xpm ) ); // TREE_PDF
m_ImageList->Add( KiBitmap( icon_txt_xpm ) ); // TREE_TXT
Expand Down
25 changes: 25 additions & 0 deletions kicad/commandframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@
* @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 <macros.h>

Expand Down
29 changes: 25 additions & 4 deletions kicad/files-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,29 @@
/* files-io.cpp */
/****************/

#ifdef __GNUG__
#pragma implementation
#endif
/*
* 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 <appl_wxstruct.h>
Expand Down Expand Up @@ -110,7 +130,8 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
{
/* List of file extensions to save. */
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( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
NULL
Expand Down
3 changes: 2 additions & 1 deletion kicad/kicad.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
enum TreeFileType {
TREE_PROJECT = 1,
TREE_SCHEMA, // Schematic file (.sch)
TREE_PCB, // board file (.brd)
TREE_LEGACY_PCB, // board file (.brd) legacy format
TREE_SEXP_PCB, // board file (.kicad_brd) new s expression format
TREE_GERBER, // Gerber file (.pho, .g*)
TREE_PDF, // PDF file (.pdf)
TREE_TXT, // ascii text file (.txt)
Expand Down
2 changes: 1 addition & 1 deletion kicad/prjconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras, [email protected]
* 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
Expand Down
Loading

0 comments on commit 5d5eb7d

Please sign in to comment.