Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
07767585
Commit
07767585
authored
Oct 30, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better code compatibility with others compilers (MSVC)
parent
645f7384
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
97 additions
and
41 deletions
+97
-41
CMakeLists.txt
3d-viewer/CMakeLists.txt
+2
-1
change_log.txt
change_log.txt
+4
-0
CMakeLists.txt
common/CMakeLists.txt
+3
-0
base_struct.cpp
common/base_struct.cpp
+0
-3
common.cpp
common/common.cpp
+12
-0
CMakeLists.txt
cvpcb/CMakeLists.txt
+1
-0
CMakeLists.txt
eeschema/CMakeLists.txt
+1
-1
CMakeLists.txt
gerbview/CMakeLists.txt
+1
-0
common.h
include/common.h
+12
-4
macros.h
include/macros.h
+57
-32
CMakeLists.txt
kicad/CMakeLists.txt
+4
-0
No files found.
3d-viewer/CMakeLists.txt
View file @
07767585
add_definitions
(
-DPCBNEW
)
add_definitions
(
-DPCBNEW
)
include_directories
(
../pcbnew
include_directories
(
${
Boost_INCLUDE_DIR
}
../pcbnew
../polygon
)
../polygon
)
set
(
3D-VIEWER_SRCS
set
(
3D-VIEWER_SRCS
...
...
change_log.txt
View file @
07767585
...
@@ -10,6 +10,10 @@ email address.
...
@@ -10,6 +10,10 @@ email address.
================================================================================
================================================================================
++All
++All
Use double instead float when possible, ande code cleaning.
Use double instead float when possible, ande code cleaning.
Some changes for a better code compatibility with others compliers (MSVC)
(__MSVC__ must be defined when using MSVC)
(double round(double) and typeof unkown in MSVC)
Note: I cannot test kicad under MSVC.
2008-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com>
2008-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com>
...
...
common/CMakeLists.txt
View file @
07767585
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
Boost_INCLUDE_DIR
}
)
set
(
COMMON_SRCS
set
(
COMMON_SRCS
about_kicad.cpp
about_kicad.cpp
base_screen.cpp
base_screen.cpp
...
...
common/base_struct.cpp
View file @
07767585
...
@@ -7,14 +7,11 @@
...
@@ -7,14 +7,11 @@
/* Fichier base_struct.cpp */
/* Fichier base_struct.cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "trigo.h"
#include "trigo.h"
#include "macros.h"
#include "common.h"
#include "common.h"
#include "wxstruct.h"
#include "wxstruct.h"
#include "base_struct.h"
#include "base_struct.h"
#include "grfonte.h"
#include "grfonte.h"
#include "macros.h"
#include "macros.h"
enum
textbox
{
enum
textbox
{
...
...
common/common.cpp
View file @
07767585
...
@@ -555,3 +555,15 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
...
@@ -555,3 +555,15 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
return
aString
;
return
aString
;
}
}
#ifdef __MSVC__ // compilers that does not have the round function (posix)
/* return the nearest rounded ( equivalent to the nearest integer value)
* from aNumber
*/
double
round
(
double
aNumber
)
{
return
floor
(
aNumber
+
0.5
);
}
#endif
cvpcb/CMakeLists.txt
View file @
07767585
add_definitions
(
-DCVPCB
)
add_definitions
(
-DCVPCB
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
Boost_INCLUDE_DIR
}
../3d-viewer
../3d-viewer
../pcbnew
../pcbnew
../polygon
)
../polygon
)
...
...
eeschema/CMakeLists.txt
View file @
07767585
add_definitions
(
-DEESCHEMA
)
add_definitions
(
-DEESCHEMA
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
#
${Boost_INCLUDE_DIR}
${
Boost_INCLUDE_DIR
}
)
)
set
(
EESCHEMA_SRCS
set
(
EESCHEMA_SRCS
...
...
gerbview/CMakeLists.txt
View file @
07767585
add_definitions
(
-DGERBVIEW -DPCBNEW
)
add_definitions
(
-DGERBVIEW -DPCBNEW
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
Boost_INCLUDE_DIR
}
../3d-viewer
../3d-viewer
../cvpcb
../cvpcb
../pcbnew
../pcbnew
...
...
include/common.h
View file @
07767585
...
@@ -405,12 +405,20 @@ wxString& operator <<( wxString& aString, const wxPoint& aPoint );
...
@@ -405,12 +405,20 @@ wxString& operator <<( wxString& aString, const wxPoint& aPoint );
bool
ProcessExecute
(
const
wxString
&
aCommandLine
,
int
aFlags
=
wxEXEC_ASYNC
);
bool
ProcessExecute
(
const
wxString
&
aCommandLine
,
int
aFlags
=
wxEXEC_ASYNC
);
wxString
ReturnPcbLayerName
(
int
layer_number
,
bool
is_filename
=
FALSE
);
/* Return the name of the layer number "layer_number".
/**
* if "is_filename" == TRUE, the name can be used for a file name
* Function ReturnPcbLayerName
* (not internatinalized, no space)*/
* @return a wxString containing the name of the layer number "layer_number".
* @param layer_number the layer number of the layer
* @param is_filename if TRUE, the name can be used for a file name (not internatinalized, no space)
*/
wxString
ReturnPcbLayerName
(
int
layer_number
,
bool
is_filename
=
FALSE
);
#ifdef __MSVC__ // compilers that does not have the round function (posix)
/* return the near rounded (like the equivalent integer value) from aNumber
*/
double
round
(
double
aNumber
);
#endif
/**************/
/**************/
/* DRAWTXT.CPP */
/* DRAWTXT.CPP */
...
...
include/macros.h
View file @
07767585
...
@@ -15,46 +15,71 @@
...
@@ -15,46 +15,71 @@
#ifndef MIN
#ifndef MIN
#define MIN( x, y )
( (x) > (y) ? (y) : (x) )
#define MIN( x, y ) ( (x) > (y) ? (y) : (x) )
#endif
#endif
#ifndef MAX
#ifndef MAX
#define MAX( x, y )
( (x) > (y) ? (x) : (y) )
#define MAX( x, y ) ( (x) > (y) ? (x) : (y) )
#endif
#endif
#ifndef ABS
#ifndef ABS
#define ABS( y )
( (y) >= 0 ? (y) : ( -(y) ) )
#define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) )
#endif
#endif
#define DEG2RAD( Deg )
( (Deg) * M_PI / 180.0 )
#define DEG2RAD( Deg ) ( (Deg) * M_PI / 180.0 )
#define RAD2DEG( Rad )
( (Rad) * 180.0 / M_PI )
#define RAD2DEG( Rad ) ( (Rad) * 180.0 / M_PI )
/* Normalize angle to be in the -360.0 .. 360.0 range or 0 .. 360.0: */
/* Normalize angle to be in the -360.0 .. 360.0 range or 0 .. 360.0: */
#define NORMALIZE_ANGLE( Angle )
{ while( Angle < 0 ) \
#define NORMALIZE_ANGLE( Angle ) { while( Angle < 0 ) \
Angle += 3600;\
Angle += 3600;\
while( Angle > 3600 ) \
while( Angle > 3600 ) \
Angle -= 3600; }
Angle -= 3600; }
/* Normalize angle to be in the 0.0 .. 360.0 range: */
/* Normalize angle to be in the 0.0 .. 360.0 range: */
#define NORMALIZE_ANGLE_POS( Angle )
{ while( Angle < 0 ) \
#define NORMALIZE_ANGLE_POS( Angle ) { while( Angle < 0 ) \
Angle += 3600;while( Angle >= 3600 ) \
Angle += 3600;while( Angle >= 3600 ) \
Angle -= 3600; }
Angle -= 3600; }
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \
{ Angle = -Angle; while( Angle < 0 ) \
{ Angle = -Angle; while( Angle < 0 ) \
Angle += 3600;while( Angle >= 3600 ) \
Angle += 3600;while( Angle >= 3600 ) \
Angle -= 3600; }
Angle -= 3600; }
/* Normalize angle to be in the -90.0 .. 90.0 range */
/* Normalize angle to be in the -90.0 .. 90.0 range */
#define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \
#define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \
Angle += 1800;\
Angle += 1800;\
while( Angle > 900 ) \
while( Angle > 900 ) \
Angle -= 1800; }
Angle -= 1800; }
/****************************************/
/*****************************/
/* inline functions to exchange 2 items */
/* macro to exchange 2 items */
/****************************************/
/*****************************/
#define EXCHG( a, b ) { typeof(a) __temp__ = (a); (a) = (b); (b) = __temp__; }
/* this macro uses the typeof keyword
* for compilers that do not know typeof (MSVC )
* the boost libs have a workaround for the typeof problem
*/
#ifdef __MSVC__ // MSCV does not know typeof. Others def can be added here
#include "boost/typeof/typeof.hpp"
// we have to register the types used with the typeof keyword with boost
BOOST_TYPEOF_REGISTER_TYPE
(
wxPoint
);
BOOST_TYPEOF_REGISTER_TYPE
(
wxSize
);
BOOST_TYPEOF_REGISTER_TYPE
(
wxString
);
class
DrawSheetLabelStruct
;
BOOST_TYPEOF_REGISTER_TYPE
(
DrawSheetLabelStruct
*
);
class
EDA_BaseStruct
;
BOOST_TYPEOF_REGISTER_TYPE
(
EDA_BaseStruct
*
);
class
D_PAD
;
BOOST_TYPEOF_REGISTER_TYPE
(
D_PAD
*
);
BOOST_TYPEOF_REGISTER_TYPE
(
const
D_PAD
*
);
class
BOARD_ITEM
;
BOOST_TYPEOF_REGISTER_TYPE
(
BOARD_
ITEM
*
);
#define typeof (expr)BOOST_TYPEOF( expr )
#endif // #ifdef __MSVC__
// here is the macro:
#define EXCHG( a, b ) { typeof(a)__temp__ = (a); (a) = (b); (b) = __temp__; }
/*****************************************************/
/*****************************************************/
...
@@ -62,7 +87,7 @@
...
@@ -62,7 +87,7 @@
/*****************************************************/
/*****************************************************/
static
inline
void
ADD_MENUITEM
(
wxMenu
*
menu
,
int
id
,
static
inline
void
ADD_MENUITEM
(
wxMenu
*
menu
,
int
id
,
const
wxString
&
text
,
const
wxString
&
text
,
const
wxBitmap
&
icon
)
const
wxBitmap
&
icon
)
{
{
wxMenuItem
*
l_item
;
wxMenuItem
*
l_item
;
...
@@ -88,8 +113,8 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
...
@@ -88,8 +113,8 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
int
id
,
const
wxString
&
text
,
int
id
,
const
wxString
&
text
,
const
wxBitmap
&
icon
)
const
wxBitmap
&
icon
)
{
{
extern
wxFont
*
g_ItalicFont
;
extern
wxFont
*
g_ItalicFont
;
wxMenuItem
*
l_item
;
wxMenuItem
*
l_item
;
l_item
=
new
wxMenuItem
(
menu
,
id
,
text
);
l_item
=
new
wxMenuItem
(
menu
,
id
,
text
);
l_item
->
SetSubMenu
(
submenu
);
l_item
->
SetSubMenu
(
submenu
);
...
@@ -98,15 +123,15 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
...
@@ -98,15 +123,15 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
menu
->
Append
(
l_item
);
menu
->
Append
(
l_item
);
};
};
static
inline
void
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
wxMenu
*
menu
,
static
inline
void
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
wxMenu
*
menu
,
wxMenu
*
submenu
,
wxMenu
*
submenu
,
int
id
,
int
id
,
const
wxString
&
text
,
const
wxString
&
text
,
const
wxString
&
help
,
const
wxString
&
help
,
const
wxBitmap
&
icon
)
const
wxBitmap
&
icon
)
{
{
extern
wxFont
*
g_ItalicFont
;
extern
wxFont
*
g_ItalicFont
;
wxMenuItem
*
l_item
;
wxMenuItem
*
l_item
;
l_item
=
new
wxMenuItem
(
menu
,
id
,
text
,
help
);
l_item
=
new
wxMenuItem
(
menu
,
id
,
text
,
help
);
l_item
->
SetSubMenu
(
submenu
);
l_item
->
SetSubMenu
(
submenu
);
...
@@ -134,7 +159,7 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
...
@@ -134,7 +159,7 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
int
id
,
int
id
,
const
wxString
&
text
,
const
wxString
&
text
,
const
wxString
&
help
,
const
wxString
&
help
,
const
wxBitmap
&
icon
)
const
wxBitmap
&
icon
)
{
{
wxMenuItem
*
l_item
;
wxMenuItem
*
l_item
;
...
...
kicad/CMakeLists.txt
View file @
07767585
add_definitions
(
-DKICAD
)
add_definitions
(
-DKICAD
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
Boost_INCLUDE_DIR
}
)
set
(
KICAD_SRCS
set
(
KICAD_SRCS
buildmnu.cpp
buildmnu.cpp
commandframe.cpp
commandframe.cpp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment