Move the non shared file class_sch_screen.h to eeschema folder. Code cleaning. Remove some wxCHECK_VERSION tests now useless.

This commit is contained in:
jean-pierre charras 2015-07-29 20:06:45 +02:00
parent 32f0ea621f
commit 6dd0073130
25 changed files with 50 additions and 126 deletions

View File

@ -57,12 +57,7 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );

View File

@ -44,11 +44,11 @@
// Default marquer shape:
const int M_SHAPE_SCALE = 6; // default scaling factor for MarkerShapeCorners coordinates
const unsigned CORNERS_COUNT = 8;
/* corners of the default shape
/* The graphic shape of markers is a polygon.
* MarkerShapeCorners contains the coordinates of corners of the polygonal default shape
* actual coordinates are these values * .m_ScalingFactor
*/
static const wxPoint MarkerShapeCorners[CORNERS_COUNT] =
static const wxPoint MarkerShapeCorners[] =
{
wxPoint( 0, 0 ),
wxPoint( 8, 1 ),
@ -59,6 +59,7 @@ static const wxPoint MarkerShapeCorners[CORNERS_COUNT] =
wxPoint( 3, 4 ),
wxPoint( 1, 8 )
};
const unsigned CORNERS_COUNT = DIM( MarkerShapeCorners );
/*******************/
/* Classe MARKER_BASE */
@ -67,7 +68,7 @@ static const wxPoint MarkerShapeCorners[CORNERS_COUNT] =
void MARKER_BASE::init()
{
m_MarkerType = MARKER_UNSPEC;
m_ErrorLevel = 0;
m_ErrorLevel = MARKER_SEVERITY_UNSPEC;
m_Color = RED;
wxPoint start = MarkerShapeCorners[0];
wxPoint end = MarkerShapeCorners[0];

View File

@ -375,10 +375,6 @@ wxString GetKicadConfigPath()
cfgpath.AppendDir( wxT( "kicad" ) );
#if !wxCHECK_VERSION( 2, 9, 0 )
#define wxS_DIR_DEFAULT 0777
#endif
if( !cfgpath.DirExists() )
{
cfgpath.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );

View File

@ -962,11 +962,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter;
#if wxMAJOR_VERSION >= 2 && wxMINOR_VERSION >= 9
int axis = event.GetWheelAxis();
#else
const int axis = 0;
#endif
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )

View File

@ -255,15 +255,9 @@ void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill )
brush.SetColour( MakeColour( Color ) );
if( fill )
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
else
brush.SetStyle( wxBRUSHSTYLE_TRANSPARENT );
#else
brush.SetStyle( wxSOLID );
else
brush.SetStyle( wxTRANSPARENT );
#endif
DC->SetBrush( brush );

View File

@ -310,7 +310,7 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName
return;
}
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
cfg->SetPath( wxT( "/" ) );
cfg->Write( wxT( "update" ), DateAndTime() );
@ -324,11 +324,11 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName
cfg->SetPath( aGroupName );
cfg->Write( wxT( "version" ), CONFIG_VERSION );
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
cfg->SetPath( wxT( "/" ) );
wxConfigSaveParams( cfg.get(), aParams, aGroupName );
cfg->SetPath( UNIX_STRING_DIR_SEP );
cfg->SetPath( wxT( "/" ) );
// cfg is deleted here by std::auto_ptr, that saves the *.pro file to disk
}

View File

@ -193,15 +193,9 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
iconDC.SetPen( *wxBLACK_PEN );
ColorSetBrush( &brush, buttcolor );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush );
iconDC.SetBackground( *wxGREY_BRUSH );
iconDC.Clear();
iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );

View File

@ -584,11 +584,12 @@ public:
*
* @param aMarkerType Indicates the type of marker to count. if MARKER_UNSPEC
* all markers are counted.
* @param aSeverity Indicates the error level of marker to count. -1 to count all markers
* of the specified type
* @param aSeverity Indicates the error level of marker to count.
* useMARKER_SEVERITY_UNSPEC to count all markersof the specified type
* @return int count of the markers found.
*/
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType, int aSeverity );
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
enum MARKER_BASE::MARKER_SEVERITY aSeverity );
private:
void AddScreenToList( SCH_SCREEN* aScreen );

View File

@ -103,9 +103,12 @@ void DIALOG_ERC::Init()
void DIALOG_ERC::updateMarkerCounts( SCH_SCREENS *screens )
{
int markers = screens->GetMarkerCount(MARKER_BASE::MARKER_ERC, -1 );
int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC, WAR );
int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC, ERR );
int markers = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
MARKER_BASE::MARKER_SEVERITY_UNSPEC );
int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
MARKER_BASE::MARKER_SEVERITY_WARNING );
int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
MARKER_BASE::MARKER_SEVERITY_ERROR );
wxString num;
num.Printf( wxT( "%d" ), markers );

View File

@ -209,7 +209,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
_( "Duplicate sheet name" ),
( (SCH_SHEET*) test_item )->GetPosition() );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( ERR );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
screen->Append( marker );
}
@ -238,7 +238,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( WAR );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
screen = aNetItemRef->m_SheetPath.LastScreen();
screen->Append( marker );
@ -329,7 +329,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
if( aDiag == ERR )
{
marker->SetErrorLevel( ERR );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
errortype = ERCE_PIN_TO_PIN_ERROR;
}
@ -546,10 +546,10 @@ bool WriteDiagnosticERC( const wxString& aFullFileName )
total_count++;
if( marker->GetErrorLevel() == ERR )
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
err_count++;
if( marker->GetErrorLevel() == WAR )
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_WARNING )
warn_count++;
msg << marker->GetReporter().ShowReport();

View File

@ -1520,7 +1520,8 @@ void SCH_SCREENS::DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType )
}
int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType, int aSeverity )
int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
enum MARKER_BASE::MARKER_SEVERITY aSeverity )
{
int count = 0;
@ -1537,7 +1538,8 @@ int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType, int a
( marker->GetMarkerType() != aMarkerType ) )
continue;
if( aSeverity < 0 || aSeverity == marker->GetErrorLevel() )
if( aSeverity == MARKER_BASE::MARKER_SEVERITY_UNSPEC ||
aSeverity == marker->GetErrorLevel() )
count++;
}
}

View File

@ -166,12 +166,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// artifacts can happen with negative items or negative images
wxColour bgColor = MakeColour( gerbFrame->GetDrawBgColor() );
#if wxCHECK_VERSION( 3, 0, 0 )
wxBrush bgBrush( bgColor, wxBRUSHSTYLE_SOLID );
#else
wxBrush bgBrush( bgColor, wxSOLID );
#endif
int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC;

View File

@ -452,13 +452,8 @@ void GERBVIEW_FRAME::Liste_D_Codes()
}
}
#if wxCHECK_VERSION( 2, 9, 4 )
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
#else
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (char**) NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
#endif
dlg.ShowModal();
}

View File

@ -30,7 +30,7 @@
#include <gr_basic.h>
/* Marker are mainly used to show an ERC error
/* Marker are mainly used to show a DRC or ERC error or warning
*/
@ -43,12 +43,18 @@ public:
MARKER_PCB,
MARKER_SIMUL
};
enum MARKER_SEVERITY { // Severity of the marker: this is the level of error
MARKER_SEVERITY_UNSPEC,
MARKER_SEVERITY_INFO,
MARKER_SEVERITY_WARNING,
MARKER_SEVERITY_ERROR
};
wxPoint m_Pos; ///< position of the marker
protected:
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
int m_ErrorLevel; ///< a flag to specify the severity of the error
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
EDA_COLOR_T m_Color; ///< color
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
///< to the position of the shape, used for Hit
@ -124,12 +130,12 @@ public:
/**
* accessors to set/get error levels (warning, error, fatal error..)
*/
void SetErrorLevel( int aErrorLevel )
void SetErrorLevel( MARKER_SEVERITY aErrorLevel )
{
m_ErrorLevel = aErrorLevel;
}
int GetErrorLevel() const
MARKER_SEVERITY GetErrorLevel() const
{
return m_ErrorLevel;
}

View File

@ -119,11 +119,7 @@ public:
* Function GetWxOrientation.
* @return ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).
*/
#if wxCHECK_VERSION( 2, 9, 0 )
wxPrintOrientation GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#else
int GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#endif
/**
* Function GetPaperId

View File

@ -35,12 +35,6 @@
#include <Carbon/Carbon.h>
#endif
/**
* @note Do we really need these defined?
*/
#define UNIX_STRING_DIR_SEP wxT( "/" )
#define WIN_STRING_DIR_SEP wxT( "\\" )
#ifdef DEBUG
#define DBG(x) x
#else
@ -48,11 +42,6 @@
#endif
// wxNullPtr is not defined prior to wxWidgets 2.9.0.
#if !wxCHECK_VERSION( 2, 9, 0 )
#define wxNullPtr ((void *)NULL)
#endif
#include <config.h>
#endif // FCTSYS_H__

View File

@ -37,6 +37,12 @@
#include <wx/process.h>
/**
* @note Do we really need these defined?
*/
#define UNIX_STRING_DIR_SEP wxT( "/" )
#define WIN_STRING_DIR_SEP wxT( "\\" )
/* Forward class declarations. */
class EDA_LIST_DIALOG;

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.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
@ -78,14 +78,6 @@ inline GR_DRAWMODE operator &(const GR_DRAWMODE& a, const GR_DRAWMODE& b)
#define GR_M_MIDDLE_DOWN 0x40000000
#define GR_M_DCLICK 0x80000000
//wxWidgets 2.8 compatibility
#if !wxCHECK_VERSION(2,9,0)
#define wxPENSTYLE_SOLID wxSOLID
#define wxPENSTYLE_SHORT_DASH wxSHORT_DASH
#define wxPENSTYLE_DOT_DASH wxDOT_DASH
typedef int wxPenStyle;
#endif
extern GR_DRAWMODE g_XorMode;

View File

@ -123,9 +123,7 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
return false;
}
#ifndef KICAD_USE_FILES_WATCHER
SetFileName( newFile );
#endif
return true;
}

View File

@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN (www.cern.ch)
* Copyright (C) 2013 KiCad Developers, see CHANGELOG.txt for contributors.
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
@ -40,12 +40,6 @@
#include <id.h>
#include <wxstruct.h>
// With a recent wxWidget, we can use the wxFileSystemWatcherEvent
// to monitor files add/remove/rename in tree project
#if wxCHECK_VERSION( 2, 9, 4 )
#define KICAD_USE_FILES_WATCHER
#endif
#define KICAD_MANAGER_FRAME_NAME wxT( "KicadFrame" )
class LAUNCHER_PANEL;
@ -256,13 +250,12 @@ public:
void OnTerminate( int pid, int status );
};
#ifdef KICAD_USE_FILES_WATCHER
/**
* Called by sending a event with id = ID_INIT_WATCHED_PATHS
* rebuild the list of wahtched paths
*/
void OnChangeWatchedPaths(wxCommandEvent& aEvent );
#endif
void SetProjectFileName( const wxString& aFullProjectProFileName );
const wxString GetProjectFileName();

View File

@ -74,9 +74,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
// Special functions
#ifdef KICAD_USE_FILES_WATCHER
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
#endif
// Button events (in command frame), and menu events equivalent to buttons
EVT_BUTTON( ID_TO_SCH, KICAD_MANAGER_FRAME::OnRunEeschema )

View File

@ -327,14 +327,12 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
m_LeftWin->ReCreateTreePrj();
#ifdef KICAD_USE_FILES_WATCHER
// Rebuild the list of watched paths.
// however this is possible only when the main loop event handler is running,
// so we use it to run the rebuild function.
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
wxPostEvent( this, cmd );
#endif
PrintPrjInfo();
}

View File

@ -130,11 +130,9 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
m_Parent = parent;
m_TreeProject = NULL;
#ifdef KICAD_USE_FILES_WATCHER
m_watcher = NULL;
Connect( wxEVT_FSWATCHER,
wxFileSystemWatcherEventHandler( TREE_PROJECT_FRAME::OnFileSystemEvent ) );
#endif
/*
* Filtering is now inverted: the filters are actually used to _enable_ support
@ -155,9 +153,7 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
TREE_PROJECT_FRAME::~TREE_PROJECT_FRAME()
{
#ifdef KICAD_USE_FILES_WATCHER
delete m_watcher;
#endif
}
@ -225,9 +221,8 @@ void TREE_PROJECT_FRAME::OnCreateNewDirectory( wxCommandEvent& event )
if( wxMkdir( full_dirname ) )
{
#ifndef KICAD_USE_FILES_WATCHER
AddItemToTreeProject( subdir, root );
#endif
// the new itel will be added by the file watcher
// AddItemToTreeProject( subdir, root );
}
}
@ -838,11 +833,9 @@ void TREE_PROJECT_FRAME::OnExpand( wxTreeEvent& Event )
if( subdir_populated )
{
#ifdef KICAD_USE_FILES_WATCHER
#ifndef __WINDOWS__
FileWatcherReset();
#endif
#endif
}
}
@ -916,7 +909,6 @@ wxTreeItemId TREE_PROJECT_FRAME::findSubdirTreeItem( const wxString& aSubDir )
}
#ifdef KICAD_USE_FILES_WATCHER
void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
{
wxFileName pathModified = event.GetPath();
@ -1082,5 +1074,3 @@ void KICAD_MANAGER_FRAME::OnChangeWatchedPaths(wxCommandEvent& aEvent )
{
m_LeftWin->FileWatcherReset();
}
#endif

View File

@ -30,10 +30,8 @@
#define TREEPRJ_FRAME_H
#include <kicad.h>
#ifdef KICAD_USE_FILES_WATCHER
#include <wx/fswatcher.h>
#endif
class TREEPROJECT_ITEM;
@ -50,10 +48,7 @@ public:
private:
wxTreeItemId m_root;
std::vector<wxString> m_filters;
#ifdef KICAD_USE_FILES_WATCHER
wxFileSystemWatcher* m_watcher; // file system watcher (since wxWidgets 2.9.2)
#endif
public:
TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent );
@ -64,7 +59,6 @@ public:
*/
void ReCreateTreePrj();
#ifdef KICAD_USE_FILES_WATCHER
/**
* Reinit the watched paths
* Should be called after opening a new project to
@ -72,7 +66,6 @@ public:
* Should be called *atfer* the main loop event handler is started
*/
void FileWatcherReset();
#endif
protected:
static wxString GetFileExt( TreeFileType type );
@ -178,14 +171,12 @@ private:
*/
wxTreeItemId findSubdirTreeItem( const wxString& aSubDir );
#ifdef KICAD_USE_FILES_WATCHER
/**
* called when a file or directory is modified/created/deleted
* The tree project is modified when a file or directory
* is created/deleted/renamed to reflect the file change
*/
void OnFileSystemEvent( wxFileSystemWatcherEvent& event );
#endif
DECLARE_EVENT_TABLE()
};

View File

@ -171,12 +171,7 @@ static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
wxCMD_LINE_PARAM,
NULL,
NULL,
#if wxCHECK_VERSION( 2, 9, 0 )
"filename of libtable",
#else
wxT( "filename of libtable" ),
#endif
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE
},
{ wxCMD_LINE_NONE }