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
790e0ef3
Commit
790e0ef3
authored
11 years ago
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReturnStringFromValue() refinements
parent
1b5a1b74
teardrops
master
review
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
base_screen.cpp
common/base_screen.cpp
+1
-1
base_units.cpp
common/base_units.cpp
+22
-2
class_base_screen.h
include/class_base_screen.h
+4
-4
No files found.
common/base_screen.cpp
View file @
790e0ef3
...
...
@@ -337,7 +337,7 @@ wxPoint BASE_SCREEN::getCrossHairScreenPosition() const
void
BASE_SCREEN
::
setCrossHairPosition
(
const
wxPoint
&
aPosition
,
const
wxPoint
&
aGridOrigin
,
bool
aSnapToGrid
)
{
if
(
aSnapToGrid
)
m_crossHairPosition
=
getNearestGridPosition
(
aPosition
,
aGridOrigin
);
m_crossHairPosition
=
getNearestGridPosition
(
aPosition
,
aGridOrigin
,
NULL
);
else
m_crossHairPosition
=
aPosition
;
}
...
...
This diff is collapsed.
Click to expand it.
common/base_units.cpp
View file @
790e0ef3
...
...
@@ -209,8 +209,28 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
StripTrailingZeros
(
stringValue
,
3
);
#else
std
::
string
s
=
Double2Str
(
value_to_print
);
wxString
stringValue
=
FROM_UTF8
(
s
.
c_str
()
);
char
buf
[
50
];
int
len
;
if
(
value_to_print
!=
0.0
&&
fabs
(
value_to_print
)
<=
0.0001
)
{
len
=
sprintf
(
buf
,
"%.10f"
,
value_to_print
);
while
(
--
len
>
0
&&
buf
[
len
]
==
'0'
)
buf
[
len
]
=
'\0'
;
if
(
buf
[
len
]
==
'.'
||
buf
[
len
]
==
','
)
buf
[
len
]
=
'\0'
;
else
++
len
;
}
else
{
len
=
sprintf
(
buf
,
"%.10g"
,
value_to_print
);
}
wxString
stringValue
(
buf
,
wxConvUTF8
);
#endif
...
...
This diff is collapsed.
Click to expand it.
include/class_base_screen.h
View file @
790e0ef3
...
...
@@ -102,7 +102,7 @@ private:
* @param aInvertY Inverts the Y axis position.
* @return The cross hair position in drawing coordinates.
*/
wxPoint
getCrossHairPosition
(
bool
aInvertY
=
false
)
const
wxPoint
getCrossHairPosition
(
bool
aInvertY
)
const
{
if
(
aInvertY
)
return
wxPoint
(
m_crossHairPosition
.
x
,
-
m_crossHairPosition
.
y
);
...
...
@@ -119,7 +119,7 @@ private:
* \a aPosition.
*
*/
void
setCrossHairPosition
(
const
wxPoint
&
aPosition
,
const
wxPoint
&
aGridOrigin
,
bool
aSnapToGrid
=
true
);
void
setCrossHairPosition
(
const
wxPoint
&
aPosition
,
const
wxPoint
&
aGridOrigin
,
bool
aSnapToGrid
);
/**
* Function getCursorScreenPosition
...
...
@@ -138,7 +138,7 @@ private:
* @return The nearst grid position.
*/
wxPoint
getNearestGridPosition
(
const
wxPoint
&
aPosition
,
const
wxPoint
&
aGridOrigin
,
wxRealPoint
*
aGridSize
=
NULL
)
const
;
wxRealPoint
*
aGridSize
)
const
;
/**
* Function getCursorPosition
...
...
@@ -149,7 +149,7 @@ private:
* if \a aOnGrid is true.
* @return The current cursor position.
*/
wxPoint
getCursorPosition
(
bool
aOnGrid
,
const
wxPoint
&
aGridOrigin
,
wxRealPoint
*
aGridSize
=
NULL
)
const
;
wxPoint
getCursorPosition
(
bool
aOnGrid
,
const
wxPoint
&
aGridOrigin
,
wxRealPoint
*
aGridSize
)
const
;
void
setMousePosition
(
const
wxPoint
&
aPosition
)
{
m_MousePosition
=
aPosition
;
}
...
...
This diff is collapsed.
Click to expand it.
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