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
7a5386a1
Commit
7a5386a1
authored
Feb 26, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes and cleanup
parent
4343eb5b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
69 deletions
+77
-69
base_units.cpp
common/base_units.cpp
+26
-15
build_version.cpp
common/build_version.cpp
+2
-2
string.cpp
common/string.cpp
+0
-17
plot_schematic_SVG.cpp
eeschema/plot_schematic_SVG.cpp
+0
-1
symbdraw.cpp
eeschema/symbdraw.cpp
+8
-1
base_units.h
include/base_units.h
+8
-0
dcsvg.h.unused
include/dcsvg.h.unused
+0
-0
kicad_string.h
include/kicad_string.h
+0
-8
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+7
-17
dialog_SVG_print.cpp
pcbnew/dialogs/dialog_SVG_print.cpp
+0
-1
set_grid.cpp
pcbnew/set_grid.cpp
+26
-7
No files found.
common/base_units.cpp
View file @
7a5386a1
...
@@ -124,6 +124,31 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils )
...
@@ -124,6 +124,31 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils )
return
text
;
return
text
;
}
}
/* Remove trailing 0 from a string containing a converted float number.
* the trailing 0 are removed if the mantissa has more
* than aTrailingZeroAllowed digits and some trailing 0
*/
void
StripTrailingZeros
(
wxString
&
aStringValue
,
unsigned
aTrailingZeroAllowed
)
{
struct
lconv
*
lc
=
localeconv
();
char
sep
=
lc
->
decimal_point
[
0
];
unsigned
sep_pos
=
aStringValue
.
Find
(
sep
);
if
(
sep_pos
>
0
)
{
// We want to keep at least aTrailingZeroAllowed digits after the separator
unsigned
min_len
=
sep_pos
+
aTrailingZeroAllowed
+
1
;
while
(
aStringValue
.
Len
()
>
min_len
)
{
if
(
aStringValue
.
Last
()
==
'0'
)
aStringValue
.
RemoveLast
();
else
break
;
}
}
}
/* Convert a value to a string using double notation.
/* Convert a value to a string using double notation.
* For readability, the mantissa has 3 or more digits (max 8 digits),
* For readability, the mantissa has 3 or more digits (max 8 digits),
...
@@ -153,21 +178,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
...
@@ -153,21 +178,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
// Strip trailing zeros. However, keep at least 3 digits in mantissa
// Strip trailing zeros. However, keep at least 3 digits in mantissa
// For readability
// For readability
struct
lconv
*
lc
=
localeconv
();
StripTrailingZeros
(
stringValue
,
3
);
char
sep
=
lc
->
decimal_point
[
0
];
unsigned
sep_pos
=
stringValue
.
Find
(
sep
);
if
(
sep_pos
>
0
)
{
// We want to keep at least 3 digits after the separator
unsigned
min_len
=
sep_pos
+
4
;
while
(
stringValue
.
Len
()
>
min_len
)
if
(
stringValue
.
Last
()
==
'0'
)
stringValue
.
RemoveLast
();
else
break
;
}
#endif
#endif
if
(
aAddUnitSymbol
)
if
(
aAddUnitSymbol
)
...
...
common/build_version.cpp
View file @
7a5386a1
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
#ifndef KICAD_BUILD_VERSION
#ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST
#if defined KICAD_GOST
# define KICAD_BUILD_VERSION "(2013-feb-2
1
GOST)"
# define KICAD_BUILD_VERSION "(2013-feb-2
6
GOST)"
#else
#else
# define KICAD_BUILD_VERSION "(2013-feb-2
1
)"
# define KICAD_BUILD_VERSION "(2013-feb-2
6
)"
#endif
#endif
#endif
#endif
...
...
common/string.cpp
View file @
7a5386a1
...
@@ -304,23 +304,6 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
...
@@ -304,23 +304,6 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
}
}
char
*
to_point
(
char
*
Text
)
{
char
*
line
=
Text
;
if
(
Text
==
NULL
)
return
NULL
;
for
(
;
*
Text
!=
0
;
Text
++
)
{
if
(
*
Text
==
','
)
*
Text
=
'.'
;
}
return
line
;
}
int
RefDesStringCompare
(
const
wxString
&
strFWord
,
const
wxString
&
strSWord
)
int
RefDesStringCompare
(
const
wxString
&
strFWord
,
const
wxString
&
strSWord
)
{
{
// The different sections of the first string
// The different sections of the first string
...
...
eeschema/plot_schematic_SVG.cpp
View file @
7a5386a1
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <class_sch_screen.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <wxEeschemaStruct.h>
#include <dcsvg.h>
#include <base_units.h>
#include <base_units.h>
#include <libeditframe.h>
#include <libeditframe.h>
#include <sch_sheet_path.h>
#include <sch_sheet_path.h>
...
...
eeschema/symbdraw.cpp
View file @
7a5386a1
...
@@ -290,7 +290,14 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
...
@@ -290,7 +290,14 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
SetCursor
(
wxCURSOR_HAND
);
SetCursor
(
wxCURSOR_HAND
);
TempCopyComponent
();
TempCopyComponent
();
// For fields only, move the anchor point of the field
// to the cursor position to allow user to see the text justification
if
(
m_drawItem
->
Type
()
==
LIB_FIELD_T
)
m_drawItem
->
BeginEdit
(
IS_MOVED
,
m_drawItem
->
GetPosition
()
);
else
m_drawItem
->
BeginEdit
(
IS_MOVED
,
GetScreen
()
->
GetCrossHairPosition
(
true
)
);
m_drawItem
->
BeginEdit
(
IS_MOVED
,
GetScreen
()
->
GetCrossHairPosition
(
true
)
);
m_canvas
->
SetMouseCapture
(
RedrawWhileMovingCursor
,
AbortSymbolTraceOn
);
m_canvas
->
SetMouseCapture
(
RedrawWhileMovingCursor
,
AbortSymbolTraceOn
);
m_canvas
->
CallMouseCapture
(
DC
,
wxDefaultPosition
,
true
);
m_canvas
->
CallMouseCapture
(
DC
,
wxDefaultPosition
,
true
);
}
}
...
...
include/base_units.h
View file @
7a5386a1
...
@@ -37,6 +37,14 @@
...
@@ -37,6 +37,14 @@
#include <common.h>
#include <common.h>
#include <convert_to_biu.h>
#include <convert_to_biu.h>
/**
* Function StripTrailingZeros
* Remove trailing 0 from a string containing a converted float number.
* The trailing 0 are removed if the mantissa has more
* than aTrailingZeroAllowed digits and some trailing 0
*/
void
StripTrailingZeros
(
wxString
&
aStringValue
,
unsigned
aTrailingZeroAllowed
=
1
);
/**
/**
* Function To_User_Unit
* Function To_User_Unit
...
...
include/dcsvg.h
→
include/dcsvg.h
.unused
View file @
7a5386a1
File moved
include/kicad_string.h
View file @
7a5386a1
...
@@ -98,14 +98,6 @@ bool WildCompareString( const wxString& pattern,
...
@@ -98,14 +98,6 @@ bool WildCompareString( const wxString& pattern,
const
wxString
&
string_to_tst
,
const
wxString
&
string_to_tst
,
bool
case_sensitive
=
true
);
bool
case_sensitive
=
true
);
/**
* Function to_point
* converts a string used to compensate for internalization of printf(). It generates
* floating point numbers with a comma instead of point.
* @deprecated Use SetLocaleTo_C_standard instead.
*/
char
*
to_point
(
char
*
Text
);
/**
/**
* Function RefDesStringCompare
* Function RefDesStringCompare
* acts just like the strcmp function but treats numbers within the string text
* acts just like the strcmp function but treats numbers within the string text
...
...
pcbnew/basepcbframe.cpp
View file @
7a5386a1
...
@@ -761,16 +761,13 @@ void PCB_BASE_FRAME::updateGridSelectBox()
...
@@ -761,16 +761,13 @@ void PCB_BASE_FRAME::updateGridSelectBox()
m_gridSelectBox
->
Clear
();
m_gridSelectBox
->
Clear
();
wxString
msg
;
wxString
msg
;
wxString
format
=
_
(
"Grid"
);
wxString
format
=
_
(
"Grid
:
"
);
switch
(
g_UserUnit
)
switch
(
g_UserUnit
)
{
{
case
INCHES
:
case
INCHES
:
// the grid size is displayed in mils
format
+=
wxT
(
" %.1f"
);
break
;
case
MILLIMETRES
:
case
MILLIMETRES
:
format
+=
wxT
(
" %.
4
f"
);
format
+=
wxT
(
" %.
6
f"
);
break
;
break
;
case
UNSCALED_UNITS
:
case
UNSCALED_UNITS
:
...
@@ -782,20 +779,13 @@ void PCB_BASE_FRAME::updateGridSelectBox()
...
@@ -782,20 +779,13 @@ void PCB_BASE_FRAME::updateGridSelectBox()
{
{
GRID_TYPE
&
grid
=
GetScreen
()
->
GetGrid
(
i
);
GRID_TYPE
&
grid
=
GetScreen
()
->
GetGrid
(
i
);
double
value
=
To_User_Unit
(
g_UserUnit
,
grid
.
m_Size
.
x
);
double
value
=
To_User_Unit
(
g_UserUnit
,
grid
.
m_Size
.
x
);
if
(
g_UserUnit
==
INCHES
)
value
*=
1000
;
if
(
grid
.
m_Id
!=
ID_POPUP_GRID_USER
)
if
(
grid
.
m_Id
!=
ID_POPUP_GRID_USER
)
{
{
switch
(
g_UserUnit
)
{
case
INCHES
:
msg
.
Printf
(
format
.
GetData
(),
value
*
1000
);
break
;
case
MILLIMETRES
:
case
UNSCALED_UNITS
:
msg
.
Printf
(
format
.
GetData
(),
value
);
msg
.
Printf
(
format
.
GetData
(),
value
);
break
;
StripTrailingZeros
(
msg
);
}
}
}
else
else
msg
=
_
(
"User Grid"
);
msg
=
_
(
"User Grid"
);
...
...
pcbnew/dialogs/dialog_SVG_print.cpp
View file @
7a5386a1
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include <appl_wxstruct.h>
#include <appl_wxstruct.h>
#include <common.h>
#include <common.h>
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <dcsvg.h>
#include <wxBasePcbFrame.h>
#include <wxBasePcbFrame.h>
#include <class_pcb_screen.h>
#include <class_pcb_screen.h>
#include <base_units.h>
#include <base_units.h>
...
...
pcbnew/set_grid.cpp
View file @
7a5386a1
...
@@ -2,6 +2,28 @@
...
@@ -2,6 +2,28 @@
* @file set_grid.cpp
* @file set_grid.cpp
* @brief Manage user grid.
* @brief Manage user grid.
*/
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 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
* 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 <common.h>
#include <common.h>
...
@@ -83,9 +105,9 @@ void DIALOG_SET_GRID::SetGridSize( const wxRealPoint& grid )
...
@@ -83,9 +105,9 @@ void DIALOG_SET_GRID::SetGridSize( const wxRealPoint& grid )
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
wxT
(
"%.
4
f"
),
grid
.
x
);
msg
.
Printf
(
wxT
(
"%.
6
f"
),
grid
.
x
);
m_OptGridSizeX
->
SetValue
(
msg
);
m_OptGridSizeX
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"%.
4
f"
),
grid
.
y
);
msg
.
Printf
(
wxT
(
"%.
6
f"
),
grid
.
y
);
m_OptGridSizeY
->
SetValue
(
msg
);
m_OptGridSizeY
->
SetValue
(
msg
);
}
}
...
@@ -138,11 +160,8 @@ void DIALOG_SET_GRID::SetGridOrigin( const wxPoint& grid )
...
@@ -138,11 +160,8 @@ void DIALOG_SET_GRID::SetGridOrigin( const wxPoint& grid )
void
DIALOG_SET_GRID
::
SetGridForFastSwitching
(
wxArrayString
aGrids
,
int
aGrid1
,
int
aGrid2
)
void
DIALOG_SET_GRID
::
SetGridForFastSwitching
(
wxArrayString
aGrids
,
int
aGrid1
,
int
aGrid2
)
{
{
for
(
wxArrayString
::
iterator
i
=
aGrids
.
begin
();
i
!=
aGrids
.
end
();
i
++
)
m_comboBoxGrid1
->
Append
(
aGrids
);
{
m_comboBoxGrid2
->
Append
(
aGrids
);
m_comboBoxGrid1
->
Append
(
*
i
);
m_comboBoxGrid2
->
Append
(
*
i
);
}
m_comboBoxGrid1
->
SetSelection
(
aGrid1
);
m_comboBoxGrid1
->
SetSelection
(
aGrid1
);
m_comboBoxGrid2
->
SetSelection
(
aGrid2
);
m_comboBoxGrid2
->
SetSelection
(
aGrid2
);
...
...
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